The fasl-loader interns gensyms by default now.

This commit is contained in:
Abdulaziz Ghuloum 2006-12-25 10:35:18 +03:00
parent b9a369197a
commit 158980aeea
5 changed files with 11 additions and 15 deletions

Binary file not shown.

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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*);

Binary file not shown.