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