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