mes: hash: Guile interface compliancy.
* mes/module/mes/scm.mes (hashq-get-handle, hashq-ref, hash-ref): New function. * src/hash.c (hashq_get_handle_): Rename from hashq_get_handle. Update users. (hashq_ref_): Likewise. (hash_ref_): Likewise.
This commit is contained in:
parent
166c93c458
commit
52733ced9a
|
@ -63,9 +63,9 @@ 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_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_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 *hash_ref_ (struct scm *table, struct scm *key, struct scm *dflt);
|
||||
struct scm *hashq_set_x (struct scm *table, struct scm *key, struct scm *value);
|
||||
struct scm *hash_set_x (struct scm *table, struct scm *key, struct scm *value);
|
||||
struct scm *hash_table_printer (struct scm *table);
|
||||
|
|
|
@ -190,6 +190,18 @@
|
|||
(lambda args
|
||||
(proc (apply (apply compose rest) args)))))
|
||||
|
||||
|
||||
;; Hash
|
||||
|
||||
(define (hashq-get-handle table key . rest)
|
||||
(core:hashq-get-handle table key (and (pair? rest) (car rest))))
|
||||
|
||||
(define (hashq-ref table key . rest)
|
||||
(core:hashq-ref table key (and (pair? rest) (car rest))))
|
||||
|
||||
(define (hash-ref table key . rest)
|
||||
(core:hash-ref table key (and (pair? rest) (car rest))))
|
||||
|
||||
|
||||
;; Vector
|
||||
(define (vector . rest) (list->vector rest))
|
||||
|
|
|
@ -173,9 +173,9 @@ 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, "hashq-get-handle", 3, &hashq_get_handle, a);
|
||||
a = init_builtin (builtin_type, "hashq-ref", 3, &hashq_ref, a);
|
||||
a = init_builtin (builtin_type, "hash-ref", 3, &hash_ref, a);
|
||||
a = init_builtin (builtin_type, "core:hashq-get-handle", 3, &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!", 3, &hashq_set_x, a);
|
||||
a = init_builtin (builtin_type, "hash-set!", 3, &hash_set_x, a);
|
||||
a = init_builtin (builtin_type, "hash-table-printer", 1, &hash_table_printer, a);
|
||||
|
|
|
@ -158,7 +158,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, cell_nil);
|
||||
return cell_f;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,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 *dflt)
|
||||
{
|
||||
struct scm *s = struct_ref_ (table, 3);
|
||||
long size = s->value;
|
||||
|
@ -86,16 +86,16 @@ 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)
|
||||
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, dflt);
|
||||
if (x != cell_f)
|
||||
x = x->cdr;
|
||||
return x;
|
||||
}
|
||||
|
||||
struct scm *
|
||||
hash_ref (struct scm *table, struct scm *key, struct scm *dflt)
|
||||
hash_ref_ (struct scm *table, struct scm *key, struct scm *dflt)
|
||||
{
|
||||
struct scm *s = struct_ref_ (table, 3);
|
||||
long size = s->value;
|
||||
|
|
|
@ -93,7 +93,7 @@ module_variable (struct scm *module, struct scm *name)
|
|||
{
|
||||
module = M0;
|
||||
struct scm *globals = struct_ref_ (module, 5);
|
||||
x = hashq_get_handle (globals, name, cell_f);
|
||||
x = hashq_get_handle_ (globals, name, cell_f);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ keyword_to_string (struct scm *keyword)
|
|||
struct scm *
|
||||
string_to_symbol (struct scm *string)
|
||||
{
|
||||
struct scm *x = hash_ref (g_symbols, string, cell_f);
|
||||
struct scm *x = hash_ref_ (g_symbols, string, cell_f);
|
||||
if (x == cell_f)
|
||||
x = make_symbol (string);
|
||||
return x;
|
||||
|
|
Loading…
Reference in New Issue