Hi, CFFI Developers
I'm sorry to point this again. LispWorks 5.0 already support long-long
foreign type,
but their FOREIGN-TYPED-AREF doesn't support 64bit yet. So a patch is
necessary, like attach.
Thanks.
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_lispworks.dpatch by <binghe(a)localhost.localdomain>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad cffi-20070901~/src/cffi-lispworks.lisp cffi-20070901/src/cffi-lispworks.lisp
--- cffi-20070901~/src/cffi-lispworks.lisp 2007-09-22 16:19:19.000000000 +0800
+++ cffi-20070901/src/cffi-lispworks.lisp 2007-09-22 16:20:03.000000000 +0800
@@ -65,12 +65,14 @@
(eval-when (:compile-toplevel :load-toplevel :execute)
(mapc (lambda (feature) (pushnew feature *features*))
'(;; Backend mis-features.
+ #-lispworks5
cffi-features:no-long-long
;; OS/CPU features.
#+darwin cffi-features:darwin
#+unix cffi-features:unix
#+win32 cffi-features:windows
#+harp::pc386 cffi-features:x86
+ #+harp::amd64 cffi-features:x86-64
#+harp::powerpc cffi-features:ppc32
)))
@@ -163,6 +165,10 @@
(:unsigned-int '(:unsigned :int))
(:long :long)
(:unsigned-long '(:unsigned :long))
+ #+lispworks5
+ (:long-long '(:long :long))
+ #+lispworks5
+ (:unsigned-long-long '(:unsigned :long :long))
(:float :float)
(:double :double)
(:pointer :pointer)
@@ -170,7 +176,7 @@
;;; Convert a CFFI type keyword to a symbol suitable for passing to
;;; FLI:FOREIGN-TYPED-AREF.
-#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))
+#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and lispworks-32bit) '(or))
(defun convert-foreign-typed-aref-type (cffi-type)
(ecase cffi-type
((:char :short :int :long)
@@ -188,7 +194,7 @@
;;; In LispWorks versions where FLI:FOREIGN-TYPED-AREF is fbound, use
;;; it instead of FLI:DEREFERENCE in the optimizer for %MEM-REF.
-#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))
+#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and lispworks-32bit) '(or))
(define-compiler-macro %mem-ref (&whole form ptr type &optional (off 0))
(if (constantp type)
(let ((type (eval type)))
@@ -204,7 +210,7 @@
;;; Open-code the call to FLI:DEREFERENCE when TYPE is constant at
;;; macroexpansion time, when FLI:FOREIGN-TYPED-AREF is not available.
-#-#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))
+#-#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and lispworks-32bit) '(or))
(define-compiler-macro %mem-ref (&whole form ptr type &optional (off 0))
(if (constantp type)
(let ((ptr-form (if (eql off 0) ptr `(inc-pointer ,ptr ,off)))
@@ -220,7 +226,7 @@
;;; In LispWorks versions where FLI:FOREIGN-TYPED-AREF is fbound, use
;;; it instead of FLI:DEREFERENCE in the optimizer for %MEM-SET.
-#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))
+#+#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and lispworks-32bit) '(or))
(define-compiler-macro %mem-set (&whole form val ptr type &optional (off 0))
(if (constantp type)
(once-only (val)
@@ -239,7 +245,7 @@
;;; Open-code the call to (SETF FLI:DEREFERENCE) when TYPE is constant
;;; at macroexpansion time.
-#-#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and) '(or))
+#-#.(cl:if (cl:find-symbol "FOREIGN-TYPED-AREF" "FLI") '(and lispworks-32bit) '(or))
(define-compiler-macro %mem-set (&whole form val ptr type &optional (off 0))
(if (constantp type)
(once-only (val)