From: Taylor R Campbell Date: Mon, 21 Dec 2009 16:35:39 +0000 (-0500) Subject: Add names for hash table types with the word `weak' in them. X-Git-Tag: 20100708-Gtk~194 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=c88117dfe1e18a2be7a71a918fb64d59a5989170;p=mit-scheme.git Add names for hash table types with the word `weak' in them. New global bindings: MAKE-WEAK-EQ-HASH-TABLE MAKE-WEAK-EQV-HASH-TABLE WEAK-EQ-HASH-TABLE-TYPE WEAK-EQV-HASH-TABLE-TYPE {EQ,EQV}-HASH-TABLE-TYPE and MAKE-{EQ,EQV}-HASH-TABLE are now aliases for WEAK-{EQ,EQV}-HASH-TABLE-TYPE and MAKE-WEAK-{EQ,EQV}-HASH-TABLE, as are MAKE-{SYMBOL,OBJECT}-HASH-TABLE. --- diff --git a/src/runtime/hashtb.scm b/src/runtime/hashtb.scm index 9eb3f5bf8..a0fa9274c 100644 --- a/src/runtime/hashtb.scm +++ b/src/runtime/hashtb.scm @@ -880,30 +880,28 @@ USA. (define address-hash-tables) -(define eq-hash-table-type) +(define weak-eq-hash-table-type) (define strong-eq-hash-table-type) -(define eqv-hash-table-type) +(define weak-eqv-hash-table-type) (define strong-eqv-hash-table-type) (define equal-hash-table-type) (define string-hash-table-type) -(define make-eq-hash-table) +(define make-weak-eq-hash-table) (define make-strong-eq-hash-table) -(define make-eqv-hash-table) +(define make-weak-eqv-hash-table) (define make-strong-eqv-hash-table) (define make-equal-hash-table) (define make-string-hash-table) -(define make-symbol-hash-table) -(define make-object-hash-table) (define (initialize-package!) (set! address-hash-tables '()) (add-primitive-gc-daemon! mark-address-hash-tables!) - (set! eq-hash-table-type + (set! weak-eq-hash-table-type (make-weak-rehash-type eq-hash-mod eq?)) (set! strong-eq-hash-table-type (make-strong-rehash-type eq-hash-mod eq?)) - (set! eqv-hash-table-type + (set! weak-eqv-hash-table-type (make-weak-rehash-type eqv-hash-mod eqv?)) (set! strong-eqv-hash-table-type (make-strong-rehash-type eqv-hash-mod eqv?)) @@ -911,11 +909,11 @@ USA. (make-strong-rehash-type equal-hash-mod equal?)) (set! string-hash-table-type (make-strong-no-rehash-type string-hash-mod string=?)) - (set! make-eq-hash-table + (set! make-weak-eq-hash-table (hash-table-constructor eq-hash-table-type)) (set! make-strong-eq-hash-table (hash-table-constructor strong-eq-hash-table-type)) - (set! make-eqv-hash-table + (set! make-weak-eqv-hash-table (hash-table-constructor eqv-hash-table-type)) (set! make-strong-eqv-hash-table (hash-table-constructor strong-eqv-hash-table-type)) @@ -923,9 +921,6 @@ USA. (hash-table-constructor equal-hash-table-type)) (set! make-string-hash-table (hash-table-constructor string-hash-table-type)) - ;; Define old names for compatibility: - (set! make-symbol-hash-table make-eq-hash-table) - (set! make-object-hash-table make-eqv-hash-table) unspecific) (define (mark-address-hash-tables!) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 34ff33188..aa260746e 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1885,6 +1885,8 @@ USA. (files "hashtb") (parent (runtime)) (export () + (eq-hash-table-type weak-eq-hash-table-type) + (eqv-hash-table-type weak-eqv-hash-table-type) (hash-table-delete! hash-table/remove!) (hash-table-equivalence-function hash-table/key=?) (hash-table-hash-function hash-table/key-hash) @@ -1895,16 +1897,18 @@ USA. (hash-table-update!/default hash-table/modify!) (hash-table-values hash-table/datum-list) (hash-table-walk hash-table/for-each) + (make-eq-hash-table make-weak-eq-hash-table) + (make-eqv-hash-table make-weak-eqv-hash-table) + (make-object-hash-table make-weak-eqv-hash-table) + (make-symbol-hash-table make-weak-eq-hash-table) alist->hash-table eq-hash eq-hash-mod - eq-hash-table-type equal-hash equal-hash-mod equal-hash-table-type eqv-hash eqv-hash-mod - eqv-hash-table-type error:not-hash-table guarantee-hash-table hash-by-identity @@ -1934,21 +1938,21 @@ USA. hash-table/size hash-table/type hash-table? - make-eq-hash-table make-equal-hash-table - make-eqv-hash-table make-hash-table - make-object-hash-table make-string-hash-table make-strong-eq-hash-table make-strong-eqv-hash-table - make-symbol-hash-table + make-weak-eq-hash-table + make-weak-eqv-hash-table set-hash-table/rehash-size! set-hash-table/rehash-threshold! string-hash-table-type strong-eq-hash-table-type strong-eqv-hash-table-type strong-hash-table/constructor + weak-eq-hash-table-type + weak-eqv-hash-table-type weak-hash-table/constructor) (initialization (initialize-package!)))