2009/10/19 Luís Oliveira <luis...@gmail.com>: > On Fri, Oct 9, 2009 at 8:10 PM, Faré <fah...@gmail.com> wrote: >> Here is what I use to compile Bordeaux-Threads with XCVB. >> >> Is it possible to apply it upstream? > > I'd be more inclined to apply this if the changes could be contained > within a single file. Plus, since XCVB isn't AFAICT ready for general > consumption and none of the developers use it, it would very likely go > stale soon. > The changes could conceivably be contained in a single file, though unhappily not with the current version of XCVB. Also, it makes things noticeably harder for the Make backend if the meaning of a file depends on data in a central file shared by all - basically, you can't let Make rely on timestamps anymore, and/or you must rebuild everything when the central file changes. Which is one of the annoyances of ASDF.
Moreover, note that going stale in wholly independent of whether or not it is in a single file. The data to maintain isn't bigger or smaller in either cases - it's just in a different place. Also, because unlike simpler systems, the CFFI system definition does a lot of conditional compilation, it is not the kind of things that is fully automated by the conversion process. And so, it is much easier to merge information if the patch is applied and a few things may possibly have to be updated, than if it isn't, and the next user will have to redo the work from scratch or apply a stale patch. I think the question of which EVAL-WHENs are or aren't necessary is more damning. I admit I didn't try to understand what should be eval-when'ed where and took a shotgun approach to getting my system to work. If you are still unwilling to commit, I understand. I will "just" have to go through the pains of maintaining my mirror. An updated patch is attached. [ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] Those who place above society the power of politics and bureaucracies as solutions to all human problems ignore that when they are not all too humans, politicians and bureaucrats are oh so inhuman.
diff -rN -u old-cffi/build.xcvb new-cffi/build.xcvb --- old-cffi/build.xcvb 1969-12-31 19:00:00.000000000 -0500 +++ new-cffi/build.xcvb 2009-10-22 20:04:26.545137261 -0400 @@ -0,0 +1,19 @@ +#+xcvb +(module + (:fullname "cffi" + :description "The Common Foreign Function Interface" + :author "James Bielman <jame...@jamesjb.com>" + :version "0.10.4" + :licence "MIT" + :build-depends-on ("alexandria" "trivial-features" "babel") + :depends-on ("src/package" + "src/utils" + "src/libraries" + "src/early-types" + "src/types" + "src/enum" + "src/strings" + "src/functions" + "src/foreign-vars" + "src/features") + :supersedes-asdf ("cffi"))) diff -rN -u old-cffi/cffi.asd new-cffi/cffi.asd --- old-cffi/cffi.asd 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/cffi.asd 2009-10-22 20:04:26.545137261 -0400 @@ -25,17 +25,19 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +(in-package :asdf) + #-(or openmcl sbcl cmu scl clisp lispworks ecl allegro cormanlisp) (error "Sorry, this Lisp is not yet supported. Patches welcome!") -(defsystem cffi +(defsystem :cffi :description "The Common Foreign Function Interface" :author "James Bielman <jame...@jamesjb.com>" :version "0.10.5" :licence "MIT" - :depends-on (alexandria trivial-features babel) + :depends-on (:alexandria :trivial-features :babel) :components - ((:module src + ((:module "src" :serial t :components (#+openmcl (:file "cffi-openmcl") diff -rN -u old-cffi/src/cffi-allegro.lisp new-cffi/src/cffi-allegro.lisp --- old-cffi/src/cffi-allegro.lisp 2009-10-22 20:04:26.521140201 -0400 +++ new-cffi/src/cffi-allegro.lisp 2009-10-22 20:04:26.553137444 -0400 @@ -27,6 +27,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp) (:import-from #:alexandria #:if-let #:with-unique-names #:once-only) @@ -226,9 +228,11 @@ ;;;# Calling Foreign Functions +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type-keyword) "Return the size in bytes of a foreign type." (ff:sizeof-fobject (convert-foreign-type type-keyword))) +) ;; end EVAL-WHEN (defun %foreign-type-alignment (type-keyword) "Returns the alignment in bytes of a foreign type." diff -rN -u old-cffi/src/cffi-clisp.lisp new-cffi/src/cffi-clisp.lisp --- old-cffi/src/cffi-clisp.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/cffi-clisp.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -28,6 +28,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:alexandria) (:export @@ -92,9 +94,11 @@ (:pointer 'ffi:c-pointer) (:void nil))) +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type) "Return the size in bytes of objects having foreign type TYPE." (nth-value 0 (ffi:sizeof (convert-foreign-type type)))) +) ;; end EVAL-WHEN ;; Remind me to buy a beer for whoever made getting the alignment ;; of foreign types part of the public interface in CLisp. :-) diff -rN -u old-cffi/src/cffi-cmucl.lisp new-cffi/src/cffi-cmucl.lisp --- old-cffi/src/cffi-cmucl.lisp 2009-10-22 20:04:26.521140201 -0400 +++ new-cffi/src/cffi-cmucl.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -27,6 +27,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:alien #:c-call) (:import-from #:alexandria #:once-only #:with-unique-names #:if-let) @@ -240,11 +242,13 @@ (:pointer 'system-area-pointer) (:void 'void))) +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type-keyword) "Return the size in bytes of a foreign type." (/ (alien-internals:alien-type-bits (alien-internals:parse-alien-type (convert-foreign-type type-keyword))) 8)) +) ;; end EVAL-WHEN (defun %foreign-type-alignment (type-keyword) "Return the alignment in bytes of a foreign type." diff -rN -u old-cffi/src/cffi-corman.lisp new-cffi/src/cffi-corman.lisp --- old-cffi/src/cffi-corman.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/cffi-corman.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -31,6 +31,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:c-types) (:import-from #:alexandria #:with-unique-names) @@ -216,9 +218,11 @@ ;;;# Calling Foreign Functions +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type-keyword) "Return the size in bytes of a foreign type." (sizeof (convert-foreign-type type-keyword))) +) ;; end EVAL-WHEN ;;; Couldn't find anything in sys/ffi.lisp and the C declaration parser ;;; doesn't seem to care about alignment so we'll assume that it's the diff -rN -u old-cffi/src/cffi-ecl.lisp new-cffi/src/cffi-ecl.lisp --- old-cffi/src/cffi-ecl.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/cffi-ecl.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -27,6 +27,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:alexandria) (:export @@ -213,10 +215,12 @@ (or (third (find type-keyword +translation-table+ :key #'second)) (error "~S is not a valid CFFI type" type-keyword))) +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type-keyword) "Return the size in bytes of a foreign type." (nth-value 0 (ffi:size-of-foreign-type (cffi-type->ecl-type type-keyword)))) +) (defun %foreign-type-alignment (type-keyword) "Return the alignment in bytes of a foreign type." diff -rN -u old-cffi/src/cffi-gcl.lisp new-cffi/src/cffi-gcl.lisp --- old-cffi/src/cffi-gcl.lisp 2009-10-22 20:04:26.521140201 -0400 +++ new-cffi/src/cffi-gcl.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -41,6 +41,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:alexandria) (:export @@ -248,9 +250,11 @@ (defentry size-of (int) (int "size_of")) ;; TODO: all this is doable inside the defcfun; figure that out.. +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type-keyword) "Return the size in bytes of a foreign type." (size-of (position type-keyword +cffi-types+))) +) (defcfun "int align_of(int type)" 0 "switch (type) { diff -rN -u old-cffi/src/cffi-lispworks.lisp new-cffi/src/cffi-lispworks.lisp --- old-cffi/src/cffi-lispworks.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/cffi-lispworks.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -27,6 +27,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:cl #:alexandria) (:export @@ -256,9 +258,11 @@ ;;;# Foreign Type Operations +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type) "Return the size in bytes of a foreign type." (fli:size-of (convert-foreign-type type))) +) (defun %foreign-type-alignment (type) "Return the structure alignment in bytes of foreign type." diff -rN -u old-cffi/src/cffi-openmcl.lisp new-cffi/src/cffi-openmcl.lisp --- old-cffi/src/cffi-openmcl.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/cffi-openmcl.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -27,6 +27,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:ccl) (:import-from #:alexandria #:once-only #:if-let) @@ -60,6 +62,8 @@ (in-package #:cffi-sys) +(eval-when (:compile-toplevel :load-toplevel :execute) + ;;;# Misfeatures (pushnew 'flat-namespace *features*) @@ -310,3 +314,5 @@ "Returns a pointer to a foreign symbol NAME." (declare (ignore library)) (foreign-symbol-address (convert-external-name name))) + +);EVAL-WHEN \ No newline at end of file diff -rN -u old-cffi/src/cffi-sbcl.lisp new-cffi/src/cffi-sbcl.lisp --- old-cffi/src/cffi-sbcl.lisp 2009-10-22 20:04:26.521140201 -0400 +++ new-cffi/src/cffi-sbcl.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -27,6 +27,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:sb-alien) (:import-from #:alexandria @@ -229,6 +231,7 @@ ;;;# Calling Foreign Functions +(eval-when (:compile-toplevel :load-toplevel :execute) (defun convert-foreign-type (type-keyword) "Convert a CFFI type keyword to an SB-ALIEN type." (ecase type-keyword @@ -263,6 +266,7 @@ (/ (sb-alien-internals:alien-type-alignment (sb-alien-internals:parse-alien-type (convert-foreign-type type-keyword) nil)) 8)) +) ;; end EVAL-WHEN (defun foreign-funcall-type-and-args (args) "Return an SB-ALIEN function type for ARGS." diff -rN -u old-cffi/src/cffi-scl.lisp new-cffi/src/cffi-scl.lisp --- old-cffi/src/cffi-scl.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/cffi-scl.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -28,6 +28,8 @@ ;;;# Administrivia +#+xcvb (module ()) + (defpackage #:cffi-sys (:use #:common-lisp #:alien #:c-call) (:import-from #:alexandria #:once-only #:with-unique-names) @@ -239,12 +241,14 @@ (:pointer 'system-area-pointer) (:void 'void))) +(eval-when (:compile-toplevel :load-toplevel :execute) (defun %foreign-type-size (type-keyword) "Return the size in bytes of a foreign type." (values (truncate (alien-internals:alien-type-bits (alien-internals:parse-alien-type (convert-foreign-type type-keyword))) 8))) +) (defun %foreign-type-alignment (type-keyword) "Return the alignment in bytes of a foreign type." diff -rN -u old-cffi/src/early-types.lisp new-cffi/src/early-types.lisp --- old-cffi/src/early-types.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/early-types.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -32,6 +32,10 @@ ;;; definitions are in a separate file because they may be used in ;;; compiler macros defined later on. +#+xcvb +(module + (:depends-on ("src/utils"))) + (in-package #:cffi) ;;;# Foreign Types @@ -50,6 +54,7 @@ ;;; Type parsers, defined with DEFINE-PARSE-METHOD should return a ;;; subtype of the foreign-type class. +(eval-when (:compile-toplevel :load-toplevel :execute) (defvar *type-parsers* (make-hash-table) "Hash table of defined type parsers.") @@ -525,3 +530,4 @@ :actual-type nil) (actual-type memoized-type) (parse-type ',base-type))) memoized-type)))) +) ;; end EVAL-WHEN diff -rN -u old-cffi/src/enum.lisp new-cffi/src/enum.lisp --- old-cffi/src/enum.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/enum.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -25,6 +25,8 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb (module (:depends-on ("src/early-types"))) + (in-package #:cffi) ;;;# Foreign Constants as Lisp Keywords diff -rN -u old-cffi/src/features.lisp new-cffi/src/features.lisp --- old-cffi/src/features.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/features.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -25,6 +25,18 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ((:cond ((:featurep :openmcl) "src/cffi-openmcl") + ((:featurep :sbcl) "src/cffi-sbcl") + ((:featurep :cmu) "src/cffi-cmucl") + ((:featurep :scl) "src/cffi-scl") + ((:featurep :clisp) "src/cffi-clisp") + ((:featurep :lispworks) "src/cffi-lispworks") + ((:featurep :ecl) "src/cffi-ecl") + ((:featurep :cormanlisp) "src/cffi-corman"))))) + + (in-package #:cl-user) (eval-when (:compile-toplevel :load-toplevel :execute) diff -rN -u old-cffi/src/foreign-vars.lisp new-cffi/src/foreign-vars.lisp --- old-cffi/src/foreign-vars.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/foreign-vars.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -25,6 +25,10 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ("src/package"))) + (in-package #:cffi) ;;;# Accessing Foreign Globals diff -rN -u old-cffi/src/functions.lisp new-cffi/src/functions.lisp --- old-cffi/src/functions.lisp 2009-10-22 20:04:26.525138757 -0400 +++ new-cffi/src/functions.lisp 2009-10-22 20:04:26.557137466 -0400 @@ -26,6 +26,10 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ("src/early-types"))) + (in-package #:cffi) ;;;# Calling Foreign Functions diff -rN -u old-cffi/src/libraries.lisp new-cffi/src/libraries.lisp --- old-cffi/src/libraries.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/libraries.lisp 2009-10-22 20:04:26.561137907 -0400 @@ -26,6 +26,10 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ("src/package"))) + (in-package #:cffi) ;;;# Finding Foreign Libraries diff -rN -u old-cffi/src/package.lisp new-cffi/src/package.lisp --- old-cffi/src/package.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/package.lisp 2009-10-22 20:04:26.561137907 -0400 @@ -25,6 +25,17 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ((:cond ((:featurep :openmcl) "src/cffi-openmcl") + ((:featurep :sbcl) "src/cffi-sbcl") + ((:featurep :cmu) "src/cffi-cmucl") + ((:featurep :scl) "src/cffi-scl") + ((:featurep :clisp) "src/cffi-clisp") + ((:featurep :lispworks) "src/cffi-lispworks") + ((:featurep :ecl) "src/cffi-ecl") + ((:featurep :cormanlisp) "src/cffi-corman"))))) + (in-package #:cl-user) (defpackage #:cffi diff -rN -u old-cffi/src/strings.lisp new-cffi/src/strings.lisp --- old-cffi/src/strings.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/strings.lisp 2009-10-22 20:04:26.561137907 -0400 @@ -26,6 +26,10 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ("src/types"))) + (in-package #:cffi) ;;;# Foreign String Conversion diff -rN -u old-cffi/src/types.lisp new-cffi/src/types.lisp --- old-cffi/src/types.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/types.lisp 2009-10-22 20:04:26.561137907 -0400 @@ -26,6 +26,10 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb +(module + (:depends-on ("src/early-types"))) + (in-package #:cffi) ;;;# Built-In Types diff -rN -u old-cffi/src/utils.lisp new-cffi/src/utils.lisp --- old-cffi/src/utils.lisp 2009-10-22 20:04:26.529136614 -0400 +++ new-cffi/src/utils.lisp 2009-10-22 20:04:26.561137907 -0400 @@ -25,6 +25,8 @@ ;;; DEALINGS IN THE SOFTWARE. ;;; +#+xcvb (module (:depends-on ("src/package"))) + (in-package #:cffi) (defmacro discard-docstring (body-var &optional force) @@ -33,6 +35,7 @@ `(when (and (stringp (car ,body-var)) (or ,force (cdr ,body-var))) (pop ,body-var))) +(eval-when (:compile-toplevel :load-toplevel :execute) (defun single-bit-p (integer) "Answer whether INTEGER, which must be an integer, is a single set twos-complement bit." @@ -65,3 +68,4 @@ (defun warn-obsolete-argument (old-arg new-arg) (warn 'obsolete-argument-warning :old-arg old-arg :new-arg new-arg)) +) ;; end EVAL-WHEN
_______________________________________________ cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel