From ead929569832439327b4056ed77e27b57490c7fa Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 22 May 2005 16:26:58 +0000 Subject: [PATCH] *** empty log message *** --- ase/stx/bootstrap.c | 105 +++++++++++++++++++++++++++++++++++++++++++- ase/stx/class.c | 8 ++-- ase/test/stx/stx.c | 1 + 3 files changed, 110 insertions(+), 4 deletions(-) diff --git a/ase/stx/bootstrap.c b/ase/stx/bootstrap.c index dc24be10..6030b394 100644 --- a/ase/stx/bootstrap.c +++ b/ase/stx/bootstrap.c @@ -1,5 +1,5 @@ /* - * $Id: bootstrap.c,v 1.1 2005-05-22 15:38:31 bacon Exp $ + * $Id: bootstrap.c,v 1.2 2005-05-22 16:26:58 bacon Exp $ */ #include @@ -11,6 +11,99 @@ static void __create_bootstrapping_objects (xp_stx_t* stx); +struct class_info_t +{ + const xp_stx_char_t* name; + const xp_stx_char_t* superclass; + const xp_stx_char_t* instance_variables; + const xp_stx_char_t* class_variables; + const xp_stx_char_t* pool_dictionaries; +}; + +typedef struct class_info_t class_info_t; + +#define T XP_STX_TEXT + +static class_info_t class_info[] = +{ + { + T("Object"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("UndefinedObject"), + T("Object"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("Behavior"), + T("Object"), + T("name instanceSize methods superclass intsanceVariables classVariables poolDictionaries category"), + XP_NULL, + XP_NULL + }, + { + T("Class"), + T("Behavior"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("Metaclass"), + T("Behavior"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("Block"), + T("Object"), + T("context argCount argLoc bytePointer"), + XP_NULL, + XP_NULL + }, + { + T("Boolean"), + T("Object"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("True"), + T("Boolean"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("False"), + T("Boolean"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + T("Context"), + T("Object"), + XP_NULL, + XP_NULL, + XP_NULL + }, + { + XP_NULL, + XP_NULL, + XP_NULL, + XP_NULL, + XP_NULL + } +}; + int xp_stx_bootstrap (xp_stx_t* stx) { xp_stx_word_t symbol_Smalltalk; @@ -167,3 +260,13 @@ static void __create_bootstrapping_objects (xp_stx_t* stx) } +static void __create_classes (xp_stx_t* stx) +{ + class_info_t* p = class_info; + + while (p->name != XP_NULL) { + if (xp_stx_lookup_class(stx, p->name) == stx->nil) { + xp_stx_new_class (stx, p->name); + } + } +} diff --git a/ase/stx/class.c b/ase/stx/class.c index f1013b81..be32cbfe 100644 --- a/ase/stx/class.c +++ b/ase/stx/class.c @@ -1,5 +1,5 @@ /* - * $Id: class.c,v 1.3 2005-05-22 15:38:31 bacon Exp $ + * $Id: class.c,v 1.4 2005-05-22 16:26:58 bacon Exp $ */ #include @@ -43,13 +43,15 @@ xp_stx_word_t xp_stx_new_class (xp_stx_t* stx, const xp_stx_char_t* name) xp_stx_word_t xp_stx_lookup_class (xp_stx_t* stx, const xp_stx_char_t* name) { - xp_stx_word_t link, value; + xp_stx_word_t link, meta, value; link = xp_stx_hash_lookup_symbol (stx, stx->smalltalk, name); if (link == stx->nil) return stx->nil; value = XP_STX_AT(stx,link,XP_STX_PAIRLINK_VALUE); - if (XP_STX_CLASS(stx,value) != stx->class_metaclass) return stx->nil; + + meta = XP_STX_CLASS(stx,value); + if (XP_STX_CLASS(stx,meta) != stx->class_metaclass) return stx->nil; return value; } diff --git a/ase/test/stx/stx.c b/ase/test/stx/stx.c index 3698ed61..bcd6dce4 100644 --- a/ase/test/stx/stx.c +++ b/ase/test/stx/stx.c @@ -8,6 +8,7 @@ #include #endif +#include #include #include #include