*** empty log message ***

This commit is contained in:
hyung-hwan 2005-07-05 04:29:31 +00:00
parent 1a2a97f85d
commit bd9d441a4c
7 changed files with 34 additions and 27 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: bootstrp.c,v 1.18 2005-07-04 16:37:03 bacon Exp $
* $Id: bootstrp.c,v 1.19 2005-07-05 04:29:31 bacon Exp $
*/
#include <xp/stx/bootstrp.h>
@ -277,7 +277,9 @@ int xp_stx_bootstrap (xp_stx_t* stx)
stx->class_object = xp_stx_new_class (stx, XP_TEXT("Object"));
stx->class_class = xp_stx_new_class (stx, XP_TEXT("Class"));
stx->class_array = xp_stx_new_class (stx, XP_TEXT("Array"));
stx->class_bytearray = xp_stx_new_class (stx, XP_TEXT("ByteArray"));
stx->class_string = xp_stx_new_class (stx, XP_TEXT("String"));
stx->class_dictionary = xp_stx_new_class (stx, XP_TEXT("Dictionary"));
__create_builtin_classes (stx);
@ -394,16 +396,16 @@ static void __create_bootstrapping_objects (xp_stx_t* stx)
/* (Symlink class) setSpec: XP_STX_CLASS_SIZE */
XP_STX_WORDAT(stx,class_SymlinkMeta,XP_STX_CLASS_SPEC) =
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << 2) | XP_STX_SPEC_NOT_INDEXABLE);
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << XP_STX_SPEC_INDEXABLE_BITS) | XP_STX_SPEC_NOT_INDEXABLE);
/* (Symbol class) setSpec: CLASS_SIZE */
XP_STX_WORDAT(stx,class_SymbolMeta,XP_STX_CLASS_SPEC) =
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << 2) | XP_STX_SPEC_NOT_INDEXABLE);
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << XP_STX_SPEC_INDEXABLE_BITS) | XP_STX_SPEC_NOT_INDEXABLE);
/* (Metaclass class) setSpec: CLASS_SIZE */
XP_STX_WORDAT(stx,class_MetaclassMeta,XP_STX_CLASS_SPEC) =
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << 2) | XP_STX_SPEC_NOT_INDEXABLE);
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << XP_STX_SPEC_INDEXABLE_BITS) | XP_STX_SPEC_NOT_INDEXABLE);
/* (Pairlink class) setSpec: CLASS_SIZE */
XP_STX_WORDAT(stx,class_PairlinkMeta,XP_STX_CLASS_SPEC) =
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << 2) | XP_STX_SPEC_NOT_INDEXABLE);
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << XP_STX_SPEC_INDEXABLE_BITS) | XP_STX_SPEC_NOT_INDEXABLE);
/* specs for class_metaclass, class_pairlink,
* class_symbol, class_symlink are set later in
@ -480,7 +482,9 @@ static void __create_builtin_classes (xp_stx_t* stx)
while (superclass != stx->nil) {
superclass_obj = (xp_stx_class_t*)
XP_STX_WORD_OBJECT(stx,superclass);
nfields += XP_STX_FROM_SMALLINT(superclass_obj->spec) >> 2;
nfields +=
XP_STX_FROM_SMALLINT(superclass_obj->spec) >>
XP_STX_SPEC_INDEXABLE_BITS;
superclass = superclass_obj->superclass;
}
@ -496,8 +500,8 @@ static void __create_builtin_classes (xp_stx_t* stx)
(p->indexable == XP_STX_SPEC_NOT_INDEXABLE ||
p->indexable == XP_STX_SPEC_WORD_INDEXABLE)));
class_obj->spec =
XP_STX_TO_SMALLINT((nfields << 2) | p->indexable);
class_obj->spec = XP_STX_TO_SMALLINT(
(nfields << XP_STX_SPEC_INDEXABLE_BITS) | p->indexable);
}
for (p = class_info; p->name != XP_NULL; p++) {
@ -641,15 +645,12 @@ static void __set_metaclass_subclasses (
static xp_word_t __make_classvar_dict (
xp_stx_t* stx, xp_word_t class, const xp_char_t* names)
{
xp_size_t n;
xp_word_t dict, symbol;
const xp_char_t* p = names;
const xp_char_t* name;
n = __count_names (names);
dict = xp_stx_alloc_word_object (stx, n);
XP_STX_CLASS(stx,dict) = /* TODO */
xp_stx_lookup_class (stx, XP_TEXT("Dictionary"));
dict = xp_stx_instantiate (
stx, stx->class_dictionary, __count_names(names));
do {
while (*p == XP_CHAR(' ') ||

View File

@ -1,5 +1,5 @@
/*
* $Id: class.c,v 1.16 2005-07-04 16:37:03 bacon Exp $
* $Id: class.c,v 1.17 2005-07-05 04:29:31 bacon Exp $
*/
#include <xp/stx/class.h>
@ -18,7 +18,7 @@ xp_word_t xp_stx_new_class (xp_stx_t* stx, const xp_char_t* name)
/* the spec of the metaclass must be the spec of its
* instance. so the XP_STX_CLASS_SIZE is set */
XP_STX_WORDAT(stx,meta,XP_STX_METACLASS_SPEC) =
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << 2) | XP_STX_SPEC_NOT_INDEXABLE);
XP_STX_TO_SMALLINT((XP_STX_CLASS_SIZE << XP_STX_SPEC_INDEXABLE_BITS) | XP_STX_SPEC_NOT_INDEXABLE);
/* the spec of the class is set later in __create_builtin_classes */
class = xp_stx_alloc_word_object (stx, XP_STX_CLASS_SIZE);

View File

@ -1,5 +1,5 @@
/*
* $Id: class.h,v 1.10 2005-07-04 16:37:03 bacon Exp $
* $Id: class.h,v 1.11 2005-07-05 04:29:31 bacon Exp $
*/
#ifndef _XP_STX_CLASS_H_
@ -25,6 +25,8 @@
#define XP_STX_METACLASS_SUBCLASSES 3
#define XP_STX_METACLASS_INSTANCE_CLASS 4
#define XP_STX_SPEC_INDEXABLE_BITS 2
#define XP_STX_SPEC_INDEXABLE_MASK 3
#define XP_STX_SPEC_NOT_INDEXABLE 0
#define XP_STX_SPEC_WORD_INDEXABLE 1
#define XP_STX_SPEC_BYTE_INDEXABLE 2

View File

@ -1,5 +1,5 @@
/*
* $Id: object.c,v 1.29 2005-07-04 16:37:03 bacon Exp $
* $Id: object.c,v 1.30 2005-07-05 04:29:31 bacon Exp $
*/
#include <xp/stx/object.h>
@ -159,7 +159,6 @@ xp_word_t xp_stx_hash_char_object (xp_stx_t* stx, xp_word_t idx)
XP_STX_DATA(stx,idx), XP_STX_SIZE(stx,idx));
}
xp_word_t xp_stx_instantiate (
xp_stx_t* stx, xp_word_t class_index, xp_word_t size)
{
@ -176,8 +175,8 @@ xp_word_t xp_stx_instantiate (
xp_assert (class_obj->header.class != stx->class_metaclass);
spec = XP_STX_FROM_SMALLINT(class_obj->spec);
nfields = (spec >> 2);
indexable = spec & 0x3;
nfields = (spec >> XP_STX_SPEC_INDEXABLE_BITS);
indexable = spec & XP_STX_SPEC_INDEXABLE_MASK;
if (indexable == XP_STX_SPEC_BYTE_INDEXABLE) {
xp_assert (nfields == 0);
@ -193,7 +192,7 @@ xp_word_t xp_stx_instantiate (
new = xp_stx_alloc_word_object (stx, nfields + size);
}
else {
xp_assert (indexable == XP_STX_SPEC_WORD_INDEXABLE);
xp_assert (indexable == XP_STX_SPEC_NOT_INDEXABLE);
xp_assert (size == 0);
new = xp_stx_alloc_word_object (stx, nfields + size);
}
@ -201,4 +200,3 @@ xp_word_t xp_stx_instantiate (
XP_STX_CLASS(stx, new) = class_index;
return new;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: object.h,v 1.19 2005-07-04 11:32:41 bacon Exp $
* $Id: object.h,v 1.20 2005-07-05 04:29:31 bacon Exp $
*/
#ifndef _XP_STX_OBJECT_H_
@ -27,8 +27,9 @@ xp_word_t xp_stx_alloc_char_objectx (
xp_word_t xp_stx_allocn_char_object (xp_stx_t* stx, ...);
xp_word_t xp_stx_hash_char_object (xp_stx_t* stx, xp_word_t idx);
int xp_stx_lookup_global (
xp_stx_t* stx, xp_word_t key, xp_word_t* value);
xp_word_t xp_stx_instantiate (
xp_stx_t* stx, xp_word_t class_index, xp_word_t size);
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stx.c,v 1.30 2005-06-08 16:00:51 bacon Exp $
* $Id: stx.c,v 1.31 2005-07-05 04:29:31 bacon Exp $
*/
#include <xp/stx/stx.h>
@ -34,7 +34,10 @@ xp_stx_t* xp_stx_open (xp_stx_t* stx, xp_word_t capacity)
stx->class_object = XP_STX_NIL;
stx->class_class = XP_STX_NIL;
stx->class_bytearray = XP_STX_NIL;
stx->class_array = XP_STX_NIL;
stx->class_string = XP_STX_NIL;
stx->class_dictionary = XP_STX_NIL;
stx->__wantabort = xp_false;
return stx;

View File

@ -1,5 +1,5 @@
/*
* $Id: stx.h,v 1.30 2005-07-04 16:37:03 bacon Exp $
* $Id: stx.h,v 1.31 2005-07-05 04:29:31 bacon Exp $
*/
#ifndef _XP_STX_STX_H_
@ -76,7 +76,9 @@ struct xp_stx_t
xp_word_t class_object;
xp_word_t class_class;
xp_word_t class_array;
xp_word_t class_bytearray;
xp_word_t class_string;
xp_word_t class_dictionary;
xp_bool_t __malloced;
xp_bool_t __wantabort; /* TODO: make it a function pointer */