Commit | Line | Data |
---|---|---|
450a55e4 | 1 | /* $Header: perl.h,v 3.0.1.8 90/08/09 04:10:53 lwall Locked $ |
a687059c LW |
2 | * |
3 | * Copyright (c) 1989, Larry Wall | |
4 | * | |
5 | * You may distribute under the terms of the GNU General Public License | |
6 | * as specified in the README file that comes with the perl 3.0 kit. | |
8d063cd8 LW |
7 | * |
8 | * $Log: perl.h,v $ | |
450a55e4 LW |
9 | * Revision 3.0.1.8 90/08/09 04:10:53 lwall |
10 | * patch19: various MSDOS and OS/2 patches folded in | |
11 | * patch19: did preliminary work toward debugging packages and evals | |
12 | * patch19: added -x switch to extract script from input trash | |
13 | * | |
0f85fab0 LW |
14 | * Revision 3.0.1.7 90/03/27 16:12:52 lwall |
15 | * patch16: MSDOS support | |
16 | * patch16: support for machines that can't cast negative floats to unsigned ints | |
17 | * | |
79a0689e LW |
18 | * Revision 3.0.1.6 90/03/12 16:40:43 lwall |
19 | * patch13: did some ndir straightening up for Xenix | |
20 | * | |
ac58e20f LW |
21 | * Revision 3.0.1.5 90/02/28 17:52:28 lwall |
22 | * patch9: Configure now determines whether volatile is supported | |
23 | * patch9: volatilized some more variables for super-optimizing compilers | |
24 | * patch9: unused VREG symbol deleted | |
25 | * patch9: perl can now start up other interpreters scripts | |
26 | * patch9: you may now undef $/ to have no input record separator | |
27 | * patch9: nested evals clobbered their longjmp environment | |
28 | * | |
663a0e37 LW |
29 | * Revision 3.0.1.4 89/12/21 20:07:35 lwall |
30 | * patch7: arranged for certain registers to be restored after longjmp() | |
31 | * patch7: Configure now compiles a test program to figure out time.h fiasco | |
32 | * patch7: Configure now detects DG/UX thingies like [sg]etpgrp2 and utime.h | |
33 | * patch7: memcpy() and memset() return void in __STDC__ | |
34 | * patch7: errno may now be a macro with an lvalue | |
35 | * patch7: ANSI strerror() is now supported | |
36 | * patch7: Xenix support for sys/ndir.h, cross compilation | |
37 | * | |
ffed7fef LW |
38 | * Revision 3.0.1.3 89/11/17 15:28:57 lwall |
39 | * patch5: byteorder now is a hex value | |
40 | * patch5: Configure now looks for <time.h> including <sys/time.h> | |
41 | * | |
ae986130 LW |
42 | * Revision 3.0.1.2 89/11/11 04:39:38 lwall |
43 | * patch2: Configure may now set -DDEBUGGING | |
44 | * patch2: netinet/in.h needed sys/types.h some places | |
45 | * patch2: more <sys/time.h> and <time.h> wrangling | |
46 | * patch2: yydebug moved to where type doesn't matter | |
47 | * | |
03a14243 LW |
48 | * Revision 3.0.1.1 89/10/26 23:17:08 lwall |
49 | * patch1: vfork now conditionally defined based on VFORK | |
50 | * patch1: DEC risc machines have a buggy memcmp | |
51 | * patch1: perl.h now includes <netinet/in.h> if it exists | |
52 | * | |
a687059c LW |
53 | * Revision 3.0 89/10/18 15:21:21 lwall |
54 | * 3.0 baseline | |
8d063cd8 LW |
55 | * |
56 | */ | |
57 | ||
ac58e20f LW |
58 | #define VOIDUSED 1 |
59 | #include "config.h" | |
60 | ||
0f85fab0 LW |
61 | #ifdef MSDOS |
62 | /* | |
63 | * BUGGY_MSC: | |
64 | * This symbol is defined if you are the unfortunate owner of a buggy | |
65 | * Microsoft C compiler and want to use intrinsic functions. Versions | |
66 | * up to 5.1 are known conform to this definition. This is not needed | |
67 | * under Unix. | |
68 | */ | |
69 | #define BUGGY_MSC /**/ | |
70 | /* | |
71 | * BINARY: | |
72 | * This symbol is defined if you run under an operating system that | |
73 | * distinguishes between binary and text files. If so the function | |
74 | * setmode will be used to set the file into binary mode. Unix | |
75 | * doesn't distinguish. | |
76 | */ | |
77 | #define BINARY /**/ | |
78 | ||
79 | #else /* !MSDOS */ | |
80 | ||
81 | /* | |
82 | * The following symbols are defined if your operating system supports | |
83 | * functions by that name. All Unixes I know of support them, thus they | |
84 | * are not checked by the configuration script, but are directly defined | |
85 | * here. | |
86 | */ | |
87 | #define CHOWN | |
88 | #define CHROOT | |
89 | #define FORK | |
90 | #define GETLOGIN | |
91 | #define GETPPID | |
92 | #define KILL | |
93 | #define LINK | |
94 | #define PIPE | |
95 | #define WAIT | |
96 | #define UMASK | |
97 | /* | |
98 | * The following symbols are defined if your operating system supports | |
99 | * password and group functions in general. All Unix systems do. | |
100 | */ | |
101 | #define GROUP | |
102 | #define PASSWD | |
103 | ||
104 | #endif /* !MSDOS */ | |
105 | ||
ac58e20f | 106 | #if defined(HASVOLATILE) || defined(__STDC__) |
663a0e37 | 107 | #define VOLATILE volatile |
663a0e37 LW |
108 | #else |
109 | #define VOLATILE | |
663a0e37 LW |
110 | #endif |
111 | ||
a687059c LW |
112 | #ifdef IAMSUID |
113 | # ifndef TAINT | |
114 | # define TAINT | |
115 | # endif | |
116 | #endif | |
117 | ||
03a14243 LW |
118 | #ifndef VFORK |
119 | # define vfork fork | |
120 | #endif | |
121 | ||
663a0e37 LW |
122 | #ifdef GETPGRP2 |
123 | # ifndef GETPGRP | |
124 | # define GETPGRP | |
125 | # endif | |
126 | # define getpgrp getpgrp2 | |
127 | #endif | |
128 | ||
129 | #ifdef SETPGRP2 | |
130 | # ifndef SETPGRP | |
131 | # define SETPGRP | |
132 | # endif | |
133 | # define setpgrp setpgrp2 | |
134 | #endif | |
135 | ||
ffed7fef | 136 | #if defined(MEMCMP) && defined(mips) && BYTEORDER == 0x1234 |
03a14243 LW |
137 | #undef MEMCMP |
138 | #endif | |
139 | ||
378cc40b | 140 | #ifdef MEMCPY |
663a0e37 | 141 | #ifndef memcpy |
450a55e4 | 142 | #if defined(__STDC__ ) || defined(MSDOS) |
663a0e37 LW |
143 | extern void *memcpy(), *memset(); |
144 | #else | |
378cc40b | 145 | extern char *memcpy(), *memset(); |
663a0e37 | 146 | #endif |
450a55e4 | 147 | extern int memcmp(); |
663a0e37 | 148 | #endif |
a687059c LW |
149 | #define bcopy(s1,s2,l) memcpy(s2,s1,l) |
150 | #define bzero(s,l) memset(s,0,l) | |
151 | #endif | |
152 | #ifndef BCMP /* prefer bcmp slightly 'cuz it doesn't order */ | |
153 | #define bcmp(s1,s2,l) memcmp(s1,s2,l) | |
8d063cd8 LW |
154 | #endif |
155 | ||
156 | #include <stdio.h> | |
157 | #include <ctype.h> | |
158 | #include <setjmp.h> | |
378cc40b LW |
159 | #include <sys/param.h> /* if this needs types.h we're still wrong */ |
160 | ||
161 | #ifndef _TYPES_ /* If types.h defines this it's easy. */ | |
162 | #ifndef major /* Does everyone's types.h define this? */ | |
8d063cd8 | 163 | #include <sys/types.h> |
378cc40b LW |
164 | #endif |
165 | #endif | |
166 | ||
ae986130 LW |
167 | #ifdef I_NETINET_IN |
168 | #include <netinet/in.h> | |
169 | #endif | |
170 | ||
8d063cd8 | 171 | #include <sys/stat.h> |
135863df | 172 | |
663a0e37 LW |
173 | #ifdef I_TIME |
174 | # include <time.h> | |
ffed7fef | 175 | #endif |
663a0e37 LW |
176 | |
177 | #ifdef I_SYSTIME | |
178 | # ifdef SYSTIMEKERNEL | |
179 | # define KERNEL | |
180 | # endif | |
181 | # include <sys/time.h> | |
182 | # ifdef SYSTIMEKERNEL | |
183 | # undef KERNEL | |
184 | # endif | |
a687059c | 185 | #endif |
135863df | 186 | |
8d063cd8 LW |
187 | #include <sys/times.h> |
188 | ||
663a0e37 LW |
189 | #if defined(STRERROR) && (!defined(MKDIR) || !defined(RMDIR)) |
190 | #undef STRERROR | |
191 | #endif | |
192 | ||
193 | #include <errno.h> | |
194 | #ifndef errno | |
195 | extern int errno; /* ANSI allows errno to be an lvalue expr */ | |
196 | #endif | |
197 | ||
198 | #ifdef STRERROR | |
199 | char *strerror(); | |
200 | #else | |
201 | extern int sys_nerr; | |
202 | extern char *sys_errlist[]; | |
203 | #define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e]) | |
204 | #endif | |
205 | ||
a687059c LW |
206 | #ifdef I_SYSIOCTL |
207 | #ifndef _IOCTL_ | |
208 | #include <sys/ioctl.h> | |
209 | #endif | |
210 | #endif | |
211 | ||
212 | #if defined(mc300) || defined(mc500) || defined(mc700) /* MASSCOMP */ | |
213 | #ifdef SOCKETPAIR | |
214 | #undef SOCKETPAIR | |
215 | #endif | |
216 | #ifdef NDBM | |
217 | #undef NDBM | |
218 | #endif | |
219 | #endif | |
220 | ||
221 | #ifdef NDBM | |
222 | #include <ndbm.h> | |
223 | #define SOME_DBM | |
ae986130 LW |
224 | #ifdef ODBM |
225 | #undef ODBM | |
226 | #endif | |
a687059c LW |
227 | #else |
228 | #ifdef ODBM | |
229 | #ifdef NULL | |
230 | #undef NULL /* suppress redefinition message */ | |
231 | #endif | |
232 | #include <dbm.h> | |
233 | #ifdef NULL | |
234 | #undef NULL | |
235 | #endif | |
236 | #define NULL 0 /* silly thing is, we don't even use this */ | |
237 | #define SOME_DBM | |
238 | #define dbm_fetch(db,dkey) fetch(dkey) | |
239 | #define dbm_delete(db,dkey) delete(dkey) | |
240 | #define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent) | |
241 | #define dbm_close(db) dbmclose() | |
242 | #define dbm_firstkey(db) firstkey() | |
243 | #endif /* ODBM */ | |
244 | #endif /* NDBM */ | |
245 | #ifdef SOME_DBM | |
246 | EXT char *dbmkey; | |
247 | EXT int dbmlen; | |
248 | #endif | |
249 | ||
250 | #if INTSIZE == 2 | |
251 | #define htoni htons | |
252 | #define ntohi ntohs | |
253 | #else | |
254 | #define htoni htonl | |
255 | #define ntohi ntohl | |
256 | #endif | |
257 | ||
79a0689e | 258 | #if defined(I_DIRENT) && !defined(M_XENIX) |
663a0e37 LW |
259 | # include <dirent.h> |
260 | # define DIRENT dirent | |
ae986130 | 261 | #else |
79a0689e LW |
262 | # ifdef I_SYSNDIR |
263 | # include <sys/ndir.h> | |
663a0e37 LW |
264 | # define DIRENT direct |
265 | # else | |
79a0689e LW |
266 | # ifdef I_SYSDIR |
267 | # ifdef hp9000s500 | |
268 | # include <ndir.h> /* may be wrong in the future */ | |
269 | # else | |
270 | # include <sys/dir.h> | |
271 | # endif | |
663a0e37 LW |
272 | # define DIRENT direct |
273 | # endif | |
274 | # endif | |
a687059c LW |
275 | #endif |
276 | ||
450a55e4 LW |
277 | typedef unsigned int STRLEN; |
278 | ||
8d063cd8 LW |
279 | typedef struct arg ARG; |
280 | typedef struct cmd CMD; | |
281 | typedef struct formcmd FCMD; | |
282 | typedef struct scanpat SPAT; | |
8d063cd8 | 283 | typedef struct stio STIO; |
378cc40b | 284 | typedef struct sub SUBR; |
8d063cd8 LW |
285 | typedef struct string STR; |
286 | typedef struct atbl ARRAY; | |
287 | typedef struct htbl HASH; | |
378cc40b | 288 | typedef struct regexp REGEXP; |
a687059c LW |
289 | typedef struct stabptrs STBP; |
290 | typedef struct stab STAB; | |
8d063cd8 | 291 | |
378cc40b LW |
292 | #include "handy.h" |
293 | #include "regexp.h" | |
8d063cd8 | 294 | #include "str.h" |
378cc40b | 295 | #include "util.h" |
8d063cd8 LW |
296 | #include "form.h" |
297 | #include "stab.h" | |
298 | #include "spat.h" | |
299 | #include "arg.h" | |
300 | #include "cmd.h" | |
301 | #include "array.h" | |
302 | #include "hash.h" | |
303 | ||
450a55e4 | 304 | #if defined(iAPX286) || defined(M_I286) || defined(I80286) |
a687059c LW |
305 | # define I286 |
306 | #endif | |
307 | ||
308 | #ifndef __STDC__ | |
135863df AB |
309 | #ifdef CHARSPRINTF |
310 | char *sprintf(); | |
311 | #else | |
312 | int sprintf(); | |
313 | #endif | |
a687059c | 314 | #endif |
135863df | 315 | |
8d063cd8 LW |
316 | EXT char *Yes INIT("1"); |
317 | EXT char *No INIT(""); | |
318 | ||
a687059c LW |
319 | /* "gimme" values */ |
320 | ||
321 | /* Note: cmd.c assumes that it can use && to produce one of these values! */ | |
322 | #define G_SCALAR 0 | |
323 | #define G_ARRAY 1 | |
324 | ||
325 | #ifdef CRIPPLED_CC | |
326 | int str_true(); | |
327 | #else /* !CRIPPLED_CC */ | |
328 | #define str_true(str) (Str = (str), \ | |
329 | (Str->str_pok ? \ | |
330 | ((*Str->str_ptr > '0' || \ | |
331 | Str->str_cur > 1 || \ | |
332 | (Str->str_cur && *Str->str_ptr != '0')) ? 1 : 0) \ | |
333 | : \ | |
334 | (Str->str_nok ? (Str->str_u.str_nval != 0.0) : 0 ) )) | |
335 | #endif /* CRIPPLED_CC */ | |
8d063cd8 | 336 | |
135863df | 337 | #ifdef DEBUGGING |
a687059c LW |
338 | #define str_peek(str) (Str = (str), \ |
339 | (Str->str_pok ? \ | |
340 | Str->str_ptr : \ | |
341 | (Str->str_nok ? \ | |
342 | (sprintf(tokenbuf,"num(%g)",Str->str_u.str_nval), \ | |
343 | (char*)tokenbuf) : \ | |
344 | "" ))) | |
135863df AB |
345 | #endif |
346 | ||
a687059c LW |
347 | #ifdef CRIPPLED_CC |
348 | char *str_get(); | |
349 | #else | |
350 | #ifdef TAINT | |
351 | #define str_get(str) (Str = (str), tainted |= Str->str_tainted, \ | |
352 | (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) | |
353 | #else | |
8d063cd8 | 354 | #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str))) |
a687059c LW |
355 | #endif /* TAINT */ |
356 | #endif /* CRIPPLED_CC */ | |
357 | ||
358 | #ifdef CRIPPLED_CC | |
359 | double str_gnum(); | |
360 | #else /* !CRIPPLED_CC */ | |
361 | #ifdef TAINT | |
362 | #define str_gnum(str) (Str = (str), tainted |= Str->str_tainted, \ | |
363 | (Str->str_nok ? Str->str_u.str_nval : str_2num(Str))) | |
364 | #else /* !TAINT */ | |
365 | #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_u.str_nval : str_2num(Str))) | |
366 | #endif /* TAINT*/ | |
367 | #endif /* CRIPPLED_CC */ | |
8d063cd8 LW |
368 | EXT STR *Str; |
369 | ||
370 | #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len) | |
371 | ||
450a55e4 | 372 | #ifndef MSDOS |
a687059c | 373 | #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len) |
450a55e4 LW |
374 | #define Str_Grow str_grow |
375 | #else | |
376 | /* extra parentheses intentionally NOT placed around "len"! */ | |
377 | #define STR_GROW(str,len) if ((str)->str_len < (unsigned long)len) \ | |
378 | str_grow(str,(unsigned long)len) | |
379 | #define Str_Grow(str,len) str_grow(str,(unsigned long)(len)) | |
380 | #endif /* MSDOS */ | |
a687059c LW |
381 | |
382 | #ifndef BYTEORDER | |
ffed7fef | 383 | #define BYTEORDER 0x1234 |
a687059c LW |
384 | #endif |
385 | ||
ae986130 LW |
386 | #if defined(htonl) && !defined(HTONL) |
387 | #define HTONL | |
388 | #endif | |
389 | #if defined(htons) && !defined(HTONS) | |
390 | #define HTONS | |
391 | #endif | |
392 | #if defined(ntohl) && !defined(NTOHL) | |
393 | #define NTOHL | |
394 | #endif | |
395 | #if defined(ntohs) && !defined(NTOHS) | |
396 | #define NTOHS | |
397 | #endif | |
a687059c | 398 | #ifndef HTONL |
ffed7fef | 399 | #if (BYTEORDER != 0x4321) && (BYTEORDER != 0x87654321) |
a687059c LW |
400 | #define HTONS |
401 | #define HTONL | |
402 | #define NTOHS | |
403 | #define NTOHL | |
404 | #define MYSWAP | |
405 | #define htons my_swap | |
406 | #define htonl my_htonl | |
407 | #define ntohs my_swap | |
408 | #define ntohl my_ntohl | |
409 | #endif | |
410 | #else | |
ffed7fef | 411 | #if (BYTEORDER == 0x4321) || (BYTEORDER == 0x87654321) |
a687059c LW |
412 | #undef HTONS |
413 | #undef HTONL | |
414 | #undef NTOHS | |
415 | #undef NTOHL | |
416 | #endif | |
417 | #endif | |
418 | ||
0f85fab0 LW |
419 | #ifdef CASTNEGFLOAT |
420 | #define U_S(what) ((unsigned short)(what)) | |
421 | #define U_I(what) ((unsigned int)(what)) | |
422 | #define U_L(what) ((unsigned long)(what)) | |
423 | #else | |
424 | unsigned long castulong(); | |
425 | #define U_S(what) ((unsigned int)castulong(what)) | |
426 | #define U_I(what) ((unsigned int)castulong(what)) | |
427 | #define U_L(what) (castulong(what)) | |
428 | #endif | |
429 | ||
8d063cd8 LW |
430 | CMD *add_label(); |
431 | CMD *block_head(); | |
432 | CMD *append_line(); | |
433 | CMD *make_acmd(); | |
434 | CMD *make_ccmd(); | |
a687059c | 435 | CMD *make_icmd(); |
8d063cd8 LW |
436 | CMD *invert(); |
437 | CMD *addcond(); | |
438 | CMD *addloop(); | |
439 | CMD *wopt(); | |
378cc40b | 440 | CMD *over(); |
8d063cd8 | 441 | |
8d063cd8 | 442 | STAB *stabent(); |
378cc40b | 443 | STAB *genstab(); |
8d063cd8 | 444 | |
378cc40b | 445 | ARG *stab2arg(); |
8d063cd8 LW |
446 | ARG *op_new(); |
447 | ARG *make_op(); | |
8d063cd8 LW |
448 | ARG *make_match(); |
449 | ARG *make_split(); | |
a687059c | 450 | ARG *rcatmaybe(); |
378cc40b | 451 | ARG *listish(); |
a687059c | 452 | ARG *maybelistish(); |
378cc40b | 453 | ARG *localize(); |
a687059c LW |
454 | ARG *fixeval(); |
455 | ARG *jmaybe(); | |
378cc40b | 456 | ARG *l(); |
a687059c | 457 | ARG *fixl(); |
378cc40b LW |
458 | ARG *mod_match(); |
459 | ARG *make_list(); | |
460 | ARG *cmd_to_arg(); | |
461 | ARG *addflags(); | |
462 | ARG *hide_ary(); | |
463 | ARG *cval_to_arg(); | |
8d063cd8 | 464 | |
8d063cd8 LW |
465 | STR *str_new(); |
466 | STR *stab_str(); | |
a687059c LW |
467 | |
468 | int do_each(); | |
469 | int do_subr(); | |
470 | int do_match(); | |
471 | int do_unpack(); | |
472 | int eval(); /* this evaluates expressions */ | |
473 | int do_eval(); /* this evaluates eval operator */ | |
474 | int do_assign(); | |
378cc40b LW |
475 | |
476 | SUBR *make_sub(); | |
8d063cd8 LW |
477 | |
478 | FCMD *load_format(); | |
479 | ||
480 | char *scanpat(); | |
481 | char *scansubst(); | |
482 | char *scantrans(); | |
483 | char *scanstr(); | |
484 | char *scanreg(); | |
8d063cd8 LW |
485 | char *str_append_till(); |
486 | char *str_gets(); | |
a687059c | 487 | char *str_grow(); |
8d063cd8 | 488 | |
8d063cd8 LW |
489 | bool do_open(); |
490 | bool do_close(); | |
491 | bool do_print(); | |
378cc40b LW |
492 | bool do_aprint(); |
493 | bool do_exec(); | |
494 | bool do_aexec(); | |
8d063cd8 LW |
495 | |
496 | int do_subst(); | |
378cc40b LW |
497 | int cando(); |
498 | int ingroup(); | |
8d063cd8 | 499 | |
378cc40b LW |
500 | void str_replace(); |
501 | void str_inc(); | |
502 | void str_dec(); | |
8d063cd8 | 503 | void str_free(); |
a687059c | 504 | void stab_clear(); |
378cc40b | 505 | void do_join(); |
378cc40b | 506 | void do_sprintf(); |
a687059c | 507 | void do_accept(); |
ac58e20f | 508 | void do_pipe(); |
a687059c LW |
509 | void do_vecset(); |
510 | void savelist(); | |
511 | void saveitem(); | |
512 | void saveint(); | |
513 | void savelong(); | |
514 | void savesptr(); | |
515 | void savehptr(); | |
516 | void restorelist(); | |
ac58e20f | 517 | void repeatcpy(); |
a687059c LW |
518 | HASH *savehash(); |
519 | ARRAY *saveary(); | |
378cc40b | 520 | |
ac58e20f LW |
521 | EXT char **origargv; |
522 | EXT int origargc; | |
a687059c LW |
523 | EXT line_t subline INIT(0); |
524 | EXT STR *subname INIT(Nullstr); | |
8d063cd8 LW |
525 | EXT int arybase INIT(0); |
526 | ||
527 | struct outrec { | |
378cc40b LW |
528 | line_t o_lines; |
529 | char *o_str; | |
530 | int o_len; | |
8d063cd8 LW |
531 | }; |
532 | ||
533 | EXT struct outrec outrec; | |
534 | EXT struct outrec toprec; | |
535 | ||
a687059c | 536 | EXT STAB *stdinstab INIT(Nullstab); |
8d063cd8 LW |
537 | EXT STAB *last_in_stab INIT(Nullstab); |
538 | EXT STAB *defstab INIT(Nullstab); | |
539 | EXT STAB *argvstab INIT(Nullstab); | |
540 | EXT STAB *envstab INIT(Nullstab); | |
541 | EXT STAB *sigstab INIT(Nullstab); | |
542 | EXT STAB *defoutstab INIT(Nullstab); | |
543 | EXT STAB *curoutstab INIT(Nullstab); | |
544 | EXT STAB *argvoutstab INIT(Nullstab); | |
378cc40b | 545 | EXT STAB *incstab INIT(Nullstab); |
a687059c LW |
546 | EXT STAB *leftstab INIT(Nullstab); |
547 | EXT STAB *amperstab INIT(Nullstab); | |
548 | EXT STAB *rightstab INIT(Nullstab); | |
549 | EXT STAB *DBstab INIT(Nullstab); | |
550 | EXT STAB *DBsub INIT(Nullstab); | |
551 | ||
552 | EXT HASH *defstash; /* main symbol table */ | |
553 | EXT HASH *curstash; /* symbol table for current package */ | |
554 | EXT HASH *debstash; /* symbol table for perldb package */ | |
555 | ||
556 | EXT STR *curstname; /* name of current package */ | |
8d063cd8 LW |
557 | |
558 | EXT STR *freestrroot INIT(Nullstr); | |
378cc40b | 559 | EXT STR *lastretstr INIT(Nullstr); |
a687059c LW |
560 | EXT STR *DBsingle INIT(Nullstr); |
561 | ||
562 | EXT int lastspbase; | |
563 | EXT int lastsize; | |
8d063cd8 | 564 | |
450a55e4 | 565 | EXT char *curpack; |
378cc40b LW |
566 | EXT char *filename; |
567 | EXT char *origfilename; | |
ac58e20f | 568 | EXT FILE * VOLATILE rsfp; |
8d063cd8 | 569 | EXT char buf[1024]; |
a687059c LW |
570 | EXT char *bufptr; |
571 | EXT char *oldbufptr; | |
572 | EXT char *oldoldbufptr; | |
573 | EXT char *bufend; | |
8d063cd8 LW |
574 | |
575 | EXT STR *linestr INIT(Nullstr); | |
576 | ||
ac58e20f | 577 | EXT int record_separator INIT('\n'); |
a687059c | 578 | EXT int rslen INIT(1); |
8d063cd8 | 579 | EXT char *ofs INIT(Nullch); |
a687059c | 580 | EXT int ofslen INIT(0); |
8d063cd8 | 581 | EXT char *ors INIT(Nullch); |
a687059c | 582 | EXT int orslen INIT(0); |
8d063cd8 LW |
583 | EXT char *ofmt INIT(Nullch); |
584 | EXT char *inplace INIT(Nullch); | |
a687059c | 585 | EXT char *nointrp INIT(""); |
8d063cd8 | 586 | |
378cc40b LW |
587 | EXT bool preprocess INIT(FALSE); |
588 | EXT bool minus_n INIT(FALSE); | |
589 | EXT bool minus_p INIT(FALSE); | |
590 | EXT bool minus_a INIT(FALSE); | |
591 | EXT bool doswitches INIT(FALSE); | |
592 | EXT bool dowarn INIT(FALSE); | |
450a55e4 | 593 | EXT bool doextract INIT(FALSE); |
378cc40b LW |
594 | EXT bool allstabs INIT(FALSE); /* init all customary symbols in symbol table?*/ |
595 | EXT bool sawampersand INIT(FALSE); /* must save all match strings */ | |
596 | EXT bool sawstudy INIT(FALSE); /* do fbminstr on all strings */ | |
a687059c LW |
597 | EXT bool sawi INIT(FALSE); /* study must assume case insensitive */ |
598 | EXT bool sawvec INIT(FALSE); | |
ac58e20f | 599 | EXT bool localizing INIT(FALSE); /* are we processing a local() list? */ |
a687059c | 600 | |
ae986130 LW |
601 | #ifdef CSH |
602 | char *cshname INIT(CSH); | |
603 | int cshlen INIT(0); | |
604 | #endif /* CSH */ | |
a687059c LW |
605 | |
606 | #ifdef TAINT | |
607 | EXT bool tainted INIT(FALSE); /* using variables controlled by $< */ | |
608 | #endif | |
378cc40b | 609 | |
450a55e4 | 610 | #ifndef MSDOS |
378cc40b | 611 | #define TMPPATH "/tmp/perl-eXXXXXX" |
450a55e4 LW |
612 | #else |
613 | #define TMPPATH "/tmp/plXXXXXX" | |
614 | #endif /* MSDOS */ | |
378cc40b LW |
615 | EXT char *e_tmpname; |
616 | EXT FILE *e_fp INIT(Nullfp); | |
617 | ||
8d063cd8 | 618 | EXT char tokenbuf[256]; |
a687059c | 619 | EXT int expectterm INIT(TRUE); /* how to interpret ambiguous tokens */ |
ac58e20f | 620 | EXT VOLATILE int in_eval INIT(FALSE); /* trap fatal errors? */ |
a687059c LW |
621 | EXT int multiline INIT(0); /* $*--do strings hold >1 line? */ |
622 | EXT int forkprocess; /* so do_open |- can return proc# */ | |
623 | EXT int do_undump INIT(0); /* -u or dump seen? */ | |
624 | EXT int error_count INIT(0); /* how many errors so far, max 10 */ | |
625 | EXT int multi_start INIT(0); /* 1st line of multi-line string */ | |
626 | EXT int multi_end INIT(0); /* last line of multi-line string */ | |
627 | EXT int multi_open INIT(0); /* delimiter of said string */ | |
628 | EXT int multi_close INIT(0); /* delimiter of said string */ | |
8d063cd8 LW |
629 | |
630 | FILE *popen(); | |
631 | /* char *str_get(); */ | |
632 | STR *interp(); | |
633 | void free_arg(); | |
634 | STIO *stio_new(); | |
635 | ||
636 | EXT struct stat statbuf; | |
a687059c LW |
637 | EXT struct stat statcache; |
638 | STAB *statstab INIT(Nullstab); | |
639 | STR *statname; | |
8d063cd8 | 640 | EXT struct tms timesbuf; |
378cc40b LW |
641 | EXT int uid; |
642 | EXT int euid; | |
a687059c LW |
643 | EXT int gid; |
644 | EXT int egid; | |
378cc40b LW |
645 | UIDTYPE getuid(); |
646 | UIDTYPE geteuid(); | |
647 | GIDTYPE getgid(); | |
648 | GIDTYPE getegid(); | |
649 | EXT int unsafe; | |
8d063cd8 LW |
650 | |
651 | #ifdef DEBUGGING | |
ac58e20f | 652 | EXT VOLATILE int debug INIT(0); |
8d063cd8 | 653 | EXT int dlevel INIT(0); |
a687059c LW |
654 | EXT int dlmax INIT(128); |
655 | EXT char *debname; | |
656 | EXT char *debdelim; | |
d96024cf | 657 | #define YYDEBUG 1 |
8d063cd8 | 658 | #endif |
a687059c | 659 | EXT int perldb INIT(0); |
8d063cd8 | 660 | |
378cc40b LW |
661 | EXT line_t cmdline INIT(NOLINE); |
662 | ||
a687059c | 663 | EXT STR str_undef; |
8d063cd8 LW |
664 | EXT STR str_no; |
665 | EXT STR str_yes; | |
666 | ||
667 | /* runtime control stuff */ | |
668 | ||
669 | EXT struct loop { | |
a687059c LW |
670 | char *loop_label; /* what the loop was called, if anything */ |
671 | int loop_sp; /* stack pointer to copy stuff down to */ | |
8d063cd8 | 672 | jmp_buf loop_env; |
a687059c | 673 | } *loop_stack; |
8d063cd8 LW |
674 | |
675 | EXT int loop_ptr INIT(-1); | |
a687059c | 676 | EXT int loop_max INIT(128); |
8d063cd8 LW |
677 | |
678 | EXT jmp_buf top_env; | |
679 | ||
ac58e20f | 680 | EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */ |
8d063cd8 | 681 | |
450a55e4 LW |
682 | struct ufuncs { |
683 | int (*uf_val)(); | |
684 | int (*uf_set)(); | |
685 | int uf_index; | |
686 | }; | |
687 | ||
a687059c LW |
688 | EXT ARRAY *stack; /* THE STACK */ |
689 | ||
ac58e20f | 690 | EXT ARRAY * VOLATILE savestack; /* to save non-local values on */ |
378cc40b LW |
691 | |
692 | EXT ARRAY *tosave; /* strings to save on recursive subroutine */ | |
693 | ||
a687059c LW |
694 | EXT ARRAY *lineary; /* lines of script for debugger */ |
695 | ||
696 | EXT ARRAY *pidstatary; /* keep pids and statuses by fd for mypopen */ | |
697 | ||
ac58e20f LW |
698 | EXT int *di; /* for tmp use in debuggers */ |
699 | EXT char *dc; | |
700 | EXT short *ds; | |
701 | ||
8d063cd8 | 702 | double atof(); |
a687059c | 703 | long time(); |
8d063cd8 | 704 | struct tm *gmtime(), *localtime(); |
378cc40b LW |
705 | char *mktemp(); |
706 | char *index(), *rindex(); | |
707 | char *strcpy(), *strcat(); | |
8d063cd8 | 708 | |
8d063cd8 | 709 | #ifdef EUNICE |
378cc40b LW |
710 | #define UNLINK unlnk |
711 | int unlnk(); | |
8d063cd8 LW |
712 | #else |
713 | #define UNLINK unlink | |
714 | #endif | |
a687059c LW |
715 | |
716 | #ifndef SETREUID | |
717 | #ifdef SETRESUID | |
718 | #define setreuid(r,e) setresuid(r,e,-1) | |
719 | #define SETREUID | |
720 | #endif | |
721 | #endif | |
722 | #ifndef SETREGID | |
723 | #ifdef SETRESGID | |
724 | #define setregid(r,e) setresgid(r,e,-1) | |
725 | #define SETREGID | |
726 | #endif | |
727 | #endif |