From 12350404f241ed56abe942585663cfe38505dea3 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 28 Mar 2016 22:49:23 -0700 Subject: [PATCH] alien.libraries: merge update-library and find-library. --- basis/alien/libraries/libraries.factor | 16 ++++------------ basis/gtk/ffi/ffi.factor | 2 +- basis/opengl/gl/gl.factor | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/basis/alien/libraries/libraries.factor b/basis/alien/libraries/libraries.factor index 951987405f..4af246851e 100755 --- a/basis/alien/libraries/libraries.factor +++ b/basis/alien/libraries/libraries.factor @@ -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* ; diff --git a/basis/gtk/ffi/ffi.factor b/basis/gtk/ffi/ffi.factor index 02face5fd9..b1e828bbed 100644 --- a/basis/gtk/ffi/ffi.factor +++ b/basis/gtk/ffi/ffi.factor @@ -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 ; diff --git a/basis/opengl/gl/gl.factor b/basis/opengl/gl/gl.factor index 6f404a4829..a18f656598 100644 --- a/basis/opengl/gl/gl.factor +++ b/basis/opengl/gl/gl.factor @@ -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