COS_Symbol cos_Qt = &cos_symbol_ent_t;
+COS_String_ent cos_string_ent_composition = { {COS_OBJECT_PREFIX_OBJECT,
+ COS_Object_Type_String,
+ 1},
+ 3, "composition"};
+
+COS_Symbol_ent cos_symbol_ent_composition = { {COS_OBJECT_PREFIX_OBJECT,
+ COS_Object_Type_Symbol,
+ 1},
+ &cos_string_ent_composition,
+ NULL};
+
+COS_Symbol cos_Qcomposition = &cos_symbol_ent_composition;
+
+
COS_Symbol_Table cos_default_symbol_table = NULL;
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;
}
if (obj == NULL)
return 0;
+ if ( (obj == cos_Qnil) || (obj == cos_Qt) ||
+ (obj == cos_Qcomposition) )
+ return 0;
+
if ( ((COS_Symbol)obj)->value != NULL)
cos_release_object (((COS_Symbol)obj)->value);
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;
}
}
cos_default_symbol_table = cos_make_symbol_table();
cos_symbol_table_set (cos_default_symbol_table, cos_Qnil);
cos_symbol_table_set (cos_default_symbol_table, cos_Qt);
+ cos_symbol_table_set (cos_default_symbol_table, cos_Qcomposition);
}
return cos_symbol_table_intern (cos_default_symbol_table, name);
}
}
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;
}