From: Chris Hanson Date: Sun, 19 Mar 2017 02:34:17 +0000 (-0700) Subject: Add hack to force printing chars in old format; can be eliminated after 9.3. X-Git-Tag: mit-scheme-pucked-9.2.12~158^2~86 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=d817f366850633199d85a9c0c74b4636d9f4e4c4;p=mit-scheme.git Add hack to force printing chars in old format; can be eliminated after 9.3. --- diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 69238b248..8b5850eaf 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4735,6 +4735,7 @@ USA. *unparser-string-length-limit*) (export () param:unparse-abbreviate-quotations? + param:unparse-char-in-unicode-syntax? param:unparse-compound-procedure-names? param:unparse-primitives-by-name? param:unparse-streams? diff --git a/src/runtime/unpars.scm b/src/runtime/unpars.scm index 7fdf33bcf..d9d894670 100644 --- a/src/runtime/unpars.scm +++ b/src/runtime/unpars.scm @@ -52,6 +52,7 @@ USA. (define param:unparser-list-depth-limit) (define param:unparser-radix) (define param:unparser-string-length-limit) +(define param:unparse-char-in-unicode-syntax?) (add-boot-init! (lambda () @@ -88,6 +89,9 @@ USA. (set! param:unparser-string-length-limit (make-unsettable-parameter #f limit-converter)) + (set! param:unparse-char-in-unicode-syntax? + (make-unsettable-parameter #f + boolean-converter)) unspecific)) (define (boolean-converter value) @@ -480,15 +484,19 @@ USA. (allowed-char? char context)))) (define (unparse/character char context) - (if (context-slashify? context) - (begin - (*unparse-string "#\\" context) - (if (and (char-in-set? char char-set:normal-printing) - (not (eq? 'separator:space (char-general-category char))) - (allowed-char? char context)) - (*unparse-char char context) - (*unparse-string (char->name char) context))) - (*unparse-char char context))) + (cond ((and (param:unparse-char-in-unicode-syntax?) + (bitless-char? char)) + (*unparse-string "#\\u+" context) + (*unparse-string (number->string (char->integer char) 16) context)) + ((context-slashify? context) + (*unparse-string "#\\" context) + (if (and (char-in-set? char char-set:normal-printing) + (not (eq? 'separator:space (char-general-category char))) + (allowed-char? char context)) + (*unparse-char char context) + (*unparse-string (char->name char) context))) + (else + (*unparse-char char context)))) (define (unparse/string string context) (if (context-slashify? context)