3 * Copyright (c) 1987-1994, Larry Wall
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.
15 * This file is being used for x2p stuff.
16 * Above symbol is defined via -D in 'x2p/Makefile.SH'
17 * Decouple x2p stuff from some of perls more extreme eccentricities.
23 #endif /* PERL_FOR_X2P */
26 * STMT_START { statements; } STMT_END;
27 * can be used as a single statement, as in
28 * if (x) STMT_START { ... } STMT_END; else ...
30 * Trying to select a version that gives no warnings...
32 #if !(defined(STMT_START) && defined(STMT_END))
33 # if defined(__GNUC__) && !defined(__STRICT_ANSI__)
34 # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */
37 /* Now which other defined()s do we need here ??? */
38 # if (VOIDFLAGS) && (defined(sun) || defined(__sun__))
39 # define STMT_START if (1)
40 # define STMT_END else (void)0
42 # define STMT_START do
43 # define STMT_END while (0)
54 # define BYTEORDER 0x1234
57 /* Overall memory policy? */
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...
70 /* define this once if either system, instead of cluttering up the src */
71 #if defined(MSDOS) || defined(atarist)
75 #if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
79 #if defined(HASVOLATILE) || defined(STANDARD_C)
81 # define VOL // to temporarily suppress warnings
89 #define TAINT_IF(c) (tainted |= (c))
90 #define TAINT_NOT (tainted = 0)
91 #define TAINT_PROPER(s) if (tainting) taint_proper(no_security, s)
92 #define TAINT_ENV() if (tainting) taint_env()
94 /* XXX All process group stuff is handled in pp_sys.c. Should these
95 defines move there? If so, I could simplify this a lot. --AD 9/96.
97 /* Process group stuff changed from traditional BSD to POSIX.
98 perlfunc.pod documents the traditional BSD-style syntax, so we'll
99 try to preserve that, if possible.
102 # define BSD_SETPGRP(pid, pgrp) setpgid((pid), (pgrp))
104 # if defined(HAS_SETPGRP) && defined(USE_BSD_SETPGRP)
105 # define BSD_SETPGRP(pid, pgrp) setpgrp((pid), (pgrp))
107 # ifdef HAS_SETPGRP2 /* DG/UX */
108 # define BSD_SETPGRP(pid, pgrp) setpgrp2((pid), (pgrp))
112 #if defined(BSD_SETPGRP) && !defined(HAS_SETPGRP)
113 # define HAS_SETPGRP /* Well, effectively it does . . . */
116 /* getpgid isn't POSIX, but at least Solaris and Linux have it, and it makes
117 our life easier :-) so we'll try it.
120 # define BSD_GETPGRP(pid) getpgid((pid))
122 # if defined(HAS_GETPGRP) && defined(USE_BSD_GETPGRP)
123 # define BSD_GETPGRP(pid) getpgrp((pid))
125 # ifdef HAS_GETPGRP2 /* DG/UX */
126 # define BSD_GETPGRP(pid) getpgrp2((pid))
130 #if defined(BSD_GETPGRP) && !defined(HAS_GETPGRP)
131 # define HAS_GETPGRP /* Well, effectively it does . . . */
134 /* These are not exact synonyms, since setpgrp() and getpgrp() may
135 have different behaviors, but perl.h used to define USE_BSDPGRP
136 (prior to 5.003_05) so some extension might depend on it.
138 #if defined(USE_BSD_SETPGRP) || defined(USE_BSD_GETPGRP)
144 #ifndef _TYPES_ /* If types.h defines this it's easy. */
145 # ifndef major /* Does everyone's types.h define this? */
146 # include <sys/types.h>
160 # include <varargs.h>
166 #ifdef USE_NEXT_CTYPE
168 #if NX_CURRENT_COMPILER_RELEASE >= 400
169 #include <objc/NXCType.h>
170 #else /* NX_CURRENT_COMPILER_RELEASE < 400 */
171 #include <appkit/NXCType.h>
172 #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
174 #else /* !USE_NEXT_CTYPE */
176 #endif /* USE_NEXT_CTYPE */
182 EXT int lc_collate_active;
184 #ifdef METHOD /* Defined by OSF/1 v3.0 by ctype.h */
191 # ifdef PARAM_NEEDS_TYPES
192 # include <sys/types.h>
194 # include <sys/param.h>
198 /* Use all the "standard" definitions? */
199 #if defined(STANDARD_C) && defined(I_STDLIB)
201 #endif /* STANDARD_C */
203 /* Maybe this comes after <stdlib.h> so we don't try to change
204 the standard library prototypes?. We'll use our own in
205 proto.h instead. I guess. The patch had no explanation.
209 # define malloc Mymalloc
210 # define realloc Myremalloc
212 # define calloc Mycalloc
214 # define safemalloc malloc
215 # define saferealloc realloc
216 # define safefree free
217 # define safecalloc calloc
220 #define MEM_SIZE Size_t
222 #if defined(I_STRING) || defined(__cplusplus)
225 # include <strings.h>
228 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
230 #define strrchr rindex
233 #if defined(mips) && defined(ultrix) && !defined(__STDC__)
242 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
244 extern char * memcpy _((char*, char*, int));
250 # define memcpy(d,s,l) bcopy(s,d,l)
252 # define memcpy(d,s,l) my_bcopy(s,d,l)
255 #endif /* HAS_MEMCPY */
258 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
260 extern char *memset _((char*, int, int));
263 # define memzero(d,l) memset(d,0,l)
267 # define memzero(d,l) bzero(d,l)
269 # define memzero(d,l) my_bzero(d,l)
272 #endif /* HAS_MEMSET */
275 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
277 extern int memcmp _((char*, char*, int));
282 # define memcmp my_memcmp
284 #endif /* HAS_MEMCMP */
286 #if !defined(HAS_MEMMOVE) && !defined(memmove)
287 # if defined(HAS_BCOPY) && defined(HAS_SAFE_BCOPY)
288 # define memmove(d,s,l) bcopy(s,d,l)
290 # if defined(HAS_MEMCPY) && defined(HAS_SAFE_MEMCPY)
291 # define memmove(d,s,l) memcpy(d,s,l)
293 # define memmove(d,s,l) my_bcopy(s,d,l)
299 # include <netinet/in.h>
303 #include <sys/stat.h>
306 /* The stat macros for Amdahl UTS, Unisoft System V/88 (and derivatives
307 like UTekV) are broken, sometimes giving false positives. Undefine
308 them here and let the code below set them to proper values.
310 The ghs macro stands for GreenHills Software C-1.8.5 which
311 is the C compiler for sysV88 and the various derivatives.
312 This header file bug is corrected in gcc-2.5.8 and later versions.
313 --Kaveh Ghazi (ghazi@noc.rutgers.edu) 10/3/94. */
315 #if defined(uts) || (defined(m88k) && defined(ghs))
329 # ifdef I_SYS_TIME_KERNEL
332 # include <sys/time.h>
333 # ifdef I_SYS_TIME_KERNEL
339 # if defined(HAS_TIMES) && defined(I_SYS_TIMES)
340 # include <sys/times.h>
344 #if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
350 # define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO, 0))
352 #endif /* !HAS_MKFIFO */
357 # include <net/errno.h>
361 # define FIXSTATUS(sts) (U_L((sts) & 0xffff))
362 # define SHIFTSTATUS(sts) ((sts) >> 8)
363 # define SETERRNO(errcode,vmserrcode) errno = (errcode)
365 # define FIXSTATUS(sts) (U_L(sts))
366 # define SHIFTSTATUS(sts) (sts)
367 # define SETERRNO(errcode,vmserrcode) STMT_START {set_errno(errcode); set_vaxc_errno(vmserrcode);} STMT_END
372 extern int errno; /* ANSI allows errno to be an lvalue expr */
378 char *strerror _((int,...));
380 char *strerror _((int));
383 # define Strerror strerror
386 # ifdef HAS_SYS_ERRLIST
388 extern char *sys_errlist[];
390 # define Strerror(e) \
391 ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
398 # include <sys/ioctl.h>
402 #if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
403 # ifdef HAS_SOCKETPAIR
404 # undef HAS_SOCKETPAIR
419 /* Configure already sets Direntry_t */
420 #if defined(I_DIRENT)
422 # if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
423 # include <sys/dir.h>
427 # include <sys/ndir.h>
431 # include <ndir.h> /* may be wrong in the future */
433 # include <sys/dir.h>
440 /* work around botch in SunOS 4.0.1 and 4.0.2 */
442 # define fputs(sv,fp) fprintf(fp,"%s",sv)
447 * The following gobbledygook brought to you on behalf of __STDC__.
448 * (I could just use #ifndef __STDC__, but this is more bulletproof
449 * in the face of half-implementations.)
454 # define S_IFMT _S_IFMT
456 # define S_IFMT 0170000
461 # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
465 # define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
470 # define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
472 # define S_ISBLK(m) (0)
477 # define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
482 # define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
484 # define S_ISFIFO(m) (0)
490 # define S_ISLNK(m) _S_ISLNK(m)
493 # define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
496 # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
498 # define S_ISLNK(m) (0)
506 # define S_ISSOCK(m) _S_ISSOCK(m)
509 # define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
512 # define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
514 # define S_ISSOCK(m) (0)
522 # define S_IRUSR S_IREAD
523 # define S_IWUSR S_IWRITE
524 # define S_IXUSR S_IEXEC
526 # define S_IRUSR 0400
527 # define S_IWUSR 0200
528 # define S_IXUSR 0100
530 # define S_IRGRP (S_IRUSR>>3)
531 # define S_IWGRP (S_IWUSR>>3)
532 # define S_IXGRP (S_IXUSR>>3)
533 # define S_IROTH (S_IRUSR>>6)
534 # define S_IWOTH (S_IWUSR>>6)
535 # define S_IXOTH (S_IXUSR>>6)
539 # define S_ISUID 04000
543 # define S_ISGID 02000
550 #if defined(cray) || defined(gould) || defined(i860) || defined(pyr)
551 # define SLOPPYDIVIDE
554 #if defined(cray) || defined(convex) || BYTEORDER > 0xffff
562 /* XXX QUAD stuff is not currently supported on most systems.
563 Specifically, perl internals don't support long long. Among
564 the many problems is that some compilers support long long,
565 but the underlying library functions (such as sprintf) don't.
566 Some things do work (such as quad pack/unpack on convex);
567 also some systems use long long for the fpos_t typedef. That
570 The IV type is supposed to be long enough to hold any integral
572 --Andy Dougherty August 1996
580 # define Quad_t long long
586 typedef unsigned Quad_t UV;
587 # define IV_MAX PERL_QUAD_MAX
588 # define IV_MIN PERL_QUAD_MIN
589 # define UV_MAX PERL_UQUAD_MAX
590 # define UV_MIN PERL_UQUAD_MIN
593 typedef unsigned long UV;
594 # define IV_MAX PERL_LONG_MAX
595 # define IV_MIN PERL_LONG_MIN
596 # define UV_MAX PERL_ULONG_MAX
597 # define UV_MIN PERL_ULONG_MIN
600 /* Previously these definitions used hardcoded figures.
601 * It is hoped these formula are more portable, although
602 * no data one way or another is presently known to me.
603 * The "PERL_" names are used because these calculated constants
604 * do not meet the ANSI requirements for LONG_MAX, etc., which
605 * need to be constants acceptable to #if - kja
606 * define PERL_LONG_MAX 2147483647L
607 * define PERL_LONG_MIN (-LONG_MAX - 1)
608 * define PERL ULONG_MAX 4294967295L
611 #ifdef I_LIMITS /* Needed for cast_xxx() functions below. */
620 * Try to figure out max and min values for the integral types. THE CORRECT
621 * SOLUTION TO THIS MESS: ADAPT enquire.c FROM GCC INTO CONFIGURE. The
622 * following hacks are used if neither limits.h or values.h provide them:
623 * U<TYPE>_MAX: for types >= int: ~(unsigned TYPE)0
624 * for types < int: (unsigned TYPE)~(unsigned)0
625 * The argument to ~ must be unsigned so that later signed->unsigned
626 * conversion can't modify the value's bit pattern (e.g. -0 -> +0),
627 * and it must not be smaller than int because ~ does integral promotion.
628 * <type>_MAX: (<type>) (U<type>_MAX >> 1)
629 * <type>_MIN: -<type>_MAX - <is_twos_complement_architecture: (3 & -1) == 3>.
630 * The latter is a hack which happens to work on some machines but
631 * does *not* catch any random system, or things like integer types
632 * with NaN if that is possible.
634 * All of the types are explicitly cast to prevent accidental loss of
635 * numeric range, and in the hope that they will be less likely to confuse
636 * over-eager optimizers.
640 #define PERL_UCHAR_MIN ((unsigned char)0)
643 # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
646 # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
648 # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
653 * CHAR_MIN and CHAR_MAX are not included here, as the (char) type may be
654 * ambiguous. It may be equivalent to (signed char) or (unsigned char)
655 * depending on local options. Until Configure detects this (or at least
656 * detects whether the "signed" keyword is available) the CHAR ranges
657 * will not be included. UCHAR functions normally.
661 #define PERL_USHORT_MIN ((unsigned short)0)
664 # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
667 # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
669 # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
674 # define PERL_SHORT_MAX ((short)SHORT_MAX)
676 # ifdef MAXSHORT /* Often used in <values.h> */
677 # define PERL_SHORT_MAX ((short)MAXSHORT)
679 # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
684 # define PERL_SHORT_MIN ((short)SHORT_MIN)
687 # define PERL_SHORT_MIN ((short)MINSHORT)
689 # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
694 # define PERL_UINT_MAX ((unsigned int)UINT_MAX)
697 # define PERL_UINT_MAX ((unsigned int)MAXUINT)
699 # define PERL_UINT_MAX (~(unsigned int)0)
703 #define PERL_UINT_MIN ((unsigned int)0)
706 # define PERL_INT_MAX ((int)INT_MAX)
708 # ifdef MAXINT /* Often used in <values.h> */
709 # define PERL_INT_MAX ((int)MAXINT)
711 # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
716 # define PERL_INT_MIN ((int)INT_MIN)
719 # define PERL_INT_MIN ((int)MININT)
721 # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
726 # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
729 # define PERL_ULONG_MAX ((unsigned long)MAXULONG)
731 # define PERL_ULONG_MAX (~(unsigned long)0)
735 #define PERL_ULONG_MIN ((unsigned long)0L)
738 # define PERL_LONG_MAX ((long)LONG_MAX)
740 # ifdef MAXLONG /* Often used in <values.h> */
741 # define PERL_LONG_MAX ((long)MAXLONG)
743 # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
748 # define PERL_LONG_MIN ((long)LONG_MIN)
751 # define PERL_LONG_MIN ((long)MINLONG)
753 # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
760 # define PERL_UQUAD_MAX ((UV)UQUAD_MAX)
762 # define PERL_UQUAD_MAX (~(UV)0)
765 # define PERL_UQUAD_MIN ((UV)0)
768 # define PERL_QUAD_MAX ((IV)QUAD_MAX)
770 # define PERL_QUAD_MAX ((IV) (PERL_UQUAD_MAX >> 1))
774 # define PERL_QUAD_MIN ((IV)QUAD_MIN)
776 # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
781 typedef MEM_SIZE STRLEN;
783 typedef struct op OP;
784 typedef struct cop COP;
785 typedef struct unop UNOP;
786 typedef struct binop BINOP;
787 typedef struct listop LISTOP;
788 typedef struct logop LOGOP;
789 typedef struct condop CONDOP;
790 typedef struct pmop PMOP;
791 typedef struct svop SVOP;
792 typedef struct gvop GVOP;
793 typedef struct pvop PVOP;
794 typedef struct loop LOOP;
796 typedef struct Outrec Outrec;
797 typedef struct interpreter PerlInterpreter;
798 typedef struct ff FF;
799 typedef struct sv SV;
800 typedef struct av AV;
801 typedef struct hv HV;
802 typedef struct cv CV;
803 typedef struct regexp REGEXP;
804 typedef struct gp GP;
805 typedef struct gv GV;
806 typedef struct io IO;
807 typedef struct context CONTEXT;
808 typedef struct block BLOCK;
810 typedef struct magic MAGIC;
811 typedef struct xrv XRV;
812 typedef struct xpv XPV;
813 typedef struct xpviv XPVIV;
814 typedef struct xpvnv XPVNV;
815 typedef struct xpvmg XPVMG;
816 typedef struct xpvlv XPVLV;
817 typedef struct xpvav XPVAV;
818 typedef struct xpvhv XPVHV;
819 typedef struct xpvgv XPVGV;
820 typedef struct xpvcv XPVCV;
821 typedef struct xpvbm XPVBM;
822 typedef struct xpvfm XPVFM;
823 typedef struct xpvio XPVIO;
824 typedef struct mgvtbl MGVTBL;
825 typedef union any ANY;
829 typedef I32 (*filter_t) _((int, SV *, int));
830 #define FILTER_READ(idx, sv, len) filter_read(idx, sv, len)
831 #define FILTER_DATA(idx) (AvARRAY(rsfp_filters)[idx])
832 #define FILTER_ISREADER(idx) (idx >= AvFILL(rsfp_filters))
845 # include "./plan9/plan9ish.h"
847 # include "unixish.h"
852 /* Some unistd.h's give a prototype for pause() even though
853 HAS_PAUSE ends up undefined. This causes the #define
854 below to be rejected by the compmiler. Sigh.
859 #define Pause() sleep((32767<<16)+32767)
864 /* on BSDish systes we're safe */
865 # define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
867 /* otherwise guess at what's safe */
868 # define IOCPARM_LEN(x) 256
877 void (*any_dptr) _((void*));
894 /* work around some libPW problems */
899 #if defined(iAPX286) || defined(M_I286) || defined(I80286)
903 #if defined(htonl) && !defined(HAS_HTONL)
906 #if defined(htons) && !defined(HAS_HTONS)
909 #if defined(ntohl) && !defined(HAS_NTOHL)
912 #if defined(ntohs) && !defined(HAS_NTOHS)
916 #if (BYTEORDER & 0xffff) != 0x4321
922 #define htons my_swap
923 #define htonl my_htonl
924 #define ntohs my_swap
925 #define ntohl my_ntohl
928 #if (BYTEORDER & 0xffff) == 0x4321
937 * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
940 #if BYTEORDER != 0x1234
945 # if BYTEORDER == 0x4321
946 # define vtohl(x) ((((x)&0xFF)<<24) \
948 +(((x)&0x0000FF00)<<8) \
949 +(((x)&0x00FF0000)>>8) )
950 # define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
951 # define htovl(x) vtohl(x)
952 # define htovs(x) vtohs(x)
954 /* otherwise default to functions in util.c */
958 #define U_S(what) ((U16)(what))
959 #define U_I(what) ((unsigned int)(what))
960 #define U_L(what) ((U32)(what))
965 U32 cast_ulong _((double));
969 #define U_S(what) ((U16)cast_ulong((double)(what)))
970 #define U_I(what) ((unsigned int)cast_ulong((double)(what)))
971 #define U_L(what) (cast_ulong((double)(what)))
975 #define I_32(what) ((I32)(what))
976 #define I_V(what) ((IV)(what))
977 #define U_V(what) ((UV)(what))
982 I32 cast_i32 _((double));
983 IV cast_iv _((double));
984 UV cast_uv _((double));
988 #define I_32(what) (cast_i32((double)(what)))
989 #define I_V(what) (cast_iv((double)(what)))
990 #define U_V(what) (cast_uv((double)(what)))
1004 # define TMPPATH "/tmp/perl-eXXXXXX"
1008 Uid_t getuid _((void));
1009 Uid_t geteuid _((void));
1010 Gid_t getgid _((void));
1011 Gid_t getegid _((void));
1015 #ifndef Perl_debug_log
1016 #define Perl_debug_log PerlIO_stderr()
1020 #define DEBUG(a) if (debug) a
1021 #define DEBUG_p(a) if (debug & 1) a
1022 #define DEBUG_s(a) if (debug & 2) a
1023 #define DEBUG_l(a) if (debug & 4) a
1024 #define DEBUG_t(a) if (debug & 8) a
1025 #define DEBUG_o(a) if (debug & 16) a
1026 #define DEBUG_c(a) if (debug & 32) a
1027 #define DEBUG_P(a) if (debug & 64) a
1028 #define DEBUG_m(a) if (curinterp && debug & 128) a
1029 #define DEBUG_f(a) if (debug & 256) a
1030 #define DEBUG_r(a) if (debug & 512) a
1031 #define DEBUG_x(a) if (debug & 1024) a
1032 #define DEBUG_u(a) if (debug & 2048) a
1033 #define DEBUG_L(a) if (debug & 4096) a
1034 #define DEBUG_H(a) if (debug & 8192) a
1035 #define DEBUG_X(a) if (debug & 16384) a
1036 #define DEBUG_D(a) if (debug & 32768) a
1057 #define YYMAXDEPTH 300
1059 #ifndef assert /* <assert.h> might have been included somehow */
1060 #define assert(what) DEB( { \
1062 croak("Assertion failed: file \"%s\", line %d", \
1063 __FILE__, __LINE__); \
1069 I32 (*uf_val)_((IV, SV*));
1070 I32 (*uf_set)_((IV, SV*));
1074 /* Fix these up for __STDC__ */
1076 char *mktemp _((char*));
1077 double atof _((const char*));
1081 /* All of these are in stdlib.h or time.h for ANSI C */
1083 struct tm *gmtime(), *localtime();
1084 char *strchr(), *strrchr();
1085 char *strcpy(), *strcat();
1086 #endif /* ! STANDARD_C */
1095 double exp _((double));
1096 double log _((double));
1097 double sqrt _((double));
1098 double modf _((double,double*));
1099 double sin _((double));
1100 double cos _((double));
1101 double atan2 _((double,double));
1102 double pow _((double,double));
1109 #ifdef __NeXT__ /* or whatever catches all NeXTs */
1110 char *crypt (); /* Maybe more hosts will need the unprototyped version */
1112 char *crypt _((const char*, const char*));
1114 char *getenv _((const char*));
1115 Off_t lseek _((int,Off_t,int));
1116 char *getlogin _((void));
1119 #ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */
1120 #define UNLINK unlnk
1121 I32 unlnk _((char*));
1123 #define UNLINK unlink
1126 #ifndef HAS_SETREUID
1127 # ifdef HAS_SETRESUID
1128 # define setreuid(r,e) setresuid(r,e,(Uid_t)-1)
1129 # define HAS_SETREUID
1132 #ifndef HAS_SETREGID
1133 # ifdef HAS_SETRESGID
1134 # define setregid(r,e) setresgid(r,e,(Gid_t)-1)
1135 # define HAS_SETREGID
1144 # ifndef DEBUGGING_MSTATS
1145 # define DEBUGGING_MSTATS
1153 # define PAD_SV(po) pad_sv(po)
1155 # define PAD_SV(po) curpad[po]
1163 EXT PerlInterpreter * curinterp; /* currently running interpreter */
1164 /* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
1165 #if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
1166 extern char ** environ; /* environment variables supplied via exec */
1168 # if defined(NeXT) && defined(__DYNAMIC__)
1170 # include <mach-o/dyld.h>
1171 EXT char *** environ_pointer;
1172 # define environ (*environ_pointer)
1174 #endif /* environ processing */
1176 EXT int uid; /* current real user id */
1177 EXT int euid; /* current effective user id */
1178 EXT int gid; /* current real group id */
1179 EXT int egid; /* current effective group id */
1180 EXT bool nomemok; /* let malloc context handle nomem */
1181 EXT U32 an; /* malloc sequence number */
1182 EXT U32 cop_seqmax; /* statement sequence number */
1183 EXT U16 op_seqmax; /* op sequence number */
1184 EXT U32 evalseq; /* eval sequence number */
1185 EXT U32 sub_generation; /* inc to force methods to be looked up again */
1186 EXT char ** origenviron;
1188 EXT U32 * profiledata;
1189 EXT int maxo INIT(MAXO);/* Number of ops */
1190 EXT char * osname; /* operating system */
1192 EXT XPV* xiv_arenaroot; /* list of allocated xiv areas */
1193 EXT IV ** xiv_root; /* free xiv list--shared by interpreters */
1194 EXT double * xnv_root; /* free xnv list--shared by interpreters */
1195 EXT XRV * xrv_root; /* free xrv list--shared by interpreters */
1196 EXT XPV * xpv_root; /* free xpv list--shared by interpreters */
1197 EXT HE * he_root; /* free he list--shared by interpreters */
1198 EXT char * nice_chunk; /* a nice chunk of memory to reuse */
1199 EXT U32 nice_chunk_size;/* how nice the chunk of memory is */
1201 /* Stack for currently executing thread--context switch must handle this. */
1202 EXT SV ** stack_base; /* stack->array_ary */
1203 EXT SV ** stack_sp; /* stack pointer now */
1204 EXT SV ** stack_max; /* stack->array_ary + stack->array_max */
1206 /* likewise for these */
1208 EXT OP * op; /* current op--oughta be in a global register */
1210 EXT I32 * scopestack; /* blocks we've entered */
1211 EXT I32 scopestack_ix;
1212 EXT I32 scopestack_max;
1214 EXT ANY* savestack; /* to save non-local values on */
1215 EXT I32 savestack_ix;
1216 EXT I32 savestack_max;
1218 EXT OP ** retstack; /* returns we've pushed */
1219 EXT I32 retstack_ix;
1220 EXT I32 retstack_max;
1222 EXT I32 * markstack; /* stackmarks we're remembering */
1223 EXT I32 * markstack_ptr; /* stackmarks we're remembering */
1224 EXT I32 * markstack_max; /* stackmarks we're remembering */
1232 EXT char buf[2048]; /* should be longer than PATH_MAX */
1233 EXT char tokenbuf[256];
1234 EXT struct stat statbuf;
1236 EXT struct tms timesbuf;
1238 EXT STRLEN na; /* for use in SvPV when length is Not Applicable */
1240 /* for tmp use in stupid debuggers */
1245 /* handy constants */
1246 EXT char * Yes INIT("1");
1247 EXT char * No INIT("");
1248 EXT char * hexdigit INIT("0123456789abcdef0123456789ABCDEFx");
1249 EXT char * patleave INIT("\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}");
1250 EXT char * vert INIT("|");
1252 EXT char warn_uninit[]
1253 INIT("Use of uninitialized value");
1254 EXT char warn_nosemi[]
1255 INIT("Semicolon seems to be missing");
1256 EXT char warn_reserved[]
1257 INIT("Unquoted string \"%s\" may clash with future reserved word");
1259 INIT("Unsuccessful %s on filename containing newline");
1260 EXT char no_wrongref[]
1261 INIT("Can't use %s ref as %s ref");
1262 EXT char no_symref[]
1263 INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");
1265 INIT("Can't use an undefined value as %s reference");
1267 INIT("Modification of non-creatable array value attempted, subscript %d");
1269 INIT("Modification of non-creatable hash value attempted, subscript \"%s\"");
1270 EXT char no_modify[]
1271 INIT("Modification of a read-only value attempted");
1273 INIT("Out of memory!\n");
1274 EXT char no_security[]
1275 INIT("Insecure dependency in %s%s");
1276 EXT char no_sock_func[]
1277 INIT("Unsupported socket function \"%s\" called");
1278 EXT char no_dir_func[]
1279 INIT("Unsupported directory function \"%s\" called");
1281 INIT("The %s function is unimplemented");
1282 EXT char no_myglob[]
1283 INIT("\"my\" variable %s can't be in a package");
1289 EXT char * cshname INIT(CSH);
1294 EXT char *sig_name[] = { SIG_NAME };
1295 EXT int sig_num[] = { SIG_NUM };
1296 EXT SV * psig_ptr[sizeof(sig_num)/sizeof(*sig_num)];
1297 EXT SV * psig_name[sizeof(sig_num)/sizeof(*sig_num)];
1299 EXT char *sig_name[];
1301 EXT SV * psig_ptr[];
1302 EXT SV * psig_name[];
1306 EXT unsigned char fold[] = { /* fast case folding table */
1307 0, 1, 2, 3, 4, 5, 6, 7,
1308 8, 9, 10, 11, 12, 13, 14, 15,
1309 16, 17, 18, 19, 20, 21, 22, 23,
1310 24, 25, 26, 27, 28, 29, 30, 31,
1311 32, 33, 34, 35, 36, 37, 38, 39,
1312 40, 41, 42, 43, 44, 45, 46, 47,
1313 48, 49, 50, 51, 52, 53, 54, 55,
1314 56, 57, 58, 59, 60, 61, 62, 63,
1315 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
1316 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
1317 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
1318 'x', 'y', 'z', 91, 92, 93, 94, 95,
1319 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
1320 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
1321 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
1322 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
1323 128, 129, 130, 131, 132, 133, 134, 135,
1324 136, 137, 138, 139, 140, 141, 142, 143,
1325 144, 145, 146, 147, 148, 149, 150, 151,
1326 152, 153, 154, 155, 156, 157, 158, 159,
1327 160, 161, 162, 163, 164, 165, 166, 167,
1328 168, 169, 170, 171, 172, 173, 174, 175,
1329 176, 177, 178, 179, 180, 181, 182, 183,
1330 184, 185, 186, 187, 188, 189, 190, 191,
1331 192, 193, 194, 195, 196, 197, 198, 199,
1332 200, 201, 202, 203, 204, 205, 206, 207,
1333 208, 209, 210, 211, 212, 213, 214, 215,
1334 216, 217, 218, 219, 220, 221, 222, 223,
1335 224, 225, 226, 227, 228, 229, 230, 231,
1336 232, 233, 234, 235, 236, 237, 238, 239,
1337 240, 241, 242, 243, 244, 245, 246, 247,
1338 248, 249, 250, 251, 252, 253, 254, 255
1341 EXT unsigned char fold[];
1345 EXT unsigned char freq[] = { /* letter frequencies for mixed English/C */
1346 1, 2, 84, 151, 154, 155, 156, 157,
1347 165, 246, 250, 3, 158, 7, 18, 29,
1348 40, 51, 62, 73, 85, 96, 107, 118,
1349 129, 140, 147, 148, 149, 150, 152, 153,
1350 255, 182, 224, 205, 174, 176, 180, 217,
1351 233, 232, 236, 187, 235, 228, 234, 226,
1352 222, 219, 211, 195, 188, 193, 185, 184,
1353 191, 183, 201, 229, 181, 220, 194, 162,
1354 163, 208, 186, 202, 200, 218, 198, 179,
1355 178, 214, 166, 170, 207, 199, 209, 206,
1356 204, 160, 212, 216, 215, 192, 175, 173,
1357 243, 172, 161, 190, 203, 189, 164, 230,
1358 167, 248, 227, 244, 242, 255, 241, 231,
1359 240, 253, 169, 210, 245, 237, 249, 247,
1360 239, 168, 252, 251, 254, 238, 223, 221,
1361 213, 225, 177, 197, 171, 196, 159, 4,
1362 5, 6, 8, 9, 10, 11, 12, 13,
1363 14, 15, 16, 17, 19, 20, 21, 22,
1364 23, 24, 25, 26, 27, 28, 30, 31,
1365 32, 33, 34, 35, 36, 37, 38, 39,
1366 41, 42, 43, 44, 45, 46, 47, 48,
1367 49, 50, 52, 53, 54, 55, 56, 57,
1368 58, 59, 60, 61, 63, 64, 65, 66,
1369 67, 68, 69, 70, 71, 72, 74, 75,
1370 76, 77, 78, 79, 80, 81, 82, 83,
1371 86, 87, 88, 89, 90, 91, 92, 93,
1372 94, 95, 97, 98, 99, 100, 101, 102,
1373 103, 104, 105, 106, 108, 109, 110, 111,
1374 112, 113, 114, 115, 116, 117, 119, 120,
1375 121, 122, 123, 124, 125, 126, 127, 128,
1376 130, 131, 132, 133, 134, 135, 136, 137,
1377 138, 139, 141, 142, 143, 144, 145, 146
1380 EXT unsigned char freq[];
1385 EXT char* block_type[] = {
1394 EXT char* block_type[];
1398 /*****************************************************************************/
1399 /* This lexer/parser stuff is currently global since yacc is hard to reenter */
1400 /*****************************************************************************/
1401 /* XXX This needs to be revisited, since BEGIN makes yacc re-enter... */
1414 EXT U32 lex_state; /* next token is determined */
1415 EXT U32 lex_defer; /* state after determined token */
1416 EXT expectation lex_expect; /* expect after determined token */
1417 EXT I32 lex_brackets; /* bracket count */
1418 EXT I32 lex_formbrack; /* bracket count at outer format level */
1419 EXT I32 lex_fakebrack; /* outer bracket is mere delimiter */
1420 EXT I32 lex_casemods; /* casemod count */
1421 EXT I32 lex_dojoin; /* doing an array interpolation */
1422 EXT I32 lex_starts; /* how many interps done on level */
1423 EXT SV * lex_stuff; /* runtime pattern from m// or s/// */
1424 EXT SV * lex_repl; /* runtime replacement from s/// */
1425 EXT OP * lex_op; /* extra info to pass back on op */
1426 EXT OP * lex_inpat; /* in pattern $) and $| are special */
1427 EXT I32 lex_inwhat; /* what kind of quoting are we in */
1428 EXT char * lex_brackstack; /* what kind of brackets to pop */
1429 EXT char * lex_casestack; /* what kind of case mods in effect */
1431 /* What we know when we're in LEX_KNOWNEXT state. */
1432 EXT YYSTYPE nextval[5]; /* value of next token, if any */
1433 EXT I32 nexttype[5]; /* type of next token */
1436 EXT PerlIO * VOL rsfp INIT(Nullfp);
1439 EXT char * oldbufptr;
1440 EXT char * oldoldbufptr;
1442 EXT expectation expect INIT(XSTATE); /* how to interpret ambiguous tokens */
1443 EXT AV * rsfp_filters;
1445 EXT I32 multi_start; /* 1st line of multi-line string */
1446 EXT I32 multi_end; /* last line of multi-line string */
1447 EXT I32 multi_open; /* delimiter of said string */
1448 EXT I32 multi_close; /* delimiter of said string */
1451 EXT I32 error_count; /* how many errors so far, max 10 */
1452 EXT I32 subline; /* line this subroutine began on */
1453 EXT SV * subname; /* name of current subroutine */
1455 EXT CV * compcv; /* currently compiling subroutine */
1456 EXT AV * comppad; /* storage for lexically scoped temporaries */
1457 EXT AV * comppad_name; /* variable names for "my" variables */
1458 EXT I32 comppad_name_fill;/* last "introduced" variable offset */
1459 EXT I32 comppad_name_floor;/* start of vars in innermost block */
1460 EXT I32 min_intro_pending;/* start of vars to introduce */
1461 EXT I32 max_intro_pending;/* end of vars to introduce */
1462 EXT I32 padix; /* max used index in current "register" pad */
1463 EXT I32 padix_floor; /* how low may inner block reset padix */
1464 EXT I32 pad_reset_pending; /* reset pad on next attempted alloc */
1467 EXT I32 thisexpr; /* name id for nothing_in_common() */
1468 EXT char * last_uni; /* position of last named-unary operator */
1469 EXT char * last_lop; /* position of last list operator */
1470 EXT OPCODE last_lop_op; /* last list operator */
1471 EXT bool in_my; /* we're compiling a "my" declaration */
1473 EXT I32 cryptseen; /* has fast crypt() been initialized? */
1476 EXT U32 hints; /* various compilation flags */
1478 /* Note: the lowest 8 bits are reserved for
1479 stuffing into op->op_private */
1480 #define HINT_INTEGER 0x00000001
1481 #define HINT_STRICT_REFS 0x00000002
1483 #define HINT_BLOCK_SCOPE 0x00000100
1484 #define HINT_STRICT_SUBS 0x00000200
1485 #define HINT_STRICT_VARS 0x00000400
1486 #define HINT_STRICT_UNTIE 0x00000800
1488 /**************************************************************************/
1489 /* This regexp stuff is global since it always happens within 1 expr eval */
1490 /**************************************************************************/
1492 EXT char * regprecomp; /* uncompiled string. */
1493 EXT char * regparse; /* Input-scan pointer. */
1494 EXT char * regxend; /* End of input for compile */
1495 EXT I32 regnpar; /* () count. */
1496 EXT char * regcode; /* Code-emit pointer; ®dummy = don't. */
1497 EXT I32 regsize; /* Code size. */
1498 EXT I32 regnaughty; /* How bad is this pattern? */
1499 EXT I32 regsawback; /* Did we see \1, ...? */
1501 EXT char * reginput; /* String-input pointer. */
1502 EXT char * regbol; /* Beginning of input, for ^ check. */
1503 EXT char * regeol; /* End of input, for $ check. */
1504 EXT char ** regstartp; /* Pointer to startp array. */
1505 EXT char ** regendp; /* Ditto for endp. */
1506 EXT U32 * reglastparen; /* Similarly for lastparen. */
1507 EXT char * regtill; /* How far we are required to go. */
1508 EXT U16 regflags; /* are we folding, multilining? */
1509 EXT char regprev; /* char before regbol, \n if none */
1511 EXT bool do_undump; /* -u or dump seen? */
1514 /***********************************************/
1515 /* Global only to current interpreter instance */
1516 /***********************************************/
1521 struct interpreter {
1524 #define IINIT(x) INIT(x)
1527 /* pseudo environmental stuff */
1529 IEXT char ** Iorigargv;
1533 IEXT char * Iorigfilename;
1535 IEXT SV * Iwarnhook;
1536 IEXT SV * Iparsehook;
1538 /* Various states of an input record separator SV (rs, nrs) */
1539 #define RsSNARF(sv) (! SvOK(sv))
1540 #define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
1541 #define RsPARA(sv) (SvOK(sv) && ! SvCUR(sv))
1546 IEXT char Ipatchlevel[10];
1547 IEXT char ** Ilocalpatches;
1549 IEXT char * Isplitstr IINIT(" ");
1550 IEXT bool Ipreprocess;
1556 IEXT bool Idoswitches;
1558 IEXT bool Idoextract;
1559 IEXT bool Isawampersand; /* must save all match strings */
1560 IEXT bool Isawstudy; /* do fbm_instr on all strings */
1561 IEXT bool Isawi; /* study must assume case insensitive */
1564 IEXT char * Iinplace;
1565 IEXT char * Ie_tmpname;
1566 IEXT PerlIO * Ie_fp;
1568 /* This value may be raised by extensions for testing purposes */
1569 IEXT int Iperl_destruct_level; /* 0=none, 1=full, 2=full with checks */
1571 /* magical thingies */
1572 IEXT Time_t Ibasetime; /* $^T */
1573 IEXT SV * Iformfeed; /* $^L */
1574 IEXT char * Ichopset IINIT(" \n-"); /* $: */
1575 IEXT SV * Irs; /* $/ */
1576 IEXT char * Iofs; /* $, */
1577 IEXT STRLEN Iofslen;
1578 IEXT char * Iors; /* $\ */
1579 IEXT STRLEN Iorslen;
1580 IEXT char * Iofmt; /* $# */
1581 IEXT I32 Imaxsysfd IINIT(MAXSYSFD); /* top fd to pass to subprocesses */
1582 IEXT int Imultiline; /* $*--do strings hold >1 line? */
1583 IEXT U32 Istatusvalue; /* $? */
1585 IEXT struct stat Istatcache; /* _ */
1587 IEXT SV * Istatname IINIT(Nullsv);
1589 /* shortcuts to various I/O objects */
1591 IEXT GV * Ilast_in_gv;
1594 IEXT GV * Idefoutgv;
1595 IEXT GV * Iargvoutgv;
1597 /* shortcuts to regexp stuff */
1601 IEXT PMOP * Icurpm; /* what to do \ interps from */
1602 IEXT I32 * Iscreamfirst;
1603 IEXT I32 * Iscreamnext;
1604 IEXT I32 Imaxscream IINIT(-1);
1605 IEXT SV * Ilastscream;
1607 /* shortcuts to misc objects */
1610 /* shortcuts to debugging objects */
1614 IEXT SV * IDBsingle;
1616 IEXT SV * IDBsignal;
1617 IEXT AV * Ilineary; /* lines of script for debugger */
1618 IEXT AV * Idbargs; /* args to call listed by caller function */
1621 IEXT HV * Idefstash; /* main symbol table */
1622 IEXT HV * Icurstash; /* symbol table for current package */
1623 IEXT HV * Idebstash; /* symbol table for perldb package */
1624 IEXT SV * Icurstname; /* name of current package */
1625 IEXT AV * Ibeginav; /* names of BEGIN subroutines */
1626 IEXT AV * Iendav; /* names of END subroutines */
1627 IEXT HV * Istrtab; /* shared string table */
1629 /* memory management */
1630 IEXT SV ** Itmps_stack;
1631 IEXT I32 Itmps_ix IINIT(-1);
1632 IEXT I32 Itmps_floor IINIT(-1);
1634 IEXT I32 Isv_count; /* how many SV* are currently allocated */
1635 IEXT I32 Isv_objcount; /* how many objects are currently allocated */
1636 IEXT SV* Isv_root; /* storage for SVs belonging to interp */
1637 IEXT SV* Isv_arenaroot; /* list of areas for garbage collection */
1639 /* funky return mechanisms */
1640 IEXT I32 Ilastspbase;
1642 IEXT int Iforkprocess; /* so do_open |- can return proc# */
1644 /* subprocess state */
1645 IEXT AV * Ifdpid; /* keep fd-to-pid mappings for my_popen */
1646 IEXT HV * Ipidstatus; /* keep pid-to-status mappings for waitpid */
1648 /* internal state */
1649 IEXT VOL int Iin_eval; /* trap "fatal" errors? */
1650 IEXT OP * Irestartop; /* Are we propagating an error from croak? */
1651 IEXT int Idelaymagic; /* ($<,$>) = ... */
1652 IEXT bool Idirty; /* In the middle of tearing things down? */
1653 IEXT U8 Ilocalizing; /* are we processing a local() list? */
1654 IEXT bool Itainted; /* using variables controlled by $< */
1655 IEXT bool Itainting; /* doing taint checks */
1656 IEXT char * Iop_mask IINIT(NULL); /* masked operations for safe evals */
1660 IEXT I32 Idlmax IINIT(128);
1661 IEXT char * Idebname;
1662 IEXT char * Idebdelim;
1664 /* current interpreter roots */
1666 IEXT OP * Imain_root;
1667 IEXT OP * Imain_start;
1668 IEXT OP * Ieval_root;
1669 IEXT OP * Ieval_start;
1671 /* runtime control stuff */
1672 IEXT COP * VOL Icurcop IINIT(&compiling);
1673 IEXT COP * Icurcopdb IINIT(NULL);
1674 IEXT line_t Icopline IINIT(NOLINE);
1675 IEXT CONTEXT * Icxstack;
1676 IEXT I32 Icxstack_ix IINIT(-1);
1677 IEXT I32 Icxstack_max IINIT(128);
1678 IEXT Sigjmp_buf Itop_env;
1682 IEXT AV * Icurstack; /* THE STACK */
1683 IEXT AV * Imainstack; /* the stack when nothing funny is happening */
1684 IEXT SV ** Imystack_base; /* stack->array_ary */
1685 IEXT SV ** Imystack_sp; /* stack pointer now */
1686 IEXT SV ** Imystack_max; /* stack->array_ary + stack->array_max */
1688 /* format accumulators */
1689 IEXT SV * Iformtarget;
1690 IEXT SV * Ibodytarget;
1691 IEXT SV * Itoptarget;
1693 /* statics moved here for shared library purposes */
1694 IEXT SV Istrchop; /* return value from chop */
1695 IEXT int Ifilemode; /* so nextargv() can preserve mode */
1696 IEXT int Ilastfd; /* what to preserve mode on */
1697 IEXT char * Ioldname; /* what to preserve mode on */
1698 IEXT char ** IArgv; /* stuff to free from do_aexec, vfork safe */
1699 IEXT char * ICmd; /* stuff to free from do_aexec, vfork safe */
1700 IEXT OP * Isortcop; /* user defined sort routine */
1701 IEXT HV * Isortstash; /* which is in some package or other */
1702 IEXT GV * Ifirstgv; /* $a */
1703 IEXT GV * Isecondgv; /* $b */
1704 IEXT AV * Isortstack; /* temp stack during pp_sort() */
1705 IEXT AV * Isignalstack; /* temp stack during sighandler() */
1706 IEXT SV * Imystrk; /* temp key string for do_each() */
1707 IEXT I32 Idumplvl; /* indentation level on syntax tree dump */
1708 IEXT PMOP * Ioldlastpm; /* for saving regexp context during debugger */
1709 IEXT I32 Igensym; /* next symbol for getsym() to define */
1710 IEXT bool Ipreambled;
1711 IEXT AV * Ipreambleav;
1712 IEXT int Ilaststatval IINIT(-1);
1713 IEXT I32 Ilaststype IINIT(OP_STAT);
1721 struct interpreter {
1735 #define Perl_sv_setptrobj(rv,ptr,name) Perl_sv_setref_iv(rv,name,(IV)ptr)
1736 #define Perl_sv_setptrref(rv,ptr) Perl_sv_setref_iv(rv,Nullch,(IV)ptr)
1738 #define sv_setptrobj(rv,ptr,name) sv_setref_iv(rv,name,(IV)ptr)
1739 #define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
1746 /* The following must follow proto.h */
1749 EXT MGVTBL vtbl_sv = {magic_get,
1753 EXT MGVTBL vtbl_env = {0, 0, 0, 0, 0};
1754 EXT MGVTBL vtbl_envelem = {0, magic_setenv,
1757 EXT MGVTBL vtbl_sig = {0, 0, 0, 0, 0};
1758 EXT MGVTBL vtbl_sigelem = {magic_getsig,
1762 EXT MGVTBL vtbl_pack = {0, 0, 0, magic_wipepack,
1764 EXT MGVTBL vtbl_packelem = {magic_getpack,
1768 EXT MGVTBL vtbl_dbline = {0, magic_setdbline,
1770 EXT MGVTBL vtbl_isa = {0, magic_setisa,
1772 EXT MGVTBL vtbl_isaelem = {0, magic_setisa,
1774 EXT MGVTBL vtbl_arylen = {magic_getarylen,
1777 EXT MGVTBL vtbl_glob = {magic_getglob,
1780 EXT MGVTBL vtbl_mglob = {0, magic_setmglob,
1782 EXT MGVTBL vtbl_nkeys = {0, magic_setnkeys,
1784 EXT MGVTBL vtbl_taint = {magic_gettaint,magic_settaint,
1786 EXT MGVTBL vtbl_substr = {0, magic_setsubstr,
1788 EXT MGVTBL vtbl_vec = {0, magic_setvec,
1790 EXT MGVTBL vtbl_pos = {magic_getpos,
1793 EXT MGVTBL vtbl_bm = {0, magic_setbm,
1795 EXT MGVTBL vtbl_uvar = {magic_getuvar,
1800 EXT MGVTBL vtbl_amagic = {0, magic_setamagic,
1801 0, 0, magic_setamagic};
1802 EXT MGVTBL vtbl_amagicelem = {0, magic_setamagic,
1803 0, 0, magic_setamagic};
1804 #endif /* OVERLOAD */
1808 EXT MGVTBL vtbl_env;
1809 EXT MGVTBL vtbl_envelem;
1810 EXT MGVTBL vtbl_sig;
1811 EXT MGVTBL vtbl_sigelem;
1812 EXT MGVTBL vtbl_pack;
1813 EXT MGVTBL vtbl_packelem;
1814 EXT MGVTBL vtbl_dbline;
1815 EXT MGVTBL vtbl_isa;
1816 EXT MGVTBL vtbl_isaelem;
1817 EXT MGVTBL vtbl_arylen;
1818 EXT MGVTBL vtbl_glob;
1819 EXT MGVTBL vtbl_mglob;
1820 EXT MGVTBL vtbl_nkeys;
1821 EXT MGVTBL vtbl_taint;
1822 EXT MGVTBL vtbl_substr;
1823 EXT MGVTBL vtbl_vec;
1824 EXT MGVTBL vtbl_pos;
1826 EXT MGVTBL vtbl_uvar;
1829 EXT MGVTBL vtbl_amagic;
1830 EXT MGVTBL vtbl_amagicelem;
1831 #endif /* OVERLOAD */
1836 EXT long amagic_generation;
1838 #define NofAMmeth 29
1840 EXT char * AMG_names[NofAMmeth][2] = {
1842 {"bool", "nomethod"},
1872 EXT char * AMG_names[NofAMmeth][2];
1873 #endif /* def INITAMAGIC */
1878 CV* table[NofAMmeth*2];
1881 typedef struct am_table AMT;
1883 #define AMGfallNEVER 1
1885 #define AMGfallYES 3
1888 fallback_amg, abs_amg,
1889 bool__amg, nomethod_amg,
1890 string_amg, numer_amg,
1891 add_amg, add_ass_amg,
1892 subtr_amg, subtr_ass_amg,
1893 mult_amg, mult_ass_amg,
1894 div_amg, div_ass_amg,
1895 mod_amg, mod_ass_amg,
1896 pow_amg, pow_ass_amg,
1897 lshift_amg, lshift_ass_amg,
1898 rshift_amg, rshift_ass_amg,
1899 band_amg, band_ass_amg,
1900 bor_amg, bor_ass_amg,
1901 bxor_amg, bxor_ass_amg,
1914 repeat_amg, repeat_ass_amg,
1915 concat_amg, concat_ass_amg,
1918 #endif /* OVERLOAD */
1920 #if !defined(PERLIO_IS_STDIO) && defined(HAS_ATTRIBUTE)
1922 * Now we have __attribute__ out of the way
1925 #define printf PerlIO_stdoutf
1928 #endif /* Include guard */