Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtksh / ksh93 / src / cmd / ksh93 / include / shnodes.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: shnodes.h /main/3 1995/11/01 16:43:01 rswiston $ */
24 /***************************************************************
25 *                                                              *
26 *                      AT&T - PROPRIETARY                      *
27 *                                                              *
28 *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF        *
29 *                    AT&T BELL LABORATORIES                    *
30 *         AND IS NOT TO BE DISCLOSED OR USED EXCEPT IN         *
31 *            ACCORDANCE WITH APPLICABLE AGREEMENTS             *
32 *                                                              *
33 *                Copyright (c) 1995 AT&T Corp.                 *
34 *              Unpublished & Not for Publication               *
35 *                     All Rights Reserved                      *
36 *                                                              *
37 *       The copyright notice above does not evidence any       *
38 *      actual or intended publication of such source code      *
39 *                                                              *
40 *               This software was created by the               *
41 *           Advanced Software Technology Department            *
42 *                    AT&T Bell Laboratories                    *
43 *                                                              *
44 *               For further information contact                *
45 *                    {research,attmail}!dgk                    *
46 *                                                              *
47 ***************************************************************/
48
49 /* : : generated by proto : : */
50                   
51 #ifndef _SHNODES_H
52 #if !defined(__PROTO__)
53 #if defined(__STDC__) || defined(__cplusplus) || defined(_proto) || defined(c_plusplus)
54 #if defined(__cplusplus)
55 #define __MANGLE__      "C"
56 #else
57 #define __MANGLE__
58 #endif
59 #define __STDARG__
60 #define __PROTO__(x)    x
61 #define __OTORP__(x)
62 #define __PARAM__(n,o)  n
63 #if !defined(__STDC__) && !defined(__cplusplus)
64 #if !defined(c_plusplus)
65 #define const
66 #endif
67 #define signed
68 #define void            int
69 #define volatile
70 #define __V_            char
71 #else
72 #define __V_            void
73 #endif
74 #else
75 #define __PROTO__(x)    ()
76 #define __OTORP__(x)    x
77 #define __PARAM__(n,o)  o
78 #define __MANGLE__
79 #define __V_            char
80 #define const
81 #define signed
82 #define void            int
83 #define volatile
84 #endif
85 #if defined(__cplusplus) || defined(c_plusplus)
86 #define __VARARG__      ...
87 #else
88 #define __VARARG__
89 #endif
90 #if defined(__STDARG__)
91 #define __VA_START__(p,a)       va_start(p,a)
92 #else
93 #define __VA_START__(p,a)       va_start(p)
94 #endif
95 #endif
96
97 #define _SHNODES_H      1
98 /*
99  *      UNIX shell
100  *      Written by David Korn
101  *
102  */
103
104
105 #include        <ast.h>
106 #include        "argnod.h"
107
108 /* command tree for tretyp */
109 #define FINT            (02<<COMBITS)           /* non-interruptable */
110 #define FAMP            (04<<COMBITS)           /* background */
111 #define FPIN            (010<<COMBITS)          /* input is a pipe */
112 #define FPOU            (040<<COMBITS)          /* output is a pipe */
113 #define FPCL            (0100<<COMBITS)         /* close the pipe */
114 #define FCOOP           (0200<<COMBITS)         /* cooperating process */
115 #define FPOSIX          (02<<COMBITS)           /* posix semantics function */
116
117 #define TNEGATE         (01<<COMBITS)           /* ! inside [[...]] */
118 #define TBINARY         (02<<COMBITS)           /* binary operator in [[...]] */
119 #define TUNARY          (04<<COMBITS)           /* unary operator in [[...]] */
120 #define TTEST           (010<<COMBITS)
121 #define TPAREN          (TBINARY|TUNARY)
122 #define TSHIFT          (COMBITS+4)
123
124 #define TCOM    0
125 #define TPAR    1
126 #define TFIL    2
127 #define TLST    3
128 #define TIF     4
129 #define TWH     5
130 #define TUN     (TWH|COMSCAN)
131 #define TTST    6
132 #define TSW     7
133 #define TAND    8
134 #define TORF    9
135 #define TFORK   10
136 #define TFOR    11
137 #define TSELECT (TFOR|COMSCAN)
138 #define TARITH  12
139 #define TTIME   13
140 #define TSETIO  14
141 #define TFUN    15
142
143 /* this node is a proforma for those that follow */
144
145 struct trenod
146 {
147         int             tretyp;
148         struct ionod    *treio;
149 };
150
151
152 struct forknod
153 {
154         int             forktyp;
155         struct ionod    *forkio;
156         union anynode   *forktre;
157         int             forkline;
158 };
159
160
161 struct ifnod
162 {
163         int             iftyp;
164         union anynode   *iftre;
165         union anynode   *thtre;
166         union anynode   *eltre;
167 };
168
169 struct whnod
170 {
171         int             whtyp;
172         union anynode   *whtre;
173         union anynode   *dotre;
174         struct arithnod *whinc;
175 };
176
177 struct fornod
178 {
179         int             fortyp;
180         union anynode   *fortre;
181         char     *fornam;
182         struct comnod   *forlst;
183 };
184
185 struct swnod
186 {
187         int             swtyp;
188         struct argnod   *swarg;
189         struct regnod   *swlst;
190 };
191
192 struct regnod
193 {
194         struct argnod   *regptr;
195         union anynode   *regcom;
196         struct regnod   *regnxt;
197         char            regflag;
198 };
199
200 struct parnod
201 {
202         int             partyp;
203         union anynode   *partre;
204 };
205
206 struct lstnod
207 {
208         int             lsttyp;
209         union anynode   *lstlef;
210         union anynode   *lstrit;
211 };
212
213 /* tst is same as lst, but with extra field for line number */
214 struct tstnod
215 {
216         struct lstnod   tstlst;
217         int             tstline;        
218 };
219
220 struct functnod
221 {
222         int             functtyp;
223         int             functline;
224         union anynode   *functtre;
225         char            *functnam;
226         off_t           functloc;
227         struct slnod    *functstak;
228         struct comnod   *functargs;
229 };
230
231 struct arithnod
232 {
233         int             artyp;
234         int             arline;
235         struct argnod   *arexpr;
236 };
237
238
239 /* types of ionodes stored in iofile  */
240 #define IOUFD   0x3f            /* file descriptor number mask */
241 #define IOPUT   0x40            /* > redirection operator */
242 #define IOAPP   0x80            /* >> redirection operator */
243 #define IODOC   0x100           /* << redirection operator */
244 #define IOMOV   0x200           /* <& or >& operators */
245 #define IOCLOB  0x400           /* noclobber bit */
246 #define IORDW   0x800           /* <> redirection operator */
247 #define IORAW   0x1000          /* no expansion needed for filename */
248 #define IOSTRG  0x2000          /* here-document stored as incore string */
249 #define IOSTRIP 0x4000          /* strip leading tabs for here-document */
250 #define IOQUOTE 0x8000          /* here-document delimiter was quoted */
251
252 union anynode
253 {
254         struct argnod   arg;
255         struct ionod    io;
256         struct whnod    wh;
257         struct swnod    sw;
258         struct ifnod    if_;
259         struct dolnod   dol;
260         struct comnod   com;
261         struct trenod   tre;
262         struct forknod  fork;
263         struct fornod   for_;
264         struct regnod   reg;
265         struct parnod   par;
266         struct lstnod   lst;
267         struct tstnod   tst;
268         struct functnod funct;
269         struct arithnod ar;
270 };
271
272 extern __MANGLE__ void                  sh_freeup __PROTO__((void));
273 extern __MANGLE__ void                  sh_funstaks __PROTO__((struct slnod*,int));
274 extern __MANGLE__ int                   sh_exec __PROTO__((const union anynode*,int));
275 extern __MANGLE__ union anynode         *sh_dolparen __PROTO__((void));
276 #ifdef SHOPT_KIA
277     extern __MANGLE__ int                       kiaclose __PROTO__((void));
278 #endif /* SHOPT_KIA */
279
280 #endif /* _SHNODES_H */