From: Chris Hanson Date: Sun, 6 Jan 2019 01:52:10 +0000 (-0800) Subject: New printer parameter param:print-hash-number-in-objects?. X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2b8dd411365a8b5ec003de8bde8478b2b29b6d3d;p=mit-scheme.git New printer parameter param:print-hash-number-in-objects?. --- diff --git a/src/runtime/boot.scm b/src/runtime/boot.scm index 99f274981..ecc79ac1f 100644 --- a/src/runtime/boot.scm +++ b/src/runtime/boot.scm @@ -344,8 +344,11 @@ USA. (begin (write-string "#[" port) (display (if (procedure? name) (name object) name) port) - (write-char #\space port) - (write (hash-object object) port) + (if (or (param:print-hash-number-in-objects?) + (not printer)) + (begin + (write-char #\space port) + (write (hash-object object) port))) (if printer (printer object port)) (write-char #\] port))))) diff --git a/src/runtime/printer.scm b/src/runtime/printer.scm index 32f39b236..125ffaef6 100644 --- a/src/runtime/printer.scm +++ b/src/runtime/printer.scm @@ -65,6 +65,9 @@ USA. (define-deferred param:printer-abbreviate-quotations? (make-unsettable-parameter #f boolean-converter)) +(define-deferred param:print-hash-number-in-objects? + (make-settable-parameter #t boolean-converter)) + (define-deferred param:printer-list-breadth-limit (make-unsettable-parameter #f limit-converter)) @@ -422,8 +425,10 @@ USA. (if (string? name) (*print-string name context*) (print-object name context*)) - (*print-char #\space context*) - (*print-hash object context*) + (if (param:print-hash-number-in-objects?) + (begin + (*print-char #\space context*) + (*print-hash object context*))) (cond (procedure (procedure context*)) ((get-param:print-with-datum?) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index d241fb8db..fc9eac303 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -4926,6 +4926,7 @@ USA. (export () param:print-char-in-unicode-syntax? param:print-compound-procedure-names? + param:print-hash-number-in-objects? param:print-primitives-by-name? param:print-streams? param:print-uninterned-symbols-by-name?