update xhash

This commit is contained in:
Yuichi Nishiwaki 2014-06-14 20:59:31 +09:00
parent 77cb18bfd4
commit f9e733a7b1
7 changed files with 21 additions and 21 deletions

@ -1 +1 @@
Subproject commit 985d9af6188a1426788e56db03025847c32e519b
Subproject commit 47a31fdbf88ea61f060b7cb45203b3a2f0149e9f

View File

@ -294,7 +294,7 @@ analyze_global_var(analyze_state *state, pic_sym sym)
xh_entry *e;
size_t i;
if ((e = xh_get(&pic->global_tbl, sym))) {
if ((e = xh_get_int(&pic->global_tbl, sym))) {
i = xh_val(e, size_t);
}
else {
@ -302,7 +302,7 @@ analyze_global_var(analyze_state *state, pic_sym sym)
if (i >= pic->gcapa) {
pic_error(pic, "global table overflow");
}
xh_put(&pic->global_tbl, sym, &i);
xh_put_int(&pic->global_tbl, sym, &i);
}
return pic_list2(pic, pic_symbol_value(state->sGREF), pic_int_value(i));
}
@ -929,18 +929,18 @@ create_activation(codegen_context *cxt)
for (i = 0; i < cxt->args.size; ++i) {
var = xv_get(&cxt->args, i);
n = i + offset;
xh_put(&regs, *var, &n);
xh_put_int(&regs, *var, &n);
}
offset += i;
for (i = 0; i < cxt->locals.size; ++i) {
var = xv_get(&cxt->locals, i);
n = i + offset;
xh_put(&regs, *var, &n);
xh_put_int(&regs, *var, &n);
}
for (i = 0; i < cxt->captures.size; ++i) {
var = xv_get(&cxt->captures, i);
if ((n = xh_val(xh_get(&regs, *var), size_t)) <= cxt->args.size || (cxt->varg && n == cxt->args.size + 1)) {
if ((n = xh_val(xh_get_int(&regs, *var), size_t)) <= cxt->args.size || (cxt->varg && n == cxt->args.size + 1)) {
/* copy arguments to capture variable area */
cxt->code[cxt->clen].insn = OP_LREF;
cxt->code[cxt->clen].u.i = n;

View File

@ -95,7 +95,7 @@ pic_export(pic_state *pic, pic_sym sym)
printf("* exporting %s as %s\n", pic_symbol_name(pic, sym), pic_symbol_name(pic, rename));
#endif
xh_put(&pic->lib->exports, sym, &rename);
xh_put_int(&pic->lib->exports, sym, &rename);
}
void
@ -111,5 +111,5 @@ pic_export_as(pic_state *pic, pic_sym sym, pic_sym as)
printf("* exporting %s as %s\n", pic_symbol_name(pic, as), pic_symbol_name(pic, rename));
#endif
xh_put(&pic->lib->exports, as, &rename);
xh_put_int(&pic->lib->exports, as, &rename);
}

View File

@ -52,7 +52,7 @@ pic_put_rename(pic_state *pic, struct pic_senv *senv, pic_sym sym, pic_sym renam
{
UNUSED(pic);
xh_put(&senv->renames, sym, &rename);
xh_put_int(&senv->renames, sym, &rename);
}
bool
@ -62,7 +62,7 @@ pic_find_rename(pic_state *pic, struct pic_senv *senv, pic_sym sym, pic_sym *ren
UNUSED(pic);
if ((e = xh_get(&senv->renames, sym)) == NULL) {
if ((e = xh_get_int(&senv->renames, sym)) == NULL) {
return false;
}
if (rename != NULL) {
@ -80,7 +80,7 @@ define_macro(pic_state *pic, pic_sym rename, struct pic_proc *proc, struct pic_s
mac->senv = senv;
mac->proc = proc;
xh_put(&pic->macros, rename, &mac);
xh_put_int(&pic->macros, rename, &mac);
}
static struct pic_macro *
@ -88,7 +88,7 @@ find_macro(pic_state *pic, pic_sym rename)
{
xh_entry *e;
if ((e = xh_get(&pic->macros, rename)) == NULL) {
if ((e = xh_get_int(&pic->macros, rename)) == NULL) {
return NULL;
}
return xh_val(e, struct pic_macro *);

View File

@ -53,7 +53,7 @@ read_label_set(int i, yyscan_t scanner)
val = pic_cons(pic, pic_none_value(), pic_none_value());
xh_put(&yylabels, i, &val);
xh_put_int(&yylabels, i, &val);
tmp = read(tok, scanner);
pic_pair_ptr(val)->car = pic_car(pic, tmp);
@ -67,7 +67,7 @@ read_label_set(int i, yyscan_t scanner)
val = pic_obj_value(pic_vec_new(pic, 0));
xh_put(&yylabels, i, &val);
xh_put_int(&yylabels, i, &val);
tmp = pic_vec_ptr(read(tok, scanner));
SWAP(pic_value *, tmp->data, pic_vec_ptr(val)->data);
@ -79,7 +79,7 @@ read_label_set(int i, yyscan_t scanner)
{
val = read(tok, scanner);
xh_put(&yylabels, i, &val);
xh_put_int(&yylabels, i, &val);
return val;
}
@ -91,7 +91,7 @@ read_label_ref(int i, yyscan_t scanner)
{
xh_entry *e;
e = xh_get(&yylabels, i);
e = xh_get_int(&yylabels, i);
if (! e) {
error("label of given index not defined", scanner);
}

View File

@ -27,7 +27,7 @@ pic_intern(pic_state *pic, const char *str, size_t len)
id = pic->sym_cnt++;
xh_put(&pic->syms, cstr, &id);
xh_put(&pic->sym_names, id, &cstr);
xh_put_int(&pic->sym_names, id, &cstr);
return id;
}
@ -50,7 +50,7 @@ pic_gensym(pic_state *pic, pic_sym base)
/* don't put the symbol to pic->syms to keep it uninterned */
uniq = pic->sym_cnt++;
xh_put(&pic->sym_names, uniq, &str);
xh_put_int(&pic->sym_names, uniq, &str);
return uniq;
}
@ -64,7 +64,7 @@ pic_interned_p(pic_state *pic, pic_sym sym)
const char *
pic_symbol_name(pic_state *pic, pic_sym sym)
{
return xh_val(xh_get(&pic->sym_names, sym), const char *);
return xh_val(xh_get_int(&pic->sym_names, sym), const char *);
}
static pic_value

View File

@ -360,7 +360,7 @@ global_ref(pic_state *pic, const char *name)
if (! pic_find_rename(pic, pic->lib->senv, sym, &rename)) {
return SIZE_MAX;
}
if (! (e = xh_get(&pic->global_tbl, rename))) {
if (! (e = xh_get_int(&pic->global_tbl, rename))) {
return SIZE_MAX;
}
return xh_val(e, size_t);
@ -386,7 +386,7 @@ global_def(pic_state *pic, const char *name)
if (pic->glen >= pic->gcapa) {
pic_error(pic, "global table overflow");
}
xh_put(&pic->global_tbl, rename, &gidx);
xh_put_int(&pic->global_tbl, rename, &gidx);
return gidx;
}