|
From: <ppr...@us...> - 2003-11-18 13:49:45
|
Update of /cvsroot/forthy/forthy
In directory sc8-pr-cvs1:/tmp/cvs-serv8784
Modified Files:
fcode.c fcode.h fcompile.c fstack.c test.txt
Log Message:
- tweaks
Index: fcode.c
===================================================================
RCS file: /cvsroot/forthy/forthy/fcode.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fcode.c 17 Nov 2003 06:18:00 -0000 1.5
--- fcode.c 18 Nov 2003 13:49:41 -0000 1.6
***************
*** 43,47 ****
void code_branch(FSYSTEM *sys);
! void code_branch_z(FSYSTEM *sys);
void code_for(FSYSTEM *sys);
--- 43,47 ----
void code_branch(FSYSTEM *sys);
! void code_branch_ne(FSYSTEM *sys);
void code_for(FSYSTEM *sys);
***************
*** 72,76 ****
{code_lit_wordref, "LIT_WORD"},
{code_branch, "BRANCH"},
! {code_branch_z, "BRANCH_Z"},
{code_for, "FOR"},
{code_next, "NEXT"},
--- 72,76 ----
{code_lit_wordref, "LIT_WORD"},
{code_branch, "BRANCH"},
! {code_branch_ne, "BRANCH_NE"},
{code_for, "FOR"},
{code_next, "NEXT"},
***************
*** 237,241 ****
! void code_branch_z(FSYSTEM *sys)
{
// if(!stack_depth(sys->stack))
--- 237,241 ----
! void code_branch_ne(FSYSTEM *sys)
{
// if(!stack_depth(sys->stack))
Index: fcode.h
===================================================================
RCS file: /cvsroot/forthy/forthy/fcode.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fcode.h 17 Nov 2003 06:18:00 -0000 1.4
--- fcode.h 18 Nov 2003 13:49:41 -0000 1.5
***************
*** 8,12 ****
#define OPFUNC(code) (code_table[(code)].exec)
! enum{OP_EXIT_INNER, OP_DOCON, OP_DOVAR, OP_ENTER, OP_EXIT, OP_EXIT_ALL,
OP_LITINT, OP_LITFLOAT, OP_LITSTRING, OP_LITWORDREF, OP_BRANCH,
OP_BRANCH_NE, OP_FOR, OP_NEXT, OP_BREAK, OP_COMPILE, OP_DOES, OP_DODOES,
--- 8,12 ----
#define OPFUNC(code) (code_table[(code)].exec)
! enum{OP_EXIT_INNER, OP_DOCON, OP_DOVAR, OP_ENTER, OP_EXIT_FAST, OP_EXIT,
OP_LITINT, OP_LITFLOAT, OP_LITSTRING, OP_LITWORDREF, OP_BRANCH,
OP_BRANCH_NE, OP_FOR, OP_NEXT, OP_BREAK, OP_COMPILE, OP_DOES, OP_DODOES,
Index: fcompile.c
===================================================================
RCS file: /cvsroot/forthy/forthy/fcompile.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fcompile.c 16 Nov 2003 16:45:06 -0000 1.5
--- fcompile.c 18 Nov 2003 13:49:41 -0000 1.6
***************
*** 598,602 ****
// Compile the EXIT opcode, close the word
! sys->code[sys->code_off]=OPCODE(OP_EXIT);
// Relocate the code block to the current dict entry
--- 598,602 ----
// Compile the EXIT opcode, close the word
! sys->code[sys->code_off]=OPCODE(OP_EXIT_FAST);
// Relocate the code block to the current dict entry
***************
*** 885,889 ****
NEED_COMPILE(sys);
! sys->code[sys->code_off]=OPCODE(OP_EXIT_ALL);
CELL_INC(sys);
--- 885,889 ----
NEED_COMPILE(sys);
! sys->code[sys->code_off]=OPCODE(OP_EXIT);
CELL_INC(sys);
Index: fstack.c
===================================================================
RCS file: /cvsroot/forthy/forthy/fstack.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fstack.c 17 Nov 2003 06:18:00 -0000 1.4
--- fstack.c 18 Nov 2003 13:49:41 -0000 1.5
***************
*** 326,338 ****
int sp=stack->sp;
! // Stack is already empty
! if(sp>=stack->stack_size)
! {
! VOID_THROW(sys, FS_UNDERFLOW);
! }
value_clean(&(stack->mem[sp]), TRUE);
- stack_sp_dec(sys, stack);
}
--- 326,333 ----
int sp=stack->sp;
! stack_sp_dec(sys, stack);
value_clean(&(stack->mem[sp]), TRUE);
}
***************
*** 349,353 ****
// Pop a value from one stack and push it onto another
! // TODO: THROW
void stack_pop_to(FSYSTEM *sys, FSTACK *dest, FSTACK *src)
{
--- 344,348 ----
// Pop a value from one stack and push it onto another
! // TODO: OPTIMIZE
void stack_pop_to(FSYSTEM *sys, FSTACK *dest, FSTACK *src)
{
Index: test.txt
===================================================================
RCS file: /cvsroot/forthy/forthy/test.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** test.txt 17 Nov 2003 06:18:00 -0000 1.1
--- test.txt 18 Nov 2003 13:49:41 -0000 1.2
***************
*** 30,48 ****
;
! : } voc.pop drop
! voc.depth if
! voc.pop dup current! voc.push
! else current.clear
! then ; immediate
! : namespace 32 word
! "{" cat ncreate last last >data ! immediate
! does> @ dup voc.push current! ;
: maze
! [ 80 50 * ] literal
! for rand 2 % if
! [ char \ ] literal emit
! else
! [ char / ] literal emit
! then next cr ;
--- 30,53 ----
;
! : }
! voc.pop drop
! voc.depth if
! voc.pop dup current! voc.push
! else current.clear
! then
! ; immediate
! : namespace
! 32 word
! "{" cat ncreate last last >data ! immediate
! does> @ dup voc.push current!
! ;
: maze
! [ 80 50 * ] literal
! for rand 2 % if
! [ char \ ] literal emit
! else
! [ char / ] literal emit
! then next cr
! ;
|