8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sh / mode.h
blob2f9e3aa6ecc7815ae1c38ee6286758685cc74441
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
26 /* All Rights Reserved */
28 #ifndef _MODE_H
29 #define _MODE_H
32 * UNIX shell
35 #include <unistd.h>
37 #ifdef pdp11
38 typedef char BOOL;
39 #else
40 typedef short BOOL;
41 #endif
43 #define BYTESPERWORD (sizeof (char *))
44 #define ALIGNSIZ (sizeof (double))
45 #define NIL ((char *)0)
49 * the following nonsense is required
50 * because casts turn an Lvalue
51 * into an Rvalue so two cheats
52 * are necessary, one for each context.
54 #define Rcheat(a) ((int)(a))
57 /* address puns for storage allocation */
58 typedef union
60 struct forknod *_forkptr;
61 struct comnod *_comptr;
62 struct fndnod *_fndptr;
63 struct parnod *_parptr;
64 struct ifnod *_ifptr;
65 struct whnod *_whptr;
66 struct fornod *_forptr;
67 struct lstnod *_lstptr;
68 struct blk *_blkptr;
69 struct namnod *_namptr;
70 char *_bytptr;
71 } address;
74 /* heap storage */
75 struct blk
77 struct blk *word;
78 char pad[ALIGNSIZ - sizeof (struct blk *)];
82 * largefile converson hack note.
83 * the shell uses the *fnxt and *fend pointers when
84 * parsing a script. However, it was also using the
85 * difference between them when doing lseeks. Because
86 * that doesn't work in the largefile world, I have
87 * added a parallel set of offset counters that need to
88 * be updated whenever the "buffer" offsets the shell
89 * uses get changed. Most of this code is in word.c.
90 * If you change it, have fun...
93 #define BUFFERSIZE 128
94 struct fileblk
96 int fdes;
97 unsigned flin;
98 BOOL feof;
99 unsigned char fsiz;
100 unsigned char *fnxt;
101 unsigned char *fend;
102 off_t nxtoff; /* file offset */
103 off_t endoff; /* file offset */
104 unsigned char **feval;
105 struct fileblk *fstak;
106 unsigned char fbuf[BUFFERSIZE];
109 struct tempblk
111 int fdes;
112 struct tempblk *fstak;
116 /* for files not used with file descriptors */
117 struct filehdr
119 int fdes;
120 unsigned flin;
121 BOOL feof;
122 unsigned char fsiz;
123 unsigned char *fnxt;
124 unsigned char *fend;
125 off_t nxtoff; /* file offset */
126 off_t endoff; /* file offset */
127 unsigned char **feval;
128 struct fileblk *fstak;
129 unsigned char _fbuf[1];
132 struct sysnod
134 char *sysnam;
135 int sysval;
138 /* this node is a proforma for those that follow */
139 struct trenod
141 int tretyp;
142 struct ionod *treio;
145 /* dummy for access only */
146 struct argnod
148 struct argnod *argnxt;
149 unsigned char argval[1];
152 struct dolnod
154 struct dolnod *dolnxt;
155 int doluse;
156 unsigned char **dolarg;
159 struct forknod
161 int forktyp;
162 struct ionod *forkio;
163 struct trenod *forktre;
166 struct comnod
168 int comtyp;
169 struct ionod *comio;
170 struct argnod *comarg;
171 struct argnod *comset;
174 struct fndnod
176 int fndtyp;
177 unsigned char *fndnam;
178 struct trenod *fndval;
179 int fndref;
182 struct ifnod
184 int iftyp;
185 struct trenod *iftre;
186 struct trenod *thtre;
187 struct trenod *eltre;
190 struct whnod
192 int whtyp;
193 struct trenod *whtre;
194 struct trenod *dotre;
197 struct fornod
199 int fortyp;
200 struct trenod *fortre;
201 unsigned char *fornam;
202 struct comnod *forlst;
205 struct swnod
207 int swtyp;
208 unsigned char *swarg;
209 struct regnod *swlst;
212 struct regnod
214 struct argnod *regptr;
215 struct trenod *regcom;
216 struct regnod *regnxt;
219 struct parnod
221 int partyp;
222 struct trenod *partre;
225 struct lstnod
227 int lsttyp;
228 struct trenod *lstlef;
229 struct trenod *lstrit;
232 struct ionod
234 int iofile;
235 char *ioname;
236 char *iolink;
237 struct ionod *ionxt;
238 struct ionod *iolst;
241 struct fdsave
243 int org_fd;
244 int dup_fd;
248 #define fndptr(x) ((struct fndnod *)x)
249 #define comptr(x) ((struct comnod *)x)
250 #define forkptr(x) ((struct forknod *)x)
251 #define parptr(x) ((struct parnod *)x)
252 #define lstptr(x) ((struct lstnod *)x)
253 #define forptr(x) ((struct fornod *)x)
254 #define whptr(x) ((struct whnod *)x)
255 #define ifptr(x) ((struct ifnod *)x)
256 #define swptr(x) ((struct swnod *)x)
258 #endif /* _MODE_H */