*** empty log message ***

This commit is contained in:
hyung-hwan 2005-05-22 16:26:58 +00:00
parent 0d5d5b5a0c
commit ead9295698
3 changed files with 110 additions and 4 deletions

View File

@ -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 <xp/stx/bootstrap.h>
@ -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);
}
}
}

View File

@ -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 <xp/stx/class.h>
@ -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;
}

View File

@ -8,6 +8,7 @@
#include <xp/bas/locale.h>
#endif
#include <xp/stx/bootstrap.h>
#include <xp/stx/object.h>
#include <xp/stx/symbol.h>
#include <xp/stx/context.h>