fix shutdown bug in last delta; revoke console so single() doesn't fail;
[unix-history] / usr / src / old / sh / mode.h
CommitLineData
3cc4dafe 1/* mode.h 4.2 88/04/24 */
4dd5bba2
KM
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;
3cc4dafe 31UNION trenod *TREPTR;
4dd5bba2
KM
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 */
3cc4dafe
KB
57/* union { int _cheat;}; */
58/* #define Lcheat(a) ((a)._cheat) */
59#define Lcheat(a) (*(int *)&(a))
60#define Rcheat(a) ( (int ) (a))
4dd5bba2
KM
61
62
63/* address puns for storage allocation */
64UNION {
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/*
80struct void {INT vvvvvvvv;};
81*/
82
83
84/* heap storage */
85struct blk {
86 BLKPTR word;
87};
88
89#define BUFSIZ 64
90struct 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 */
103struct 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
115struct sysnod {
116 STRING sysnam;
117 INT sysval;
118};
119
4dd5bba2
KM
120/* dummy for access only */
121struct argnod {
122 ARGPTR argnxt;
123 CHAR argval[1];
124};
125
126struct dolnod {
127 DOLPTR dolnxt;
128 INT doluse;
129 CHAR dolarg[1];
130};
131
132struct forknod {
133 INT forktyp;
134 IOPTR forkio;
135 TREPTR forktre;
136};
137
138struct comnod {
139 INT comtyp;
140 IOPTR comio;
141 ARGPTR comarg;
142 ARGPTR comset;
143};
144
145struct ifnod {
146 INT iftyp;
147 TREPTR iftre;
148 TREPTR thtre;
149 TREPTR eltre;
150};
151
152struct whnod {
153 INT whtyp;
154 TREPTR whtre;
155 TREPTR dotre;
156};
157
158struct fornod {
159 INT fortyp;
160 TREPTR fortre;
161 STRING fornam;
162 COMPTR forlst;
163};
164
165struct swnod {
166 INT swtyp;
167 STRING swarg;
168 REGPTR swlst;
169};
170
171struct regnod {
172 ARGPTR regptr;
173 TREPTR regcom;
174 REGPTR regnxt;
175};
176
177struct parnod {
178 INT partyp;
179 TREPTR partre;
180};
181
182struct lstnod {
183 INT lsttyp;
184 TREPTR lstlef;
185 TREPTR lstrit;
186};
187
188struct 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))
3cc4dafe
KB
205
206/* this node is a proforma for those that precede it */
207union 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};