|
|
1.1 root 1: /*
2: * QED
3: */
4: #define VAX VAX
5: #ifdef VAX
6: #define BIGTMP LOTSOFBITS
7: #endif
8: /* Fake setexit & reset from v6 using setjmp and longjmp */
9: #include <setjmp.h>
10: jmp_buf env;
11: #define setexit() setjmp(env)
12: #define reset() longjmp(env, 0)
13: #define TRUE 1
14: #define FALSE 0
15: #define LBSIZE 512
16: #define RHSIZE (LBSIZE/4) /* ed says /2; but that's unreasonable! */
17: #define NBRA 9
18: #define EOF (-1)
19: #define FILERR 0200
20: #define SAVENEVER 0
21: #define SAVEIFFIRST 1
22: #define SAVEALWAYS 2
23: /*
24: * Stack types. Must appear in the order as in cspec[]/getchar.
25: * XTTY, GLOB and BRWS are special types with no corresponding special character.
26: * Special is never used directly - it is just used in tracing
27: * pushinp()/getchar.c can be called with a negative index for cspec[]
28: */
29: char special[]; /* "xgBbBcfFlprzN\"\\'" */
30: #define cspec (special + 3)
31: #define XTTY 0175
32: #define GLOB 0176
33: #define BRWS 0177
34: #define BUF 0
35: #define CURBN 1
36: #define QUOTE 2
37: #define FILEN 3
38: #define BFILEN 4
39: #define TTY 5
40: #define PAT 6
41: #define RHS 7
42: #define STRING 8
43: #define NEWL 9
44: #define NOTHING 10
45: #define BACKSLASH 11
46: #define LITERAL 12
47: /*
48: * Getchar-linked macros
49: */
50: #define ungetchar(c) (peekc = (c))
51: #define nextchar() (peekc = getchar())
52: #define NBUFS 56
53: /*
54: * The buffer structure. All info associated with each buffer stored here
55: */
56: struct buffer{
57: int *zero;
58: int *dot;
59: int *dol;
60: char cflag;
61: char gmark;
62: }buffer[NBUFS];
63: struct buffer *curbuf;
64: /*
65: * The string structure
66: * The first NBUFS strings are the registers
67: * The next NBUFS are the file names
68: * The next two are the saved pattern and saved right hand side
69: * The next is the special register for browsing (the `ob' command)
70: * The next is a file buffer.
71: * Strings are stored in the `strarea' area and garbage collected
72: * when the area is full. The NSTRCHARS parameter can be increased
73: * if you've got lots of core.
74: * The first two characters of `strarea' form the null string.
75: * The third and subsequent characters are the storage for non null
76: * strings.
77: * The null string has to be stored in this area so that
78: * the R and S commands write out valid pointers to the null string.
79: * The last entry in the string structure is used to store the pointer
80: * to the next free position.
81: * In string.c strfree is defined as "string[NSTRING].str".
82: */
83: #define NSTRING (NBUFS+NBUFS+4)
84: #define COUNT (26+'C'-'A')
85: #define TRUTH (26+'T'-'A')
86: #define UNIX (26+'U'-'A')
87: #define FILE(z) (NBUFS+(z))
88: #define SAVPAT (NBUFS+NBUFS)
89: #define SAVRHS (SAVPAT+1)
90: #define BROWSE (SAVRHS+1)
91: #define FILEBUF (BROWSE+1)
92: struct string{
93: int len;
94: char *str;
95: }string[NSTRING+1];
96: #define NSTRCHARS 1024
97: char strarea[NSTRCHARS + 2];
98: #define nullstr strarea
99: #define strchars (&strarea[2])
100: #define STACKSIZE 16
101: /*
102: * The getchar stack.
103: */
104: struct stack{
105: char type;
106: char literal;
107: union{
108: struct buffer *u1bufptr;
109: char *u1globp;
110: }u1;
111: union{
112: int u2lineno;
113: int u2strname;
114: }u2;
115: int charno;
116: }stack[STACKSIZE];
117: #define bufptr u1.u1bufptr
118: #define globp u1.u1globp
119: #define lineno u2.u2lineno
120: #define strname u2.u2strname
121: struct stack *stackp;
122: int peekc;
123: int lastc;
124: char line[70];
125: char *linp;
126: int savedfile;
127: char linebuf[LBSIZE];
128: int *zero;
129: int *dot;
130: int *dol;
131: int *lastdol;
132: int *endcore;
133: int *fendcore;
134: int *addr1;
135: int *addr2;
136: char genbuf[LBSIZE];
137: char *linebp;
138: #include "sgtty.h"
139: struct sgttyb ttybuf;
140: int ninbuf;
141: int io;
142: int onhup;
143: int onquit;
144: int onintr;
145: char lasterr;
146: #define PAGESIZE 22
147: extern pagesize;
148: extern char bformat; /* = 'p' */
149: int appflag;
150: int cflag;
151: int cprflag;
152: int dflag;
153: int eflag;
154: int gflag;
155: int biggflag;
156: int iflag;
157: int prflag;
158: int tflag;
159: int uflag;
160: int vflag;
161: int qok;
162: int eok;
163: int initflag;
164: int nestlevel;
165: int lastttyc;
166: int listf;
167: int tfile;
168: int tfile2;
169: char *tfname;
170: char *loc1;
171: char *loc2;
172: int names[NBUFS];
173: char *braslist[NBRA];
174: char *braelist[NBRA];
175: int nbra;
176: int oneline;
177: int lock;
178: char bname[]; /* ="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~" */
179: char lchars[]; /* = "pPlL" */
180: int bbempty; /* whether getc's internal buffer buffer needs reloading */
181: char *getline();
182: int *address();
183: char *getenv();
184: long lseek();
185: char *sbrk();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.