core: hashq_get_handle: FIX!
This commit is contained in:
parent
5ee49f2887
commit
63e0996aaa
|
@ -63,7 +63,7 @@ struct scm *gc ();
|
|||
/* src/hash.c */
|
||||
struct scm *hashq (struct scm *x, struct scm *size);
|
||||
struct scm *hash (struct scm *x, struct scm *size);
|
||||
struct scm *hashq_get_handle_ (struct scm *table, struct scm *key, struct scm *dflt);
|
||||
struct scm *hashq_get_handle_ (struct scm *table, struct scm *key);
|
||||
struct scm *hashq_ref_ (struct scm *table, struct scm *key, struct scm *dflt);
|
||||
struct scm *hash_ref_ (struct scm *table, struct scm *key, struct scm *dflt);
|
||||
struct scm *hashq_set_handle_x (struct scm *table, struct scm *key, struct scm *value);
|
||||
|
|
|
@ -173,7 +173,7 @@ mes_builtins (struct scm *a) /*:((internal)) */
|
|||
/* src/hash.c */
|
||||
a = init_builtin (builtin_type, "hashq", 2, &hashq, a);
|
||||
a = init_builtin (builtin_type, "hash", 2, &hash, a);
|
||||
a = init_builtin (builtin_type, "core:hashq-get-handle", 3, &hashq_get_handle_, a);
|
||||
a = init_builtin (builtin_type, "core:hashq-get-handle", 2, &hashq_get_handle_, a);
|
||||
a = init_builtin (builtin_type, "core:hashq-ref", 3, &hashq_ref_, a);
|
||||
a = init_builtin (builtin_type, "core:hash-ref", 3, &hash_ref_, a);
|
||||
a = init_builtin (builtin_type, "hashq-set-handle!", 3, &hashq_set_handle_x, a);
|
||||
|
|
|
@ -148,7 +148,7 @@ struct scm *
|
|||
macro_get_handle (struct scm *name) /*:((internal)) */
|
||||
{
|
||||
if (name->type == TSYMBOL)
|
||||
return hashq_get_handle_ (g_macros, name, cell_nil);
|
||||
return hashq_get_handle_ (g_macros, name);
|
||||
return cell_f;
|
||||
}
|
||||
|
||||
|
|
12
src/hash.c
12
src/hash.c
|
@ -66,7 +66,7 @@ hash (struct scm *x, struct scm *size)
|
|||
}
|
||||
|
||||
struct scm *
|
||||
hashq_get_handle_ (struct scm *table, struct scm *key, struct scm *dflt)
|
||||
hashq_get_handle_ (struct scm *table, struct scm *key)
|
||||
{
|
||||
struct scm *s = struct_ref_ (table, 3);
|
||||
long size = s->value;
|
||||
|
@ -74,8 +74,6 @@ hashq_get_handle_ (struct scm *table, struct scm *key, struct scm *dflt)
|
|||
struct scm *buckets = struct_ref_ (table, 4);
|
||||
struct scm *bucket = vector_ref_ (buckets, hash);
|
||||
struct scm *x = cell_f;
|
||||
if (dflt->type == TPAIR)
|
||||
x = dflt->car;
|
||||
if (bucket->type == TPAIR)
|
||||
x = assq (key, bucket);
|
||||
return x;
|
||||
|
@ -84,9 +82,11 @@ hashq_get_handle_ (struct scm *table, struct scm *key, struct scm *dflt)
|
|||
struct scm *
|
||||
hashq_ref_ (struct scm *table, struct scm *key, struct scm *dflt)
|
||||
{
|
||||
struct scm *x = hashq_get_handle_ (table, key, dflt);
|
||||
struct scm *x = hashq_get_handle_ (table, key);
|
||||
if (x != cell_f)
|
||||
x = x->cdr;
|
||||
else
|
||||
x = dflt;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -98,9 +98,7 @@ hash_ref_ (struct scm *table, struct scm *key, struct scm *dflt)
|
|||
unsigned hash = hash_ (key, size);
|
||||
struct scm *buckets = struct_ref_ (table, 4);
|
||||
struct scm *bucket = vector_ref_ (buckets, hash);
|
||||
struct scm *x = cell_f;
|
||||
if (dflt->type == TPAIR)
|
||||
x = dflt->car;
|
||||
struct scm *x = dflt;
|
||||
if (bucket->type == TPAIR)
|
||||
{
|
||||
x = assoc (key, bucket);
|
||||
|
|
|
@ -46,7 +46,7 @@ current_module () /*:((internal)) */
|
|||
if (booted_p->type == TPAIR && booted_p->cdr != cell_f)
|
||||
{
|
||||
*/
|
||||
struct scm *module = hashq_get_handle_ (M0, cstring_to_symbol ("*current-module*"), cell_f);
|
||||
struct scm *module = hashq_get_handle_ (M0, cstring_to_symbol ("*current-module*"));
|
||||
if (module->type == TPAIR && module->cdr != cell_f)
|
||||
return module->cdr;
|
||||
/*
|
||||
|
@ -85,7 +85,7 @@ module_handle (struct scm *module, struct scm *name) /*:((internal)) */
|
|||
eputs ("\n");
|
||||
}
|
||||
|
||||
struct scm *handle = hashq_get_handle_ (table, name, cell_f);
|
||||
struct scm *handle = hashq_get_handle_ (table, name);
|
||||
if (handle != cell_f)
|
||||
return handle;
|
||||
|
||||
|
@ -111,7 +111,7 @@ module_handle (struct scm *module, struct scm *name) /*:((internal)) */
|
|||
}
|
||||
|
||||
/* 4. Hack for Mes: always look in M0. */
|
||||
handle = hashq_get_handle_ (M0, name, cell_f);
|
||||
handle = hashq_get_handle_ (M0, name);
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
|
@ -134,14 +134,14 @@ lookup_handle (struct scm *name, struct scm *define_p)
|
|||
if (define_p == cell_f)
|
||||
{
|
||||
if (module == M0)
|
||||
handle = hashq_get_handle_ (M0, name, cell_f);
|
||||
handle = hashq_get_handle_ (M0, name);
|
||||
else
|
||||
handle = module_handle (module, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct scm *table = module_defines (module);
|
||||
handle = hashq_get_handle_ (table, name, cell_f);
|
||||
handle = hashq_get_handle_ (table, name);
|
||||
if (handle == cell_f)
|
||||
{
|
||||
if (g_debug > 0)
|
||||
|
|
Loading…
Reference in New Issue