cs: support second argument to primitive-table

The two-argument mode is needed to support building RacketCs using
RacketCS.
This commit is contained in:
Matthew Flatt 2019-01-01 13:14:07 -07:00
parent 7797d3672b
commit dbabafa147

View File

@ -44,20 +44,26 @@
;; The expander needs various tables to set up primitive modules, and ;; The expander needs various tables to set up primitive modules, and
;; the `primitive-table` function is the bridge between worlds ;; the `primitive-table` function is the bridge between worlds
(define (primitive-table key) (define user-installed-tables (make-hasheq))
(case key
[(|#%linklet|) linklet-table] (define primitive-table
[(|#%kernel|) kernel-table] (case-lambda
[(|#%read|) (make-hasheq)] [(key)
[(|#%paramz|) paramz-table] (case key
[(|#%unsafe|) unsafe-table] [(|#%linklet|) linklet-table]
[(|#%foreign|) foreign-table] [(|#%kernel|) kernel-table]
[(|#%futures|) futures-table] [(|#%read|) (make-hasheq)]
[(|#%place|) place-table] [(|#%paramz|) paramz-table]
[(|#%flfxnum|) flfxnum-table] [(|#%unsafe|) unsafe-table]
[(|#%extfl|) extfl-table] [(|#%foreign|) foreign-table]
[(|#%network|) network-table] [(|#%futures|) futures-table]
[else #f])) [(|#%place|) place-table]
[(|#%flfxnum|) flfxnum-table]
[(|#%extfl|) extfl-table]
[(|#%network|) network-table]
[else (hash-ref user-installed-tables key #f)])]
[(key table)
(hash-set! user-installed-tables key table)]))
(define-syntax define-primitive-table (define-syntax define-primitive-table
(syntax-rules () (syntax-rules ()