alien.syntax: FUNCTION-ALIAS: syntax to define a C function binding with a different Factor name

release
Joe Groff 2010-04-14 12:06:45 -07:00
parent 378e0f7f6e
commit e5c1a82643
2 changed files with 15 additions and 5 deletions

View File

@ -113,13 +113,19 @@ PRIVATE>
: function-effect ( names return -- effect )
[ { } ] [ return-type-name 1array ] if-void <effect> ;
:: make-function ( return function library types names -- word quot effect )
function create-in dup reset-generic
: create-function ( name -- word )
create-in dup reset-generic ;
:: (make-function) ( return function library types names -- quot effect )
return library function types function-quot
names return function-effect ;
: (FUNCTION:) ( -- word quot effect )
scan-function-name current-library get ";" scan-c-args make-function ;
:: make-function ( return function library types names -- word quot effect )
function create-function
return function library types names (make-function) ;
: (FUNCTION:) ( -- return function library types names )
scan-function-name current-library get ";" scan-c-args ;
: callback-quot ( return types abi -- quot )
'[ [ _ _ _ ] dip alien-callback ] ;

View File

@ -16,7 +16,11 @@ SYNTAX: BAD-ALIEN <bad-alien> suffix! ;
SYNTAX: LIBRARY: scan current-library set ;
SYNTAX: FUNCTION:
(FUNCTION:) define-declared ;
(FUNCTION:) make-function define-declared ;
SYNTAX: FUNCTION-ALIAS:
scan create-function
(FUNCTION:) (make-function) define-declared ;
SYNTAX: CALLBACK:
(CALLBACK:) define-inline ;