]> birchwood-abbey.net Git - mit-scheme.git/commitdiff
Add parameter to force printer to use ASCII.
authorChris Hanson <org/chris-hanson/cph>
Sat, 6 Mar 2021 21:49:44 +0000 (13:49 -0800)
committerChris Hanson <org/chris-hanson/cph>
Sun, 7 Mar 2021 23:10:22 +0000 (15:10 -0800)
This is needed for the UCD converter, when converting newer versions of UCD.
Otherwise the output could contain characters that can't be read by the host
Scheme reader, since they didn't exist in that version.

(cherry picked from commit e3e581eadcfc82d266d4aa469fe53f1fd385e4a3)

src/runtime/printer.scm
src/runtime/runtime.pkg

index e306e35ec96b87fc52130725d4e955a1c6ecdbd5..18700a8994c16c70f47e6ed905290e99f8dcc3e5 100644 (file)
@@ -48,6 +48,9 @@ USA.
 (define-deferred param:print-char-in-unicode-syntax?
   (make-unsettable-parameter #f boolean-converter))
 
+(define-deferred param:print-ascii-only?
+  (make-unsettable-parameter #f boolean-converter))
+
 (define-deferred param:print-compound-procedure-names?
   (make-unsettable-parameter #t boolean-converter))
 
@@ -185,7 +188,9 @@ USA.
   ((context-labeling context) object))
 
 (define (context-char-set context)
-  (textual-port-char-set (context-port context)))
+  (if (param:print-ascii-only?)
+      char-set:ascii
+      (textual-port-char-set (context-port context))))
 
 (define (with-current-unparser-state context procedure)
   (parameterize ((initial-context context))
index 2adc9e86cbb7156f6f17deaff9b49380a656756d..4b7e1e0d674b6570e6412aa2fe707ecb2039a9ab 100644 (file)
@@ -5382,6 +5382,7 @@ USA.
          *unparser-string-length-limit*
          with-current-unparser-state)
   (export ()
+         param:print-ascii-only?
          param:print-char-in-unicode-syntax?
          param:print-compound-procedure-names?
          param:print-hash-number-in-objects?