*** empty log message ***
This commit is contained in:
parent
eca4b4145c
commit
bb30e3e656
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: bootstrp.c,v 1.21 2005-07-05 09:02:13 bacon Exp $
|
* $Id: bootstrp.c,v 1.22 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/stx/bootstrp.h>
|
#include <xp/stx/bootstrp.h>
|
||||||
@ -307,7 +307,7 @@ int xp_stx_bootstrap (xp_stx_t* stx)
|
|||||||
symbol_Smalltalk =
|
symbol_Smalltalk =
|
||||||
xp_stx_new_symbol (stx, XP_TEXT("Smalltalk"));
|
xp_stx_new_symbol (stx, XP_TEXT("Smalltalk"));
|
||||||
xp_stx_hash_insert (stx, stx->smalltalk,
|
xp_stx_hash_insert (stx, stx->smalltalk,
|
||||||
xp_stx_hash_char_object(stx, symbol_Smalltalk),
|
xp_stx_hash_object(stx, symbol_Smalltalk),
|
||||||
symbol_Smalltalk, stx->smalltalk);
|
symbol_Smalltalk, stx->smalltalk);
|
||||||
|
|
||||||
/* create #nil, #true, #false */
|
/* create #nil, #true, #false */
|
||||||
@ -441,16 +441,16 @@ static void __create_bootstrapping_objects (xp_stx_t* stx)
|
|||||||
|
|
||||||
/* register class names into the system dictionary */
|
/* register class names into the system dictionary */
|
||||||
xp_stx_hash_insert (stx, stx->smalltalk,
|
xp_stx_hash_insert (stx, stx->smalltalk,
|
||||||
xp_stx_hash_char_object(stx, symbol_Symlink),
|
xp_stx_hash_object(stx, symbol_Symlink),
|
||||||
symbol_Symlink, stx->class_symlink);
|
symbol_Symlink, stx->class_symlink);
|
||||||
xp_stx_hash_insert (stx, stx->smalltalk,
|
xp_stx_hash_insert (stx, stx->smalltalk,
|
||||||
xp_stx_hash_char_object(stx, symbol_Symbol),
|
xp_stx_hash_object(stx, symbol_Symbol),
|
||||||
symbol_Symbol, stx->class_symbol);
|
symbol_Symbol, stx->class_symbol);
|
||||||
xp_stx_hash_insert (stx, stx->smalltalk,
|
xp_stx_hash_insert (stx, stx->smalltalk,
|
||||||
xp_stx_hash_char_object(stx, symbol_Metaclass),
|
xp_stx_hash_object(stx, symbol_Metaclass),
|
||||||
symbol_Metaclass, stx->class_metaclass);
|
symbol_Metaclass, stx->class_metaclass);
|
||||||
xp_stx_hash_insert (stx, stx->smalltalk,
|
xp_stx_hash_insert (stx, stx->smalltalk,
|
||||||
xp_stx_hash_char_object(stx, symbol_Pairlink),
|
xp_stx_hash_object(stx, symbol_Pairlink),
|
||||||
symbol_Pairlink, stx->class_pairlink);
|
symbol_Pairlink, stx->class_pairlink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,7 +667,7 @@ static xp_word_t __make_classvar_dict (
|
|||||||
symbol = xp_stx_new_symbolx (stx, name, p - name);
|
symbol = xp_stx_new_symbolx (stx, name, p - name);
|
||||||
|
|
||||||
xp_stx_hash_insert (stx, dict,
|
xp_stx_hash_insert (stx, dict,
|
||||||
xp_stx_hash_char_object(stx, symbol), symbol, stx->nil);
|
xp_stx_hash_object(stx, symbol), symbol, stx->nil);
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
return dict;
|
return dict;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: class.c,v 1.19 2005-07-05 09:02:13 bacon Exp $
|
* $Id: class.c,v 1.20 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/stx/class.h>
|
#include <xp/stx/class.h>
|
||||||
@ -29,7 +29,7 @@ xp_word_t xp_stx_new_class (xp_stx_t* stx, const xp_char_t* name)
|
|||||||
XP_STX_WORDAT(stx,class,XP_STX_CLASS_NAME) = class_name;
|
XP_STX_WORDAT(stx,class,XP_STX_CLASS_NAME) = class_name;
|
||||||
|
|
||||||
xp_stx_hash_insert (stx, stx->smalltalk,
|
xp_stx_hash_insert (stx, stx->smalltalk,
|
||||||
xp_stx_hash_char_object(stx, class_name),
|
xp_stx_hash_object(stx, class_name),
|
||||||
class_name, class);
|
class_name, class);
|
||||||
|
|
||||||
return class;
|
return class;
|
||||||
|
@ -1,9 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: misc.c,v 1.6 2005-06-30 15:11:00 bacon Exp $
|
* $Id: misc.c,v 1.7 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/stx/misc.h>
|
#include <xp/stx/misc.h>
|
||||||
|
|
||||||
|
xp_word_t xp_stx_hash (const void* data, xp_word_t len)
|
||||||
|
{
|
||||||
|
xp_word_t h = 0;
|
||||||
|
xp_byte_t* bp, * be;
|
||||||
|
|
||||||
|
bp = (xp_byte_t*)data; be = bp + len;
|
||||||
|
while (bp < be) h = h * 31 + *bp++;
|
||||||
|
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
xp_word_t xp_stx_strhash (const xp_char_t* str)
|
xp_word_t xp_stx_strhash (const xp_char_t* str)
|
||||||
{
|
{
|
||||||
xp_word_t h = 0;
|
xp_word_t h = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: misc.h,v 1.10 2005-07-03 16:37:01 bacon Exp $
|
* $Id: misc.h,v 1.11 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_STX_MISC_H_
|
#ifndef _XP_STX_MISC_H_
|
||||||
@ -44,6 +44,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
xp_word_t xp_stx_hash (const void* data, xp_word_t len);
|
||||||
xp_word_t xp_stx_strhash (const xp_char_t* str);
|
xp_word_t xp_stx_strhash (const xp_char_t* str);
|
||||||
xp_word_t xp_stx_strxhash (const xp_char_t* str, xp_word_t len);
|
xp_word_t xp_stx_strxhash (const xp_char_t* str, xp_word_t len);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: object.c,v 1.34 2005-07-05 10:22:35 bacon Exp $
|
* $Id: object.c,v 1.35 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/stx/object.h>
|
#include <xp/stx/object.h>
|
||||||
@ -34,11 +34,7 @@ xp_word_t xp_stx_alloc_word_object (
|
|||||||
obj->header.access = (n << 2) | XP_STX_WORD_INDEXED;
|
obj->header.access = (n << 2) | XP_STX_WORD_INDEXED;
|
||||||
|
|
||||||
if (variable_data == XP_NULL) {
|
if (variable_data == XP_NULL) {
|
||||||
while (n > nfields) {
|
while (n > nfields) obj->data[--n] = stx->nil;
|
||||||
n--;
|
|
||||||
xp_printf (XP_TEXT("%d\n"), n);
|
|
||||||
obj->data[n] = stx->nil;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while (n > nfields) {
|
while (n > nfields) {
|
||||||
@ -161,31 +157,28 @@ xp_word_t xp_stx_allocn_char_object (xp_stx_t* stx, ...)
|
|||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
xp_word_t xp_stx_hash_char_object (xp_stx_t* stx, xp_word_t idx)
|
|
||||||
{
|
|
||||||
xp_assert (!XP_STX_IS_SMALLINT(idx) && XP_STX_IS_CHAR_OBJECT(stx, idx));
|
|
||||||
return xp_stx_strxhash (
|
|
||||||
XP_STX_DATA(stx,idx), XP_STX_SIZE(stx,idx));
|
|
||||||
}
|
|
||||||
|
|
||||||
xp_word_t xp_stx_hash_object (xp_stx_t* stx, xp_word_t object)
|
xp_word_t xp_stx_hash_object (xp_stx_t* stx, xp_word_t object)
|
||||||
{
|
{
|
||||||
xp_word_t hv;
|
xp_word_t hv;
|
||||||
|
|
||||||
/* TODO: implement this function */
|
|
||||||
|
|
||||||
if (XP_STX_IS_SMALLINT(object)) {
|
if (XP_STX_IS_SMALLINT(object)) {
|
||||||
hv = 0;
|
xp_word_t tmp = XP_STX_FROM_SMALLINT(object);
|
||||||
}
|
hv = xp_stx_hash(&tmp, xp_sizeof(tmp));
|
||||||
else if (XP_STX_IS_BYTE_OBJECT(stx,object)) {
|
|
||||||
hv = 0;
|
|
||||||
}
|
}
|
||||||
else if (XP_STX_IS_CHAR_OBJECT(stx,object)) {
|
else if (XP_STX_IS_CHAR_OBJECT(stx,object)) {
|
||||||
hv = xp_stx_strxhash (
|
/*hv = xp_stx_strxhash (
|
||||||
|
XP_STX_DATA(stx,object), XP_STX_SIZE(stx,object));*/
|
||||||
|
hv = xp_stx_hash (XP_STX_DATA(stx,object),
|
||||||
|
XP_STX_SIZE(stx,object) * xp_sizeof(xp_char_t));
|
||||||
|
}
|
||||||
|
else if (XP_STX_IS_BYTE_OBJECT(stx,object)) {
|
||||||
|
hv = xp_stx_hash (
|
||||||
XP_STX_DATA(stx,object), XP_STX_SIZE(stx,object));
|
XP_STX_DATA(stx,object), XP_STX_SIZE(stx,object));
|
||||||
}
|
}
|
||||||
else if (XP_STX_IS_WORD_OBJECT(stx,object)) {
|
else {
|
||||||
hv = 0;
|
xp_assert (XP_STX_IS_WORD_OBJECT(stx,object));
|
||||||
|
hv = xp_stx_hash (XP_STX_DATA(stx,object),
|
||||||
|
XP_STX_SIZE(stx,object) * xp_sizeof(xp_word_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
return hv;
|
return hv;
|
||||||
@ -205,6 +198,7 @@ xp_word_t xp_stx_instantiate (
|
|||||||
created in a different way */
|
created in a different way */
|
||||||
/* TODO: maybe delete the following line */
|
/* TODO: maybe delete the following line */
|
||||||
xp_assert (class_obj->header.class != stx->class_metaclass);
|
xp_assert (class_obj->header.class != stx->class_metaclass);
|
||||||
|
xp_assert (XP_STX_IS_SMALLINT(class_obj->spec));
|
||||||
|
|
||||||
spec = XP_STX_FROM_SMALLINT(class_obj->spec);
|
spec = XP_STX_FROM_SMALLINT(class_obj->spec);
|
||||||
nfields = (spec >> XP_STX_SPEC_INDEXABLE_BITS);
|
nfields = (spec >> XP_STX_SPEC_INDEXABLE_BITS);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: object.h,v 1.24 2005-07-05 10:22:35 bacon Exp $
|
* $Id: object.h,v 1.25 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _XP_STX_OBJECT_H_
|
#ifndef _XP_STX_OBJECT_H_
|
||||||
@ -24,7 +24,6 @@ xp_word_t xp_stx_alloc_char_objectx (
|
|||||||
xp_stx_t* stx, const xp_char_t* str, xp_word_t n);
|
xp_stx_t* stx, const xp_char_t* str, xp_word_t n);
|
||||||
xp_word_t xp_stx_allocn_char_object (xp_stx_t* stx, ...);
|
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);
|
|
||||||
xp_word_t xp_stx_hash_object (xp_stx_t* stx, xp_word_t object);
|
xp_word_t xp_stx_hash_object (xp_stx_t* stx, xp_word_t object);
|
||||||
|
|
||||||
xp_word_t xp_stx_instantiate (
|
xp_word_t xp_stx_instantiate (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: parser.c,v 1.53 2005-07-05 09:52:00 bacon Exp $
|
* $Id: parser.c,v 1.54 2005-07-05 11:15:51 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/stx/parser.h>
|
#include <xp/stx/parser.h>
|
||||||
@ -39,9 +39,6 @@ static int __parse_keyword_message (xp_stx_parser_t* parser);
|
|||||||
static int __parse_binary_message (xp_stx_parser_t* parser);
|
static int __parse_binary_message (xp_stx_parser_t* parser);
|
||||||
static int __parse_unary_message (xp_stx_parser_t* parser);
|
static int __parse_unary_message (xp_stx_parser_t* parser);
|
||||||
|
|
||||||
static int __emit_code (
|
|
||||||
xp_stx_parser_t* parser, const xp_char_t* high, const xp_char_t* low);
|
|
||||||
|
|
||||||
static int __get_token (xp_stx_parser_t* parser);
|
static int __get_token (xp_stx_parser_t* parser);
|
||||||
static int __get_ident (xp_stx_parser_t* parser);
|
static int __get_ident (xp_stx_parser_t* parser);
|
||||||
static int __get_numlit (xp_stx_parser_t* parser, xp_bool_t negated);
|
static int __get_numlit (xp_stx_parser_t* parser, xp_bool_t negated);
|
||||||
@ -238,6 +235,20 @@ static INLINE xp_bool_t __is_closing_char (xp_cint_t c)
|
|||||||
c == XP_CHAR('\"') || c == XP_CHAR('\'');
|
c == XP_CHAR('\"') || c == XP_CHAR('\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INLINE int __emit_code (
|
||||||
|
xp_stx_parser_t* parser, const xp_char_t* high, const xp_char_t* low)
|
||||||
|
{
|
||||||
|
xp_printf (XP_TEXT("CODE: %s %s\n"), high, low);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
static INLINE int __emit_code (xp_stx_parser_t* parser, xp_byte_t code)
|
||||||
|
{
|
||||||
|
return (xp_array_add_datum(&parser->bytecode, &code) == XP_NULL)? -1: 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
int xp_stx_parser_parse_method (
|
int xp_stx_parser_parse_method (
|
||||||
xp_stx_parser_t* parser, xp_word_t method_class, void* input)
|
xp_stx_parser_t* parser, xp_word_t method_class, void* input)
|
||||||
{
|
{
|
||||||
@ -519,6 +530,15 @@ static int __parse_primitive (xp_stx_parser_t* parser)
|
|||||||
}
|
}
|
||||||
EMIT_CODE (parser, XP_TEXT("DO_PRIMITIVE"), parser->token.name.buffer);
|
EMIT_CODE (parser, XP_TEXT("DO_PRIMITIVE"), parser->token.name.buffer);
|
||||||
|
|
||||||
|
/*
|
||||||
|
EMIT_CODE (parser, DO_PRIMITIVE);
|
||||||
|
EMIT_CODE (parser, parser->token.ivalue);
|
||||||
|
|
||||||
|
EMIT_CODE (parser, DO_PRIMITIVE_EXTENDED);
|
||||||
|
EMIT_CODE (parser, parser->token.ivalue);
|
||||||
|
EMIT_CODE (parser, parser->token.ivalue);
|
||||||
|
*/
|
||||||
|
|
||||||
GET_TOKEN (parser);
|
GET_TOKEN (parser);
|
||||||
if (!__is_primitive_closer(&parser->token)) {
|
if (!__is_primitive_closer(&parser->token)) {
|
||||||
parser->error_code = XP_STX_PARSER_ERROR_PRIMITIVE_NOT_CLOSED;
|
parser->error_code = XP_STX_PARSER_ERROR_PRIMITIVE_NOT_CLOSED;
|
||||||
@ -905,13 +925,6 @@ static int __parse_unary_message (xp_stx_parser_t* parser)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __emit_code (
|
|
||||||
xp_stx_parser_t* parser, const xp_char_t* high, const xp_char_t* low)
|
|
||||||
{
|
|
||||||
xp_printf (XP_TEXT("CODE: %s %s\n"), high, low);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __get_token (xp_stx_parser_t* parser)
|
static int __get_token (xp_stx_parser_t* parser)
|
||||||
{
|
{
|
||||||
xp_cint_t c;
|
xp_cint_t c;
|
||||||
|
Loading…
Reference in New Issue
Block a user