1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1982-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * David Korn <dgk@research.att.com> *
19 ***********************************************************************/
25 * Written by David Korn
33 /* command tree for tretyp */
34 #define FINT (02<<COMBITS) /* non-interruptable */
35 #define FAMP (04<<COMBITS) /* background */
36 #define FPIN (010<<COMBITS) /* input is a pipe */
37 #define FPOU (040<<COMBITS) /* output is a pipe */
38 #define FPCL (0100<<COMBITS) /* close the pipe */
39 #define FCOOP (0200<<COMBITS) /* cooperating process */
40 #define FSHOWME (0400<<COMBITS) /* set for showme commands */
41 #define FPOSIX (02<<COMBITS) /* posix semantics function */
42 #define FLINENO (04<<COMBITS) /* for/case has line number */
43 #define FOPTGET (010<<COMBITS) /* function calls getopts */
45 #define TNEGATE (01<<COMBITS) /* ! inside [[...]] */
46 #define TBINARY (02<<COMBITS) /* binary operator in [[...]] */
47 #define TUNARY (04<<COMBITS) /* unary operator in [[...]] */
48 #define TTEST (010<<COMBITS)
49 #define TPAREN (TBINARY|TUNARY)
50 #define TSHIFT (COMBITS+4)
51 #define TNSPACE (TFUN|COMSCAN)
59 #define TUN (TWH|COMSCAN)
66 #define TSELECT (TFOR|COMSCAN)
72 /* this node is a proforma for those that follow */
103 struct arithnod
*whinc
;
111 struct comnod
*forlst
;
118 struct argnod
*swarg
;
119 struct regnod
*swlst
;
126 struct argnod
*regptr
;
128 struct regnod
*regnxt
;
145 /* tst is same as lst, but with extra field for line number */
148 struct lstnod tstlst
;
159 struct slnod
*functstak
;
160 struct comnod
*functargs
;
167 struct argnod
*arexpr
;
172 /* types of ionodes stored in iofile */
173 #define IOUFD 0x3f /* file descriptor number mask */
174 #define IOPUT 0x40 /* > redirection operator */
175 #define IOAPP 0x80 /* >> redirection operator */
176 #define IODOC 0x100 /* << redirection operator */
177 #define IOMOV 0x200 /* <& or >& operators */
178 #define IOCLOB 0x400 /* noclobber bit */
179 #define IORDW 0x800 /* <> redirection operator */
180 #define IORAW 0x1000 /* no expansion needed for filename */
181 #define IOSTRG 0x2000 /* here-document stored as incore string */
182 #define IOSTRIP 0x4000 /* strip leading tabs for here-document */
183 #define IOQUOTE 0x8000 /* here-document delimiter was quoted */
184 #define IOVNM 0x10000 /* iovname field is non-zero */
185 #define IOLSEEK 0x20000 /* seek operators <# or ># */
186 #define IOARITH 0x40000 /* arithmetic seek <# ((expr)) */
187 #define IOREWRITE 0x80000 /* arithmetic seek <# ((expr)) */
188 #define IOCOPY IOCLOB /* copy skipped lines onto standard output */
189 #define IOPROCSUB IOARITH /* process substitution redirection */
207 struct functnod funct
;
211 extern void sh_freeup(Shell_t
*);
212 extern void sh_funstaks(struct slnod
*,int);
213 extern Sfio_t
*sh_subshell(Shnode_t
*, int, int);
214 #if defined(__EXPORT__) && defined(_BLD_DLL) && defined(_BLD_shell)
217 extern int sh_tdump(Sfio_t
*, const Shnode_t
*);
218 extern Shnode_t
*sh_trestore(Shell_t
*, Sfio_t
*);
220 #endif /* _SHNODES_H */