This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 1.0 patch 5: a2p didn't make use of the config.h generated by Configure
[perl5.git] / arg.h
CommitLineData
8d063cd8
LW
1/* $Header: arg.h,v 1.0 87/12/18 13:04:39 root Exp $
2 *
3 * $Log: arg.h,v $
4 * Revision 1.0 87/12/18 13:04:39 root
5 * Initial revision
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
114#define MAXO 105
115
116#ifndef DOINIT
117extern char *opname[];
118#else
119char *opname[] = {
120 "NULL",
121 "ITEM",
122 "ITEM2",
123 "ITEM3",
124 "CONCAT",
125 "MATCH",
126 "NMATCH",
127 "SUBST",
128 "NSUBST",
129 "ASSIGN",
130 "MULTIPLY",
131 "DIVIDE",
132 "MODULO",
133 "ADD",
134 "SUBTRACT",
135 "LEFT_SHIFT",
136 "RIGHT_SHIFT",
137 "LT",
138 "GT",
139 "LE",
140 "GE",
141 "EQ",
142 "NE",
143 "BIT_AND",
144 "XOR",
145 "BIT_OR",
146 "AND",
147 "OR",
148 "COND_EXPR",
149 "COMMA",
150 "NEGATE",
151 "NOT",
152 "COMPLEMENT",
153 "WRITE",
154 "OPEN",
155 "TRANS",
156 "NTRANS",
157 "CLOSE",
158 "ARRAY",
159 "HASH",
160 "LARRAY",
161 "LHASH",
162 "PUSH",
163 "POP",
164 "SHIFT",
165 "SPLIT",
166 "LENGTH",
167 "SPRINTF",
168 "SUBSTR",
169 "JOIN",
170 "SLT",
171 "SGT",
172 "SLE",
173 "SGE",
174 "SEQ",
175 "SNE",
176 "SUBR",
177 "PRINT",
178 "CHDIR",
179 "DIE",
180 "EXIT",
181 "RESET",
182 "LIST",
183 "SELECT",
184 "EOF",
185 "TELL",
186 "SEEK",
187 "LAST",
188 "NEXT",
189 "REDO",
190 "GOTO",/* shudder */
191 "INDEX",
192 "TIME",
193 "TIMES",
194 "LOCALTIME",
195 "GMTIME",
196 "STAT",
197 "CRYPT",
198 "EXP",
199 "LOG",
200 "SQRT",
201 "INT",
202 "PRINTF",
203 "ORD",
204 "SLEEP",
205 "FLIP",
206 "FLOP",
207 "KEYS",
208 "VALUES",
209 "EACH",
210 "CHOP",
211 "FORK",
212 "EXEC",
213 "SYSTEM",
214 "OCT",
215 "HEX",
216 "CHMOD",
217 "CHOWN",
218 "KILL",
219 "RENAME",
220 "UNLINK",
221 "UMASK",
222 "UNSHIFT",
223 "LINK",
224 "REPEAT",
225 "105"
226};
227#endif
228
229#define A_NULL 0
230#define A_EXPR 1
231#define A_CMD 2
232#define A_STAB 3
233#define A_LVAL 4
234#define A_SINGLE 5
235#define A_DOUBLE 6
236#define A_BACKTICK 7
237#define A_READ 8
238#define A_SPAT 9
239#define A_LEXPR 10
240#define A_ARYLEN 11
241#define A_NUMBER 12
242
243#ifndef DOINIT
244extern char *argname[];
245#else
246char *argname[] = {
247 "A_NULL",
248 "EXPR",
249 "CMD",
250 "STAB",
251 "LVAL",
252 "SINGLE",
253 "DOUBLE",
254 "BACKTICK",
255 "READ",
256 "SPAT",
257 "LEXPR",
258 "ARYLEN",
259 "NUMBER",
260 "13"
261};
262#endif
263
264#ifndef DOINIT
265extern bool hoistable[];
266#else
267bool hoistable[] = {0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0};
268#endif
269
270struct arg {
271 union argptr {
272 ARG *arg_arg;
273 char *arg_cval;
274 STAB *arg_stab;
275 SPAT *arg_spat;
276 CMD *arg_cmd;
277 STR *arg_str;
278 double arg_nval;
279 } arg_ptr;
280 short arg_len;
281 char arg_type;
282 char arg_flags;
283};
284
285#define AF_SPECIAL 1 /* op wants to evaluate this arg itself */
286#define AF_POST 2 /* post *crement this item */
287#define AF_PRE 4 /* pre *crement this item */
288#define AF_UP 8 /* increment rather than decrement */
289#define AF_COMMON 16 /* left and right have symbols in common */
290#define AF_NUMERIC 32 /* return as numeric rather than string */
291#define AF_LISTISH 64 /* turn into list if important */
292
293/*
294 * Most of the ARG pointers are used as pointers to arrays of ARG. When
295 * so used, the 0th element is special, and represents the operator to
296 * use on the list of arguments following. The arg_len in the 0th element
297 * gives the maximum argument number, and the arg_str is used to store
298 * the return value in a more-or-less static location. Sorry it's not
299 * re-entrant, but it sure makes it efficient. The arg_type of the
300 * 0th element is an operator (O_*) rather than an argument type (A_*).
301 */
302
303#define Nullarg Null(ARG*)
304
305EXT char opargs[MAXO];
306
307int do_trans();
308int do_split();
309bool do_eof();
310long do_tell();
311bool do_seek();
312int do_tms();
313int do_time();
314int do_stat();