Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2009-02-09 21:16:10 -06:00
commit efdd9946ac
10 changed files with 64 additions and 30 deletions

2
basis/alien/arrays/arrays.factor Normal file → Executable file
View File

@ -26,7 +26,7 @@ M: array box-return drop "void*" box-return ;
M: array stack-size drop "void*" stack-size ; M: array stack-size drop "void*" stack-size ;
M: array c-type-boxer-quot drop f ; M: array c-type-boxer-quot drop [ ] ;
M: array c-type-unboxer-quot drop [ >c-ptr ] ; M: array c-type-unboxer-quot drop [ >c-ptr ] ;

26
basis/alien/c-types/c-types.factor Normal file → Executable file
View File

@ -4,7 +4,7 @@ USING: byte-arrays arrays assocs kernel kernel.private libc math
namespaces make parser sequences strings words assocs splitting namespaces make parser sequences strings words assocs splitting
math.parser cpu.architecture alien alien.accessors quotations math.parser cpu.architecture alien alien.accessors quotations
layouts system compiler.units io.files io.encodings.binary layouts system compiler.units io.files io.encodings.binary
accessors combinators effects continuations fry call ; accessors combinators effects continuations fry call classes ;
IN: alien.c-types IN: alien.c-types
DEFER: <int> DEFER: <int>
@ -13,18 +13,20 @@ DEFER: *char
: little-endian? ( -- ? ) 1 <int> *char 1 = ; foldable : little-endian? ( -- ? ) 1 <int> *char 1 = ; foldable
TUPLE: c-type TUPLE: c-type
class { class class initial: object }
boxer boxer-quot unboxer unboxer-quot boxer
getter setter { boxer-quot callable }
reg-class size align stack-align? ; unboxer
{ unboxer-quot callable }
: new-c-type ( class -- type ) { getter callable }
new { setter callable }
int-regs >>reg-class { reg-class initial: int-regs }
object >>class ; inline size
align
stack-align? ;
: <c-type> ( -- type ) : <c-type> ( -- type )
\ c-type new-c-type ; \ c-type new ;
SYMBOL: c-types SYMBOL: c-types
@ -224,7 +226,7 @@ M: f byte-length drop 0 ;
TUPLE: long-long-type < c-type ; TUPLE: long-long-type < c-type ;
: <long-long-type> ( -- type ) : <long-long-type> ( -- type )
long-long-type new-c-type ; long-long-type new ;
M: long-long-type unbox-parameter ( n type -- ) M: long-long-type unbox-parameter ( n type -- )
c-type-unboxer %unbox-long-long ; c-type-unboxer %unbox-long-long ;

15
basis/alien/structs/structs-tests.factor Normal file → Executable file
View File

@ -42,3 +42,18 @@ C-UNION: barx
[ ] [ \ foox-x "help" get execute ] unit-test [ ] [ \ foox-x "help" get execute ] unit-test
[ ] [ \ set-foox-x "help" get execute ] unit-test [ ] [ \ set-foox-x "help" get execute ] unit-test
] when ] when
C-STRUCT: nested
{ "int" "x" } ;
C-STRUCT: nested-2
{ "nested" "y" } ;
[ 4 ] [
"nested-2" <c-object>
"nested" <c-object>
4 over set-nested-x
over set-nested-2-y
nested-2-y
nested-x
] unit-test

12
basis/alien/structs/structs.factor Normal file → Executable file
View File

@ -2,10 +2,18 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs generic hashtables kernel kernel.private USING: accessors arrays assocs generic hashtables kernel kernel.private
math namespaces parser sequences strings words libc fry math namespaces parser sequences strings words libc fry
alien.c-types alien.structs.fields cpu.architecture math.order ; alien.c-types alien.structs.fields cpu.architecture math.order
quotations ;
IN: alien.structs IN: alien.structs
TUPLE: struct-type size align fields boxer-quot unboxer-quot getter setter ; TUPLE: struct-type
size
align
fields
{ boxer-quot callable }
{ unboxer-quot callable }
{ getter callable }
{ setter callable } ;
M: struct-type heap-size size>> ; M: struct-type heap-size size>> ;

7
basis/io/launcher/windows/nt/nt-tests.factor Normal file → Executable file
View File

@ -37,11 +37,12 @@ IN: io.launcher.windows.nt.tests
"out.txt" temp-file ascii file-lines first "out.txt" temp-file ascii file-lines first
] unit-test ] unit-test
[ ] [ [ "( scratchpad ) " ] [
<process> <process>
console-vm "-run=listener" 2array >>command console-vm "-run=listener" 2array >>command
+closed+ >>stdin +closed+ >>stdin
try-process +stdout+ >>stderr
ascii [ input-stream get contents ] with-process-reader
] unit-test ] unit-test
: launcher-test-path ( -- str ) : launcher-test-path ( -- str )
@ -162,3 +163,5 @@ IN: io.launcher.windows.nt.tests
"append-test" temp-file ascii file-contents "append-test" temp-file ascii file-contents
] unit-test ] unit-test

4
basis/tools/deploy/backend/backend.factor Normal file → Executable file
View File

@ -11,8 +11,8 @@ tools.deploy.config.editor bootstrap.image io.encodings.utf8
destructors accessors ; destructors accessors ;
IN: tools.deploy.backend IN: tools.deploy.backend
: copy-vm ( executable bundle-name extension -- vm ) : copy-vm ( executable bundle-name -- vm )
[ prepend-path ] dip append vm over copy-file ; prepend-path vm over copy-file ;
: copy-fonts ( name dir -- ) : copy-fonts ( name dir -- )
deploy-ui? get [ deploy-ui? get [

2
basis/tools/deploy/macosx/macosx.factor Normal file → Executable file
View File

@ -54,7 +54,7 @@ IN: tools.deploy.macosx
} cleave } cleave
] ]
[ create-app-plist ] [ create-app-plist ]
[ "Contents/MacOS/" append-path "" copy-vm ] 2tri [ "Contents/MacOS/" append-path copy-vm ] 2tri
dup OCT: 755 set-file-permissions ; dup OCT: 755 set-file-permissions ;
: deploy.app-image ( vocab bundle-name -- str ) : deploy.app-image ( vocab bundle-name -- str )

2
basis/tools/deploy/unix/unix.factor Normal file → Executable file
View File

@ -8,7 +8,7 @@ IN: tools.deploy.unix
: create-app-dir ( vocab bundle-name -- vm ) : create-app-dir ( vocab bundle-name -- vm )
dup "" copy-fonts dup "" copy-fonts
"" copy-vm copy-vm
dup OCT: 755 set-file-permissions ; dup OCT: 755 set-file-permissions ;
: bundle-name ( -- str ) : bundle-name ( -- str )

View File

@ -1,9 +1,9 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io io.files io.directories kernel namespaces sequences system USING: io io.files io.pathnames io.directories kernel namespaces
tools.deploy.backend tools.deploy.config sequences locals system splitting tools.deploy.backend
tools.deploy.config.editor assocs hashtables prettyprint tools.deploy.config tools.deploy.config.editor assocs hashtables
combinators windows.shell32 windows.user32 ; prettyprint combinators windows.shell32 windows.user32 ;
IN: tools.deploy.windows IN: tools.deploy.windows
: copy-dll ( bundle-name -- ) : copy-dll ( bundle-name -- )
@ -15,13 +15,18 @@ IN: tools.deploy.windows
"resource:zlib1.dll" "resource:zlib1.dll"
} swap copy-files-into ; } swap copy-files-into ;
:: copy-vm ( executable bundle-name extension -- vm )
vm "." split1-last drop extension append
bundle-name executable ".exe" append append-path
[ copy-file ] keep ;
: create-exe-dir ( vocab bundle-name -- vm ) : create-exe-dir ( vocab bundle-name -- vm )
dup copy-dll dup copy-dll
deploy-ui? get [ deploy-ui? get [
dup copy-freetype [ copy-freetype ]
dup "" copy-fonts [ "" copy-fonts ]
] when [ ".exe" copy-vm ] tri
".exe" copy-vm ; ] [ ".com" copy-vm ] if ;
M: winnt deploy* M: winnt deploy*
"resource:" [ "resource:" [

1
core/slots/slots.factor Normal file → Executable file
View File

@ -151,6 +151,7 @@ M: class initial-value* no-initial-value ;
{ [ array bootstrap-word over class<= ] [ { } ] } { [ array bootstrap-word over class<= ] [ { } ] }
{ [ byte-array bootstrap-word over class<= ] [ B{ } ] } { [ byte-array bootstrap-word over class<= ] [ B{ } ] }
{ [ simple-alien bootstrap-word over class<= ] [ <bad-alien> ] } { [ simple-alien bootstrap-word over class<= ] [ <bad-alien> ] }
{ [ quotation bootstrap-word over class<= ] [ [ ] ] }
[ dup initial-value* ] [ dup initial-value* ]
} cond nip ; } cond nip ;