--- gforth/Attic/engine.c 1994/09/09 16:27:18 1.15 +++ gforth/Attic/engine.c 1994/12/12 17:10:35 1.20 @@ -1,5 +1,4 @@ /* - $Id: engine.c,v 1.15 1994/09/09 16:27:18 anton Exp $ Copyright 1992 by the ANSI figForth Development Group */ @@ -17,9 +16,14 @@ #include "forth.h" #include "io.h" +#ifndef SEEK_SET +/* should be defined in stdio.h, but some systems don't have it */ +#define SEEK_SET 0 +#endif + typedef union { struct { -#ifdef BIG_ENDIAN +#ifdef WORDS_BIGENDIAN Cell high; Cell low; #else @@ -180,6 +184,12 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * CPU_DEP; #endif +#ifdef DEBUG + fprintf(stderr,"ip=%x, sp=%x, rp=%x, fp=%x, lp=%x, up=%x\n", + (unsigned)ip,(unsigned)sp,(unsigned)rp, + (unsigned)fp,(unsigned)lp,(unsigned)up); +#endif + if (ip == NULL) return symbols; @@ -190,7 +200,7 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * docol: #ifdef DEBUG - printf("%08x: col: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); + fprintf(stderr,"%08x: col: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); #endif #ifdef CISC_NEXT /* this is the simple version */ @@ -215,7 +225,7 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * docon: #ifdef DEBUG - printf("%08x: con: %08x\n",(Cell)ip,*(Cell*)PFA1(cfa)); + fprintf(stderr,"%08x: con: %08x\n",(Cell)ip,*(Cell*)PFA1(cfa)); #endif #ifdef USE_TOS *sp-- = TOS; @@ -227,7 +237,7 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * dovar: #ifdef DEBUG - printf("%08x: var: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); + fprintf(stderr,"%08x: var: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); #endif #ifdef USE_TOS *sp-- = TOS; @@ -241,7 +251,7 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * douser: #ifdef DEBUG - printf("%08x: user: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); + fprintf(stderr,"%08x: user: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); #endif #ifdef USE_TOS *sp-- = TOS; @@ -253,7 +263,7 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * dodefer: #ifdef DEBUG - printf("%08x: defer: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); + fprintf(stderr,"%08x: defer: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); #endif cfa = *(Xt *)PFA1(cfa); NEXT1; @@ -277,8 +287,8 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * */ #ifdef DEBUG - printf("%08x/%08x: does: %08x\n",(Cell)ip,(Cell)cfa,*(Cell)PFA(cfa)); - fflush(stdout); + fprintf(stderr,"%08x/%08x: does: %08x\n",(Cell)ip,(Cell)PFA(cfa),(Cell)DOES_CODE1(cfa)); + fflush(stderr); #endif *--rp = (Cell)ip; /* PFA1 might collide with DOES_CODE1 here, so we use PFA */ @@ -290,6 +300,6 @@ Label *engine(Xt *ip0, Cell *sp0, Cell * *--sp = (Cell)PFA(cfa); #endif NEXT; - + #include "primitives.i" }