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

Daniel Dickison danieldickison at gmail.com
Mon May 14 09:34:33 PDT 2007


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



More information about the Openmcl-devel mailing list