|
|
1.1 root 1: /* mode.h 4.2 88/04/24 */
2:
3: #
4: /*
5: * UNIX shell
6: */
7:
8:
9: #define BYTESPERWORD (sizeof(char *))
10:
11: TYPE char CHAR;
12: TYPE char BOOL;
13: TYPE int UFD;
14: TYPE int INT;
15: TYPE float REAL;
16: TYPE char *ADDRESS;
17: TYPE long int L_INT;
18: TYPE int VOID;
19: TYPE unsigned POS;
20: TYPE char *STRING;
21: TYPE char MSG[];
22: TYPE int PIPE[];
23: TYPE char *STKPTR;
24: TYPE char *BYTPTR;
25:
26: STRUCT stat STATBUF; /* defined in /usr/sys/stat.h */
27: STRUCT blk *BLKPTR;
28: STRUCT fileblk FILEBLK;
29: STRUCT filehdr FILEHDR;
30: STRUCT fileblk *FILE;
31: UNION trenod *TREPTR;
32: STRUCT forknod *FORKPTR;
33: STRUCT comnod *COMPTR;
34: STRUCT swnod *SWPTR;
35: STRUCT regnod *REGPTR;
36: STRUCT parnod *PARPTR;
37: STRUCT ifnod *IFPTR;
38: STRUCT whnod *WHPTR;
39: STRUCT fornod *FORPTR;
40: STRUCT lstnod *LSTPTR;
41: STRUCT argnod *ARGPTR;
42: STRUCT dolnod *DOLPTR;
43: STRUCT ionod *IOPTR;
44: STRUCT namnod NAMNOD;
45: STRUCT namnod *NAMPTR;
46: STRUCT sysnod SYSNOD;
47: STRUCT sysnod *SYSPTR;
48: STRUCT sysnod SYSTAB[];
49: #define NIL ((char*)0)
50:
51:
52: /* the following nonsense is required
53: * because casts turn an Lvalue
54: * into an Rvalue so two cheats
55: * are necessary, one for each context.
56: */
57: /* union { int _cheat;}; */
58: /* #define Lcheat(a) ((a)._cheat) */
59: #define Lcheat(a) (*(int *)&(a))
60: #define Rcheat(a) ( (int ) (a))
61:
62:
63: /* address puns for storage allocation */
64: UNION {
65: FORKPTR _forkptr;
66: COMPTR _comptr;
67: PARPTR _parptr;
68: IFPTR _ifptr;
69: WHPTR _whptr;
70: FORPTR _forptr;
71: LSTPTR _lstptr;
72: BLKPTR _blkptr;
73: NAMPTR _namptr;
74: BYTPTR _bytptr;
75: } address;
76:
77:
78: /* for functions that do not return values */
79: /*
80: struct void {INT vvvvvvvv;};
81: */
82:
83:
84: /* heap storage */
85: struct blk {
86: BLKPTR word;
87: };
88:
89: #define BUFSIZ 64
90: struct fileblk {
91: UFD fdes;
92: POS flin;
93: BOOL feof;
94: CHAR fsiz;
95: STRING fnxt;
96: STRING fend;
97: STRING *feval;
98: FILE fstak;
99: CHAR fbuf[BUFSIZ];
100: };
101:
102: /* for files not used with file descriptors */
103: struct filehdr {
104: UFD fdes;
105: POS flin;
106: BOOL feof;
107: CHAR fsiz;
108: STRING fnxt;
109: STRING fend;
110: STRING *feval;
111: FILE fstak;
112: CHAR _fbuf[1];
113: };
114:
115: struct sysnod {
116: STRING sysnam;
117: INT sysval;
118: };
119:
120: /* dummy for access only */
121: struct argnod {
122: ARGPTR argnxt;
123: CHAR argval[1];
124: };
125:
126: struct dolnod {
127: DOLPTR dolnxt;
128: INT doluse;
129: CHAR dolarg[1];
130: };
131:
132: struct forknod {
133: INT forktyp;
134: IOPTR forkio;
135: TREPTR forktre;
136: };
137:
138: struct comnod {
139: INT comtyp;
140: IOPTR comio;
141: ARGPTR comarg;
142: ARGPTR comset;
143: };
144:
145: struct ifnod {
146: INT iftyp;
147: TREPTR iftre;
148: TREPTR thtre;
149: TREPTR eltre;
150: };
151:
152: struct whnod {
153: INT whtyp;
154: TREPTR whtre;
155: TREPTR dotre;
156: };
157:
158: struct fornod {
159: INT fortyp;
160: TREPTR fortre;
161: STRING fornam;
162: COMPTR forlst;
163: };
164:
165: struct swnod {
166: INT swtyp;
167: STRING swarg;
168: REGPTR swlst;
169: };
170:
171: struct regnod {
172: ARGPTR regptr;
173: TREPTR regcom;
174: REGPTR regnxt;
175: };
176:
177: struct parnod {
178: INT partyp;
179: TREPTR partre;
180: };
181:
182: struct lstnod {
183: INT lsttyp;
184: TREPTR lstlef;
185: TREPTR lstrit;
186: };
187:
188: struct ionod {
189: INT iofile;
190: STRING ioname;
191: IOPTR ionxt;
192: IOPTR iolst;
193: };
194:
195: #define FORKTYPE (sizeof(struct forknod))
196: #define COMTYPE (sizeof(struct comnod))
197: #define IFTYPE (sizeof(struct ifnod))
198: #define WHTYPE (sizeof(struct whnod))
199: #define FORTYPE (sizeof(struct fornod))
200: #define SWTYPE (sizeof(struct swnod))
201: #define REGTYPE (sizeof(struct regnod))
202: #define PARTYPE (sizeof(struct parnod))
203: #define LSTTYPE (sizeof(struct lstnod))
204: #define IOTYPE (sizeof(struct ionod))
205:
206: /* this node is a proforma for those that precede it */
207: union trenod {
208: INT tretyp;
209: struct { INT dummyy; IOPTR treio;} treio;
210: struct forknod forknod;
211: struct comnod comnod;
212: struct ifnod ifnod;
213: struct whnod whnod;
214: struct fornod fornod;
215: struct swnod swnod;
216: struct lstnod lstnod;
217: struct parnod parnod;
218: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.