*** empty log message ***
This commit is contained in:
parent
4f260eb1b7
commit
3d1af4450e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: bootstrp.c,v 1.15 2005-07-03 16:37:01 bacon Exp $
|
||||
* $Id: bootstrp.c,v 1.16 2005-07-04 11:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/bootstrp.h>
|
||||
@ -122,7 +122,7 @@ static class_info_t class_info[] =
|
||||
{
|
||||
XP_TEXT("Method"),
|
||||
XP_TEXT("Object"),
|
||||
XP_TEXT("text message bytecodes literals stackSize temporarySize class"),
|
||||
XP_TEXT("text message bytecodes literals stackSize temporarySize"),
|
||||
//XP_NULL,
|
||||
XP_TEXT("Win32Errors"), // TODO: REMOVE THIS
|
||||
XP_NULL,
|
||||
@ -636,6 +636,8 @@ static xp_word_t __make_classvar_dict (
|
||||
|
||||
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"));
|
||||
|
||||
do {
|
||||
while (*p == XP_CHAR(' ') ||
|
||||
|
@ -1,5 +1,5 @@
|
||||
SRCS = stx.c memory.c object.c symbol.c class.c \
|
||||
hash.c misc.c context.c name.c token.c parser.c bootstrp.c
|
||||
hash.c misc.c method.c context.c name.c token.c parser.c bootstrp.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
OUT = libxpstx.a
|
||||
|
||||
|
9
ase/stx/method.c
Normal file
9
ase/stx/method.c
Normal file
@ -0,0 +1,9 @@
|
||||
/*
|
||||
* $Id: method.c,v 1.1 2005-07-04 11:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/method.h>
|
||||
|
||||
int xp_stx_new_method (xp_stx_t* stx, xp_word_t size)
|
||||
{
|
||||
}
|
28
ase/stx/method.h
Normal file
28
ase/stx/method.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* $Id: method.h,v 1.1 2005-07-04 11:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_STX_METHOD_H_
|
||||
#define _XP_STX_METHOD_H_
|
||||
|
||||
#include <xp/stx/stx.h>
|
||||
|
||||
#define XP_STX_METHOD_SIZE 6
|
||||
#define XP_STX_METHOD_TEXT 0
|
||||
#define XP_STX_METHOD_MESSAGE 1
|
||||
#define XP_STX_METHOD_BYTECODES 2
|
||||
#define XP_STX_METHOD_LITERALS 3
|
||||
#define XP_STX_METHOD_STACK_SIZE 4
|
||||
#define XP_STX_METHOD_TEMPORARY_SIZE 5
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int xp_stx_new_method (xp_stx_t* stx, xp_word_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: object.c,v 1.26 2005-06-30 12:07:02 bacon Exp $
|
||||
* $Id: object.c,v 1.27 2005-07-04 11:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/object.h>
|
||||
@ -37,7 +37,8 @@ xp_word_t xp_stx_alloc_word_object (xp_stx_t* stx, xp_word_t n)
|
||||
}
|
||||
|
||||
/* n: number of bytes */
|
||||
xp_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_word_t n)
|
||||
xp_word_t xp_stx_alloc_byte_object (
|
||||
xp_stx_t* stx, const xp_byte_t* data, xp_word_t n)
|
||||
{
|
||||
xp_word_t idx;
|
||||
xp_stx_byte_object_t* obj;
|
||||
@ -56,7 +57,13 @@ xp_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_word_t n)
|
||||
obj = XP_STX_BYTE_OBJECT(stx,idx);
|
||||
obj->header.class = stx->nil;
|
||||
obj->header.access = (n << 2) | XP_STX_BYTE_INDEXED;
|
||||
|
||||
if (data == XP_NULL) {
|
||||
while (n-- > 0) obj->data[n] = 0;
|
||||
}
|
||||
else {
|
||||
while (n-- > 0) obj->data[n] = data[n];
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: object.h,v 1.18 2005-06-08 16:00:51 bacon Exp $
|
||||
* $Id: object.h,v 1.19 2005-07-04 11:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_STX_OBJECT_H_
|
||||
@ -16,7 +16,10 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
xp_word_t xp_stx_alloc_word_object (xp_stx_t* stx, xp_word_t n);
|
||||
xp_word_t xp_stx_alloc_byte_object (xp_stx_t* stx, xp_word_t n);
|
||||
|
||||
xp_word_t xp_stx_alloc_byte_object (
|
||||
xp_stx_t* stx, const xp_byte_t* data, xp_word_t n);
|
||||
|
||||
xp_word_t xp_stx_alloc_char_object (
|
||||
xp_stx_t* stx, const xp_char_t* str);
|
||||
xp_word_t xp_stx_alloc_char_objectx (
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parser.c,v 1.48 2005-07-04 10:02:00 bacon Exp $
|
||||
* $Id: parser.c,v 1.49 2005-07-04 11:32:41 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/parser.h>
|
||||
@ -9,6 +9,7 @@
|
||||
static int __parse_method (
|
||||
xp_stx_parser_t* parser,
|
||||
xp_word_t method_class, void* input);
|
||||
static int __finish_method (xp_stx_parser_t* parser);
|
||||
|
||||
static int __parse_message_pattern (xp_stx_parser_t* parser);
|
||||
static int __parse_unary_pattern (xp_stx_parser_t* parser);
|
||||
@ -274,6 +275,46 @@ static int __parse_method (
|
||||
if (__parse_temporaries(parser) == -1) return -1;
|
||||
if (__parse_primitive(parser) == -1) return -1;
|
||||
if (__parse_statements(parser) == -1) return -1;
|
||||
if (__finish_method (parser) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int __finish_method (xp_stx_parser_t* parser)
|
||||
{
|
||||
xp_stx_class_t* class_obj;
|
||||
xp_word_t bytecodes;
|
||||
|
||||
class_obj = (xp_stx_class_t*)
|
||||
XP_STX_WORD_OBJECT(parser->stx, parser->method_class);
|
||||
|
||||
if (class_obj->methods == parser->stx->nil) {
|
||||
/* TODO: reconfigure method dictionary size */
|
||||
class_obj->methods = xp_stx_alloc_word_object (parser->stx, 64);
|
||||
XP_STX_CLASS(parser->stx, class_obj->methods) =
|
||||
xp_stx_lookup_class (parser->stx, XP_TEXT("Dictionary"));
|
||||
}
|
||||
xp_assert (class_obj->methods != parser->stx->nil);
|
||||
|
||||
/*
|
||||
bytecodes = xp_stx_alloc_byte_object (parser->stx,
|
||||
parser->bytecodes, parser->bytecode_size);
|
||||
*/
|
||||
|
||||
/* TODO: text saving must be optional */
|
||||
/*
|
||||
method_obj->text =
|
||||
xp_stx_new_string (parser->stx, parser->text);
|
||||
|
||||
method_obj->message =
|
||||
xp_stx_new_symbol (parser->stx, parser->method_name);
|
||||
method_obj->bytecodes = bytecodes;
|
||||
//method_obj->literals =
|
||||
method_obj->stack_size = XP_STX_TO_SMALLINT(100);
|
||||
method_obj->temporary_size =
|
||||
XP_STX_TO_SMALLINT(parser->temporary_count);
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user