[elephant-cvs] CVS update: elephant/src/sleepycat.lisp

blee at common-lisp.net blee at common-lisp.net
Thu Sep 2 07:18:09 UTC 2004


Update of /project/elephant/cvsroot/elephant/src
In directory common-lisp.net:/tmp/cvs-serv18343/src

Modified Files:
	sleepycat.lisp 
Log Message:
openmcl, errors on library load failure

Date: Thu Sep  2 09:18:08 2004
Author: blee

Index: elephant/src/sleepycat.lisp
diff -u elephant/src/sleepycat.lisp:1.7 elephant/src/sleepycat.lisp:1.8
--- elephant/src/sleepycat.lisp:1.7	Mon Aug 30 23:36:54 2004
+++ elephant/src/sleepycat.lisp	Thu Sep  2 09:18:08 2004
@@ -85,21 +85,29 @@
   ;; This one worked for me.  There are known issues with
   ;; Red Hat and Berkeley DB, search google.
   #+linux
-  (uffi:load-foreign-library "/lib/tls/libpthread.so.0" :module "pthread")
-
-  ;; Sleepycat: this works on linux
-  #-bsd
-  (uffi:load-foreign-library "/usr/local/BerkeleyDB.4.2/lib/libdb.so" 
-			     :module "sleepycat")
-  ;; this works on FreeBSD
-  #+bsd
-  (uffi:load-foreign-library "/usr/local/lib/db42/libdb.so" 
-			     :module "sleepycat")
+  (unless 
+      (uffi:load-foreign-library "/lib/tls/libpthread.so.0" :module "pthread")
+    (error "Couldn't load libpthread!"))
+
+  (unless
+      (uffi:load-foreign-library 
+       ;; Sleepycat: this works on linux
+       #+linux
+       "/usr/local/BerkeleyDB.4.2/lib/libdb.so" 
+       ;; this works on FreeBSD
+       #+(or bsd freebsd)
+       "/usr/local/lib/db42/libdb.so" 
+       #+darwin
+       "/usr/local/BerkeleyDB.4.2/lib/libdb.dylib"
+       :module "sleepycat")
+    (error "Couldn't load libdb (Sleepycat)!"))
 
   ;; Libsleepycat.so: edit this
-  (uffi:load-foreign-library 
-   "/usr/local/share/common-lisp/elephant/libsleepycat.so" 
-   :module "libsleepycat")
+  (unless
+      (uffi:load-foreign-library 
+       "/usr/local/share/common-lisp/elephant-0.1/libsleepycat.so" 
+       :module "libsleepycat")
+    (error "Couldn't load libsleepycat!"))
 
   ;; fini on user editable part
 
@@ -107,7 +115,7 @@
   (def-type pointer-void :pointer-void)
   (def-foreign-type array-or-pointer-char
       #+allegro (:array :char)
-      #+(or cmu sbcl scl) (* :char))
+      #+(or cmu sbcl scl openmcl) (* :char))
   (def-type array-or-pointer-char array-or-pointer-char)
   (def-enum DBTYPE ((:BTREE 1) :HASH :QUEUE :RECNO :UNKNOWN))
 )
@@ -171,8 +179,8 @@
 (defconstant DB_LOCK_NOTGRANTED -30994)
 (defconstant DB_NOTFOUND        -30990)
 
-(defconstant +NULL-VOID+ (make-null-pointer :void))
-(defconstant +NULL-CHAR+ (make-null-pointer :char))
+(defvar +NULL-VOID+ (make-null-pointer :void))
+(defvar +NULL-CHAR+ (make-null-pointer :char))
 
 
 ;; Buffer management / pointer arithmetic
@@ -273,7 +281,7 @@
 	   (dynamic-extent src dest length))
   (multiple-value-bind (ivector disp)
       (ccl::array-data-and-offset src)
-    (ccl::%copy-ivector-to-ptr src (+ disp src-offset)
+    (ccl::%copy-ivector-to-ptr ivector (+ disp src-offset)
 			       dest dest-offset length)))
 
 ;; Lisp version, for kicks.  this assumes 8-bit chars!
@@ -858,7 +866,7 @@
 				   (type boolean txn-nosync txn-sync)))
 
 (defmacro with-transaction ((&key transaction environment
-				  (parent '*current-transaction*)
+				  (parent *current-transaction*)
 				  (retries 100)
 				  dirty-read txn-nosync
 				  txn-nowait txn-sync)
@@ -934,12 +942,18 @@
   (gen :unsigned-int)
   (mode DB-LOCKMODE))
 
+#+openmcl
+(ccl:def-foreign-type DB-LOCK (:struct DB-LOCK))
+
 (def-struct DB-LOCKREQ
     (op DB-LOCKOP)
   (mode DB-LOCKMODE)
   (timeout :unsigned-int)
   (obj (:array :char))
   (lock (* DB-LOCK)))
+
+#+openmcl
+(ccl:def-foreign-type DB-LOCKREQ (:struct DB-LOCKREQ))
 
 (def-function ("db_txn_id" %db-transaction-id)
     ((transaction :pointer-void))





More information about the Elephant-cvs mailing list