Without this, with-pointer-to-vector-data always results in NIL, which isn't nearly as useful.
New patches:
[Return proper clisp value. David Brown lisp@davidb.org**20080210085127
with-pointer-to-vector-data wasn't returning the result of its BODY. ] { hunk ./src/cffi-clisp.lisp 240 - ,@body - ;; copy-out - (loop for i below ,size-var do - (setf (aref ,vector-var i) - (%mem-ref ,ptr-var :unsigned-char i))))))) + (unwind-protect + ,@body + ;; copy-out + (loop for i below ,size-var do + (setf (aref ,vector-var i) + (%mem-ref ,ptr-var :unsigned-char i)))))))) }
Context:
[cffi-openmcl: fix test for cffi-features:darwin Luis Oliveira loliveira@common-lisp.net**20071214010923
- Check for :darwin-target instead of :darwinppc-target. ] [Fix indentation in defctype* Luis Oliveira loliveira@common-lisp.net**20070901191050] [fix: missing eval-when tomi.borbely@gmail.com**20070625144550] [Don't discard DEFCFUN docstrings. Luis Oliveira loliveira@common-lisp.net**20070820131701
- Pass them to the underlying DEFUN or DEFMACRO. - Add tests. ] [Minor indentation fixes to cffi-allegro.lisp Luis Oliveira loliveira@common-lisp.net**20070816140803
- Also use (eval size) instead of checking for (integerp size) in the previous patch for Allegro 8.1 support. ] [Add AllegroCL 8.1 support masayuki.onjo@gmail.com**20070816035650] [Fix stdcall tests. Luis Oliveira loliveira@common-lisp.net**20070730205407] [Handle docstrings properly in DEFCFUN. Luis Oliveira loliveira@common-lisp.net**20070730060953
- DEFCFUN would complain when given a docstring but no argument list. - Add test. ] [Get rid of SBCL warnings in tests/foreign-globals.lisp Luis Oliveira loliveira@common-lisp.net**20070730022547] [Make libtest work with MSVC8 Luis Oliveira loliveira@common-lisp.net**20070727221628] [Remove tabs from cffi-ecl.lisp Luis Oliveira loliveira@common-lisp.net**20070719182543] [Slight change to :SIMPLE-PARSER's semantics Luis Oliveira loliveira@common-lisp.net**20070719182519] [cffi-uffi-compat: fix deref-pointer Luis Oliveira loliveira@common-lisp.net**20070620173741
Bug reported by Aurelio Bignoli. ] [New type alias: cffi:foreign-pointer Luis Oliveira loliveira@common-lisp.net**20070618141413
- foreign-pointer: deftyped to sb-sys:system-area-pointer, ccl:macptr, etc. - manual: document it. - new tests: pointerp.1 and pointerp.2. ] [manual: fix :pointer documentation Luis Oliveira loliveira@common-lisp.net**20070618141334] [Fix check-for-typedef-cycles Luis Oliveira loliveira@common-lisp.net**20070608015901
Patch courtesy of Douglas Crosher. ] [Check for possible cycles created with DEFCTYPE[*] Luis Oliveira loliveira@common-lisp.net**20070607201117
Bug reported by Attila Lendvai. ] [Export DEFINE-PARSE-METHOD Luis Oliveira loliveira@common-lisp.net**20070607005840
Bug reported by Chun Tian. ] [Add DEFCTYPE* for Verrazano. Luis Oliveira loliveira@common-lisp.net**20070605215554] [gmake, sparc/hppa and libraries.lisp Luis Oliveira loliveira@common-lisp.net**20070601035026
- cffi-tests.asd: use gmake on solaris too. - new cffi-features: sparc[64] and hppa[64], SCL-only. (updated the respective test) - libraries.lisp: handle ERROR instead of SIMPLE-ERROR. - tests/bindings.lisp: bugfix?
Patch courtesy of Douglas Crosher. ] [with-foreign-objects: use &body instead of &rest Luis Oliveira loliveira@common-lisp.net**20070601034243
Reported by Frank Buss. ] [libraries.lisp: use *QUERY-IO* for the USE-VALUE restart Luis Oliveira loliveira@common-lisp.net**20070601034150] [New documentation example using defcstruct and :count Luis Oliveira loliveira@common-lisp.net**20070601033804] [Misc whitespace and reformating changes Luis Oliveira loliveira@common-lisp.net**20070601033709] [load-foreign-library-path: show useful error messages Luis Oliveira loliveira@common-lisp.net**20070601033126] [Unexported and undocumented array type and operators Luis Oliveira loliveira@common-lisp.net**20070416213326
Based on code by Vasilis M. http://article.gmane.org/gmane.lisp.cffi.devel/283 ] [Add :class option to defcstruct Luis Oliveira loliveira@common-lisp.net**20070416205312] [fix conflict Luis Oliveira loliveira@common-lisp.net**20070415182619] [tests/Makefile: x86_64 changes Luis Oliveira loliveira@common-lisp.net**20070404060214] [New example: mapping.lisp Luis Oliveira loliveira@common-lisp.net**20070413141102] [manual: add new *foreign-library-directories* example Luis Oliveira loliveira@common-lisp.net**20070413135416] [Update status in cffi-scl.lisp Luis Oliveira loliveira@common-lisp.net**20070413134343] [Update comments in cffi-corman.lisp Luis Oliveira loliveira@common-lisp.net**20070413134241] [New TODO item about multiple versions of the manual Luis Oliveira loliveira@common-lisp.net**20070413134202] [cffi-lispworks: don't pass NIL to register-module Luis Oliveira loliveira@common-lisp.net**20070329052606
Bug reported by Jack Unrue. ] [defctype and define-foreign-type: warn if type name is a keyword or CL symbol. Luis Oliveira loliveira@common-lisp.net**20070317001532] [Documentation update Luis Oliveira loliveira@common-lisp.net**20070222003330
- doc/Makefile: split spec and manual targets. - First documentation update reflecting the type system changes. Not complete yet. - Mention cffi-grovel. - Fix h4 margins in style.css. ] [Type system overhaul Luis Oliveira loliveira@common-lisp.net**20070219011856
The changes are summarized here: http://article.gmane.org/gmane.lisp.cffi.devel/1029
Also adapted tests and examples and uffi-compat. ] [New file: uffi-compat/uffi.asd Luis Oliveira loliveira@common-lisp.net**20070222005213] [Update TODO list Luis Oliveira loliveira@common-lisp.net**20070222004917
Removed some stuff that's already been implemented, etc... ] [Simplify load-foreign-library-error. Luis Oliveira loliveira@common-lisp.net**20070222000828] [Fix load-foreign-library bug Luis Oliveira loliveira@common-lisp.net**20070214195457
load-foreign-library wasn't accepting non-symbol library designators correctly. Bug reported by Stelian Ionescu. ] [Update documentation with stdcall/namespace/close-foreign-library changes Luis Oliveira loliveira@common-lisp.net**20070214144215] [Fix conflict Luis Oliveira loliveira@common-lisp.net**20070214132212] [Generate more meaningful errors for invalid enums Luis Oliveira loliveira@common-lisp.net**20070214125726
Reported by Lars Nostdal. ] [Remove finalizers. Users can use trivial-garbage instead. Luis Oliveira loliveira@common-lisp.net**20070214125318] [stdcall, namespaces, close-foreign-library Luis Oliveira loliveira@common-lisp.net**20070214124058
Three new features: - stdcall (defcfun, foreign-funcall(-pointer), defcallback) - namespaces, associate foreigns vars and functions to a specific library. (CLISP and Lispworks only) - close-foreign-library actually works now.
Backwards incompatible changes: - define-foreign-library's syntax changed slightly, can't load more than one foreign library per define-foreign-library form anymore. - defcvar's syntax changed. - foreign-funcall can't funcall pointers anymore. Use foreign-funcall-pointer for that. ] [clisp: copy-in/out implementation of with-pointer-to-vector-data Luis Oliveira loliveira@common-lisp.net**20061220221141
Patch courtesy of Stelian Ionescu.
] [Correctly handle duplicate loading of libraries in CMUCL. Luis Oliveira loliveira@common-lisp.net**20061219194553
Patch courtesy of Stelian Ionescu. ] [Fix WITH-POINTER-TO-VECTOR-DATA on recent SBCLs Luis Oliveira loliveira@common-lisp.net**20061208085224
Patch courtesy of Stelian Ionescu. ] [Bugfixes for ECL/DFFI Luis Oliveira loliveira@common-lisp.net**20061203032620
Patch courtesy of Juan Jose Garcia-Ripoll. ] [Fix typo in strings.lisp Luis Oliveira loliveira@common-lisp.net**20061117033535] [New function: CFFI-SYS:NATIVE-NAMESTRING Luis Oliveira loliveira@common-lisp.net**20061117033120
- Use it to load foreign libraries. Using plain CL:NAMESTRING was causing trouble with OpenMCL where (namestring #p"foo.bar.baz") returns "foo\.bar.baz". ] [CMUCL: pick up new callback trampolines after loading core Luis Oliveira loliveira@common-lisp.net**20061117032832
Patch courtesy of Bart Botta. ] [Use ECL's RT. Luis Oliveira loliveira@common-lisp.net**20061013002817] [Add declarations to cffi-sbcl.lisp Luis Oliveira loliveira@common-lisp.net**20061012224706
Patch courtesy of Yaroslav Kavenchuk. ] [ECL port update Luis Oliveira loliveira@common-lisp.net**20061012220014
- Fixed the port to architectures without dynamical FFI. - Tests with too large number of arguments (> 34) are marked as expected to fail.
Patch courtesy of Juan Jose Garcia-Ripoll. ] [bindings.lisp: load-directory Luis Oliveira loliveira@common-lisp.net**20060925141345
- Use pathname-device and pathname-host to more accurately get the current directory on, for example, windows.
Bug report and initial fix by Yaroslav Kavenchuk. ] [Fixed typo in %callback Daniel Dickison danieldickison@gmail.com**20060912160327] [uffi-compat: implement missing macro DEF-POINTER-VAR Luis Oliveira loliveira@common-lisp.net**20060910015547
Reported by Ricardo Alves. ] [Forgot to increment the version number in the .asd file again. Luis Oliveira loliveira@common-lisp.net**20060908205602] [TAG 0.9.2 Luis Oliveira loliveira@common-lisp.net**20060908205321] Patch bundle hash: 1f0dea411e0b6b5d03a0b746d2f72a87d66243bb
David Brown lisp@davidb.org writes:
Without this, with-pointer-to-vector-data always results in NIL, which isn't nearly as useful.
Thanks for the bug report. Unfortunately darcs doesn't seem to understand either of the two patches you sent. They seem to be missing a couple of newline characters, but I'm not sure whether that's the problem.
(unwind-protect
,@body
;; copy-out
(loop for i below ,size-var do
(setf (aref ,vector-var i)
(%mem-ref ,ptr-var :unsigned-char i))))))))
Anyway, I pushed a slightly different fix: we want to wrap the BODY in a PROGN. Also, I used PROG1 instead of UNWIND-PROTECT but I'm having second thoughts. I'm going to write some tests for WITH-POINTER-TO-VECTOR-DATA and most likely change that to UNWIND-PROTECT.