This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 4.0 patch 1: (combined patch)
[perl5.git] / perl.h
CommitLineData
fe14fcc3 1/* $Header: perl.h,v 4.0 91/03/20 01:37:56 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 $
fe14fcc3
LW
9 * Revision 4.0 91/03/20 01:37:56 lwall
10 * 4.0 baseline.
8d063cd8
LW
11 *
12 */
13
ac58e20f
LW
14#define VOIDUSED 1
15#include "config.h"
16
0f85fab0 17#ifdef MSDOS
fe14fcc3 18/* This stuff now in the MS-DOS config.h file. */
0f85fab0
LW
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 */
fe14fcc3
LW
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
0f85fab0
LW
38/*
39 * The following symbols are defined if your operating system supports
40 * password and group functions in general. All Unix systems do.
41 */
fe14fcc3
LW
42#define HAS_GROUP
43#define HAS_PASSWD
0f85fab0
LW
44
45#endif /* !MSDOS */
46
ac58e20f 47#if defined(HASVOLATILE) || defined(__STDC__)
663a0e37 48#define VOLATILE volatile
663a0e37
LW
49#else
50#define VOLATILE
663a0e37
LW
51#endif
52
a687059c
LW
53#ifdef IAMSUID
54# ifndef TAINT
55# define TAINT
56# endif
57#endif
58
fe14fcc3 59#ifndef HAS_VFORK
03a14243
LW
60# define vfork fork
61#endif
62
fe14fcc3
LW
63#ifdef HAS_GETPGRP2
64# ifndef HAS_GETPGRP
65# define HAS_GETPGRP
663a0e37
LW
66# endif
67# define getpgrp getpgrp2
68#endif
69
fe14fcc3
LW
70#ifdef HAS_SETPGRP2
71# ifndef HAS_SETPGRP
72# define HAS_SETPGRP
663a0e37
LW
73# endif
74# define setpgrp setpgrp2
75#endif
76
fe14fcc3
LW
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 */
03a14243 82#endif
fe14fcc3
LW
83#ifdef __STDC__
84/* Use all the "standard" definitions */
85#include <stdlib.h>
86#include <string.h>
87#endif /* __STDC__ */
03a14243 88
fe14fcc3
LW
89#if defined(HAS_MEMCMP) && defined(mips) && BYTEORDER == 0x1234
90#undef HAS_MEMCMP
663a0e37 91#endif
fe14fcc3
LW
92
93#ifdef HAS_MEMCPY
94
95# ifndef __STDC__
96# ifndef memcpy
97extern char * memcpy(), *memset();
450a55e4 98extern int memcmp();
fe14fcc3
LW
99# endif /* ndef memcpy */
100# endif /* ndef __STDC__ */
101
a687059c
LW
102#define bcopy(s1,s2,l) memcpy(s2,s1,l)
103#define bzero(s,l) memset(s,0,l)
fe14fcc3 104#endif /* HAS_MEMCPY */
8d063cd8 105
fe14fcc3
LW
106#ifndef HAS_BCMP /* prefer bcmp slightly 'cuz it doesn't order */
107#define bcmp(s1,s2,l) memcmp(s1,s2,l)
d9d8d8de 108#endif
378cc40b
LW
109
110#ifndef _TYPES_ /* If types.h defines this it's easy. */
111#ifndef major /* Does everyone's types.h define this? */
8d063cd8 112#include <sys/types.h>
378cc40b
LW
113#endif
114#endif
115
ae986130
LW
116#ifdef I_NETINET_IN
117#include <netinet/in.h>
118#endif
119
8d063cd8 120#include <sys/stat.h>
135863df 121
663a0e37
LW
122#ifdef I_TIME
123# include <time.h>
ffed7fef 124#endif
663a0e37 125
fe14fcc3 126#ifdef I_SYS_TIME
663a0e37
LW
127# ifdef SYSTIMEKERNEL
128# define KERNEL
129# endif
130# include <sys/time.h>
131# ifdef SYSTIMEKERNEL
132# undef KERNEL
133# endif
a687059c 134#endif
135863df 135
d9d8d8de 136#ifndef MSDOS
8d063cd8 137#include <sys/times.h>
d9d8d8de 138#endif
8d063cd8 139
fe14fcc3
LW
140#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
141#undef HAS_STRERROR
663a0e37
LW
142#endif
143
144#include <errno.h>
d9d8d8de 145#ifndef MSDOS
663a0e37
LW
146#ifndef errno
147extern int errno; /* ANSI allows errno to be an lvalue expr */
148#endif
d9d8d8de 149#endif
663a0e37 150
fe14fcc3 151#ifdef HAS_STRERROR
663a0e37
LW
152char *strerror();
153#else
154extern int sys_nerr;
155extern char *sys_errlist[];
156#define strerror(e) ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
157#endif
158
a687059c
LW
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 */
fe14fcc3
LW
166#ifdef HAS_SOCKETPAIR
167#undef HAS_SOCKETPAIR
a687059c 168#endif
fe14fcc3
LW
169#ifdef HAS_NDBM
170#undef HAS_NDBM
a687059c
LW
171#endif
172#endif
173
fe14fcc3
LW
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
a687059c
LW
187#include <ndbm.h>
188#define SOME_DBM
fe14fcc3
LW
189#ifdef HAS_ODBM
190#undef HAS_ODBM
ae986130 191#endif
a687059c 192#else
fe14fcc3 193#ifdef HAS_ODBM
a687059c
LW
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()
fe14fcc3
LW
208#endif /* HAS_ODBM */
209#endif /* HAS_NDBM */
210#endif /* HAS_GDBM */
a687059c
LW
211#ifdef SOME_DBM
212EXT char *dbmkey;
213EXT 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
79a0689e 224#if defined(I_DIRENT) && !defined(M_XENIX)
663a0e37
LW
225# include <dirent.h>
226# define DIRENT dirent
ae986130 227#else
fe14fcc3 228# ifdef I_SYS_NDIR
79a0689e 229# include <sys/ndir.h>
663a0e37
LW
230# define DIRENT direct
231# else
fe14fcc3 232# ifdef I_SYS_DIR
79a0689e
LW
233# ifdef hp9000s500
234# include <ndir.h> /* may be wrong in the future */
235# else
236# include <sys/dir.h>
237# endif
663a0e37
LW
238# define DIRENT direct
239# endif
240# endif
a687059c
LW
241#endif
242
c623bd54
LW
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
fe14fcc3
LW
266# ifdef S_IFBLK
267# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
268# else
269# define S_ISBLK(m) (0)
270# endif
c623bd54
LW
271#endif
272
273#ifndef S_ISREG
274# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
275#endif
276
277#ifndef S_ISFIFO
fe14fcc3
LW
278# ifdef S_IFIFO
279# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
280# else
281# define S_ISFIFO(m) (0)
282# endif
c623bd54
LW
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
450a55e4
LW
343typedef unsigned int STRLEN;
344
8d063cd8
LW
345typedef struct arg ARG;
346typedef struct cmd CMD;
347typedef struct formcmd FCMD;
348typedef struct scanpat SPAT;
8d063cd8 349typedef struct stio STIO;
378cc40b 350typedef struct sub SUBR;
8d063cd8
LW
351typedef struct string STR;
352typedef struct atbl ARRAY;
353typedef struct htbl HASH;
378cc40b 354typedef struct regexp REGEXP;
a687059c
LW
355typedef struct stabptrs STBP;
356typedef struct stab STAB;
d9d8d8de 357typedef struct callsave CSV;
8d063cd8 358
378cc40b
LW
359#include "handy.h"
360#include "regexp.h"
8d063cd8 361#include "str.h"
378cc40b 362#include "util.h"
8d063cd8
LW
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
450a55e4 371#if defined(iAPX286) || defined(M_I286) || defined(I80286)
a687059c
LW
372# define I286
373#endif
374
375#ifndef __STDC__
135863df
AB
376#ifdef CHARSPRINTF
377 char *sprintf();
378#else
379 int sprintf();
380#endif
a687059c 381#endif
135863df 382
8d063cd8
LW
383EXT char *Yes INIT("1");
384EXT char *No INIT("");
385
a687059c
LW
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
393int 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 */
8d063cd8 403
135863df 404#ifdef DEBUGGING
a687059c
LW
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 "" )))
135863df
AB
412#endif
413
a687059c
LW
414#ifdef CRIPPLED_CC
415char *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
8d063cd8 421#define str_get(str) (Str = (str), (Str->str_pok ? Str->str_ptr : str_2ptr(Str)))
a687059c
LW
422#endif /* TAINT */
423#endif /* CRIPPLED_CC */
424
425#ifdef CRIPPLED_CC
426double 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 */
8d063cd8
LW
435EXT STR *Str;
436
437#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
438
450a55e4 439#ifndef MSDOS
a687059c 440#define STR_GROW(str,len) if ((str)->str_len < (len)) str_grow(str,len)
450a55e4
LW
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 */
a687059c
LW
448
449#ifndef BYTEORDER
ffed7fef 450#define BYTEORDER 0x1234
a687059c
LW
451#endif
452
fe14fcc3
LW
453#if defined(htonl) && !defined(HAS_HTONL)
454#define HAS_HTONL
ae986130 455#endif
fe14fcc3
LW
456#if defined(htons) && !defined(HAS_HTONS)
457#define HAS_HTONS
ae986130 458#endif
fe14fcc3
LW
459#if defined(ntohl) && !defined(HAS_NTOHL)
460#define HAS_NTOHL
ae986130 461#endif
fe14fcc3
LW
462#if defined(ntohs) && !defined(HAS_NTOHS)
463#define HAS_NTOHS
ae986130 464#endif
fe14fcc3 465#ifndef HAS_HTONL
d9d8d8de 466#if (BYTEORDER & 0xffff) != 0x4321
fe14fcc3
LW
467#define HAS_HTONS
468#define HAS_HTONL
469#define HAS_NTOHS
470#define HAS_NTOHL
a687059c
LW
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
d9d8d8de 478#if (BYTEORDER & 0xffff) == 0x4321
fe14fcc3
LW
479#undef HAS_HTONS
480#undef HAS_HTONL
481#undef HAS_NTOHS
482#undef HAS_NTOHL
a687059c
LW
483#endif
484#endif
485
0f85fab0
LW
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
491unsigned 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
8d063cd8
LW
497CMD *add_label();
498CMD *block_head();
499CMD *append_line();
500CMD *make_acmd();
501CMD *make_ccmd();
a687059c 502CMD *make_icmd();
8d063cd8
LW
503CMD *invert();
504CMD *addcond();
505CMD *addloop();
506CMD *wopt();
378cc40b 507CMD *over();
8d063cd8 508
8d063cd8 509STAB *stabent();
378cc40b 510STAB *genstab();
8d063cd8 511
378cc40b 512ARG *stab2arg();
8d063cd8
LW
513ARG *op_new();
514ARG *make_op();
8d063cd8
LW
515ARG *make_match();
516ARG *make_split();
a687059c 517ARG *rcatmaybe();
378cc40b 518ARG *listish();
a687059c 519ARG *maybelistish();
378cc40b 520ARG *localize();
a687059c
LW
521ARG *fixeval();
522ARG *jmaybe();
378cc40b 523ARG *l();
a687059c 524ARG *fixl();
378cc40b
LW
525ARG *mod_match();
526ARG *make_list();
527ARG *cmd_to_arg();
528ARG *addflags();
529ARG *hide_ary();
530ARG *cval_to_arg();
8d063cd8 531
8d063cd8
LW
532STR *str_new();
533STR *stab_str();
a687059c
LW
534
535int do_each();
536int do_subr();
537int do_match();
538int do_unpack();
539int eval(); /* this evaluates expressions */
540int do_eval(); /* this evaluates eval operator */
541int do_assign();
378cc40b
LW
542
543SUBR *make_sub();
8d063cd8
LW
544
545FCMD *load_format();
546
547char *scanpat();
548char *scansubst();
549char *scantrans();
550char *scanstr();
fe14fcc3 551char *scanident();
8d063cd8
LW
552char *str_append_till();
553char *str_gets();
a687059c 554char *str_grow();
8d063cd8 555
8d063cd8
LW
556bool do_open();
557bool do_close();
558bool do_print();
378cc40b
LW
559bool do_aprint();
560bool do_exec();
561bool do_aexec();
8d063cd8
LW
562
563int do_subst();
378cc40b
LW
564int cando();
565int ingroup();
8d063cd8 566
378cc40b
LW
567void str_replace();
568void str_inc();
569void str_dec();
8d063cd8 570void str_free();
a687059c 571void stab_clear();
378cc40b 572void do_join();
378cc40b 573void do_sprintf();
a687059c 574void do_accept();
ac58e20f 575void do_pipe();
a687059c 576void do_vecset();
fe14fcc3
LW
577void do_unshift();
578void do_execfree();
579void magicalize();
580void magicname();
a687059c
LW
581void savelist();
582void saveitem();
583void saveint();
584void savelong();
585void savesptr();
586void savehptr();
587void restorelist();
ac58e20f 588void repeatcpy();
a687059c
LW
589HASH *savehash();
590ARRAY *saveary();
378cc40b 591
ac58e20f
LW
592EXT char **origargv;
593EXT int origargc;
fe14fcc3 594EXT char **origenviron;
a687059c
LW
595EXT line_t subline INIT(0);
596EXT STR *subname INIT(Nullstr);
8d063cd8
LW
597EXT int arybase INIT(0);
598
599struct outrec {
d9d8d8de
LW
600 long o_lines;
601 char *o_str;
602 int o_len;
8d063cd8
LW
603};
604
605EXT struct outrec outrec;
606EXT struct outrec toprec;
607
a687059c 608EXT STAB *stdinstab INIT(Nullstab);
8d063cd8
LW
609EXT STAB *last_in_stab INIT(Nullstab);
610EXT STAB *defstab INIT(Nullstab);
611EXT STAB *argvstab INIT(Nullstab);
612EXT STAB *envstab INIT(Nullstab);
613EXT STAB *sigstab INIT(Nullstab);
614EXT STAB *defoutstab INIT(Nullstab);
615EXT STAB *curoutstab INIT(Nullstab);
616EXT STAB *argvoutstab INIT(Nullstab);
378cc40b 617EXT STAB *incstab INIT(Nullstab);
a687059c
LW
618EXT STAB *leftstab INIT(Nullstab);
619EXT STAB *amperstab INIT(Nullstab);
620EXT STAB *rightstab INIT(Nullstab);
621EXT STAB *DBstab INIT(Nullstab);
d9d8d8de 622EXT STAB *DBline INIT(Nullstab);
a687059c
LW
623EXT STAB *DBsub INIT(Nullstab);
624
625EXT HASH *defstash; /* main symbol table */
626EXT HASH *curstash; /* symbol table for current package */
627EXT HASH *debstash; /* symbol table for perldb package */
628
629EXT STR *curstname; /* name of current package */
8d063cd8
LW
630
631EXT STR *freestrroot INIT(Nullstr);
378cc40b 632EXT STR *lastretstr INIT(Nullstr);
a687059c 633EXT STR *DBsingle INIT(Nullstr);
d9d8d8de
LW
634EXT STR *DBtrace INIT(Nullstr);
635EXT STR *DBsignal INIT(Nullstr);
a687059c
LW
636
637EXT int lastspbase;
638EXT int lastsize;
8d063cd8 639
fe14fcc3 640EXT char *hexdigit INIT("0123456789abcdef0123456789ABCDEF");
378cc40b 641EXT char *origfilename;
ac58e20f 642EXT FILE * VOLATILE rsfp;
8d063cd8 643EXT char buf[1024];
a687059c
LW
644EXT char *bufptr;
645EXT char *oldbufptr;
646EXT char *oldoldbufptr;
647EXT char *bufend;
8d063cd8
LW
648
649EXT STR *linestr INIT(Nullstr);
650
fe14fcc3
LW
651EXT char *rs INIT("\n");
652EXT int rschar INIT('\n'); /* final char of rs, or 0777 if none */
a687059c 653EXT int rslen INIT(1);
8d063cd8 654EXT char *ofs INIT(Nullch);
a687059c 655EXT int ofslen INIT(0);
8d063cd8 656EXT char *ors INIT(Nullch);
a687059c 657EXT int orslen INIT(0);
8d063cd8
LW
658EXT char *ofmt INIT(Nullch);
659EXT char *inplace INIT(Nullch);
a687059c 660EXT char *nointrp INIT("");
8d063cd8 661
378cc40b
LW
662EXT bool preprocess INIT(FALSE);
663EXT bool minus_n INIT(FALSE);
664EXT bool minus_p INIT(FALSE);
fe14fcc3 665EXT bool minus_l INIT(FALSE);
378cc40b
LW
666EXT bool minus_a INIT(FALSE);
667EXT bool doswitches INIT(FALSE);
668EXT bool dowarn INIT(FALSE);
450a55e4 669EXT bool doextract INIT(FALSE);
378cc40b
LW
670EXT bool allstabs INIT(FALSE); /* init all customary symbols in symbol table?*/
671EXT bool sawampersand INIT(FALSE); /* must save all match strings */
672EXT bool sawstudy INIT(FALSE); /* do fbminstr on all strings */
a687059c
LW
673EXT bool sawi INIT(FALSE); /* study must assume case insensitive */
674EXT bool sawvec INIT(FALSE);
ac58e20f 675EXT bool localizing INIT(FALSE); /* are we processing a local() list? */
a687059c 676
ae986130
LW
677#ifdef CSH
678char *cshname INIT(CSH);
679int cshlen INIT(0);
680#endif /* CSH */
a687059c
LW
681
682#ifdef TAINT
683EXT bool tainted INIT(FALSE); /* using variables controlled by $< */
684#endif
378cc40b 685
450a55e4 686#ifndef MSDOS
378cc40b 687#define TMPPATH "/tmp/perl-eXXXXXX"
450a55e4 688#else
57ebbfd0 689#define TMPPATH "plXXXXXX"
450a55e4 690#endif /* MSDOS */
378cc40b
LW
691EXT char *e_tmpname;
692EXT FILE *e_fp INIT(Nullfp);
693
8d063cd8 694EXT char tokenbuf[256];
a687059c 695EXT int expectterm INIT(TRUE); /* how to interpret ambiguous tokens */
ac58e20f 696EXT VOLATILE int in_eval INIT(FALSE); /* trap fatal errors? */
a687059c
LW
697EXT int multiline INIT(0); /* $*--do strings hold >1 line? */
698EXT int forkprocess; /* so do_open |- can return proc# */
699EXT int do_undump INIT(0); /* -u or dump seen? */
700EXT int error_count INIT(0); /* how many errors so far, max 10 */
701EXT int multi_start INIT(0); /* 1st line of multi-line string */
702EXT int multi_end INIT(0); /* last line of multi-line string */
703EXT int multi_open INIT(0); /* delimiter of said string */
704EXT int multi_close INIT(0); /* delimiter of said string */
8d063cd8
LW
705
706FILE *popen();
707/* char *str_get(); */
708STR *interp();
709void free_arg();
710STIO *stio_new();
711
712EXT struct stat statbuf;
a687059c
LW
713EXT struct stat statcache;
714STAB *statstab INIT(Nullstab);
715STR *statname;
d9d8d8de 716#ifndef MSDOS
8d063cd8 717EXT struct tms timesbuf;
d9d8d8de 718#endif
378cc40b
LW
719EXT int uid;
720EXT int euid;
a687059c
LW
721EXT int gid;
722EXT int egid;
378cc40b
LW
723UIDTYPE getuid();
724UIDTYPE geteuid();
725GIDTYPE getgid();
726GIDTYPE getegid();
727EXT int unsafe;
8d063cd8
LW
728
729#ifdef DEBUGGING
ac58e20f 730EXT VOLATILE int debug INIT(0);
8d063cd8 731EXT int dlevel INIT(0);
a687059c
LW
732EXT int dlmax INIT(128);
733EXT char *debname;
734EXT char *debdelim;
d96024cf 735#define YYDEBUG 1
8d063cd8 736#endif
a687059c 737EXT int perldb INIT(0);
fe14fcc3 738#define YYMAXDEPTH 300
8d063cd8 739
378cc40b
LW
740EXT line_t cmdline INIT(NOLINE);
741
a687059c 742EXT STR str_undef;
8d063cd8
LW
743EXT STR str_no;
744EXT STR str_yes;
745
746/* runtime control stuff */
747
748EXT struct loop {
a687059c
LW
749 char *loop_label; /* what the loop was called, if anything */
750 int loop_sp; /* stack pointer to copy stuff down to */
8d063cd8 751 jmp_buf loop_env;
a687059c 752} *loop_stack;
8d063cd8
LW
753
754EXT int loop_ptr INIT(-1);
a687059c 755EXT int loop_max INIT(128);
8d063cd8
LW
756
757EXT jmp_buf top_env;
758
ac58e20f 759EXT char * VOLATILE goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
8d063cd8 760
450a55e4
LW
761struct ufuncs {
762 int (*uf_val)();
763 int (*uf_set)();
764 int uf_index;
765};
766
a687059c
LW
767EXT ARRAY *stack; /* THE STACK */
768
ac58e20f 769EXT ARRAY * VOLATILE savestack; /* to save non-local values on */
378cc40b
LW
770
771EXT ARRAY *tosave; /* strings to save on recursive subroutine */
772
a687059c 773EXT ARRAY *lineary; /* lines of script for debugger */
d9d8d8de 774EXT ARRAY *dbargs; /* args to call listed by caller function */
a687059c 775
d9d8d8de
LW
776EXT ARRAY *fdpid; /* keep fd-to-pid mappings for mypopen */
777EXT HASH *pidstatus; /* keep pid-to-status mappings for waitpid */
a687059c 778
ac58e20f
LW
779EXT int *di; /* for tmp use in debuggers */
780EXT char *dc;
781EXT short *ds;
782
fe14fcc3
LW
783/* Fix these up for __STDC__ */
784EXT long basetime INIT(0);
785char *mktemp();
786#ifndef __STDC__
787/* All of these are in stdlib.h or time.h for ANSI C */
8d063cd8 788double atof();
a687059c 789long time();
8d063cd8 790struct tm *gmtime(), *localtime();
378cc40b
LW
791char *index(), *rindex();
792char *strcpy(), *strcat();
fe14fcc3 793#endif /* ! __STDC__ */
8d063cd8 794
8d063cd8 795#ifdef EUNICE
378cc40b
LW
796#define UNLINK unlnk
797int unlnk();
8d063cd8
LW
798#else
799#define UNLINK unlink
800#endif
a687059c 801
fe14fcc3
LW
802#ifndef HAS_SETREUID
803#ifdef HAS_SETRESUID
a687059c 804#define setreuid(r,e) setresuid(r,e,-1)
fe14fcc3 805#define HAS_SETREUID
a687059c
LW
806#endif
807#endif
fe14fcc3
LW
808#ifndef HAS_SETREGID
809#ifdef HAS_SETRESGID
a687059c 810#define setregid(r,e) setresgid(r,e,-1)
fe14fcc3 811#define HAS_SETREGID
a687059c
LW
812#endif
813#endif