Annotation of gforth/forth.h, revision 1.8

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

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