I'm a glutton for punishment:
. latest darcs cffi source code (about an hour old) . latest stable clisp (January 2006, cygwin version) . cygwin (latest version) hosted on windows xp sp2 . mysql 4.1.12 . latest clsql 3.6.1 (a few hours old)
I'm trying to get all of these to play nice but the clsql tutorial example (clsql-tutorial-mysql.lisp) dies during compilation of clsql/db-mysql/mysql-api.lisp. The trace is below. I'm using uffi-compat.lisp.
I'm trying to load "ctm" which is just a link to the clsql example file clsql-tutorial-mysql.lisp. *compile-print* and *load-print* are turned on for greater viewing pleasure.
I'm aware clsql doesn't officially support clisp (especially on windows) but I'm hoping somebody got this to work. All the DLLs load.
Can anybody tell me whether this is a cffi or a clsql or a platform issue? Please holler if there's more info I can provide.
Thanks
P.S. I tried SBCL but it's still too unstable on windows.
I believe the first struct (in mysql-api.lisp) is being compiled when the error occurs. This is what the def-struct macro / NOTICE-FOREIGN-STRUCT-DEFINITION function is choking on:
(uffi:def-struct mysql-net (vio :pointer-void) (fd mysql-socket) (fcntl :int) (buff (* :unsigned-char)) (buff-end (* :unsigned-char)) (write-pos (* :unsigned-char)) (read-pos (* :unsigned-char)) (last-error (:array :char 200)) (last-errno :unsigned-int) (max-packet :unsigned-int) (timeout :unsigned-int) (pkt-nr :unsigned-int) (error mysql-bool) (return-errno mysql-bool) (compress mysql-bool) (no-send-ok mysql-bool) (remain-in-buf :unsigned-long) (length :unsigned-long) (buf-length :unsigned-long) (where-b :unsigned-long) (return-status (* :unsigned-int)) (reading-or-writing :unsigned-char) (save-char :char))
... ;; Loaded file /usr/local/asdf-install/site/clsql-3.6.1/db-mysql/mysql-client-info.fas ;; Compiling file /usr/local/asdf-install/site/clsql-3.6.1/db-mysql/mysql-api.lisp ... ; (IN-PACKAGE #:MYSQL) ; (CFFI-UFFI-COMPAT:DEF-FOREIGN-TYPE MYSQL-SOCKET :INT) ; (CFFI-UFFI-COMPAT:DEF-FOREIGN-TYPE MYSQL-BOOL :BYTE) ; (CFFI-UFFI-COMPAT:DEF-FOREIGN-TYPE MYSQL-BYTE :UNSIGNED-CHAR) ; (CFFI-UFFI-COMPAT:DEF-ENUM MYSQL-NET-TYPE (:TCP-IP :SOCKET :NAMED-PIPE)) ; (CFFI-UFFI-COMPAT:DEF-STRUCT MYSQL-NET (VIO :POINTER-VOID) ...) *** - NO-APPLICABLE-METHOD: When calling #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE> with arguments (NIL), no method is applicable. The following restarts are available: RETRY :R1 try calling CFFI::CANONICALIZE again RETURN :R2 specify return values RETRY :R3 Retry performing #<ASDF:COMPILE-OP NIL #x007A79CD> on #<ASDF:CL-SOURCE-FILE "mysql-api" #x008BA485>. ACCEPT :R4 Continue, treating #<ASDF:COMPILE-OP NIL #x007A79CD> on #<ASDF:CL-SOURCE-FILE "mysql-api" #x008BA485> as having been successful. SKIP :R5 skip (CASE *TUTORIAL-DATABASE-TYPE* # ...) STOP :R6 stop loading file /usr/local/asdf-install/site/clsql-3.6.1/examples/clsql-tutorial-mysql.lisp SKIP :R7 skip (LOAD ctm) STOP :R8 stop loading file /home/Lou_Vanek/.clisprc.lisp ABORT :R9 ABORT Break 1 MYSQL[2]> :bt1 <1> #<SYSTEM-FUNCTION EXT:SHOW-STACK> 3 <2> #<COMPILED-FUNCTION SYSTEM::PRINT-BACKTRACE> <3> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE> <4> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE-1> <5> #<SYSTEM-FUNCTION SYSTEM::READ-EVAL-PRINT> 2 <6> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2-2> <7> #<SYSTEM-FUNCTION SYSTEM::SAME-ENV-AS> 2 <8> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2> <9> #<SYSTEM-FUNCTION SYSTEM::DRIVER> - #<CLOS:METHOD-CALL-TYPE-ERROR #x006BFBC9> - NIL <10> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP> - #<CLOS:METHOD-CALL-TYPE-ERROR #x006BFBC9> <11> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1 frame binding variables (~ = dynamically): | ~ SYSTEM::*PRIN-STREAM* <--> #<UNBOUND> frame binding variables (~ = dynamically): | ~ *PRINT-READABLY* <--> NIL frame binding variables (~ = dynamically): | ~ *PRINT-ESCAPE* <--> T - #<CLOS:METHOD-CALL-TYPE-ERROR #x006BFBC9> <12> #<SYSTEM-FUNCTION ERROR> frame binding variables (~ = dynamically): | ~ SYSTEM::*CONDITION-RESTARTS* <--> NIL frame binding variables (~ = dynamically): | ~ SYSTEM::*ACTIVE-RESTARTS* <--> (#S(RESTART :NAME ASDF:RETRY :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<FUNCTION :LAMBDA (&REST SYSTEM::ARGUMENTS) (SETQ #:G3623 SYSTEM::ARGUMENTS) (GO #:G3620)> :REPORT #<FUNCTION :LAMBDA (ASDF::S) (FORMAT ASDF::S "~@<Retry performing ~S on ~S.~@:>" ASDF::OP ASDF:COMPONENT)> :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T) #S(RESTART :NAME ASDF:ACCEPT :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<FUNCTION :LAMBDA (&REST SYSTEM::ARGUMENTS) (SETQ #:G3623 SYSTEM::ARGUMENTS) (GO #:G3621)> :REPORT #<FUNCTION :LAMBDA (ASDF::S) (FORMAT ASDF::S "~@<Continue, treating ~S on ~S as ~ having been successful.~@:>" ASDF::OP ASDF:COMPONENT)> :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T) #S(RESTART :NAME SYSTEM::SKIP :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-1> :REPORT #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-2> :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T) #S(RESTART :NAME SYSTEM::STOP :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-3> :REPORT #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-4> :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T) #S(RESTART :NAME SYSTEM::SKIP :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-1> :REPORT #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-2> :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T) #S(RESTART :NAME SYSTEM::STOP :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-3> :REPORT #<COMPILED-FUNCTION SYSTEM::EVAL-LOADED-FORM-4> :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T) #S(RESTART :NAME ABORT :TEST #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-TEST> :INVOKE-TAG NIL :INVOKE-FUNCTION #<COMPILED-FUNCTION SYSTEM::MAIN-LOOP-1-1> :REPORT NIL :INTERACTIVE #<COMPILED-FUNCTION SYSTEM::DEFAULT-RESTART-INTERACTIVE> :MEANINGFULP T)) compiled tagbody frame for #(NIL NIL) - 93 - 107 - #(#(NIL #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE>) NIL) - #(NIL #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE>) - #<COMPILED-FUNCTION SYSTEM::RETRY-FUNCTION-CALL> - (NIL) - #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE> - #<CLOS:METHOD-CALL-TYPE-ERROR #x006BFBC9> <13> #<COMPILED-FUNCTION SYSTEM::RETRY-FUNCTION-CALL> - 0 - (#<STANDARD-METHOD (#<STANDARD-CLASS CFFI::FOREIGN-STRUCT-TYPE>)> #<STANDARD-METHOD (#<STANDARD-CLASS CFFI::FOREIGN-TYPE-ALIAS>)> #<STANDARD-METHOD (#<STANDARD-CLASS CFFI::FOREIGN-POINTER-TYPE>)> #<STANDARD-METHOD (#<STANDARD-CLASS CFFI::FOREIGN-BUILT-IN-TYPE>)>) - #<COMPILED-FUNCTION #:|87 107 (DEFGENERIC NO-APPLICABLE-METHOD (GF &REST ARGS) ...)-9-1|> - (NIL) - #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE> <14> #<COMPILED-FUNCTION #:|87 107 (DEFGENERIC NO-APPLICABLE-METHOD (GF &REST ARGS) ...)-9-1|> <15> #<STANDARD-GENERIC-FUNCTION NO-APPLICABLE-METHOD> <16> #<STANDARD-GENERIC-FUNCTION NO-APPLICABLE-METHOD> - NO-APPLICABLE-METHOD - #<COMPILED-FUNCTION CLOS::NO-METHOD-CALLER-1> - (NIL) <17> #<COMPILED-FUNCTION CLOS::NO-METHOD-CALLER-1> <18> #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE> - #<COMPILED-FUNCTION #:|267 269 (DEFMETHOD CANONICALIZE (#) ...)-41-1-1|> - #<CFFI-UFFI-COMPAT::UFFI-ARRAY-TYPE #:ANONYMOUS-CFFI-TYPE7352> <19> #<COMPILED-FUNCTION #:|267 269 (DEFMETHOD CANONICALIZE (#) ...)-41-1-1|> <20> #<STANDARD-GENERIC-FUNCTION CFFI::CANONICALIZE> - #<COMPILED-FUNCTION CFFI::CANONICALIZE-FOREIGN-TYPE> - (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200) <21> #<COMPILED-FUNCTION CFFI::CANONICALIZE-FOREIGN-TYPE> - NIL - 1 - NIL - (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200) - LAST-ERROR - (LAST-ERROR (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200)) - ((LAST-ERROR (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200)) (LAST-ERRNO :UNSIGNED-INT) (MAX-PACKET :UNSIGNED-INT) (TIMEOUT :UNSIGNED-INT) (PKT-NR :UNSIGNED-INT) (ERROR MYSQL-BOOL) (RETURN-ERRNO MYSQL-BOOL) (COMPRESS MYSQL-BOOL) (NO-SEND-OK MYSQL-BOOL) (REMAIN-IN-BUF :UNSIGNED-LONG) (LENGTH :UNSIGNED-LONG) (BUF-LENGTH :UNSIGNED-LONG) (WHERE-B :UNSIGNED-LONG) (RETURN-STATUS :POINTER) (READING-OR-WRITING (CFFI-UFFI-COMPAT::UFFI-CHAR :UNSIGNED-CHAR)) (SAVE-CHAR (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR))) - NIL - 4 - 28 - #<CFFI::FOREIGN-STRUCT-TYPE MYSQL-NET> - NIL - NIL - MYSQL-NET - (MYSQL-NET) - #<COMPILED-FUNCTION CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION> - ((VIO :POINTER) (FD MYSQL-SOCKET) (FCNTL :INT) (BUFF :POINTER) (BUFF-END :POINTER) (WRITE-POS :POINTER) (READ-POS :POINTER) (LAST-ERROR (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200)) (LAST-ERRNO :UNSIGNED-INT) (MAX-PACKET :UNSIGNED-INT) (TIMEOUT :UNSIGNED-INT) (PKT-NR :UNSIGNED-INT) (ERROR MYSQL-BOOL) (RETURN-ERRNO MYSQL-BOOL) (COMPRESS MYSQL-BOOL) (NO-SEND-OK MYSQL-BOOL) (REMAIN-IN-BUF :UNSIGNED-LONG) (LENGTH :UNSIGNED-LONG) (BUF-LENGTH :UNSIGNED-LONG) (WHERE-B :UNSIGNED-LONG) (RETURN-STATUS :POINTER) (READING-OR-WRITING (CFFI-UFFI-COMPAT::UFFI-CHAR :UNSIGNED-CHAR)) (SAVE-CHAR (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR))) - MYSQL-NET <22> #<COMPILED-FUNCTION CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION> - #<COMPILED-FUNCTION CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION> EVAL frame for form (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION 'MYSQL-NET '((VIO :POINTER) (FD MYSQL-SOCKET) (FCNTL :INT) (BUFF :POINTER) (BUFF-END :POINTER) (WRITE-POS :POINTER) (READ-POS :POINTER) (LAST-ERROR (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200)) (LAST-ERRNO :UNSIGNED-INT) (MAX-PACKET :UNSIGNED-INT) (TIMEOUT :UNSIGNED-INT) (PKT-NR :UNSIGNED-INT) (ERROR MYSQL-BOOL) (RETURN-ERRNO MYSQL-BOOL) (COMPRESS MYSQL-BOOL) (NO-SEND-OK MYSQL-BOOL) (REMAIN-IN-BUF :UNSIGNED-LONG) (LENGTH :UNSIGNED-LONG) (BUF-LENGTH :UNSIGNED-LONG) (WHERE-B :UNSIGNED-LONG) (RETURN-STATUS :POINTER) (READING-OR-WRITING (CFFI-UFFI-COMPAT::UFFI-CHAR :UNSIGNED-CHAR)) (SAVE-CHAR (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR)))) - NIL <23> #<SPECIAL-OPERATOR PROGN> EVAL frame for form (PROGN (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION 'MYSQL-NET '((VIO :POINTER) (FD MYSQL-SOCKET) (FCNTL :INT) (BUFF :POINTER) (BUFF-END :POINTER) (WRITE-POS :POINTER) (READ-POS :POINTER) (LAST-ERROR (CFFI-UFFI-COMPAT::UFFI-ARRAY (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR) 200)) (LAST-ERRNO :UNSIGNED-INT) (MAX-PACKET :UNSIGNED-INT) (TIMEOUT :UNSIGNED-INT) (PKT-NR :UNSIGNED-INT) (ERROR MYSQL-BOOL) (RETURN-ERRNO MYSQL-BOOL) (COMPRESS MYSQL-BOOL) (NO-SEND-OK MYSQL-BOOL) (REMAIN-IN-BUF :UNSIGNED-LONG) (LENGTH :UNSIGNED-LONG) (BUF-LENGTH :UNSIGNED-LONG) (WHERE-B :UNSIGNED-LONG) (RETURN-STATUS :POINTER) (READING-OR-WRITING (CFFI-UFFI-COMPAT::UFFI-CHAR :UNSIGNED-CHAR)) (SAVE-CHAR (CFFI-UFFI-COMPAT::UFFI-CHAR :CHAR))))) frame binding environments VAR_ENV <--> #<ADDRESS #x1918084C> FUN_ENV <--> #(NEXT-METHOD-P #<FUNCTION-MACRO #<FUNCTION NEXT-METHOD-P (SYSTEM::<MACRO-FORM> SYSTEM::<ENV-ARG>) (DECLARE (CONS SYSTEM::<MACRO-FORM>)) (DECLARE (IGNORE SYSTEM::<ENV-ARG>)) (IF (> (EXT:LIST-LENGTH-DOTTED SYSTEM::<MACRO-FORM>) 1) (SYSTEM::MACRO-CALL-ERROR SYSTEM::<MACRO-FORM>) (LET* NIL (BLOCK NEXT-METHOD-P '#:G3549)))> #<FUNCTION NEXT-METHOD-P NIL #:G3549>> CALL-NEXT-METHOD #<FUNCTION-MACRO #<FUNCTION CALL-NEXT-METHOD (SYSTEM::<MACRO-FORM> SYSTEM::<ENV-ARG>) (DECLARE (CONS SYSTEM::<MACRO-FORM>)) (DECLARE (IGNORE SYSTEM::<ENV-ARG>)) (LET* ((CLOS::NEW-ARG-EXPRS (CDR SYSTEM::<MACRO-FORM>))) (BLOCK CALL-NEXT-METHOD (IF CLOS::NEW-ARG-EXPRS (LIST 'IF '(EVAL-WHEN (EVAL) T) (LIST 'CLOS::%CALL-NEXT-METHOD '#:G3548 '#:G3549 (LIST 'LIST '#:G3550 '#:G3551) (CONS 'LIST CLOS::NEW-ARG-EXPRS)) (LIST 'IF '#:G3549 (LIST* 'FUNCALL '#:G3549 CLOS::NEW-ARG-EXPRS) (LIST* 'CLOS::%NO-NEXT-METHOD '#:G3548 CLOS::NEW-ARG-EXPRS))) (LIST 'IF '#:G3549 (LIST 'FUNCALL '#:G3549 '#:G3550 '#:G3551) (LIST 'CLOS::%NO-NEXT-METHOD '#:G3548 '#:G3550 '#:G3551)))))> #<FUNCTION CALL-NEXT-METHOD (&REST CLOS::NEW-ARGS) (IF CLOS::NEW-ARGS (IF (EVAL-WHEN (EVAL) T) (CLOS::%CALL-NEXT-METHOD #:G3548 #:G3549 (LIST #:G3550 #:G3551) CLOS::NEW-ARGS) (IF #:G3549 (APPLY #:G3549 CLOS::NEW-ARGS) (APPLY #'CLOS::%NO-NEXT-METHOD #:G3548 CLOS::NEW-ARGS))) (IF #:G3549 (FUNCALL #:G3549 #:G3550 #:G3551) (CLOS::%NO-NEXT-METHOD #:G3548 #:G3550 #:G3551)))>> NIL) BLOCK_ENV <--> NIL GO_ENV <--> NIL DECL_ENV <--> ((DECLARATION OPTIMIZE DECLARATION)) <24> #<SYSTEM-FUNCTION EVAL> - (PROGN (CFFI::NOTICE-FOREIGN-STRUCT-DEFINITION 'MYSQL-NET ...
this patch fixes cffi (today's darcs) so that it can work with clsql 3.6.1 and clisp 2.38 and run example/clsql-tutorial-mysql.lisp against mysql 4.1.12 on cygwin. This patch may be slightly off since this stupid mail list doesn't accept posts wider than 80 chars.
diff -urN --exclude '*.lib' --exclude '*.fas' --exclude files cffi.clean/src/early-types.lisp cffi/src/early-types.lisp --- cffi.clean/src/early-types.lisp 2006-05-20 08:35:15.083847000 -0400 +++ cffi/src/early-types.lisp 2006-05-20 08:47:59.708847000 -0400 @@ -266,7 +266,10 @@
(defmethod canonicalize ((type foreign-type-alias)) "Return the built-in type keyword for TYPE." - (canonicalize (actual-type type))) + (let ((atype (actual-type type))) + (if (null atype) + (format *standard-error* "WARNING! null base-type.") + (canonicalize atype))))
(defmethod aggregatep ((type foreign-type-alias)) "Return true if TYPE's actual type is aggregate." diff -urN --exclude '*.lib' --exclude '*.fas' --exclude files cffi.clean/src/utils.lisp cffi/src/utils.lisp --- cffi.clean/src/utils.lisp 2006-05-20 08:35:15.130722000 -0400 +++ cffi/src/utils.lisp 2006-05-20 09:06:14.990097000 -0400 @@ -39,7 +39,8 @@ #:let-when #:bif #:post-incf - #:single-bit-p)) + #:single-bit-p + #:getenv))
(in-package #:cffi-utils)
@@ -166,6 +167,21 @@ do (setf integer (ash integer -1)) finally (return (zerop (ash integer -1))))))
+;; Taken from UFFI's src/os.lisp +(defun getenv (var) + "Return the value of the environment variable." + #+allegro (sys::getenv (string var)) + #+clisp (sys::getenv (string var)) + #+(or cmu scl) (cdr (assoc (string var) ext:*environment-list* + :test #'equalp :key #'string)) + #+gcl (si:getenv (string var)) + #+lispworks (lw:environment-variable (string var)) + #+lucid (lcl:environment-variable (string var)) + #+mcl (ccl::getenv var) + #+sbcl (sb-ext:posix-getenv var) + #-(or allegro clisp cmu scl gcl lispworks lucid mcl sbcl) + (error 'not-implemented :proc (list 'getenv var))) + ;(defun deprecation-warning (bad-name &optional good-name) ; (warn "using deprecated ~S~@[, should use ~S instead~]" ; bad-name diff -urN --exclude '*.lib' --exclude '*.fas' --exclude files cffi.clean/uffi-compat/uffi-compat.lisp cffi/uffi-compat/uffi-compat.lisp --- cffi.clean/uffi-compat/uffi-compat.lisp 2006-05-20 08:35:15.068222000 -0400 +++ cffi/uffi-compat/uffi-compat.lisp 2006-05-20 09:06:27.255722000 -0400 @@ -90,7 +90,6 @@ #:foreign-library-types
;; os - #:getenv #:run-shell-command ))
@@ -135,7 +134,7 @@ (:documentation "UFFI's :array type."))
(defmethod initialize-instance :after ((self uffi-array-type) &key) - (setf (cffi::actual-type self) (cffi::find-type :pointer))) + (setf (cffi::actual-type self) (cffi::parse-type :pointer)))
(defmethod cffi:foreign-type-size ((type uffi-array-type)) (* (cffi:foreign-type-size (element-type type)) (nelems type))) @@ -143,7 +142,7 @@ (defmethod cffi::aggregatep ((type uffi-array-type)) t)
-(cffi::define-type-spec-parser uffi-array (element-type count) +(cffi::define-type-spec-parser uffi-array (element-type &optional count) (make-instance 'uffi-array-type :element-type element-type :nelems (or count 1)))
@@ -508,20 +507,6 @@ (push filename *loaded-libraries*) t))))
-;; Taken from UFFI's src/os.lisp -(defun getenv (var) - "Return the value of the environment variable." - #+allegro (sys::getenv (string var)) - #+clisp (sys::getenv (string var)) - #+(or cmu scl) (cdr (assoc (string var) ext:*environment-list* :test #'equalp - :key #'string)) - #+gcl (si:getenv (string var)) - #+lispworks (lw:environment-variable (string var)) - #+lucid (lcl:environment-variable (string var)) - #+mcl (ccl::getenv var) - #+sbcl (sb-ext:posix-getenv var) - #-(or allegro clisp cmu scl gcl lispworks lucid mcl sbcl) - (error 'not-implemented :proc (list 'getenv var)))
;; Taken from UFFI's src/os.lisp ;; modified from function ASDF -- Copyright Dan Barlow and Contributors diff -urN --exclude '*.lib' --exclude '*.fas' --exclude files cffi.clean/uffi.asd cffi/uffi.asd --- cffi.clean/uffi.asd 1969-12-31 19:00:00.000000000 -0500 +++ cffi/uffi.asd 2006-05-20 09:15:36.990097000 -0400 @@ -0,0 +1,7 @@ +;;;-*- Mode: Lisp; Package: COMMON-LISP-USER -*- + +(defpackage :asdf-uffi (:use #:asdf #:cl)) +(in-package :asdf-uffi) +(defsystem uffi :depends-on (:cffi-uffi-compat)) + +;;; End file uffi.asd
On 2006-maj-20, at 15:37, Lou Vanek wrote:
+++ cffi/src/early-types.lisp 2006-05-20 08:47:59.708847000 -0400 @@ -266,7 +266,10 @@
(defmethod canonicalize ((type foreign-type-alias)) "Return the built-in type keyword for TYPE."
- (canonicalize (actual-type type)))
- (let ((atype (actual-type type)))
(if (null atype)
(format *standard-error* "WARNING! null base-type.")
(canonicalize atype))))
I'll probably put an (assert (not (null (actual-type type)))) there instead.
diff -urN --exclude '*.lib' --exclude '*.fas' --exclude files cffi.clean/src/utils.lisp cffi/src/utils.lisp --- cffi.clean/src/utils.lisp 2006-05-20 08:35:15.130722000 -0400 +++ cffi/src/utils.lisp 2006-05-20 09:06:14.990097000 -0400 @@ -39,7 +39,8 @@ #:let-when #:bif #:post-incf
#:single-bit-p))
#:single-bit-p
#:getenv))
Hmmm why are you moving GETENV into the cffi-utils package? (Hmm, maybe this package should be renamed to cffi-internal-utils).
+++ cffi/uffi-compat/uffi-compat.lisp 2006-05-20 09:06:27.255722000 -0400 @@ -90,7 +90,6 @@ #:foreign-library-types
;; os
- #:getenv #:run-shell-command ))
And why are you removing it from uffi-compat? It's part of UFFI 1.5.7 (at least).
@@ -135,7 +134,7 @@ (:documentation "UFFI's :array type."))
(defmethod initialize-instance :after ((self uffi-array-type) &key)
- (setf (cffi::actual-type self) (cffi::find-type :pointer)))
- (setf (cffi::actual-type self) (cffi::parse-type :pointer)))
Ah ha! Now there's the bug. Well spotted. Thanks. :-)
@@ -143,7 +142,7 @@ (defmethod cffi::aggregatep ((type uffi-array-type)) t)
-(cffi::define-type-spec-parser uffi-array (element-type count) +(cffi::define-type-spec-parser uffi-array (element-type &optional count) (make-instance 'uffi-array-type :element-type element-type :nelems (or count 1)))
What's the rationale behind this change? I'm guessing it has something to do with def-array-pointer, but I think there's more to it.
--- cffi.clean/uffi.asd 1969-12-31 19:00:00.000000000 -0500 +++ cffi/uffi.asd 2006-05-20 09:15:36.990097000 -0400 @@ -0,0 +1,7 @@ +;;;-*- Mode: Lisp; Package: COMMON-LISP-USER -*-
+(defpackage :asdf-uffi (:use #:asdf #:cl)) +(in-package :asdf-uffi) +(defsystem uffi :depends-on (:cffi-uffi-compat))
+;;; End file uffi.asd
A couple of people have suggested this. I don't think cffi's root directory is a good place for this. Any suggestions? Perhaps inside uffi-compat or a new contrib directoy?
Luís Oliveira wrote:
On 2006-maj-20, at 15:37, Lou Vanek wrote:
+++ cffi/src/early-types.lisp 2006-05-20 08:47:59.708847000 -0400 @@ -266,7 +266,10 @@
(defmethod canonicalize ((type foreign-type-alias)) "Return the built-in type keyword for TYPE."
- (canonicalize (actual-type type)))
- (let ((atype (actual-type type)))
(if (null atype)
(format *standard-error* "WARNING! null base-type.")
(canonicalize atype))))
I'll probably put an (assert (not (null (actual-type type)))) there instead.
I don't think you want an assert here.
There is one instance when you actually want this to be null (temporarily). The uffi-array-type class initially does not specify an actual-type until it's "initialize-instance :after" method, so I think canonicalize needs to allow null actual-types, at least until after all of the constructors have finished running. (Canonicalize is called prior to "initialize-instance :after" is invoked.)
As a possible work-around, you may want to give uffi-array-type a temporary actual-type until the real actual-type is set.
diff -urN --exclude '*.lib' --exclude '*.fas' --exclude files cffi.clean/src/utils.lisp cffi/src/utils.lisp --- cffi.clean/src/utils.lisp 2006-05-20 08:35:15.130722000 -0400 +++ cffi/src/utils.lisp 2006-05-20 09:06:14.990097000 -0400 @@ -39,7 +39,8 @@ #:let-when #:bif #:post-incf
#:single-bit-p))
#:single-bit-p
#:getenv))
Hmmm why are you moving GETENV into the cffi-utils package? (Hmm, maybe this
package should be renamed to cffi-internal-utils).
After reviewing my clsql code I think I changed the getenv call in clsql.asd. Yeah, you're right, this getenv move isn't necessary for stock clsql code.
+++ cffi/uffi-compat/uffi-compat.lisp 2006-05-20 09:06:27.255722000 -0400 @@ -90,7 +90,6 @@ #:foreign-library-types
;; os
- #:getenv #:run-shell-command ))
And why are you removing it from uffi-compat? It's part of UFFI 1.5.7 (at
least).
See above.
@@ -135,7 +134,7 @@ (:documentation "UFFI's :array type."))
(defmethod initialize-instance :after ((self uffi-array-type) &key)
- (setf (cffi::actual-type self) (cffi::find-type :pointer)))
- (setf (cffi::actual-type self) (cffi::parse-type :pointer)))
Ah ha! Now there's the bug. Well spotted. Thanks. :-)
Your welcome.
@@ -143,7 +142,7 @@ (defmethod cffi::aggregatep ((type uffi-array-type)) t)
-(cffi::define-type-spec-parser uffi-array (element-type count) +(cffi::define-type-spec-parser uffi-array (element-type &optional count) (make-instance 'uffi-array-type :element-type element-type :nelems (or count 1)))
What's the rationale behind this change? I'm guessing it has something to do
with def-array-pointer, but I think there's more to it.
This change was necessary for those times when you don't know how large the array is going to be. Specifically, for this line in mysql-api.lisp:
(uffi:def-array-pointer mysql-row (* :unsigned-char))
Otherwise, since "count" is unknown, lisp will stop with an error because the lamba list takes two arguments (element-type and count) but only element-type is known.
--- cffi.clean/uffi.asd 1969-12-31 19:00:00.000000000 -0500 +++ cffi/uffi.asd 2006-05-20 09:15:36.990097000 -0400 @@ -0,0 +1,7 @@ +;;;-*- Mode: Lisp; Package: COMMON-LISP-USER -*-
+(defpackage :asdf-uffi (:use #:asdf #:cl)) +(in-package :asdf-uffi) +(defsystem uffi :depends-on (:cffi-uffi-compat))
+;;; End file uffi.asd
A couple of people have suggested this. I don't think cffi's root directory
is a good place for this. Any suggestions? Perhaps inside uffi-compat or a new contrib directoy?
It doesn't make any difference to me as long as it isn't buried. I like the idea of putting in in uffi-compat since I would notice it there because that's one of the first places I would look for it. But I would mention this in the README, as well.
On 2006-maj-20, at 17:01, Lou Vanek wrote:
+++ cffi/src/early-types.lisp 2006-05-20 08:47:59.708847000 -0400 @@ -266,7 +266,10 @@
(defmethod canonicalize ((type foreign-type-alias)) "Return the built-in type keyword for TYPE."
- (canonicalize (actual-type type)))
- (let ((atype (actual-type type)))
(if (null atype)
(format *standard-error* "WARNING! null base-type.")
(canonicalize atype))))
I'll probably put an (assert (not (null (actual-type type)))) there instead.
I don't think you want an assert here.
I think I do, because (canonicalize nil) will signal an error anyway as mentioned in the subject.
-(cffi::define-type-spec-parser uffi-array (element-type count) +(cffi::define-type-spec-parser uffi-array (element-type &optional count)
[...]
What's the rationale behind this change? I'm guessing it has something to do with def-array-pointer, but I think there's more to it.
This change was necessary for those times when you don't know how large the array is going to be. Specifically, for this line in mysql- api.lisp:
(uffi:def-array-pointer mysql-row (* :unsigned-char))
Right. Looking at some code, it seems that UFFI's undocumented array type is in fact meant to work as (:array element-type &optional (count 1)).
I like the idea of putting in in uffi-compat since I would notice it there because that's one of the first places I would look for it. But I would mention this in the README, as well.
uffi-compat should have its own chapter in the manual, definitely. That's in the TODO list.
Luís Oliveira <luismbo <at> gmail.com> writes:
(if (null atype)
(format *standard-error* "WARNING! null base-type.")
(canonicalize atype))))
I'll probably put an (assert (not (null (actual-type type)))) there instead.
I don't think you want an assert here.
I think I do, because (canonicalize nil) will signal an error anyway as mentioned in the subject.
Actually, by throwing in that "format" (which returns nil) you short-circuit the canonicalize recursive call and you no longer get the error because you are no longer calling canonicalize with nil.
&optional count)
[...]
What's the rationale behind this change? I'm guessing it has something to do with def-array-pointer, but I think there's more to it.
This change was necessary for those times when you don't know how large the array is going to be. Specifically, for this line in mysql- api.lisp:
(uffi:def-array-pointer mysql-row (* :unsigned-char))
Right. Looking at some code, it seems that UFFI's undocumented array type is in fact meant to work as (:array element-type &optional (count 1)).
Yeah, that's what I was thinking, too.
[snip]
Jeez Louise this mailing list management software is annoying! It's complaining about too much quoted text. And top-level posting, FCS.
On 2006-maj-20, at 20:26, Lou Vanek wrote:
Actually, by throwing in that "format" (which returns nil) you short-circuit the canonicalize recursive call and you no longer get the error because you are no longer calling canonicalize with nil.
Oh, right. Even worse then.