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