perl 2.0 (no announcement message available)
[p5sagit/p5-mst-13.2.git] / arg.h
CommitLineData
378cc40b 1/* $Header: arg.h,v 2.0 88/06/05 00:08:14 root Exp $
8d063cd8 2 *
3 * $Log: arg.h,v $
378cc40b 4 * Revision 2.0 88/06/05 00:08:14 root
5 * Baseline version 2.0.
8d063cd8 6 *
7 */
8
9#define O_NULL 0
10#define O_ITEM 1
11#define O_ITEM2 2
12#define O_ITEM3 3
13#define O_CONCAT 4
14#define O_MATCH 5
15#define O_NMATCH 6
16#define O_SUBST 7
17#define O_NSUBST 8
18#define O_ASSIGN 9
19#define O_MULTIPLY 10
20#define O_DIVIDE 11
21#define O_MODULO 12
22#define O_ADD 13
23#define O_SUBTRACT 14
24#define O_LEFT_SHIFT 15
25#define O_RIGHT_SHIFT 16
26#define O_LT 17
27#define O_GT 18
28#define O_LE 19
29#define O_GE 20
30#define O_EQ 21
31#define O_NE 22
32#define O_BIT_AND 23
33#define O_XOR 24
34#define O_BIT_OR 25
35#define O_AND 26
36#define O_OR 27
37#define O_COND_EXPR 28
38#define O_COMMA 29
39#define O_NEGATE 30
40#define O_NOT 31
41#define O_COMPLEMENT 32
42#define O_WRITE 33
43#define O_OPEN 34
44#define O_TRANS 35
45#define O_NTRANS 36
46#define O_CLOSE 37
47#define O_ARRAY 38
48#define O_HASH 39
49#define O_LARRAY 40
50#define O_LHASH 41
51#define O_PUSH 42
52#define O_POP 43
53#define O_SHIFT 44
54#define O_SPLIT 45
55#define O_LENGTH 46
56#define O_SPRINTF 47
57#define O_SUBSTR 48
58#define O_JOIN 49
59#define O_SLT 50
60#define O_SGT 51
61#define O_SLE 52
62#define O_SGE 53
63#define O_SEQ 54
64#define O_SNE 55
65#define O_SUBR 56
66#define O_PRINT 57
67#define O_CHDIR 58
68#define O_DIE 59
69#define O_EXIT 60
70#define O_RESET 61
71#define O_LIST 62
72#define O_SELECT 63
73#define O_EOF 64
74#define O_TELL 65
75#define O_SEEK 66
76#define O_LAST 67
77#define O_NEXT 68
78#define O_REDO 69
79#define O_GOTO 70
80#define O_INDEX 71
81#define O_TIME 72
82#define O_TMS 73
83#define O_LOCALTIME 74
84#define O_GMTIME 75
85#define O_STAT 76
86#define O_CRYPT 77
87#define O_EXP 78
88#define O_LOG 79
89#define O_SQRT 80
90#define O_INT 81
91#define O_PRTF 82
92#define O_ORD 83
93#define O_SLEEP 84
94#define O_FLIP 85
95#define O_FLOP 86
96#define O_KEYS 87
97#define O_VALUES 88
98#define O_EACH 89
99#define O_CHOP 90
100#define O_FORK 91
101#define O_EXEC 92
102#define O_SYSTEM 93
103#define O_OCT 94
104#define O_HEX 95
105#define O_CHMOD 96
106#define O_CHOWN 97
107#define O_KILL 98
108#define O_RENAME 99
109#define O_UNLINK 100
110#define O_UMASK 101
111#define O_UNSHIFT 102
112#define O_LINK 103
113#define O_REPEAT 104
a559c259 114#define O_EVAL 105
378cc40b 115#define O_FTEREAD 106
116#define O_FTEWRITE 107
117#define O_FTEEXEC 108
118#define O_FTEOWNED 109
119#define O_FTRREAD 110
120#define O_FTRWRITE 111
121#define O_FTREXEC 112
122#define O_FTROWNED 113
123#define O_FTIS 114
124#define O_FTZERO 115
125#define O_FTSIZE 116
126#define O_FTFILE 117
127#define O_FTDIR 118
128#define O_FTLINK 119
129#define O_SYMLINK 120
130#define O_FTPIPE 121
131#define O_FTSOCK 122
132#define O_FTBLK 123
133#define O_FTCHR 124
134#define O_FTSUID 125
135#define O_FTSGID 126
136#define O_FTSVTX 127
137#define O_FTTTY 128
138#define O_DOFILE 129
139#define O_FTTEXT 130
140#define O_FTBINARY 131
141#define O_UTIME 132
142#define O_WAIT 133
143#define O_SORT 134
144#define O_DELETE 135
145#define O_STUDY 136
146#define MAXO 137
8d063cd8 147
148#ifndef DOINIT
149extern char *opname[];
150#else
151char *opname[] = {
152 "NULL",
153 "ITEM",
154 "ITEM2",
155 "ITEM3",
156 "CONCAT",
157 "MATCH",
158 "NMATCH",
159 "SUBST",
160 "NSUBST",
161 "ASSIGN",
162 "MULTIPLY",
163 "DIVIDE",
164 "MODULO",
165 "ADD",
166 "SUBTRACT",
167 "LEFT_SHIFT",
168 "RIGHT_SHIFT",
169 "LT",
170 "GT",
171 "LE",
172 "GE",
173 "EQ",
174 "NE",
175 "BIT_AND",
176 "XOR",
177 "BIT_OR",
178 "AND",
179 "OR",
180 "COND_EXPR",
181 "COMMA",
182 "NEGATE",
183 "NOT",
184 "COMPLEMENT",
185 "WRITE",
186 "OPEN",
187 "TRANS",
188 "NTRANS",
189 "CLOSE",
190 "ARRAY",
191 "HASH",
192 "LARRAY",
193 "LHASH",
194 "PUSH",
195 "POP",
196 "SHIFT",
197 "SPLIT",
198 "LENGTH",
199 "SPRINTF",
200 "SUBSTR",
201 "JOIN",
202 "SLT",
203 "SGT",
204 "SLE",
205 "SGE",
206 "SEQ",
207 "SNE",
208 "SUBR",
209 "PRINT",
210 "CHDIR",
211 "DIE",
212 "EXIT",
213 "RESET",
214 "LIST",
215 "SELECT",
216 "EOF",
217 "TELL",
218 "SEEK",
219 "LAST",
220 "NEXT",
221 "REDO",
222 "GOTO",/* shudder */
223 "INDEX",
224 "TIME",
225 "TIMES",
226 "LOCALTIME",
227 "GMTIME",
228 "STAT",
229 "CRYPT",
230 "EXP",
231 "LOG",
232 "SQRT",
233 "INT",
234 "PRINTF",
235 "ORD",
236 "SLEEP",
237 "FLIP",
238 "FLOP",
239 "KEYS",
240 "VALUES",
241 "EACH",
242 "CHOP",
243 "FORK",
244 "EXEC",
245 "SYSTEM",
246 "OCT",
247 "HEX",
248 "CHMOD",
249 "CHOWN",
250 "KILL",
251 "RENAME",
252 "UNLINK",
253 "UMASK",
254 "UNSHIFT",
255 "LINK",
256 "REPEAT",
a559c259 257 "EVAL",
378cc40b 258 "FTEREAD",
259 "FTEWRITE",
260 "FTEEXEC",
261 "FTEOWNED",
262 "FTRREAD",
263 "FTRWRITE",
264 "FTREXEC",
265 "FTROWNED",
266 "FTIS",
267 "FTZERO",
268 "FTSIZE",
269 "FTFILE",
270 "FTDIR",
271 "FTLINK",
272 "SYMLINK",
273 "FTPIPE",
274 "FTSOCK",
275 "FTBLK",
276 "FTCHR",
277 "FTSUID",
278 "FTSGID",
279 "FTSVTX",
280 "FTTTY",
281 "DOFILE",
282 "FTTEXT",
283 "FTBINARY",
284 "UTIME",
285 "WAIT",
286 "SORT",
287 "DELETE",
288 "STUDY",
289 "135"
8d063cd8 290};
291#endif
292
293#define A_NULL 0
294#define A_EXPR 1
295#define A_CMD 2
296#define A_STAB 3
297#define A_LVAL 4
298#define A_SINGLE 5
299#define A_DOUBLE 6
300#define A_BACKTICK 7
301#define A_READ 8
302#define A_SPAT 9
303#define A_LEXPR 10
304#define A_ARYLEN 11
305#define A_NUMBER 12
378cc40b 306#define A_LARYLEN 13
307#define A_GLOB 14
308#define A_WORD 15
309#define A_INDREAD 16
8d063cd8 310
311#ifndef DOINIT
312extern char *argname[];
313#else
314char *argname[] = {
315 "A_NULL",
316 "EXPR",
317 "CMD",
318 "STAB",
319 "LVAL",
320 "SINGLE",
321 "DOUBLE",
322 "BACKTICK",
323 "READ",
324 "SPAT",
325 "LEXPR",
326 "ARYLEN",
327 "NUMBER",
378cc40b 328 "LARYLEN",
329 "GLOB",
330 "WORD",
331 "INDREAD",
332 "17"
8d063cd8 333};
334#endif
335
336#ifndef DOINIT
337extern bool hoistable[];
338#else
378cc40b 339bool hoistable[] = {0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0};
8d063cd8 340#endif
341
378cc40b 342union argptr {
343 ARG *arg_arg;
344 char *arg_cval;
345 STAB *arg_stab;
346 SPAT *arg_spat;
347 CMD *arg_cmd;
348 STR *arg_str;
349 double arg_nval;
350};
351
8d063cd8 352struct arg {
378cc40b 353 union argptr arg_ptr;
8d063cd8 354 short arg_len;
378cc40b 355 unsigned char arg_type;
356 unsigned char arg_flags;
8d063cd8 357};
358
359#define AF_SPECIAL 1 /* op wants to evaluate this arg itself */
360#define AF_POST 2 /* post *crement this item */
361#define AF_PRE 4 /* pre *crement this item */
362#define AF_UP 8 /* increment rather than decrement */
363#define AF_COMMON 16 /* left and right have symbols in common */
364#define AF_NUMERIC 32 /* return as numeric rather than string */
365#define AF_LISTISH 64 /* turn into list if important */
378cc40b 366#define AF_LOCAL 128 /* list of local variables */
8d063cd8 367
368/*
369 * Most of the ARG pointers are used as pointers to arrays of ARG. When
370 * so used, the 0th element is special, and represents the operator to
371 * use on the list of arguments following. The arg_len in the 0th element
372 * gives the maximum argument number, and the arg_str is used to store
373 * the return value in a more-or-less static location. Sorry it's not
374 * re-entrant, but it sure makes it efficient. The arg_type of the
375 * 0th element is an operator (O_*) rather than an argument type (A_*).
376 */
377
378#define Nullarg Null(ARG*)
379
380EXT char opargs[MAXO];
381
382int do_trans();
383int do_split();
384bool do_eof();
385long do_tell();
386bool do_seek();
387int do_tms();
388int do_time();
389int do_stat();
378cc40b 390STR *do_push();
391FILE *nextargv();
392STR *do_fttext();