From: Guillermo J. Rozas Date: Tue, 16 Nov 1993 16:36:44 +0000 (+0000) Subject: Fix bug when displaying #\' X-Git-Tag: 20090517-FFI~7496 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6f62d46629df030bc6ad9fcea7941aef9a203235;p=mit-scheme.git Fix bug when displaying #\' --- diff --git a/v7/src/compiler/machines/C/cout.scm b/v7/src/compiler/machines/C/cout.scm index 4211f970f..c0aef95eb 100644 --- a/v7/src/compiler/machines/C/cout.scm +++ b/v7/src/compiler/machines/C/cout.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: cout.scm,v 1.18 1993/11/16 16:09:15 gjr Exp $ +$Id: cout.scm,v 1.19 1993/11/16 16:36:44 gjr Exp $ Copyright (c) 1992-1993 Massachusetts Institute of Technology @@ -733,7 +733,7 @@ MIT in each case. |# (char-set-union char-set:not-graphic (char-set #\\ #\"))) (define char-set:C-named-chars - (char-set #\\ #\" #\' #\Tab #\BS + (char-set #\\ #\" #\Tab #\BS ;; #\' Scheme does not quote it in strings ;; #\VT #\BEL ;; Cannot depend on ANSI C #\Linefeed #\Return #\Page)) @@ -747,6 +747,10 @@ MIT in each case. |# (C-quotify-string (substring string (1+ index) (string-length string))))))) +;; The following two routines rely on the fact that Scheme and C +;; use the same quoting convention for the named characters when they +;; appear in strings. + (define (C-quotify-string-char char) (cond ((char-set-member? char-set:C-named-chars char) (let ((result (write-to-string (string char)))) @@ -764,13 +768,15 @@ MIT in each case. |# (define (C-quotify-char char) (cond ((not (char-set-member? char-set:C-char-quoted char)) - (string-append "'" (make-string 1 char) "'")) + (string #\' char #\')) ((char-set-member? char-set:C-named-chars char) (string-append "'" (let ((s (write-to-string (make-string 1 char)))) (substring s 1 (-1+ (string-length s)))) "'")) + ((char=? char #\') + "'\\''") ((char=? char #\NUL) "'\\0'") (else