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