[cmucl-imp] Compiling files with traditional Mac EOL in CMUCL

Raymond Toy toy.raymond at gmail.com
Thu Oct 12 15:02:47 UTC 2017


On Wed, Oct 11, 2017 at 2:13 AM, Chun Tian <binghe.lisp at gmail.com> wrote:
>
> Hi Raymond,
>
> I’m so sorry, but somehow I've never received your previous email, that’s why I didn’t reply.
>
> After my initial post for this issue, I actually received a private mail from James Anderson (the author of CL-XML and many other utilities), the following reader macro, which allows the correct handling of Mac EOL in every CL implementation:
>
> (defun |universal-comment-reader| (stream char)
>   (declare (ignore char))
>   (loop (case (read-char stream nil nil)
>           ((#\return #\linefeed nil) (return))
>           (t )))
>   (values))
>
> (set-macro-character #\; '|universal-comment-reader|)
>
> But any way, I just tried (compile-file "foo.lisp" :external-format '(:utf8 :cr)), and I confirm it also works.  I don’t know how to let ASDF compile files with additional parameters in COMPILE-FILE, but anyway there should be a solution (for CMUCL, maybe also SBCL?), it’s still a problem for some other CL implementations.

Thanks for letting me know; glad it works for you.

As for asdf, you can define your own classes and operations.  I'm not
an expert on this, but here is an example from f2cl (that Fare
basically updated for me):
https://gitlab.common-lisp.net/f2cl/f2cl/blob/master/src/f2cl-asdf.lisp.
I think the relevant part is the perform method where you can specify
options when compiling.
>
> Regards,
>
> Chun Tian
>
> > Il giorno 11 ott 2017, alle ore 05:37, Raymond Toy <toy.raymond at gmail.com> ha scritto:
> >
> >>>>>> "Raymond" == Raymond Toy <toy.raymond at gmail.com> writes:
> >
> >>>>>> "Chun" == Chun Tian <(binghe)" <binghe.lisp at gmail.com>> writes:
> >    Chun> OK, sorry, I carefully checked again. SBCL also doesn't support compiling
> >    Chun> files with Mac EOLs.  Clozure CL, which I confirmed now, indeed support Mac
> >    Chun> EOLs.
> >
> >    Chun> For the reason I can't convert the source files to UNIX line endings,
> >    Chun> there's a Lisp function for parsing (multi-line) literal strings defined in
> >    Chun> source files with MAC line endings.  It seems that, #\Newline was mapped to
> >    Chun> "\r" in MCL, thus Lisp forms like (position #\Newline string) doesn't work
> >    Chun> in MCL for other line endings, especially the UNIX endings, because in this
> >    Chun> case there would be no #\Newline in the string at all!
> >
> >    Raymond> I haven't tried this out in a long time, but maybe something like this
> >    Raymond> will work:
> >
> >    Raymond> (compile-file "foo.lisp" :external-format '(:utf8 :cr))
> >
> > Did you get a chance to try this out?
> >
> > --
> > Ray
> >
> > _______________________________________________
> > cmucl-imp mailing list
> > cmucl-imp at cmucl.cons.org
> > https://lists.zs64.net/mailman/listinfo/cmucl-imp
>



-- 
Ray


More information about the cmucl-imp mailing list