From d817f366850633199d85a9c0c74b4636d9f4e4c4 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sat, 18 Mar 2017 19:34:17 -0700 Subject: [PATCH] Add hack to force printing chars in old format; can be eliminated after 9.3. --- src/runtime/runtime.pkg | 1 + src/runtime/unpars.scm | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) 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) -- 2.25.1