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