[Openmcl-devel] with-encoded-cstrs is broken

Gary Byers gb at clozure.com
Mon May 14 11:55:46 PDT 2007


Thanks.

Another (perhaps simpler, or at least more expedient) approach is to
change WITH-ENCODED-CSTR's lambda list to accept what
WITH-ENCODED-CSTRS is passing it.  Neither of these things is
exported/documented/ready-for-prime-time, but if either of them were
to be it'd most likely be WITH-ENCODED-CSTRS.  (The fact that it and a
few other things happen to expand into a set of nested bindings of a
single variable is just an artifact of the implementation.  It happens
that that particular approach makes it hard to meaningfully use
declarations in the nominally higher-level construct.)

I checked in a change to WITH-ENCODED-CSTR that expects what
WITH-ENCODED-CSTRS hands it, and also tries to do the 0-termination
bit a little more sanely.

On Mon, 14 May 2007, Daniel Dickison wrote:

> with-encoded-cstrs doesn't expand into the right form for with-
> encoded-cstr.  Specifically, the first parameter for with-encoded-
> cstr is the encoding name, but with-encoded-cstrs sticks the encoding
> name to the car of the bindings.  i.e:
>
> CL-USER> (macroexpand-1 '(ccl::with-encoded-cstrs :utf-16 ((x "hello"))
> 							(print x)))
> (CCL::WITH-ENCODED-CSTR (:UTF-16 (X "hello"))
>   (PROGN (PRINT X)))
> T
>
> But with-encoded-cstr expects:
> (CCL::WITH-ENCODED-CSTR :UTF-16 (x "hello")
>   (progn (print x)))
>
> A possible solution is to use a modified with-specs-aux and change
> with-encoded-cstrs (in ccl/lib/macros.lisp) to:
>
> (defmacro with-encoded-cstrs (encoding-name bindings &body body)
>   (with-specs-aux-2 'with-encoded-cstr
>                     encoding-name
>                     bindings
>                     body))
>
> (defun with-specs-aux-2 (name param-1 spec-list body)
>   (setq body (cons 'progn body))
>   (dolist (spec (reverse spec-list))
>      (setq body (list name param-1 spec body)))
>   body)
>
> Daniel
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list