*** empty log message ***
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: bytecode.c,v 1.15 2005-10-02 10:44:49 bacon Exp $
|
||||
* $Id: bytecode.c,v 1.16 2005-10-02 15:45:09 bacon Exp $
|
||||
*/
|
||||
#include <xp/stx/bytecode.h>
|
||||
#include <xp/stx/class.h>
|
||||
@ -17,7 +17,6 @@ int xp_stx_decode (xp_stx_t* stx, xp_word_t class)
|
||||
class_obj = (xp_stx_class_t*)XP_STX_OBJECT(stx, class);
|
||||
if (class_obj->methods == stx->nil) return 0;
|
||||
|
||||
|
||||
/* TODO */
|
||||
xp_stx_dict_traverse (stx, class_obj->methods, __decode1, class_obj);
|
||||
return 0;
|
||||
@ -116,7 +115,7 @@ static int __decode2 (xp_stx_t* stx,
|
||||
|
||||
static const xp_char_t* stack_special_opcode_names[] =
|
||||
{
|
||||
XP_TEXT("store_pop_stack_top"),
|
||||
XP_TEXT("pop_stack_top"),
|
||||
XP_TEXT("duplicate_pop_stack_top"),
|
||||
XP_TEXT("push_active_context"),
|
||||
XP_TEXT("push_nil"),
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: bytecode.h,v 1.11 2005-09-30 12:19:00 bacon Exp $
|
||||
* $Id: bytecode.h,v 1.12 2005-10-02 15:45:09 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_STX_BYTECODE_H_
|
||||
@ -21,7 +21,7 @@
|
||||
#define STORE_RECEIVER_VARIABLE_EXTENDED 0x64
|
||||
#define STORE_TEMPORARY_LOCATION_EXTENDED 0x65
|
||||
|
||||
#define STORE_POP_STACK_TOP 0x67
|
||||
#define POP_STACK_TOP 0x67
|
||||
#define DUPLICATE_POP_STACK_TOP 0x68
|
||||
#define PUSH_ACTIVE_CONTEXT 0x69
|
||||
#define PUSH_NIL 0x6A
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: class.c,v 1.26 2005-10-02 10:44:49 bacon Exp $
|
||||
* $Id: class.c,v 1.27 2005-10-02 15:45:09 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/class.h>
|
||||
@ -113,15 +113,14 @@ xp_word_t xp_stx_lookup_class_variable (
|
||||
return stx->nil;
|
||||
}
|
||||
|
||||
xp_word_t xp_stx_lookup_method (
|
||||
xp_stx_t* stx, xp_word_t class_index, const xp_char_t* name)
|
||||
xp_word_t xp_stx_lookup_method (xp_stx_t* stx,
|
||||
xp_word_t class_index, const xp_char_t* name, xp_bool_t from_super)
|
||||
{
|
||||
xp_stx_class_t* class_obj;
|
||||
|
||||
class_obj = (xp_stx_class_t*)XP_STX_OBJECT(stx, class_index);
|
||||
xp_assert (class_obj != XP_NULL);
|
||||
|
||||
/* TODO: can a metaclass have class variables? */
|
||||
#if 0
|
||||
if (class_obj->header.class != stx->class_metaclass &&
|
||||
class_obj->methods != stx->nil) {
|
||||
@ -143,11 +142,16 @@ xp_word_t xp_stx_lookup_method (
|
||||
|
||||
while (class_index != stx->nil) {
|
||||
class_obj = (xp_stx_class_t*)XP_STX_OBJECT(stx, class_index);
|
||||
xp_assert (class_obj != XP_NULL);
|
||||
|
||||
/* TODO: check if this condition is ok */
|
||||
if (class_obj->header.class != stx->class_metaclass &&
|
||||
class_obj->methods != stx->nil) {
|
||||
xp_assert (class_obj != XP_NULL);
|
||||
xp_assert (
|
||||
class_obj->header.class == stx->class_metaclass ||
|
||||
XP_STX_CLASS(stx,class_obj->header.class) == stx->class_metaclass);
|
||||
|
||||
if (from_super) {
|
||||
from_super = xp_false;
|
||||
}
|
||||
else if (class_obj->methods != stx->nil) {
|
||||
xp_word_t assoc;
|
||||
assoc = xp_stx_dict_lookup(stx, class_obj->methods, name);
|
||||
if (assoc != stx->nil) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: class.h,v 1.14 2005-09-11 15:15:35 bacon Exp $
|
||||
* $Id: class.h,v 1.15 2005-10-02 15:45:09 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_STX_CLASS_H_
|
||||
@ -71,8 +71,8 @@ int xp_stx_get_instance_variable_index (
|
||||
|
||||
xp_word_t xp_stx_lookup_class_variable (
|
||||
xp_stx_t* stx, xp_word_t class_index, const xp_char_t* name);
|
||||
xp_word_t xp_stx_lookup_method (
|
||||
xp_stx_t* stx, xp_word_t class_index, const xp_char_t* name);
|
||||
xp_word_t xp_stx_lookup_method (xp_stx_t* stx,
|
||||
xp_word_t class_index, const xp_char_t* name, xp_bool_t from_super);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: interp.c,v 1.18 2005-10-02 10:44:49 bacon Exp $
|
||||
* $Id: interp.c,v 1.19 2005-10-02 15:45:09 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/interp.h>
|
||||
@ -149,6 +149,13 @@ static int __run_process (xp_stx_t* stx, process_t* proc)
|
||||
|
||||
/* TODO: more here .... */
|
||||
|
||||
else if (code == 0x67) {
|
||||
/* pop stack top */
|
||||
proc->stack_top--;
|
||||
}
|
||||
|
||||
/* TODO: more here .... */
|
||||
|
||||
else if (code == 0x6A) {
|
||||
proc->stack[proc->stack_top++] = stx->nil;
|
||||
}
|
||||
@ -266,8 +273,9 @@ static int __send_message (xp_stx_t* stx, process_t* proc,
|
||||
xp_assert (XP_STX_CLASS(stx,selector) == stx->class_symbol);
|
||||
|
||||
receiver = proc->stack[proc->stack_top - nargs - 1];
|
||||
method = xp_stx_lookup_method (stx,
|
||||
XP_STX_CLASS(stx,receiver), XP_STX_DATA(stx,selector));
|
||||
method = xp_stx_lookup_method (
|
||||
stx, XP_STX_CLASS(stx,receiver),
|
||||
XP_STX_DATA(stx,selector), to_super);
|
||||
if (method == stx->nil) {
|
||||
xp_printf (XP_TEXT("cannot find the method....\n"));
|
||||
return -1;
|
||||
@ -363,6 +371,9 @@ static int __dispatch_primitive (xp_stx_t* stx, process_t* proc, xp_word_t no)
|
||||
XP_STX_FROM_SMALLINT(proc->stack[proc->stack_base + 1]),
|
||||
XP_STX_FROM_SMALLINT(proc->stack[proc->stack_base + 2]));
|
||||
break;
|
||||
case 20:
|
||||
xp_printf (XP_TEXT("<< PRIMITIVE 20 >>\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parser.c,v 1.77 2005-10-02 10:44:49 bacon Exp $
|
||||
* $Id: parser.c,v 1.78 2005-10-02 15:45:09 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/parser.h>
|
||||
@ -826,6 +826,7 @@ static int __parse_expression (xp_stx_parser_t* parser)
|
||||
* <assignment target> ::= identifier
|
||||
* assignmentOperator ::= ':='
|
||||
*/
|
||||
xp_stx_t* stx = parser->stx;
|
||||
|
||||
if (parser->token.type == XP_STX_TOKEN_IDENT) {
|
||||
xp_char_t* ident = xp_stx_token_yield (&parser->token, 0);
|
||||
|
Reference in New Issue
Block a user