alien.libraries: merge update-library and find-library.
parent
02956a25ce
commit
12350404f2
|
@ -57,16 +57,6 @@ M: library dispose dll>> [ dispose ] when* ;
|
||||||
: same-library? ( library path abi -- ? )
|
: same-library? ( library path abi -- ? )
|
||||||
[ swap path>> = ] [ swap abi>> = ] bi-curry* bi and ;
|
[ swap path>> = ] [ swap abi>> = ] bi-curry* bi and ;
|
||||||
|
|
||||||
: add-library? ( name path abi -- ? )
|
|
||||||
[ lookup-library ] 2dip '[ _ _ same-library? not ] [ t ] if* ;
|
|
||||||
|
|
||||||
: add-library ( name path abi -- )
|
|
||||||
3dup add-library? [
|
|
||||||
[ 2drop remove-library ]
|
|
||||||
[ [ nip ] dip make-library ]
|
|
||||||
[ 2drop libraries get set-at ] 3tri
|
|
||||||
] [ 3drop ] if ;
|
|
||||||
|
|
||||||
: change-dll ( library path abi -- )
|
: change-dll ( library path abi -- )
|
||||||
swap >>abi
|
swap >>abi
|
||||||
swap >>path
|
swap >>path
|
||||||
|
@ -74,11 +64,13 @@ M: library dispose dll>> [ dispose ] when* ;
|
||||||
[ path>> open-dll ]
|
[ path>> open-dll ]
|
||||||
[ swap >>dlerror swap >>dll drop ] tri ;
|
[ swap >>dlerror swap >>dll drop ] tri ;
|
||||||
|
|
||||||
: update-library ( name path abi -- )
|
: add-library ( name path abi -- )
|
||||||
pick lookup-library [
|
pick lookup-library [
|
||||||
[ 2over same-library? not ] keep swap
|
[ 2over same-library? not ] keep swap
|
||||||
[ change-dll drop ] [ 4drop ] if
|
[ change-dll drop ] [ 4drop ] if
|
||||||
] [ add-library ] if* ;
|
] [
|
||||||
|
make-library swap libraries get set-at
|
||||||
|
] if* ;
|
||||||
|
|
||||||
: library-abi ( library -- abi )
|
: library-abi ( library -- abi )
|
||||||
lookup-library [ abi>> ] [ cdecl ] if* ;
|
lookup-library [ abi>> ] [ cdecl ] if* ;
|
||||||
|
|
|
@ -12,7 +12,7 @@ IN: gtk.ffi
|
||||||
|
|
||||||
LIBRARY: gtk
|
LIBRARY: gtk
|
||||||
|
|
||||||
[ "gtk" "gtk-x11-2.0" find-library cdecl update-library ] "gtk" add-startup-hook
|
[ "gtk" "gtk-x11-2.0" find-library cdecl add-library ] "find-gtk" add-startup-hook
|
||||||
|
|
||||||
IMPLEMENT-STRUCTS: GtkTreeIter ;
|
IMPLEMENT-STRUCTS: GtkTreeIter ;
|
||||||
|
|
||||||
|
|
|
@ -631,7 +631,7 @@ LIBRARY: gl
|
||||||
|
|
||||||
[
|
[
|
||||||
os [ linux? ] [ macosx? not ] bi and
|
os [ linux? ] [ macosx? not ] bi and
|
||||||
[ "gl" "GL" find-library cdecl update-library ] when
|
[ "gl" "GL" find-library cdecl add-library ] when
|
||||||
] "find-gl" add-startup-hook
|
] "find-gl" add-startup-hook
|
||||||
|
|
||||||
! Miscellaneous
|
! Miscellaneous
|
||||||
|
|
Loading…
Reference in New Issue