Frank Buss <fb@frank-buss.de> wrote:
+---------------
| Rob Warnock wrote [quoting from CMUCL sources]:
| > (defmacro defenum ((&key (prefix "") (suffix "") (start 0) (step 1))
| > &rest identifiers)
| > ...)
|
| I've done something similar for converting anonymous C enums to Lisp:
| http://article.gmane.org/gmane.lisp.cffi.devel/478/match=defenum
| (defmacro defenum (&body enums)
| `(progn ,@(loop for value in enums
| for index = 0 then (1+ index)
| when (listp value) do (setf index (second value)
| value (first value))
| collect `(defconstant ,value ,index))))
| And while not as powerful with prefix and suffix, I think my macro
| looks nicer :-)
+---------------
Indeed! I suspect the main reason the CMUCL version has all that prefix
and suffix stuff is because of a grotesquely horrible hack elsewhere in
the compiler which uses introspection of certain packages to extract values
from symbols with magic prefixes/suffixes to create certain source files
when recompiling itself!! Specifically, look at the functions GENESIS,
EMIT-C-HEADER, & EMIT-C-HEADER-AUX in the file "src/compiler/generic/
new-genesis.lisp". [But have a barf bag handy...] ;-}
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607