diff --git a/bin/ikarus b/bin/ikarus index cf97a7c..2392bec 100755 Binary files a/bin/ikarus and b/bin/ikarus differ diff --git a/bin/ikarus-fasl.c b/bin/ikarus-fasl.c index 8eb2c90..977bd79 100644 --- a/bin/ikarus-fasl.c +++ b/bin/ikarus-fasl.c @@ -310,16 +310,11 @@ static ikp do_read(ikpcb* pcb, fasl_port* p){ char x = fasl_read_byte(p); return byte_to_scheme_char(x); } - else if(c == 'G'){ /* G is for gensym */ + else if(c == 'G'){ + /* G is for gensym */ ikp pretty = do_read(pcb, p); ikp unique = do_read(pcb, p); - ikp sym = ik_alloc(pcb, align(symbol_size)) + symbol_tag; - ref(sym, off_symbol_string) = pretty; - ref(sym, off_symbol_ustring) = unique; - ref(sym, off_symbol_value) = unbound_object; - ref(sym, off_symbol_system_value) = unbound_object; - ref(sym, off_symbol_plist) = null_object; - ref(sym, off_symbol_system_plist) = null_object; + ikp sym = ikrt_strings_to_gensym(pretty, unique, pcb); if(put_mark_index){ p->marks[put_mark_index] = sym; } diff --git a/bin/ikarus-symbol-table.c b/bin/ikarus-symbol-table.c index 210e3ab..ad34bb6 100644 --- a/bin/ikarus-symbol-table.c +++ b/bin/ikarus-symbol-table.c @@ -78,21 +78,21 @@ intern_string(ikp str, ikp st, ikpcb* pcb){ return sym; } -ikp -ikrt_intern_unique_string(ikp ustr, ikp st, ikpcb* pcb){ +static ikp +intern_unique_string(ikp str, ikp ustr, ikp st, ikpcb* pcb){ int h = compute_hash(ustr); int idx = h & (unfix(ref(st, off_vector_length)) - 1); ikp bckt = ref(st, off_vector_data + idx*wordsize); ikp b = bckt; while(b){ ikp sym = ref(b, off_car); - ikp sym_str = ref(sym, off_symbol_ustring); - if(strings_eqp(sym_str, ustr)){ + ikp sym_ustr = ref(sym, off_symbol_ustring); + if(strings_eqp(sym_ustr, ustr)){ return sym; } b = ref(b, off_cdr); } - ikp sym = ik_make_symbol(false_object, ustr, pcb); + ikp sym = ik_make_symbol(str, ustr, pcb); b = ik_alloc(pcb, pair_size) + pair_tag; ref(b, off_car) = sym; ref(b, off_cdr) = bckt; @@ -148,13 +148,13 @@ ik_intern_string(ikp str, ikpcb* pcb){ } ikp -ikrt_string_to_gensym(ikp str, ikpcb* pcb){ +ikrt_strings_to_gensym(ikp str, ikp ustr, ikpcb* pcb){ ikp st = pcb->gensym_table; if(st == 0){ st = make_symbol_table(pcb); pcb->gensym_table = st; } - return intern_string(str, st, pcb); + return intern_unique_string(str, ustr, st, pcb); } diff --git a/bin/ikarus.h b/bin/ikarus.h index 6b5742c..27cb2a2 100644 --- a/bin/ikarus.h +++ b/bin/ikarus.h @@ -162,6 +162,7 @@ void ik_print(ikp x); void ik_fprint(FILE*, ikp x); ikp ikrt_string_to_symbol(ikp, ikpcb*); +ikp ikrt_strings_to_gensym(ikp, ikp, ikpcb*); ikp ik_cstring_to_symbol(char*, ikpcb*); diff --git a/src/ikarus.boot b/src/ikarus.boot index 341ef5c..7c07ce4 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ