summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-11-21 11:12:20 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-11-21 11:12:20 -0800
commit4a1556a848c5bfb527cecb2b823a750ba63e6f80 (patch)
treebe9378666222056692e4770a8f0eb79b45ef8993 /hash.c
parent00f823aee439ed8c2cdd71dfbb89385dc68eae7b (diff)
downloadtxr-4a1556a848c5bfb527cecb2b823a750ba63e6f80.tar.gz
txr-4a1556a848c5bfb527cecb2b823a750ba63e6f80.tar.bz2
txr-4a1556a848c5bfb527cecb2b823a750ba63e6f80.zip
Introducing symbol packages. Internal symbols are now in
a system package instead of being hacked with the $ prefix. Keyword symbols are provided. In the matcher, evaluation is tightened up. Keywords, nil and t are not bindeable, and errors are thrown if attempts are made to bind them. Destructuring in dest_bind is strict in the number of items. String streams are exploited to print bindings to objects that are not strings or characters. Numerous bugfixes.
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 28bd8455..81d2709b 100644
--- a/hash.c
+++ b/hash.c
@@ -93,6 +93,7 @@ static long ll_hash(val obj)
case NUM:
return c_num(obj) & NUM_MAX;
case SYM:
+ case PKG:
return ((long) obj) & NUM_MAX;
case FUN:
return ((long) obj->f.f.interp_fun + ll_hash(obj->f.env)) & NUM_MAX;
@@ -238,12 +239,12 @@ val make_hash(val weak_keys, val weak_vals)
return hash;
}
-val *gethash_l(val hash, val key)
+val *gethash_l(val hash, val key, val *new_p)
{
struct hash *h = (struct hash *) hash->co.handle;
val *pchain = vecref_l(h->table, num(ll_hash(key) % h->modulus));
val old = *pchain;
- val *place = acons_new_l(pchain, key);
+ val *place = acons_new_l(pchain, key, new_p);
if (old != *pchain && ++h->count > 2 * h->modulus)
hash_grow(h);
return place;