[Openmcl-devel] compiler bug?
beer at eecs.cwru.edu
Sat Sep 18 00:25:29 EDT 2004
This looks like a bug on my part. The first case of the COND in
COERCE-TO-FOREIGN-TYPE is passing the *symbol* X into COERCE-TO-BOOL
rather than its value (Note that COERCE-TO-BOOL will be expanded when
COERCE-TO-FOREIGN-TYPE is compiled). The reason for making all of these
macros was to incur the absolute minimum overhead for these coercions,
but I screwed up here. A quick fix is below, but there may be a better
way to do this.
(defmacro coerce-to-foreign-type (x ftype)
(cond ((and (constantp x) (constantp ftype))
(:id (if (null x) `(%null-ptr) (coerce-to-address x)))
(:char (coerce-to-bool (EVAL x)))
(:id `(coerce-to-address ,x))
(:char `(coerce-to-bool ,x))
(t `(case ,(if (atom ftype) ftype)
(:id (coerce-to-address ,x))
(:char (coerce-to-bool ,x))
On Sep 17, 2004, at 11:14 PM, alex crain wrote:
> Ok, I'm stumped
> (send text-view :set-editable #$NO) doesn't work. I notice that:
> (coerce-to-foreign-type 0 :char) -> 0
> (coerce-to-foreign-type #$NO :char) -> 1
> COERCE-TO-FOREIGN-TYPE is a macro that should expand to the result if
> (COERCE-TO-BOOL #$NO), but
> (COERCE-TO-BOOL #$NO) -> 0 like it is supposed to.
> I'm very interested in why this doesn't work and how to debug this
> kind of thing.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel