Annotation of gforth/forth.h, revision 1.14

1.1       anton       1: /*
                      2:   Copyright 1992 by the ANSI figForth Development Group
                      3: */
                      4: 
                      5: /* common header file */
                      6: 
                      7: typedef void *Label;
                      8: 
1.2       pazsan      9: /* symbol indexed constants */
                     10: 
                     11: #define DOCOL  0
                     12: #define DOCON  1
                     13: #define DOVAR  2
                     14: #define DOUSER 3
1.8       anton      15: #define DODEFER        4
1.14    ! pazsan     16: #define DOSTRUC        5
        !            17: #define DODOES 6
        !            18: #define DOESJUMP       7
1.6       benschop   19: 
1.1       anton      20: #include "machine.h"
                     21: 
                     22: /* Forth data types */
                     23: typedef int Bool;
                     24: #define FLAG(b) (-(b))
1.5       pazsan     25: #define FILEIO(error)  (FLAG(error) & -37)
                     26: #define FILEEXIST(error)       (FLAG(error) & -38)
1.1       anton      27: 
                     28: #define F_TRUE (FLAG(0==0))
                     29: #define F_FALSE (FLAG(0!=0))
                     30: 
                     31: typedef unsigned char Char;
                     32: typedef double Float;
                     33: typedef char *Address;
                     34: 
                     35: #ifdef DIRECT_THREADED
                     36: typedef Label Xt;
                     37: #else
                     38: typedef Label *Xt;
                     39: #endif
                     40: 
1.4       anton      41: Label *engine(Xt *ip, Cell *sp, Cell *rp, Float *fp, Address lp);
1.1       anton      42: 
                     43: #ifndef DIRECT_THREADED
                     44: /* i.e. indirect threaded */
                     45: /* the direct threaded version is machine dependent and resides in machine.h */
                     46: 
                     47: /* PFA gives the parameter field address corresponding to a cfa */
                     48: #define PFA(cfa)       (((Cell *)cfa)+2)
                     49: /* PFA1 is a special version for use just after a NEXT1 */
                     50: #define PFA1(cfa)      PFA(cfa)
                     51: /* CODE_ADDRESS is the address of the code jumped to through the code field */
                     52: #define CODE_ADDRESS(cfa)      (*(Label *)(cfa))
                     53:       /* DOES_CODE is the Forth code does jumps to */
                     54: #define DOES_CODE(cfa)           (cfa[1])
                     55: #define DOES_CODE1(cfa)          DOES_CODE(cfa)
                     56: /* MAKE_CF creates an appropriate code field at the cfa;
                     57:    ca is the code address */
                     58: #define MAKE_CF(cfa,ca) ((*(Label *)(cfa)) = ((Label)ca))
                     59: /* make a code field for a defining-word-defined word */
1.2       pazsan     60: #define MAKE_DOES_CF(cfa,does_code)    ({MAKE_CF(cfa,symbols[DODOES]); \
1.1       anton      61:                                          ((Cell *)cfa)[1] = (Cell)does_code;})
                     62: /* the does handler resides between DOES> and the following Forth code */
1.13      pazsan     63: #define DOES_HANDLER_SIZE      (2*sizeof(Cell))
1.1       anton      64: #define MAKE_DOES_HANDLER(addr)        0 /* do nothing */
                     65: #endif
                     66: 
                     67: #ifdef DEBUG
1.13      pazsan     68: #      define  NAME(string)    fprintf(stderr,"%08x: "string"\n",(Cell)ip);
1.1       anton      69: #else
                     70: #      define  NAME(string)
                     71: #endif
1.2       pazsan     72: 
                     73: #define CF(const)      (-const-2)
                     74: 
                     75: #define CF_NIL -1
1.3       pazsan     76: 
                     77: #ifndef CACHE_FLUSH
                     78: #      define CACHE_FLUSH(addr,size)
                     79: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>