blob: ac4481bd89f99bb6d65669e897675d3a377e75ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
#
/*
* sed -- stream editor
*
*
*/
#define CBRA 1
#define CCHR 2
#define CDOT 4
#define CCL 6
#define CNL 8
#define CDOL 10
#define CEOF 11
#define CKET 12
#define CNULL 13
#define CLNUM 14
#define CEND 16
#define CDONT 17
#define CBACK 18
#define STAR 01
#define NLINES 256
#define DEPTH 20
#define PTRSIZE 1024
#define RESIZE 20000
#define ABUFSIZE 20
#define LBSIZE 4000
#define LABSIZE 50
#define NBRA 9
typedef unsigned char uchar;
FILE *fin;
union reptr *abuf[ABUFSIZE];
union reptr **aptr;
uchar *lastre;
uchar ibuf[512];
uchar *cbp;
uchar *ebp;
uchar genbuf[LBSIZE];
uchar *loc1;
uchar *loc2;
uchar *locs;
uchar seof;
uchar *reend;
uchar *lbend;
uchar *hend;
uchar *lcomend;
union reptr *ptrend;
int eflag;
int dolflag;
int sflag;
int jflag;
int numbra;
int delflag;
long lnum;
uchar linebuf[LBSIZE+1];
uchar holdsp[LBSIZE+1];
uchar *spend;
uchar *hspend;
int nflag;
int gflag;
uchar *braelist[NBRA];
uchar *braslist[NBRA];
long tlno[NLINES];
int nlno;
#define MAXFILES 120
char fname[MAXFILES][40];
FILE *fcode[MAXFILES];
int nfiles;
#define ACOM 01
#define BCOM 020
#define CCOM 02
#define CDCOM 025
#define CNCOM 022
#define COCOM 017
#define CPCOM 023
#define DCOM 03
#define ECOM 015
#define EQCOM 013
#define FCOM 016
#define GCOM 027
#define CGCOM 030
#define HCOM 031
#define CHCOM 032
#define ICOM 04
#define LCOM 05
#define NCOM 012
#define PCOM 010
#define QCOM 011
#define RCOM 06
#define SCOM 07
#define TCOM 021
#define WCOM 014
#define CWCOM 024
#define YCOM 026
#define XCOM 033
uchar *cp;
uchar *reend;
uchar *lbend;
union reptr {
struct reptr1 {
uchar *ad1;
uchar *ad2;
uchar *re1;
uchar *rhs;
FILE *fcode;
uchar command;
uchar gfl;
uchar pfl;
uchar inar;
uchar negfl;
} r1;
struct reptr2 {
uchar *ad1;
uchar *ad2;
union reptr *lb1;
uchar *rhs;
FILE *fcode;
uchar command;
uchar gfl;
uchar pfl;
uchar inar;
uchar negfl;
} r2;
} ptrspace[PTRSIZE], *rep;
uchar respace[RESIZE];
struct label {
uchar asc[9];
union reptr *chain;
union reptr *address;
} ltab[LABSIZE];
struct label *lab;
struct label *labend;
int f;
int depth;
int eargc;
uchar **eargv;
uchar *address(uchar *);
int advance(uchar *, uchar *);
void arout(void);
extern uchar bittab[];
uchar bad;
uchar *badp;
int cmp(uchar *, uchar *);
union reptr **cmpend[DEPTH];
void command(union reptr *);
uchar compfl;
uchar *compile(uchar *);
uchar *compsub(uchar *);
void dechain(void);
int depth;
void dosub(uchar *);
int ecmp(uchar *, uchar *, int);
void execute(uchar *);
void fcomp(void);
uchar *gline(uchar *);
uchar *lformat(int, uchar *);
int match(uchar *, int);
union reptr *pending;
uchar *place(uchar *, uchar *, uchar *);
int rline(uchar *);
struct label *search(struct label *);
int substitute(union reptr *);
uchar *text(uchar *);
uchar *ycomp(uchar *);
|