added some basic code to handle a method dictionary
This commit is contained in:
@ -122,6 +122,7 @@ static int ignite_1 (stix_t* stix)
|
||||
stix->_symbol = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 1, STIX_OBJ_TYPE_CHAR));
|
||||
stix->_symbol_set = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(STIX_SET_NAMED_INSTVARS, 0, STIX_OBJ_TYPE_OOP));
|
||||
stix->_system_dictionary = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(STIX_SET_NAMED_INSTVARS, 0, STIX_OBJ_TYPE_OOP));
|
||||
stix->_method_dictionary = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(STIX_SET_NAMED_INSTVARS, 0, STIX_OBJ_TYPE_OOP));
|
||||
stix->_association = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(STIX_ASSOCIATION_NAMED_INSTVARS, 0, STIX_OBJ_TYPE_OOP));
|
||||
stix->_true_class = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 0, STIX_OBJ_TYPE_OOP));
|
||||
stix->_false_class = alloc_kernel_class (stix, 0, STIX_CLASS_SPEC_MAKE(0, 0, STIX_OBJ_TYPE_OOP));
|
||||
@ -134,8 +135,8 @@ static int ignite_1 (stix_t* stix)
|
||||
|
||||
if (!stix->_stix || !stix->_nil_object || !stix->_object ||
|
||||
!stix->_array || !stix->_string || !stix->_symbol ||
|
||||
!stix->_symbol_set || !stix->_system_dictionary || !stix->_association ||
|
||||
!stix->_true_class || !stix->_false_class ||
|
||||
!stix->_symbol_set || !stix->_system_dictionary || !stix->_method_dictionary ||
|
||||
!stix->_association || !stix->_true_class || !stix->_false_class ||
|
||||
!stix->_character || !stix->_small_integer) return -1;
|
||||
STIX_OBJ_SET_CLASS (stix->_nil, stix->_nil_object);
|
||||
return 0;
|
||||
@ -143,7 +144,7 @@ static int ignite_1 (stix_t* stix)
|
||||
|
||||
static int ignite_2 (stix_t* stix)
|
||||
{
|
||||
stix_oop_oop_t arr;
|
||||
stix_oop_t tmp;
|
||||
|
||||
/* Create 'true' and 'false objects */
|
||||
stix->_true = stix_instantiate (stix, stix->_true_class, STIX_NULL, 0);
|
||||
@ -151,8 +152,9 @@ static int ignite_2 (stix_t* stix)
|
||||
if (!stix->_true || !stix->_false) return -1;
|
||||
|
||||
/* Create the symbol table */
|
||||
stix->symtab = (stix_oop_set_t)stix_instantiate (stix, stix->_symbol_set, STIX_NULL, 0);
|
||||
if (!stix->symtab) return -1;
|
||||
tmp = stix_instantiate (stix, stix->_symbol_set, STIX_NULL, 0);
|
||||
if (!tmp) return -1;
|
||||
stix->symtab = (stix_oop_set_t)tmp;
|
||||
|
||||
stix->symtab->tally = STIX_OOP_FROM_SMINT(0);
|
||||
/* It's important to assign the result of stix_instantiate() to a temporary
|
||||
@ -160,18 +162,19 @@ static int ignite_2 (stix_t* stix)
|
||||
* The pointer 'stix->symtab; can change in stix_instantiate() and the
|
||||
* target address of assignment may get set before stix_instantiate()
|
||||
* is called. */
|
||||
arr = (stix_oop_oop_t)stix_instantiate (stix, stix->_array, STIX_NULL, stix->option.dfl_symtab_size);
|
||||
if (!arr) return -1;
|
||||
stix->symtab->bucket = arr;
|
||||
tmp = stix_instantiate (stix, stix->_array, STIX_NULL, stix->option.dfl_symtab_size);
|
||||
if (!tmp) return -1;
|
||||
stix->symtab->bucket = (stix_oop_oop_t)tmp;
|
||||
|
||||
/* Create the system dictionary */
|
||||
stix->sysdic = (stix_oop_set_t)stix_instantiate (stix, stix->_system_dictionary, STIX_NULL, 0);
|
||||
if (!stix->sysdic) return -1;
|
||||
tmp = stix_instantiate (stix, stix->_system_dictionary, STIX_NULL, 0);
|
||||
if (!tmp) return -1;
|
||||
stix->sysdic = (stix_oop_set_t)tmp;
|
||||
|
||||
stix->sysdic->tally = STIX_OOP_FROM_SMINT(0);
|
||||
arr = (stix_oop_oop_t)stix_instantiate (stix, stix->_array, STIX_NULL, stix->option.dfl_sysdic_size);
|
||||
if (!arr) return -1;
|
||||
stix->sysdic->bucket = arr;
|
||||
tmp = stix_instantiate (stix, stix->_array, STIX_NULL, stix->option.dfl_sysdic_size);
|
||||
if (!tmp) return -1;
|
||||
stix->sysdic->bucket = (stix_oop_oop_t)tmp;
|
||||
|
||||
/* Export the system dictionary via the first class variable of the Stix class */
|
||||
((stix_oop_class_t)stix->_stix)->classvar[0] = (stix_oop_t)stix->sysdic;
|
||||
@ -197,6 +200,7 @@ static int ignite_3 (stix_t* stix)
|
||||
{ 5, { 'A','r','r','a','y' } },
|
||||
{ 9, { 'S','y','m','b','o','l','S','e','t' } },
|
||||
{ 16, { 'S','y','s','t','e','m','D','i','c','t','i','o','n','a','r','y' } },
|
||||
{ 16, { 'M','e','t','h','o','d','D','i','c','t','i','o','n','a','r','y' } },
|
||||
{ 11, { 'A','s','s','o','c','i','a','t','i','o','n' } },
|
||||
{ 4, { 'T','r','u','e' } },
|
||||
{ 5, { 'F','a','l','s','e' } },
|
||||
|
Reference in New Issue
Block a user