
/*
** Small-C Compiler Version 2.0
**
** Copyright 1982 J. E. Hendrix
**
** Macro Definitions
*/

#define DATE  "(7/28/83)"       /* date this version was created */
#define VERSION  "2.03"         /* current version of compiler */

/*
** compile options
*/
#define N_CMD_LN /* new command line processing */
/* #define FULLC         /* bootstrap compiler can handle full C */
/* #define C80      /* bootstrap compile with C/80 compiler */
#define M80      /* generate m80 compatable library calls */
#define PHASE2   /* 2nd and later compiles */
#define SEPARATE /* compile separately */
#define OPTIMIZE /* compile output optimizer */
#define NOCCARGC /* no calls to CCARGC */
/* #define HASH     /* use hash search for macros */
/* #define SMALL_VM /* uses Small-VM interface */
#define CMD_LINE /* command line run options */
/* #define DYNAMIC  /* allocate memory dynamically */
/* #define POLL     /* poll for operator interruptions */
/* #define PDS      /* uses PDS assembler and loader */
#define COL      /* terminate labels with a colon */
#define TAB  9   /* put out tabs of this value */
#define UPPER    /* force symbols to upper case */
#define LINK     /* will use with linking loader */

/*
** machine dependent parameters
*/
#define BPW     2   /* bytes per word */
#define LBPW    1   /* log2(BPW) */
#define SBPC    1   /* stack bytes per character */
#define ERRCODE 7   /* op sys return code */
 
/*
** symbol table format
*/
#define IDENT    0
#define TYPE     1
#define CLASS    2
#define OFFSET   3
#define NAME     5
#define OFFSIZE (NAME-OFFSET)
#define SYMAVG  10
#define SYMMAX  14

/*
** symbol table parameters
*/
#define NUMLOCS   25
#define STARTLOC  symtab
#define ENDLOC   (symtab+(NUMLOCS*SYMAVG))
#define NUMGLBS   180
#define STARTGLB  ENDLOC
#define ENDGLB   (ENDLOC+((NUMGLBS-1)*SYMMAX))
#define SYMTBSZ   2770  /* NUMLOCS*SYMAVG + NUMGLBS*SYMMAX */
 
/*
** System wide name size (for symbols)
*/
#define NAMESIZE 9
#define NAMEMAX  8
 
/*
** possible entries for "IDENT"
*/
#define LABEL    0
#define VARIABLE 1
#define ARRAY    2
#define POINTER  3
#define FUNCTION 4
 
/*
** possible entries for "TYPE"
**    low order 2 bits make type unique within length
**    high order bits give length of object
*/
/*      LABEL   0 */
#define CCHAR   (1<<2)
#define CINT    (BPW<<2)
 
/*
** possible entries for "CLASS"
*/
/*      LABEL     0 */
#define STATIC    1
#define AUTOMATIC 2
#define EXTERNAL  3

/*
** "switch" table
*/
#ifdef PHASE2
#define SWSIZ   (2*BPW)
#define SWTABSZ (25*SWSIZ)
#else /* PHASE2 */
#define SWSIZ    4
#define SWTABSZ 100
#endif /* PHASE2 */
 
/*
** "while" statement queue
*/
#define WQTABSZ  30
#define WQSIZ     3
#define WQMAX   (wq+WQTABSZ-WQSIZ)
 
/*
** entry offsets in while queue
*/
#define WQSP    0
#define WQLOOP  1
#define WQEXIT  2
 
/*
** literal pool
*/
#define LITABSZ 700
#define LITMAX  (LITABSZ-1)
 
/*
** input line
*/
#define LINEMAX  100
#define LINESIZE 101

/*
** command line
*/
#define MAXARGS  32     /* maximum number of option arguments */

/*
** output staging buffer size
*/
#define STAGESIZE   800
#define STAGELIMIT  (STAGESIZE-1)
 
/*
** macro (define) pool
*/
#ifdef HASH
#define MACNBR   90
#define MACNSIZE 990   /* 90*(NAMESIZE+2) */
#define MACNEND  (macn+MACNSIZE)
#define MACQSIZE 450   /* 90*5 */

#else /* HASH */
#define MACQSIZE 950
#endif /* HASH */

#define MACMAX  (MACQSIZE-1)
 
/*
** statement types
*/
#define STIF      1
#define STWHILE   2
#define STRETURN  3
#define STBREAK   4
#define STCONT    5
#define STASM     6
#define STEXPR    7
#define STDO      8 /* compile "do" logic */
#define STFOR     9 /* compile "for" logic */
#define STSWITCH 10 /* compile "switch/case/default" logic */
#define STCASE   11
#define STDEF    12
#define STGOTO   13 /* compile "goto" logic */
pile "switch/case/default" logic */
#define STCASE   11
#define STDEF    12
#define STGOTO   13 /* compile "goto" lo