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