1: /*	@(#)c0.h	2.4	SCCS id keyword	*/
   2: #
   3: /*
   4: * 	C compiler-- first pass header
   5: */
   6: 
   7: #include <stdio.h>
   8: #include <whoami.h>
   9: 
  10: /*
  11:  * parameters
  12:  */
  13: 
  14: #define LTYPE   long    /* change to int if no long consts */
  15: #define MAXINT  077777  /* Largest positive short integer */
  16: #define MAXUINT 0177777 /* largest unsigned integer */
  17: #define NCPS    8   /* # chars per symbol */
  18: #ifdef  FORTY
  19: #define HSHSIZ  600 /* Smaller but be sure vi compiles */
  20: #else
  21: #define HSHSIZ  800 /* # entries in hash table for names */
  22: #endif	FORTY
  23: #define CMSIZ   40  /* size of expression stack */
  24: #define SSIZE   20  /* size of other expression stack */
  25: #define SWSIZ   230 /* size of switch table */
  26: #define NMEMS   128 /* Number of members in a structure */
  27: #define NBPW    16  /* bits per word, object machine */
  28: #define NBPC    8   /* bits per character, object machine */
  29: #define NCPW    2   /* chars per word, object machine */
  30: #define LNCPW   2   /* chars per word, compiler's machine */
  31: int STAUTO;     /* offset of first auto variable */
  32: #define STARG   4   /* offset of first argument */
  33: 
  34: 
  35: /*
  36:  * # bytes in primitive types
  37:  */
  38: #define SZCHAR  1
  39: #define SZINT   2
  40: #define SZPTR   2
  41: #define SZFLOAT 4
  42: #define SZLONG  4
  43: #define SZDOUB  8
  44: 
  45: /*
  46:  * format of a structure description
  47:  */
  48: struct str {
  49:     int ssize;          /* structure size */
  50:     struct hshtab   **memlist;  /* member list */
  51: };
  52: 
  53: /*
  54:  * For fields, strp points here instead.
  55:  */
  56: struct field {
  57:     int flen;       /* field width in bits */
  58:     int bitoffs;    /* shift count */
  59: };
  60: 
  61: /*
  62:  * Structure of tree nodes for operators
  63:  */
  64: struct tnode {
  65:     int op;     /* operator */
  66:     int type;       /* data type */
  67:     int *subsp;     /* subscript list (for arrays) */
  68:     struct  str *strp;  /* structure description for structs */
  69:     struct  tnode *tr1; /* left operand */
  70:     struct  tnode *tr2; /* right operand */
  71: };
  72: 
  73: /*
  74:  * Tree node for constants
  75:  */
  76: struct  cnode {
  77:     int op;
  78:     int type;
  79:     int *subsp;
  80:     struct  str *strp;
  81:     int value;
  82: };
  83: 
  84: /*
  85:  * Tree node for long constants
  86:  */
  87: struct lnode {
  88:     int op;
  89:     int type;
  90:     int *subsp;
  91:     struct  str *strp;
  92:     LTYPE   lvalue;
  93: };
  94: 
  95: /*
  96:  * tree node for floating
  97:  * constants
  98:  */
  99: struct  fnode {
 100:     int op;
 101:     int type;
 102:     int *subsp;
 103:     struct  str *strp;
 104:     char    *cstr;
 105: };
 106: 
 107: /*
 108:  * Structure of namelist
 109:  */
 110: /*
 111:  * Pushed-down entry for block structure
 112:  */
 113: struct  phshtab {
 114:     char    hclass;
 115:     char    hflag;
 116:     int htype;
 117:     int *hsubsp;
 118:     struct  str *hstrp;
 119:     int hoffset;
 120:     struct  phshtab *hpdown;
 121:     char    hblklev;
 122: };
 123: 
 124: /*
 125:  * Top-level namelist
 126:  */
 127: struct hshtab {
 128:     char    hclass;     /* storage class */
 129:     char    hflag;      /* various flags */
 130:     int htype;      /* type */
 131:     int *hsubsp;    /* subscript list */
 132:     struct  str *hstrp; /* structure description */
 133:     int hoffset;    /* post-allocation location */
 134:     struct  phshtab *hpdown;    /* Pushed-down name in outer block */
 135:     char    hblklev;    /* Block level of definition */
 136:     char    name[NCPS]; /* ASCII name */
 137: };
 138: 
 139: /*
 140:  * Place used to keep dimensions
 141:  * during declarations
 142:  */
 143: struct  tdim {
 144:     int rank;
 145:     int dimens[5];
 146: };
 147: 
 148: /*
 149:  * Table for recording switches.
 150:  */
 151: struct swtab {
 152:     int swlab;
 153:     int swval;
 154: };
 155: 
 156: char    cvtab[4][4];
 157: char    filename[64];
 158: int opdope[];
 159: char    ctab[];
 160: char    symbuf[NCPS+2];
 161: int hshused;
 162: struct  hshtab  hshtab[HSHSIZ];
 163: struct  tnode **cp;
 164: int isn;
 165: struct  swtab   swtab[SWSIZ];
 166: struct  swtab   *swp;
 167: int contlab;
 168: int brklab;
 169: int retlab;
 170: int deflab;
 171: unsigned autolen;       /* make these int if necessary */
 172: unsigned maxauto;       /* ... will only cause trouble rarely */
 173: int peeksym;
 174: int peekc;
 175: int eof;
 176: int line;
 177: char    *funcbase;
 178: char    *curbase;
 179: char    *coremax;
 180: char    *maxdecl;
 181: struct  hshtab  *defsym;
 182: struct  hshtab  *funcsym;
 183: int proflg;
 184: struct  hshtab  *csym;
 185: int cval;
 186: LTYPE   lcval;
 187: int nchstr;
 188: int nerror;
 189: struct  hshtab  **paraml;
 190: struct  hshtab  **parame;
 191: int strflg;
 192: int mosflg;
 193: int initflg;
 194: int inhdr;
 195: char    sbuf[BUFSIZ];
 196: FILE    *sbufp;
 197: int regvar;
 198: int bitoffs;
 199: struct  tnode   funcblk;
 200: char    cvntab[];
 201: char    numbuf[64];
 202: struct  hshtab **memlist;
 203: int nmems;
 204: struct  hshtab  structhole;
 205: int blklev;
 206: int mossym;
 207: 
 208: /*
 209:   operators
 210: */
 211: #define EOFC    0
 212: #define NULLOP  218
 213: #define SEMI    1
 214: #define LBRACE  2
 215: #define RBRACE  3
 216: #define LBRACK  4
 217: #define RBRACK  5
 218: #define LPARN   6
 219: #define RPARN   7
 220: #define COLON   8
 221: #define COMMA   9
 222: #define FSEL    10
 223: #define CAST    11
 224: #define ETYPE   12
 225: 
 226: #define KEYW    19
 227: #define NAME    20
 228: #define CON 21
 229: #define STRING  22
 230: #define FCON    23
 231: #define SFCON   24
 232: #define LCON    25
 233: #define SLCON   26
 234: 
 235: #define SIZEOF  91
 236: #define INCBEF  30
 237: #define DECBEF  31
 238: #define INCAFT  32
 239: #define DECAFT  33
 240: #define EXCLA   34
 241: #define AMPER   35
 242: #define STAR    36
 243: #define NEG 37
 244: #define COMPL   38
 245: 
 246: #define DOT 39
 247: #define PLUS    40
 248: #define MINUS   41
 249: #define TIMES   42
 250: #define DIVIDE  43
 251: #define MOD 44
 252: #define RSHIFT  45
 253: #define LSHIFT  46
 254: #define AND 47
 255: #define OR  48
 256: #define EXOR    49
 257: #define ARROW   50
 258: #define ITOF    51
 259: #define FTOI    52
 260: #define LOGAND  53
 261: #define LOGOR   54
 262: #define FTOL    56
 263: #define LTOF    57
 264: #define ITOL    58
 265: #define LTOI    59
 266: #define ITOP    13
 267: #define PTOI    14
 268: #define LTOP    15
 269: 
 270: #define EQUAL   60
 271: #define NEQUAL  61
 272: #define LESSEQ  62
 273: #define LESS    63
 274: #define GREATEQ 64
 275: #define GREAT   65
 276: #define LESSEQP 66
 277: #define LESSP   67
 278: #define GREATQP 68
 279: #define GREATP  69
 280: 
 281: #define ASPLUS  70
 282: #define ASMINUS 71
 283: #define ASTIMES 72
 284: #define ASDIV   73
 285: #define ASMOD   74
 286: #define ASRSH   75
 287: #define ASLSH   76
 288: #define ASSAND  77
 289: #define ASOR    78
 290: #define ASXOR   79
 291: #define ASSIGN  80
 292: 
 293: #define QUEST   90
 294: #define MAX 93
 295: #define MAXP    94
 296: #define MIN 95
 297: #define MINP    96
 298: #define SEQNC   97
 299: #define CALL    100
 300: #define MCALL   101
 301: #define JUMP    102
 302: #define CBRANCH 103
 303: #define INIT    104
 304: #define SETREG  105
 305: #define RFORCE  110
 306: #define BRANCH  111
 307: #define LABEL   112
 308: #define NLABEL  113
 309: #define RLABEL  114
 310: #define STRASG  115
 311: #define ITOC    109
 312: #define SEOF    200 /* stack EOF marker in expr compilation */
 313: 
 314: /*
 315:   types
 316: */
 317: #define INT 0
 318: #define CHAR    1
 319: #define FLOAT   2
 320: #define DOUBLE  3
 321: #define STRUCT  4
 322: #define LONG    6
 323: #define UNSIGN  7
 324: #define UNION   8       /* adjusted later to struct */
 325: 
 326: #define ALIGN   01
 327: #define TYPE    07
 328: #define BIGTYPE 060000
 329: #define TYLEN   2
 330: #define XTYPE   (03<<3)
 331: #define PTR 010
 332: #define FUNC    020
 333: #define ARRAY   030
 334: 
 335: /*
 336:   storage classes
 337: */
 338: #define KEYWC   1
 339: #define DEFXTRN 20
 340: #define TYPEDEF 9
 341: #define MOS 10
 342: #define AUTO    11
 343: #define EXTERN  12
 344: #define STATIC  13
 345: #define REG 14
 346: #define STRTAG  15
 347: #define ARG 16
 348: #define ARG1    17
 349: #define AREG    18
 350: #define MOU 21
 351: #define ENUMTAG 22
 352: #define ENUMCON 24
 353: 
 354: /*
 355:   keywords
 356: */
 357: #define GOTO    20
 358: #define RETURN  21
 359: #define IF  22
 360: #define WHILE   23
 361: #define ELSE    24
 362: #define SWITCH  25
 363: #define CASE    26
 364: #define BREAK   27
 365: #define CONTIN  28
 366: #define DO  29
 367: #define DEFAULT 30
 368: #define FOR 31
 369: #define ENUM    32
 370: 
 371: /*
 372:   characters
 373: */
 374: #define BSLASH  117
 375: #define SHARP   118
 376: #define INSERT  119
 377: #define PERIOD  120
 378: #define SQUOTE  121
 379: #define DQUOTE  122
 380: #define LETTER  123
 381: #define DIGIT   124
 382: #define NEWLN   125
 383: #define SPACE   126
 384: #define UNKN    127
 385: 
 386: /*
 387:  * Special operators in intermediate code
 388:  */
 389: #define BDATA   200
 390: #define WDATA   201
 391: #define PROG    202
 392: #define DATA    203
 393: #define BSS 204
 394: #define CSPACE  205
 395: #define SSPACE  206
 396: #define SYMDEF  207
 397: #define SAVE    208
 398: #define RETRN   209
 399: #define EVEN    210
 400: #define PROFIL  212
 401: #define SWIT    213
 402: #define EXPR    214
 403: #define SNAME   215
 404: #define RNAME   216
 405: #define ANAME   217
 406: #define SETSTK  219
 407: #define SINIT   220
 408: 
 409: /*
 410:   Flag bits
 411: */
 412: 
 413: #define BINARY  01
 414: #define LVALUE  02
 415: #define RELAT   04
 416: #define ASSGOP  010
 417: #define LWORD   020
 418: #define RWORD   040
 419: #define COMMUTE 0100
 420: #define RASSOC  0200
 421: #define LEAF    0400
 422: 
 423: /*
 424:  * Conversion codes
 425:  */
 426: #define ITF 1
 427: #define ITL 2
 428: #define LTF 3
 429: #define ITP 4
 430: #define PTI 5
 431: #define FTI 6
 432: #define LTI 7
 433: #define FTL 8
 434: #define LTP 9
 435: #define ITC 10
 436: #define XX  15
 437: 
 438: /*
 439:  * symbol table flags
 440:  */
 441: 
 442: #define FMOS    01
 443: #define FKEYW   04
 444: #define FFIELD  020
 445: #define FINIT   040
 446: #define FLABL   0100
 447: 
 448: /*
 449:  * functions
 450:  */
 451: char    *sbrk();
 452: struct  tnode *tree();
 453: char    *copnum();
 454: struct  tnode *convert();
 455: struct  tnode *chkfun();
 456: struct  tnode *disarray();
 457: struct  tnode *block();
 458: struct  cnode *cblock();
 459: struct  fnode *fblock();
 460: char    *gblock();
 461: struct  tnode *pexpr();
 462: struct  str *strdec();
 463: struct  hshtab *xprtype();
 464: struct  tnode *nblock();

Defined variables

STAUTO defined in line 31; used 5 times
autolen defined in line 171; used 7 times
bitoffs defined in line 198; used 18 times
blklev defined in line 205; used 16 times
brklab defined in line 168; used 22 times
contlab defined in line 167; used 19 times
coremax defined in line 179; used 3 times
cp defined in line 163; used 51 times
csym defined in line 184; used 13 times
ctab defined in line 159; used 12 times
curbase defined in line 178; used 19 times
cval defined in line 185; used 32 times
cvntab defined in line 200; used 1 times
cvtab defined in line 156; used 1 times
deflab defined in line 170; used 8 times
defsym defined in line 181; used 15 times
eof defined in line 175; used 6 times
filename defined in line 157; used 3 times
funcbase defined in line 177; used 21 times
funcblk defined in line 199; used 5 times
funcsym defined in line 182; used 3 times
hshtab defined in line 162; used 10 times
hshused defined in line 161; used 3 times
inhdr defined in line 194; used 8 times
initflg defined in line 193; used 6 times
isn defined in line 164; used 27 times
line defined in line 176; used 12 times
maxauto defined in line 172; used 4 times
maxdecl defined in line 180; used 10 times
memlist defined in line 202; used 16 times
mosflg defined in line 192; used 11 times
mossym defined in line 206; used 5 times
nchstr defined in line 187; used 8 times
nerror defined in line 188; used 6 times
nmems defined in line 203; used 5 times
numbuf defined in line 201; used 3 times
opdope defined in line 158; used 6 times
parame defined in line 190; used 4 times
paraml defined in line 189; used 8 times
peekc defined in line 174; used 24 times
peeksym defined in line 173; used 54 times
proflg defined in line 183; used 2 times
regvar defined in line 197; used 10 times
retlab defined in line 169; used 4 times
sbuf defined in line 195; used 1 times
strflg defined in line 191; used 4 times
structhole defined in line 204; used 2 times
swp defined in line 166; used 10 times
swtab defined in line 165; used 2 times
symbuf defined in line 160; used 11 times

Defined struct's

cnode defined in line 76; used 6 times
field defined in line 56; used 2 times
fnode defined in line 99; used 6 times
hshtab defined in line 127; used 93 times
lnode defined in line 87; used 2 times
phshtab defined in line 113; used 14 times
str defined in line 48; used 20 times
swtab defined in line 151; used 6 times
tdim defined in line 143; used 6 times
tnode defined in line 64; used 110 times

Defined macros

ALIGN defined in line 326; used 8 times
AMPER defined in line 241; used 6 times
ANAME defined in line 405; used 1 times
AND defined in line 254; used 4 times
AREG defined in line 349; used 4 times
ARG defined in line 347; used 4 times
ARG1 defined in line 348; used 4 times
ARRAY defined in line 333; used 17 times
ARROW defined in line 257; used 1 times
ASDIV defined in line 284; never used
ASLSH defined in line 287; used 1 times
ASMINUS defined in line 282; never used
ASMOD defined in line 285; never used
ASOR defined in line 289; never used
ASPLUS defined in line 281; used 2 times
ASRSH defined in line 286; used 1 times
ASSAND defined in line 288; never used
ASSGOP defined in line 416; used 1 times
ASTIMES defined in line 283; never used
ASXOR defined in line 290; never used
AUTO defined in line 342; used 13 times
BDATA defined in line 389; used 4 times
BIGTYPE defined in line 328; used 4 times
BINARY defined in line 413; used 5 times
BRANCH defined in line 306; used 1 times
BREAK defined in line 364; used 1 times
BSLASH defined in line 374; used 1 times
BSS defined in line 393; used 2 times
CALL defined in line 299; used 8 times
CASE defined in line 363; used 1 times
CAST defined in line 223; used 4 times
CBRANCH defined in line 302; used 1 times
CHAR defined in line 318; used 18 times
CMSIZ defined in line 23; used 2 times
COLON defined in line 220; used 9 times
COMMA defined in line 221; used 8 times
COMMUTE defined in line 419; never used
COMPL defined in line 244; used 1 times
CON defined in line 228; used 14 times
CONTIN defined in line 365; used 1 times
CSPACE defined in line 394; used 1 times
DATA defined in line 392; used 2 times
DECAFT defined in line 239; never used
DECBEF defined in line 237; used 1 times
DEFAULT defined in line 367; used 1 times
DEFXTRN defined in line 339; used 3 times
DIGIT defined in line 381; used 14 times
DIVIDE defined in line 250; used 2 times
DO defined in line 366; used 1 times
DOT defined in line 246; used 1 times
DOUBLE defined in line 320; used 7 times
DQUOTE defined in line 379; used 1 times
ELSE defined in line 361; used 3 times
ENUM defined in line 369; used 6 times
ENUMCON defined in line 352; used 4 times
ENUMTAG defined in line 351; used 1 times
EOFC defined in line 211; used 7 times
EQUAL defined in line 270; used 1 times
ETYPE defined in line 224; used 3 times
EVEN defined in line 399; used 4 times
EXCLA defined in line 240; used 2 times
EXOR defined in line 256; used 3 times
EXPR defined in line 402; used 1 times
EXTERN defined in line 343; used 18 times
FCON defined in line 230; used 6 times
FFIELD defined in line 444; used 5 times
FINIT defined in line 445; used 2 times
FKEYW defined in line 443; used 6 times
FLABL defined in line 446; used 3 times
FLOAT defined in line 319; used 4 times
FMOS defined in line 442; used 4 times
FOR defined in line 368; used 1 times
FSEL defined in line 222; used 2 times
FTI defined in line 431; used 1 times
FTL defined in line 433; used 1 times
FTOI defined in line 259; used 2 times
FTOL defined in line 262; used 1 times
FUNC defined in line 332; used 9 times
GOTO defined in line 357; used 1 times
GREAT defined in line 275; used 2 times
GREATEQ defined in line 274; used 1 times
GREATP defined in line 279; never used
GREATQP defined in line 278; never used
HSHSIZ defined in line 21; used 8 times
IF defined in line 359; used 1 times
INCAFT defined in line 238; never used
INCBEF defined in line 236; used 1 times
INIT defined in line 303; used 2 times
INSERT defined in line 376; used 1 times
INT defined in line 317; used 31 times
ITC defined in line 435; never used
ITF defined in line 426; used 2 times
ITL defined in line 427; used 3 times
ITOC defined in line 311; used 2 times
ITOF defined in line 258; used 2 times
ITOL defined in line 264; used 1 times
ITOP defined in line 266; used 1 times
ITP defined in line 429; used 5 times
JUMP defined in line 301; used 1 times
KEYW defined in line 226; used 8 times
KEYWC defined in line 338; never used
LABEL defined in line 307; used 5 times
LBRACE defined in line 214; used 8 times
LBRACK defined in line 216; used 3 times
LCON defined in line 232; used 3 times
LEAF defined in line 421; never used
LESS defined in line 273; used 2 times
LESSEQ defined in line 272; used 3 times
LESSEQP defined in line 276; used 1 times
LESSP defined in line 277; never used
LETTER defined in line 380; used 54 times
LNCPW defined in line 30; used 4 times
LOGAND defined in line 260; used 1 times
LOGOR defined in line 261; used 1 times
LONG defined in line 322; used 5 times
LPARN defined in line 218; used 5 times
LSHIFT defined in line 253; used 1 times
LTF defined in line 428; used 2 times
LTI defined in line 432; used 2 times
LTOF defined in line 263; used 1 times
LTOI defined in line 265; used 1 times
LTOP defined in line 268; used 1 times
LTP defined in line 434; used 4 times
LTYPE defined in line 14; used 2 times
LVALUE defined in line 414; used 1 times
LWORD defined in line 417; used 1 times
MAX defined in line 294; used 3 times
MAXINT defined in line 15; used 2 times
MAXP defined in line 295; used 1 times
MAXUINT defined in line 16; never used
MCALL defined in line 300; used 1 times
MIN defined in line 296; used 2 times
MINP defined in line 297; never used
MINUS defined in line 248; used 3 times
MOD defined in line 251; used 1 times
MOS defined in line 341; used 10 times
MOU defined in line 350; used 3 times
NAME defined in line 227; used 18 times
NBPC defined in line 28; used 4 times
NBPW defined in line 27; used 2 times
NCPS defined in line 17; used 9 times
NCPW defined in line 29; used 1 times
NEG defined in line 243; used 1 times
NEQUAL defined in line 271; used 1 times
NEWLN defined in line 382; used 1 times
NLABEL defined in line 308; used 2 times
NMEMS defined in line 26; used 4 times
NULLOP defined in line 212; used 1 times
OR defined in line 255; used 2 times
PERIOD defined in line 377; used 1 times
PLUS defined in line 247; used 9 times
PROFIL defined in line 400; used 1 times
PROG defined in line 391; used 2 times
PTI defined in line 430; used 6 times
PTOI defined in line 267; used 1 times
PTR defined in line 331; used 13 times
QUEST defined in line 293; used 4 times
RASSOC defined in line 420; used 1 times
RBRACE defined in line 215; used 12 times
RBRACK defined in line 217; used 4 times
REG defined in line 345; used 9 times
RELAT defined in line 415; used 2 times
RETRN defined in line 398; used 1 times
RETURN defined in line 358; used 1 times
RFORCE defined in line 305; used 2 times
RLABEL defined in line 309; used 1 times
RNAME defined in line 404; used 1 times
RPARN defined in line 219; used 12 times
RSHIFT defined in line 252; used 1 times
RWORD defined in line 418; used 1 times
SAVE defined in line 397; used 1 times
SEMI defined in line 213; used 15 times
SEOF defined in line 312; used 1 times
SEQNC defined in line 298; used 1 times
SETREG defined in line 304; used 3 times
SETSTK defined in line 406; used 1 times
SFCON defined in line 231; never used
SHARP defined in line 375; used 1 times
SINIT defined in line 407; used 1 times
SIZEOF defined in line 235; used 5 times
SLCON defined in line 233; never used
SNAME defined in line 403; used 1 times
SPACE defined in line 383; used 5 times
SQUOTE defined in line 378; used 1 times
SSIZE defined in line 24; used 3 times
SSPACE defined in line 395; used 4 times
STAR defined in line 242; used 8 times
STARG defined in line 32; used 1 times
STATIC defined in line 344; used 11 times
STRASG defined in line 310; used 1 times
STRING defined in line 229; used 2 times
STRTAG defined in line 346; used 1 times
STRUCT defined in line 321; used 13 times
SWIT defined in line 401; used 1 times
SWITCH defined in line 362; used 1 times
SWSIZ defined in line 25; used 2 times
SYMDEF defined in line 396; used 4 times
SZCHAR defined in line 38; never used
SZDOUB defined in line 43; used 1 times
SZFLOAT defined in line 41; used 1 times
SZINT defined in line 39; used 2 times
SZLONG defined in line 42; used 1 times
SZPTR defined in line 40; used 1 times
TIMES defined in line 249; used 1 times
TYLEN defined in line 329; used 8 times
TYPE defined in line 327; used 12 times
TYPEDEF defined in line 340; used 11 times
UNION defined in line 324; used 2 times
UNKN defined in line 384; used 30 times
UNSIGN defined in line 323; used 18 times
WDATA defined in line 390; never used
WHILE defined in line 360; used 2 times
XTYPE defined in line 330; used 19 times
XX defined in line 436; used 4 times

Usage of this include

Last modified: 1981-09-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2686
Valid CSS Valid XHTML 1.0 Strict