[cl-typesetting-devel] Some small patches
Peter Seibel
peter at javamonkey.com
Mon Nov 8 23:06:22 UTC 2004
"Marc Battyani" <marc.battyani at fractalconcept.com> writes:
> "Peter Seibel" <peter at javamonkey.com> wrote:
>> Peter Seibel <peter at javamonkey.com> writes:
>>
>> > Here are some patches that I've had lying around in my version of
>> > cl-typesetting that allow it to compile cleanly on some of the more
>> > picky Common Lisp's.
>>
>> Oh, another problem I had when compiling with with SBCL was that the
>> iterate source files are in DOS mode which causes ~<newline> format
>> directives to fail since they look to Lisp like ~<carrige return>
>> which isn't a valid format directive. I worked around it by
>> dos2unix'ing the files but I don't know if there's a better long term
>> solution? Does subversion have any facility to fix line endings for
>> text files so folks who check them out onto Unix machines get Unix
>> line endings and Windows folks get Windows CRLFs?
>
> Thanks for the patches. I try to look at them tomorrow (in the plane
> to Milano ;-). The crlf problem in the iterate sources has already
> annoyed some people. I will get the latest iterate version and check
> in what format are the files.
>
> That's cool, There is a lot of new stuff to integrate. Thanks to
> all! :)
Another heads up--there's a problem in Allegro 7.0 that stops it from
compiling pprint.lisp (due to it's use of ITERATE). I believe it's a
bug in Allegro and have opened a ticket with them. But if anyone needs
a quick workaround this patch seems to do the trick:
Index: iterate.lisp
===================================================================
--- iterate.lisp (revision 66)
+++ iterate.lisp (working copy)
@@ -627,7 +627,7 @@
;; functions; and, by personal preference, special operators
;; should be expanded before iterate clauses.
- ((macro-function (car form) *env*)
+ ((macro-form? (car form) *env*)
(walk (macroexpand form *env*)))
((special-form? (car form))
(walk-special-form form))
@@ -727,6 +727,14 @@
(or (special-operator-p symbol)
(assoc symbol *special-form-alist*)))
+(defun macro-form? (symbol &optional env)
+ ;; Workaround to deal with seeming bug in Allegro 7.0 where DECLARE
+ ;; has a MACRO-FUNCTION but MACROEXPANDING it goes into an infinite
+ ;; loop.
+ (when (not (eql symbol 'cl:declare))
+ (macro-function symbol env)))
+
+
(defun walk-special-form (form)
(let* ((*clause* form)
(func-p (assoc (car form) *special-form-alist*))
@@ -963,7 +971,7 @@
(let ((args (cons (keywordize (first ppclause))
(cdr ppclause)))
(func (clause-info-function info)))
- (if (macro-function func *env*)
+ (if (macro-form? func *env*)
(walk (macroexpand (cons func args) *env*))
(apply-clause-function func args))))
(t
@@ -2020,7 +2028,7 @@
(nconc free-vars (free-vars-list body bound-vars))))
(otherwise
nil)))
- ((macro-function (car form) *env*)
+ ((macro-form? (car form) *env*)
(free-vars (macroexpand form *env*) bound-vars))
(t ; function call
(free-vars-list (cdr form) bound-vars))))
-Peter
--
Peter Seibel peter at javamonkey.com
Lisp is the red pill. -- John Fraser, comp.lang.lisp
More information about the cl-typesetting-devel
mailing list