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