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