From 025c5cd4ecd855953c5fb34355eabf77af289cea Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 24 Apr 2018 22:55:42 -0700 Subject: [PATCH] Add type and constructors for datum-weak hash tables. --- src/runtime/hash-table.scm | 16 +++++++++++++--- src/runtime/runtime.pkg | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/runtime/hash-table.scm b/src/runtime/hash-table.scm index 42c1b01db..482f41a00 100644 --- a/src/runtime/hash-table.scm +++ b/src/runtime/hash-table.scm @@ -1262,8 +1262,10 @@ USA. (define equal-hash-table-type) (define key-ephemeral-eq-hash-table-type) (define key-weak-eq-hash-table-type) +(define datum-weak-eq-hash-table-type) (define key-ephemeral-eqv-hash-table-type) (define key-weak-eqv-hash-table-type) +(define datum-weak-eqv-hash-table-type) (define non-pointer-hash-table-type) (define string-hash-table-type) (define strong-eq-hash-table-type) @@ -1295,10 +1297,14 @@ USA. (make equal-hash-mod equal? #t hash-table-entry-type:strong)) (set! key-weak-eq-hash-table-type ;Open-coded (open-type! eq-hash-mod eq? #t hash-table-entry-type:key-weak)) - (set! key-weak-eqv-hash-table-type - (make eqv-hash-mod eqv? #t hash-table-entry-type:key-weak)) + (set! datum-weak-eq-hash-table-type ;Open-coded + (open-type! eq-hash-mod eq? #t hash-table-entry-type:datum-weak)) (set! key-ephemeral-eqv-hash-table-type (make eqv-hash-mod eqv? #t hash-table-entry-type:key-ephemeral)) + (set! key-weak-eqv-hash-table-type + (make eqv-hash-mod eqv? #t hash-table-entry-type:key-weak)) + (set! datum-weak-eqv-hash-table-type + (make eqv-hash-mod eqv? #t hash-table-entry-type:datum-weak)) (set! non-pointer-hash-table-type ;Open-coded (open-type! eq-hash-mod eq? #f hash-table-entry-type:strong)) (set! string-hash-table-type @@ -1308,12 +1314,14 @@ USA. (set! strong-eqv-hash-table-type (make eqv-hash-mod eqv? #t hash-table-entry-type:strong))) unspecific)) - + (define make-equal-hash-table) (define make-key-ephemeral-eq-hash-table) (define make-key-weak-eq-hash-table) +(define make-datum-weak-eq-hash-table) (define make-key-ephemeral-eqv-hash-table) (define make-key-weak-eqv-hash-table) +(define make-datum-weak-eqv-hash-table) (define make-non-pointer-hash-table) (define make-string-hash-table) (define make-strong-eq-hash-table) @@ -1329,8 +1337,10 @@ USA. ;; This is done above. ;; (init make-key-ephemeral-eq-hash-table key-ephemeral-eq-hash-table-type) (init make-key-weak-eq-hash-table key-weak-eq-hash-table-type) + (init make-datum-weak-eq-hash-table datum-weak-eq-hash-table-type) (init make-key-ephemeral-eqv-hash-table key-ephemeral-eqv-hash-table-type) (init make-key-weak-eqv-hash-table key-weak-eqv-hash-table-type) + (init make-datum-weak-eqv-hash-table datum-weak-eqv-hash-table-type) (init make-non-pointer-hash-table non-pointer-hash-table-type) (init make-string-hash-table string-hash-table-type) (init make-strong-eq-hash-table strong-eq-hash-table-type) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 433724da4..ffac4dc59 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -2408,6 +2408,8 @@ USA. (weak-eq-hash-table-type key-weak-eq-hash-table-type) (weak-eqv-hash-table-type key-weak-eqv-hash-table-type) alist->hash-table ;SRFI-69 + datum-weak-eq-hash-table-type + datum-weak-eqv-hash-table-type eq-hash eq-hash-mod equal-hash @@ -2462,6 +2464,8 @@ USA. key-ephemeral-eqv-hash-table-type key-weak-eq-hash-table-type key-weak-eqv-hash-table-type + make-datum-weak-eq-hash-table + make-datum-weak-eqv-hash-table make-equal-hash-table make-hash-table make-hash-table* -- 2.25.1