*** empty log message ***

This commit is contained in:
hyung-hwan 2005-05-22 15:24:57 +00:00
parent 997da1dc11
commit b7e57633d3
2 changed files with 19 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: class.c,v 1.1 2005-05-22 15:03:20 bacon Exp $ * $Id: class.c,v 1.2 2005-05-22 15:24:57 bacon Exp $
*/ */
#include <xp/stx/class.h> #include <xp/stx/class.h>
@ -43,11 +43,14 @@ 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 xp_stx_lookup_class (xp_stx_t* stx, const xp_stx_char_t* name)
{ {
xp_stx_word_t link; xp_stx_word_t link, value;
link = xp_stx_hash_lookup_symbol (stx, stx->smalltalk, name); link = xp_stx_hash_lookup_symbol (stx, stx->smalltalk, name);
if (link == stx->nil) return stx->nil; if (link == stx->nil) return stx->nil;
return XP_STX_AT(stx,link,XP_STX_PAIRLINK_VALUE); value = XP_STX_AT(stx,link,XP_STX_PAIRLINK_VALUE);
if (XP_STX_CLASS(stx,value) != stx->class_metaclass) stx->nil;
return value;
} }

View File

@ -11,6 +11,7 @@
#include <xp/stx/object.h> #include <xp/stx/object.h>
#include <xp/stx/symbol.h> #include <xp/stx/symbol.h>
#include <xp/stx/context.h> #include <xp/stx/context.h>
#include <xp/stx/class.h>
#include <xp/stx/hash.h> #include <xp/stx/hash.h>
void print_symbol_names (xp_stx_t* stx, xp_stx_word_t sym) void print_symbol_names (xp_stx_t* stx, xp_stx_word_t sym)
@ -63,6 +64,18 @@ int xp_main (int argc, xp_char_t* argv[])
xp_stx_hash_traverse (&stx, stx.smalltalk, print_symbol_names_2); xp_stx_hash_traverse (&stx, stx.smalltalk, print_symbol_names_2);
xp_printf (XP_TEXT("-------------\n")); xp_printf (XP_TEXT("-------------\n"));
{
xp_size_t n;
xp_stx_class_t* obj;
n = xp_stx_lookup_class (&stx, XP_STX_TEXT("UndefinedObject"));
obj = (xp_stx_class_t*)XP_STX_WORD_OBJECT(&stx,n);
xp_printf (XP_TEXT("name of class UndefinedObject: %lu, %s\n"),
(unsigned long)obj->name,
XP_STX_DATA(&stx, obj->name));
}
xp_printf (XP_TEXT("-------------\n"));
{ {
xp_stx_word_t class_name, method_name; xp_stx_word_t class_name, method_name;
xp_stx_word_t main_class; xp_stx_word_t main_class;