version 1.5, 1994/05/07 14:55:47
|
version 1.7, 1994/06/01 10:05:15
|
Line 13
|
Line 13
|
#include <assert.h> |
#include <assert.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <time.h> |
#include <time.h> |
|
#include <sys/time.h> |
|
#include <sys/unistd.h> |
#include "forth.h" |
#include "forth.h" |
#include "io.h" |
#include "io.h" |
|
|
extern unlink(char *); |
|
extern ftruncate(int, int); |
|
|
|
typedef union { |
typedef union { |
struct { |
struct { |
#ifdef BIG_ENDIAN |
#ifdef BIG_ENDIAN |
Line 72 typedef struct F83Name {
|
Line 71 typedef struct F83Name {
|
#define FTOS (fp[0]) |
#define FTOS (fp[0]) |
#endif |
#endif |
|
|
/* |
|
#define CA_DODOES (symbols[DODOES]) |
|
*/ |
|
|
|
int emitcounter; |
int emitcounter; |
#define NULLC '\0' |
#define NULLC '\0' |
|
|
Line 89 static char* fileattr[6]={"r","rb","r+",
|
Line 84 static char* fileattr[6]={"r","rb","r+",
|
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 |
returns array of machine code labels (for use in a loader), if ip==NULL |
returns array of machine code labels (for use in a loader), if ip==NULL |
This is very preliminary, as the bootstrap architecture is not yet decided |
|
*/ |
*/ |
{ |
{ |
Xt cfa; |
Xt cfa; |
Line 100 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 94 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
&&dovar, |
&&dovar, |
&&douser, |
&&douser, |
&&dodoes, |
&&dodoes, |
&&docol, /* dummy for does handler address */ |
&&dodoes, /* dummy for does handler address */ |
#include "prim_labels.i" |
#include "prim_labels.i" |
}; |
}; |
IF_TOS(register Cell TOS;) |
IF_TOS(register Cell TOS;) |
Line 119 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 113 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
|
|
docol: |
docol: |
#ifdef DEBUG |
#ifdef DEBUG |
printf("col: %x\n",(Cell)PFA1(cfa)); |
printf("%08x: col: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); |
#endif |
#endif |
#ifdef undefined |
#ifdef undefined |
/* this is the simple version */ |
/* this is the simple version */ |
Line 143 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 137 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
|
|
docon: |
docon: |
#ifdef DEBUG |
#ifdef DEBUG |
printf("con: %x\n",*(Cell*)PFA1(cfa)); |
printf("%08x: con: %08x\n",(Cell)ip,*(Cell*)PFA1(cfa)); |
#endif |
#endif |
#ifdef USE_TOS |
#ifdef USE_TOS |
*sp-- = TOS; |
*sp-- = TOS; |
Line 155 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 149 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
|
|
dovar: |
dovar: |
#ifdef DEBUG |
#ifdef DEBUG |
printf("var: %x\n",(Cell)PFA1(cfa)); |
printf("%08x: var: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); |
#endif |
#endif |
#ifdef USE_TOS |
#ifdef USE_TOS |
*sp-- = TOS; |
*sp-- = TOS; |
Line 169 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 163 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
|
|
douser: |
douser: |
#ifdef DEBUG |
#ifdef DEBUG |
printf("user: %x\n",(Cell)PFA1(cfa)); |
printf("%08x: user: %08x\n",(Cell)ip,(Cell)PFA1(cfa)); |
#endif |
#endif |
#ifdef USE_TOS |
#ifdef USE_TOS |
*sp-- = TOS; |
*sp-- = TOS; |
Line 198 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
Line 192 Label *engine(Xt *ip, Cell *sp, Cell *rp
|
|
|
*/ |
*/ |
#ifdef DEBUG |
#ifdef DEBUG |
printf("does: %x\n",(Cell)PFA(cfa)); fflush(stdout); |
printf("%08x/%08x: does: %08x\n",(Cell)ip,(Cell)cfa,*(Cell)PFA(cfa)); |
|
fflush(stdout); |
#endif |
#endif |
*--rp = (Cell)ip; |
*--rp = (Cell)ip; |
/* PFA1 might collide with DOES_CODE1 here, so we use PFA */ |
/* PFA1 might collide with DOES_CODE1 here, so we use PFA */ |