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