Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

character printing

1 view
Skip to first unread message

Nils Goesche

unread,
Dec 31, 2000, 11:16:54 PM12/31/00
to
Hi!

Is the following a bug in CMUCL or am I missing something? It
works on Allegro Trial...

* (code-char 28)
#\^\
* (prin1 (code-char 28))
#\^\
#\^\
* (read-from-string (prin1-to-string (code-char 28)))

Unexpected EOF on #<String-Input Stream> after escape character.

Restarts:
0: [abort] Return to Top-Level.

Debug (type H for help)

(common-lisp::reader-eof-error #<String-Input Stream> "after escape character")
0]

Regards,
--
Nils Goesche
Ask not for whom the <CONTROL-G> tolls.

jos...@corporate-world.lisp.de

unread,
Jan 1, 2001, 8:14:51 AM1/1/01
to
In article <87u27je...@darkstar.cartan>,

Nils Goesche <car...@t-online.de> wrote:
> Hi!
>
> Is the following a bug in CMUCL or am I missing something? It
> works on Allegro Trial...
>
> * (code-char 28)
> #\^\

#\^\ does not make much sense as a character name... Why
is there a second "\" ?

> #\^\
> * (read-from-string (prin1-to-string (code-char 28)))

Does this work:

(read-from-string "#\^\\")

?

Anyway, this looks like a question to the CMUCL maintainers.

Sent via Deja.com
http://www.deja.com/

Nils Goesche

unread,
Jan 1, 2001, 11:54:23 AM1/1/01
to
jos...@corporate-world.lisp.de writes:

> In article <87u27je...@darkstar.cartan>,
> Nils Goesche <car...@t-online.de> wrote:
> > Hi!
> >
> > Is the following a bug in CMUCL or am I missing something? It
> > works on Allegro Trial...
> >
> > * (code-char 28)
> > #\^\
>
> #\^\ does not make much sense as a character name... Why
> is there a second "\" ?

It's stands for `Ctrl-\'. When you hit Ctrl-\ on a Unix terminal
with default settings, you send a SIGQUIT to the foreground
process, which usually causes it to terminate and dump core, for
debugging purposes. (You appear to be using a Mac)

> > #\^\
> > * (read-from-string (prin1-to-string (code-char 28)))
>
> Does this work:
>
> (read-from-string "#\^\\")
>
> ?

No, but this does:

(read-from-string "#\\^\\\\")

> Anyway, this looks like a question to the CMUCL maintainers.

Yes, as Erik Naggum said, it is a bug in the printer, as
expected. Some kind soul from cmucl.cons.org already sent me a
patch. I was trying to print out and read back in some character
tables, and was surprised that it didn't work. I thought that
maybe I was missing some special variable like *print-readably*,
so I'd rather ask here before reporting a bug.

Erik Naggum

unread,
Jan 1, 2001, 11:15:53 AM1/1/01
to
* Nils Goesche <car...@t-online.de>

| Is the following a bug in CMUCL or am I missing something?

It looks like a bug in the printer. (char-name (code-char 28)) should
return a string that has one final backslash and prints with two, and so
the same should be true for the printed representation of the character.

* jos...@corporate-world.lisp.de


| #\^\ does not make much sense as a character name...

Well, the _name_ should be the string "^\\".

| Why is there a second "\"?

Because ^ is a common modifier character that turns the following
character into a control character. ^A is ctrl-A, and ^\ is perfectly
acceptable as a control character in a context where \ is not escaping
the following character -- it is, however, in Common Lisp.

#:Erik
--
Performance is the last refuge of the miserable programmer.

0 new messages