scexp depends on the common-idioms package.
The current release of scexp is 0.9, released Saturday Jan 15 2005. The release is available at the following URL:
http://www.unmutual.info/software/scexp/scexp-0.9.tar.gz
The development version is currently available as a Subversion repository at the following url:
svn://unmutual.info/scexp/You can also browse the documentation for the latest release.
This is an example of a macro in scexp for constructing Duff's Device:
[(defmacro {make-duff} {(to from count n-type size)}
`{(let ((,n-type n (/ (+ ,count ,[(- {size} 1)]) ,size)))
(switch (mod ,count ,size)
(case 0)
(do/while
((setq (deref ,to) (deref (post-incf ,from)))
,@[(loop for i from (- {size} 1) downto 1
append `{((case ,[i])
(setq (deref ,to) (deref (post-incf ,from))))})])
(> (decf n) 0))))})]
Which generates Duff's Device
for loop unrolling in C, with a parameter of 8. Note the loop
in the macro!
The funny [ and { macros switch readtables from and to the scexp readtable, which preserves case in symbols and backslashes in strings. If this looks ugly, come up with a better solution and email it to me.
To use the macro, simply call it as if it were a function:
(defun void duff8 (((* char) to) ((* char) from) (int count))
()
(make-duff to from count int 8))
scexp is Copyright 2004 Brian Mastenbrook, and licensed under the MIT license.