diff --git a/ase/stx/memory.c b/ase/stx/memory.c index bb51d304..9a930c20 100644 --- a/ase/stx/memory.c +++ b/ase/stx/memory.c @@ -1,5 +1,5 @@ /* - * $Id: memory.c,v 1.7 2005-05-08 11:16:07 bacon Exp $ + * $Id: memory.c,v 1.8 2005-05-18 16:34:51 bacon Exp $ */ #include @@ -31,19 +31,11 @@ xp_stx_memory_t* xp_stx_memory_open ( mem->slots = slots; /* weave the free slot list */ - /* - mem->free = &slots[capacity - 1]; - while (capacity > 1) { - capacity--; - mem->slots[capacity] = (xp_stx_object_t*)&mem->slots[capacity - 1]; - } - mem->slots[--capacity] = XP_NULL; - */ mem->free = &slots[0]; for (n = 0; n < capacity - 1; n++) { mem->slots[n] = (xp_stx_object_t*)&mem->slots[n + 1]; } - mem->slots[n + 1] = XP_NULL; + mem->slots[n] = XP_NULL; return mem; } @@ -86,6 +78,7 @@ xp_stx_word_t xp_stx_memory_alloc (xp_stx_memory_t* mem, xp_stx_word_t nbytes) mem->free = (xp_stx_object_t**)*slot; *slot = object; +xp_printf (XP_TEXT("returning %d\n"), slot - mem->slots); return (xp_stx_word_t)(slot - mem->slots); } diff --git a/ase/stx/object.c b/ase/stx/object.c index 74a20bdf..4e8bed0a 100644 --- a/ase/stx/object.c +++ b/ase/stx/object.c @@ -1,5 +1,5 @@ /* - * $Id: object.c,v 1.15 2005-05-18 04:01:51 bacon Exp $ + * $Id: object.c,v 1.16 2005-05-18 16:34:51 bacon Exp $ */ #include @@ -25,7 +25,7 @@ xp_stx_word_t xp_stx_alloc_object (xp_stx_t* stx, xp_stx_word_t n) xp_assert (stx->nil == XP_STX_NIL); XP_STX_CLASS(stx,idx) = stx->nil; XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_INDEXED; - while (n--) XP_STX_AT(stx,idx,n) = stx->nil; + while (n-- > 0) XP_STX_AT(stx,idx,n) = stx->nil; return idx; } @@ -42,7 +42,7 @@ xp_stx_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_stx_word_t n) xp_assert (stx->nil == XP_STX_NIL); XP_STX_CLASS(stx,idx) = stx->nil; XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_BYTE_INDEXED; - while (n--) XP_STX_BYTEAT(stx,idx,n) = 0; + while (n-- > 0) XP_STX_BYTEAT(stx,idx,n) = 0; return idx; } @@ -61,7 +61,7 @@ xp_stx_word_t xp_stx_alloc_string_object ( XP_STX_CLASS(stx,idx) = stx->nil; XP_STX_ACCESS(stx,idx) = (n << 2) | XP_STX_CHAR_INDEXED; XP_STX_CHARAT(stx,idx,n) = XP_STX_CHAR('\0'); - while (n--) XP_STX_CHARAT(stx,idx,n) = str[n]; + while (n-- > 0) XP_STX_CHARAT(stx,idx,n) = str[n]; return idx; } diff --git a/ase/stx/stx.c b/ase/stx/stx.c index 20302d4d..56f2a407 100644 --- a/ase/stx/stx.c +++ b/ase/stx/stx.c @@ -1,5 +1,5 @@ /* - * $Id: stx.c,v 1.18 2005-05-18 16:05:34 bacon Exp $ + * $Id: stx.c,v 1.19 2005-05-18 16:34:51 bacon Exp $ */ #include @@ -57,11 +57,14 @@ int xp_stx_bootstrap (xp_stx_t* stx) xp_stx_word_t class_Object, class_Class; xp_stx_word_t tmp; +xp_printf (XP_TEXT("bootstreap\n")); __create_bootstrapping_objects (stx); +xp_printf (XP_TEXT("bootstreap over\n")); /* more initialization */ XP_STX_CLASS(stx,stx->symbol_table) = xp_stx_new_class (stx, XP_STX_TEXT("SymbolTable")); +xp_printf (XP_TEXT("bootstreap 1111\n")); XP_STX_CLASS(stx,stx->smalltalk) = xp_stx_new_class (stx, XP_STX_TEXT("SystemDictionary")); @@ -70,15 +73,18 @@ int xp_stx_bootstrap (xp_stx_t* stx) xp_stx_hash_string_object(stx,symbol_Smalltalk), symbol_Smalltalk, stx->smalltalk); - /* more initialization for nil, true, false */ + /* create #nil, #true, #false */ xp_stx_new_symbol (stx, XP_STX_TEXT("nil")); xp_stx_new_symbol (stx, XP_STX_TEXT("true")); xp_stx_new_symbol (stx, XP_STX_TEXT("false")); + /* nil setClass: UndefinedObject */ XP_STX_CLASS(stx,stx->nil) = xp_stx_new_class (stx, XP_STX_TEXT("UndefinedObject")); + /* true setClass: True */ XP_STX_CLASS(stx,stx->true) = xp_stx_new_class (stx, XP_STX_TEXT("True")); + /* fales setClass: False */ XP_STX_CLASS(stx,stx->false) = xp_stx_new_class (stx, XP_STX_TEXT("False")); @@ -138,6 +144,7 @@ static void __create_bootstrapping_objects (xp_stx_t* stx) class_PairlinkMeta = /* Pairlink class */ xp_stx_alloc_object(stx,XP_STX_CLASS_SIZE); + /* (Symlink class) setClass: Metaclass */ XP_STX_CLASS(stx,class_SymlinkMeta) = stx->class_metaclass; /* (Symbol class) setClass: Metaclass */