]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge alien/parser/parser.factor
authorErik Charlebois <erikcharlebois@gmail.com>
Mon, 22 Feb 2010 18:53:19 +0000 (10:53 -0800)
committerErik Charlebois <erikcharlebois@gmail.com>
Mon, 22 Feb 2010 18:53:19 +0000 (10:53 -0800)
basis/alien/c-types/c-types.factor
basis/alien/libraries/authors.txt
basis/alien/libraries/libraries.factor
basis/alien/parser/parser.factor
basis/stack-checker/alien/alien.factor
basis/windows/ddk/hid/platforms.txt [new file with mode: 0644]

index c25f465600e31780e8c15716afbc16ed4bc1e137..fff49a44808831871d4c28bddaae6da67f17cc32 100644 (file)
@@ -69,14 +69,6 @@ M: array resolve-pointer-type
     dup void? [ no-c-type ] when
     dup c-type-name? [ c-type ] when ;
 
-<PRIVATE
-
-: parse-array-type ( name -- dims c-type )
-    "[" split unclip
-    [ [ "]" ?tail drop string>number ] map ] dip ;
-
-PRIVATE>
-
 M: word c-type
     dup "c-type" word-prop resolve-typedef
     [ ] [ no-c-type ] ?if ;
index 1901f27a24507e2512d93a1f956aaaa0d2f05714..580f882c8d78327fd1fc737a4da0624407fe0e7a 100644 (file)
@@ -1 +1,2 @@
 Slava Pestov
+Joe Groff
index 6f80900da0c54a1e72832dc58c4162e081455e73..47e34fe5fffa495699b6487b5393eece7a23d6a6 100644 (file)
@@ -1,4 +1,4 @@
-! Copyright (C) 2009 Slava Pestov.
+! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.strings assocs io.backend
 kernel namespaces destructors sequences system io.pathnames ;
@@ -9,10 +9,8 @@ IN: alien.libraries
 : dlsym ( name dll -- alien ) [ string>symbol ] dip (dlsym) ;
 
 SYMBOL: libraries
-SYMBOL: deploy-libraries
 
 libraries [ H{ } clone ] initialize
-deploy-libraries [ V{ } clone ] initialize
 
 TUPLE: library path abi dll ;
 
@@ -37,18 +35,29 @@ M: library dispose dll>> [ dispose ] when* ;
     [ 2drop remove-library ]
     [ <library> swap libraries get set-at ] 3bi ;
 
+: library-abi ( library -- abi )
+    library [ abi>> ] [ "cdecl" ] if* ;
+
+SYMBOL: deploy-libraries
+
+deploy-libraries [ V{ } clone ] initialize
+
 : deploy-library ( name -- )
     dup libraries get key?
     [ deploy-libraries get 2dup member? [ 2drop ] [ push ] if ]
     [ no-library ] if ;
 
 <PRIVATE
+
 HOOK: >deployed-library-path os ( path -- path' )
 
 M: windows >deployed-library-path
     file-name ;
+
 M: unix >deployed-library-path
     file-name "$ORIGIN" prepend-path ;
+
 M: macosx >deployed-library-path
     file-name "@executable_path/../Frameworks" prepend-path ;
+
 PRIVATE>
index d073a4caac2b9f863f394c7f6db4e777e206b098..8d850c47eea8500b6542452ae16fb063c0770cb4 100644 (file)
@@ -66,16 +66,16 @@ IN: alien.parser
         2 group [ first2 normalize-c-arg 2array ] map
         unzip [ "," ?tail drop ] map
     ]
-    [ dup "void" = [ drop { } ] [ 1array ] if ]
+    [ [ { } ] [ name>> 1array ] if-void ]
     bi* <effect> ;
 
 : function-quot ( return library function types -- quot )
     '[ _ _ _ _ alien-invoke ] ;
 
 :: make-function ( return library function parameters -- word quot effect )
-    return function normalize-c-arg :> ( return-c-type function )
+    return function normalize-c-arg :> ( return function )
     function create-in dup reset-generic
-    return-c-type library function
+    return library function
     parameters return parse-arglist [ function-quot ] dip ;
 
 : parse-arg-tokens ( -- tokens )
@@ -88,10 +88,7 @@ IN: alien.parser
     make-function define-declared ;
 
 : callback-quot ( return types abi -- quot )
-    [ [ ] 3curry dip alien-callback ] 3curry ;
-
-: library-abi ( lib -- abi )
-    library [ abi>> ] [ "cdecl" ] if* ;
+    '[ [ _ _ _ ] dip alien-callback ] ;
 
 :: make-callback-type ( lib return type-name parameters -- word quot effect )
     return type-name normalize-c-arg :> ( return-c-type type-name )
@@ -115,4 +112,3 @@ PREDICATE: alien-function-word < word
 
 PREDICATE: alien-callback-type-word < typedef-word
     "callback-effect" word-prop ;
-
index 09121488ef89730d23134d7e1b09d68b5ad5d511..81d8a93240dfc2ce867f3bfd0fdf9222671ae718 100644 (file)
@@ -59,7 +59,7 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
     pop-library
     pop-return
     ! Set ABI
-    dup library>> library [ abi>> ] [ "cdecl" ] if* >>abi
+    dup library>> library-abi >>abi
     ! Quotation which coerces parameters to required types
     dup infer-params
     ! Magic #: consume exactly the number of inputs
diff --git a/basis/windows/ddk/hid/platforms.txt b/basis/windows/ddk/hid/platforms.txt
new file mode 100644 (file)
index 0000000..205e643
--- /dev/null
@@ -0,0 +1 @@
+winnt