*** empty log message ***
This commit is contained in:
parent
ae4249e3b9
commit
44721cbd3c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: interp.c,v 1.13 2005-09-13 11:15:41 bacon Exp $
|
* $Id: interp.c,v 1.14 2005-09-13 12:10:23 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <xp/stx/interp.h>
|
#include <xp/stx/interp.h>
|
||||||
@ -180,10 +180,11 @@ static int __run_process (xp_stx_t* stx, process_t* proc)
|
|||||||
case 0: /* receiver variable */
|
case 0: /* receiver variable */
|
||||||
proc->stack[proc->stack_top++] = XP_STX_WORD_AT(stx, proc->receiver, index);
|
proc->stack[proc->stack_top++] = XP_STX_WORD_AT(stx, proc->receiver, index);
|
||||||
break;
|
break;
|
||||||
case 1: /* temporary variable */
|
|
||||||
proc->stack[proc->stack_top++] = proc->stack[index];
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
|
case 1: /* temporary variable */
|
||||||
|
proc->stack[proc->stack_top++] =
|
||||||
|
proc->stack[proc->stack_base + 1 + index];
|
||||||
|
break;
|
||||||
case 2: /* literal constant */
|
case 2: /* literal constant */
|
||||||
proc->stack[proc->stack_top++] = proc->literals[index];
|
proc->stack[proc->stack_top++] = proc->literals[index];
|
||||||
break;
|
break;
|
||||||
@ -196,16 +197,16 @@ static int __run_process (xp_stx_t* stx, process_t* proc)
|
|||||||
int what = code >> 4;
|
int what = code >> 4;
|
||||||
int index = code & 0x0F;
|
int index = code & 0x0F;
|
||||||
|
|
||||||
#if 0
|
|
||||||
switch (what) {
|
switch (what) {
|
||||||
|
#if 0
|
||||||
case 4: /* receiver variable */
|
case 4: /* receiver variable */
|
||||||
XP_STX_WORD_AT(stx,proc->receiver,index) = proc->stack[--proc->stack_top];
|
XP_STX_WORD_AT(stx,proc->receiver,index) = proc->stack[--proc->stack_top];
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case 5: /* temporary location */
|
case 5: /* temporary location */
|
||||||
proc->stack[index] = proc->stack[--proc->stack_top];
|
proc->stack[proc->stack_base + 1 + index] = proc->stack[--proc->stack_top];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* more here .... */
|
/* more here .... */
|
||||||
@ -213,8 +214,8 @@ static int __run_process (xp_stx_t* stx, process_t* proc)
|
|||||||
else if (code == 0x70) {
|
else if (code == 0x70) {
|
||||||
next = proc->bytecodes[proc->pc++];
|
next = proc->bytecodes[proc->pc++];
|
||||||
//xp_printf (XP_TEXT("%d, %d\n"), next >> 5, next & 0x1F);
|
//xp_printf (XP_TEXT("%d, %d\n"), next >> 5, next & 0x1F);
|
||||||
__send_to_self (stx,
|
if (__send_to_self (stx, proc,
|
||||||
proc, next >> 5, proc->literals[next & 0x1F]);
|
next >> 5, proc->literals[next & 0x1F]) == -1) break;
|
||||||
//xp_printf (XP_TEXT("done %d, %d\n"), next >> 5, next & 0x1F);
|
//xp_printf (XP_TEXT("done %d, %d\n"), next >> 5, next & 0x1F);
|
||||||
}
|
}
|
||||||
else if (code == 0x71) {
|
else if (code == 0x71) {
|
||||||
@ -227,8 +228,8 @@ static int __run_process (xp_stx_t* stx, process_t* proc)
|
|||||||
/* send to self extended */
|
/* send to self extended */
|
||||||
next = proc->bytecodes[proc->pc++];
|
next = proc->bytecodes[proc->pc++];
|
||||||
next2 = proc->bytecodes[proc->pc++];
|
next2 = proc->bytecodes[proc->pc++];
|
||||||
__send_to_self (stx,
|
if (__send_to_self (stx, proc,
|
||||||
proc, next >> 5, proc->literals[next2]);
|
next >> 5, proc->literals[next2]) == -1) break;
|
||||||
}
|
}
|
||||||
else if (code == 0x73) {
|
else if (code == 0x73) {
|
||||||
/* send to super extended */
|
/* send to super extended */
|
||||||
@ -314,6 +315,11 @@ static int __dispatch_primitive (xp_stx_t* stx, process_t* proc, xp_word_t no)
|
|||||||
xp_printf (XP_TEXT("<< FUNKY STX SMALLTALK >> %d\n"),
|
xp_printf (XP_TEXT("<< FUNKY STX SMALLTALK >> %d\n"),
|
||||||
XP_STX_FROM_SMALLINT(proc->stack[proc->stack_base + 1]));
|
XP_STX_FROM_SMALLINT(proc->stack[proc->stack_base + 1]));
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
xp_printf (XP_TEXT("<< HIGH STX SMALLTALK >> %d, %d\n"),
|
||||||
|
XP_STX_FROM_SMALLINT(proc->stack[proc->stack_base + 1]),
|
||||||
|
XP_STX_FROM_SMALLINT(proc->stack[proc->stack_base + 2]));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -160,13 +160,13 @@ int xp_main (int argc, xp_char_t* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xp_stx_parser_parse_method (&parser, stx.class_symbol,
|
if (xp_stx_parser_parse_method (&parser, stx.class_symbol,
|
||||||
(void*)XP_TEXT("test2.st")) == -1) {
|
(void*)XP_TEXT("test1.st")) == -1) {
|
||||||
xp_printf (XP_TEXT("parser error <%s>\n"),
|
xp_printf (XP_TEXT("parser error <%s>\n"),
|
||||||
xp_stx_parser_error_string (&parser));
|
xp_stx_parser_error_string (&parser));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xp_stx_parser_parse_method (&parser, stx.class_symbol,
|
if (xp_stx_parser_parse_method (&parser, stx.class_symbol,
|
||||||
(void*)XP_TEXT("test3.st")) == -1) {
|
(void*)XP_TEXT("test2.st")) == -1) {
|
||||||
xp_printf (XP_TEXT("parser error <%s>\n"),
|
xp_printf (XP_TEXT("parser error <%s>\n"),
|
||||||
xp_stx_parser_error_string (&parser));
|
xp_stx_parser_error_string (&parser));
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
main
|
main
|
||||||
| a b |
|
|
||||||
|
|
||||||
<primitive: 0>
|
<primitive: 0>
|
||||||
#abc prim1.
|
#abc print: 123 and: 2345.
|
||||||
#def prim1.
|
|
||||||
#def prim2: 4512.
|
|
||||||
^nil
|
^nil
|
||||||
|
Loading…
Reference in New Issue
Block a user