On 12/20/06, Lars Rune Nøstdal <[EMAIL PROTECTED]> wrote:
  SWGtk> (foreign-funcall "someCFunction" UpdateType :not-valid)

..I get:

  The value nil is not of type (signed-byte 32).

The following patch should fix that. Before commiting this patch,
though, I wanted to write a regression test. That kind of requires a
proper error condition instead of simple-error and having a proper
error condition would probably remove the need for the errorp argument
that introduced this bug in the first place.

IIRC, this was added by request of the cffi-unix folks who wanted to
deal gracefully with incomplete enums or something like that.
cffi-unix folks, wouldn't a condition work better than this errorp
argument? Well, I suppose we could have both ways of doing this... Any
comments?


diff -rN -u old-cffi/src/enum.lisp new-cffi/src/enum.lisp
--- old-cffi/src/enum.lisp      2006-12-20 15:07:48.000000000 +0000
+++ new-cffi/src/enum.lisp      2006-12-20 15:07:48.000000000 +0000
@@ -110,11 +110,11 @@

(defmethod translate-type-to-foreign (value (type foreign-enum))
  (if (keywordp value)
-      (%foreign-enum-value type value)
+      (%foreign-enum-value type value :errorp t)
      value))

(defmethod translate-type-from-foreign (value (type foreign-enum))
-  (%foreign-enum-keyword type value))
+  (%foreign-enum-keyword type value :errorp t))

;;;# Foreign Bitfields as Lisp keywords
;;;

--
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to