home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / source / c / c0h.c < prev    next >
Encoding:
C/C++ Source or Header  |  1975-07-18  |  4.7 KB  |  352 lines

  1. #
  2. /*
  3.  
  4.     C compiler-- pass 1 header
  5.  
  6.  
  7. */
  8.  
  9. /*
  10.   parameters
  11. */
  12.  
  13. #define    ncps    8
  14. #define    hshsiz    200
  15. #define    cmsiz    40
  16. #define    swsiz    200
  17. #define    OSSIZ    500
  18. #define    dimsiz    100
  19. #define    NBPW    16
  20. #define    NBPC    8
  21. #define    NCPW    2
  22. #define    STRSIZ    256
  23.  
  24. struct tnode {
  25.     int    op;
  26.     int    type;
  27.     int    dimp;
  28.     struct    tnode *tr1, *tr2;
  29. };
  30.  
  31. struct {
  32.     int    op;
  33.     int    type;
  34.     char    ssp;        /* subscript list */
  35.     char    lenp;        /* structure length */
  36. };
  37.  
  38. struct tname {
  39.     int    op;
  40.     int    type;
  41.     int    dimp;
  42.     int    class;
  43.     int    offset;
  44.     int    nloc;
  45. };
  46.  
  47. struct txname {
  48.     int    op;
  49.     int    type;
  50.     int    dimp;
  51.     int    class;
  52.     int    offset;
  53.     char    nname[ncps];
  54. };
  55.  
  56. struct tconst {
  57.     int    op;
  58.     int    type;
  59.     int    dimp;
  60.     int    value;
  61. };
  62.  
  63. struct hshtab {
  64.     char    hclass;
  65.     char    hflag;
  66.     int    htype;
  67.     int    hdimp;
  68.     int    hoffset;
  69.     char    name[ncps];
  70. };
  71.  
  72. struct {
  73.     char    hclass;
  74.     char    hflag;
  75.     int    htype;
  76.     char    flen;        /* Field length */
  77.     char    bitoffs;    /* Offset of field */
  78. };
  79.  
  80. struct swtab {
  81.     int    swlab;
  82.     int    swval;
  83. };
  84.  
  85. struct    bnode {
  86.     int    bop;
  87.     struct    tnode *btree;
  88.     int    lbl;
  89.     int    cond;
  90. };
  91.  
  92. char    cvtab[4][4];
  93. char    savstr[STRSIZ];
  94. char    *strptr;
  95. int    opdope[];
  96. char    ctab[];
  97. char    symbuf[ncps+2];
  98. int    hshused;
  99. struct    hshtab    hshtab[hshsiz];
  100. int    *space;
  101. int    *cp;
  102. int    cmst[cmsiz];
  103. int    isn;
  104. struct    swtab    swtab[swsiz];
  105. struct    swtab    *swp;
  106. int    contlab;
  107. int    brklab;
  108. int    retlab;
  109. int    deflab;
  110. int    nauto;
  111. int    autolen;
  112. int    peeksym;
  113. int    peekc;
  114. int    eof;
  115. int    line;
  116. int    osspace[OSSIZ];
  117. int    *treespace;
  118. struct    hshtab    *defsym;
  119. struct    hshtab    *funcsym;
  120. int    xdflg;
  121. int    proflg;
  122. int    stflg;
  123. struct    hshtab    *csym;
  124. int    cval;
  125. double    fcval;
  126. int    nchstr;
  127. int    nerror;
  128. struct    hshtab    *paraml;
  129. struct    hshtab    *parame;
  130. int    strflg;
  131. int    mosflg;
  132. int    initflg;
  133. int    inhdr;
  134. int    dimtab[dimsiz];
  135. char    obuf[518];
  136. char    sbuf[518];
  137. int    dimp;
  138. int    regvar;
  139. int    bitoffs;
  140. struct    tname    funcblk;
  141.  
  142. /*
  143.   operators
  144. */
  145. #define    EOF    0
  146. #define    SEMI    1
  147. #define    LBRACE    2
  148. #define    RBRACE    3
  149. #define    LBRACK    4
  150. #define    RBRACK    5
  151. #define    LPARN    6
  152. #define    RPARN    7
  153. #define    COLON    8
  154. #define    COMMA    9
  155. #define    FSEL    10
  156.  
  157. #define    KEYW    19
  158. #define    NAME    20
  159. #define    CON    21
  160. #define    STRING    22
  161. #define    FCON    23
  162. #define    SFCON    24
  163.  
  164. #define    SIZEOF    91
  165. #define    INCBEF    30
  166. #define    DECBEF    31
  167. #define    INCAFT    32
  168. #define    DECAFT    33
  169. #define    EXCLA    34
  170. #define    AMPER    35
  171. #define    STAR    36
  172. #define    NEG    37
  173. #define    COMPL    38
  174.  
  175. #define    DOT    39
  176. #define    PLUS    40
  177. #define    MINUS    41
  178. #define    TIMES    42
  179. #define    DIVIDE    43
  180. #define    MOD    44
  181. #define    RSHIFT    45
  182. #define    LSHIFT    46
  183. #define    AND    47
  184. #define    OR    48
  185. #define    EXOR    49
  186. #define    ARROW    50
  187. #define    ITOF    51
  188. #define    FTOI    52
  189. #define    LOGAND    53
  190. #define    LOGOR    54
  191. #define    FTOL    56
  192. #define    LTOF    57
  193. #define    ITOL    58
  194. #define    LTOI    59
  195.  
  196. #define    EQUAL    60
  197. #define    NEQUAL    61
  198. #define    LESSEQ    62
  199. #define    LESS    63
  200. #define    GREATEQ    64
  201. #define    GREAT    65
  202. #define    LESSEQP    66
  203. #define    LESSP    67
  204. #define    GREATQP    68
  205. #define    GREATP    69
  206.  
  207. #define    ASPLUS    70
  208. #define    ASMINUS    71
  209. #define    ASTIMES    72
  210. #define    ASDIV    73
  211. #define    ASMOD    74
  212. #define    ASRSH    75
  213. #define    ASLSH    76
  214. #define    ASSAND    77
  215. #define    ASOR    78
  216. #define    ASXOR    79
  217. #define    ASSIGN    80
  218.  
  219. #define    QUEST    90
  220. #define    CALL    100
  221. #define    MCALL    101
  222. #define    JUMP    102
  223. #define    CBRANCH    103
  224. #define    INIT    104
  225. #define    SETREG    105
  226. #define    RFORCE    110
  227. #define    BRANCH    111
  228. #define    LABEL    112
  229. #define    NLABEL    113
  230. #define    RLABEL    114
  231.  
  232. /*
  233.   types
  234. */
  235. #define    INT    0
  236. #define    CHAR    1
  237. #define    FLOAT    2
  238. #define    DOUBLE    3
  239. #define    STRUCT    4
  240. #define    RSTRUCT    5
  241. #define    LONG    6
  242. #define    NOTYPE    7    /* used internally */
  243.  
  244. #define    ALIGN    01
  245. #define    TYPE    07
  246. #define    TYLEN    2
  247. #define    XTYPE    (03<<3)
  248. #define    PTR    010
  249. #define    FUNC    020
  250. #define    ARRAY    030
  251.  
  252. /*
  253.   storage classes
  254. */
  255. #define    KEYWC    1
  256. #define    MOS    10
  257. #define    AUTO    11
  258. #define    EXTERN    12
  259. #define    STATIC    13
  260. #define    REG    14
  261. #define    STRTAG    15
  262. #define ARG    16
  263. #define    ARG1    17
  264. #define    FMOS    18
  265.  
  266. /*
  267.   keywords
  268. */
  269. #define    GOTO    20
  270. #define    RETURN    21
  271. #define    IF    22
  272. #define    WHILE    23
  273. #define    ELSE    24
  274. #define    SWITCH    25
  275. #define    CASE    26
  276. #define    BREAK    27
  277. #define    CONTIN    28
  278. #define    DO    29
  279. #define    DEFAULT    30
  280. #define    FOR    31
  281.  
  282. /*
  283.   characters
  284. */
  285. #define    INSERT    119
  286. #define    PERIOD    120
  287. #define    SQUOTE    121
  288. #define    DQUOTE    122
  289. #define    LETTER    123
  290. #define    DIGIT    124
  291. #define    NEWLN    125
  292. #define    SPACE    126
  293. #define    UNKN    127
  294.  
  295. /*
  296.  * Special operators in intermediate code
  297.  */
  298. #define    BDATA    200
  299. #define    WDATA    201
  300. #define    PROG    202
  301. #define    DATA    203
  302. #define    BSS    204
  303. #define    CSPACE    205
  304. #define    SSPACE    206
  305. #define    SYMDEF    207
  306. #define    SAVE    208
  307. #define    RETRN    209
  308. #define    EVEN    210
  309. #define    PROFIL    212
  310. #define    SWIT    213
  311. #define    EXPR    214
  312. #define    SNAME    215
  313. #define    RNAME    216
  314. #define    ANAME    217
  315. #define    NULL    218
  316.  
  317. /*
  318.   Flag bits
  319. */
  320.  
  321. #define    BINARY    01
  322. #define    LVALUE    02
  323. #define    RELAT    04
  324. #define    ASSGOP    010
  325. #define    LWORD    020
  326. #define    RWORD    040
  327. #define    COMMUTE    0100
  328. #define    RASSOC    0200
  329. #define    LEAF    0400
  330.  
  331. /*
  332.  * Conversion codes
  333.  */
  334. #define    ITF    1
  335. #define    ITL    2
  336. #define    LTF    3
  337. #define    ITP    4
  338. #define    PTI    5
  339. #define    FTI    6
  340. #define    LTI    7
  341. #define    FTL    8
  342. #define    XX    15
  343.  
  344. /*
  345.  * symbol table flags
  346.  */
  347.  
  348. #define    FNDEL    01
  349. #define    FNUND    02
  350. #define    FKEYW    04
  351. #define    FFIELD    020
  352.