[movitz-devel] Possible macroexpansion bug

Peter Minten peter.minten at wanadoo.nl
Tue Apr 27 17:25:53 UTC 2004


Hi,

I've put up a new version of the harddisk code 
(http://www.il.fontys.nl/~silvernerd/harddisk.lisp), featuring a complete code 
rewrite (as usual :-). The problem is, it doesn't compile due to some weird 
macroexpansion that somehow turns the io-port code in define-register-accessors 
(invoked with clauses of (name offset type)) into (io-port (+ ... type)). I 
checked with CMUCL macroexpand-1 and it doesn't expand that way there.

Note that I slightly modified the code after the last test, so there may be 
other errors coming first, but since those modifications are lower in the file 
(and consist only of renaming to the new naming scheme) I doubt it.

(defmacro define-register-accessors (&rest clauses)
   (let ((gs-hdc (gensym "hdc-")))
     `(progn
       ,@(mapcar #'(lambda (clause)
                     `(defmacro
                       ,(intern (concatenate 'string
                                             (string (first clause))
                                             (string '-register)))
                       (,gs-hdc)
                       `(io-port (+ (slot-value ,,gs-hdc 'command-base)
                                  ,,(second clause))
                         ,,(third clause))))
                 clauses))))

Greetings,

Peter




More information about the movitz-devel mailing list