diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index c25f465600..fff49a4480 100644 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -69,14 +69,6 @@ M: array resolve-pointer-type dup void? [ no-c-type ] when dup c-type-name? [ c-type ] when ; -number ] map ] dip ; - -PRIVATE> - M: word c-type dup "c-type" word-prop resolve-typedef [ ] [ no-c-type ] ?if ; diff --git a/basis/alien/libraries/authors.txt b/basis/alien/libraries/authors.txt index 1901f27a24..580f882c8d 100644 --- a/basis/alien/libraries/authors.txt +++ b/basis/alien/libraries/authors.txt @@ -1 +1,2 @@ Slava Pestov +Joe Groff diff --git a/basis/alien/libraries/libraries.factor b/basis/alien/libraries/libraries.factor index 6f80900da0..47e34fe5ff 100644 --- a/basis/alien/libraries/libraries.factor +++ b/basis/alien/libraries/libraries.factor @@ -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 ] [ 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 ; 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> diff --git a/basis/alien/parser/parser.factor b/basis/alien/parser/parser.factor index d073a4caac..8d850c47ee 100644 --- a/basis/alien/parser/parser.factor +++ b/basis/alien/parser/parser.factor @@ -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* ; : 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 ; - diff --git a/basis/stack-checker/alien/alien.factor b/basis/stack-checker/alien/alien.factor index 09121488ef..81d8a93240 100644 --- a/basis/stack-checker/alien/alien.factor +++ b/basis/stack-checker/alien/alien.factor @@ -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 index 0000000000..205e64323d --- /dev/null +++ b/basis/windows/ddk/hid/platforms.txt @@ -0,0 +1 @@ +winnt