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