mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-24 00:44:23 +00:00
154 lines
4.5 KiB
Plaintext
154 lines
4.5 KiB
Plaintext
1File: PREPROC.H Page 1
|
|
1 /*
|
|
2 Copyright 1982
|
|
3 Alcyon Corporation
|
|
4 8716 Production Ave.
|
|
5 San Diego, Ca. 92121
|
|
6 */
|
|
7 #include <stdio.h>
|
|
8 #include <klib.h>
|
|
9 #include "icode.h"
|
|
10 #include "machine.h"
|
|
11 /*cexpr operators*/
|
|
12 #define EOF 0
|
|
13 #define SUB 1
|
|
14 #define ADD 2
|
|
15 #define NOT 3
|
|
16 #define NEG 4
|
|
17 #define LPAREN 5
|
|
18 #define RPAREN 6
|
|
19 #define QMARK 7
|
|
20 #define COLON 8
|
|
21 #define OR 9
|
|
22 #define AND 10
|
|
23 #define XOR 11
|
|
24 #define EQUAL 12
|
|
25 #define NEQUAL 13
|
|
26 #define LESS 14
|
|
27 #define LSEQUAL 15
|
|
28 #define GREAT 16
|
|
29 #define GREQUAL 17
|
|
30 #define LSHIFT 18
|
|
31 #define RSHIFT 19
|
|
32 #define MULT 20
|
|
33 #define DIV 21
|
|
34 #define MOD 22
|
|
35 #define COMPL 23
|
|
36 #define CONST 24
|
|
37 #define LASTOP COMPL /*up to here used by cexpr*/
|
|
38 #define SQUOTE 25
|
|
39 #define DQUOTE 26
|
|
40 #define ANYC 27
|
|
41 #define BADC 28
|
|
42 #define COMMA 29
|
|
43 #define NEWL 30
|
|
44 #define POUND 31
|
|
45 #define ALPHA 32
|
|
46 #define DIGIT 33
|
|
47 #define BSLASH 34
|
|
48 #define WHITE 35
|
|
49 #define BUFSIZE 512
|
|
50 #define LINESIZE 512
|
|
51 #define ARG -1
|
|
52 #define NEWLABEL -2
|
|
53 #define LABEL -3
|
|
54 #define NOARGS -4
|
|
55 #define MAXARGS 60
|
|
56 #define ARGBSIZE 1000
|
|
57 #define TOKSIZE 300 /*BUG 4/20/82 was 128*/
|
|
58 #define DEFSIZE 1024
|
|
59 #define PBSIZE 1000
|
|
1File: PREPROC.H Page 2
|
|
60 #define DEFINE 1
|
|
61 #define UNDEF 2
|
|
62 #define INCLUDE 3
|
|
63 #define IFDEF 4
|
|
64 #define IFNDEF 5
|
|
65 #define ELSE 6
|
|
66 #define ENDIF 7
|
|
67 #define IF 8
|
|
68 #define SKIP 0
|
|
69 #define NOSKIP 1
|
|
70 #define SOH '\01'
|
|
71 #define SSIZE 8
|
|
72 #define HSIZE 517 /* 3.4 made prime */
|
|
73 #define FSTACK 10
|
|
74
|
|
75 #define TRUE 1
|
|
76 #define FALSE 0
|
|
77 #define NDEFS 20
|
|
78
|
|
79 struct symbol {
|
|
80 char s_name[SSIZE];
|
|
81 char *s_def;
|
|
82 } symtab[HSIZE];
|
|
83
|
|
84 /*buffered I/O structure*/
|
|
85 struct ibuf {
|
|
86 int fd;
|
|
87 int nc;
|
|
88 char *bp;
|
|
89 char buffer[BUFSIZE];
|
|
90 } outbuf;
|
|
91
|
|
92 /* command line define structure */
|
|
93 struct defstruc {
|
|
94 char *ptr;
|
|
95 char *value;
|
|
96 } defs[NDEFS];
|
|
97
|
|
98 struct stackstruc { /* [vlh] */
|
|
99 int ifd;
|
|
100 char ifile[13];
|
|
101 int lineno;
|
|
102 struct ibuf inbuf;
|
|
103 } filestack[FSTACK], *filep; /* stack of incl files, ptr to... */
|
|
104
|
|
105 #ifdef BULLSHIT /* Bullshit, bullshit, bullshit!!!*/
|
|
106 #ifdef VERSADOS
|
|
107 #define NONEST 1
|
|
108 #define NOFORKS 1
|
|
109 #endif
|
|
110
|
|
111 #ifdef VMS
|
|
112 #define NONEST 1
|
|
113 #endif
|
|
114
|
|
115 #ifdef NONEST
|
|
116 struct ibuf holdbuf; /* alternate buffer, hold main file info */
|
|
117 #endif
|
|
118 #endif
|
|
1File: PREPROC.H Page 3
|
|
119
|
|
120 int mfail; /*macro error flag*/
|
|
121 int skip; /*skipping current line*/
|
|
122 char *defap; /*pointer to available define area*/
|
|
123 char *defp; /*pointer to next avail define byte*/
|
|
124 int defcount; /*bytes left in define area*/
|
|
125 int defused; /*number of bytes used in define area*/
|
|
126 int defmax; /*maximum define area used*/
|
|
127 int pflag;
|
|
128 int asflag;
|
|
129
|
|
130 /*line to output after macro substitution*/
|
|
131 char line[LINESIZE+2]; /*line buffer*/
|
|
132 char *linep; /*current line pointer*/
|
|
133 int loverflow; /*line overflow flag*/
|
|
134 int lineno;
|
|
135
|
|
136 /*push back buffer*/
|
|
137 char pbbuf[PBSIZE]; /*push back buffer*/
|
|
138 char *pbp; /*push back pointer*/
|
|
139 int pbflag; /*checks for recursive definition*/
|
|
140
|
|
141 char null[]; /*used for undef'd symbols*/
|
|
142
|
|
143 char *lookup();
|
|
144 #ifdef BULLSHIT
|
|
145 char *maketemp();
|
|
146 char *setend();
|
|
147 char *makecopy();
|
|
148 #endif
|
|
149 char *sbrk();
|
|
150 struct symbol *getsp();
|