|
|
1.1 ! root 1: /* ! 2: * Secondary inclusions. ! 3: */ ! 4: ! 5: #include <mprec.h> /* multi-precision integer declarations */ ! 6: #include "bcmch.h" /* bc-machine definitions */ ! 7: #include "bcsymtbl.h" /* symbol table definitions */ ! 8: ! 9: ! 10: /* ! 11: * Manifest constants. ! 12: */ ! 13: ! 14: #define TRUE (0 == 0) ! 15: #define FALSE (0 != 0) ! 16: #define MAXWORD 80 /* maximum token length */ ! 17: #define MAXSTRING 250 /* maximum quoted-string length */ ! 18: #define MAXSTACK 200 /* max pseudo-machine run-time stack */ ! 19: #define MAXCODE 1000 /* maximum function code size */ ! 20: #define ABUMP 8 /* array growth quantum */ ! 21: #define LINELEN 72 /* maximum output line length */ ! 22: #define NOSHELL 127 /* system return if no shell */ ! 23: ! 24: /* ! 25: * The nel macro returns the number of elements in the array ! 26: * "array". It will be a compile time constant. ! 27: */ ! 28: ! 29: #define nel(array) ((sizeof (array)) / (sizeof *(array))) ! 30: ! 31: /* ! 32: * The following macros are used to place items in the code ! 33: * stream of the bc-machine. ! 34: */ ! 35: ! 36: #define emitop(op) (incloc()->opcode = (op)) ! 37: #define emitzap (incloc()->address = -1, loc - 1) ! 38: #define emitaddr(addr) (loc->address = (addr) - loc, incloc()) ! 39: #define emitnum(num) (incloc()->lvalue = (num)) ! 40: #define emitarry(arry) (incloc()->alvalue = (arry)) ! 41: #define emitstr(str) (incloc()->svalue = (str)) ! 42: #define emitcnt(cnt) (incloc()->ivalue = (cnt)) ! 43: #define emitid(ident) (incloc()->dvalue = (ident)) ! 44: #define patch(target, addr) ((target)->address = (addr) - (target)) ! 45: ! 46: /* ! 47: * Global functions that return non-ints. ! 48: */ ! 49: ! 50: rvalue *getnum(); /* read number from stdin */ ! 51: rvalue *select(); /* select an array element */ ! 52: code *incloc(); /* return next slot and advance loc */ ! 53: mint *pow10(); /* return 10 to a power */ ! 54: opcode negate(); /* negate condition of branch */ ! 55: stkent *pauto(); /* initialize autos used in a bc fnc.*/ ! 56: stkent *newframe(); /* frame value after a function call */ ! 57: char *realloc(); /* call in dc.c and bcmutil.c */ ! 58: ! 59: /* ! 60: * Global variables. ! 61: */ ! 62: ! 63: extern int allok; /* True iff no syntax errors */ ! 64: extern int scale; /* scale register */ ! 65: extern int ibase; /* input base */ ! 66: extern dicent *dictionary; /* root of string table */ ! 67: extern code cstream[]; /* code stream */ ! 68: extern code *loc; /* where next code item goes */ ! 69: extern mint ten; /* constant ten */ ! 70: extern mint maxsobase; /* max small output base (16) */ ! 71: extern mint outbase; /* output base */ ! 72: extern rvalue dot; /* last number printed */ ! 73: extern rvalue zero; /* constant zero */ ! 74: extern FILE *infile; /* current input file */ ! 75: extern int inline; /* current input line */ ! 76: extern char *infnam; /* current file name */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.