From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: prj@po.cwru.edu (Paul Jarc) Newsgroups: gmane.lisp.guile.devel Subject: Re: patch: (read "\x1b") => #\esc Date: Tue, 18 Nov 2003 19:24:19 -0500 Organization: What did you have in mind? A short, blunt, human pyramid? Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <87n0b0uj0z.fsf@zagadka.ping.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_I+ri93EwmwZ4TDI65pPvWQ)" X-Trace: sea.gmane.org 1069201980 27948 80.91.224.253 (19 Nov 2003 00:33:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 19 Nov 2003 00:33:00 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Nov 19 01:32:56 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMGH9-0002qD-00 for ; Wed, 19 Nov 2003 01:32:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMHEU-00052R-3k for guile-devel@m.gmane.org; Tue, 18 Nov 2003 20:34:14 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AMHBJ-0004Ig-2u for guile-devel@gnu.org; Tue, 18 Nov 2003 20:30:57 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AMHAb-0003iV-Pw for guile-devel@gnu.org; Tue, 18 Nov 2003 20:30:44 -0500 Original-Received: from [129.22.104.62] (helo=lewis.CNS.CWRU.Edu) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMHAZ-0003dL-4w for guile-devel@gnu.org; Tue, 18 Nov 2003 20:30:11 -0500 Original-Received: from conversion-daemon.smtp-b.cwru.edu by smtp-b.cwru.edu (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) id <0HOK00C01OZAEH@smtp-b.cwru.edu> for guile-devel@gnu.org; Tue, 18 Nov 2003 19:24:20 -0500 (EST) Original-Received: from multivac.cwru.edu (multivac.ITS.CWRU.Edu [129.22.114.26]) by smtp-b.cwru.edu (iPlanet Messaging Server 5.2 HotFix 1.14 (built Mar 18 2003)) with SMTP id <0HOK00BQSP4KTK@smtp-b.cwru.edu> for guile-devel@gnu.org; Tue, 18 Nov 2003 19:24:20 -0500 (EST) Original-Received: (qmail 31245 invoked by uid 500); Wed, 19 Nov 2003 00:24:42 +0000 In-reply-to: Original-To: Marius Vollmer Mail-followup-to: Marius Vollmer , guile-devel@gnu.org Mail-Copies-To: nobody User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Original-Lines: 9 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:3065 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:3065 --Boundary_(ID_I+ri93EwmwZ4TDI65pPvWQ) Content-type: TEXT/PLAIN Content-transfer-encoding: 7BIT I wrote: > Meanwhile, here's the patch for writing. Oops. paul --Boundary_(ID_I+ri93EwmwZ4TDI65pPvWQ) Content-type: text/x-patch; NAME=write-string-hex.patch Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=write-string-hex.patch 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); --Boundary_(ID_I+ri93EwmwZ4TDI65pPvWQ) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --Boundary_(ID_I+ri93EwmwZ4TDI65pPvWQ)--