alien.inline: refactoring

db4
Jeremy Hughes 2009-07-05 21:49:31 +12:00
parent dd45949c50
commit b212588417
1 changed files with 10 additions and 10 deletions

View File

@ -34,10 +34,10 @@ SYMBOL: c-strings
: cify-type ( str -- str' ) : cify-type ( str -- str' )
{ { CHAR: - CHAR: space } } substitute ; { { CHAR: - CHAR: space } } substitute ;
: factor-function ( function types effect -- ) : factor-function ( function types effect -- word quot effect )
[ c-library get ] 3dip [ [ factorize-type ] map ] dip [ c-library get ] 3dip [ [ factorize-type ] map ] dip
types-effect>params-return factorize-type -roll types-effect>params-return factorize-type -roll
make-function define-declared ; concat make-function ;
: prototype-string ( function types effect -- str ) : prototype-string ( function types effect -- str )
[ [ cify-type ] map ] dip [ [ cify-type ] map ] dip
@ -79,14 +79,12 @@ PRIVATE>
compile-library? [ compile-library ] when compile-library? [ compile-library ] when
c-library get library-path "cdecl" add-library ; c-library get library-path "cdecl" add-library ;
: define-c-function ( function types effect -- ) : define-c-function ( function types effect -- prototype )
[ factor-function ] 3keep prototype-string [ factor-function define-declared ] 3keep prototype-string ;
append-function-body c-strings get push ;
: define-c-function' ( function effect -- ) : define-c-function' ( function effect -- prototype )
[ in>> ] keep [ factor-function ] 3keep [ in>> ] keep [ factor-function define-declared ] 3keep
out>> prototype-string' out>> prototype-string' ;
append-function-body c-strings get push ;
: define-c-link ( str -- ) : define-c-link ( str -- )
"-l" prepend compiler-args get push ; "-l" prepend compiler-args get push ;
@ -112,6 +110,8 @@ SYNTAX: C-LINK/FRAMEWORK: scan define-c-link/framework ;
SYNTAX: C-INCLUDE: scan define-c-include ; SYNTAX: C-INCLUDE: scan define-c-include ;
SYNTAX: C-FUNCTION: function-types-effect define-c-function ; SYNTAX: C-FUNCTION:
function-types-effect define-c-function
append-function-body c-strings get push ;
SYNTAX: ;C-LIBRARY compile-c-library ; SYNTAX: ;C-LIBRARY compile-c-library ;