Merge branch 'master' of git://factorcode.org/git/factor
commit
dd15816bad
13
Makefile
13
Makefile
|
@ -3,6 +3,7 @@ AR = ar
|
|||
LD = ld
|
||||
|
||||
EXECUTABLE = factor
|
||||
CONSOLE_EXECUTABLE = factor_console
|
||||
VERSION = 0.92
|
||||
|
||||
IMAGE = factor.image
|
||||
|
@ -138,9 +139,16 @@ zlib1.dll:
|
|||
|
||||
winnt-x86-32: freetype6.dll zlib1.dll
|
||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
||||
$(MAKE) $(CONSOLE_EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.32
|
||||
$(MAKE) winnt-finish
|
||||
|
||||
winnt-x86-64:
|
||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
|
||||
$(MAKE) $(CONSOLE_EXECUTABLE) CONFIG=vm/Config.windows.nt.x86.64
|
||||
$(MAKE) winnt-finish
|
||||
|
||||
winnt-finish:
|
||||
cp misc/factor-cygwin.sh ./factor
|
||||
|
||||
wince-arm:
|
||||
$(MAKE) $(EXECUTABLE) CONFIG=vm/Config.windows.ce.arm
|
||||
|
@ -161,6 +169,11 @@ factor: $(DLL_OBJS) $(EXE_OBJS)
|
|||
$(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
|
||||
$(CFLAGS) -o $@$(EXE_SUFFIX)$(EXE_EXTENSION) $(EXE_OBJS)
|
||||
|
||||
factor_console: $(DLL_OBJS) $(EXE_OBJS)
|
||||
$(LINKER) $(ENGINE) $(DLL_OBJS)
|
||||
$(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \
|
||||
$(CFLAGS) $(CFLAGS_CONSOLE) -o $(EXECUTABLE)$(EXE_SUFFIX)$(CONSOLE_EXE_EXTENSION) $(EXE_OBJS)
|
||||
|
||||
clean:
|
||||
rm -f vm/*.o
|
||||
rm -f factor*.dll libfactor.{a,so,dylib}
|
||||
|
|
|
@ -13,7 +13,7 @@ IN: compiler.cfg.alias-analysis.tests
|
|||
|
||||
[ ] [
|
||||
{
|
||||
T{ ##load-indirect f V int-regs 1 "hello" }
|
||||
T{ ##load-reference f V int-regs 1 "hello" }
|
||||
T{ ##slot-imm f V int-regs 0 V int-regs 1 0 3 }
|
||||
} alias-analysis drop
|
||||
] unit-test
|
||||
|
|
|
@ -224,7 +224,7 @@ GENERIC: analyze-aliases* ( insn -- insn' )
|
|||
M: ##load-immediate analyze-aliases*
|
||||
dup [ val>> ] [ dst>> ] bi constants get set-at ;
|
||||
|
||||
M: ##load-indirect analyze-aliases*
|
||||
M: ##load-reference analyze-aliases*
|
||||
dup dst>> set-heap-ac ;
|
||||
|
||||
M: ##alien-global analyze-aliases*
|
||||
|
|
|
@ -36,13 +36,13 @@ TUPLE: ##alien-setter < ##effect { value vreg } ;
|
|||
|
||||
! Stack operations
|
||||
INSN: ##load-immediate < ##pure { val integer } ;
|
||||
INSN: ##load-indirect < ##pure obj ;
|
||||
INSN: ##load-reference < ##pure obj ;
|
||||
|
||||
GENERIC: ##load-literal ( dst value -- )
|
||||
|
||||
M: fixnum ##load-literal tag-fixnum ##load-immediate ;
|
||||
M: f ##load-literal drop \ f tag-number ##load-immediate ;
|
||||
M: object ##load-literal ##load-indirect ;
|
||||
M: object ##load-literal ##load-reference ;
|
||||
|
||||
INSN: ##peek < ##read { loc loc } ;
|
||||
INSN: ##replace < ##write { loc loc } ;
|
||||
|
|
|
@ -39,8 +39,6 @@ GENERIC: >expr ( insn -- expr )
|
|||
|
||||
M: ##load-immediate >expr val>> <constant> ;
|
||||
|
||||
M: ##load-indirect >expr obj>> <constant> ;
|
||||
|
||||
M: ##unary >expr
|
||||
[ class ] [ src>> vreg>vn ] bi unary-expr boa ;
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ sequences ;
|
|||
|
||||
[
|
||||
{
|
||||
T{ ##load-indirect f V int-regs 1 + }
|
||||
T{ ##load-reference f V int-regs 1 + }
|
||||
T{ ##peek f V int-regs 2 D 0 }
|
||||
T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc> }
|
||||
T{ ##compare f V int-regs 6 V int-regs 2 V int-regs 1 cc> }
|
||||
|
@ -89,7 +89,7 @@ sequences ;
|
|||
}
|
||||
] [
|
||||
{
|
||||
T{ ##load-indirect f V int-regs 1 + }
|
||||
T{ ##load-reference f V int-regs 1 + }
|
||||
T{ ##peek f V int-regs 2 D 0 }
|
||||
T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc> }
|
||||
T{ ##compare-imm f V int-regs 6 V int-regs 4 7 cc/= }
|
||||
|
@ -99,7 +99,7 @@ sequences ;
|
|||
|
||||
[
|
||||
{
|
||||
T{ ##load-indirect f V int-regs 1 + }
|
||||
T{ ##load-reference f V int-regs 1 + }
|
||||
T{ ##peek f V int-regs 2 D 0 }
|
||||
T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc<= }
|
||||
T{ ##compare f V int-regs 6 V int-regs 2 V int-regs 1 cc> }
|
||||
|
@ -107,7 +107,7 @@ sequences ;
|
|||
}
|
||||
] [
|
||||
{
|
||||
T{ ##load-indirect f V int-regs 1 + }
|
||||
T{ ##load-reference f V int-regs 1 + }
|
||||
T{ ##peek f V int-regs 2 D 0 }
|
||||
T{ ##compare f V int-regs 4 V int-regs 2 V int-regs 1 cc<= }
|
||||
T{ ##compare-imm f V int-regs 6 V int-regs 4 7 cc= }
|
||||
|
|
|
@ -70,8 +70,8 @@ SYMBOL: labels
|
|||
M: ##load-immediate generate-insn
|
||||
[ dst>> register ] [ val>> ] bi %load-immediate ;
|
||||
|
||||
M: ##load-indirect generate-insn
|
||||
[ dst>> register ] [ obj>> ] bi %load-indirect ;
|
||||
M: ##load-reference generate-insn
|
||||
[ dst>> register ] [ obj>> ] bi %load-reference ;
|
||||
|
||||
M: ##peek generate-insn
|
||||
[ dst>> register ] [ loc>> ] bi %peek ;
|
||||
|
|
|
@ -277,7 +277,7 @@ TUPLE: id obj ;
|
|||
[ 4 ] [ 2 [ dup fixnum* ] compile-call ] unit-test
|
||||
[ 7 ] [ 2 [ dup fixnum* 3 fixnum+fast ] compile-call ] unit-test
|
||||
|
||||
SINGLETON: cucumber
|
||||
TUPLE: cucumber ;
|
||||
|
||||
M: cucumber equal? "The cucumber has no equal" throw ;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ M: object param-reg param-regs nth ;
|
|||
HOOK: two-operand? cpu ( -- ? )
|
||||
|
||||
HOOK: %load-immediate cpu ( reg obj -- )
|
||||
HOOK: %load-indirect cpu ( reg obj -- )
|
||||
HOOK: %load-reference cpu ( reg obj -- )
|
||||
|
||||
HOOK: %peek cpu ( vreg loc -- )
|
||||
HOOK: %replace cpu ( vreg loc -- )
|
||||
|
|
|
@ -34,7 +34,7 @@ M: ppc two-operand? f ;
|
|||
|
||||
M: ppc %load-immediate ( reg n -- ) swap LOAD ;
|
||||
|
||||
M: ppc %load-indirect ( reg obj -- )
|
||||
M: ppc %load-reference ( reg obj -- )
|
||||
[ 0 swap LOAD32 ] [ rc-absolute-ppc-2/2 rel-immediate ] bi* ;
|
||||
|
||||
M: ppc %alien-global ( register symbol dll -- )
|
||||
|
@ -261,7 +261,7 @@ M:: ppc %fixnum-mul-tail ( src1 src2 temp1 temp2 -- )
|
|||
M:: ppc %integer>bignum ( dst src temp -- )
|
||||
[
|
||||
"end" define-label
|
||||
dst 0 >bignum %load-indirect
|
||||
dst 0 >bignum %load-reference
|
||||
! Is it zero? Then just go to the end and return this zero
|
||||
0 src 0 CMPI
|
||||
"end" get BEQ
|
||||
|
@ -321,7 +321,7 @@ M:: ppc %integer>float ( dst src -- )
|
|||
scratch-reg dup HEX: 8000 XORIS
|
||||
scratch-reg 1 4 scratch@ STW
|
||||
dst 1 0 scratch@ LFD
|
||||
scratch-reg 4503601774854144.0 %load-indirect
|
||||
scratch-reg 4503601774854144.0 %load-reference
|
||||
fp-scratch-reg scratch-reg float-offset LFD
|
||||
dst dst fp-scratch-reg FSUB ;
|
||||
|
||||
|
@ -488,7 +488,7 @@ M: ppc %epilogue ( n -- )
|
|||
"end" define-label
|
||||
dst \ f tag-number %load-immediate
|
||||
"end" get word execute
|
||||
dst \ t %load-indirect
|
||||
dst \ t %load-reference
|
||||
"end" get resolve-label ; inline
|
||||
|
||||
: %boolean ( dst temp cc -- )
|
||||
|
@ -637,7 +637,7 @@ M: ppc %alien-invoke ( symbol dll -- )
|
|||
[ 11 ] 2dip %alien-global 11 MTLR BLRL ;
|
||||
|
||||
M: ppc %alien-callback ( quot -- )
|
||||
3 swap %load-indirect "c_to_factor" f %alien-invoke ;
|
||||
3 swap %load-reference "c_to_factor" f %alien-invoke ;
|
||||
|
||||
M: ppc %prepare-alien-indirect ( -- )
|
||||
"unbox_alien" f %alien-invoke
|
||||
|
|
|
@ -237,7 +237,7 @@ M: x86.32 %alien-indirect ( -- )
|
|||
|
||||
M: x86.32 %alien-callback ( quot -- )
|
||||
4 [
|
||||
EAX swap %load-indirect
|
||||
EAX swap %load-reference
|
||||
EAX PUSH
|
||||
"c_to_factor" f %alien-invoke
|
||||
] with-aligned-stack ;
|
||||
|
|
|
@ -176,7 +176,7 @@ M: x86.64 %alien-indirect ( -- )
|
|||
RBP CALL ;
|
||||
|
||||
M: x86.64 %alien-callback ( quot -- )
|
||||
param-reg-1 swap %load-indirect
|
||||
param-reg-1 swap %load-reference
|
||||
"c_to_factor" f %alien-invoke ;
|
||||
|
||||
M: x86.64 %callback-value ( ctype -- )
|
||||
|
|
|
@ -21,7 +21,7 @@ HOOK: param-reg-2 cpu ( -- reg )
|
|||
|
||||
M: x86 %load-immediate MOV ;
|
||||
|
||||
M: x86 %load-indirect swap 0 MOV rc-absolute-cell rel-immediate ;
|
||||
M: x86 %load-reference swap 0 MOV rc-absolute-cell rel-immediate ;
|
||||
|
||||
HOOK: ds-reg cpu ( -- reg )
|
||||
HOOK: rs-reg cpu ( -- reg )
|
||||
|
@ -188,7 +188,7 @@ M:: x86 %integer>bignum ( dst src temp -- )
|
|||
[
|
||||
"end" define-label
|
||||
! Load cached zero value
|
||||
dst 0 >bignum %load-indirect
|
||||
dst 0 >bignum %load-reference
|
||||
src 0 CMP
|
||||
! Is it zero? Then just go to the end and return this zero
|
||||
"end" get JE
|
||||
|
|
|
@ -792,7 +792,7 @@ LIBRARY: kernel32
|
|||
! FUNCTION: AddRefActCtx
|
||||
! FUNCTION: AddVectoredExceptionHandler
|
||||
! FUNCTION: AllocateUserPhysicalPages
|
||||
! FUNCTION: AllocConsole
|
||||
FUNCTION: BOOL AllocConsole ( ) ;
|
||||
! FUNCTION: AreFileApisANSI
|
||||
! FUNCTION: AssignProcessToJobObject
|
||||
! FUNCTION: AttachConsole
|
||||
|
@ -1111,7 +1111,7 @@ FUNCTION: BOOL FindVolumeMountPointClose ( HANDLE hFindVolumeMountPoint ) ;
|
|||
! FUNCTION: FoldStringW
|
||||
! FUNCTION: FormatMessageA
|
||||
! FUNCTION: FormatMessageW
|
||||
! FUNCTION: FreeConsole
|
||||
FUNCTION: BOOL FreeConsole ( ) ;
|
||||
! FUNCTION: FreeEnvironmentStringsA
|
||||
FUNCTION: BOOL FreeEnvironmentStringsW ( LPTCH lpszEnvironmentBlock ) ;
|
||||
ALIAS: FreeEnvironmentStrings FreeEnvironmentStringsW
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
IN: xmode.code2html.tests
|
||||
USING: xmode.code2html xmode.catalog
|
||||
tools.test multiline splitting memoize
|
||||
kernel ;
|
||||
|
||||
[ ] [ \ (load-mode) reset-memoized ] unit-test
|
||||
|
||||
[ ] [
|
||||
<" <style type="text/css" media="screen" >
|
||||
* {margin:0; padding:0; border:0;} ">
|
||||
string-lines "html" htmlize-lines drop
|
||||
] unit-test
|
|
@ -236,7 +236,7 @@ find_word_size() {
|
|||
|
||||
set_factor_binary() {
|
||||
case $OS in
|
||||
winnt) FACTOR_BINARY=factor.exe;;
|
||||
winnt) FACTOR_BINARY=factor.com;;
|
||||
*) FACTOR_BINARY=factor;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
USING: help.markup help.syntax io strings arrays io.backend
|
||||
io.files.private quotations ;
|
||||
io.files.private quotations sequences ;
|
||||
IN: io.files
|
||||
|
||||
ARTICLE: "io.files" "Reading and writing files"
|
||||
|
@ -63,13 +63,13 @@ HELP: file-lines
|
|||
{ $errors "Throws an error if the file cannot be opened for reading." } ;
|
||||
|
||||
HELP: set-file-contents
|
||||
{ $values { "str" "a string" } { "path" "a pathname string" } { "encoding" "an encoding descriptor" } }
|
||||
{ $description "Sets the contents of a file to a string with the given encoding." }
|
||||
{ $values { "seq" sequence } { "path" "a pathname string" } { "encoding" "an encoding descriptor" } }
|
||||
{ $description "Sets the contents of a file to a sequence with the given encoding." }
|
||||
{ $errors "Throws an error if the file cannot be opened for writing." } ;
|
||||
|
||||
HELP: file-contents
|
||||
{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "str" "a string" } }
|
||||
{ $description "Opens the file at the given path using the given encoding, and the contents of that file as a string." }
|
||||
{ $values { "path" "a pathname string" } { "encoding" "an encoding descriptor" } { "seq" sequence } }
|
||||
{ $description "Opens the file at the given path using the given encoding, and the contents of that file as a sequence." }
|
||||
{ $errors "Throws an error if the file cannot be opened for reading." } ;
|
||||
|
||||
{ set-file-lines file-lines set-file-contents file-contents } related-words
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
USING: tools.test io.files io.files.private io.files.temp
|
||||
io.directories io.encodings.8-bit arrays make system
|
||||
io.encodings.binary io
|
||||
threads kernel continuations io.encodings.ascii sequences
|
||||
strings accessors io.encodings.utf8 math destructors namespaces
|
||||
;
|
||||
io.encodings.binary io threads kernel continuations
|
||||
io.encodings.ascii sequences strings accessors
|
||||
io.encodings.utf8 math destructors namespaces ;
|
||||
IN: io.files.tests
|
||||
|
||||
\ exists? must-infer
|
||||
|
|
|
@ -25,7 +25,7 @@ HOOK: (file-appender) io-backend ( path -- stream )
|
|||
: with-file-reader ( path encoding quot -- )
|
||||
[ <file-reader> ] dip with-input-stream ; inline
|
||||
|
||||
: file-contents ( path encoding -- str )
|
||||
: file-contents ( path encoding -- seq )
|
||||
<file-reader> contents ;
|
||||
|
||||
: with-file-writer ( path encoding quot -- )
|
||||
|
@ -34,7 +34,7 @@ HOOK: (file-appender) io-backend ( path -- stream )
|
|||
: set-file-lines ( seq path encoding -- )
|
||||
[ [ print ] each ] with-file-writer ;
|
||||
|
||||
: set-file-contents ( str path encoding -- )
|
||||
: set-file-contents ( seq path encoding -- )
|
||||
[ write ] with-file-writer ;
|
||||
|
||||
: with-file-appender ( path encoding quot -- )
|
||||
|
@ -58,4 +58,4 @@ PRIVATE>
|
|||
13 getenv cwd prepend-path \ image set-global
|
||||
14 getenv cwd prepend-path \ vm set-global
|
||||
image parent-directory "resource-path" set-global
|
||||
] "io.files" add-init-hook
|
||||
] "io.files" add-init-hook
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#! /bin/sh
|
||||
./factor.com "$@"
|
|
@ -2,6 +2,7 @@ CFLAGS += -DWINDOWS -mno-cygwin
|
|||
LIBS = -lm
|
||||
PLAF_DLL_OBJS += vm/os-windows.o
|
||||
EXE_EXTENSION=.exe
|
||||
CONSOLE_EXE_EXTENSION=.com
|
||||
DLL_EXTENSION=.dll
|
||||
LINKER = $(CC) -shared -mno-cygwin -o
|
||||
LINK_WITH_ENGINE = -l$(DLL_PREFIX)factor$(DLL_SUFFIX)
|
||||
|
|
|
@ -4,5 +4,6 @@ DLL_SUFFIX=
|
|||
PLAF_DLL_OBJS += vm/os-windows-nt.o
|
||||
PLAF_EXE_OBJS += vm/resources.o
|
||||
PLAF_EXE_OBJS += vm/main-windows-nt.o
|
||||
#CFLAGS += -mwindows
|
||||
CFLAGS += -mwindows
|
||||
CFLAGS_CONSOLE += -mconsole
|
||||
include vm/Config.windows
|
||||
|
|
|
@ -54,14 +54,4 @@ void c_to_factor_toplevel(CELL quot)
|
|||
|
||||
void open_console(void)
|
||||
{
|
||||
/*
|
||||
// Do this: http://www.cygwin.com/ml/cygwin/2007-11/msg00432.html
|
||||
if(console_open)
|
||||
return;
|
||||
|
||||
if(AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
|
||||
{
|
||||
console_open = true;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -18,5 +18,4 @@ typedef char F_SYMBOL;
|
|||
|
||||
void c_to_factor_toplevel(CELL quot);
|
||||
long exception_handler(PEXCEPTION_POINTERS pe);
|
||||
bool console_open;
|
||||
void open_console(void);
|
||||
|
|
Loading…
Reference in New Issue