|
|
1.1 root 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 512
27: #define RESIZE 10000
28: #define ABUFSIZE 20
29: #define LBSIZE 4000
30: #define LABSIZE 50
31: #define NBRA 9
32:
33: FILE *fin;
34: union reptr *abuf[ABUFSIZE];
35: union reptr **aptr;
36: char *lastre;
37: char ibuf[512];
38: char *cbp;
39: char *ebp;
40: char genbuf[LBSIZE];
41: char *loc1;
42: char *loc2;
43: char *locs;
44: char seof;
45: char *reend;
46: char *lbend;
47: char *hend;
48: char *lcomend;
49: union reptr *ptrend;
50: int eflag;
51: int dolflag;
52: int sflag;
53: int jflag;
54: int numbra;
55: int delflag;
56: long lnum;
57: char linebuf[LBSIZE+1];
58: char holdsp[LBSIZE+1];
59: char *spend;
60: char *hspend;
61: int nflag;
62: int gflag;
63: char *braelist[NBRA];
64: char *braslist[NBRA];
65: long tlno[NLINES];
66: int nlno;
67: #define MAXFILES 120
68: char fname[MAXFILES][40];
69: FILE *fcode[MAXFILES];
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: } r1;
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: } r2;
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;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.