# define LIBERAL 1
#endif
+#if 'A' == 65 && 'I' == 73 && 'J' == 74 && 'Z' == 90
+#define ASCIIish
+#else
+#undef ASCIIish
+#endif
+
/*
* The following contortions are brought to you on behalf of all the
* standards, semi-standards, de facto standards, not-so-de-facto standards
# endif
#endif
+/* HP-UX 10.X CMA (Common Multithreaded Architecure) insists that
+ pthread.h must be included before all other header files.
+*/
+#if defined(USE_THREADS) && defined(PTHREAD_H_FIRST)
+# include <pthread.h>
+#endif
+
+/* HP-UX 10.X CMA (Common Multithreaded Architecure) insists that
+ pthread.h must be included before all other header files.
+*/
+#if defined(USE_THREADS) && defined(PTHREAD_H_FIRST)
+# include <pthread.h>
+#endif
#ifndef _TYPES_ /* If types.h defines this it's easy. */
# ifndef major /* Does everyone's types.h define this? */
# include <sys/types.h>
set_vaxc_errno(vmserrcode); \
} STMT_END
#else
-# define SETERRNO(errcode,vmserrcode) errno = (errcode)
+# define SETERRNO(errcode,vmserrcode) (errno = (errcode))
#endif
#ifdef USE_THREADS
#endif /* USE_THREADS */
#ifndef errno
- extern int errno; /* ANSI allows errno to be an lvalue expr */
+ extern int errno; /* ANSI allows errno to be an lvalue expr.
+ * For example in multithreaded environments
+ * something like this might happen:
+ * extern int *_errno(void);
+ * #define errno (*_errno()) */
#endif
#ifdef HAS_STRERROR
#undef UV
#endif
+#ifdef I_INTTYPES
+#include <inttypes.h>
+#endif
+
/* XXX QUAD stuff is not currently supported on most systems.
Specifically, perl internals don't support long long. Among
the many problems is that some compilers support long long,
--Andy Dougherty August 1996
*/
-#ifdef cray
-# define Quad_t int
-#else
-# ifdef convex
-# define Quad_t long long
-# else
-# if LONGSIZE == 8
-# define Quad_t long
-# endif
+/* Much more 64-bit probing added. Now we should get Quad_t
+ in most systems: int64_t, long long, long, int, will do.
+
+ Beware of LP32 systems (ILP32, ILP32LL64). Such systems have been
+ used to sizeof(long) == sizeof(foo*). This is a bad assumption
+ because then IV/UV have been 32 bits, too. Which, in turn means
+ that even if the system has quads (e.g. long long), IV cannot be a
+ quad. Introducing a 64-bit IV (because of long long existing)
+ will introduce binary incompatibility.
+
+ Summary: a long long system needs to add -DUSE_LONG_LONG to $ccflags
+ to get quads -- and if its pointers are still 32 bits, this will break
+ binary compatibility. Casting an IV (a long long) to a pointer will
+ truncate half of the IV away.
+
+ --jhi September 1998 */
+
+#if INTSIZE == 4 && LONGSIZE == 4 && PTRSIZE == 4
+# define PERL_ILP32
+# if defined(HAS_LONG_LONG) && LONGLONGSIZE == 8
+# define PERL_ILP32LL64
# endif
#endif
-/* XXX Experimental set-up for long long. Just add -DUSE_LONG_LONG
- to your ccflags. --Andy Dougherty 4/1998
-*/
-#ifdef USE_LONG_LONG
-# if defined(HAS_LONG_LONG) && LONGLONGSIZE == 8
-# define Quad_t long long
-# endif
+#if LONGSIZE == 8 && PTRSIZE == 8
+# define PERL_LP64
+# if INTSIZE == 8
+# define PERL_ILP64
+# endif
+#endif
+
+#ifdef HAS_INT64_T
+# define Quad_t int64_t
+# define PERL_QUAD_IS_INT64_T
+#else
+# if LONGSIZE == 8
+# define Quad_t long
+# define PERL_QUAD_IS_LONG
+# else
+# ifdef USE_LONG_LONG /* See above note about LP32. --jhi */
+# if defined(HAS_LONG_LONG) && LONGLONGSIZE == 8
+# define Quad_t long long
+# define PERL_QUAD_IS_LONG_LONG
+# endif
+# endif
+# ifndef Quad_t
+# if INTSIZE == 8
+# define Quad_t int
+# define PERL_QUAD_IS_INT
+# endif
+# endif
+# endif
#endif
#ifdef Quad_t
# define HAS_QUAD
- typedef Quad_t IV;
- typedef unsigned Quad_t UV;
-# define IV_MAX PERL_QUAD_MAX
-# define IV_MIN PERL_QUAD_MIN
-# define UV_MAX PERL_UQUAD_MAX
-# define UV_MIN PERL_UQUAD_MIN
+#endif
+
+/* See above note on LP32 about the PTRSIZE test. --jhi */
+#if defined(HAS_QUAD) && (PTRSIZE > 4 || defined(USE_LONG_LONG))
+ typedef Quad_t IV;
+ typedef unsigned Quad_t UV;
+# if defined(PERL_QUAD_IS_INT64_T) && defined(INT64_MAX)
+# define IV_MAX INT64_MAX
+# define IV_MIN INT64_MIN
+# define UV_MAX UINT64_MAX
+# define UV_MIN UINT64_MIN
+# else
+# define IV_MAX PERL_QUAD_MAX
+# define IV_MIN PERL_QUAD_MIN
+# define UV_MAX PERL_UQUAD_MAX
+# define UV_MIN PERL_UQUAD_MIN
+# endif
#else
- typedef long IV;
- typedef unsigned long UV;
-# define IV_MAX PERL_LONG_MAX
-# define IV_MIN PERL_LONG_MIN
-# define UV_MAX PERL_ULONG_MAX
-# define UV_MIN PERL_ULONG_MIN
+ typedef long IV;
+ typedef unsigned long UV;
+# if defined(INT32_MAX) && LONGSIZE == 4
+# define IV_MAX INT32_MAX
+# define IV_MIN INT32_MIN
+# define UV_MAX UINT32_MAX
+# define UV_MIN UINT32_MIN
+# else
+# define IV_MAX PERL_LONG_MAX
+# define IV_MIN PERL_LONG_MIN
+# define UV_MAX PERL_ULONG_MAX
+# define UV_MIN PERL_ULONG_MIN
+# endif
#endif
/* Previously these definitions used hardcoded figures.
#include "handy.h"
+#ifdef USE_64_BITS
+# ifdef USE_64_BIT_FILES
+# ifndef USE_64_BIT_IO
+# define USE_64_BIT_IO
+# endif
+# ifndef USE_64_BIT_STDIO
+# define USE_64_BIT_STDIO
+# endif
+# ifndef USE_64_BIT_DBM
+# define USE_64_BIT_DBM
+# endif
+# endif
+# ifdef USE_64_BIT_IO
+# ifdef HAS_FSTAT64
+# define fstat fstat64
+# endif
+# ifdef HAS_FTRUNCATE64
+# define ftruncate ftruncate64
+# endif
+# ifdef HAS_LSEEK64
+# define lseek lseek64
+# ifdef HAS_OFF64_T
+# undef Off_t
+# define Off_t off64_t
+# endif
+# endif
+# ifdef HAS_LSTAT64
+# define lstat lstat64
+# endif
+ /* Some systems have open64() in libc but use that only
+ * for true LP64 mode, in mixed mode (ILP32LL64, for example)
+ * they use the vanilla open(). Such systems should undefine
+ * d_open64 in their hints files. --jhi */
+# if defined(HAS_OPEN64)
+# define open open64
+# endif
+# ifdef HAS_OPENDIR64
+# define opendir opendir64
+# endif
+# ifdef HAS_READDIR64
+# define readdir readdir64
+# ifdef HAS_STRUCT_DIRENT64
+# define dirent dirent64
+# endif
+# endif
+# ifdef HAS_SEEKDIR64
+# define seekdir seekdir64
+# endif
+# ifdef HAS_STAT64
+# define stat stat64 /* Affects also struct stat, hopefully okay. */
+# endif
+# ifdef HAS_TELLDIR64
+# define telldir telldir64
+# endif
+# ifdef HAS_TRUNCATE64
+# define truncate truncate64
+# endif
+ /* flock is not #defined here to be flock64 because it seems
+ that a system may have struct flock64 but still use flock()
+ and not flock64(). The actual flocking code in pp_sys.c
+ must be changed. Also lockf and lockf64 must be dealt
+ with in pp_sys.c. --jhi */
+# endif
+# ifdef USE_64_BIT_STDIO
+# ifdef HAS_FGETPOS64
+# define fgetpos fgetpos64
+# endif
+# ifdef HAS_FOPEN64
+# define fopen fopen64
+# endif
+# ifdef HAS_FREOPEN64
+# define freopen freopen64
+# endif
+# ifdef HAS_FSEEK64
+# define fseek fseek64
+# endif
+# ifdef HAS_FSEEKO64
+# define fseeko fseeko64
+# endif
+# ifdef HAS_FSETPOS64
+# define fsetpos fsetpos64
+# endif
+# ifdef HAS_FTELL64
+# define ftell ftell64
+# endif
+# ifdef HAS_FTELLO64
+# define ftello ftello64
+# endif
+# ifdef HAS_TMPFILE64
+# define tmpfile tmpfile64
+# endif
+# endif
+# ifdef USE_64_BIT_DBM
+# ifdef HAS_DBMINIT64
+# define dbminit dbminit64
+# endif
+# ifdef HAS_DBMCLOSE64
+# define dbmclose dbmclose64
+# endif
+# ifdef HAS_FETCH64
+# define fetch fetch64
+# endif
+# ifdef HAS_DELETE64
+# define delete delete64
+# endif
+# ifdef HAS_STORE64
+# define store store64
+# endif
+# ifdef HAS_FIRSTKEY64
+# define firstkey firstkey64
+# endif
+# ifdef HAS_NEXTKEY64
+# define nextkey nextkey64
+# endif
+# endif
+#endif
+
#ifdef PERL_OBJECT
typedef I32 (*filter_t) _((CPerlObj*, int, SV *, int));
#else
# if defined(MPE)
# include "mpeix/mpeixish.h"
# else
-# include "unixish.h"
+# if defined(__VOS__)
+# include "vosish.h"
+# else
+# include "unixish.h"
+# endif
# endif
# endif
# endif
#include "hv.h"
#include "mg.h"
#include "scope.h"
+#include "warning.h"
#include "bytecode.h"
#include "byterun.h"
+#include "utf8.h"
/* Current curly descriptor */
typedef struct curcur CURCUR;
OP *sub_op; /* "lex_op" to use */
};
-#ifdef PERL_OBJECT
-struct magic_state {
- SV* mgs_sv;
- U32 mgs_flags;
-};
-typedef struct magic_state MGS;
+typedef struct magic_state MGS; /* struct magic_state defined in mg.c */
+#ifdef PERL_OBJECT
typedef struct {
I32 len_min;
I32 len_delta;
#ifndef Perl_debug_log
#define Perl_debug_log PerlIO_stderr()
#endif
+#undef YYDEBUG
#define YYDEBUG 1
#define DEB(a) a
#define DEBUG(a) if (PL_debug) a
#define DEBUG_H(a) if (PL_debug & 8192) a
#define DEBUG_X(a) if (PL_debug & 16384) a
#define DEBUG_D(a) if (PL_debug & 32768) a
+# ifdef USE_THREADS
+# define DEBUG_S(a) if (PL_debug & (1<<16)) a
+# else
+# define DEBUG_S(a)
+# endif
#else
#define DEB(a)
#define DEBUG(a)
#define DEBUG_r(a)
#define DEBUG_x(a)
#define DEBUG_u(a)
-#define DEBUG_L(a)
+#define DEBUG_S(a)
#define DEBUG_H(a)
#define DEBUG_X(a)
#define DEBUG_D(a)
+#define DEBUG_S(a)
#endif
#define YYMAXDEPTH 300
/* All of these are in stdlib.h or time.h for ANSI C */
Time_t time();
struct tm *gmtime(), *localtime();
+#ifdef OEMVS
+char *(strchr)(), *(strrchr)();
+char *(strcpy)(), *(strcat)();
+#else
char *strchr(), *strrchr();
char *strcpy(), *strcat();
+#endif
#endif /* ! STANDARD_C */
/* fast case folding tables */
#ifdef DOINIT
+#ifdef EBCDIC
+EXT unsigned char fold[] = { /* fast EBCDIC case folding table */
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103,
+ 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 138, 139, 140, 141, 142, 143,
+ 144, 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+ 'Q', 'R', 154, 155, 156, 157, 158, 159,
+ 160, 161, 'S', 'T', 'U', 'V', 'W', 'X',
+ 'Y', 'Z', 170, 171, 172, 173, 174, 175,
+ 176, 177, 178, 179, 180, 181, 182, 183,
+ 184, 185, 186, 187, 188, 189, 190, 191,
+ 192, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 202, 203, 204, 205, 206, 207,
+ 208, 'j', 'k', 'l', 'm', 'n', 'o', 'p',
+ 'q', 'r', 218, 219, 220, 221, 222, 223,
+ 224, 225, 's', 't', 'u', 'v', 'w', 'x',
+ 'y', 'z', 234, 235, 236, 237, 238, 239,
+ 240, 241, 242, 243, 244, 245, 246, 247,
+ 248, 249, 250, 251, 252, 253, 254, 255
+};
+#else /* ascii rather than ebcdic */
EXTCONST unsigned char fold[] = {
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
240, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 253, 254, 255
};
+#endif /* !EBCDIC */
#else
EXTCONST unsigned char fold[];
#endif
#endif
#ifdef DOINIT
+#ifdef EBCDIC
+EXT unsigned char freq[] = {/* EBCDIC frequencies for mixed English/C */
+ 1, 2, 84, 151, 154, 155, 156, 157,
+ 165, 246, 250, 3, 158, 7, 18, 29,
+ 40, 51, 62, 73, 85, 96, 107, 118,
+ 129, 140, 147, 148, 149, 150, 152, 153,
+ 255, 6, 8, 9, 10, 11, 12, 13,
+ 14, 15, 24, 25, 26, 27, 28, 226,
+ 29, 30, 31, 32, 33, 43, 44, 45,
+ 46, 47, 48, 49, 50, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86,
+ 87, 94, 95, 234, 181, 233, 187, 190,
+ 180, 96, 97, 98, 99, 100, 101, 102,
+ 104, 112, 182, 174, 236, 232, 229, 103,
+ 228, 226, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 235, 176, 230, 194, 162,
+ 130, 131, 132, 133, 134, 135, 136, 137,
+ 138, 139, 201, 205, 163, 217, 220, 224,
+ 5, 248, 227, 244, 242, 255, 241, 231,
+ 240, 253, 16, 197, 19, 20, 21, 187,
+ 23, 169, 210, 245, 237, 249, 247, 239,
+ 168, 252, 34, 196, 36, 37, 38, 39,
+ 41, 42, 251, 254, 238, 223, 221, 213,
+ 225, 177, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 74, 75,
+ 205, 208, 186, 202, 200, 218, 198, 179,
+ 178, 214, 88, 89, 90, 91, 92, 93,
+ 217, 166, 170, 207, 199, 209, 206, 204,
+ 160, 212, 105, 106, 108, 109, 110, 111,
+ 203, 113, 216, 215, 192, 175, 193, 243,
+ 172, 161, 123, 124, 125, 126, 127, 128,
+ 222, 219, 211, 195, 188, 193, 185, 184,
+ 191, 183, 141, 142, 143, 144, 145, 146
+};
+#else /* ascii rather than ebcdic */
EXTCONST unsigned char freq[] = { /* letter frequencies for mixed English/C */
1, 2, 84, 151, 154, 155, 156, 157,
165, 246, 250, 3, 158, 7, 18, 29,
130, 131, 132, 133, 134, 135, 136, 137,
138, 139, 141, 142, 143, 144, 145, 146
};
+#endif
#else
EXTCONST unsigned char freq[];
#endif
stuffing into op->op_private */
#define HINT_INTEGER 0x00000001
#define HINT_STRICT_REFS 0x00000002
+/* #define HINT_notused4 0x00000004 */
+#define HINT_UTF8 0x00000008
+/* #define HINT_notused10 0x00000010 */
+ /* Note: 20,40,80 used for NATIVE_HINTS */
#define HINT_BLOCK_SCOPE 0x00000100
#define HINT_STRICT_SUBS 0x00000200
#define HINT_RE_TAINT 0x00100000
#define HINT_RE_EVAL 0x00200000
+#define HINT_FILETEST_ACCESS 0x00400000
+
/* Various states of an input record separator SV (rs, nrs) */
#define RsSNARF(sv) (! SvOK(sv))
#define RsSIMPLE(sv) (SvOK(sv) && SvCUR(sv))
#endif
#ifdef PERL_OBJECT
+/*
+ * The following is a buffer where new variables must
+ * be defined to maintain binary compatibility with PERL_OBJECT
+ * for 5.005
+ */
+PERLVAR(object_compatibility[30], char)
};
#include "objpp.h"
0, 0, 0};
EXT MGVTBL vtbl_regexp = {0,0,0,0, magic_freeregexp};
+EXT MGVTBL vtbl_regdata = {0, 0, magic_regdata_cnt, 0, 0};
+EXT MGVTBL vtbl_regdatum = {magic_regdatum_get, 0, 0, 0, 0};
#ifdef USE_LOCALE_COLLATE
EXT MGVTBL vtbl_collxfrm = {0,
EXT MGVTBL vtbl_defelem;
EXT MGVTBL vtbl_regexp;
+EXT MGVTBL vtbl_regdata;
+EXT MGVTBL vtbl_regdatum;
#ifdef USE_LOCALE_COLLATE
EXT MGVTBL vtbl_collxfrm;