Annotation of gforth/forth.h, revision 1.7

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

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