perl 5.0 alpha 6
[p5sagit/p5-mst-13.2.git] / perl.h
CommitLineData
79072805 1/* $RCSfile: perl.h,v $$Revision: 4.1 $$Date: 92/08/07 18:25:56 $
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 $
79072805 9 * Revision 4.1 92/08/07 18:25:56 lwall
10 *
ee0007ab 11 * Revision 4.0.1.6 92/06/08 14:55:10 lwall
12 * patch20: added Atari ST portability
13 * patch20: bcopy() and memcpy() now tested for overlap safety
14 * patch20: Perl now distinguishes overlapped copies from non-overlapped
15 * patch20: removed implicit int declarations on functions
16 *
988174c1 17 * Revision 4.0.1.5 91/11/11 16:41:07 lwall
18 * patch19: uts wrongly defines S_ISDIR() et al
19 * patch19: too many preprocessors can't expand a macro right in #if
20 * patch19: added little-endian pack/unpack options
21 *
45d8adaa 22 * Revision 4.0.1.4 91/11/05 18:06:10 lwall
23 * patch11: various portability fixes
24 * patch11: added support for dbz
25 * patch11: added some support for 64-bit integers
26 * patch11: hex() didn't understand leading 0x
27 *
1462b684 28 * Revision 4.0.1.3 91/06/10 01:25:10 lwall
29 * patch10: certain pattern optimizations were botched
30 *
352d5a3a 31 * Revision 4.0.1.2 91/06/07 11:28:33 lwall
32 * patch4: new copyright notice
33 * patch4: made some allowances for "semi-standard" C
34 * patch4: many, many itty-bitty portability fixes
35 *
35c8bce7 36 * Revision 4.0.1.1 91/04/11 17:49:51 lwall
37 * patch1: hopefully straightened out some of the Xenix mess
38 *
fe14fcc3 39 * Revision 4.0 91/03/20 01:37:56 lwall
40 * 4.0 baseline.
8d063cd8 41 *
42 */
43
79072805 44#include "embed.h"
45
35c8bce7 46#define VOIDWANT 1
79072805 47#ifdef __cplusplus
48#include "config_c++.h"
49#else
ac58e20f 50#include "config.h"
79072805 51#endif
52
53#ifndef BYTEORDER
54# define BYTEORDER 0x1234
55#endif
56
57/* Overall memory policy? */
58#ifndef CONSERVATIVE
59# define LIBERAL 1
60#endif
61
62/*
63 * The following contortions are brought to you on behalf of all the
64 * standards, semi-standards, de facto standards, not-so-de-facto standards
65 * of the world, as well as all the other botches anyone ever thought of.
66 * The basic theory is that if we work hard enough here, the rest of the
67 * code can be a lot prettier. Well, so much for theory. Sorry, Henry...
68 */
ac58e20f 69
45d8adaa 70#ifdef MYMALLOC
71# ifdef HIDEMYMALLOC
72# define malloc Mymalloc
73# define realloc Myremalloc
74# define free Myfree
75# endif
76# define safemalloc malloc
77# define saferealloc realloc
78# define safefree free
79#endif
80
81/* work around some libPW problems */
45d8adaa 82#ifdef DOINIT
83char Error[1];
84#endif
85
ee0007ab 86/* define this once if either system, instead of cluttering up the src */
87#if defined(MSDOS) || defined(atarist)
88#define DOSISH 1
89#endif
90
79072805 91#if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
352d5a3a 92# define STANDARD_C 1
93#endif
94
79072805 95#if defined(STANDARD_C)
96# define P(args) args
97#else
98# define P(args) ()
99#endif
100
352d5a3a 101#if defined(HASVOLATILE) || defined(STANDARD_C)
79072805 102# ifdef __cplusplus
103# define VOL // to temporarily suppress warnings
104# else
105# define VOL volatile
106# endif
663a0e37 107#else
79072805 108# define VOL
663a0e37 109#endif
110
463ee0b2 111#define TAINT_IF(c) (tainted |= (c))
112#define TAINT_NOT (tainted = 0)
113#define TAINT_PROPER(s) if (tainting) taint_proper(no_security, s)
114#define TAINT_ENV() if (tainting) taint_env()
a687059c 115
fe14fcc3 116#ifndef HAS_VFORK
03a14243 117# define vfork fork
118#endif
119
fe14fcc3 120#ifdef HAS_GETPGRP2
121# ifndef HAS_GETPGRP
122# define HAS_GETPGRP
663a0e37 123# endif
124# define getpgrp getpgrp2
125#endif
126
fe14fcc3 127#ifdef HAS_SETPGRP2
128# ifndef HAS_SETPGRP
129# define HAS_SETPGRP
663a0e37 130# endif
131# define setpgrp setpgrp2
132#endif
133
fe14fcc3 134#include <stdio.h>
135#include <ctype.h>
136#include <setjmp.h>
79072805 137
fe14fcc3 138#ifndef MSDOS
79072805 139# ifdef PARAM_NEEDS_TYPES
140# include <sys/types.h>
141# endif
142# include <sys/param.h>
352d5a3a 143#endif
79072805 144
145
146/* Use all the "standard" definitions? */
352d5a3a 147#ifdef STANDARD_C
79072805 148# include <stdlib.h>
149# include <string.h>
150# define MEM_SIZE size_t
ee0007ab 151#else
79072805 152 typedef unsigned int MEM_SIZE;
352d5a3a 153#endif /* STANDARD_C */
03a14243 154
ee0007ab 155#if defined(HAS_MEMCMP) && defined(mips) && defined(ultrix)
79072805 156# undef HAS_MEMCMP
663a0e37 157#endif
fe14fcc3 158
159#ifdef HAS_MEMCPY
352d5a3a 160# ifndef STANDARD_C
fe14fcc3 161# ifndef memcpy
79072805 162 extern char * memcpy P((char*, char*, int));
ee0007ab 163# endif
164# endif
165#else
166# ifndef memcpy
167# ifdef HAS_BCOPY
168# define memcpy(d,s,l) bcopy(s,d,l)
169# else
170# define memcpy(d,s,l) my_bcopy(s,d,l)
171# endif
172# endif
173#endif /* HAS_MEMCPY */
fe14fcc3 174
ee0007ab 175#ifdef HAS_MEMSET
176# ifndef STANDARD_C
177# ifndef memset
79072805 178 extern char *memset P((char*, int, int));
ee0007ab 179# endif
180# endif
181# define memzero(d,l) memset(d,0,l)
182#else
183# ifndef memzero
184# ifdef HAS_BZERO
185# define memzero(d,l) bzero(d,l)
186# else
187# define memzero(d,l) my_bzero(d,l)
188# endif
352d5a3a 189# endif
ee0007ab 190#endif /* HAS_MEMSET */
191
192#ifdef HAS_MEMCMP
193# ifndef STANDARD_C
194# ifndef memcmp
79072805 195 extern int memcmp P((char*, char*, int));
ee0007ab 196# endif
197# endif
198#else
199# ifndef memcmp
200# define memcmp(s1,s2,l) my_memcmp(s1,s2,l)
352d5a3a 201# endif
ee0007ab 202#endif /* HAS_MEMCMP */
8d063cd8 203
ee0007ab 204/* we prefer bcmp slightly for comparisons that don't care about ordering */
205#ifndef HAS_BCMP
352d5a3a 206# ifndef bcmp
207# define bcmp(s1,s2,l) memcmp(s1,s2,l)
208# endif
ee0007ab 209#endif /* HAS_BCMP */
210
211#ifndef HAS_MEMMOVE
79072805 212# if defined(HAS_BCOPY) && defined(SAFE_BCOPY)
213# define memmove(d,s,l) bcopy(s,d,l)
214# else
215# if defined(HAS_MEMCPY) && defined(SAFE_MEMCPY)
216# define memmove(d,s,l) memcpy(d,s,l)
217# else
218# define memmove(d,s,l) my_bcopy(s,d,l)
219# endif
220# endif
d9d8d8de 221#endif
378cc40b 222
223#ifndef _TYPES_ /* If types.h defines this it's easy. */
79072805 224# ifndef major /* Does everyone's types.h define this? */
225# include <sys/types.h>
226# endif
378cc40b 227#endif
228
ae986130 229#ifdef I_NETINET_IN
79072805 230# include <netinet/in.h>
ae986130 231#endif
232
8d063cd8 233#include <sys/stat.h>
79072805 234
ee0007ab 235#if defined(uts) || defined(UTekV)
79072805 236# undef S_ISDIR
237# undef S_ISCHR
238# undef S_ISBLK
239# undef S_ISREG
240# undef S_ISFIFO
241# undef S_ISLNK
242# define S_ISDIR(P) (((P)&S_IFMT)==S_IFDIR)
243# define S_ISCHR(P) (((P)&S_IFMT)==S_IFCHR)
244# define S_ISBLK(P) (((P)&S_IFMT)==S_IFBLK)
245# define S_ISREG(P) (((P)&S_IFMT)==S_IFREG)
246# define S_ISFIFO(P) (((P)&S_IFMT)==S_IFIFO)
247# ifdef S_IFLNK
248# define S_ISLNK(P) (((P)&S_IFMT)==S_IFLNK)
249# endif
ee0007ab 250#endif
135863df 251
663a0e37 252#ifdef I_TIME
253# include <time.h>
ffed7fef 254#endif
663a0e37 255
fe14fcc3 256#ifdef I_SYS_TIME
663a0e37 257# ifdef SYSTIMEKERNEL
258# define KERNEL
259# endif
260# include <sys/time.h>
261# ifdef SYSTIMEKERNEL
262# undef KERNEL
263# endif
a687059c 264#endif
135863df 265
d9d8d8de 266#ifndef MSDOS
8d063cd8 267#include <sys/times.h>
d9d8d8de 268#endif
8d063cd8 269
fe14fcc3 270#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
79072805 271# undef HAS_STRERROR
663a0e37 272#endif
273
274#include <errno.h>
ed6116ce 275#ifdef HAS_SOCKET
276# ifndef ENOTSOCK
277# include <net/errno.h>
278# endif
279#endif
280
d9d8d8de 281#ifndef MSDOS
79072805 282# ifndef errno
283 extern int errno; /* ANSI allows errno to be an lvalue expr */
284# endif
d9d8d8de 285#endif
663a0e37 286
35c8bce7 287#ifndef strerror
79072805 288# ifdef HAS_STRERROR
289 char *strerror P((int));
290# else
291 extern int sys_nerr;
292 extern char *sys_errlist[];
293# define strerror(e) \
294 ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
295# endif
35c8bce7 296#endif
663a0e37 297
a687059c 298#ifdef I_SYSIOCTL
79072805 299# ifndef _IOCTL_
300# include <sys/ioctl.h>
301# endif
a687059c 302#endif
303
ee0007ab 304#if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
79072805 305# ifdef HAS_SOCKETPAIR
306# undef HAS_SOCKETPAIR
307# endif
308# ifdef HAS_NDBM
309# undef HAS_NDBM
310# endif
a687059c 311#endif
312
a687059c 313#if INTSIZE == 2
79072805 314# define htoni htons
315# define ntohi ntohs
a687059c 316#else
79072805 317# define htoni htonl
318# define ntohi ntohl
a687059c 319#endif
320
35c8bce7 321#if defined(I_DIRENT)
663a0e37 322# include <dirent.h>
323# define DIRENT dirent
ae986130 324#else
fe14fcc3 325# ifdef I_SYS_NDIR
79a0689e 326# include <sys/ndir.h>
663a0e37 327# define DIRENT direct
328# else
fe14fcc3 329# ifdef I_SYS_DIR
79a0689e 330# ifdef hp9000s500
331# include <ndir.h> /* may be wrong in the future */
332# else
333# include <sys/dir.h>
334# endif
663a0e37 335# define DIRENT direct
336# endif
337# endif
a687059c 338#endif
339
352d5a3a 340#ifdef FPUTS_BOTCH
341/* work around botch in SunOS 4.0.1 and 4.0.2 */
342# ifndef fputs
79072805 343# define fputs(sv,fp) fprintf(fp,"%s",sv)
352d5a3a 344# endif
345#endif
346
c623bd54 347/*
348 * The following gobbledygook brought to you on behalf of __STDC__.
349 * (I could just use #ifndef __STDC__, but this is more bulletproof
350 * in the face of half-implementations.)
351 */
352
353#ifndef S_IFMT
354# ifdef _S_IFMT
355# define S_IFMT _S_IFMT
356# else
357# define S_IFMT 0170000
358# endif
359#endif
360
361#ifndef S_ISDIR
362# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
363#endif
364
365#ifndef S_ISCHR
366# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
367#endif
368
369#ifndef S_ISBLK
fe14fcc3 370# ifdef S_IFBLK
371# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
372# else
373# define S_ISBLK(m) (0)
374# endif
c623bd54 375#endif
376
377#ifndef S_ISREG
378# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
379#endif
380
381#ifndef S_ISFIFO
fe14fcc3 382# ifdef S_IFIFO
383# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
384# else
385# define S_ISFIFO(m) (0)
386# endif
c623bd54 387#endif
388
389#ifndef S_ISLNK
390# ifdef _S_ISLNK
391# define S_ISLNK(m) _S_ISLNK(m)
392# else
393# ifdef _S_IFLNK
394# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
395# else
396# ifdef S_IFLNK
397# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
398# else
399# define S_ISLNK(m) (0)
400# endif
401# endif
402# endif
403#endif
404
405#ifndef S_ISSOCK
406# ifdef _S_ISSOCK
407# define S_ISSOCK(m) _S_ISSOCK(m)
408# else
409# ifdef _S_IFSOCK
410# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
411# else
412# ifdef S_IFSOCK
413# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
414# else
415# define S_ISSOCK(m) (0)
416# endif
417# endif
418# endif
419#endif
420
421#ifndef S_IRUSR
422# ifdef S_IREAD
423# define S_IRUSR S_IREAD
424# define S_IWUSR S_IWRITE
425# define S_IXUSR S_IEXEC
426# else
427# define S_IRUSR 0400
428# define S_IWUSR 0200
429# define S_IXUSR 0100
430# endif
431# define S_IRGRP (S_IRUSR>>3)
432# define S_IWGRP (S_IWUSR>>3)
433# define S_IXGRP (S_IXUSR>>3)
434# define S_IROTH (S_IRUSR>>6)
435# define S_IWOTH (S_IWUSR>>6)
436# define S_IXOTH (S_IXUSR>>6)
437#endif
438
439#ifndef S_ISUID
440# define S_ISUID 04000
441#endif
442
443#ifndef S_ISGID
444# define S_ISGID 02000
445#endif
446
79072805 447#ifdef ff_next
448# undef ff_next
352d5a3a 449#endif
450
ee0007ab 451#if defined(cray) || defined(gould) || defined(i860)
45d8adaa 452# define SLOPPYDIVIDE
453#endif
454
988174c1 455#if defined(cray) || defined(convex) || defined (uts) || BYTEORDER > 0xffff
45d8adaa 456# define QUAD
457#endif
458
459#ifdef QUAD
460# ifdef cray
461# define quad int
462# else
988174c1 463# if defined(convex) || defined (uts)
45d8adaa 464# define quad long long
465# else
466# define quad long
467# endif
468# endif
469#endif
470
79072805 471#ifdef VOIDSIG
472# define VOIDRET void
473#else
474# define VOIDRET int
475#endif
476
477#ifdef DOSISH
478# include "dosish.h"
479#else
480# include "unixish.h"
481#endif
482
483#ifndef HAS_PAUSE
484#define pause() sleep((32767<<16)+32767)
485#endif
486
487#ifndef IOCPARM_LEN
488# ifdef IOCPARM_MASK
489 /* on BSDish systes we're safe */
490# define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
491# else
492 /* otherwise guess at what's safe */
493# define IOCPARM_LEN(x) 256
494# endif
495#endif
496
ee0007ab 497typedef MEM_SIZE STRLEN;
450a55e4 498
79072805 499typedef struct op OP;
500typedef struct cop COP;
501typedef struct unop UNOP;
502typedef struct binop BINOP;
503typedef struct listop LISTOP;
504typedef struct logop LOGOP;
505typedef struct condop CONDOP;
506typedef struct pmop PMOP;
507typedef struct svop SVOP;
508typedef struct gvop GVOP;
509typedef struct pvop PVOP;
510typedef struct cvop CVOP;
511typedef struct loop LOOP;
512
513typedef struct Outrec Outrec;
514typedef struct lstring Lstring;
93a17b20 515typedef struct interpreter PerlInterpreter;
79072805 516typedef struct ff FF;
79072805 517typedef struct sv SV;
518typedef struct av AV;
519typedef struct hv HV;
520typedef struct cv CV;
378cc40b 521typedef struct regexp REGEXP;
79072805 522typedef struct gp GP;
523typedef struct sv GV;
8990e307 524typedef struct io IO;
79072805 525typedef struct context CONTEXT;
526typedef struct block BLOCK;
527
528typedef struct magic MAGIC;
ed6116ce 529typedef struct xrv XRV;
79072805 530typedef struct xpv XPV;
531typedef struct xpviv XPVIV;
532typedef struct xpvnv XPVNV;
533typedef struct xpvmg XPVMG;
534typedef struct xpvlv XPVLV;
535typedef struct xpvav XPVAV;
536typedef struct xpvhv XPVHV;
537typedef struct xpvgv XPVGV;
538typedef struct xpvcv XPVCV;
539typedef struct xpvbm XPVBM;
540typedef struct xpvfm XPVFM;
8990e307 541typedef struct xpvio XPVIO;
79072805 542typedef struct mgvtbl MGVTBL;
543typedef union any ANY;
8d063cd8 544
378cc40b 545#include "handy.h"
79072805 546union any {
547 void* any_ptr;
548 I32 any_i32;
549};
550
378cc40b 551#include "regexp.h"
79072805 552#include "sv.h"
378cc40b 553#include "util.h"
8d063cd8 554#include "form.h"
79072805 555#include "gv.h"
556#include "cv.h"
557#include "opcode.h"
558#include "op.h"
559#include "cop.h"
560#include "av.h"
561#include "hv.h"
562#include "mg.h"
563#include "scope.h"
8d063cd8 564
450a55e4 565#if defined(iAPX286) || defined(M_I286) || defined(I80286)
a687059c 566# define I286
567#endif
568
352d5a3a 569#ifndef STANDARD_C
79072805 570# ifdef CHARSPRINTF
571 char *sprintf P((char *, ...));
572# else
573 int sprintf P((char *, ...));
574# endif
a687059c 575#endif
576
fe14fcc3 577#if defined(htonl) && !defined(HAS_HTONL)
578#define HAS_HTONL
ae986130 579#endif
fe14fcc3 580#if defined(htons) && !defined(HAS_HTONS)
581#define HAS_HTONS
ae986130 582#endif
fe14fcc3 583#if defined(ntohl) && !defined(HAS_NTOHL)
584#define HAS_NTOHL
ae986130 585#endif
fe14fcc3 586#if defined(ntohs) && !defined(HAS_NTOHS)
587#define HAS_NTOHS
ae986130 588#endif
fe14fcc3 589#ifndef HAS_HTONL
d9d8d8de 590#if (BYTEORDER & 0xffff) != 0x4321
fe14fcc3 591#define HAS_HTONS
592#define HAS_HTONL
593#define HAS_NTOHS
594#define HAS_NTOHL
a687059c 595#define MYSWAP
596#define htons my_swap
597#define htonl my_htonl
598#define ntohs my_swap
599#define ntohl my_ntohl
600#endif
601#else
d9d8d8de 602#if (BYTEORDER & 0xffff) == 0x4321
fe14fcc3 603#undef HAS_HTONS
604#undef HAS_HTONL
605#undef HAS_NTOHS
606#undef HAS_NTOHL
a687059c 607#endif
608#endif
609
988174c1 610/*
611 * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
612 * -DWS
613 */
614#if BYTEORDER != 0x1234
615# define HAS_VTOHL
616# define HAS_VTOHS
617# define HAS_HTOVL
618# define HAS_HTOVS
619# if BYTEORDER == 0x4321
620# define vtohl(x) ((((x)&0xFF)<<24) \
621 +(((x)>>24)&0xFF) \
622 +(((x)&0x0000FF00)<<8) \
623 +(((x)&0x00FF0000)>>8) )
624# define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
625# define htovl(x) vtohl(x)
626# define htovs(x) vtohs(x)
627# endif
628 /* otherwise default to functions in util.c */
629#endif
630
0f85fab0 631#ifdef CASTNEGFLOAT
79072805 632#define U_S(what) ((U16)(what))
0f85fab0 633#define U_I(what) ((unsigned int)(what))
79072805 634#define U_L(what) ((U32)(what))
0f85fab0 635#else
79072805 636U32 cast_ulong P((double));
637#define U_S(what) ((U16)cast_ulong(what))
638#define U_I(what) ((unsigned int)cast_ulong(what))
639#define U_L(what) (cast_ulong(what))
ee0007ab 640#endif
641
ed6116ce 642#ifdef CASTI32
643#define I_32(what) ((I32)(what))
644#else
645I32 cast_i32 P((double));
646#define I_32(what) (cast_i32(what))
647#endif
648
79072805 649struct Outrec {
650 I32 o_lines;
d9d8d8de 651 char *o_str;
79072805 652 U32 o_len;
8d063cd8 653};
654
352d5a3a 655#ifndef MAXSYSFD
656# define MAXSYSFD 2
657#endif
ee0007ab 658
659#ifndef DOSISH
378cc40b 660#define TMPPATH "/tmp/perl-eXXXXXX"
450a55e4 661#else
57ebbfd0 662#define TMPPATH "plXXXXXX"
450a55e4 663#endif /* MSDOS */
79072805 664
665#ifndef __cplusplus
666UIDTYPE getuid P(());
667UIDTYPE geteuid P(());
668GIDTYPE getgid P(());
669GIDTYPE getegid P(());
670#endif
8d063cd8 671
672#ifdef DEBUGGING
d96024cf 673#define YYDEBUG 1
79072805 674#define DEB(a) a
675#define DEBUG(a) if (debug) a
676#define DEBUG_p(a) if (debug & 1) a
677#define DEBUG_s(a) if (debug & 2) a
678#define DEBUG_l(a) if (debug & 4) a
679#define DEBUG_t(a) if (debug & 8) a
680#define DEBUG_o(a) if (debug & 16) a
681#define DEBUG_c(a) if (debug & 32) a
682#define DEBUG_P(a) if (debug & 64) a
683#define DEBUG_m(a) if (debug & 128) a
684#define DEBUG_f(a) if (debug & 256) a
685#define DEBUG_r(a) if (debug & 512) a
686#define DEBUG_x(a) if (debug & 1024) a
687#define DEBUG_u(a) if (debug & 2048) a
688#define DEBUG_L(a) if (debug & 4096) a
689#define DEBUG_H(a) if (debug & 8192) a
690#define DEBUG_X(a) if (debug & 16384) a
8990e307 691#define DEBUG_D(a) if (debug & 32768) a
79072805 692#else
693#define DEB(a)
694#define DEBUG(a)
695#define DEBUG_p(a)
696#define DEBUG_s(a)
697#define DEBUG_l(a)
698#define DEBUG_t(a)
699#define DEBUG_o(a)
700#define DEBUG_c(a)
701#define DEBUG_P(a)
702#define DEBUG_m(a)
703#define DEBUG_f(a)
704#define DEBUG_r(a)
705#define DEBUG_x(a)
706#define DEBUG_u(a)
707#define DEBUG_L(a)
708#define DEBUG_H(a)
709#define DEBUG_X(a)
8990e307 710#define DEBUG_D(a)
8d063cd8 711#endif
fe14fcc3 712#define YYMAXDEPTH 300
8d063cd8 713
79072805 714#define assert(what) DEB( { \
715 if (!(what)) { \
463ee0b2 716 croak("Assertion failed: file \"%s\", line %d", \
79072805 717 __FILE__, __LINE__); \
718 exit(1); \
719 }})
8d063cd8 720
450a55e4 721struct ufuncs {
79072805 722 I32 (*uf_val)P((I32, SV*));
723 I32 (*uf_set)P((I32, SV*));
724 I32 uf_index;
450a55e4 725};
726
fe14fcc3 727/* Fix these up for __STDC__ */
79072805 728char *mktemp P((char*));
729double atof P((const char*));
730
352d5a3a 731#ifndef STANDARD_C
fe14fcc3 732/* All of these are in stdlib.h or time.h for ANSI C */
a687059c 733long time();
8d063cd8 734struct tm *gmtime(), *localtime();
93a17b20 735char *strchr(), *strrchr();
378cc40b 736char *strcpy(), *strcat();
352d5a3a 737#endif /* ! STANDARD_C */
8d063cd8 738
79072805 739
740#ifdef I_MATH
741# include <math.h>
742#else
743# ifdef __cplusplus
744 extern "C" {
745# endif
746 double exp P((double));
747 double log P((double));
748 double sqrt P((double));
749 double modf P((double,int*));
750 double sin P((double));
751 double cos P((double));
752 double atan2 P((double,double));
753 double pow P((double,double));
754# ifdef __cplusplus
755 };
756# endif
757#endif
758
759
760char *crypt P((const char*, const char*));
761char *getenv P((const char*));
762long lseek P((int,int,int));
763char *getlogin P((void));
764
8d063cd8 765#ifdef EUNICE
378cc40b 766#define UNLINK unlnk
79072805 767int unlnk P((char*));
8d063cd8 768#else
769#define UNLINK unlink
770#endif
a687059c 771
fe14fcc3 772#ifndef HAS_SETREUID
773#ifdef HAS_SETRESUID
a687059c 774#define setreuid(r,e) setresuid(r,e,-1)
fe14fcc3 775#define HAS_SETREUID
a687059c 776#endif
777#endif
fe14fcc3 778#ifndef HAS_SETREGID
779#ifdef HAS_SETRESGID
a687059c 780#define setregid(r,e) setresgid(r,e,-1)
fe14fcc3 781#define HAS_SETREGID
a687059c 782#endif
783#endif
ee0007ab 784
785#define SCAN_DEF 0
786#define SCAN_TR 1
787#define SCAN_REPL 2
79072805 788
789#ifdef DEBUGGING
790#define PAD_SV(po) pad_sv(po)
791#else
792#define PAD_SV(po) curpad[po]
793#endif
794
795/****************/
796/* Truly global */
797/****************/
798
799/* global state */
93a17b20 800EXT PerlInterpreter *curinterp; /* currently running interpreter */
79072805 801extern char ** environ; /* environment variables supplied via exec */
802EXT int uid; /* current real user id */
803EXT int euid; /* current effective user id */
804EXT int gid; /* current real group id */
805EXT int egid; /* current effective group id */
806EXT bool nomemok; /* let malloc context handle nomem */
807EXT U32 an; /* malloc sequence number */
463ee0b2 808EXT U32 cop_seqmax; /* statement sequence number */
809EXT U32 op_seqmax; /* op sequence number */
8990e307 810EXT U32 evalseq; /* eval sequence number */
463ee0b2 811EXT U32 sub_generation; /* inc to force methods to be looked up again */
79072805 812EXT char ** origenviron;
813EXT U32 origalen;
814
8990e307 815EXT I32 * xiv_root; /* free xiv list--shared by interpreters */
816EXT double * xnv_root; /* free xnv list--shared by interpreters */
817EXT XRV * xrv_root; /* free xrv list--shared by interpreters */
818EXT XPV * xpv_root; /* free xpv list--shared by interpreters */
819
79072805 820/* Stack for currently executing thread--context switch must handle this. */
821EXT SV ** stack_base; /* stack->array_ary */
822EXT SV ** stack_sp; /* stack pointer now */
823EXT SV ** stack_max; /* stack->array_ary + stack->array_max */
824
825/* likewise for these */
826
827EXT OP * op; /* current op--oughta be in a global register */
828
829EXT I32 * scopestack; /* blocks we've entered */
830EXT I32 scopestack_ix;
831EXT I32 scopestack_max;
832
833EXT ANY* savestack; /* to save non-local values on */
834EXT I32 savestack_ix;
835EXT I32 savestack_max;
836
837EXT OP ** retstack; /* returns we've pushed */
838EXT I32 retstack_ix;
839EXT I32 retstack_max;
840
841EXT I32 * markstack; /* stackmarks we're remembering */
842EXT I32 * markstack_ptr; /* stackmarks we're remembering */
843EXT I32 * markstack_max; /* stackmarks we're remembering */
844
845EXT SV ** curpad;
846
847/* temp space */
848EXT SV * Sv;
849EXT XPV * Xpv;
850EXT char buf[1024];
851EXT char tokenbuf[256];
852EXT struct stat statbuf;
853#ifndef MSDOS
854EXT struct tms timesbuf;
855#endif
463ee0b2 856EXT STRLEN na; /* for use in SvPV when length is Not Applicable */
79072805 857
858/* for tmp use in stupid debuggers */
859EXT int * di;
860EXT short * ds;
861EXT char * dc;
862
863/* handy constants */
864EXT char * Yes INIT("1");
865EXT char * No INIT("");
866EXT char * hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
79072805 867EXT char * patleave INIT("\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}");
868EXT char * vert INIT("|");
869
8990e307 870EXT char warn_uninit[]
871 INIT("Use of uninitialized variable");
463ee0b2 872EXT char warn_nosemi[]
873 INIT("Semicolon seems to be missing");
874EXT char warn_reserved[]
875 INIT("Unquoted string \"%s\" may clash with future reserved word");
876EXT char warn_nl[]
93a17b20 877 INIT("Unsuccessful %s on filename containing newline");
878EXT char no_usym[]
8990e307 879 INIT("Can't use an undefined value as %s reference");
93a17b20 880EXT char no_aelem[]
881 INIT("Modification of non-creatable array value attempted, subscript %d");
882EXT char no_helem[]
883 INIT("Modification of non-creatable hash value attempted, subscript \"%s\"");
884EXT char no_modify[]
885 INIT("Modification of a read-only value attempted");
886EXT char no_mem[]
887 INIT("Out of memory!\n");
888EXT char no_security[]
463ee0b2 889 INIT("Insecure dependency in %s%s");
93a17b20 890EXT char no_sock_func[]
891 INIT("Unsupported socket function \"%s\" called");
892EXT char no_dir_func[]
893 INIT("Unsupported directory function \"%s\" called");
894EXT char no_func[]
895 INIT("The %s function is unimplemented");
896
79072805 897EXT SV sv_undef;
898EXT SV sv_no;
899EXT SV sv_yes;
900#ifdef CSH
901 EXT char * cshname INIT(CSH);
902 EXT I32 cshlen;
903#endif
904
905#ifdef DOINIT
906EXT char *sig_name[] = {
907 SIG_NAME,0
908};
909#else
910EXT char *sig_name[];
911#endif
912
913#ifdef DOINIT
79072805 914EXT unsigned char fold[] = { /* fast case folding table */
915 0, 1, 2, 3, 4, 5, 6, 7,
916 8, 9, 10, 11, 12, 13, 14, 15,
917 16, 17, 18, 19, 20, 21, 22, 23,
918 24, 25, 26, 27, 28, 29, 30, 31,
919 32, 33, 34, 35, 36, 37, 38, 39,
920 40, 41, 42, 43, 44, 45, 46, 47,
921 48, 49, 50, 51, 52, 53, 54, 55,
922 56, 57, 58, 59, 60, 61, 62, 63,
923 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
924 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
925 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
926 'x', 'y', 'z', 91, 92, 93, 94, 95,
927 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
928 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
929 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
930 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
931 128, 129, 130, 131, 132, 133, 134, 135,
932 136, 137, 138, 139, 140, 141, 142, 143,
933 144, 145, 146, 147, 148, 149, 150, 151,
934 152, 153, 154, 155, 156, 157, 158, 159,
935 160, 161, 162, 163, 164, 165, 166, 167,
936 168, 169, 170, 171, 172, 173, 174, 175,
937 176, 177, 178, 179, 180, 181, 182, 183,
938 184, 185, 186, 187, 188, 189, 190, 191,
939 192, 193, 194, 195, 196, 197, 198, 199,
940 200, 201, 202, 203, 204, 205, 206, 207,
941 208, 209, 210, 211, 212, 213, 214, 215,
942 216, 217, 218, 219, 220, 221, 222, 223,
943 224, 225, 226, 227, 228, 229, 230, 231,
944 232, 233, 234, 235, 236, 237, 238, 239,
945 240, 241, 242, 243, 244, 245, 246, 247,
946 248, 249, 250, 251, 252, 253, 254, 255
947};
948#else
949EXT unsigned char fold[];
950#endif
951
952#ifdef DOINIT
953EXT unsigned char freq[] = { /* letter frequencies for mixed English/C */
954 1, 2, 84, 151, 154, 155, 156, 157,
955 165, 246, 250, 3, 158, 7, 18, 29,
956 40, 51, 62, 73, 85, 96, 107, 118,
957 129, 140, 147, 148, 149, 150, 152, 153,
958 255, 182, 224, 205, 174, 176, 180, 217,
959 233, 232, 236, 187, 235, 228, 234, 226,
960 222, 219, 211, 195, 188, 193, 185, 184,
961 191, 183, 201, 229, 181, 220, 194, 162,
962 163, 208, 186, 202, 200, 218, 198, 179,
963 178, 214, 166, 170, 207, 199, 209, 206,
964 204, 160, 212, 216, 215, 192, 175, 173,
965 243, 172, 161, 190, 203, 189, 164, 230,
966 167, 248, 227, 244, 242, 255, 241, 231,
967 240, 253, 169, 210, 245, 237, 249, 247,
968 239, 168, 252, 251, 254, 238, 223, 221,
969 213, 225, 177, 197, 171, 196, 159, 4,
970 5, 6, 8, 9, 10, 11, 12, 13,
971 14, 15, 16, 17, 19, 20, 21, 22,
972 23, 24, 25, 26, 27, 28, 30, 31,
973 32, 33, 34, 35, 36, 37, 38, 39,
974 41, 42, 43, 44, 45, 46, 47, 48,
975 49, 50, 52, 53, 54, 55, 56, 57,
976 58, 59, 60, 61, 63, 64, 65, 66,
977 67, 68, 69, 70, 71, 72, 74, 75,
978 76, 77, 78, 79, 80, 81, 82, 83,
979 86, 87, 88, 89, 90, 91, 92, 93,
980 94, 95, 97, 98, 99, 100, 101, 102,
981 103, 104, 105, 106, 108, 109, 110, 111,
982 112, 113, 114, 115, 116, 117, 119, 120,
983 121, 122, 123, 124, 125, 126, 127, 128,
984 130, 131, 132, 133, 134, 135, 136, 137,
985 138, 139, 141, 142, 143, 144, 145, 146
986};
987#else
988EXT unsigned char freq[];
989#endif
990
8990e307 991#ifdef DEBUGGING
992#ifdef DOINIT
993EXT char* block_type[] = {
994 "NULL",
995 "SUB",
996 "EVAL",
997 "LOOP",
998 "SUBST",
999 "BLOCK",
1000};
1001#else
1002EXT char* block_type[];
1003#endif
1004#endif
1005
79072805 1006/*****************************************************************************/
1007/* This lexer/parser stuff is currently global since yacc is hard to reenter */
1008/*****************************************************************************/
8990e307 1009/* XXX This needs to be revisited, since BEGIN makes yacc re-enter... */
79072805 1010
1011typedef enum {
1012 XOPERATOR,
1013 XTERM,
79072805 1014 XREF,
8990e307 1015 XSTATE,
1016 XBLOCK,
79072805 1017} expectation;
1018
1019EXT FILE * VOL rsfp INIT(Nullfp);
1020EXT SV * linestr;
1021EXT char * bufptr;
1022EXT char * oldbufptr;
1023EXT char * oldoldbufptr;
1024EXT char * bufend;
8990e307 1025EXT expectation expect INIT(XSTATE); /* how to interpret ambiguous tokens */
79072805 1026
1027EXT I32 multi_start; /* 1st line of multi-line string */
1028EXT I32 multi_end; /* last line of multi-line string */
1029EXT I32 multi_open; /* delimiter of said string */
1030EXT I32 multi_close; /* delimiter of said string */
1031
1032EXT GV * scrgv;
1033EXT I32 error_count; /* how many errors so far, max 10 */
1034EXT I32 subline; /* line this subroutine began on */
1035EXT SV * subname; /* name of current subroutine */
1036
93a17b20 1037EXT AV * comppad; /* storage for lexically scoped temporaries */
8990e307 1038EXT AV * comppad_name; /* variable names for "my" variables */
1039EXT I32 comppad_name_fill;/* last "introduced" variable offset */
1040EXT I32 min_intro_pending;/* start of vars to introduce */
1041EXT I32 max_intro_pending;/* end of vars to introduce */
79072805 1042EXT I32 padix; /* max used index in current "register" pad */
1043EXT COP compiling;
1044
1045EXT SV * evstr; /* op_fold_const() temp string cache */
1046EXT I32 thisexpr; /* name id for nothing_in_common() */
1047EXT char * last_uni; /* position of last named-unary operator */
1048EXT char * last_lop; /* position of last list operator */
8990e307 1049EXT OPCODE last_lop_op; /* last list operator */
79072805 1050EXT bool in_format; /* we're compiling a run_format */
93a17b20 1051EXT bool in_my; /* we're compiling a "my" declaration */
463ee0b2 1052EXT I32 needblockscope INIT(TRUE); /* block overhead needed? */
79072805 1053#ifdef FCRYPT
1054EXT I32 cryptseen; /* has fast crypt() been initialized? */
1055#endif
1056
1057/**************************************************************************/
1058/* This regexp stuff is global since it always happens within 1 expr eval */
1059/**************************************************************************/
1060
1061EXT char * regprecomp; /* uncompiled string. */
1062EXT char * regparse; /* Input-scan pointer. */
1063EXT char * regxend; /* End of input for compile */
1064EXT I32 regnpar; /* () count. */
1065EXT char * regcode; /* Code-emit pointer; &regdummy = don't. */
1066EXT I32 regsize; /* Code size. */
1067EXT I32 regfold; /* are we folding? */
1068EXT I32 regsawbracket; /* Did we do {d,d} trick? */
1069EXT I32 regsawback; /* Did we see \1, ...? */
1070
1071EXT char * reginput; /* String-input pointer. */
1072EXT char regprev; /* char before regbol, \n if none */
1073EXT char * regbol; /* Beginning of input, for ^ check. */
1074EXT char * regeol; /* End of input, for $ check. */
1075EXT char ** regstartp; /* Pointer to startp array. */
1076EXT char ** regendp; /* Ditto for endp. */
1077EXT char * reglastparen; /* Similarly for lastparen. */
1078EXT char * regtill; /* How far we are required to go. */
1079EXT I32 regmyp_size;
1080EXT char ** regmystartp;
1081EXT char ** regmyendp;
1082
1083/***********************************************/
1084/* Global only to current interpreter instance */
1085/***********************************************/
1086
8990e307 1087#ifdef MULTIPLICITY
79072805 1088#define IEXT
1089#define IINIT(x)
1090struct interpreter {
1091#else
1092#define IEXT EXT
1093#define IINIT(x) INIT(x)
1094#endif
1095
1096/* pseudo environmental stuff */
1097IEXT int Iorigargc;
1098IEXT char ** Iorigargv;
1099IEXT GV * Ienvgv;
1100IEXT GV * Isiggv;
1101IEXT GV * Iincgv;
1102IEXT char * Iorigfilename;
1103
1104/* switches */
1105IEXT char * Icddir;
1106IEXT bool Iminus_c;
1107IEXT char Ipatchlevel[6];
1108IEXT char * Inrs IINIT("\n");
1109IEXT U32 Inrschar IINIT('\n'); /* final char of rs, or 0777 if none */
1110IEXT I32 Inrslen IINIT(1);
1111IEXT bool Ipreprocess;
1112IEXT bool Iminus_n;
1113IEXT bool Iminus_p;
1114IEXT bool Iminus_l;
1115IEXT bool Iminus_a;
1116IEXT bool Idoswitches;
1117IEXT bool Idowarn;
1118IEXT bool Idoextract;
79072805 1119IEXT bool Isawampersand; /* must save all match strings */
1120IEXT bool Isawstudy; /* do fbm_instr on all strings */
1121IEXT bool Isawi; /* study must assume case insensitive */
1122IEXT bool Isawvec;
1123IEXT bool Iunsafe;
1124IEXT bool Ido_undump; /* -u or dump seen? */
1125IEXT char * Iinplace;
1126IEXT char * Ie_tmpname;
1127IEXT FILE * Ie_fp;
1128IEXT VOL U32 Idebug;
1129IEXT U32 Iperldb;
1130
1131/* magical thingies */
1132IEXT time_t Ibasetime; /* $^T */
1133IEXT I32 Iarybase; /* $[ */
1134IEXT SV * Iformfeed; /* $^L */
1135IEXT char * Ichopset IINIT(" \n-"); /* $: */
1136IEXT char * Irs IINIT("\n"); /* $/ */
1137IEXT U32 Irschar IINIT('\n'); /* final char of rs, or 0777 if none */
8990e307 1138IEXT STRLEN Irslen IINIT(1);
79072805 1139IEXT bool Irspara;
1140IEXT char * Iofs; /* $, */
8990e307 1141IEXT STRLEN Iofslen;
79072805 1142IEXT char * Iors; /* $\ */
8990e307 1143IEXT STRLEN Iorslen;
79072805 1144IEXT char * Iofmt; /* $# */
1145IEXT I32 Imaxsysfd IINIT(MAXSYSFD); /* top fd to pass to subprocesses */
1146IEXT int Imultiline; /* $*--do strings hold >1 line? */
1147IEXT U16 Istatusvalue; /* $? */
1148
1149IEXT struct stat Istatcache; /* _ */
1150IEXT GV * Istatgv;
1151IEXT SV * Istatname IINIT(Nullsv);
1152
1153/* shortcuts to various I/O objects */
1154IEXT GV * Istdingv;
1155IEXT GV * Ilast_in_gv;
1156IEXT GV * Idefgv;
1157IEXT GV * Iargvgv;
1158IEXT GV * Idefoutgv;
1159IEXT GV * Icuroutgv;
1160IEXT GV * Iargvoutgv;
1161
1162/* shortcuts to regexp stuff */
1163IEXT GV * Ileftgv;
1164IEXT GV * Iampergv;
1165IEXT GV * Irightgv;
1166IEXT PMOP * Icurpm; /* what to do \ interps from */
79072805 1167IEXT I32 * Iscreamfirst;
1168IEXT I32 * Iscreamnext;
1169IEXT I32 Imaxscream IINIT(-1);
1170IEXT SV * Ilastscream;
1171
1172/* shortcuts to debugging objects */
1173IEXT GV * IDBgv;
1174IEXT GV * IDBline;
1175IEXT GV * IDBsub;
1176IEXT SV * IDBsingle;
1177IEXT SV * IDBtrace;
1178IEXT SV * IDBsignal;
1179IEXT AV * Ilineary; /* lines of script for debugger */
1180IEXT AV * Idbargs; /* args to call listed by caller function */
1181
1182/* symbol tables */
1183IEXT HV * Idefstash; /* main symbol table */
1184IEXT HV * Icurstash; /* symbol table for current package */
1185IEXT HV * Idebstash; /* symbol table for perldb package */
1186IEXT SV * Icurstname; /* name of current package */
93a17b20 1187IEXT AV * Ibeginav; /* names of BEGIN subroutines */
1188IEXT AV * Iendav; /* names of END subroutines */
1189IEXT AV * Ipad; /* storage for lexically scoped temporaries */
1190IEXT AV * Ipadname; /* variable names for "my" variables */
79072805 1191
1192/* memory management */
79072805 1193IEXT SV ** Itmps_stack;
1194IEXT I32 Itmps_ix IINIT(-1);
1195IEXT I32 Itmps_floor IINIT(-1);
8990e307 1196IEXT I32 Itmps_max;
1197IEXT I32 Isv_count; /* how many SV* are currently allocated */
1198IEXT I32 Isv_rvcount; /* how many RV* are currently allocated */
1199IEXT SV* Isv_root; /* storage for SVs belonging to interp */
1200IEXT SV* Isv_arenaroot; /* list of areas for garbage collection */
79072805 1201
1202/* funky return mechanisms */
1203IEXT I32 Ilastspbase;
1204IEXT I32 Ilastsize;
1205IEXT int Iforkprocess; /* so do_open |- can return proc# */
1206
1207/* subprocess state */
1208IEXT AV * Ifdpid; /* keep fd-to-pid mappings for my_popen */
1209IEXT HV * Ipidstatus; /* keep pid-to-status mappings for waitpid */
1210
1211/* internal state */
463ee0b2 1212IEXT VOL int Iin_eval; /* trap "fatal" errors? */
1213IEXT OP * Irestartop; /* Are we propagating an error from croak? */
79072805 1214IEXT int Idelaymagic; /* ($<,$>) = ... */
1215IEXT bool Idirty; /* clean before rerunning */
1216IEXT bool Ilocalizing; /* are we processing a local() list? */
79072805 1217IEXT bool Itainted; /* using variables controlled by $< */
463ee0b2 1218IEXT bool Itainting; /* doing taint checks */
79072805 1219
1220/* trace state */
1221IEXT I32 Idlevel;
1222IEXT I32 Idlmax IINIT(128);
1223IEXT char * Idebname;
1224IEXT char * Idebdelim;
1225
1226/* current interpreter roots */
463ee0b2 1227IEXT OP * Imain_root;
1228IEXT OP * Imain_start;
1229IEXT OP * Ieval_root;
1230IEXT OP * Ieval_start;
79072805 1231
1232/* runtime control stuff */
1233IEXT COP * VOL Icurcop IINIT(&compiling);
1234IEXT line_t Icopline IINIT(NOLINE);
1235IEXT CONTEXT * Icxstack;
1236IEXT I32 Icxstack_ix IINIT(-1);
1237IEXT I32 Icxstack_max IINIT(128);
1238IEXT jmp_buf Itop_env;
1239
1240/* stack stuff */
1241IEXT AV * Istack; /* THE STACK */
1242IEXT AV * Imainstack; /* the stack when nothing funny is happening */
1243IEXT SV ** Imystack_base; /* stack->array_ary */
1244IEXT SV ** Imystack_sp; /* stack pointer now */
1245IEXT SV ** Imystack_max; /* stack->array_ary + stack->array_max */
1246
1247/* format accumulators */
463ee0b2 1248IEXT SV * Iformtarget;
1249IEXT SV * Ibodytarget;
1250IEXT SV * Itoptarget;
79072805 1251
1252/* statics moved here for shared library purposes */
93a17b20 1253IEXT SV Istrchop; /* return value from chop */
79072805 1254IEXT int Ifilemode; /* so nextargv() can preserve mode */
1255IEXT int Ilastfd; /* what to preserve mode on */
1256IEXT char * Ioldname; /* what to preserve mode on */
1257IEXT char ** IArgv; /* stuff to free from do_aexec, vfork safe */
1258IEXT char * ICmd; /* stuff to free from do_aexec, vfork safe */
1259IEXT OP * Isortcop; /* user defined sort routine */
1260IEXT HV * Isortstash; /* which is in some package or other */
1261IEXT GV * Ifirstgv; /* $a */
1262IEXT GV * Isecondgv; /* $b */
1263IEXT AV * Isortstack; /* temp stack during pp_sort() */
1264IEXT AV * Isignalstack; /* temp stack during sighandler() */
1265IEXT SV * Imystrk; /* temp key string for do_each() */
1266IEXT I32 Idumplvl; /* indentation level on syntax tree dump */
79072805 1267IEXT PMOP * Ioldlastpm; /* for saving regexp context during debugger */
1268IEXT I32 Igensym; /* next symbol for getsym() to define */
1269IEXT bool Ipreambled;
1270IEXT int Ilaststatval IINIT(-1);
1271IEXT I32 Ilaststype IINIT(OP_STAT);
1272
1273#undef IEXT
1274#undef IINIT
1275
8990e307 1276#ifdef MULTIPLICITY
79072805 1277};
1278#else
1279struct interpreter {
1280 char broiled;
1281};
1282#endif
1283
1284#include "pp.h"
1285
1286#ifdef __cplusplus
1287extern "C" {
1288#endif
1289
1290#include "proto.h"
1291
1292#ifdef __cplusplus
1293};
1294#endif
1295
93a17b20 1296/* The following must follow proto.h */
79072805 1297
1298#ifdef DOINIT
463ee0b2 1299MGVTBL vtbl_sv = {magic_get,
1300 magic_set,
1301 magic_len,
1302 0, 0};
1303MGVTBL vtbl_env = {0, 0, 0, 0, 0};
1304MGVTBL vtbl_envelem = {0, magic_setenv,
1305 0, 0, 0};
1306MGVTBL vtbl_sig = {0, 0, 0, 0, 0};
1307MGVTBL vtbl_sigelem = {0, magic_setsig,
1308 0, 0, 0};
1309MGVTBL vtbl_pack = {0, 0,
1310 0, 0, 0};
1311MGVTBL vtbl_packelem = {magic_getpack,
1312 magic_setpack,
1313 0, magic_clearpack,
1314 0};
1315MGVTBL vtbl_dbline = {0, magic_setdbline,
1316 0, 0, 0};
1317MGVTBL vtbl_isa = {0, magic_setisa,
1318 0, 0, 0};
1319MGVTBL vtbl_isaelem = {0, magic_setisa,
1320 0, 0, 0};
1321MGVTBL vtbl_arylen = {magic_getarylen,
1322 magic_setarylen,
1323 0, 0, 0};
1324MGVTBL vtbl_glob = {magic_getglob,
1325 magic_setglob,
1326 0, 0, 0};
1327MGVTBL vtbl_mglob = {0, magic_setmglob,
1328 0, 0, 0};
1329MGVTBL vtbl_taint = {magic_gettaint,magic_settaint,
1330 0, 0, 0};
1331MGVTBL vtbl_substr = {0, magic_setsubstr,
1332 0, 0, 0};
1333MGVTBL vtbl_vec = {0, magic_setvec,
1334 0, 0, 0};
1335MGVTBL vtbl_bm = {0, magic_setbm,
1336 0, 0, 0};
1337MGVTBL vtbl_uvar = {magic_getuvar,
1338 magic_setuvar,
1339 0, 0, 0};
79072805 1340#else
1341EXT MGVTBL vtbl_sv;
1342EXT MGVTBL vtbl_env;
1343EXT MGVTBL vtbl_envelem;
1344EXT MGVTBL vtbl_sig;
1345EXT MGVTBL vtbl_sigelem;
463ee0b2 1346EXT MGVTBL vtbl_pack;
1347EXT MGVTBL vtbl_packelem;
79072805 1348EXT MGVTBL vtbl_dbline;
463ee0b2 1349EXT MGVTBL vtbl_isa;
1350EXT MGVTBL vtbl_isaelem;
79072805 1351EXT MGVTBL vtbl_arylen;
1352EXT MGVTBL vtbl_glob;
93a17b20 1353EXT MGVTBL vtbl_mglob;
463ee0b2 1354EXT MGVTBL vtbl_taint;
79072805 1355EXT MGVTBL vtbl_substr;
1356EXT MGVTBL vtbl_vec;
1357EXT MGVTBL vtbl_bm;
1358EXT MGVTBL vtbl_uvar;
1359#endif