diff --git a/scheme/ikarus.hash-tables.ss b/scheme/ikarus.hash-tables.ss index 8bc7493..21a33fe 100644 --- a/scheme/ikarus.hash-tables.ss +++ b/scheme/ikarus.hash-tables.ss @@ -18,7 +18,8 @@ (export make-eq-hashtable hashtable-ref hashtable-set! hashtable? hashtable-size hashtable-delete! hashtable-contains? hashtable-update! hashtable-keys hashtable-mutable? - hashtable-clear! hashtable-entries hashtable-copy) + hashtable-clear! hashtable-entries hashtable-copy + string-hash) (import (ikarus system $pairs) (ikarus system $vectors) @@ -27,7 +28,8 @@ (except (ikarus) make-eq-hashtable hashtable-ref hashtable-set! hashtable? hashtable-size hashtable-delete! hashtable-contains? hashtable-update! hashtable-keys hashtable-mutable? - hashtable-clear! hashtable-entries hashtable-copy)) + hashtable-clear! hashtable-entries hashtable-copy + string-hash)) (define-struct hasht (vec count tc mutable?)) @@ -404,4 +406,9 @@ h) (error 'hashtable-copy "not a hash table" h))])) + (define (string-hash s) + (if (string? s) + (foreign-call "ikrt_string_hash" s) + (error 'string-hash "not a string" s))) + ) diff --git a/scheme/last-revision b/scheme/last-revision index 2b4ff56..1b6d75c 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1114 +1115 diff --git a/scheme/makefile.ss b/scheme/makefile.ss index 8ebf8b8..90008ed 100755 --- a/scheme/makefile.ss +++ b/scheme/makefile.ss @@ -1192,7 +1192,7 @@ [make-hashtable r ht] [hashtable-equivalence-function r ht] [equal-hash r ht] - [string-hash r ht] + [string-hash i r ht] [string-ci-hash r ht] [symbol-hash r ht] [list-sort i r sr] diff --git a/scheme/todo-r6rs.ss b/scheme/todo-r6rs.ss index 25bccbe..cc25e1d 100755 --- a/scheme/todo-r6rs.ss +++ b/scheme/todo-r6rs.ss @@ -565,7 +565,7 @@ [flush-output-port C ip] [get-bytevector-all S ip] [get-bytevector-n C ip] - [get-bytevector-n! S ip] + [get-bytevector-n! C ip] [get-bytevector-some S ip] [get-char C ip] [get-datum C ip] @@ -699,7 +699,7 @@ [make-hashtable S ht] [hashtable-equivalence-function S ht] [equal-hash S ht] - [string-hash S ht] + [string-hash C ht] [string-ci-hash S ht] [symbol-hash S ht] ;;; diff --git a/src/ikarus-symbol-table.c b/src/ikarus-symbol-table.c index a355e98..41871a2 100644 --- a/src/ikarus-symbol-table.c +++ b/src/ikarus-symbol-table.c @@ -51,6 +51,11 @@ compute_hash(ikp str){ return h; } +ikp +ikrt_string_hash(ikp str){ + return fix(compute_hash(str)); +} + static int strings_eqp(ikp str1, ikp str2){ ikp len = ref(str1, off_string_length); if(len == ref(str2, off_string_length)){