version 1.6, 1994/05/18 17:29:52
|
version 1.12, 1994/08/25 15:25:21
|
Line 17
|
Line 17
|
#include "forth.h" |
#include "forth.h" |
#include "io.h" |
#include "io.h" |
|
|
#ifndef unlink |
|
extern unlink(char *); |
|
#endif |
|
#ifndef ftruncate |
|
extern ftruncate(int, int); |
|
#endif |
|
|
|
typedef union { |
typedef union { |
struct { |
struct { |
#ifdef BIG_ENDIAN |
#ifdef BIG_ENDIAN |
Line 87 int emitcounter;
|
Line 80 int emitcounter;
|
|
|
static char* fileattr[6]={"r","rb","r+","r+b","w+","w+b"}; |
static char* fileattr[6]={"r","rb","r+","r+b","w+","w+b"}; |
|
|
#if ~defined(select) && defined(DOS) |
static Address up0=NULL; |
/* select replacement for DOS computers for ms only */ |
|
void select(int n, int a, int b, int c, struct timeval * timeout) |
|
{ |
|
struct timeval time1; |
|
struct timeval time2; |
|
struct timezone zone1; |
|
|
|
gettimeofday(&time1,&zone1); |
|
time1.tv_sec += timeout->tv_sec; |
|
time1.tv_usec += timeout->tv_usec; |
|
while(time1.tv_usec >= 1000000) |
|
{ |
|
time1.tv_usec -= 1000000; |
|
time1.tv_sec++; |
|
} |
|
do |
|
{ |
|
gettimeofday(&time2,&zone1); |
|
} |
|
while(time2.tv_usec < time1.tv_usec || time2.tv_sec < time1.tv_sec); |
|
} |
|
#endif |
|
|
|
Label *engine(Xt *ip, Cell *sp, Cell *rp, Float *fp, Address lp) |
Label *engine(Xt *ip, Cell *sp, Cell *rp, Float *fp, Address lp) |
/* executes code at ip, if ip!=NULL |
/* executes code at ip, if ip!=NULL |
Line 117 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 88 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
*/ |
*/ |
{ |
{ |
Xt cfa; |
Xt cfa; |
Address up=NULL; |
Address up=up0; |
static Label symbols[]= { |
static Label symbols[]= { |
&&docol, |
&&docol, |
&&docon, |
&&docon, |
&&dovar, |
&&dovar, |
&&douser, |
&&douser, |
|
&&dodefer, |
&&dodoes, |
&&dodoes, |
&&dodoes, /* dummy for does handler address */ |
&&dodoes, /* dummy for does handler address */ |
#include "prim_labels.i" |
#include "prim_labels.i" |
Line 135 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 107 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
|
|
if (ip == NULL) |
if (ip == NULL) |
return symbols; |
return symbols; |
|
|
IF_TOS(TOS = sp[0]); |
IF_TOS(TOS = sp[0]); |
IF_FTOS(FTOS = fp[0]); |
IF_FTOS(FTOS = fp[0]); |
prep_terminal(); |
prep_terminal(); |
Line 203 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 175 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
#endif |
#endif |
NEXT; |
NEXT; |
|
|
|
dodefer: |
|
#ifdef DEBUG |
|
printf("%08x: defer: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); |
|
#endif |
|
cfa = *(Xt *)PFA1(cfa); |
|
NEXT1; |
|
|
dodoes: |
dodoes: |
/* this assumes the following structure: |
/* this assumes the following structure: |
defining-word: |
defining-word: |