]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.libraries: merge update-library and find-library.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 29 Mar 2016 05:49:23 +0000 (22:49 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 29 Mar 2016 05:49:23 +0000 (22:49 -0700)
basis/alien/libraries/libraries.factor
basis/gtk/ffi/ffi.factor
basis/opengl/gl/gl.factor

index 951987405f2eb575c48719eb3f31014a185ba186..4af246851e5aa8fb4e6fe5dbdeca19a44ea1a5da 100755 (executable)
@@ -57,16 +57,6 @@ M: library dispose dll>> [ dispose ] when* ;
 : same-library? ( library path abi -- ? )
     [ 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 -- )
     swap >>abi
     swap >>path
@@ -74,11 +64,13 @@ M: library dispose dll>> [ dispose ] when* ;
     [ path>> open-dll ]
     [ swap >>dlerror swap >>dll drop ] tri ;
 
-: update-library ( name path abi -- )
+: add-library ( name path abi -- )
     pick lookup-library [
         [ 2over same-library? not ] keep swap
         [ change-dll drop ] [ 4drop ] if
-    ] [ add-library ] if* ;
+    ] [
+        make-library swap libraries get set-at
+    ] if* ;
 
 : library-abi ( library -- abi )
     lookup-library [ abi>> ] [ cdecl ] if* ;
index 02face5fd9db1d6ea970e8f7fd38d518261c5fe3..b1e828bbedc31cca0db8bda5af3c5278757d82aa 100644 (file)
@@ -12,7 +12,7 @@ IN: gtk.ffi
 
 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 ;
 
index 6f404a4829a0d7be816389d66a08b5156d6b6fb5..a18f656598a7e97717aedfa36743a3232f0cc162 100644 (file)
@@ -631,7 +631,7 @@ LIBRARY: gl
 
 [
     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
 
 ! Miscellaneous