From: prj@po.cwru.edu (Paul Jarc)
Cc: guile-devel@gnu.org
Subject: Re: patch: (read "\x1b") => #\esc
Date: Tue, 18 Nov 2003 19:24:19 -0500 [thread overview]
Message-ID: <m3smklqk6u.fsf@multivac.cwru.edu> (raw)
In-Reply-To: <m31xs5sash.fsf@multivac.cwru.edu>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 66 bytes --]
I wrote:
> Meanwhile, here's the patch for writing.
Oops.
paul
[-- Attachment #2: write-string-hex.patch --]
[-- Type: text/x-patch, Size: 1222 bytes --]
Index: guile-core/libguile/print.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/print.c,v
retrieving revision 1.155
diff -u -r1.155 print.c
--- guile-core/libguile/print.c 11 Oct 2003 00:57:25 -0000 1.155
+++ guile-core/libguile/print.c 18 Nov 2003 19:57:56 -0000
@@ -538,16 +538,24 @@
scm_putc ('"', port);
for (i = 0; i < SCM_STRING_LENGTH (exp); ++i)
- switch (SCM_STRING_CHARS (exp)[i])
- {
- case '"':
- case '\\':
- scm_putc ('\\', port);
- default:
- scm_putc (SCM_STRING_CHARS (exp)[i], port);
- }
+ {
+ unsigned char ch = SCM_STRING_CHARS (exp)[i];
+ if ((ch < 32 && ch != '\n') || (127 <= ch && ch < 148))
+ {
+ static char const hex[]="0123456789abcdef";
+ scm_putc ('\\', port);
+ scm_putc ('x', port);
+ scm_putc (hex [ch / 16], port);
+ scm_putc (hex [ch % 16], port);
+ }
+ else
+ {
+ if (ch == '"' || ch == '\\')
+ scm_putc ('\\', port);
+ scm_putc (ch, port);
+ }
+ }
scm_putc ('"', port);
- break;
}
else
scm_lfwrite (SCM_STRING_CHARS (exp), SCM_STRING_LENGTH (exp), port);
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next prev parent reply other threads:[~2003-11-19 0:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-10 22:41 patch: (read "\x1b") => #\esc Paul Jarc
2003-11-10 22:48 ` Paul Jarc
2003-11-10 23:18 ` Kevin Ryde
2003-11-11 2:45 ` Paul Jarc
2003-11-11 21:48 ` Kevin Ryde
2003-11-13 20:10 ` Marius Vollmer
2003-11-18 20:04 ` Paul Jarc
2003-11-19 0:24 ` Paul Jarc [this message]
2003-11-29 23:43 ` Marius Vollmer
2003-11-25 17:12 ` Paul Jarc
2003-11-30 1:05 ` Marius Vollmer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3smklqk6u.fsf@multivac.cwru.edu \
--to=prj@po.cwru.edu \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).