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 ***********************************************************************/
23 * struct to hold a word argument
24 * Written by David Korn
46 struct argnod
*comarg
;
47 struct argnod
*comset
;
55 #define COMMSK ((1<<COMBITS)-1)
56 #define COMSCAN (01<<COMBITS)
57 #define COMFIXED (02<<COMBITS)
59 struct slnod
/* struct for link list of stacks */
62 struct slnod
*slchild
;
64 /* slpad aligns struct functnod = struct slnod + 1 on some architectures */
69 * This struct is use to hold $* lists and arrays
74 int dolrefcnt
; /* reference count */
75 int dolmax
; /* size of dolval array */
76 int dolnum
; /* number of elements */
77 int dolbot
; /* current first element */
78 struct dolnod
*dolnxt
; /* used when list are chained */
79 char *dolval
[1]; /* array of value pointers */
83 * This struct is used to hold word arguments of variable size during
84 * parsing and during expansion. The flags indicate what processing
85 * is required on the argument.
101 unsigned char argflag
;
107 /* The following should evaluate to the offset of argval in argnod */
108 #define ARGVAL offsetof(struct argnod,argval[0])
109 #define sh_argstr(ap) ((ap)->argflag&ARG_RAW?sh_fmtq((ap)->argval):(ap)->argval)
113 /* legal argument flags */
114 #define ARG_RAW 0x1 /* string needs no processing */
115 #define ARG_MAKE 0x2 /* bit set during argument expansion */
116 #define ARG_COMSUB 0x2 /* command sub */
117 #define ARG_MAC 0x4 /* string needs macro expansion */
118 #define ARG_EXP 0x8 /* string needs file expansion */
119 #define ARG_ASSIGN 0x10 /* argument is an assignment */
120 #define ARG_QUOTED 0x20 /* word contained quote characters */
121 #define ARG_MESSAGE 0x40 /* contains international string */
122 #define ARG_APPEND 0x80 /* for += assignment */
123 /* The following can be passed as options to sh_macexpand() */
124 #define ARG_ARITH 0x100 /* arithmetic expansion */
125 #define ARG_OPTIMIZE 0x200 /* try to optimize */
126 #define ARG_NOGLOB 0x400 /* no file name expansion */
127 #define ARG_LET 0x800 /* processing let command arguments */
128 #define ARG_ARRAYOK 0x1000 /* $x[sub] ==> ${x[sub]} */
130 extern struct dolnod
*sh_argcreate(char*[]);
131 extern char *sh_argdolminus(void*);
132 extern int sh_argopts(int,char*[],void*);
135 extern const char e_heading
[];
136 extern const char e_off
[];
137 extern const char e_on
[];
138 extern const char e_sptbnl
[];
139 extern const char e_subst
[];
140 extern const char e_option
[];
141 extern const char e_exec
[];
142 extern const char e_devfdNN
[];
143 extern const char e_devfdstd
[];