int
cos_retain_symbol (COS_Object obj)
{
- cos_retain_object (((COS_Symbol)obj)->value);
- cos_retain_object (((COS_Symbol)obj)->name);
+ //cos_retain_object (((COS_Symbol)obj)->value);
+ //cos_retain_object (((COS_Symbol)obj)->name);
return 0;
}
return 0;
}
+int
+cos_symbol_p (COS_object obj)
+{
+ return COS_OBJECT_SYMBOL_P (obj);
+}
+
COS_Symbol
cos_symbol_table_intern (COS_Symbol_Table table, COS_object name)
{
table->data[i] = entry;
return entry;
}
- else if ( (entry->name->size == key_string->size)
+ else if ( COS_OBJECT_SYMBOL_P (entry)
+ && COS_OBJECT_STRING_P (entry->name)
+ && (entry->name->size == key_string->size)
&& (memcmp (entry->name->data,
key_string->data, key_string->size) == 0) )
{
+ cos_retain_object ((COS_object)entry);
return entry;
}
}
}
int
+cos_print_symbol_table (COS_Symbol_Table table)
+{
+ int i;
+ COS_Symbol entry;
+
+ if (table == NULL)
+ table = cos_default_symbol_table;
+
+ printf ("#[symbol_table %lX\tsize = %d", table->size);
+ for (i = 0; i < table->size; i++)
+ {
+ entry = table->data[i];
+ printf ("\n\t%d : ", i);
+ cos_print_object (entry);
+ }
+ printf ("\t]\n");
+ return 0;
+}
+
+int
cos_symbol_table_grow (COS_Symbol_Table table)
{
COS_Symbol_Table new_table
if (new_table == NULL)
return -1;
+ //printf ("\n(old table is ");
+ //cos_print_symbol_table (table);
for (i = 0; i < table->size; i++)
{
COS_Symbol entry = table->data[i];
table->size = new_table->size;
table->data = new_table->data;
free (new_table);
+ //printf ("\t)\n(new table is ");
+ //cos_print_symbol_table (table);
+ //printf ("\t)\n");
return 0;
}