]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.syntax: FUNCTION-ALIAS: syntax to define a C function binding with a different...
authorJoe Groff <arcata@gmail.com>
Wed, 14 Apr 2010 19:06:45 +0000 (12:06 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 14 Apr 2010 19:06:45 +0000 (12:06 -0700)
basis/alien/parser/parser.factor
basis/alien/syntax/syntax.factor

index 7b677c3581a185772f5875a1894fa6e37ce6318e..27c3024056bca0636b47b3a3e46704da0a32449d 100755 (executable)
@@ -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 ] ;
index bc7e590cff1ec2df09d86476f34b9a7df5e2bf1c..41aed994461ddddb22c8c3c1226d3e44b79594bc 100755 (executable)
@@ -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 ;