3 * Copyright (c) 1987-1997, 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.
25 #endif /* PERL_FOR_X2P */
36 # define START_EXTERN_C extern "C" {
37 # define END_EXTERN_C }
38 # define EXTERN_C extern "C"
40 # define START_EXTERN_C
47 # define stringify_immed(s) #s
48 # define stringify(s) stringify_immed(s)
49 register struct op *op asm(stringify(OP_IN_REGISTER));
54 * STMT_START { statements; } STMT_END;
55 * can be used as a single statement, as in
56 * if (x) STMT_START { ... } STMT_END; else ...
58 * Trying to select a version that gives no warnings...
60 #if !(defined(STMT_START) && defined(STMT_END))
61 # if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__cplusplus)
62 # define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */
65 /* Now which other defined()s do we need here ??? */
66 # if (VOIDFLAGS) && (defined(sun) || defined(__sun__))
67 # define STMT_START if (1)
68 # define STMT_END else (void)0
70 # define STMT_START do
71 # define STMT_END while (0)
78 #define WITH_THR(s) STMT_START { dTHR; s; } STMT_END
81 * SOFT_CAST can be used for args to prototyped functions to retain some
82 * type checking; it only casts if the compiler does not know prototypes.
84 #if defined(CAN_PROTOTYPE) && defined(DEBUGGING_COMPILE)
85 #define SOFT_CAST(type)
87 #define SOFT_CAST(type) (type)
91 # define BYTEORDER 0x1234
94 /* Overall memory policy? */
100 * The following contortions are brought to you on behalf of all the
101 * standards, semi-standards, de facto standards, not-so-de-facto standards
102 * of the world, as well as all the other botches anyone ever thought of.
103 * The basic theory is that if we work hard enough here, the rest of the
104 * code can be a lot prettier. Well, so much for theory. Sorry, Henry...
107 /* define this once if either system, instead of cluttering up the src */
108 #if defined(MSDOS) || defined(atarist) || defined(WIN32)
112 #if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
113 # define STANDARD_C 1
116 #if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(OS2) \
118 # define DONT_DECLARE_STD 1
121 #if defined(NeXT) && !defined(_POSIX_SOURCE)
122 # define MISSING_PID_T
125 #if defined(HASVOLATILE) || defined(STANDARD_C)
127 # define VOL // to temporarily suppress warnings
129 # define VOL volatile
135 #define TAINT (tainted = TRUE)
136 #define TAINT_NOT (tainted = FALSE)
137 #define TAINT_IF(c) if (c) { tainted = TRUE; }
138 #define TAINT_ENV() if (tainting) { taint_env(); }
139 #define TAINT_PROPER(s) if (tainting) { taint_proper(no_security, s); }
145 /* XXX All process group stuff is handled in pp_sys.c. Should these
146 defines move there? If so, I could simplify this a lot. --AD 9/96.
148 /* Process group stuff changed from traditional BSD to POSIX.
149 perlfunc.pod documents the traditional BSD-style syntax, so we'll
150 try to preserve that, if possible.
153 # define BSD_SETPGRP(pid, pgrp) setpgid((pid), (pgrp))
155 # if defined(HAS_SETPGRP) && defined(USE_BSD_SETPGRP)
156 # define BSD_SETPGRP(pid, pgrp) setpgrp((pid), (pgrp))
158 # ifdef HAS_SETPGRP2 /* DG/UX */
159 # define BSD_SETPGRP(pid, pgrp) setpgrp2((pid), (pgrp))
163 #if defined(BSD_SETPGRP) && !defined(HAS_SETPGRP)
164 # define HAS_SETPGRP /* Well, effectively it does . . . */
167 /* getpgid isn't POSIX, but at least Solaris and Linux have it, and it makes
168 our life easier :-) so we'll try it.
171 # define BSD_GETPGRP(pid) getpgid((pid))
173 # if defined(HAS_GETPGRP) && defined(USE_BSD_GETPGRP)
174 # define BSD_GETPGRP(pid) getpgrp((pid))
176 # ifdef HAS_GETPGRP2 /* DG/UX */
177 # define BSD_GETPGRP(pid) getpgrp2((pid))
181 #if defined(BSD_GETPGRP) && !defined(HAS_GETPGRP)
182 # define HAS_GETPGRP /* Well, effectively it does . . . */
185 /* These are not exact synonyms, since setpgrp() and getpgrp() may
186 have different behaviors, but perl.h used to define USE_BSDPGRP
187 (prior to 5.003_05) so some extension might depend on it.
189 #if defined(USE_BSD_SETPGRP) || defined(USE_BSD_GETPGRP)
195 #ifndef _TYPES_ /* If types.h defines this it's easy. */
196 # ifndef major /* Does everyone's types.h define this? */
197 # include <sys/types.h>
211 # include <varargs.h>
217 #include "perlsock.h"
218 #include "perlproc.h"
222 #ifdef USE_NEXT_CTYPE
224 #if NX_CURRENT_COMPILER_RELEASE >= 400
225 #include <objc/NXCType.h>
226 #else /* NX_CURRENT_COMPILER_RELEASE < 400 */
227 #include <appkit/NXCType.h>
228 #endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
230 #else /* !USE_NEXT_CTYPE */
232 #endif /* USE_NEXT_CTYPE */
234 #ifdef METHOD /* Defined by OSF/1 v3.0 by ctype.h */
242 #if !defined(NO_LOCALE) && defined(HAS_SETLOCALE)
244 # if !defined(NO_LOCALE_COLLATE) && defined(LC_COLLATE) \
245 && defined(HAS_STRXFRM)
246 # define USE_LOCALE_COLLATE
248 # if !defined(NO_LOCALE_CTYPE) && defined(LC_CTYPE)
249 # define USE_LOCALE_CTYPE
251 # if !defined(NO_LOCALE_NUMERIC) && defined(LC_NUMERIC)
252 # define USE_LOCALE_NUMERIC
254 #endif /* !NO_LOCALE && HAS_SETLOCALE */
259 # ifdef PARAM_NEEDS_TYPES
260 # include <sys/types.h>
262 # include <sys/param.h>
266 /* Use all the "standard" definitions? */
267 #if defined(STANDARD_C) && defined(I_STDLIB)
271 #define MEM_SIZE Size_t
273 /* This comes after <stdlib.h> so we don't try to change the standard
274 * library prototypes; we'll use our own in proto.h instead. */
279 # define malloc Mymalloc
280 # define calloc Mycalloc
281 # define realloc Myremalloc
283 Malloc_t Mymalloc _((MEM_SIZE nbytes));
284 Malloc_t Mycalloc _((MEM_SIZE elements, MEM_SIZE size));
285 Malloc_t Myrealloc _((Malloc_t where, MEM_SIZE nbytes));
286 Free_t Myfree _((Malloc_t where));
288 # ifdef EMBEDMYMALLOC
289 # define malloc Perl_malloc
290 # define calloc Perl_calloc
291 # define realloc Perl_realloc
292 # define free Perl_free
293 Malloc_t Perl_malloc _((MEM_SIZE nbytes));
294 Malloc_t Perl_calloc _((MEM_SIZE elements, MEM_SIZE size));
295 Malloc_t Perl_realloc _((Malloc_t where, MEM_SIZE nbytes));
296 Free_t Perl_free _((Malloc_t where));
303 # define safemalloc malloc
304 # define safecalloc calloc
305 # define saferealloc realloc
306 # define safefree free
308 #endif /* MYMALLOC */
310 #if defined(STANDARD_C) && defined(I_STDDEF)
312 # define STRUCT_OFFSET(s,m) offsetof(s,m)
314 # define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m))
317 #if defined(I_STRING) || defined(__cplusplus)
320 # include <strings.h>
323 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
325 #define strrchr rindex
333 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
335 extern char * memcpy _((char*, char*, int));
341 # define memcpy(d,s,l) bcopy(s,d,l)
343 # define memcpy(d,s,l) my_bcopy(s,d,l)
346 #endif /* HAS_MEMCPY */
349 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
351 extern char *memset _((char*, int, int));
355 # define memset(d,c,l) my_memset(d,c,l)
356 #endif /* HAS_MEMSET */
358 #if !defined(HAS_MEMMOVE) && !defined(memmove)
359 # if defined(HAS_BCOPY) && defined(HAS_SAFE_BCOPY)
360 # define memmove(d,s,l) bcopy(s,d,l)
362 # if defined(HAS_MEMCPY) && defined(HAS_SAFE_MEMCPY)
363 # define memmove(d,s,l) memcpy(d,s,l)
365 # define memmove(d,s,l) my_bcopy(s,d,l)
370 #if defined(mips) && defined(ultrix) && !defined(__STDC__)
374 #if defined(HAS_MEMCMP) && defined(HAS_SANE_MEMCMP)
375 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
377 extern int memcmp _((char*, char*, int));
381 # pragma function(memcmp)
385 # define memcmp my_memcmp
387 #endif /* HAS_MEMCMP && HAS_SANE_MEMCMP */
391 # define memzero(d,l) memset(d,0,l)
394 # define memzero(d,l) bzero(d,l)
396 # define memzero(d,l) my_bzero(d,l)
403 # define bcmp(s1,s2,l) memcmp(s1,s2,l)
405 #endif /* !HAS_BCMP */
408 # include <netinet/in.h>
411 #if defined(SF_APPEND) && defined(USE_SFIO) && defined(I_SFIO)
412 /* <sfio.h> defines SF_APPEND and <sys/stat.h> might define SF_APPEND
413 * (the neo-BSD seem to do this). */
418 # include <sys/stat.h>
421 /* The stat macros for Amdahl UTS, Unisoft System V/88 (and derivatives
422 like UTekV) are broken, sometimes giving false positives. Undefine
423 them here and let the code below set them to proper values.
425 The ghs macro stands for GreenHills Software C-1.8.5 which
426 is the C compiler for sysV88 and the various derivatives.
427 This header file bug is corrected in gcc-2.5.8 and later versions.
428 --Kaveh Ghazi (ghazi@noc.rutgers.edu) 10/3/94. */
430 #if defined(uts) || (defined(m88k) && defined(ghs))
444 # ifdef I_SYS_TIME_KERNEL
447 # include <sys/time.h>
448 # ifdef I_SYS_TIME_KERNEL
453 #if defined(HAS_TIMES) && defined(I_SYS_TIMES)
454 # include <sys/times.h>
457 #if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
463 # define mkfifo(path, mode) (mknod((path), (mode) | S_IFIFO, 0))
465 #endif /* !HAS_MKFIFO */
470 # include <net/errno.h>
475 # define SETERRNO(errcode,vmserrcode) \
477 set_errno(errcode); \
478 set_vaxc_errno(vmserrcode); \
481 # define SETERRNO(errcode,vmserrcode) errno = (errcode)
485 # define ERRSV (thr->errsv)
486 # define ERRHV (thr->errhv)
487 # define DEFSV THREADSV(0)
488 # define SAVE_DEFSV save_threadsv(0)
490 # define ERRSV GvSV(errgv)
491 # define ERRHV GvHV(errgv)
492 # define DEFSV GvSV(defgv)
493 # define SAVE_DEFSV SAVESPTR(GvSV(defgv))
494 #endif /* USE_THREADS */
497 extern int errno; /* ANSI allows errno to be an lvalue expr */
502 char *strerror _((int,...));
504 #ifndef DONT_DECLARE_STD
505 char *strerror _((int));
509 # define Strerror strerror
512 # ifdef HAS_SYS_ERRLIST
514 extern char *sys_errlist[];
516 # define Strerror(e) \
517 ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
524 # include <sys/ioctl.h>
528 #if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
529 # ifdef HAS_SOCKETPAIR
530 # undef HAS_SOCKETPAIR
545 /* Configure already sets Direntry_t */
546 #if defined(I_DIRENT)
548 # if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
549 # include <sys/dir.h>
553 # include <sys/ndir.h>
557 # include <ndir.h> /* may be wrong in the future */
559 # include <sys/dir.h>
566 /* work around botch in SunOS 4.0.1 and 4.0.2 */
568 # define fputs(sv,fp) fprintf(fp,"%s",sv)
573 * The following gobbledygook brought to you on behalf of __STDC__.
574 * (I could just use #ifndef __STDC__, but this is more bulletproof
575 * in the face of half-implementations.)
580 # define S_IFMT _S_IFMT
582 # define S_IFMT 0170000
587 # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
591 # define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
596 # define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
598 # define S_ISBLK(m) (0)
603 # define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
608 # define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
610 # define S_ISFIFO(m) (0)
616 # define S_ISLNK(m) _S_ISLNK(m)
619 # define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
622 # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
624 # define S_ISLNK(m) (0)
632 # define S_ISSOCK(m) _S_ISSOCK(m)
635 # define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
638 # define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
640 # define S_ISSOCK(m) (0)
648 # define S_IRUSR S_IREAD
649 # define S_IWUSR S_IWRITE
650 # define S_IXUSR S_IEXEC
652 # define S_IRUSR 0400
653 # define S_IWUSR 0200
654 # define S_IXUSR 0100
656 # define S_IRGRP (S_IRUSR>>3)
657 # define S_IWGRP (S_IWUSR>>3)
658 # define S_IXGRP (S_IXUSR>>3)
659 # define S_IROTH (S_IRUSR>>6)
660 # define S_IWOTH (S_IWUSR>>6)
661 # define S_IXOTH (S_IXUSR>>6)
665 # define S_ISUID 04000
669 # define S_ISGID 02000
676 #if defined(cray) || defined(gould) || defined(i860) || defined(pyr)
677 # define SLOPPYDIVIDE
684 /* XXX QUAD stuff is not currently supported on most systems.
685 Specifically, perl internals don't support long long. Among
686 the many problems is that some compilers support long long,
687 but the underlying library functions (such as sprintf) don't.
688 Some things do work (such as quad pack/unpack on convex);
689 also some systems use long long for the fpos_t typedef. That
692 The IV type is supposed to be long enough to hold any integral
694 --Andy Dougherty August 1996
701 # define Quad_t long long
703 # if BYTEORDER > 0xFFFF
712 typedef unsigned Quad_t UV;
713 # define IV_MAX PERL_QUAD_MAX
714 # define IV_MIN PERL_QUAD_MIN
715 # define UV_MAX PERL_UQUAD_MAX
716 # define UV_MIN PERL_UQUAD_MIN
719 typedef unsigned long UV;
720 # define IV_MAX PERL_LONG_MAX
721 # define IV_MIN PERL_LONG_MIN
722 # define UV_MAX PERL_ULONG_MAX
723 # define UV_MIN PERL_ULONG_MIN
726 /* Previously these definitions used hardcoded figures.
727 * It is hoped these formula are more portable, although
728 * no data one way or another is presently known to me.
729 * The "PERL_" names are used because these calculated constants
730 * do not meet the ANSI requirements for LONG_MAX, etc., which
731 * need to be constants acceptable to #if - kja
732 * define PERL_LONG_MAX 2147483647L
733 * define PERL_LONG_MIN (-LONG_MAX - 1)
734 * define PERL ULONG_MAX 4294967295L
737 #ifdef I_LIMITS /* Needed for cast_xxx() functions below. */
746 * Try to figure out max and min values for the integral types. THE CORRECT
747 * SOLUTION TO THIS MESS: ADAPT enquire.c FROM GCC INTO CONFIGURE. The
748 * following hacks are used if neither limits.h or values.h provide them:
749 * U<TYPE>_MAX: for types >= int: ~(unsigned TYPE)0
750 * for types < int: (unsigned TYPE)~(unsigned)0
751 * The argument to ~ must be unsigned so that later signed->unsigned
752 * conversion can't modify the value's bit pattern (e.g. -0 -> +0),
753 * and it must not be smaller than int because ~ does integral promotion.
754 * <type>_MAX: (<type>) (U<type>_MAX >> 1)
755 * <type>_MIN: -<type>_MAX - <is_twos_complement_architecture: (3 & -1) == 3>.
756 * The latter is a hack which happens to work on some machines but
757 * does *not* catch any random system, or things like integer types
758 * with NaN if that is possible.
760 * All of the types are explicitly cast to prevent accidental loss of
761 * numeric range, and in the hope that they will be less likely to confuse
762 * over-eager optimizers.
766 #define PERL_UCHAR_MIN ((unsigned char)0)
769 # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
772 # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
774 # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
779 * CHAR_MIN and CHAR_MAX are not included here, as the (char) type may be
780 * ambiguous. It may be equivalent to (signed char) or (unsigned char)
781 * depending on local options. Until Configure detects this (or at least
782 * detects whether the "signed" keyword is available) the CHAR ranges
783 * will not be included. UCHAR functions normally.
787 #define PERL_USHORT_MIN ((unsigned short)0)
790 # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
793 # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
795 # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
800 # define PERL_SHORT_MAX ((short)SHORT_MAX)
802 # ifdef MAXSHORT /* Often used in <values.h> */
803 # define PERL_SHORT_MAX ((short)MAXSHORT)
805 # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
810 # define PERL_SHORT_MIN ((short)SHORT_MIN)
813 # define PERL_SHORT_MIN ((short)MINSHORT)
815 # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
820 # define PERL_UINT_MAX ((unsigned int)UINT_MAX)
823 # define PERL_UINT_MAX ((unsigned int)MAXUINT)
825 # define PERL_UINT_MAX (~(unsigned int)0)
829 #define PERL_UINT_MIN ((unsigned int)0)
832 # define PERL_INT_MAX ((int)INT_MAX)
834 # ifdef MAXINT /* Often used in <values.h> */
835 # define PERL_INT_MAX ((int)MAXINT)
837 # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
842 # define PERL_INT_MIN ((int)INT_MIN)
845 # define PERL_INT_MIN ((int)MININT)
847 # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
852 # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
855 # define PERL_ULONG_MAX ((unsigned long)MAXULONG)
857 # define PERL_ULONG_MAX (~(unsigned long)0)
861 #define PERL_ULONG_MIN ((unsigned long)0L)
864 # define PERL_LONG_MAX ((long)LONG_MAX)
866 # ifdef MAXLONG /* Often used in <values.h> */
867 # define PERL_LONG_MAX ((long)MAXLONG)
869 # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
874 # define PERL_LONG_MIN ((long)LONG_MIN)
877 # define PERL_LONG_MIN ((long)MINLONG)
879 # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
886 # define PERL_UQUAD_MAX ((UV)UQUAD_MAX)
888 # define PERL_UQUAD_MAX (~(UV)0)
891 # define PERL_UQUAD_MIN ((UV)0)
894 # define PERL_QUAD_MAX ((IV)QUAD_MAX)
896 # define PERL_QUAD_MAX ((IV) (PERL_UQUAD_MAX >> 1))
900 # define PERL_QUAD_MIN ((IV)QUAD_MIN)
902 # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
907 typedef MEM_SIZE STRLEN;
909 typedef struct op OP;
910 typedef struct cop COP;
911 typedef struct unop UNOP;
912 typedef struct binop BINOP;
913 typedef struct listop LISTOP;
914 typedef struct logop LOGOP;
915 typedef struct condop CONDOP;
916 typedef struct pmop PMOP;
917 typedef struct svop SVOP;
918 typedef struct gvop GVOP;
919 typedef struct pvop PVOP;
920 typedef struct loop LOOP;
922 typedef struct Outrec Outrec;
923 typedef struct interpreter PerlInterpreter;
925 typedef struct ff FF; /* XXX not defined anywhere, should go? */
927 typedef struct sv SV;
928 typedef struct av AV;
929 typedef struct hv HV;
930 typedef struct cv CV;
931 typedef struct regexp REGEXP;
932 typedef struct gp GP;
933 typedef struct gv GV;
934 typedef struct io IO;
935 typedef struct context PERL_CONTEXT;
936 typedef struct block BLOCK;
938 typedef struct magic MAGIC;
939 typedef struct xrv XRV;
940 typedef struct xpv XPV;
941 typedef struct xpviv XPVIV;
942 typedef struct xpvuv XPVUV;
943 typedef struct xpvnv XPVNV;
944 typedef struct xpvmg XPVMG;
945 typedef struct xpvlv XPVLV;
946 typedef struct xpvav XPVAV;
947 typedef struct xpvhv XPVHV;
948 typedef struct xpvgv XPVGV;
949 typedef struct xpvcv XPVCV;
950 typedef struct xpvbm XPVBM;
951 typedef struct xpvfm XPVFM;
952 typedef struct xpvio XPVIO;
953 typedef struct mgvtbl MGVTBL;
954 typedef union any ANY;
958 typedef I32 (*filter_t) _((int, SV *, int));
959 #define FILTER_READ(idx, sv, len) filter_read(idx, sv, len)
960 #define FILTER_DATA(idx) (AvARRAY(rsfp_filters)[idx])
961 #define FILTER_ISREADER(idx) (idx >= AvFILLp(rsfp_filters))
974 # include "./plan9/plan9ish.h"
976 # include "unixish.h"
982 * USE_THREADS needs to be after unixish.h as <pthread.h> includes
983 * <sys/signal.h> which defines NSIG - which will stop inclusion of <signal.h>
984 * this results in many functions being undeclared which bothers C++
985 * May make sense to have threads after "*ish.h" anyway
990 # include "fakethr.h"
993 # include <win32thread.h>
996 # include "os2thread.h"
998 # include <pthread.h>
999 typedef pthread_t perl_os_thread;
1000 typedef pthread_mutex_t perl_mutex;
1001 typedef pthread_cond_t perl_cond;
1002 typedef pthread_key_t perl_key;
1005 # endif /* FAKE_THREADS */
1006 #endif /* USE_THREADS */
1011 # define STATUS_NATIVE statusvalue_vms
1012 # define STATUS_NATIVE_EXPORT \
1013 ((I32)statusvalue_vms == -1 ? 44 : statusvalue_vms)
1014 # define STATUS_NATIVE_SET(n) \
1016 statusvalue_vms = (n); \
1017 if ((I32)statusvalue_vms == -1) \
1019 else if (statusvalue_vms & STS$M_SUCCESS) \
1021 else if ((statusvalue_vms & STS$M_SEVERITY) == 0) \
1022 statusvalue = 1 << 8; \
1024 statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8; \
1026 # define STATUS_POSIX statusvalue
1027 # ifdef VMSISH_STATUS
1028 # define STATUS_CURRENT (VMSISH_STATUS ? STATUS_NATIVE : STATUS_POSIX)
1030 # define STATUS_CURRENT STATUS_POSIX
1032 # define STATUS_POSIX_SET(n) \
1034 statusvalue = (n); \
1035 if (statusvalue != -1) { \
1036 statusvalue &= 0xFFFF; \
1037 statusvalue_vms = statusvalue ? 44 : 1; \
1039 else statusvalue_vms = -1; \
1041 # define STATUS_ALL_SUCCESS (statusvalue = 0, statusvalue_vms = 1)
1042 # define STATUS_ALL_FAILURE (statusvalue = 1, statusvalue_vms = 44)
1044 # define STATUS_NATIVE STATUS_POSIX
1045 # define STATUS_NATIVE_EXPORT STATUS_POSIX
1046 # define STATUS_NATIVE_SET STATUS_POSIX_SET
1047 # define STATUS_POSIX statusvalue
1048 # define STATUS_POSIX_SET(n) \
1050 statusvalue = (n); \
1051 if (statusvalue != -1) \
1052 statusvalue &= 0xFFFF; \
1054 # define STATUS_CURRENT STATUS_POSIX
1055 # define STATUS_ALL_SUCCESS (statusvalue = 0)
1056 # define STATUS_ALL_FAILURE (statusvalue = 1)
1059 /* Some unistd.h's give a prototype for pause() even though
1060 HAS_PAUSE ends up undefined. This causes the #define
1061 below to be rejected by the compmiler. Sigh.
1066 #define Pause() sleep((32767<<16)+32767)
1070 # ifdef IOCPARM_MASK
1071 /* on BSDish systes we're safe */
1072 # define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
1074 /* otherwise guess at what's safe */
1075 # define IOCPARM_LEN(x) 256
1084 void (*any_dptr) _((void*));
1088 #define ARGSproto struct perl_thread *thr
1090 #define ARGSproto void
1091 #endif /* USE_THREADS */
1093 /* Work around some cygwin32 problems with importing global symbols */
1094 #if defined(CYGWIN32) && defined(DLLIMPORT)
1095 # include "cw32imp.h"
1112 /* work around some libPW problems */
1117 #if defined(iAPX286) || defined(M_I286) || defined(I80286)
1121 #if defined(htonl) && !defined(HAS_HTONL)
1124 #if defined(htons) && !defined(HAS_HTONS)
1127 #if defined(ntohl) && !defined(HAS_NTOHL)
1130 #if defined(ntohs) && !defined(HAS_NTOHS)
1134 #if (BYTEORDER & 0xffff) != 0x4321
1140 #define htons my_swap
1141 #define htonl my_htonl
1142 #define ntohs my_swap
1143 #define ntohl my_ntohl
1146 #if (BYTEORDER & 0xffff) == 0x4321
1155 * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
1158 #if BYTEORDER != 0x1234
1163 # if BYTEORDER == 0x4321
1164 # define vtohl(x) ((((x)&0xFF)<<24) \
1166 +(((x)&0x0000FF00)<<8) \
1167 +(((x)&0x00FF0000)>>8) )
1168 # define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
1169 # define htovl(x) vtohl(x)
1170 # define htovs(x) vtohs(x)
1172 /* otherwise default to functions in util.c */
1176 #define U_S(what) ((U16)(what))
1177 #define U_I(what) ((unsigned int)(what))
1178 #define U_L(what) ((U32)(what))
1180 EXTERN_C U32 cast_ulong _((double));
1181 #define U_S(what) ((U16)cast_ulong((double)(what)))
1182 #define U_I(what) ((unsigned int)cast_ulong((double)(what)))
1183 #define U_L(what) (cast_ulong((double)(what)))
1187 #define I_32(what) ((I32)(what))
1188 #define I_V(what) ((IV)(what))
1189 #define U_V(what) ((UV)(what))
1192 I32 cast_i32 _((double));
1193 IV cast_iv _((double));
1194 UV cast_uv _((double));
1196 #define I_32(what) (cast_i32((double)(what)))
1197 #define I_V(what) (cast_iv((double)(what)))
1198 #define U_V(what) (cast_uv((double)(what)))
1212 # define TMPPATH "/tmp/perl-eXXXXXX"
1216 Uid_t getuid _((void));
1217 Uid_t geteuid _((void));
1218 Gid_t getgid _((void));
1219 Gid_t getegid _((void));
1223 #ifndef Perl_debug_log
1224 #define Perl_debug_log PerlIO_stderr()
1228 #define DEBUG(a) if (debug) a
1229 #define DEBUG_p(a) if (debug & 1) a
1230 #define DEBUG_s(a) if (debug & 2) a
1231 #define DEBUG_l(a) if (debug & 4) a
1232 #define DEBUG_t(a) if (debug & 8) a
1233 #define DEBUG_o(a) if (debug & 16) a
1234 #define DEBUG_c(a) if (debug & 32) a
1235 #define DEBUG_P(a) if (debug & 64) a
1236 #define DEBUG_m(a) if (curinterp && debug & 128) a
1237 #define DEBUG_f(a) if (debug & 256) a
1238 #define DEBUG_r(a) if (debug & 512) a
1239 #define DEBUG_x(a) if (debug & 1024) a
1240 #define DEBUG_u(a) if (debug & 2048) a
1241 #define DEBUG_L(a) if (debug & 4096) a
1242 #define DEBUG_H(a) if (debug & 8192) a
1243 #define DEBUG_X(a) if (debug & 16384) a
1244 #define DEBUG_D(a) if (debug & 32768) a
1265 #define YYMAXDEPTH 300
1267 #ifndef assert /* <assert.h> might have been included somehow */
1268 #define assert(what) DEB( { \
1270 croak("Assertion failed: file \"%s\", line %d", \
1271 __FILE__, __LINE__); \
1277 I32 (*uf_val)_((IV, SV*));
1278 I32 (*uf_set)_((IV, SV*));
1282 /* Fix these up for __STDC__ */
1283 #ifndef DONT_DECLARE_STD
1284 char *mktemp _((char*));
1285 double atof _((const char*));
1289 /* All of these are in stdlib.h or time.h for ANSI C */
1291 struct tm *gmtime(), *localtime();
1292 char *strchr(), *strrchr();
1293 char *strcpy(), *strcat();
1294 #endif /* ! STANDARD_C */
1301 double exp _((double));
1302 double log _((double));
1303 double log10 _((double));
1304 double sqrt _((double));
1305 double frexp _((double,int*));
1306 double ldexp _((double,int));
1307 double modf _((double,double*));
1308 double sin _((double));
1309 double cos _((double));
1310 double atan2 _((double,double));
1311 double pow _((double,double));
1316 # ifdef __NeXT__ /* or whatever catches all NeXTs */
1317 char *crypt (); /* Maybe more hosts will need the unprototyped version */
1319 # if !defined(WIN32) || !defined(HAVE_DES_FCRYPT)
1320 char *crypt _((const char*, const char*));
1321 # endif /* !WIN32 && !HAVE_CRYPT_SOURCE */
1322 # endif /* !__NeXT__ */
1323 # ifndef DONT_DECLARE_STD
1325 char *getenv _((const char*));
1326 # endif /* !getenv */
1327 Off_t lseek _((int,Off_t,int));
1328 # endif /* !DONT_DECLARE_STD */
1329 char *getlogin _((void));
1330 #endif /* !__cplusplus */
1332 #ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */
1333 #define UNLINK unlnk
1334 I32 unlnk _((char*));
1336 #define UNLINK unlink
1339 #ifndef HAS_SETREUID
1340 # ifdef HAS_SETRESUID
1341 # define setreuid(r,e) setresuid(r,e,(Uid_t)-1)
1342 # define HAS_SETREUID
1345 #ifndef HAS_SETREGID
1346 # ifdef HAS_SETRESGID
1347 # define setregid(r,e) setresgid(r,e,(Gid_t)-1)
1348 # define HAS_SETREGID
1352 typedef Signal_t (*Sighandler_t) _((int));
1354 #ifdef HAS_SIGACTION
1355 typedef struct sigaction Sigsave_t;
1357 typedef Sighandler_t Sigsave_t;
1368 # define PAD_SV(po) pad_sv(po)
1369 # define RUNOPS_DEFAULT runops_debug
1371 # define PAD_SV(po) curpad[po]
1372 # define RUNOPS_DEFAULT runops_standard
1376 # define MALLOC_INIT MUTEX_INIT(&malloc_mutex)
1377 # define MALLOC_TERM MUTEX_DESTROY(&malloc_mutex)
1379 # define MALLOC_INIT
1380 # define MALLOC_TERM
1385 * These need prototyping here because <proto.h> isn't
1386 * included until after runops is initialised.
1389 typedef int runops_proc_t _((void));
1390 int runops_standard _((void));
1392 int runops_debug _((void));
1395 /* _ (for $_) must be first in the following list (DEFSV requires it) */
1396 #define THREADSV_NAMES "_123456789&`'+/.,\\\";^-%=|~:\001\005!@"
1398 /* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
1399 #if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
1400 #if !defined(DONT_DECLARE_STD) \
1401 || (defined(__svr4__) && defined(__GNUC__) && defined(sun)) \
1402 || defined(__sgi) || defined(__DGUX)
1403 extern char ** environ; /* environment variables supplied via exec */
1406 # if defined(NeXT) && defined(__DYNAMIC__)
1408 # include <mach-o/dyld.h>
1409 EXT char *** environ_pointer;
1410 # define environ (*environ_pointer)
1412 #endif /* environ processing */
1415 /* for tmp use in stupid debuggers */
1420 /* handy constants */
1421 EXTCONST char warn_uninit[]
1422 INIT("Use of uninitialized value");
1423 EXTCONST char warn_nosemi[]
1424 INIT("Semicolon seems to be missing");
1425 EXTCONST char warn_reserved[]
1426 INIT("Unquoted string \"%s\" may clash with future reserved word");
1427 EXTCONST char warn_nl[]
1428 INIT("Unsuccessful %s on filename containing newline");
1429 EXTCONST char no_wrongref[]
1430 INIT("Can't use %s ref as %s ref");
1431 EXTCONST char no_symref[]
1432 INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");
1433 EXTCONST char no_usym[]
1434 INIT("Can't use an undefined value as %s reference");
1435 EXTCONST char no_aelem[]
1436 INIT("Modification of non-creatable array value attempted, subscript %d");
1437 EXTCONST char no_helem[]
1438 INIT("Modification of non-creatable hash value attempted, subscript \"%s\"");
1439 EXTCONST char no_modify[]
1440 INIT("Modification of a read-only value attempted");
1441 EXTCONST char no_mem[]
1442 INIT("Out of memory!\n");
1443 EXTCONST char no_security[]
1444 INIT("Insecure dependency in %s%s");
1445 EXTCONST char no_sock_func[]
1446 INIT("Unsupported socket function \"%s\" called");
1447 EXTCONST char no_dir_func[]
1448 INIT("Unsupported directory function \"%s\" called");
1449 EXTCONST char no_func[]
1450 INIT("The %s function is unimplemented");
1451 EXTCONST char no_myglob[]
1452 INIT("\"my\" variable %s can't be in a package");
1455 EXT char *sig_name[] = { SIG_NAME };
1456 EXT int sig_num[] = { SIG_NUM };
1457 EXT SV * psig_ptr[sizeof(sig_num)/sizeof(*sig_num)];
1458 EXT SV * psig_name[sizeof(sig_num)/sizeof(*sig_num)];
1460 EXT char *sig_name[];
1462 EXT SV * psig_ptr[];
1463 EXT SV * psig_name[];
1466 /* fast case folding tables */
1469 EXTCONST unsigned char fold[] = {
1470 0, 1, 2, 3, 4, 5, 6, 7,
1471 8, 9, 10, 11, 12, 13, 14, 15,
1472 16, 17, 18, 19, 20, 21, 22, 23,
1473 24, 25, 26, 27, 28, 29, 30, 31,
1474 32, 33, 34, 35, 36, 37, 38, 39,
1475 40, 41, 42, 43, 44, 45, 46, 47,
1476 48, 49, 50, 51, 52, 53, 54, 55,
1477 56, 57, 58, 59, 60, 61, 62, 63,
1478 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
1479 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
1480 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
1481 'x', 'y', 'z', 91, 92, 93, 94, 95,
1482 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
1483 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
1484 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
1485 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
1486 128, 129, 130, 131, 132, 133, 134, 135,
1487 136, 137, 138, 139, 140, 141, 142, 143,
1488 144, 145, 146, 147, 148, 149, 150, 151,
1489 152, 153, 154, 155, 156, 157, 158, 159,
1490 160, 161, 162, 163, 164, 165, 166, 167,
1491 168, 169, 170, 171, 172, 173, 174, 175,
1492 176, 177, 178, 179, 180, 181, 182, 183,
1493 184, 185, 186, 187, 188, 189, 190, 191,
1494 192, 193, 194, 195, 196, 197, 198, 199,
1495 200, 201, 202, 203, 204, 205, 206, 207,
1496 208, 209, 210, 211, 212, 213, 214, 215,
1497 216, 217, 218, 219, 220, 221, 222, 223,
1498 224, 225, 226, 227, 228, 229, 230, 231,
1499 232, 233, 234, 235, 236, 237, 238, 239,
1500 240, 241, 242, 243, 244, 245, 246, 247,
1501 248, 249, 250, 251, 252, 253, 254, 255
1504 EXTCONST unsigned char fold[];
1508 EXT unsigned char fold_locale[] = {
1509 0, 1, 2, 3, 4, 5, 6, 7,
1510 8, 9, 10, 11, 12, 13, 14, 15,
1511 16, 17, 18, 19, 20, 21, 22, 23,
1512 24, 25, 26, 27, 28, 29, 30, 31,
1513 32, 33, 34, 35, 36, 37, 38, 39,
1514 40, 41, 42, 43, 44, 45, 46, 47,
1515 48, 49, 50, 51, 52, 53, 54, 55,
1516 56, 57, 58, 59, 60, 61, 62, 63,
1517 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
1518 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
1519 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
1520 'x', 'y', 'z', 91, 92, 93, 94, 95,
1521 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
1522 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
1523 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
1524 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
1525 128, 129, 130, 131, 132, 133, 134, 135,
1526 136, 137, 138, 139, 140, 141, 142, 143,
1527 144, 145, 146, 147, 148, 149, 150, 151,
1528 152, 153, 154, 155, 156, 157, 158, 159,
1529 160, 161, 162, 163, 164, 165, 166, 167,
1530 168, 169, 170, 171, 172, 173, 174, 175,
1531 176, 177, 178, 179, 180, 181, 182, 183,
1532 184, 185, 186, 187, 188, 189, 190, 191,
1533 192, 193, 194, 195, 196, 197, 198, 199,
1534 200, 201, 202, 203, 204, 205, 206, 207,
1535 208, 209, 210, 211, 212, 213, 214, 215,
1536 216, 217, 218, 219, 220, 221, 222, 223,
1537 224, 225, 226, 227, 228, 229, 230, 231,
1538 232, 233, 234, 235, 236, 237, 238, 239,
1539 240, 241, 242, 243, 244, 245, 246, 247,
1540 248, 249, 250, 251, 252, 253, 254, 255
1543 EXT unsigned char fold_locale[];
1547 EXTCONST unsigned char freq[] = { /* letter frequencies for mixed English/C */
1548 1, 2, 84, 151, 154, 155, 156, 157,
1549 165, 246, 250, 3, 158, 7, 18, 29,
1550 40, 51, 62, 73, 85, 96, 107, 118,
1551 129, 140, 147, 148, 149, 150, 152, 153,
1552 255, 182, 224, 205, 174, 176, 180, 217,
1553 233, 232, 236, 187, 235, 228, 234, 226,
1554 222, 219, 211, 195, 188, 193, 185, 184,
1555 191, 183, 201, 229, 181, 220, 194, 162,
1556 163, 208, 186, 202, 200, 218, 198, 179,
1557 178, 214, 166, 170, 207, 199, 209, 206,
1558 204, 160, 212, 216, 215, 192, 175, 173,
1559 243, 172, 161, 190, 203, 189, 164, 230,
1560 167, 248, 227, 244, 242, 255, 241, 231,
1561 240, 253, 169, 210, 245, 237, 249, 247,
1562 239, 168, 252, 251, 254, 238, 223, 221,
1563 213, 225, 177, 197, 171, 196, 159, 4,
1564 5, 6, 8, 9, 10, 11, 12, 13,
1565 14, 15, 16, 17, 19, 20, 21, 22,
1566 23, 24, 25, 26, 27, 28, 30, 31,
1567 32, 33, 34, 35, 36, 37, 38, 39,
1568 41, 42, 43, 44, 45, 46, 47, 48,
1569 49, 50, 52, 53, 54, 55, 56, 57,
1570 58, 59, 60, 61, 63, 64, 65, 66,
1571 67, 68, 69, 70, 71, 72, 74, 75,
1572 76, 77, 78, 79, 80, 81, 82, 83,
1573 86, 87, 88, 89, 90, 91, 92, 93,
1574 94, 95, 97, 98, 99, 100, 101, 102,
1575 103, 104, 105, 106, 108, 109, 110, 111,
1576 112, 113, 114, 115, 116, 117, 119, 120,
1577 121, 122, 123, 124, 125, 126, 127, 128,
1578 130, 131, 132, 133, 134, 135, 136, 137,
1579 138, 139, 141, 142, 143, 144, 145, 146
1582 EXTCONST unsigned char freq[];
1587 EXTCONST char* block_type[] = {
1596 EXTCONST char* block_type[];
1600 /*****************************************************************************/
1601 /* This lexer/parser stuff is currently global since yacc is hard to reenter */
1602 /*****************************************************************************/
1603 /* XXX This needs to be revisited, since BEGIN makes yacc re-enter... */
1607 #define LEX_NOTPARSING 11 /* borrowed from toke.c */
1619 /* Note: the lowest 8 bits are reserved for
1620 stuffing into op->op_private */
1621 #define HINT_INTEGER 0x00000001
1622 #define HINT_STRICT_REFS 0x00000002
1624 #define HINT_BLOCK_SCOPE 0x00000100
1625 #define HINT_STRICT_SUBS 0x00000200
1626 #define HINT_STRICT_VARS 0x00000400
1627 #define HINT_LOCALE 0x00000800
1629 /* Various states of an input record separator SV (rs, nrs) */
1630 #define RsSNARF(sv) (! SvOK(sv))
1631 #define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
1632 #define RsPARA(sv) (SvOK(sv) && ! SvCUR(sv))
1634 /* Set up PERLVAR macros for populating structs */
1635 #define PERLVAR(var,type) type var;
1636 #define PERLVARI(var,type,init) type var;
1637 #define PERLVARIC(var,type,init) type var;
1639 #ifdef PERL_GLOBAL_STRUCT
1641 #include "perlvars.h"
1645 EXT struct perl_vars Perl_Vars;
1646 EXT struct perl_vars *Perl_VarsPtr INIT(&Perl_Vars);
1648 #if !defined(__GNUC__) || !defined(WIN32)
1651 struct perl_vars *Perl_VarsPtr;
1652 #define Perl_Vars (*((Perl_VarsPtr) ? Perl_VarsPtr : (Perl_VarsPtr = Perl_GetVars())))
1654 #endif /* PERL_GLOBAL_STRUCT */
1657 /* If we have multiple interpreters define a struct
1658 holding variables which must be per-interpreter
1659 If we don't have threads anything that would have
1660 be per-thread is per-interpreter.
1663 struct interpreter {
1665 #include "thrdvar.h"
1667 #include "intrpvar.h"
1671 struct interpreter {
1677 /* If we have threads define a struct with all the variables
1678 * that have to be per-thread
1682 struct perl_thread {
1683 #include "thrdvar.h"
1686 typedef struct perl_thread *Thread;
1689 typedef void *Thread;
1692 /* Done with PERLVAR macros for now ... */
1702 #define Perl_sv_setptrobj(rv,ptr,name) Perl_sv_setref_iv(rv,name,(IV)ptr)
1703 #define Perl_sv_setptrref(rv,ptr) Perl_sv_setref_iv(rv,Nullch,(IV)ptr)
1705 #define sv_setptrobj(rv,ptr,name) sv_setref_iv(rv,name,(IV)ptr)
1706 #define sv_setptrref(rv,ptr) sv_setref_iv(rv,Nullch,(IV)ptr)
1709 /* The following must follow proto.h as #defines mess up syntax */
1711 #include "embedvar.h"
1713 /* Now include all the 'global' variables
1714 * If we don't have threads or multiple interpreters
1715 * these include variables that would have been their struct-s
1718 #define PERLVAR(var,type) EXT type var;
1719 #define PERLVARI(var,type,init) EXT type var INIT(init);
1720 #define PERLVARIC(var,type,init) EXTCONST type var INIT(init);
1722 #ifndef PERL_GLOBAL_STRUCT
1723 #include "perlvars.h"
1726 #ifndef MULTIPLICITY
1729 #include "thrdvar.h"
1732 #include "intrpvar.h"
1740 #if defined(HASATTRIBUTE) && defined(WIN32)
1742 * This provides a layer of functions and macros to ensure extensions will
1743 * get to use the same RTL functions as the core.
1744 * It has to go here or #define of printf messes up __attribute__
1747 # include <win32iop.h>
1752 EXT MGVTBL vtbl_sv = {magic_get,
1756 EXT MGVTBL vtbl_env = {0, magic_set_all_env,
1757 0, magic_clear_all_env,
1759 EXT MGVTBL vtbl_envelem = {0, magic_setenv,
1762 EXT MGVTBL vtbl_sig = {0, 0, 0, 0, 0};
1763 EXT MGVTBL vtbl_sigelem = {magic_getsig,
1767 EXT MGVTBL vtbl_pack = {0, 0, magic_sizepack, magic_wipepack,
1769 EXT MGVTBL vtbl_packelem = {magic_getpack,
1773 EXT MGVTBL vtbl_dbline = {0, magic_setdbline,
1775 EXT MGVTBL vtbl_isa = {0, magic_setisa,
1778 EXT MGVTBL vtbl_isaelem = {0, magic_setisa,
1780 EXT MGVTBL vtbl_arylen = {magic_getarylen,
1783 EXT MGVTBL vtbl_glob = {magic_getglob,
1786 EXT MGVTBL vtbl_mglob = {0, magic_setmglob,
1788 EXT MGVTBL vtbl_nkeys = {0, magic_setnkeys,
1790 EXT MGVTBL vtbl_taint = {magic_gettaint,magic_settaint,
1792 EXT MGVTBL vtbl_substr = {0, magic_setsubstr,
1794 EXT MGVTBL vtbl_vec = {0, magic_setvec,
1796 EXT MGVTBL vtbl_pos = {magic_getpos,
1799 EXT MGVTBL vtbl_bm = {0, magic_setbm,
1801 EXT MGVTBL vtbl_fm = {0, magic_setfm,
1803 EXT MGVTBL vtbl_uvar = {magic_getuvar,
1807 EXT MGVTBL vtbl_mutex = {0, 0, 0, 0, magic_mutexfree};
1808 #endif /* USE_THREADS */
1809 EXT MGVTBL vtbl_defelem = {magic_getdefelem,magic_setdefelem,
1810 0, 0, magic_freedefelem};
1812 EXT MGVTBL vtbl_regexp = {0,0,0,0, magic_freeregexp};
1814 #ifdef USE_LOCALE_COLLATE
1815 EXT MGVTBL vtbl_collxfrm = {0,
1821 EXT MGVTBL vtbl_amagic = {0, magic_setamagic,
1822 0, 0, magic_setamagic};
1823 EXT MGVTBL vtbl_amagicelem = {0, magic_setamagic,
1824 0, 0, magic_setamagic};
1825 #endif /* OVERLOAD */
1830 EXT MGVTBL vtbl_env;
1831 EXT MGVTBL vtbl_envelem;
1832 EXT MGVTBL vtbl_sig;
1833 EXT MGVTBL vtbl_sigelem;
1834 EXT MGVTBL vtbl_pack;
1835 EXT MGVTBL vtbl_packelem;
1836 EXT MGVTBL vtbl_dbline;
1837 EXT MGVTBL vtbl_isa;
1838 EXT MGVTBL vtbl_isaelem;
1839 EXT MGVTBL vtbl_arylen;
1840 EXT MGVTBL vtbl_glob;
1841 EXT MGVTBL vtbl_mglob;
1842 EXT MGVTBL vtbl_nkeys;
1843 EXT MGVTBL vtbl_taint;
1844 EXT MGVTBL vtbl_substr;
1845 EXT MGVTBL vtbl_vec;
1846 EXT MGVTBL vtbl_pos;
1849 EXT MGVTBL vtbl_uvar;
1852 EXT MGVTBL vtbl_mutex;
1853 #endif /* USE_THREADS */
1855 EXT MGVTBL vtbl_defelem;
1856 EXT MGVTBL vtbl_regexp;
1858 #ifdef USE_LOCALE_COLLATE
1859 EXT MGVTBL vtbl_collxfrm;
1863 EXT MGVTBL vtbl_amagic;
1864 EXT MGVTBL vtbl_amagicelem;
1865 #endif /* OVERLOAD */
1867 #endif /* !DOINIT */
1871 #define NofAMmeth 58
1873 EXTCONST char * AMG_names[NofAMmeth] = {
1874 "fallback", "abs", /* "fallback" should be the first. */
1905 EXTCONST char * AMG_names[NofAMmeth];
1906 #endif /* def INITAMAGIC */
1912 CV* table[NofAMmeth];
1915 struct am_table_short {
1920 typedef struct am_table AMT;
1921 typedef struct am_table_short AMTS;
1923 #define AMGfallNEVER 1
1925 #define AMGfallYES 3
1927 #define AMTf_AMAGIC 1
1928 #define AMT_AMAGIC(amt) ((amt)->flags & AMTf_AMAGIC)
1929 #define AMT_AMAGIC_on(amt) ((amt)->flags |= AMTf_AMAGIC)
1930 #define AMT_AMAGIC_off(amt) ((amt)->flags &= ~AMTf_AMAGIC)
1933 fallback_amg, abs_amg,
1934 bool__amg, nomethod_amg,
1935 string_amg, numer_amg,
1936 add_amg, add_ass_amg,
1937 subtr_amg, subtr_ass_amg,
1938 mult_amg, mult_ass_amg,
1939 div_amg, div_ass_amg,
1940 mod_amg, mod_ass_amg,
1941 pow_amg, pow_ass_amg,
1942 lshift_amg, lshift_ass_amg,
1943 rshift_amg, rshift_ass_amg,
1944 band_amg, band_ass_amg,
1945 bor_amg, bor_ass_amg,
1946 bxor_amg, bxor_ass_amg,
1959 repeat_amg, repeat_ass_amg,
1960 concat_amg, concat_ass_amg,
1965 * some compilers like to redefine cos et alia as faster
1966 * (and less accurate?) versions called F_cos et cetera (Quidquid
1967 * latine dictum sit, altum viditur.) This trick collides with
1968 * the Perl overloading (amg). The following #defines fool both.
1973 # define F_atan2_amg atan2_amg
1976 # define F_cos_amg cos_amg
1979 # define F_exp_amg exp_amg
1982 # define F_log_amg log_amg
1985 # define F_pow_amg pow_amg
1988 # define F_sin_amg sin_amg
1991 # define F_sqrt_amg sqrt_amg
1993 #endif /* _FASTMATH */
1995 #endif /* OVERLOAD */
1997 #define PERLDB_ALL 0xff
1998 #define PERLDBf_SUB 0x01 /* Debug sub enter/exit. */
1999 #define PERLDBf_LINE 0x02 /* Keep line #. */
2000 #define PERLDBf_NOOPT 0x04 /* Switch off optimizations. */
2001 #define PERLDBf_INTER 0x08 /* Preserve more data for
2002 later inspections. */
2003 #define PERLDBf_SUBLINE 0x10 /* Keep subr source lines. */
2004 #define PERLDBf_SINGLE 0x20 /* Start with single-step on. */
2006 #define PERLDB_SUB (perldb && (perldb & PERLDBf_SUB))
2007 #define PERLDB_LINE (perldb && (perldb & PERLDBf_LINE))
2008 #define PERLDB_NOOPT (perldb && (perldb & PERLDBf_NOOPT))
2009 #define PERLDB_INTER (perldb && (perldb & PERLDBf_INTER))
2010 #define PERLDB_SUBLINE (perldb && (perldb & PERLDBf_SUBLINE))
2011 #define PERLDB_SINGLE (perldb && (perldb & PERLDBf_SINGLE))
2014 #ifdef USE_LOCALE_NUMERIC
2016 #define SET_NUMERIC_STANDARD() \
2018 if (! numeric_standard) \
2019 perl_set_numeric_standard(); \
2022 #define SET_NUMERIC_LOCAL() \
2024 if (! numeric_local) \
2025 perl_set_numeric_local(); \
2028 #else /* !USE_LOCALE_NUMERIC */
2030 #define SET_NUMERIC_STANDARD() /**/
2031 #define SET_NUMERIC_LOCAL() /**/
2033 #endif /* !USE_LOCALE_NUMERIC */
2035 #if !defined(PERLIO_IS_STDIO) && defined(HAS_ATTRIBUTE)
2037 * Now we have __attribute__ out of the way
2040 #define printf PerlIO_stdoutf
2043 #ifndef PERL_SCRIPT_MODE
2044 #define PERL_SCRIPT_MODE "r"
2048 * nice_chunk and nice_chunk size need to be set
2049 * and queried under the protection of sv_mutex
2051 #define offer_nice_chunk(chunk, chunk_size) do { \
2053 if (!nice_chunk) { \
2054 nice_chunk = (char*)(chunk); \
2055 nice_chunk_size = (chunk_size); \
2061 #endif /* Include guard */