From bee4a922510a796760654d87b235f3775be88dc1 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 25 Oct 2019 15:04:58 -0600 Subject: [PATCH] cs-bootstrap: updates to work with recent Chez Scheme changes --- racket/collects/setup/main.rkt | 2 +- racket/src/cs/bootstrap/scheme-lang.rkt | 29 ++++++++++++++------ racket/src/cs/bootstrap/scheme-readtable.rkt | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/racket/collects/setup/main.rkt b/racket/collects/setup/main.rkt index a6beac8da4..81651e8690 100644 --- a/racket/collects/setup/main.rkt +++ b/racket/collects/setup/main.rkt @@ -250,7 +250,7 @@ (if skip-zo/reason (if print-loading-sources? (lambda (path modname) - (log-message (current-logger) 'info 'compiler/cm (format "loading ~a" path)) + ;; (log-message (current-logger) 'info 'compiler/cm (format "loading ~a" path)) (orig-load path modname)) orig-load) (lambda (path modname) diff --git a/racket/src/cs/bootstrap/scheme-lang.rkt b/racket/src/cs/bootstrap/scheme-lang.rkt index da70d851d1..eb155291a1 100644 --- a/racket/src/cs/bootstrap/scheme-lang.rkt +++ b/racket/src/cs/bootstrap/scheme-lang.rkt @@ -5,6 +5,7 @@ racket/vector racket/splicing racket/pretty + racket/dict "config.rkt" (for-syntax "config.rkt") (for-syntax "constant.rkt") @@ -150,6 +151,7 @@ [s:error $oops] [error $undefined-violation] [error errorf] + [error warningf] [make-bytes make-bytevector] [bytes bytevector] [bytes-length bytevector-length] @@ -220,16 +222,16 @@ $ht-minlen $ht-veclen (rename-out [hash? hashtable?] - [hash-ref/pair hashtable-ref] - [hash-ref/pair eq-hashtable-ref] + [hash-ref/pair/dict hashtable-ref] + [hash-ref/pair/dict eq-hashtable-ref] [hash-ref-cell eq-hashtable-cell] - [hash-set!/pair hashtable-set!] + [hash-set!/pair/dict hashtable-set!] [hash-remove! eq-hashtable-delete!] [equal-hash-code string-hash] - [hash-set!/pair symbol-hashtable-set!] + [hash-set!/pair/dict symbol-hashtable-set!] [hash-has-key? symbol-hashtable-contains?] [hash-has-key? eq-hashtable-contains?] - [hash-ref/pair symbol-hashtable-ref] + [hash-ref/pair/dict symbol-hashtable-ref] [hash-ref-cell symbol-hashtable-cell]) bignum? ratnum? @@ -881,14 +883,25 @@ (eq? eql? =)) (make-hash)] [else - (error 'make-hashtable - "??? ~s ~s" hash eql?)])) + (make-custom-hash eql? hash (lambda (a) 1))])) (define (make-weak-eq-hashtable) (make-weak-hasheq)) +(define (hash-ref/pair/dict ht key def-v) + (if (hash? ht) + (hash-ref/pair ht key def-v) + (dict-ref ht key def-v))) + +(define (hash-set!/pair/dict ht key v) + (if (hash? ht) + (hash-set!/pair ht key v) + (dict-set! ht key v))) + (define (hashtable-keys ht) - (list->vector (hash-keys ht))) + (list->vector (if (hash? ht) + (hash-keys ht) + (dict-keys ht)))) (define (hashtable-entries ht) (define ps (hash-values ht)) diff --git a/racket/src/cs/bootstrap/scheme-readtable.rkt b/racket/src/cs/bootstrap/scheme-readtable.rkt index 2d92b34e51..f69d745d48 100644 --- a/racket/src/cs/bootstrap/scheme-readtable.rkt +++ b/racket/src/cs/bootstrap/scheme-readtable.rkt @@ -37,7 +37,7 @@ (read/recursive new-in #f #f #t)])) (define (hash-percent c in src line col pos) - (read-syntax/recursive src in)) + `($primitive ,(read/recursive in))) (define (hash-bang c in src line col pos) (define sym (read/recursive in))