perl 4.0 patch 2: Patch 1 continued
[p5sagit/p5-mst-13.2.git] / perl.h
1 /* $RCSfile: perl.h,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:49:51 $
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.
7  *
8  * $Log:        perl.h,v $
9  * Revision 4.0.1.1  91/04/11  17:49:51  lwall
10  * patch1: hopefully straightened out some of the Xenix mess
11  * 
12  * Revision 4.0  91/03/20  01:37:56  lwall
13  * 4.0 baseline.
14  * 
15  */
16
17 #define VOIDWANT 1
18 #include "config.h"
19
20 #ifdef MSDOS
21 /* This stuff now in the MS-DOS config.h file. */
22 #else /* !MSDOS */
23
24 /*
25  * The following symbols are defined if your operating system supports
26  * functions by that name.  All Unixes I know of support them, thus they
27  * are not checked by the configuration script, but are directly defined
28  * here.
29  */
30 #define HAS_ALARM
31 #define HAS_CHOWN
32 #define HAS_CHROOT
33 #define HAS_FORK
34 #define HAS_GETLOGIN
35 #define HAS_GETPPID
36 #define HAS_KILL
37 #define HAS_LINK
38 #define HAS_PIPE
39 #define HAS_WAIT
40 #define HAS_UMASK
41 /*
42  * The following symbols are defined if your operating system supports
43  * password and group functions in general.  All Unix systems do.
44  */
45 #define HAS_GROUP
46 #define HAS_PASSWD
47
48 #endif /* !MSDOS */
49
50 #if defined(HASVOLATILE) || defined(__STDC__)
51 #define VOLATILE volatile
52 #else
53 #define VOLATILE
54 #endif
55
56 #ifdef IAMSUID
57 #   ifndef TAINT
58 #       define TAINT
59 #   endif
60 #endif
61
62 #ifndef HAS_VFORK
63 #   define vfork fork
64 #endif
65
66 #ifdef HAS_GETPGRP2
67 #   ifndef HAS_GETPGRP
68 #       define HAS_GETPGRP
69 #   endif
70 #   define getpgrp getpgrp2
71 #endif
72
73 #ifdef HAS_SETPGRP2
74 #   ifndef HAS_SETPGRP
75 #       define HAS_SETPGRP
76 #   endif
77 #   define setpgrp setpgrp2
78 #endif
79
80 #include <stdio.h>
81 #include <ctype.h>
82 #include <setjmp.h>
83 #ifndef MSDOS
84 #include <sys/param.h>  /* if this needs types.h we're still wrong */
85 #endif
86 #ifdef __STDC__
87 /* Use all the "standard" definitions */
88 #include <stdlib.h>
89 #include <string.h>
90 #endif /* __STDC__ */
91
92 #if defined(HAS_MEMCMP) && defined(mips) && BYTEORDER == 0x1234
93 #undef HAS_MEMCMP
94 #endif
95
96 #ifdef HAS_MEMCPY
97
98 #  ifndef __STDC__
99 #    ifndef memcpy
100 extern char * memcpy(), *memset();
101 extern int memcmp();
102 #    endif /* ndef memcpy */
103 #  endif /* ndef __STDC__ */
104
105 #define bcopy(s1,s2,l) memcpy(s2,s1,l)
106 #define bzero(s,l) memset(s,0,l)
107 #endif /* HAS_MEMCPY */
108
109 #ifndef HAS_BCMP                /* prefer bcmp slightly 'cuz it doesn't order */
110 #define bcmp(s1,s2,l) memcmp(s1,s2,l)
111 #endif
112
113 #ifndef _TYPES_         /* If types.h defines this it's easy. */
114 #ifndef major           /* Does everyone's types.h define this? */
115 #include <sys/types.h>
116 #endif
117 #endif
118
119 #ifdef I_NETINET_IN
120 #include <netinet/in.h>
121 #endif
122
123 #include <sys/stat.h>
124
125 #ifdef I_TIME
126 #   include <time.h>
127 #endif
128
129 #ifdef I_SYS_TIME
130 #   ifdef SYSTIMEKERNEL
131 #       define KERNEL
132 #   endif
133 #   include <sys/time.h>
134 #   ifdef SYSTIMEKERNEL
135 #       undef KERNEL
136 #   endif
137 #endif
138
139 #ifndef MSDOS
140 #include <sys/times.h>
141 #endif
142
143 #if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
144 #undef HAS_STRERROR
145 #endif
146
147 #include <errno.h>
148 #ifndef MSDOS
149 #ifndef errno
150 extern int errno;     /* ANSI allows errno to be an lvalue expr */
151 #endif
152 #endif
153
154 #ifndef strerror
155 #ifdef HAS_STRERROR
156 char *strerror();
157 #else
158 extern int sys_nerr;
159 extern char *sys_errlist[];
160 #define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
161 #endif
162 #endif
163
164 #ifdef I_SYSIOCTL
165 #ifndef _IOCTL_
166 #include <sys/ioctl.h>
167 #endif
168 #endif
169
170 #if defined(mc300) || defined(mc500) || defined(mc700)  /* MASSCOMP */
171 #ifdef HAS_SOCKETPAIR
172 #undef HAS_SOCKETPAIR
173 #endif
174 #ifdef HAS_NDBM
175 #undef HAS_NDBM
176 #endif
177 #endif
178
179 #ifdef HAS_GDBM
180 #ifdef I_GDBM
181 #include <gdbm.h>
182 #endif
183 #define SOME_DBM
184 #ifdef HAS_NDBM
185 #undef HAS_NDBM
186 #endif
187 #ifdef HAS_ODBM
188 #undef HAS_ODBM
189 #endif
190 #else
191 #ifdef HAS_NDBM
192 #include <ndbm.h>
193 #define SOME_DBM
194 #ifdef HAS_ODBM
195 #undef HAS_ODBM
196 #endif
197 #else
198 #ifdef HAS_ODBM
199 #ifdef NULL
200 #undef NULL             /* suppress redefinition message */
201 #endif
202 #include <dbm.h>
203 #ifdef NULL
204 #undef NULL
205 #endif
206 #define NULL 0          /* silly thing is, we don't even use this */
207 #define SOME_DBM
208 #define dbm_fetch(db,dkey) fetch(dkey)
209 #define dbm_delete(db,dkey) delete(dkey)
210 #define dbm_store(db,dkey,dcontent,flags) store(dkey,dcontent)
211 #define dbm_close(db) dbmclose()
212 #define dbm_firstkey(db) firstkey()
213 #endif /* HAS_ODBM */
214 #endif /* HAS_NDBM */
215 #endif /* HAS_GDBM */
216 #ifdef SOME_DBM
217 EXT char *dbmkey;
218 EXT int dbmlen;
219 #endif
220
221 #if INTSIZE == 2
222 #define htoni htons
223 #define ntohi ntohs
224 #else
225 #define htoni htonl
226 #define ntohi ntohl
227 #endif
228
229 #if defined(I_DIRENT)
230 #   include <dirent.h>
231 #   define DIRENT dirent
232 #else
233 #   ifdef I_SYS_NDIR
234 #       include <sys/ndir.h>
235 #       define DIRENT direct
236 #   else
237 #       ifdef I_SYS_DIR
238 #           ifdef hp9000s500
239 #               include <ndir.h>        /* may be wrong in the future */
240 #           else
241 #               include <sys/dir.h>
242 #           endif
243 #           define DIRENT direct
244 #       endif
245 #   endif
246 #endif
247
248 /*
249  * The following gobbledygook brought to you on behalf of __STDC__.
250  * (I could just use #ifndef __STDC__, but this is more bulletproof
251  * in the face of half-implementations.)
252  */
253
254 #ifndef S_IFMT
255 #   ifdef _S_IFMT
256 #       define S_IFMT _S_IFMT
257 #   else
258 #       define S_IFMT 0170000
259 #   endif
260 #endif
261
262 #ifndef S_ISDIR
263 #   define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
264 #endif
265
266 #ifndef S_ISCHR
267 #   define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
268 #endif
269
270 #ifndef S_ISBLK
271 #   ifdef S_IFBLK
272 #       define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
273 #   else
274 #       define S_ISBLK(m) (0)
275 #   endif
276 #endif
277
278 #ifndef S_ISREG
279 #   define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
280 #endif
281
282 #ifndef S_ISFIFO
283 #   ifdef S_IFIFO
284 #       define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
285 #   else
286 #       define S_ISFIFO(m) (0)
287 #   endif
288 #endif
289
290 #ifndef S_ISLNK
291 #   ifdef _S_ISLNK
292 #       define S_ISLNK(m) _S_ISLNK(m)
293 #   else
294 #       ifdef _S_IFLNK
295 #           define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
296 #       else
297 #           ifdef S_IFLNK
298 #               define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
299 #           else
300 #               define S_ISLNK(m) (0)
301 #           endif
302 #       endif
303 #   endif
304 #endif
305
306 #ifndef S_ISSOCK
307 #   ifdef _S_ISSOCK
308 #       define S_ISSOCK(m) _S_ISSOCK(m)
309 #   else
310 #       ifdef _S_IFSOCK
311 #           define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
312 #       else
313 #           ifdef S_IFSOCK
314 #               define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
315 #           else
316 #               define S_ISSOCK(m) (0)
317 #           endif
318 #       endif
319 #   endif
320 #endif
321
322 #ifndef S_IRUSR
323 #   ifdef S_IREAD
324 #       define S_IRUSR S_IREAD
325 #       define S_IWUSR S_IWRITE
326 #       define S_IXUSR S_IEXEC
327 #   else
328 #       define S_IRUSR 0400
329 #       define S_IWUSR 0200
330 #       define S_IXUSR 0100
331 #   endif
332 #   define S_IRGRP (S_IRUSR>>3)
333 #   define S_IWGRP (S_IWUSR>>3)
334 #   define S_IXGRP (S_IXUSR>>3)
335 #   define S_IROTH (S_IRUSR>>6)
336 #   define S_IWOTH (S_IWUSR>>6)
337 #   define S_IXOTH (S_IXUSR>>6)
338 #endif
339
340 #ifndef S_ISUID
341 #   define S_ISUID 04000
342 #endif
343
344 #ifndef S_ISGID
345 #   define S_ISGID 02000
346 #endif
347
348 typedef unsigned int STRLEN;
349
350 typedef struct arg ARG;
351 typedef struct cmd CMD;
352 typedef struct formcmd FCMD;
353 typedef struct scanpat SPAT;
354 typedef struct stio STIO;
355 typedef struct sub SUBR;
356 typedef struct string STR;
357 typedef struct atbl ARRAY;
358 typedef struct htbl HASH;
359 typedef struct regexp REGEXP;
360 typedef struct stabptrs STBP;
361 typedef struct stab STAB;
362 typedef struct callsave CSV;
363
364 #include "handy.h"
365 #include "regexp.h"
366 #include "str.h"
367 #include "util.h"
368 #include "form.h"
369 #include "stab.h"
370 #include "spat.h"
371 #include "arg.h"
372 #include "cmd.h"
373 #include "array.h"
374 #include "hash.h"
375
376 #if defined(iAPX286) || defined(M_I286) || defined(I80286)
377 #   define I286
378 #endif
379
380 #ifndef __STDC__
381 #ifdef CHARSPRINTF
382     char *sprintf();
383 #else
384     int sprintf();
385 #endif
386 #endif
387
388 EXT char *Yes INIT("1");
389 EXT char *No INIT("");
390
391 /* "gimme" values */
392
393 /* Note: cmd.c assumes that it can use && to produce one of these values! */
394 #define G_SCALAR 0
395 #define G_ARRAY 1
396
397 #ifdef CRIPPLED_CC
398 int str_true();
399 #else /* !CRIPPLED_CC */
400 #define str_true(str) (Str = (str), \
401         (Str->str_pok ? \
402             ((*Str->str_ptr > '0' || \
403               Str->str_cur > 1 || \
404               (Str->str_cur && *Str->str_ptr != '0')) ? 1 : 0) \
405         : \
406             (Str->str_nok ? (Str->str_u.str_nval != 0.0) : 0 ) ))
407 #endif /* CRIPPLED_CC */
408
409 #ifdef DEBUGGING
410 #define str_peek(str) (Str = (str), \
411         (Str->str_pok ? \
412             Str->str_ptr : \
413             (Str->str_nok ? \
414                 (sprintf(tokenbuf,"num(%g)",Str->str_u.str_nval), \
415                     (char*)tokenbuf) : \
416                 "" )))
417 #endif
418
419 #ifdef CRIPPLED_CC
420 char *str_get();
421 #else
422 #ifdef TAINT
423 #define str_get(str) (Str = (str), tainted |= Str->str_tainted, \
424         (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
425 #else
426 #define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
427 #endif /* TAINT */
428 #endif /* CRIPPLED_CC */
429
430 #ifdef CRIPPLED_CC
431 double str_gnum();
432 #else /* !CRIPPLED_CC */
433 #ifdef TAINT
434 #define str_gnum(str) (Str = (str), tainted |= Str->str_tainted, \
435         (Str->str_nok ? Str->str_u.str_nval : str_2num(Str)))
436 #else /* !TAINT */
437 #define str_gnum(str) (Str = (str), (Str->str_nok ? Str->str_u.str_nval : str_2num(Str)))
438 #endif /* TAINT*/
439 #endif /* CRIPPLED_CC */
440 EXT STR *Str;
441
442 #define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
443
444 #ifndef MSDOS
445 #define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len)
446 #define Str_Grow str_grow
447 #else
448 /* extra parentheses intentionally NOT placed around "len"! */
449 #define STR_GROW(str,len) if ((str)->str_len < (unsigned long)len) \
450                 str_grow(str,(unsigned long)len)
451 #define Str_Grow(str,len) str_grow(str,(unsigned long)(len))
452 #endif /* MSDOS */
453
454 #ifndef BYTEORDER
455 #define BYTEORDER 0x1234
456 #endif
457
458 #if defined(htonl) && !defined(HAS_HTONL)
459 #define HAS_HTONL
460 #endif
461 #if defined(htons) && !defined(HAS_HTONS)
462 #define HAS_HTONS
463 #endif
464 #if defined(ntohl) && !defined(HAS_NTOHL)
465 #define HAS_NTOHL
466 #endif
467 #if defined(ntohs) && !defined(HAS_NTOHS)
468 #define HAS_NTOHS
469 #endif
470 #ifndef HAS_HTONL
471 #if (BYTEORDER & 0xffff) != 0x4321
472 #define HAS_HTONS
473 #define HAS_HTONL
474 #define HAS_NTOHS
475 #define HAS_NTOHL
476 #define MYSWAP
477 #define htons my_swap
478 #define htonl my_htonl
479 #define ntohs my_swap
480 #define ntohl my_ntohl
481 #endif
482 #else
483 #if (BYTEORDER & 0xffff) == 0x4321
484 #undef HAS_HTONS
485 #undef HAS_HTONL
486 #undef HAS_NTOHS
487 #undef HAS_NTOHL
488 #endif
489 #endif
490
491 #ifdef CASTNEGFLOAT
492 #define U_S(what) ((unsigned short)(what))
493 #define U_I(what) ((unsigned int)(what))
494 #define U_L(what) ((unsigned long)(what))
495 #else
496 unsigned long castulong();
497 #define U_S(what) ((unsigned int)castulong(what))
498 #define U_I(what) ((unsigned int)castulong(what))
499 #define U_L(what) (castulong(what))
500 #endif
501
502 CMD *add_label();
503 CMD *block_head();
504 CMD *append_line();
505 CMD *make_acmd();
506 CMD *make_ccmd();
507 CMD *make_icmd();
508 CMD *invert();
509 CMD *addcond();
510 CMD *addloop();
511 CMD *wopt();
512 CMD *over();
513
514 STAB *stabent();
515 STAB *genstab();
516
517 ARG *stab2arg();
518 ARG *op_new();
519 ARG *make_op();
520 ARG *make_match();
521 ARG *make_split();
522 ARG *rcatmaybe();
523 ARG *listish();
524 ARG *maybelistish();
525 ARG *localize();
526 ARG *fixeval();
527 ARG *jmaybe();
528 ARG *l();
529 ARG *fixl();
530 ARG *mod_match();
531 ARG *make_list();
532 ARG *cmd_to_arg();
533 ARG *addflags();
534 ARG *hide_ary();
535 ARG *cval_to_arg();
536
537 STR *str_new();
538 STR *stab_str();
539
540 int do_each();
541 int do_subr();
542 int do_match();
543 int do_unpack();
544 int eval();             /* this evaluates expressions */
545 int do_eval();          /* this evaluates eval operator */
546 int do_assign();
547
548 SUBR *make_sub();
549
550 FCMD *load_format();
551
552 char *scanpat();
553 char *scansubst();
554 char *scantrans();
555 char *scanstr();
556 char *scanident();
557 char *str_append_till();
558 char *str_gets();
559 char *str_grow();
560
561 bool do_open();
562 bool do_close();
563 bool do_print();
564 bool do_aprint();
565 bool do_exec();
566 bool do_aexec();
567
568 int do_subst();
569 int cando();
570 int ingroup();
571
572 void str_replace();
573 void str_inc();
574 void str_dec();
575 void str_free();
576 void stab_clear();
577 void do_join();
578 void do_sprintf();
579 void do_accept();
580 void do_pipe();
581 void do_vecset();
582 void do_unshift();
583 void do_execfree();
584 void magicalize();
585 void magicname();
586 void savelist();
587 void saveitem();
588 void saveint();
589 void savelong();
590 void savesptr();
591 void savehptr();
592 void restorelist();
593 void repeatcpy();
594 HASH *savehash();
595 ARRAY *saveary();
596
597 EXT char **origargv;
598 EXT int origargc;
599 EXT char **origenviron;
600 extern char **environ;
601
602 EXT line_t subline INIT(0);
603 EXT STR *subname INIT(Nullstr);
604 EXT int arybase INIT(0);
605
606 struct outrec {
607     long        o_lines;
608     char        *o_str;
609     int         o_len;
610 };
611
612 EXT struct outrec outrec;
613 EXT struct outrec toprec;
614
615 EXT STAB *stdinstab INIT(Nullstab);
616 EXT STAB *last_in_stab INIT(Nullstab);
617 EXT STAB *defstab INIT(Nullstab);
618 EXT STAB *argvstab INIT(Nullstab);
619 EXT STAB *envstab INIT(Nullstab);
620 EXT STAB *sigstab INIT(Nullstab);
621 EXT STAB *defoutstab INIT(Nullstab);
622 EXT STAB *curoutstab INIT(Nullstab);
623 EXT STAB *argvoutstab INIT(Nullstab);
624 EXT STAB *incstab INIT(Nullstab);
625 EXT STAB *leftstab INIT(Nullstab);
626 EXT STAB *amperstab INIT(Nullstab);
627 EXT STAB *rightstab INIT(Nullstab);
628 EXT STAB *DBstab INIT(Nullstab);
629 EXT STAB *DBline INIT(Nullstab);
630 EXT STAB *DBsub INIT(Nullstab);
631
632 EXT HASH *defstash;             /* main symbol table */
633 EXT HASH *curstash;             /* symbol table for current package */
634 EXT HASH *debstash;             /* symbol table for perldb package */
635
636 EXT STR *curstname;             /* name of current package */
637
638 EXT STR *freestrroot INIT(Nullstr);
639 EXT STR *lastretstr INIT(Nullstr);
640 EXT STR *DBsingle INIT(Nullstr);
641 EXT STR *DBtrace INIT(Nullstr);
642 EXT STR *DBsignal INIT(Nullstr);
643
644 EXT int lastspbase;
645 EXT int lastsize;
646
647 EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEF");
648 EXT char *origfilename;
649 EXT FILE * VOLATILE rsfp;
650 EXT char buf[1024];
651 EXT char *bufptr;
652 EXT char *oldbufptr;
653 EXT char *oldoldbufptr;
654 EXT char *bufend;
655
656 EXT STR *linestr INIT(Nullstr);
657
658 EXT char *rs INIT("\n");
659 EXT int rschar INIT('\n');      /* final char of rs, or 0777 if none */
660 EXT int rslen INIT(1);
661 EXT char *ofs INIT(Nullch);
662 EXT int ofslen INIT(0);
663 EXT char *ors INIT(Nullch);
664 EXT int orslen INIT(0);
665 EXT char *ofmt INIT(Nullch);
666 EXT char *inplace INIT(Nullch);
667 EXT char *nointrp INIT("");
668
669 EXT bool preprocess INIT(FALSE);
670 EXT bool minus_n INIT(FALSE);
671 EXT bool minus_p INIT(FALSE);
672 EXT bool minus_l INIT(FALSE);
673 EXT bool minus_a INIT(FALSE);
674 EXT bool doswitches INIT(FALSE);
675 EXT bool dowarn INIT(FALSE);
676 EXT bool doextract INIT(FALSE);
677 EXT bool allstabs INIT(FALSE);  /* init all customary symbols in symbol table?*/
678 EXT bool sawampersand INIT(FALSE);      /* must save all match strings */
679 EXT bool sawstudy INIT(FALSE);          /* do fbminstr on all strings */
680 EXT bool sawi INIT(FALSE);              /* study must assume case insensitive */
681 EXT bool sawvec INIT(FALSE);
682 EXT bool localizing INIT(FALSE);        /* are we processing a local() list? */
683
684 #ifdef CSH
685 char *cshname INIT(CSH);
686 int cshlen INIT(0);
687 #endif /* CSH */
688
689 #ifdef TAINT
690 EXT bool tainted INIT(FALSE);           /* using variables controlled by $< */
691 #endif
692
693 #ifndef MSDOS
694 #define TMPPATH "/tmp/perl-eXXXXXX"
695 #else
696 #define TMPPATH "plXXXXXX"
697 #endif /* MSDOS */
698 EXT char *e_tmpname;
699 EXT FILE *e_fp INIT(Nullfp);
700
701 EXT char tokenbuf[256];
702 EXT int expectterm INIT(TRUE);          /* how to interpret ambiguous tokens */
703 EXT VOLATILE int in_eval INIT(FALSE);   /* trap fatal errors? */
704 EXT int multiline INIT(0);              /* $*--do strings hold >1 line? */
705 EXT int forkprocess;                    /* so do_open |- can return proc# */
706 EXT int do_undump INIT(0);              /* -u or dump seen? */
707 EXT int error_count INIT(0);            /* how many errors so far, max 10 */
708 EXT int multi_start INIT(0);            /* 1st line of multi-line string */
709 EXT int multi_end INIT(0);              /* last line of multi-line string */
710 EXT int multi_open INIT(0);             /* delimiter of said string */
711 EXT int multi_close INIT(0);            /* delimiter of said string */
712
713 FILE *popen();
714 /* char *str_get(); */
715 STR *interp();
716 void free_arg();
717 STIO *stio_new();
718
719 EXT struct stat statbuf;
720 EXT struct stat statcache;
721 STAB *statstab INIT(Nullstab);
722 STR *statname;
723 #ifndef MSDOS
724 EXT struct tms timesbuf;
725 #endif
726 EXT int uid;
727 EXT int euid;
728 EXT int gid;
729 EXT int egid;
730 UIDTYPE getuid();
731 UIDTYPE geteuid();
732 GIDTYPE getgid();
733 GIDTYPE getegid();
734 EXT int unsafe;
735
736 #ifdef DEBUGGING
737 EXT VOLATILE int debug INIT(0);
738 EXT int dlevel INIT(0);
739 EXT int dlmax INIT(128);
740 EXT char *debname;
741 EXT char *debdelim;
742 #define YYDEBUG 1
743 #endif
744 EXT int perldb INIT(0);
745 #define YYMAXDEPTH 300
746
747 EXT line_t cmdline INIT(NOLINE);
748
749 EXT STR str_undef;
750 EXT STR str_no;
751 EXT STR str_yes;
752
753 /* runtime control stuff */
754
755 EXT struct loop {
756     char *loop_label;           /* what the loop was called, if anything */
757     int loop_sp;                /* stack pointer to copy stuff down to */
758     jmp_buf loop_env;
759 } *loop_stack;
760
761 EXT int loop_ptr INIT(-1);
762 EXT int loop_max INIT(128);
763
764 EXT jmp_buf top_env;
765
766 EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
767
768 struct ufuncs {
769     int (*uf_val)();
770     int (*uf_set)();
771     int uf_index;
772 };
773
774 EXT ARRAY *stack;               /* THE STACK */
775
776 EXT ARRAY * VOLATILE savestack;         /* to save non-local values on */
777
778 EXT ARRAY *tosave;              /* strings to save on recursive subroutine */
779
780 EXT ARRAY *lineary;             /* lines of script for debugger */
781 EXT ARRAY *dbargs;              /* args to call listed by caller function */
782
783 EXT ARRAY *fdpid;               /* keep fd-to-pid mappings for mypopen */
784 EXT HASH *pidstatus;            /* keep pid-to-status mappings for waitpid */
785
786 EXT int *di;                    /* for tmp use in debuggers */
787 EXT char *dc;
788 EXT short *ds;
789
790 /* Fix these up for __STDC__ */
791 EXT long basetime INIT(0);
792 char *mktemp();
793 #ifndef __STDC__
794 /* All of these are in stdlib.h or time.h for ANSI C */
795 double atof();
796 long time();
797 struct tm *gmtime(), *localtime();
798 char *index(), *rindex();
799 char *strcpy(), *strcat();
800 #endif /* ! __STDC__ */
801
802 #ifdef EUNICE
803 #define UNLINK unlnk
804 int unlnk();
805 #else
806 #define UNLINK unlink
807 #endif
808
809 #ifndef HAS_SETREUID
810 #ifdef HAS_SETRESUID
811 #define setreuid(r,e) setresuid(r,e,-1)
812 #define HAS_SETREUID
813 #endif
814 #endif
815 #ifndef HAS_SETREGID
816 #ifdef HAS_SETRESGID
817 #define setregid(r,e) setresgid(r,e,-1)
818 #define HAS_SETREGID
819 #endif
820 #endif