3 * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
4 * 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by Larry Wall and others
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Artistic License, as specified in the README file.
17 * This file is being used for x2p stuff.
18 * Above symbol is defined via -D in 'x2p/Makefile.SH'
19 * Decouple x2p stuff from some of perls more extreme eccentricities.
24 #endif /* PERL_FOR_X2P */
27 #include <sys/fcntl.h>
38 # ifndef USE_CROSS_COMPILE
45 /* See L<perlguts/"The Perl API"> for detailed notes on
46 * PERL_IMPLICIT_CONTEXT and PERL_IMPLICIT_SYS */
48 /* Note that from here --> to <-- the same logic is
49 * repeated in makedef.pl, so be certain to update
50 * both places when editing. */
52 #ifdef PERL_IMPLICIT_SYS
53 /* PERL_IMPLICIT_SYS implies PerlMemShared != PerlMem
54 so use slab allocator to avoid lots of MUTEX overhead
56 # ifndef PL_OP_SLAB_ALLOC
57 # define PL_OP_SLAB_ALLOC
62 # if !defined(MULTIPLICITY)
67 #ifdef PERL_GLOBAL_STRUCT_PRIVATE
68 # ifndef PERL_GLOBAL_STRUCT
69 # define PERL_GLOBAL_STRUCT
73 #ifdef PERL_GLOBAL_STRUCT
80 # ifndef PERL_IMPLICIT_CONTEXT
81 # define PERL_IMPLICIT_CONTEXT
85 /* undef WIN32 when building on Cygwin (for libwin32) - gph */
91 #if defined(__SYMBIAN32__) || (defined(__VC32__) && defined(WINS))
98 # include "symbian/symbian_proto.h"
101 /* Any stack-challenged places. The limit varies (and often
102 * is configurable), but using more than a kilobyte of stack
103 * is usually dubious in these systems. */
104 #if defined(EPOC) || defined(__SYMBIAN32__)
105 /* EPOC/Symbian: need to work around the SDK features. *
106 * On WINS: MS VC5 generates calls to _chkstk, *
107 * if a "large" stack frame is allocated. *
108 * gcc on MARM does not generate calls like these. */
109 # define USE_HEAP_INSTEAD_OF_STACK
112 #/* Use the reentrant APIs like localtime_r and getpwent_r */
113 /* Win32 has naturally threadsafe libraries, no need to use any _r variants. */
114 #if defined(USE_ITHREADS) && !defined(USE_REENTRANT_API) && !defined(NETWARE) && !defined(WIN32) && !defined(PERL_DARWIN)
115 # define USE_REENTRANT_API
118 /* <--- here ends the logic shared by perl.h and makedef.pl */
121 * PERL_DARWIN for MacOSX (__APPLE__ exists but is not officially sanctioned)
122 * (The -DPERL_DARWIN comes from the hints/darwin.sh.)
123 * __bsdi__ for BSD/OS
125 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(PERL_DARWIN) || defined(__bsdi__) || defined(BSD41) || defined(BSD42) || defined(BSD43) || defined(BSD44)
131 #undef START_EXTERN_C
135 # define START_EXTERN_C extern "C" {
136 # define END_EXTERN_C }
137 # define EXTERN_C extern "C"
139 # define START_EXTERN_C
140 # define END_EXTERN_C
141 # define EXTERN_C extern
144 /* Fallback definitions in case we don't have definitions from config.h.
145 This should only matter for systems that don't use Configure and
146 haven't been modified to define PERL_STATIC_INLINE yet.
148 #if !defined(PERL_STATIC_INLINE)
149 # ifdef HAS_STATIC_INLINE
150 # define PERL_STATIC_INLINE static inline
152 # define PERL_STATIC_INLINE static
156 #ifdef PERL_GLOBAL_STRUCT
157 # ifndef PERL_GET_VARS
158 # ifdef PERL_GLOBAL_STRUCT_PRIVATE
159 EXTERN_C struct perl_vars* Perl_GetVarsPrivate();
160 # define PERL_GET_VARS() Perl_GetVarsPrivate() /* see miniperlmain.c */
161 # ifndef PERLIO_FUNCS_CONST
162 # define PERLIO_FUNCS_CONST /* Can't have these lying around. */
165 # define PERL_GET_VARS() PL_VarsPtr
170 #define pVAR register struct perl_vars* my_vars PERL_UNUSED_DECL
172 #ifdef PERL_GLOBAL_STRUCT
173 # define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS()
178 #ifdef PERL_IMPLICIT_CONTEXT
179 # ifndef MULTIPLICITY
180 # define MULTIPLICITY
182 # define tTHX PerlInterpreter*
183 # define pTHX register tTHX my_perl PERL_UNUSED_DECL
184 # define aTHX my_perl
185 # ifdef PERL_GLOBAL_STRUCT
186 # define dTHXa(a) dVAR; pTHX = (tTHX)a
188 # define dTHXa(a) pTHX = (tTHX)a
190 # ifdef PERL_GLOBAL_STRUCT
191 # define dTHX dVAR; pTHX = PERL_GET_THX
193 # define dTHX pTHX = PERL_GET_THX
206 # if defined(DEBUGGING) && !defined(PERL_TRACK_MEMPOOL)
207 # define PERL_TRACK_MEMPOOL
210 # undef PERL_TRACK_MEMPOOL
213 #define STATIC static
216 /* Do not use these macros. They were part of PERL_OBJECT, which was an
217 * implementation of multiplicity using C++ objects. They have been left
218 * here solely for the sake of XS code which has incorrectly
221 #define CPERLscope(x) x
222 #define CPERLarg void
225 #define PERL_OBJECT_THIS
226 #define _PERL_OBJECT_THIS
227 #define PERL_OBJECT_THIS_
228 #define CALL_FPTR(fptr) (*fptr)
229 #define MEMBER_TO_FPTR(name) name
230 #endif /* !PERL_CORE */
232 #define CALLRUNOPS PL_runops
234 #define CALLREGCOMP(sv, flags) Perl_pregcomp(aTHX_ (sv),(flags))
236 #define CALLREGCOMP_ENG(prog, sv, flags) (prog)->comp(aTHX_ sv, flags)
237 #define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,screamer,data,flags) \
238 RX_ENGINE(prog)->exec(aTHX_ (prog),(stringarg),(strend), \
239 (strbeg),(minend),(screamer),(data),(flags))
240 #define CALLREG_INTUIT_START(prog,sv,strpos,strend,flags,data) \
241 RX_ENGINE(prog)->intuit(aTHX_ (prog), (sv), (strpos), \
242 (strend),(flags),(data))
243 #define CALLREG_INTUIT_STRING(prog) \
244 RX_ENGINE(prog)->checkstr(aTHX_ (prog))
246 #define CALLREGFREE(prog) \
247 Perl_pregfree(aTHX_ (prog))
249 #define CALLREGFREE_PVT(prog) \
250 if(prog) RX_ENGINE(prog)->free(aTHX_ (prog))
252 #define CALLREG_NUMBUF_FETCH(rx,paren,usesv) \
253 RX_ENGINE(rx)->numbered_buff_FETCH(aTHX_ (rx),(paren),(usesv))
255 #define CALLREG_NUMBUF_STORE(rx,paren,value) \
256 RX_ENGINE(rx)->numbered_buff_STORE(aTHX_ (rx),(paren),(value))
258 #define CALLREG_NUMBUF_LENGTH(rx,sv,paren) \
259 RX_ENGINE(rx)->numbered_buff_LENGTH(aTHX_ (rx),(sv),(paren))
261 #define CALLREG_NAMED_BUFF_FETCH(rx, key, flags) \
262 RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), NULL, ((flags) | RXapif_FETCH))
264 #define CALLREG_NAMED_BUFF_STORE(rx, key, value, flags) \
265 RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), (value), ((flags) | RXapif_STORE))
267 #define CALLREG_NAMED_BUFF_DELETE(rx, key, flags) \
268 RX_ENGINE(rx)->named_buff(aTHX_ (rx),(key), NULL, ((flags) | RXapif_DELETE))
270 #define CALLREG_NAMED_BUFF_CLEAR(rx, flags) \
271 RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_CLEAR))
273 #define CALLREG_NAMED_BUFF_EXISTS(rx, key, flags) \
274 RX_ENGINE(rx)->named_buff(aTHX_ (rx), (key), NULL, ((flags) | RXapif_EXISTS))
276 #define CALLREG_NAMED_BUFF_FIRSTKEY(rx, flags) \
277 RX_ENGINE(rx)->named_buff_iter(aTHX_ (rx), NULL, ((flags) | RXapif_FIRSTKEY))
279 #define CALLREG_NAMED_BUFF_NEXTKEY(rx, lastkey, flags) \
280 RX_ENGINE(rx)->named_buff_iter(aTHX_ (rx), (lastkey), ((flags) | RXapif_NEXTKEY))
282 #define CALLREG_NAMED_BUFF_SCALAR(rx, flags) \
283 RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_SCALAR))
285 #define CALLREG_NAMED_BUFF_COUNT(rx) \
286 RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, RXapif_REGNAMES_COUNT)
288 #define CALLREG_NAMED_BUFF_ALL(rx, flags) \
289 RX_ENGINE(rx)->named_buff(aTHX_ (rx), NULL, NULL, flags)
291 #define CALLREG_PACKAGE(rx) \
292 RX_ENGINE(rx)->qr_package(aTHX_ (rx))
294 #if defined(USE_ITHREADS)
295 #define CALLREGDUPE(prog,param) \
296 Perl_re_dup(aTHX_ (prog),(param))
298 #define CALLREGDUPE_PVT(prog,param) \
299 (prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) \
308 * Because of backward compatibility reasons the PERL_UNUSED_DECL
309 * cannot be changed from postfix to PERL_UNUSED_DECL(x). Sigh.
311 * Note that there are C compilers such as MetroWerks CodeWarrior
312 * which do not have an "inlined" way (like the gcc __attribute__) of
313 * marking unused variables (they need e.g. a #pragma) and therefore
314 * cpp macros like PERL_UNUSED_DECL cannot work for this purpose, even
315 * if it were PERL_UNUSED_DECL(x), which it cannot be (see above).
319 #if defined(__SYMBIAN32__) && defined(__GNUC__)
321 # define PERL_UNUSED_DECL
323 # define PERL_UNUSED_DECL __attribute__((unused))
327 #ifndef PERL_UNUSED_DECL
328 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
329 # define PERL_UNUSED_DECL __attribute__unused__
331 # define PERL_UNUSED_DECL
336 * for silencing unused variables that are actually used most of the time,
337 * but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs
339 #ifndef PERL_UNUSED_ARG
340 # if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
342 # define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
344 # define PERL_UNUSED_ARG(x) ((void)x)
347 #ifndef PERL_UNUSED_VAR
348 # define PERL_UNUSED_VAR(x) ((void)x)
352 # define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
354 # define PERL_UNUSED_CONTEXT
357 #define NOOP /*EMPTY*/(void)0
358 #if !defined(HASATTRIBUTE_UNUSED) && defined(__cplusplus)
359 #define dNOOP /*EMPTY*/(void)0 /* Older g++ has no __attribute((unused))__ */
361 #define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
365 /* Don't bother defining tTHX and sTHX; using them outside
366 * code guarded by PERL_IMPLICIT_CONTEXT is an error.
372 # define dTHXa(a) dNOOP
389 /* these are only defined for compatibility; should not be used internally */
390 #if !defined(pTHXo) && !defined(PERL_CORE)
392 # define pTHXo_ pTHX_
394 # define aTHXo_ aTHX_
396 # define dTHXoa(x) dTHXa(x)
400 # define pTHXx register PerlInterpreter *my_perl
401 # define pTHXx_ pTHXx,
402 # define aTHXx my_perl
403 # define aTHXx_ aTHXx,
407 /* Under PERL_IMPLICIT_SYS (used in Windows for fork emulation)
408 * PerlIO_foo() expands to PL_StdIO->pFOO(PL_StdIO, ...).
409 * dTHXs is therefore needed for all functions using PerlIO_foo(). */
410 #ifdef PERL_IMPLICIT_SYS
411 # ifdef PERL_GLOBAL_STRUCT_PRIVATE
412 # define dTHXs dVAR; dTHX
417 # ifdef PERL_GLOBAL_STRUCT_PRIVATE
424 /* Some platforms require marking function declarations
425 * for them to be exportable. Used in perlio.h, proto.h
426 * is handled either by the makedef.pl or by defining the
427 * PERL_CALLCONV to be something special. See also the
428 * definition of XS() in XSUB.h. */
429 #ifndef PERL_EXPORT_C
431 # define PERL_EXPORT_C extern "C"
433 # define PERL_EXPORT_C extern
436 #ifndef PERL_XS_EXPORT_C
438 # define PERL_XS_EXPORT_C extern "C"
440 # define PERL_XS_EXPORT_C
444 #ifdef OP_IN_REGISTER
446 # define stringify_immed(s) #s
447 # define stringify(s) stringify_immed(s)
448 register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
452 /* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
453 * g++ allows them but seems to have problems with them
454 * (insane errors ensue).
455 * g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
457 #if defined(PERL_GCC_PEDANTIC) || \
458 (defined(__GNUC__) && defined(__cplusplus) && \
459 ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
460 # ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
461 # define PERL_GCC_BRACE_GROUPS_FORBIDDEN
465 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
466 # ifndef PERL_USE_GCC_BRACE_GROUPS
467 # define PERL_USE_GCC_BRACE_GROUPS
472 * STMT_START { statements; } STMT_END;
473 * can be used as a single statement, as in
474 * if (x) STMT_START { ... } STMT_END; else ...
476 * Trying to select a version that gives no warnings...
478 #if !(defined(STMT_START) && defined(STMT_END))
479 # ifdef PERL_USE_GCC_BRACE_GROUPS
480 # define STMT_START (void)( /* gcc supports "({ STATEMENTS; })" */
483 /* Now which other defined()s do we need here ??? */
484 # if (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !defined(__GNUC__)
485 # define STMT_START if (1)
486 # define STMT_END else (void)0
488 # define STMT_START do
489 # define STMT_END while (0)
494 #define WITH_THX(s) STMT_START { dTHX; s; } STMT_END
495 #define WITH_THR(s) WITH_THX(s)
497 #ifndef BYTEORDER /* Should never happen -- byteorder is in config.h */
498 # define BYTEORDER 0x1234
501 /* Overall memory policy? */
506 #if 'A' == 65 && 'I' == 73 && 'J' == 74 && 'Z' == 90
513 * The following contortions are brought to you on behalf of all the
514 * standards, semi-standards, de facto standards, not-so-de-facto standards
515 * of the world, as well as all the other botches anyone ever thought of.
516 * The basic theory is that if we work hard enough here, the rest of the
517 * code can be a lot prettier. Well, so much for theory. Sorry, Henry...
520 /* define this once if either system, instead of cluttering up the src */
521 #if defined(MSDOS) || defined(atarist) || defined(WIN32) || defined(NETWARE)
525 #if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus) || defined(EPOC) || defined(NETWARE) || defined(__SYMBIAN32__)
526 # define STANDARD_C 1
529 #if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(__EMX__) || defined(__DGUX) || defined(EPOC) || defined(__QNX__) || defined(NETWARE) || defined(PERL_MICRO)
530 # define DONT_DECLARE_STD 1
533 #if defined(HASVOLATILE) || defined(STANDARD_C)
534 # define VOL volatile
539 #define TAINT (PL_tainted = TRUE)
540 #define TAINT_NOT (PL_tainted = FALSE)
541 #define TAINT_IF(c) if (c) { PL_tainted = TRUE; }
542 #define TAINT_ENV() if (PL_tainting) { taint_env(); }
543 #define TAINT_PROPER(s) if (PL_tainting) { taint_proper(NULL, s); }
545 /* XXX All process group stuff is handled in pp_sys.c. Should these
546 defines move there? If so, I could simplify this a lot. --AD 9/96.
548 /* Process group stuff changed from traditional BSD to POSIX.
549 perlfunc.pod documents the traditional BSD-style syntax, so we'll
550 try to preserve that, if possible.
553 # define BSD_SETPGRP(pid, pgrp) setpgid((pid), (pgrp))
555 # if defined(HAS_SETPGRP) && defined(USE_BSD_SETPGRP)
556 # define BSD_SETPGRP(pid, pgrp) setpgrp((pid), (pgrp))
558 # ifdef HAS_SETPGRP2 /* DG/UX */
559 # define BSD_SETPGRP(pid, pgrp) setpgrp2((pid), (pgrp))
563 #if defined(BSD_SETPGRP) && !defined(HAS_SETPGRP)
564 # define HAS_SETPGRP /* Well, effectively it does . . . */
567 /* getpgid isn't POSIX, but at least Solaris and Linux have it, and it makes
568 our life easier :-) so we'll try it.
571 # define BSD_GETPGRP(pid) getpgid((pid))
573 # if defined(HAS_GETPGRP) && defined(USE_BSD_GETPGRP)
574 # define BSD_GETPGRP(pid) getpgrp((pid))
576 # ifdef HAS_GETPGRP2 /* DG/UX */
577 # define BSD_GETPGRP(pid) getpgrp2((pid))
581 #if defined(BSD_GETPGRP) && !defined(HAS_GETPGRP)
582 # define HAS_GETPGRP /* Well, effectively it does . . . */
585 /* These are not exact synonyms, since setpgrp() and getpgrp() may
586 have different behaviors, but perl.h used to define USE_BSDPGRP
587 (prior to 5.003_05) so some extension might depend on it.
589 #if defined(USE_BSD_SETPGRP) || defined(USE_BSD_GETPGRP)
595 /* HP-UX 10.X CMA (Common Multithreaded Architecure) insists that
596 pthread.h must be included before all other header files.
598 #if defined(USE_ITHREADS) && defined(PTHREAD_H_FIRST) && defined(I_PTHREAD)
599 # include <pthread.h>
602 #ifndef _TYPES_ /* If types.h defines this it's easy. */
603 # ifndef major /* Does everyone's types.h define this? */
604 # include <sys/types.h>
618 # include <varargs.h>
622 #ifdef USE_NEXT_CTYPE
624 #if NX_CURRENT_COMPILER_RELEASE >= 500
625 # include <bsd/ctypes.h>
627 # if NX_CURRENT_COMPILER_RELEASE >= 400
628 # include <objc/NXCType.h>
629 # else /* NX_CURRENT_COMPILER_RELEASE < 400 */
630 # include <appkit/NXCType.h>
631 # endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
632 #endif /* NX_CURRENT_COMPILER_RELEASE >= 500 */
634 #else /* !USE_NEXT_CTYPE */
636 #endif /* USE_NEXT_CTYPE */
638 #ifdef METHOD /* Defined by OSF/1 v3.0 by ctype.h */
650 #if !defined(NO_LOCALE) && defined(HAS_SETLOCALE)
652 # if !defined(NO_LOCALE_COLLATE) && defined(LC_COLLATE) \
653 && defined(HAS_STRXFRM)
654 # define USE_LOCALE_COLLATE
656 # if !defined(NO_LOCALE_CTYPE) && defined(LC_CTYPE)
657 # define USE_LOCALE_CTYPE
659 # if !defined(NO_LOCALE_NUMERIC) && defined(LC_NUMERIC)
660 # define USE_LOCALE_NUMERIC
662 #endif /* !NO_LOCALE && HAS_SETLOCALE */
667 # ifdef PARAM_NEEDS_TYPES
668 # include <sys/types.h>
670 # include <sys/param.h>
673 /* Use all the "standard" definitions? */
674 #if defined(STANDARD_C) && defined(I_STDLIB)
678 /* If this causes problems, set i_unistd=undef in the hint file. */
685 # include <sys/wait.h>
689 # undef _SC_ARG_MAX /* Symbian has _SC_ARG_MAX but no sysconf() */
692 #if defined(HAS_SYSCALL) && !defined(HAS_SYSCALL_PROTO) && !defined(PERL_MICRO)
693 EXTERN_C int syscall(int, ...);
696 #if defined(HAS_USLEEP) && !defined(HAS_USLEEP_PROTO) && !defined(PERL_MICRO)
697 EXTERN_C int usleep(unsigned int);
700 /* Funky places that do not have socket stuff. */
701 #if defined(__LIBCATAMOUNT__)
705 #ifdef PERL_MICRO /* Last chance to export Perl_my_swap */
711 /* macros for correct constant construction */
713 # define U16_CONST(x) ((U16)x##U)
715 # define U16_CONST(x) ((U16)x##UL)
719 # define U32_CONST(x) ((U32)x##U)
721 # define U32_CONST(x) ((U32)x##UL)
726 # define U64_CONST(x) ((U64)x##U)
728 # define U64_CONST(x) ((U64)x##UL)
729 # elif QUADKIND == QUAD_IS_LONG_LONG
730 # define U64_CONST(x) ((U64)x##ULL)
731 # else /* best guess we can make */
732 # define U64_CONST(x) ((U64)x##UL)
736 /* byte-swapping functions for big-/little-endian conversion */
737 # define _swab_16_(x) ((U16)( \
738 (((U16)(x) & U16_CONST(0x00ff)) << 8) | \
739 (((U16)(x) & U16_CONST(0xff00)) >> 8) ))
741 # define _swab_32_(x) ((U32)( \
742 (((U32)(x) & U32_CONST(0x000000ff)) << 24) | \
743 (((U32)(x) & U32_CONST(0x0000ff00)) << 8) | \
744 (((U32)(x) & U32_CONST(0x00ff0000)) >> 8) | \
745 (((U32)(x) & U32_CONST(0xff000000)) >> 24) ))
748 # define _swab_64_(x) ((U64)( \
749 (((U64)(x) & U64_CONST(0x00000000000000ff)) << 56) | \
750 (((U64)(x) & U64_CONST(0x000000000000ff00)) << 40) | \
751 (((U64)(x) & U64_CONST(0x0000000000ff0000)) << 24) | \
752 (((U64)(x) & U64_CONST(0x00000000ff000000)) << 8) | \
753 (((U64)(x) & U64_CONST(0x000000ff00000000)) >> 8) | \
754 (((U64)(x) & U64_CONST(0x0000ff0000000000)) >> 24) | \
755 (((U64)(x) & U64_CONST(0x00ff000000000000)) >> 40) | \
756 (((U64)(x) & U64_CONST(0xff00000000000000)) >> 56) ))
759 /*----------------------------------------------------------------------------*/
760 # if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 /* little-endian */
761 /*----------------------------------------------------------------------------*/
762 # define my_htole16(x) (x)
763 # define my_letoh16(x) (x)
764 # define my_htole32(x) (x)
765 # define my_letoh32(x) (x)
766 # define my_htobe16(x) _swab_16_(x)
767 # define my_betoh16(x) _swab_16_(x)
768 # define my_htobe32(x) _swab_32_(x)
769 # define my_betoh32(x) _swab_32_(x)
771 # define my_htole64(x) (x)
772 # define my_letoh64(x) (x)
773 # define my_htobe64(x) _swab_64_(x)
774 # define my_betoh64(x) _swab_64_(x)
776 # define my_htoles(x) (x)
777 # define my_letohs(x) (x)
778 # define my_htolei(x) (x)
779 # define my_letohi(x) (x)
780 # define my_htolel(x) (x)
781 # define my_letohl(x) (x)
783 # define my_htobes(x) (x)
784 # define my_betohs(x) (x)
785 # elif SHORTSIZE == 2
786 # define my_htobes(x) _swab_16_(x)
787 # define my_betohs(x) _swab_16_(x)
788 # elif SHORTSIZE == 4
789 # define my_htobes(x) _swab_32_(x)
790 # define my_betohs(x) _swab_32_(x)
791 # elif SHORTSIZE == 8
792 # define my_htobes(x) _swab_64_(x)
793 # define my_betohs(x) _swab_64_(x)
795 # define PERL_NEED_MY_HTOBES
796 # define PERL_NEED_MY_BETOHS
799 # define my_htobei(x) (x)
800 # define my_betohi(x) (x)
802 # define my_htobei(x) _swab_16_(x)
803 # define my_betohi(x) _swab_16_(x)
805 # define my_htobei(x) _swab_32_(x)
806 # define my_betohi(x) _swab_32_(x)
808 # define my_htobei(x) _swab_64_(x)
809 # define my_betohi(x) _swab_64_(x)
811 # define PERL_NEED_MY_HTOBEI
812 # define PERL_NEED_MY_BETOHI
815 # define my_htobel(x) (x)
816 # define my_betohl(x) (x)
818 # define my_htobel(x) _swab_16_(x)
819 # define my_betohl(x) _swab_16_(x)
821 # define my_htobel(x) _swab_32_(x)
822 # define my_betohl(x) _swab_32_(x)
824 # define my_htobel(x) _swab_64_(x)
825 # define my_betohl(x) _swab_64_(x)
827 # define PERL_NEED_MY_HTOBEL
828 # define PERL_NEED_MY_BETOHL
830 # define my_htolen(p,n) NOOP
831 # define my_letohn(p,n) NOOP
832 # define my_htoben(p,n) my_swabn(p,n)
833 # define my_betohn(p,n) my_swabn(p,n)
834 /*----------------------------------------------------------------------------*/
835 # elif BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 /* big-endian */
836 /*----------------------------------------------------------------------------*/
837 # define my_htobe16(x) (x)
838 # define my_betoh16(x) (x)
839 # define my_htobe32(x) (x)
840 # define my_betoh32(x) (x)
841 # define my_htole16(x) _swab_16_(x)
842 # define my_letoh16(x) _swab_16_(x)
843 # define my_htole32(x) _swab_32_(x)
844 # define my_letoh32(x) _swab_32_(x)
846 # define my_htobe64(x) (x)
847 # define my_betoh64(x) (x)
848 # define my_htole64(x) _swab_64_(x)
849 # define my_letoh64(x) _swab_64_(x)
851 # define my_htobes(x) (x)
852 # define my_betohs(x) (x)
853 # define my_htobei(x) (x)
854 # define my_betohi(x) (x)
855 # define my_htobel(x) (x)
856 # define my_betohl(x) (x)
858 # define my_htoles(x) (x)
859 # define my_letohs(x) (x)
860 # elif SHORTSIZE == 2
861 # define my_htoles(x) _swab_16_(x)
862 # define my_letohs(x) _swab_16_(x)
863 # elif SHORTSIZE == 4
864 # define my_htoles(x) _swab_32_(x)
865 # define my_letohs(x) _swab_32_(x)
866 # elif SHORTSIZE == 8
867 # define my_htoles(x) _swab_64_(x)
868 # define my_letohs(x) _swab_64_(x)
870 # define PERL_NEED_MY_HTOLES
871 # define PERL_NEED_MY_LETOHS
874 # define my_htolei(x) (x)
875 # define my_letohi(x) (x)
877 # define my_htolei(x) _swab_16_(x)
878 # define my_letohi(x) _swab_16_(x)
880 # define my_htolei(x) _swab_32_(x)
881 # define my_letohi(x) _swab_32_(x)
883 # define my_htolei(x) _swab_64_(x)
884 # define my_letohi(x) _swab_64_(x)
886 # define PERL_NEED_MY_HTOLEI
887 # define PERL_NEED_MY_LETOHI
890 # define my_htolel(x) (x)
891 # define my_letohl(x) (x)
893 # define my_htolel(x) _swab_16_(x)
894 # define my_letohl(x) _swab_16_(x)
896 # define my_htolel(x) _swab_32_(x)
897 # define my_letohl(x) _swab_32_(x)
899 # define my_htolel(x) _swab_64_(x)
900 # define my_letohl(x) _swab_64_(x)
902 # define PERL_NEED_MY_HTOLEL
903 # define PERL_NEED_MY_LETOHL
905 # define my_htolen(p,n) my_swabn(p,n)
906 # define my_letohn(p,n) my_swabn(p,n)
907 # define my_htoben(p,n) NOOP
908 # define my_betohn(p,n) NOOP
909 /*----------------------------------------------------------------------------*/
910 # else /* all other byte-orders */
911 /*----------------------------------------------------------------------------*/
912 # define PERL_NEED_MY_HTOLE16
913 # define PERL_NEED_MY_LETOH16
914 # define PERL_NEED_MY_HTOBE16
915 # define PERL_NEED_MY_BETOH16
916 # define PERL_NEED_MY_HTOLE32
917 # define PERL_NEED_MY_LETOH32
918 # define PERL_NEED_MY_HTOBE32
919 # define PERL_NEED_MY_BETOH32
921 # define PERL_NEED_MY_HTOLE64
922 # define PERL_NEED_MY_LETOH64
923 # define PERL_NEED_MY_HTOBE64
924 # define PERL_NEED_MY_BETOH64
926 # define PERL_NEED_MY_HTOLES
927 # define PERL_NEED_MY_LETOHS
928 # define PERL_NEED_MY_HTOBES
929 # define PERL_NEED_MY_BETOHS
930 # define PERL_NEED_MY_HTOLEI
931 # define PERL_NEED_MY_LETOHI
932 # define PERL_NEED_MY_HTOBEI
933 # define PERL_NEED_MY_BETOHI
934 # define PERL_NEED_MY_HTOLEL
935 # define PERL_NEED_MY_LETOHL
936 # define PERL_NEED_MY_HTOBEL
937 # define PERL_NEED_MY_BETOHL
938 /*----------------------------------------------------------------------------*/
939 # endif /* end of byte-order macros */
940 /*----------------------------------------------------------------------------*/
942 /* The old value was hard coded at 1008. (4096-16) seems to be a bit faster,
943 at least on FreeBSD. YMMV, so experiment. */
944 #ifndef PERL_ARENA_SIZE
945 #define PERL_ARENA_SIZE 4080
948 /* Maximum level of recursion */
949 #ifndef PERL_SUB_DEPTH_WARN
950 #define PERL_SUB_DEPTH_WARN 100
953 #endif /* PERL_CORE */
955 /* We no longer default to creating a new SV for GvSV.
956 Do this before embed. */
957 #ifndef PERL_CREATE_GVSV
958 # ifndef PERL_DONT_CREATE_GVSV
959 # define PERL_DONT_CREATE_GVSV
963 #if !defined(HAS_WAITPID) && !defined(HAS_WAIT4) || defined(HAS_WAITPID_RUNTIME)
964 #define PERL_USES_PL_PIDSTATUS
967 #if !defined(OS2) && !defined(WIN32) && !defined(DJGPP) && !defined(EPOC) && !defined(__SYMBIAN32__)
968 #define PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION
971 /* Cannot include embed.h here on Win32 as win32.h has not
972 yet been included and defines some config variables e.g. HAVE_INTERP_INTERN
974 #if !defined(PERL_FOR_X2P) && !(defined(WIN32)||defined(VMS))
978 # define op_getmad(arg,pegop,slot) NOOP
982 #define MEM_SIZE Size_t
984 /* Round all values passed to malloc up, by default to a multiple of
987 #ifndef PERL_STRLEN_ROUNDUP_QUANTUM
988 #define PERL_STRLEN_ROUNDUP_QUANTUM Size_t_size
991 /* sv_grow() will expand strings by at least a certain percentage of
992 the previously *used* length to avoid excessive calls to realloc().
993 The default is 25% of the current length.
995 #ifndef PERL_STRLEN_EXPAND_SHIFT
996 # define PERL_STRLEN_EXPAND_SHIFT 2
999 #if defined(STANDARD_C) && defined(I_STDDEF)
1000 # include <stddef.h>
1001 # define STRUCT_OFFSET(s,m) offsetof(s,m)
1003 # define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m))
1006 #ifndef __SYMBIAN32__
1007 # if defined(I_STRING) || defined(__cplusplus)
1008 # include <string.h>
1010 # include <strings.h>
1014 /* This comes after <stdlib.h> so we don't try to change the standard
1015 * library prototypes; we'll use our own in proto.h instead. */
1018 # ifdef PERL_POLLUTE_MALLOC
1019 # ifndef PERL_EXTMALLOC_DEF
1020 # define Perl_malloc malloc
1021 # define Perl_calloc calloc
1022 # define Perl_realloc realloc
1023 # define Perl_mfree free
1026 # define EMBEDMYMALLOC /* for compatibility */
1029 # define safemalloc Perl_malloc
1030 # define safecalloc Perl_calloc
1031 # define saferealloc Perl_realloc
1032 # define safefree Perl_mfree
1033 # define CHECK_MALLOC_TOO_LATE_FOR_(code) STMT_START { \
1034 if (!PL_tainting && MallocCfg_ptr[MallocCfg_cfg_env_read]) \
1037 # define CHECK_MALLOC_TOO_LATE_FOR(ch) \
1038 CHECK_MALLOC_TOO_LATE_FOR_(MALLOC_TOO_LATE_FOR(ch))
1039 # define panic_write2(s) write(2, s, strlen(s))
1040 # define CHECK_MALLOC_TAINT(newval) \
1041 CHECK_MALLOC_TOO_LATE_FOR_( \
1043 panic_write2("panic: tainting with $ENV{PERL_MALLOC_OPT}\n");\
1045 # define MALLOC_CHECK_TAINT(argc,argv,env) STMT_START { \
1046 if (doing_taint(argc,argv,env)) { \
1047 MallocCfg_ptr[MallocCfg_skip_cfg_env] = 1; \
1049 #else /* MYMALLOC */
1050 # define safemalloc safesysmalloc
1051 # define safecalloc safesyscalloc
1052 # define saferealloc safesysrealloc
1053 # define safefree safesysfree
1054 # define CHECK_MALLOC_TOO_LATE_FOR(ch) ((void)0)
1055 # define CHECK_MALLOC_TAINT(newval) ((void)0)
1056 # define MALLOC_CHECK_TAINT(argc,argv,env)
1057 #endif /* MYMALLOC */
1059 /* diag_listed_as: "-T" is on the #! line, it must also be used on the command line */
1060 #define TOO_LATE_FOR_(ch,what) Perl_croak(aTHX_ "\"-%c\" is on the #! line, it must also be used on the command line%s", (char)(ch), what)
1061 #define TOO_LATE_FOR(ch) TOO_LATE_FOR_(ch, "")
1062 #define MALLOC_TOO_LATE_FOR(ch) TOO_LATE_FOR_(ch, " with $ENV{PERL_MALLOC_OPT}")
1063 #define MALLOC_CHECK_TAINT2(argc,argv) MALLOC_CHECK_TAINT(argc,argv,NULL)
1065 #if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
1066 #define strchr index
1067 #define strrchr rindex
1071 # include <memory.h>
1075 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
1077 extern char * memcpy (char*, char*, int);
1083 # define memcpy(d,s,l) bcopy(s,d,l)
1085 # define memcpy(d,s,l) my_bcopy(s,d,l)
1088 #endif /* HAS_MEMCPY */
1091 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
1093 extern char *memset (char*, int, int);
1098 # define memset(d,c,l) my_memset(d,c,l)
1099 #endif /* HAS_MEMSET */
1101 #if !defined(HAS_MEMMOVE) && !defined(memmove)
1102 # if defined(HAS_BCOPY) && defined(HAS_SAFE_BCOPY)
1103 # define memmove(d,s,l) bcopy(s,d,l)
1105 # if defined(HAS_MEMCPY) && defined(HAS_SAFE_MEMCPY)
1106 # define memmove(d,s,l) memcpy(d,s,l)
1108 # define memmove(d,s,l) my_bcopy(s,d,l)
1113 #if defined(mips) && defined(ultrix) && !defined(__STDC__)
1117 #if defined(HAS_MEMCMP) && defined(HAS_SANE_MEMCMP)
1118 # if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
1120 extern int memcmp (char*, char*, int);
1124 # pragma function(memcmp)
1128 # define memcmp my_memcmp
1130 #endif /* HAS_MEMCMP && HAS_SANE_MEMCMP */
1134 # define memzero(d,l) memset(d,0,l)
1137 # define memzero(d,l) bzero(d,l)
1139 # define memzero(d,l) my_bzero(d,l)
1147 # define memchr(s,c,n) ninstr((char*)(s), ((char*)(s)) + n, &(c), &(c) + 1)
1154 # define bcmp(s1,s2,l) memcmp(s1,s2,l)
1156 #endif /* !HAS_BCMP */
1159 # include <netinet/in.h>
1163 # include <arpa/inet.h>
1166 #if defined(SF_APPEND) && defined(USE_SFIO) && defined(I_SFIO)
1167 /* <sfio.h> defines SF_APPEND and <sys/stat.h> might define SF_APPEND
1168 * (the neo-BSD seem to do this). */
1173 # include <sys/stat.h>
1176 /* Microsoft VC's sys/stat.h defines all S_Ixxx macros except S_IFIFO.
1177 This definition should ideally go into win32/win32.h, but S_IFIFO is
1178 used later here in perl.h before win32/win32.h is being included. */
1179 #if !defined(S_IFIFO) && defined(_S_IFIFO)
1180 # define S_IFIFO _S_IFIFO
1183 /* The stat macros for Amdahl UTS, Unisoft System V/88 (and derivatives
1184 like UTekV) are broken, sometimes giving false positives. Undefine
1185 them here and let the code below set them to proper values.
1187 The ghs macro stands for GreenHills Software C-1.8.5 which
1188 is the C compiler for sysV88 and the various derivatives.
1189 This header file bug is corrected in gcc-2.5.8 and later versions.
1190 --Kaveh Ghazi (ghazi@noc.rutgers.edu) 10/3/94. */
1192 #if defined(uts) || (defined(m88k) && defined(ghs))
1206 # ifdef I_SYS_TIME_KERNEL
1209 # include <sys/time.h>
1210 # ifdef I_SYS_TIME_KERNEL
1215 #if defined(HAS_TIMES) && defined(I_SYS_TIMES)
1216 # include <sys/times.h>
1219 #if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
1220 # undef HAS_STRERROR
1225 #if defined(WIN32) && defined(PERL_IMPLICIT_SYS)
1226 # define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */
1229 /* In Tru64 use the 4.4BSD struct msghdr, not the 4.3 one.
1230 * This is important for using IPv6.
1231 * For OSF/1 3.2, however, defining _SOCKADDR_LEN would be
1232 * a bad idea since it breaks send() and recv(). */
1233 #if defined(__osf__) && defined(__alpha) && !defined(_SOCKADDR_LEN) && !defined(DEC_OSF1_3_X)
1234 # define _SOCKADDR_LEN
1237 #if defined(HAS_SOCKET) && !defined(VMS) && !defined(WIN32) /* VMS/WIN32 handle sockets via vmsish.h/win32.h */
1238 # include <sys/socket.h>
1239 # if defined(USE_SOCKS) && defined(I_SOCKS)
1240 # if !defined(INCLUDE_PROTOTYPES)
1241 # define INCLUDE_PROTOTYPES /* for <socks.h> */
1242 # define PERL_SOCKS_NEED_PROTOTYPES
1245 # ifdef PERL_SOCKS_NEED_PROTOTYPES /* keep cpp space clean */
1246 # undef INCLUDE_PROTOTYPES
1247 # undef PERL_SOCKS_NEED_PROTOTYPES
1258 # include <net/errno.h>
1263 /* sockatmark() is so new (2001) that many places might have it hidden
1264 * behind some -D_BLAH_BLAH_SOURCE guard. The __THROW magic is required
1265 * e.g. in Gentoo, see http://bugs.gentoo.org/show_bug.cgi?id=12605 */
1266 #if defined(HAS_SOCKATMARK) && !defined(HAS_SOCKATMARK_PROTO)
1267 # if defined(__THROW) && defined(__GLIBC__)
1268 int sockatmark(int) __THROW;
1270 int sockatmark(int);
1274 #if defined(__osf__) && defined(__cplusplus) && !defined(_XOPEN_SOURCE_EXTENDED) /* Tru64 "cxx" (C++), see hints/dec_osf.sh for why the _XOPEN_SOURCE_EXTENDED cannot be defined. */
1275 EXTERN_C int fchdir(int);
1276 EXTERN_C int flock(int, int);
1277 EXTERN_C int fseeko(FILE *, off_t, int);
1278 EXTERN_C off_t ftello(FILE *);
1281 #if defined(__SUNPRO_CC) /* SUNWspro CC (C++) */
1282 EXTERN_C char *crypt(const char *, const char *);
1283 EXTERN_C char **environ;
1286 #if defined(__cplusplus)
1287 # if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
1288 EXTERN_C char **environ;
1289 # elif defined(__CYGWIN__)
1290 EXTERN_C char *crypt(const char *, const char *);
1295 # undef SETERRNO /* SOCKS might have defined this */
1299 # define SETERRNO(errcode,vmserrcode) \
1301 set_errno(errcode); \
1302 set_vaxc_errno(vmserrcode); \
1304 # define dSAVEDERRNO int saved_errno; unsigned saved_vms_errno
1305 # define dSAVE_ERRNO int saved_errno = errno; unsigned saved_vms_errno = vaxc$errno
1306 # define SAVE_ERRNO ( saved_errno = errno, saved_vms_errno = vaxc$errno )
1307 # define RESTORE_ERRNO SETERRNO(saved_errno, saved_vms_errno)
1309 # define LIB_INVARG LIB$_INVARG
1310 # define RMS_DIR RMS$_DIR
1311 # define RMS_FAC RMS$_FAC
1312 # define RMS_FEX RMS$_FEX
1313 # define RMS_FNF RMS$_FNF
1314 # define RMS_IFI RMS$_IFI
1315 # define RMS_ISI RMS$_ISI
1316 # define RMS_PRV RMS$_PRV
1317 # define SS_ACCVIO SS$_ACCVIO
1318 # define SS_DEVOFFLINE SS$_DEVOFFLINE
1319 # define SS_IVCHAN SS$_IVCHAN
1320 # define SS_NORMAL SS$_NORMAL
1322 # define SETERRNO(errcode,vmserrcode) (errno = (errcode))
1323 # define dSAVEDERRNO int saved_errno
1324 # define dSAVE_ERRNO int saved_errno = errno
1325 # define SAVE_ERRNO (saved_errno = errno)
1326 # define RESTORE_ERRNO (errno = saved_errno)
1328 # define LIB_INVARG 0
1336 # define SS_ACCVIO 0
1337 # define SS_DEVOFFLINE 0
1338 # define SS_IVCHAN 0
1339 # define SS_NORMAL 0
1342 #define ERRSV GvSVn(PL_errgv)
1344 #define CLEAR_ERRSV() STMT_START { \
1345 if (!GvSV(PL_errgv)) { \
1346 sv_setpvs(GvSV(gv_add_by_type(PL_errgv, SVt_PV)), ""); \
1347 } else if (SvREADONLY(GvSV(PL_errgv))) { \
1348 SvREFCNT_dec(GvSV(PL_errgv)); \
1349 GvSV(PL_errgv) = newSVpvs(""); \
1351 SV *const errsv = GvSV(PL_errgv); \
1352 sv_setpvs(errsv, ""); \
1353 if (SvMAGICAL(errsv)) { \
1356 SvPOK_only(errsv); \
1362 # define DEFSV (0 + GvSVn(PL_defgv))
1364 # define DEFSV GvSVn(PL_defgv)
1366 #define DEFSV_set(sv) (GvSV(PL_defgv) = (sv))
1367 #define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
1369 #define ERRHV GvHV(PL_errgv) /* XXX unused, here for compatibility */
1372 extern int errno; /* ANSI allows errno to be an lvalue expr.
1373 * For example in multithreaded environments
1374 * something like this might happen:
1375 * extern int *_errno(void);
1376 * #define errno (*_errno()) */
1381 char *strerror (int,...);
1383 #ifndef DONT_DECLARE_STD
1384 char *strerror (int);
1388 # define Strerror strerror
1391 # ifdef HAS_SYS_ERRLIST
1392 extern int sys_nerr;
1393 extern char *sys_errlist[];
1395 # define Strerror(e) \
1396 ((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
1403 # include <sys/ioctl.h>
1407 #if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
1408 # ifdef HAS_SOCKETPAIR
1409 # undef HAS_SOCKETPAIR
1416 #ifndef HAS_SOCKETPAIR
1418 # define socketpair Perl_my_socketpair
1423 # define htoni htons
1424 # define ntohi ntohs
1426 # define htoni htonl
1427 # define ntohi ntohl
1430 /* Configure already sets Direntry_t */
1431 #if defined(I_DIRENT)
1432 # include <dirent.h>
1433 /* NeXT needs dirent + sys/dir.h */
1434 # if defined(I_SYS_DIR) && (defined(NeXT) || defined(__NeXT__))
1435 # include <sys/dir.h>
1439 # include <sys/ndir.h>
1443 # include <ndir.h> /* may be wrong in the future */
1445 # include <sys/dir.h>
1458 /* work around botch in SunOS 4.0.1 and 4.0.2 */
1460 # define fputs(sv,fp) fprintf(fp,"%s",sv)
1465 * The following gobbledygook brought to you on behalf of __STDC__.
1466 * (I could just use #ifndef __STDC__, but this is more bulletproof
1467 * in the face of half-implementations.)
1470 #if defined(I_SYSMODE) && !defined(PERL_MICRO)
1471 #include <sys/mode.h>
1476 # define S_IFMT _S_IFMT
1478 # define S_IFMT 0170000
1483 # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
1487 # define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
1492 # define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
1494 # define S_ISBLK(m) (0)
1499 # define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
1504 # define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
1506 # define S_ISFIFO(m) (0)
1512 # define S_ISLNK(m) _S_ISLNK(m)
1515 # define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
1518 # define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
1520 # define S_ISLNK(m) (0)
1528 # define S_ISSOCK(m) _S_ISSOCK(m)
1531 # define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
1534 # define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
1536 # define S_ISSOCK(m) (0)
1544 # define S_IRUSR S_IREAD
1545 # define S_IWUSR S_IWRITE
1546 # define S_IXUSR S_IEXEC
1548 # define S_IRUSR 0400
1549 # define S_IWUSR 0200
1550 # define S_IXUSR 0100
1556 # define S_IRGRP (S_IRUSR>>3)
1557 # define S_IWGRP (S_IWUSR>>3)
1558 # define S_IXGRP (S_IXUSR>>3)
1560 # define S_IRGRP 0040
1561 # define S_IWGRP 0020
1562 # define S_IXGRP 0010
1568 # define S_IROTH (S_IRUSR>>6)
1569 # define S_IWOTH (S_IWUSR>>6)
1570 # define S_IXOTH (S_IXUSR>>6)
1572 # define S_IROTH 0040
1573 # define S_IWOTH 0020
1574 # define S_IXOTH 0010
1579 # define S_ISUID 04000
1583 # define S_ISGID 02000
1587 # define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
1591 # define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
1595 # define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
1598 /* BeOS 5.0 and Haiku R1 seem to define S_IREAD and S_IWRITE in <posix/fcntl.h>
1599 * which would get included through <sys/file.h >, but that is 3000
1600 * lines in the future. --jhi */
1602 #if !defined(S_IREAD) && !(defined(__BEOS__) || defined(__HAIKU__))
1603 # define S_IREAD S_IRUSR
1606 #if !defined(S_IWRITE) && !(defined(__BEOS__) || defined(__HAIKU__))
1607 # define S_IWRITE S_IWUSR
1611 # define S_IEXEC S_IXUSR
1618 #if defined(cray) || defined(gould) || defined(i860) || defined(pyr)
1619 # define SLOPPYDIVIDE
1626 #ifdef SPRINTF_E_BUG
1627 # define sprintf UTS_sprintf_wrap
1630 /* For the times when you want the return value of sprintf, and you want it
1631 to be the length. Can't have a thread variable passed in, because C89 has
1634 #ifdef SPRINTF_RETURNS_STRLEN
1635 # define my_sprintf sprintf
1637 # define my_sprintf Perl_my_sprintf
1641 * If we have v?snprintf() and the C99 variadic macros, we can just
1642 * use just the v?snprintf(). It is nice to try to trap the buffer
1643 * overflow, however, so if we are DEBUGGING, and we cannot use the
1644 * gcc statement expressions, then use the function wrappers which try
1645 * to trap the overflow. If we can use the gcc statement expressions,
1646 * we can try that even with the version that uses the C99 variadic
1650 /* Note that we do not check against snprintf()/vsnprintf() returning
1651 * negative values because that is non-standard behaviour and we use
1652 * snprintf/vsnprintf only iff HAS_VSNPRINTF has been defined, and
1653 * that should be true only if the snprintf()/vsnprintf() are true
1654 * to the standard. */
1656 #if defined(HAS_SNPRINTF) && defined(HAS_C99_VARIADIC_MACROS) && !(defined(DEBUGGING) && !defined(PERL_USE_GCC_BRACE_GROUPS)) && !defined(PERL_GCC_PEDANTIC)
1657 # ifdef PERL_USE_GCC_BRACE_GROUPS
1658 # define my_snprintf(buffer, len, ...) ({ int __len__ = snprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && (Size_t)__len__ >= (len)) Perl_croak_nocontext("panic: snprintf buffer overflow"); __len__; })
1659 # define PERL_MY_SNPRINTF_GUARDED
1661 # define my_snprintf(buffer, len, ...) snprintf(buffer, len, __VA_ARGS__)
1664 # define my_snprintf Perl_my_snprintf
1665 # define PERL_MY_SNPRINTF_GUARDED
1668 #if defined(HAS_VSNPRINTF) && defined(HAS_C99_VARIADIC_MACROS) && !(defined(DEBUGGING) && !defined(PERL_USE_GCC_BRACE_GROUPS)) && !defined(PERL_GCC_PEDANTIC)
1669 # ifdef PERL_USE_GCC_BRACE_GROUPS
1670 # define my_vsnprintf(buffer, len, ...) ({ int __len__ = vsnprintf(buffer, len, __VA_ARGS__); if ((len) > 0 && (Size_t)__len__ >= (len)) Perl_croak_nocontext("panic: vsnprintf buffer overflow"); __len__; })
1671 # define PERL_MY_VSNPRINTF_GUARDED
1673 # define my_vsnprintf(buffer, len, ...) vsnprintf(buffer, len, __VA_ARGS__)
1676 # define my_vsnprintf Perl_my_vsnprintf
1677 # define PERL_MY_VSNPRINTF_GUARDED
1681 # define my_strlcat strlcat
1683 # define my_strlcat Perl_my_strlcat
1687 # define my_strlcpy strlcpy
1689 # define my_strlcpy Perl_my_strlcpy
1692 /* Configure gets this right but the UTS compiler gets it wrong.
1693 -- Hal Morris <hom00@utsglobal.com> */
1696 # define UVTYPE unsigned
1700 The IV type is supposed to be long enough to hold any integral
1702 --Andy Dougherty August 1996
1708 #if defined(USE_64_BIT_INT) && defined(HAS_QUAD)
1709 # if QUADKIND == QUAD_IS_INT64_T && defined(INT64_MAX)
1710 # define IV_MAX INT64_MAX
1711 # define IV_MIN INT64_MIN
1712 # define UV_MAX UINT64_MAX
1714 # define UINT64_MIN 0
1716 # define UV_MIN UINT64_MIN
1718 # define IV_MAX PERL_QUAD_MAX
1719 # define IV_MIN PERL_QUAD_MIN
1720 # define UV_MAX PERL_UQUAD_MAX
1721 # define UV_MIN PERL_UQUAD_MIN
1726 # if defined(INT32_MAX) && IVSIZE == 4
1727 # define IV_MAX INT32_MAX
1728 # define IV_MIN INT32_MIN
1729 # ifndef UINT32_MAX_BROKEN /* e.g. HP-UX with gcc messes this up */
1730 # define UV_MAX UINT32_MAX
1732 # define UV_MAX 4294967295U
1735 # define UINT32_MIN 0
1737 # define UV_MIN UINT32_MIN
1739 # define IV_MAX PERL_LONG_MAX
1740 # define IV_MIN PERL_LONG_MIN
1741 # define UV_MAX PERL_ULONG_MAX
1742 # define UV_MIN PERL_ULONG_MIN
1758 # undef PERL_NEED_MY_HTOLE64
1759 # undef PERL_NEED_MY_LETOH64
1760 # undef PERL_NEED_MY_HTOBE64
1761 # undef PERL_NEED_MY_BETOH64
1764 #if defined(uts) || defined(UTS)
1766 # define UV_MAX (4294967295u)
1769 #define IV_DIG (BIT_DIGITS(IVSIZE * 8))
1770 #define UV_DIG (BIT_DIGITS(UVSIZE * 8))
1772 #ifndef NO_PERL_PRESERVE_IVUV
1773 #define PERL_PRESERVE_IVUV /* We like our integers to stay integers. */
1777 * The macros INT2PTR and NUM2PTR are (despite their names)
1778 * bi-directional: they will convert int/float to or from pointers.
1779 * However the conversion to int/float are named explicitly:
1780 * PTR2IV, PTR2UV, PTR2NV.
1782 * For int conversions we do not need two casts if pointers are
1783 * the same size as IV and UV. Otherwise we need an explicit
1784 * cast (PTRV) to avoid compiler warnings.
1786 #if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
1788 # define INT2PTR(any,d) (any)(d)
1790 # if PTRSIZE == LONGSIZE
1791 # define PTRV unsigned long
1792 # define PTR2ul(p) (unsigned long)(p)
1794 # define PTRV unsigned
1799 # define INT2PTR(any,d) (any)(PTRV)(d)
1803 # define PTR2ul(p) INT2PTR(unsigned long,p)
1806 #define NUM2PTR(any,d) (any)(PTRV)(d)
1807 #define PTR2IV(p) INT2PTR(IV,p)
1808 #define PTR2UV(p) INT2PTR(UV,p)
1809 #define PTR2NV(p) NUM2PTR(NV,p)
1810 #define PTR2nat(p) (PTRV)(p) /* pointer to integer of PTRSIZE */
1812 /* According to strict ANSI C89 one cannot freely cast between
1813 * data pointers and function (code) pointers. There are at least
1814 * two ways around this. One (used below) is to do two casts,
1815 * first the other pointer to an (unsigned) integer, and then
1816 * the integer to the other pointer. The other way would be
1817 * to use unions to "overlay" the pointers. For an example of
1818 * the latter technique, see union dirpu in struct xpvio in sv.h.
1819 * The only feasible use is probably temporarily storing
1820 * function pointers in a data pointer (such as a void pointer). */
1822 #define DPTR2FPTR(t,p) ((t)PTR2nat(p)) /* data pointer to function pointer */
1823 #define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */
1825 #ifdef USE_LONG_DOUBLE
1826 # if defined(HAS_LONG_DOUBLE) && LONG_DOUBLESIZE == DOUBLESIZE
1827 # define LONG_DOUBLE_EQUALS_DOUBLE
1829 # if !(defined(HAS_LONG_DOUBLE) && (LONG_DOUBLESIZE > DOUBLESIZE))
1830 # undef USE_LONG_DOUBLE /* Ouch! */
1835 /* Use an overridden DBL_DIG */
1839 # define DBL_DIG OVR_DBL_DIG
1841 /* The following is all to get DBL_DIG, in order to pick a nice
1842 default value for printing floating point numbers in Gconvert
1843 (see config.h). (It also has other uses, such as figuring out if
1844 a given precision of printing can be done with a double instead of
1845 a long double - Allen).
1854 #define DBL_DIG 15 /* A guess that works lots of places */
1859 /* Use an overridden LDBL_DIG */
1863 # define LDBL_DIG OVR_LDBL_DIG
1865 /* The following is all to get LDBL_DIG, in order to pick a nice
1866 default value for printing floating point numbers in Gconvert.
1870 # include <limits.h>
1875 # ifndef HAS_LDBL_DIG
1876 # if LONG_DOUBLESIZE == 10
1877 # define LDBL_DIG 18 /* assume IEEE */
1879 # if LONG_DOUBLESIZE == 12
1880 # define LDBL_DIG 18 /* gcc? */
1882 # if LONG_DOUBLESIZE == 16
1883 # define LDBL_DIG 33 /* assume IEEE */
1885 # if LONG_DOUBLESIZE == DOUBLESIZE
1886 # define LDBL_DIG DBL_DIG /* bummer */
1895 * This is for making sure we have a good DBL_MAX value, if possible,
1896 * either for usage as NV_MAX or for usage in figuring out if we can
1897 * fit a given long double into a double, if bug-fixing makes it
1898 * necessary to do so. - Allen <allens@cpan.org>
1902 # include <limits.h>
1906 # if !(defined(DBL_MIN) && defined(DBL_MAX) && defined(I_LIMITS))
1907 # include <values.h>
1908 # if defined(MAXDOUBLE) && !defined(DBL_MAX)
1909 # define DBL_MAX MAXDOUBLE
1911 # if defined(MINDOUBLE) && !defined(DBL_MIN)
1912 # define DBL_MIN MINDOUBLE
1915 #endif /* defined(I_VALUES) */
1920 # include <ieeefp.h>
1923 #ifdef USE_LONG_DOUBLE
1925 # include <sunmath.h>
1927 # define NV_DIG LDBL_DIG
1928 # ifdef LDBL_MANT_DIG
1929 # define NV_MANT_DIG LDBL_MANT_DIG
1932 # define NV_MIN LDBL_MIN
1935 # define NV_MAX LDBL_MAX
1937 # ifdef LDBL_MIN_10_EXP
1938 # define NV_MIN_10_EXP LDBL_MIN_10_EXP
1940 # ifdef LDBL_MAX_10_EXP
1941 # define NV_MAX_10_EXP LDBL_MAX_10_EXP
1943 # ifdef LDBL_EPSILON
1944 # define NV_EPSILON LDBL_EPSILON
1947 # define NV_MAX LDBL_MAX
1948 /* Having LDBL_MAX doesn't necessarily mean that we have LDBL_MIN... -Allen */
1951 # define NV_MAX HUGE_VALL
1954 # define NV_MAX ((NV)HUGE_VAL)
1959 # define Perl_cos cosl
1960 # define Perl_sin sinl
1961 # define Perl_sqrt sqrtl
1962 # define Perl_exp expl
1963 # define Perl_log logl
1964 # define Perl_atan2 atan2l
1965 # define Perl_pow powl
1966 # define Perl_floor floorl
1967 # define Perl_ceil ceill
1968 # define Perl_fmod fmodl
1970 /* e.g. libsunmath doesn't have modfl and frexpl as of mid-March 2000 */
1972 # define Perl_modf(x,y) modfl(x,y)
1973 /* eg glibc 2.2 series seems to provide modfl on ppc and arm, but has no
1974 prototype in <math.h> */
1975 # ifndef HAS_MODFL_PROTO
1976 EXTERN_C long double modfl(long double, long double *);
1979 # if defined(HAS_AINTL) && defined(HAS_COPYSIGNL)
1980 extern long double Perl_my_modfl(long double x, long double *ip);
1981 # define Perl_modf(x,y) Perl_my_modfl(x,y)
1985 # define Perl_frexp(x,y) frexpl(x,y)
1987 # if defined(HAS_ILOGBL) && defined(HAS_SCALBNL)
1988 extern long double Perl_my_frexpl(long double x, int *e);
1989 # define Perl_frexp(x,y) Perl_my_frexpl(x,y)
1994 # define Perl_isnan(x) isnanl(x)
1999 # define Perl_isinf(x) !(finitel(x)||Perl_isnan(x))
2003 # define NV_DIG DBL_DIG
2004 # ifdef DBL_MANT_DIG
2005 # define NV_MANT_DIG DBL_MANT_DIG
2008 # define NV_MIN DBL_MIN
2011 # define NV_MAX DBL_MAX
2013 # ifdef DBL_MIN_10_EXP
2014 # define NV_MIN_10_EXP DBL_MIN_10_EXP
2016 # ifdef DBL_MAX_10_EXP
2017 # define NV_MAX_10_EXP DBL_MAX_10_EXP
2020 # define NV_EPSILON DBL_EPSILON
2022 # ifdef DBL_MAX /* XXX Does DBL_MAX imply having DBL_MIN? */
2023 # define NV_MAX DBL_MAX
2024 # define NV_MIN DBL_MIN
2027 # define NV_MAX HUGE_VAL
2030 # define Perl_cos cos
2031 # define Perl_sin sin
2032 # define Perl_sqrt sqrt
2033 # define Perl_exp exp
2034 # define Perl_log log
2035 # define Perl_atan2 atan2
2036 # define Perl_pow pow
2037 # define Perl_floor floor
2038 # define Perl_ceil ceil
2039 # define Perl_fmod fmod
2040 # define Perl_modf(x,y) modf(x,y)
2041 # define Perl_frexp(x,y) frexp(x,y)
2044 /* rumor has it that Win32 has _fpclass() */
2046 /* SGI has fpclassl... but not with the same result values,
2047 * and it's via a typedef (not via #define), so will need to redo Configure
2048 * to use. Not worth the trouble, IMO, at least until the below is used
2049 * more places. Also has fp_class_l, BTW, via fp_class.h. Feel free to check
2050 * with me for the SGI manpages, SGI testing, etcetera, if you want to
2051 * try getting this to work with IRIX. - Allen <allens@cpan.org> */
2053 #if !defined(Perl_fp_class) && (defined(HAS_FPCLASS)||defined(HAS_FPCLASSL))
2055 # include <ieeefp.h>
2060 # if defined(USE_LONG_DOUBLE) && defined(HAS_FPCLASSL)
2061 # define Perl_fp_class() fpclassl(x)
2063 # define Perl_fp_class() fpclass(x)
2065 # define Perl_fp_class_snan(x) (Perl_fp_class(x)==FP_CLASS_SNAN)
2066 # define Perl_fp_class_qnan(x) (Perl_fp_class(x)==FP_CLASS_QNAN)
2067 # define Perl_fp_class_nan(x) (Perl_fp_class(x)==FP_CLASS_SNAN||Perl_fp_class(x)==FP_CLASS_QNAN)
2068 # define Perl_fp_class_ninf(x) (Perl_fp_class(x)==FP_CLASS_NINF)
2069 # define Perl_fp_class_pinf(x) (Perl_fp_class(x)==FP_CLASS_PINF)
2070 # define Perl_fp_class_inf(x) (Perl_fp_class(x)==FP_CLASS_NINF||Perl_fp_class(x)==FP_CLASS_PINF)
2071 # define Perl_fp_class_nnorm(x) (Perl_fp_class(x)==FP_CLASS_NNORM)
2072 # define Perl_fp_class_pnorm(x) (Perl_fp_class(x)==FP_CLASS_PNORM)
2073 # define Perl_fp_class_norm(x) (Perl_fp_class(x)==FP_CLASS_NNORM||Perl_fp_class(x)==FP_CLASS_PNORM)
2074 # define Perl_fp_class_ndenorm(x) (Perl_fp_class(x)==FP_CLASS_NDENORM)
2075 # define Perl_fp_class_pdenorm(x) (Perl_fp_class(x)==FP_CLASS_PDENORM)
2076 # define Perl_fp_class_denorm(x) (Perl_fp_class(x)==FP_CLASS_NDENORM||Perl_fp_class(x)==FP_CLASS_PDENORM)
2077 # define Perl_fp_class_nzero(x) (Perl_fp_class(x)==FP_CLASS_NZERO)
2078 # define Perl_fp_class_pzero(x) (Perl_fp_class(x)==FP_CLASS_PZERO)
2079 # define Perl_fp_class_zero(x) (Perl_fp_class(x)==FP_CLASS_NZERO||Perl_fp_class(x)==FP_CLASS_PZERO)
2082 #if !defined(Perl_fp_class) && defined(HAS_FP_CLASS) && !defined(PERL_MICRO)
2084 # if !defined(FP_SNAN) && defined(I_FP_CLASS)
2085 # include <fp_class.h>
2087 # define Perl_fp_class(x) fp_class(x)
2088 # define Perl_fp_class_snan(x) (fp_class(x)==FP_SNAN)
2089 # define Perl_fp_class_qnan(x) (fp_class(x)==FP_QNAN)
2090 # define Perl_fp_class_nan(x) (fp_class(x)==FP_SNAN||fp_class(x)==FP_QNAN)
2091 # define Perl_fp_class_ninf(x) (fp_class(x)==FP_NEG_INF)
2092 # define Perl_fp_class_pinf(x) (fp_class(x)==FP_POS_INF)
2093 # define Perl_fp_class_inf(x) (fp_class(x)==FP_NEG_INF||fp_class(x)==FP_POS_INF)
2094 # define Perl_fp_class_nnorm(x) (fp_class(x)==FP_NEG_NORM)
2095 # define Perl_fp_class_pnorm(x) (fp_class(x)==FP_POS_NORM)
2096 # define Perl_fp_class_norm(x) (fp_class(x)==FP_NEG_NORM||fp_class(x)==FP_POS_NORM)
2097 # define Perl_fp_class_ndenorm(x) (fp_class(x)==FP_NEG_DENORM)
2098 # define Perl_fp_class_pdenorm(x) (fp_class(x)==FP_POS_DENORM)
2099 # define Perl_fp_class_denorm(x) (fp_class(x)==FP_NEG_DENORM||fp_class(x)==FP_POS_DENORM)
2100 # define Perl_fp_class_nzero(x) (fp_class(x)==FP_NEG_ZERO)
2101 # define Perl_fp_class_pzero(x) (fp_class(x)==FP_POS_ZERO)
2102 # define Perl_fp_class_zero(x) (fp_class(x)==FP_NEG_ZERO||fp_class(x)==FP_POS_ZERO)
2105 #if !defined(Perl_fp_class) && defined(HAS_FPCLASSIFY)
2107 # define Perl_fp_class(x) fpclassify(x)
2108 # define Perl_fp_class_nan(x) (fp_classify(x)==FP_SNAN||fp_classify(x)==FP_QNAN)
2109 # define Perl_fp_class_inf(x) (fp_classify(x)==FP_INFINITE)
2110 # define Perl_fp_class_norm(x) (fp_classify(x)==FP_NORMAL)
2111 # define Perl_fp_class_denorm(x) (fp_classify(x)==FP_SUBNORMAL)
2112 # define Perl_fp_class_zero(x) (fp_classify(x)==FP_ZERO)
2115 #if !defined(Perl_fp_class) && defined(HAS_CLASS)
2118 # define Perl_fp_class(x) class(x)
2120 # define Perl_fp_class(x) _class(x)
2122 # define Perl_fp_class_snan(x) (Perl_fp_class(x)==FP_NANS)
2123 # define Perl_fp_class_qnan(x) (Perl_fp_class(x)==FP_NANQ)
2124 # define Perl_fp_class_nan(x) (Perl_fp_class(x)==FP_SNAN||Perl_fp_class(x)==FP_QNAN)
2125 # define Perl_fp_class_ninf(x) (Perl_fp_class(x)==FP_MINUS_INF)
2126 # define Perl_fp_class_pinf(x) (Perl_fp_class(x)==FP_PLUS_INF)
2127 # define Perl_fp_class_inf(x) (Perl_fp_class(x)==FP_MINUS_INF||Perl_fp_class(x)==FP_PLUS_INF)
2128 # define Perl_fp_class_nnorm(x) (Perl_fp_class(x)==FP_MINUS_NORM)
2129 # define Perl_fp_class_pnorm(x) (Perl_fp_class(x)==FP_PLUS_NORM)
2130 # define Perl_fp_class_norm(x) (Perl_fp_class(x)==FP_MINUS_NORM||Perl_fp_class(x)==FP_PLUS_NORM)
2131 # define Perl_fp_class_ndenorm(x) (Perl_fp_class(x)==FP_MINUS_DENORM)
2132 # define Perl_fp_class_pdenorm(x) (Perl_fp_class(x)==FP_PLUS_DENORM)
2133 # define Perl_fp_class_denorm(x) (Perl_fp_class(x)==FP_MINUS_DENORM||Perl_fp_class(x)==FP_PLUS_DENORM)
2134 # define Perl_fp_class_nzero(x) (Perl_fp_class(x)==FP_MINUS_ZERO)
2135 # define Perl_fp_class_pzero(x) (Perl_fp_class(x)==FP_PLUS_ZERO)
2136 # define Perl_fp_class_zero(x) (Perl_fp_class(x)==FP_MINUS_ZERO||Perl_fp_class(x)==FP_PLUS_ZERO)
2139 /* rumor has it that Win32 has _isnan() */
2143 # define Perl_isnan(x) isnan((NV)x)
2145 # ifdef Perl_fp_class_nan
2146 # define Perl_isnan(x) Perl_fp_class_nan(x)
2148 # ifdef HAS_UNORDERED
2149 # define Perl_isnan(x) unordered((x), 0.0)
2151 # define Perl_isnan(x) ((x)!=(x))
2158 int isnan(double d);
2163 # define Perl_isinf(x) isinf((NV)x)
2165 # ifdef Perl_fp_class_inf
2166 # define Perl_isinf(x) Perl_fp_class_inf(x)
2168 # define Perl_isinf(x) ((x)==NV_INF)
2173 #ifndef Perl_isfinite
2175 # define Perl_isfinite(x) finite((NV)x)
2177 # ifdef HAS_ISFINITE
2178 # define Perl_isfinite(x) isfinite(x)
2180 # ifdef Perl_fp_class_finite
2181 # define Perl_isfinite(x) Perl_fp_class_finite(x)
2183 # define Perl_isfinite(x) !(Perl_is_inf(x)||Perl_is_nan(x))
2189 /* The default is to use Perl's own atof() implementation (in numeric.c).
2190 * Usually that is the one to use but for some platforms (e.g. UNICOS)
2191 * it is however best to use the native implementation of atof.
2192 * You can experiment with using your native one by -DUSE_PERL_ATOF=0.
2193 * Some good tests to try out with either setting are t/base/num.t,
2194 * t/op/numconvert.t, and t/op/pack.t. Note that if using long doubles
2195 * you may need to be using a different function than atof! */
2197 #ifndef USE_PERL_ATOF
2199 # define USE_PERL_ATOF
2202 # if USE_PERL_ATOF == 0
2203 # undef USE_PERL_ATOF
2207 #ifdef USE_PERL_ATOF
2208 # define Perl_atof(s) Perl_my_atof(s)
2209 # define Perl_atof2(s, n) Perl_my_atof2(aTHX_ (s), &(n))
2211 # define Perl_atof(s) (NV)atof(s)
2212 # define Perl_atof2(s, n) ((n) = atof(s))
2215 /* Previously these definitions used hardcoded figures.
2216 * It is hoped these formula are more portable, although
2217 * no data one way or another is presently known to me.
2218 * The "PERL_" names are used because these calculated constants
2219 * do not meet the ANSI requirements for LONG_MAX, etc., which
2220 * need to be constants acceptable to #if - kja
2221 * define PERL_LONG_MAX 2147483647L
2222 * define PERL_LONG_MIN (-LONG_MAX - 1)
2223 * define PERL ULONG_MAX 4294967295L
2226 #ifdef I_LIMITS /* Needed for cast_xxx() functions below. */
2227 # include <limits.h>
2229 /* Included values.h above if necessary; still including limits.h down here,
2230 * despite doing above, because math.h might have overriden... XXX - Allen */
2233 * Try to figure out max and min values for the integral types. THE CORRECT
2234 * SOLUTION TO THIS MESS: ADAPT enquire.c FROM GCC INTO CONFIGURE. The
2235 * following hacks are used if neither limits.h or values.h provide them:
2236 * U<TYPE>_MAX: for types >= int: ~(unsigned TYPE)0
2237 * for types < int: (unsigned TYPE)~(unsigned)0
2238 * The argument to ~ must be unsigned so that later signed->unsigned
2239 * conversion can't modify the value's bit pattern (e.g. -0 -> +0),
2240 * and it must not be smaller than int because ~ does integral promotion.
2241 * <type>_MAX: (<type>) (U<type>_MAX >> 1)
2242 * <type>_MIN: -<type>_MAX - <is_twos_complement_architecture: (3 & -1) == 3>.
2243 * The latter is a hack which happens to work on some machines but
2244 * does *not* catch any random system, or things like integer types
2245 * with NaN if that is possible.
2247 * All of the types are explicitly cast to prevent accidental loss of
2248 * numeric range, and in the hope that they will be less likely to confuse
2249 * over-eager optimizers.
2253 #define PERL_UCHAR_MIN ((unsigned char)0)
2256 # define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
2259 # define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
2261 # define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
2266 * CHAR_MIN and CHAR_MAX are not included here, as the (char) type may be
2267 * ambiguous. It may be equivalent to (signed char) or (unsigned char)
2268 * depending on local options. Until Configure detects this (or at least
2269 * detects whether the "signed" keyword is available) the CHAR ranges
2270 * will not be included. UCHAR functions normally.
2274 #define PERL_USHORT_MIN ((unsigned short)0)
2277 # define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
2280 # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
2283 # define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)
2285 # define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
2291 # define PERL_SHORT_MAX ((short)SHORT_MAX)
2293 # ifdef MAXSHORT /* Often used in <values.h> */
2294 # define PERL_SHORT_MAX ((short)MAXSHORT)
2297 # define PERL_SHORT_MAX ((short)SHRT_MAX)
2299 # define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
2305 # define PERL_SHORT_MIN ((short)SHORT_MIN)
2308 # define PERL_SHORT_MIN ((short)MINSHORT)
2311 # define PERL_SHORT_MIN ((short)SHRT_MIN)
2313 # define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
2319 # define PERL_UINT_MAX ((unsigned int)UINT_MAX)
2322 # define PERL_UINT_MAX ((unsigned int)MAXUINT)
2324 # define PERL_UINT_MAX (~(unsigned int)0)
2328 #define PERL_UINT_MIN ((unsigned int)0)
2331 # define PERL_INT_MAX ((int)INT_MAX)
2333 # ifdef MAXINT /* Often used in <values.h> */
2334 # define PERL_INT_MAX ((int)MAXINT)
2336 # define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
2341 # define PERL_INT_MIN ((int)INT_MIN)
2344 # define PERL_INT_MIN ((int)MININT)
2346 # define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
2351 # define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
2354 # define PERL_ULONG_MAX ((unsigned long)MAXULONG)
2356 # define PERL_ULONG_MAX (~(unsigned long)0)
2360 #define PERL_ULONG_MIN ((unsigned long)0L)
2363 # define PERL_LONG_MAX ((long)LONG_MAX)
2365 # ifdef MAXLONG /* Often used in <values.h> */
2366 # define PERL_LONG_MAX ((long)MAXLONG)
2368 # define PERL_LONG_MAX ((long) (PERL_ULONG_MAX >> 1))
2373 # define PERL_LONG_MIN ((long)LONG_MIN)
2376 # define PERL_LONG_MIN ((long)MINLONG)
2378 # define PERL_LONG_MIN (-PERL_LONG_MAX - ((3 & -1) == 3))
2384 # define PERL_UQUAD_MAX (~(UV)0)
2385 # define PERL_UQUAD_MIN ((UV)0)
2386 # define PERL_QUAD_MAX ((IV) (PERL_UQUAD_MAX >> 1))
2387 # define PERL_QUAD_MIN (-PERL_QUAD_MAX - ((3 & -1) == 3))
2391 struct RExC_state_t;
2392 struct _reg_trie_data;
2394 typedef MEM_SIZE STRLEN;
2397 typedef struct token TOKEN;
2398 typedef struct madprop MADPROP;
2399 typedef struct nexttoken NEXTTOKE;
2401 typedef struct op OP;
2402 typedef struct cop COP;
2403 typedef struct unop UNOP;
2404 typedef struct binop BINOP;
2405 typedef struct listop LISTOP;
2406 typedef struct logop LOGOP;
2407 typedef struct pmop PMOP;
2408 typedef struct svop SVOP;
2409 typedef struct padop PADOP;
2410 typedef struct pvop PVOP;
2411 typedef struct loop LOOP;
2413 typedef struct block_hooks BHK;
2414 typedef struct custom_op XOP;
2416 typedef struct interpreter PerlInterpreter;
2418 /* Amdahl's <ksync.h> has struct sv */
2419 /* SGI's <sys/sema.h> has struct sv */
2420 #if defined(UTS) || defined(__sgi)
2421 # define STRUCT_SV perl_sv
2423 # define STRUCT_SV sv
2425 typedef struct STRUCT_SV SV;
2426 typedef struct av AV;
2427 typedef struct hv HV;
2428 typedef struct cv CV;
2429 typedef struct regexp ORANGE; /* This is the body structure. */
2430 typedef struct p5rx REGEXP;
2431 typedef struct gp GP;
2432 typedef struct gv GV;
2433 typedef struct io IO;
2434 typedef struct context PERL_CONTEXT;
2435 typedef struct block BLOCK;
2437 typedef struct magic MAGIC;
2438 typedef struct xpv XPV;
2439 typedef struct xpviv XPVIV;
2440 typedef struct xpvuv XPVUV;
2441 typedef struct xpvnv XPVNV;
2442 typedef struct xpvmg XPVMG;
2443 typedef struct xpvlv XPVLV;
2444 typedef struct xpvav XPVAV;
2445 typedef struct xpvhv XPVHV;
2446 typedef struct xpvgv XPVGV;
2447 typedef struct xpvcv XPVCV;
2448 typedef struct xpvbm XPVBM;
2449 typedef struct xpvfm XPVFM;
2450 typedef struct xpvio XPVIO;
2451 typedef struct mgvtbl MGVTBL;
2452 typedef union any ANY;
2453 typedef struct ptr_tbl_ent PTR_TBL_ENT_t;
2454 typedef struct ptr_tbl PTR_TBL_t;
2455 typedef struct clone_params CLONE_PARAMS;
2459 #if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_RAWIO)
2460 # if LSEEKSIZE == 8 && !defined(USE_64_BIT_RAWIO)
2461 # define USE_64_BIT_RAWIO /* implicit */
2465 /* Notice the use of HAS_FSEEKO: now we are obligated to always use
2466 * fseeko/ftello if possible. Don't go #defining ftell to ftello yourself,
2467 * however, because operating systems like to do that themself. */
2470 # define FSEEKSIZE LSEEKSIZE
2472 # define FSEEKSIZE LONGSIZE
2476 #if defined(USE_LARGE_FILES) && !defined(NO_64_BIT_STDIO)
2477 # if FSEEKSIZE == 8 && !defined(USE_64_BIT_STDIO)
2478 # define USE_64_BIT_STDIO /* implicit */
2482 #ifdef USE_64_BIT_RAWIO
2485 # define Off_t off64_t
2487 # define LSEEKSIZE 8
2489 /* Most 64-bit environments have defines like _LARGEFILE_SOURCE that
2490 * will trigger defines like the ones below. Some 64-bit environments,
2491 * however, do not. Therefore we have to explicitly mix and match. */
2492 # if defined(USE_OPEN64)
2493 # define open open64
2495 # if defined(USE_LSEEK64)
2496 # define lseek lseek64
2498 # if defined(USE_LLSEEK)
2499 # define lseek llseek
2502 # if defined(USE_STAT64)
2503 # define stat stat64
2505 # if defined(USE_FSTAT64)
2506 # define fstat fstat64
2508 # if defined(USE_LSTAT64)
2509 # define lstat lstat64
2511 # if defined(USE_FLOCK64)
2512 # define flock flock64
2514 # if defined(USE_LOCKF64)
2515 # define lockf lockf64
2517 # if defined(USE_FCNTL64)
2518 # define fcntl fcntl64
2520 # if defined(USE_TRUNCATE64)
2521 # define truncate truncate64
2523 # if defined(USE_FTRUNCATE64)
2524 # define ftruncate ftruncate64
2528 #ifdef USE_64_BIT_STDIO
2529 # ifdef HAS_FPOS64_T
2531 # define Fpos_t fpos64_t
2533 /* Most 64-bit environments have defines like _LARGEFILE_SOURCE that
2534 * will trigger defines like the ones below. Some 64-bit environments,
2535 * however, do not. */
2536 # if defined(USE_FOPEN64)
2537 # define fopen fopen64
2539 # if defined(USE_FSEEK64)
2540 # define fseek fseek64 /* don't do fseeko here, see perlio.c */
2542 # if defined(USE_FTELL64)
2543 # define ftell ftell64 /* don't do ftello here, see perlio.c */
2545 # if defined(USE_FSETPOS64)
2546 # define fsetpos fsetpos64
2548 # if defined(USE_FGETPOS64)
2549 # define fgetpos fgetpos64
2551 # if defined(USE_TMPFILE64)
2552 # define tmpfile tmpfile64
2554 # if defined(USE_FREOPEN64)
2555 # define freopen freopen64
2560 # include "iperlsys.h"
2563 #if defined(__OPEN_VM)
2564 # include "vmesa/vmesaish.h"
2565 # define ISHISH "vmesa"
2570 # include "os2ish.h"
2572 # include "dosish.h"
2574 # define ISHISH "dos"
2578 # include "vmsish.h"
2582 # define op_getmad(arg,pegop,slot) NOOP
2584 # define ISHISH "vms"
2588 # include "./plan9/plan9ish.h"
2589 # define ISHISH "plan9"
2593 # include "mpeix/mpeixish.h"
2594 # define ISHISH "mpeix"
2597 #if defined(__VOS__)
2599 # include "./vos/vosish.h"
2601 # include "vos/vosish.h"
2603 # define ISHISH "vos"
2607 # include "epocish.h"
2608 # define ISHISH "epoc"
2611 #ifdef __SYMBIAN32__
2612 # include "symbian/symbianish.h"
2616 # define op_getmad(arg,pegop,slot) NOOP
2618 # define ISHISH "symbian"
2622 #if defined(__HAIKU__)
2623 # include "haiku/haikuish.h"
2624 # define ISHISH "haiku"
2625 #elif defined(__BEOS__)
2626 # include "beos/beosish.h"
2627 # define ISHISH "beos"
2631 # include "unixish.h"
2632 # define ISHISH "unix"
2635 /* NSIG logic from Configure --> */
2636 /* Strange style to avoid deeply-nested #if/#else/#endif */
2639 # define NSIG (_NSIG)
2645 # define NSIG (SIGMAX+1)
2651 # define NSIG (SIG_MAX+1)
2657 # define NSIG (_SIG_MAX+1)
2663 # define NSIG (MAXSIG+1)
2669 # define NSIG (MAX_SIG+1)
2674 # ifdef SIGARRAYSIZE
2675 # define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
2681 # define NSIG (_sys_nsig) /* Solaris 2.5 */
2685 /* Default to some arbitrary number that's big enough to get most
2686 of the common signals.
2691 /* <-- NSIG logic from Configure */
2693 #ifndef NO_ENVIRON_ARRAY
2694 # define USE_ENVIRON_ARRAY
2698 * initialise to avoid floating-point exceptions from overflow, etc
2700 #ifndef PERL_FPU_INIT
2701 # ifdef HAS_FPSETMASK
2702 # if HAS_FLOATINGPOINT_H
2703 # include <floatingpoint.h>
2705 /* Some operating systems have this as a macro, which in turn expands to a comma
2706 expression, and the last sub-expression is something that gets calculated,
2707 and then they have the gall to warn that a value computed is not used. Hence
2709 # define PERL_FPU_INIT (void)fpsetmask(0)
2711 # if defined(SIGFPE) && defined(SIG_IGN) && !defined(PERL_MICRO)
2712 # define PERL_FPU_INIT PL_sigfpe_saved = (Sighandler_t) signal(SIGFPE, SIG_IGN)
2713 # define PERL_FPU_PRE_EXEC { Sigsave_t xfpe; rsignal_save(SIGFPE, PL_sigfpe_saved, &xfpe);
2714 # define PERL_FPU_POST_EXEC rsignal_restore(SIGFPE, &xfpe); }
2716 # define PERL_FPU_INIT
2721 #ifndef PERL_FPU_PRE_EXEC
2722 # define PERL_FPU_PRE_EXEC {
2723 # define PERL_FPU_POST_EXEC }
2726 #ifndef PERL_SYS_INIT3_BODY
2727 # define PERL_SYS_INIT3_BODY(argvp,argcp,envp) PERL_SYS_INIT_BODY(argvp,argcp)
2731 =for apidoc Am|void|PERL_SYS_INIT|int argc|char** argv
2732 Provides system-specific tune up of the C runtime environment necessary to
2733 run Perl interpreters. This should be called only once, before creating
2734 any Perl interpreters.
2736 =for apidoc Am|void|PERL_SYS_INIT3|int argc|char** argv|char** env
2737 Provides system-specific tune up of the C runtime environment necessary to
2738 run Perl interpreters. This should be called only once, before creating
2739 any Perl interpreters.
2741 =for apidoc Am|void|PERL_SYS_TERM|
2742 Provides system-specific clean up of the C runtime environment after
2743 running Perl interpreters. This should be called only once, after
2744 freeing any remaining Perl interpreters.
2749 #define PERL_SYS_INIT(argc, argv) Perl_sys_init(argc, argv)
2750 #define PERL_SYS_INIT3(argc, argv, env) Perl_sys_init3(argc, argv, env)
2751 #define PERL_SYS_TERM() Perl_sys_term()
2753 #ifndef PERL_WRITE_MSG_TO_CONSOLE
2754 # define PERL_WRITE_MSG_TO_CONSOLE(io, msg, len) PerlIO_write(io, msg, len)
2759 # ifdef _POSIX_PATH_MAX
2760 # if PATH_MAX > _POSIX_PATH_MAX
2761 /* POSIX 1990 (and pre) was ambiguous about whether PATH_MAX
2762 * included the null byte or not. Later amendments of POSIX,
2763 * XPG4, the Austin Group, and the Single UNIX Specification
2764 * all explicitly include the null byte in the PATH_MAX.
2765 * Ditto for _POSIX_PATH_MAX. */
2766 # define MAXPATHLEN PATH_MAX
2768 # define MAXPATHLEN _POSIX_PATH_MAX
2771 # define MAXPATHLEN (PATH_MAX+1)
2774 # ifdef _POSIX_PATH_MAX
2775 # define MAXPATHLEN _POSIX_PATH_MAX
2777 # define MAXPATHLEN 1024 /* Err on the large side. */
2782 /* In case Configure was not used (we are using a "canned config"
2783 * such as Win32, or a cross-compilation setup, for example) try going
2784 * by the gcc major and minor versions. One useful URL is
2785 * http://www.ohse.de/uwe/articles/gcc-attributes.html,
2786 * but contrary to this information warn_unused_result seems
2787 * not to be in gcc 3.3.5, at least. --jhi
2788 * Also, when building extensions with an installed perl, this allows
2789 * the user to upgrade gcc and get the right attributes, rather than
2790 * relying on the list generated at Configure time. --AD
2791 * Set these up now otherwise we get confused when some of the <*thread.h>
2792 * includes below indirectly pull in <perlio.h> (which needs to know if we
2793 * have HASATTRIBUTE_FORMAT).
2797 #if defined __GNUC__ && !defined(__INTEL_COMPILER)
2798 # if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3 /* 3.1 -> */
2799 # define HASATTRIBUTE_DEPRECATED
2801 # if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */
2802 # define HASATTRIBUTE_FORMAT
2803 # if defined __MINGW32__
2804 # define PRINTF_FORMAT_NULL_OK
2807 # if __GNUC__ >= 3 /* 3.0 -> */
2808 # define HASATTRIBUTE_MALLOC
2810 # if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */
2811 # define HASATTRIBUTE_NONNULL
2813 # if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */
2814 # define HASATTRIBUTE_NORETURN
2816 # if __GNUC__ >= 3 /* gcc 3.0 -> */
2817 # define HASATTRIBUTE_PURE
2819 # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
2820 # define HASATTRIBUTE_UNUSED
2822 # if __GNUC__ == 3 && __GNUC_MINOR__ == 3 && !defined(__cplusplus)
2823 # define HASATTRIBUTE_UNUSED /* gcc-3.3, but not g++-3.3. */
2825 # if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
2826 # define HASATTRIBUTE_WARN_UNUSED_RESULT
2829 #endif /* #ifndef PERL_MICRO */
2831 /* USE_5005THREADS needs to be after unixish.h as <pthread.h> includes
2832 * <sys/signal.h> which defines NSIG - which will stop inclusion of <signal.h>
2833 * this results in many functions being undeclared which bothers C++
2834 * May make sense to have threads after "*ish.h" anyway
2837 #if defined(USE_ITHREADS)
2839 # include <nw5thread.h>
2841 # ifdef FAKE_THREADS
2842 # include "fakethr.h"
2845 # include <win32thread.h>
2848 # include "os2thread.h"
2850 # ifdef I_MACH_CTHREADS
2851 # include <mach/cthreads.h>
2852 # if (defined(NeXT) || defined(__NeXT__)) && defined(PERL_POLLUTE_MALLOC)
2853 # define MUTEX_INIT_CALLS_MALLOC
2855 typedef cthread_t perl_os_thread;
2856 typedef mutex_t perl_mutex;
2857 typedef condition_t perl_cond;
2858 typedef void * perl_key;
2859 # else /* Posix threads */
2861 # include <pthread.h>
2863 typedef pthread_t perl_os_thread;
2864 typedef pthread_mutex_t perl_mutex;
2865 typedef pthread_cond_t perl_cond;
2866 typedef pthread_key_t perl_key;
2867 # endif /* I_MACH_CTHREADS */
2870 # endif /* FAKE_THREADS */
2871 #endif /* NETWARE */
2872 #endif /* USE_ITHREADS */
2879 # include "netware.h"
2882 #define STATUS_UNIX PL_statusvalue
2884 # define STATUS_NATIVE PL_statusvalue_vms
2886 * vaxc$errno is only guaranteed to be valid if errno == EVMSERR, otherwise
2887 * its contents can not be trusted. Unfortunately, Perl seems to check
2888 * it on exit, so it when PL_statusvalue_vms is updated, vaxc$errno should
2891 # include <stsdef.h>
2893 /* Presume this because if VMS changes it, it will require a new
2894 * set of APIs for waiting on children for binary compatibility.
2896 # define child_offset_bits (8)
2897 # ifndef C_FAC_POSIX
2898 # define C_FAC_POSIX 0x35A000
2901 /* STATUS_EXIT - validates and returns a NATIVE exit status code for the
2902 * platform from the existing UNIX or Native status values.
2905 # define STATUS_EXIT \
2906 (((I32)PL_statusvalue_vms == -1 ? SS$_ABORT : PL_statusvalue_vms) | \
2907 (VMSISH_HUSHED ? STS$M_INHIB_MSG : 0))
2910 /* STATUS_NATIVE_CHILD_SET - Calculate UNIX status that matches the child
2911 * exit code and shifts the UNIX value over the correct number of bits to
2912 * be a child status. Usually the number of bits is 8, but that could be
2913 * platform dependent. The NATIVE status code is presumed to have either
2914 * from a child process.
2917 /* This is complicated. The child processes return a true native VMS
2918 status which must be saved. But there is an assumption in Perl that
2919 the UNIX child status has some relationship to errno values, so
2920 Perl tries to translate it to text in some of the tests.
2921 In order to get the string translation correct, for the error, errno
2922 must be EVMSERR, but that generates a different text message
2923 than what the test programs are expecting. So an errno value must
2924 be derived from the native status value when an error occurs.
2925 That will hide the true native status message. With this version of
2926 perl, the true native child status can always be retrieved so that
2927 is not a problem. But in this case, Pl_statusvalue and errno may
2928 have different values in them.
2931 # define STATUS_NATIVE_CHILD_SET(n) \
2933 I32 evalue = (I32)n; \
2934 if (evalue == EVMSERR) { \
2935 PL_statusvalue_vms = vaxc$errno; \
2936 PL_statusvalue = evalue; \
2938 PL_statusvalue_vms = evalue; \
2939 if (evalue == -1) { \
2940 PL_statusvalue = -1; \
2941 PL_statusvalue_vms = SS$_ABORT; /* Should not happen */ \
2943 PL_statusvalue = Perl_vms_status_to_unix(evalue, 1); \
2944 set_vaxc_errno(evalue); \
2945 if ((PL_statusvalue_vms & C_FAC_POSIX) == C_FAC_POSIX) \
2946 set_errno(EVMSERR); \
2947 else set_errno(Perl_vms_status_to_unix(evalue, 0)); \
2948 PL_statusvalue = PL_statusvalue << child_offset_bits; \
2952 # ifdef VMSISH_STATUS
2953 # define STATUS_CURRENT (VMSISH_STATUS ? STATUS_NATIVE : STATUS_UNIX)
2955 # define STATUS_CURRENT STATUS_UNIX
2958 /* STATUS_UNIX_SET - takes a UNIX/POSIX errno value and attempts to update
2959 * the NATIVE status to an equivalent value. Can not be used to translate
2960 * exit code values as exit code values are not guaranteed to have any
2961 * relationship at all to errno values.
2962 * This is used when Perl is forcing errno to have a specific value.
2964 # define STATUS_UNIX_SET(n) \
2966 I32 evalue = (I32)n; \
2967 PL_statusvalue = evalue; \
2968 if (PL_statusvalue != -1) { \
2969 if (PL_statusvalue != EVMSERR) { \
2970 PL_statusvalue &= 0xFFFF; \
2971 if (MY_POSIX_EXIT) \
2972 PL_statusvalue_vms=PL_statusvalue ? SS$_ABORT : SS$_NORMAL;\
2973 else PL_statusvalue_vms = Perl_unix_status_to_vms(evalue); \
2976 PL_statusvalue_vms = vaxc$errno; \
2979 else PL_statusvalue_vms = SS$_ABORT; \
2980 set_vaxc_errno(PL_statusvalue_vms); \
2983 /* STATUS_UNIX_EXIT_SET - Takes a UNIX/POSIX exit code and sets
2984 * the NATIVE error status based on it.
2986 * When in the default mode to comply with the Perl VMS documentation,
2987 * 0 is a success and any other code sets the NATIVE status to a failure
2988 * code of SS$_ABORT.
2990 * In the new POSIX EXIT mode, native status will be set so that the
2991 * actual exit code will can be retrieved by the calling program or
2994 * If the exit code is not clearly a UNIX parent or child exit status,
2995 * it will be passed through as a VMS status.
2998 # define STATUS_UNIX_EXIT_SET(n) \
3000 I32 evalue = (I32)n; \
3001 PL_statusvalue = evalue; \
3002 if (MY_POSIX_EXIT) { \
3003 if (evalue <= 0xFF00) { \
3004 if (evalue > 0xFF) \
3005 evalue = (evalue >> child_offset_bits) & 0xFF; \
3006 PL_statusvalue_vms = \
3007 (C_FAC_POSIX | (evalue << 3 ) | \
3008 ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1)); \
3009 } else /* forgive them Perl, for they have sinned */ \
3010 PL_statusvalue_vms = evalue; \
3013 PL_statusvalue_vms = SS$_NORMAL; \
3014 else if (evalue <= 0xFF00) \
3015 PL_statusvalue_vms = SS$_ABORT; \
3016 else { /* forgive them Perl, for they have sinned */ \
3017 if (evalue != EVMSERR) PL_statusvalue_vms = evalue; \
3018 else PL_statusvalue_vms = vaxc$errno; \
3019 /* And obviously used a VMS status value instead of UNIX */ \
3020 PL_statusvalue = EVMSERR; \
3022 set_vaxc_errno(PL_statusvalue_vms); \
3027 /* STATUS_EXIT_SET - Takes a NATIVE/UNIX/POSIX exit code
3028 * and sets the NATIVE error status based on it. This special case
3029 * is needed to maintain compatibility with past VMS behavior.
3031 * In the default mode on VMS, this number is passed through as
3032 * both the NATIVE and UNIX status. Which makes it different
3033 * that the STATUS_UNIX_EXIT_SET.
3035 * In the new POSIX EXIT mode, native status will be set so that the
3036 * actual exit code will can be retrieved by the calling program or
3039 * A POSIX exit code is from 0 to 255. If the exit code is higher
3040 * than this, it needs to be assumed that it is a VMS exit code and
3044 # define STATUS_EXIT_SET(n) \
3046 I32 evalue = (I32)n; \
3047 PL_statusvalue = evalue; \
3048 if (MY_POSIX_EXIT) \
3049 if (evalue > 255) PL_statusvalue_vms = evalue; else { \
3050 PL_statusvalue_vms = \
3051 (C_FAC_POSIX | (evalue << 3 ) | \
3052 ((evalue == 1) ? (STS$K_ERROR | STS$M_INHIB_MSG) : 1));} \
3054 PL_statusvalue_vms = evalue ? evalue : SS$_NORMAL; \
3055 set_vaxc_errno(PL_statusvalue_vms); \
3059 /* This macro forces a success status */
3060 # define STATUS_ALL_SUCCESS \
3061 (PL_statusvalue = 0, PL_statusvalue_vms = SS$_NORMAL)
3063 /* This macro forces a failure status */
3064 # define STATUS_ALL_FAILURE (PL_statusvalue = 1, \
3065 vaxc$errno = PL_statusvalue_vms = MY_POSIX_EXIT ? \
3066 (C_FAC_POSIX | (1 << 3) | STS$K_ERROR | STS$M_INHIB_MSG) : SS$_ABORT)
3069 # define STATUS_NATIVE PL_statusvalue_posix
3070 # if defined(WCOREDUMP)
3071 # define STATUS_NATIVE_CHILD_SET(n) \
3073 PL_statusvalue_posix = (n); \
3074 if (PL_statusvalue_posix == -1) \
3075 PL_statusvalue = -1; \
3078 (WIFEXITED(PL_statusvalue_posix) ? (WEXITSTATUS(PL_statusvalue_posix) << 8) : 0) | \
3079 (WIFSIGNALED(PL_statusvalue_posix) ? (WTERMSIG(PL_statusvalue_posix) & 0x7F) : 0) | \
3080 (WIFSIGNALED(PL_statusvalue_posix) && WCOREDUMP(PL_statusvalue_posix) ? 0x80 : 0); \
3083 # elif defined(WIFEXITED)
3084 # define STATUS_NATIVE_CHILD_SET(n) \
3086 PL_statusvalue_posix = (n); \
3087 if (PL_statusvalue_posix == -1) \
3088 PL_statusvalue = -1; \
3091 (WIFEXITED(PL_statusvalue_posix) ? (WEXITSTATUS(PL_statusvalue_posix) << 8) : 0) | \
3092 (WIFSIGNALED(PL_statusvalue_posix) ? (WTERMSIG(PL_statusvalue_posix) & 0x7F) : 0); \
3096 # define STATUS_NATIVE_CHILD_SET(n) \
3098 PL_statusvalue_posix = (n); \
3099 if (PL_statusvalue_posix == -1) \
3100 PL_statusvalue = -1; \
3103 PL_statusvalue_posix & 0xFFFF; \
3107 # define STATUS_UNIX_SET(n) \
3109 PL_statusvalue = (n); \
3110 if (PL_statusvalue != -1) \
3111 PL_statusvalue &= 0xFFFF; \
3113 # define STATUS_UNIX_EXIT_SET(n) STATUS_UNIX_SET(n)
3114 # define STATUS_EXIT_SET(n) STATUS_UNIX_SET(n)
3115 # define STATUS_CURRENT STATUS_UNIX
3116 # define STATUS_EXIT STATUS_UNIX
3117 # define STATUS_ALL_SUCCESS (PL_statusvalue = 0, PL_statusvalue_posix = 0)
3118 # define STATUS_ALL_FAILURE (PL_statusvalue = 1, PL_statusvalue_posix = 1)
3121 /* flags in PL_exit_flags for nature of exit() */
3122 #define PERL_EXIT_EXPECTED 0x01
3123 #define PERL_EXIT_DESTRUCT_END 0x02 /* Run END in perl_destruct */
3126 /* format to use for version numbers in file/directory names */
3127 /* XXX move to Configure? */
3128 /* This was only ever used for the current version, and that can be done at
3129 compile time, as PERL_FS_VERSION, so should we just delete it? */
3130 # ifndef PERL_FS_VER_FMT
3131 # define PERL_FS_VER_FMT "%d.%d.%d"
3135 #ifndef PERL_FS_VERSION
3136 # define PERL_FS_VERSION PERL_VERSION_STRING
3139 /* This defines a way to flush all output buffers. This may be a
3140 * performance issue, so we allow people to disable it. Also, if
3141 * we are using stdio, there are broken implementations of fflush(NULL)
3142 * out there, Solaris being the most prominent.
3144 #ifndef PERL_FLUSHALL_FOR_CHILD
3145 # if defined(USE_PERLIO) || defined(FFLUSH_NULL) || defined(USE_SFIO)
3146 # define PERL_FLUSHALL_FOR_CHILD PerlIO_flush((PerlIO*)NULL)
3149 # define PERL_FLUSHALL_FOR_CHILD my_fflush_all()
3151 # define PERL_FLUSHALL_FOR_CHILD NOOP
3156 #ifndef PERL_WAIT_FOR_CHILDREN
3157 # define PERL_WAIT_FOR_CHILDREN NOOP
3160 /* the traditional thread-unsafe notion of "current interpreter". */
3161 #ifndef PERL_SET_INTERP
3162 # define PERL_SET_INTERP(i) (PL_curinterp = (PerlInterpreter*)(i))
3165 #ifndef PERL_GET_INTERP
3166 # define PERL_GET_INTERP (PL_curinterp)
3169 #if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_GET_THX)
3170 # ifdef MULTIPLICITY
3171 # define PERL_GET_THX ((PerlInterpreter *)PERL_GET_CONTEXT)
3173 # define PERL_SET_THX(t) PERL_SET_CONTEXT(t)
3177 This replaces the previous %_ "hack" by the "%p" hacks.
3178 All that is required is that the perl source does not
3179 use "%-p" or "%-<number>p" or "%<number>p" formats.
3180 These formats will still work in perl code.
3181 See comments in sv.c for futher details.
3183 Robin Barker 2005-07-14
3185 No longer use %1p for VDf = %vd. RMB 2007-10-19
3189 # define SVf_(n) "-" STRINGIFY(n) "p"
3197 # define SVf32 SVf_(32)
3201 # define SVf256 SVf_(256)
3204 #define SVfARG(p) ((void*)(p))
3207 /* not used; but needed for backward compatibilty with XS code? - RMB */
3216 /* not used; but needed for backward compatibilty with XS code? - RMB */
3224 #ifdef HASATTRIBUTE_DEPRECATED
3225 # define __attribute__deprecated__ __attribute__((deprecated))
3227 #ifdef HASATTRIBUTE_FORMAT
3228 # define __attribute__format__(x,y,z) __attribute__((format(x,y,z)))
3230 #ifdef HASATTRIBUTE_MALLOC
3231 # define __attribute__malloc__ __attribute__((__malloc__))
3233 #ifdef HASATTRIBUTE_NONNULL
3234 # define __attribute__nonnull__(a) __attribute__((nonnull(a)))
3236 #ifdef HASATTRIBUTE_NORETURN
3237 # define __attribute__noreturn__ __attribute__((noreturn))
3239 #ifdef HASATTRIBUTE_PURE
3240 # define __attribute__pure__ __attribute__((pure))
3242 #ifdef HASATTRIBUTE_UNUSED
3243 # define __attribute__unused__ __attribute__((unused))
3245 #ifdef HASATTRIBUTE_WARN_UNUSED_RESULT
3246 # define __attribute__warn_unused_result__ __attribute__((warn_unused_result))
3249 /* If we haven't defined the attributes yet, define them to blank. */
3250 #ifndef __attribute__deprecated__
3251 # define __attribute__deprecated__
3253 #ifndef __attribute__format__
3254 # define __attribute__format__(x,y,z)
3256 #ifndef __attribute__malloc__
3257 # define __attribute__malloc__
3259 #ifndef __attribute__nonnull__
3260 # define __attribute__nonnull__(a)
3262 #ifndef __attribute__noreturn__
3263 # define __attribute__noreturn__
3265 #ifndef __attribute__pure__
3266 # define __attribute__pure__
3268 #ifndef __attribute__unused__
3269 # define __attribute__unused__
3271 #ifndef __attribute__warn_unused_result__
3272 # define __attribute__warn_unused_result__
3275 /* For functions that are marked as __attribute__noreturn__, it's not
3276 appropriate to call return. In either case, include the lint directive.
3278 #ifdef HASATTRIBUTE_NORETURN
3279 # define NORETURN_FUNCTION_END /* NOTREACHED */
3281 # define NORETURN_FUNCTION_END /* NOTREACHED */ return 0
3284 /* Some OS warn on NULL format to printf */
3285 #ifdef PRINTF_FORMAT_NULL_OK
3286 # define __attribute__format__null_ok__(x,y,z) __attribute__format__(x,y,z)
3288 # define __attribute__format__null_ok__(x,y,z)
3291 #ifdef HAS_BUILTIN_EXPECT
3292 # define EXPECT(expr,val) __builtin_expect(expr,val)
3294 # define EXPECT(expr,val) (expr)
3296 #define LIKELY(cond) EXPECT(cond,1)
3297 #define UNLIKELY(cond) EXPECT(cond,0)
3298 #ifdef HAS_BUILTIN_CHOOSE_EXPR
3302 /* Some unistd.h's give a prototype for pause() even though
3303 HAS_PAUSE ends up undefined. This causes the #define
3304 below to be rejected by the compiler. Sigh.
3309 #define Pause() sleep((32767<<16)+32767)
3313 # ifdef IOCPARM_MASK
3314 /* on BSDish systems we're safe */
3315 # define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
3317 # if defined(_IOC_SIZE) && defined(__GLIBC__)
3318 /* on Linux systems we're safe; except when we're not [perl #38223] */
3319 # define IOCPARM_LEN(x) (_IOC_SIZE(x) < 256 ? 256 : _IOC_SIZE(x))
3321 /* otherwise guess at what's safe */
3322 # define IOCPARM_LEN(x) 256
3327 #if defined(__CYGWIN__)
3329 * This symbol, if defined, indicates that the program should
3330 * use the routine my_binmode(FILE *fp, char iotype, int mode) to insure
3331 * that a file is in "binary" mode -- that is, that no translation
3332 * of bytes occurs on read or write operations.
3334 # define USEMYBINMODE /**/
3335 # include <io.h> /* for setmode() prototype */
3336 # define my_binmode(fp, iotype, mode) \
3337 (PerlLIO_setmode(fileno(fp), mode) != -1 ? TRUE : FALSE)
3341 void init_os_extras(void);
3344 #ifdef UNION_ANY_DEFINITION
3345 UNION_ANY_DEFINITION;
3354 void (*any_dptr) (void*);
3355 void (*any_dxptr) (pTHX_ void*);
3359 typedef I32 (*filter_t) (pTHX_ int, SV *, int);
3361 #define FILTER_READ(idx, sv, len) filter_read(idx, sv, len)
3362 #define FILTER_DATA(idx) \
3363 (PL_parser ? AvARRAY(PL_parser->rsfp_filters)[idx] : NULL)
3364 #define FILTER_ISREADER(idx) \
3365 (PL_parser && PL_parser->rsfp_filters \
3366 && idx >= AvFILLp(PL_parser->rsfp_filters))
3367 #define PERL_FILTER_EXISTS(i) \
3368 (PL_parser && PL_parser->rsfp_filters \
3369 && (i) <= av_len(PL_parser->rsfp_filters))
3371 #if defined(_AIX) && !defined(_AIX43)
3372 #if defined(USE_REENTRANT) || defined(_REENTRANT) || defined(_THREAD_SAFE)
3373 /* We cannot include <crypt.h> to get the struct crypt_data
3374 * because of setkey prototype problems when threading */
3375 typedef struct crypt_data { /* straight from /usr/include/crypt.h */
3376 /* From OSF, Not needed in AIX
3384 #endif /* threading */
3388 # include "iperlsys.h"
3391 #ifdef __LIBCATAMOUNT__
3392 #undef HAS_PASSWD /* unixish.h but not unixish enough. */
3394 #define FAKE_BIT_BUCKET
3397 /* [perl #22371] Algorimic Complexity Attack on Perl 5.6.1, 5.8.0.
3398 * Note that the USE_HASH_SEED and USE_HASH_SEED_EXPLICIT are *NOT*
3399 * defined by Configure, despite their names being similar to the
3400 * other defines like USE_ITHREADS. Configure in fact knows nothing
3401 * about the randomised hashes. Therefore to enable/disable the hash
3402 * randomisation defines use the Configure -Accflags=... instead. */
3403 #if !defined(NO_HASH_SEED) && !defined(USE_HASH_SEED) && !defined(USE_HASH_SEED_EXPLICIT)
3404 # define USE_HASH_SEED
3407 /* Win32 defines a type 'WORD' in windef.h. This conflicts with the enumerator
3408 * 'WORD' defined in perly.h. The yytokentype enum is only a debugging aid, so
3409 * it's not really needed.
3412 # define YYTOKENTYPE
3418 YYSTYPE next_val; /* value of next token, if any */
3419 I32 next_type; /* type of next token */
3420 MADPROP *next_mad; /* everything else about that token */
3424 /* macros to define bit-fields in structs. */
3425 #ifndef PERL_BITFIELD8
3426 # define PERL_BITFIELD8 unsigned
3428 #ifndef PERL_BITFIELD16
3429 # define PERL_BITFIELD16 unsigned
3431 #ifndef PERL_BITFIELD32
3432 # define PERL_BITFIELD32 unsigned
3442 #include "opnames.h"
3449 #include "warnings.h"
3452 /* these would be in doio.h if there was such a file */
3453 #define my_stat() my_stat_flags(SV_GMAGIC)
3454 #define my_lstat() my_lstat_flags(SV_GMAGIC)
3456 /* defined in sv.c, but also used in [ach]v.c */
3459 #undef _XPVCV_COMMON
3461 typedef struct _sublex_info SUBLEXINFO;
3462 struct _sublex_info {
3463 U8 super_state; /* lexer state to save */
3464 U16 sub_inwhat; /* "lex_inwhat" to use */
3465 OP *sub_op; /* "lex_op" to use */
3466 char *super_bufptr; /* PL_parser->bufptr that was */
3467 char *super_bufend; /* PL_parser->bufend that was */
3472 typedef struct magic_state MGS; /* struct magic_state defined in mg.c */
3474 struct scan_data_t; /* Used in S_* functions in regcomp.c */
3475 struct regnode_charclass_class; /* Used in S_* functions in regcomp.c */
3477 struct ptr_tbl_ent {
3478 struct ptr_tbl_ent* next;
3484 struct ptr_tbl_ent** tbl_ary;
3487 struct ptr_tbl_arena *tbl_arena;
3488 struct ptr_tbl_ent *tbl_arena_next;
3489 struct ptr_tbl_ent *tbl_arena_end;
3492 #if defined(iAPX286) || defined(M_I286) || defined(I80286)
3496 #if defined(htonl) && !defined(HAS_HTONL)
3499 #if defined(htons) && !defined(HAS_HTONS)
3502 #if defined(ntohl) && !defined(HAS_NTOHL)
3505 #if defined(ntohs) && !defined(HAS_NTOHS)
3509 #if (BYTEORDER & 0xffff) != 0x4321
3515 #define htons my_swap
3516 #define htonl my_htonl
3517 #define ntohs my_swap
3518 #define ntohl my_ntohl
3521 #if (BYTEORDER & 0xffff) == 0x4321
3530 * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'.
3533 #if BYTEORDER != 0x1234
3538 # if BYTEORDER == 0x4321 || BYTEORDER == 0x87654321
3539 # define vtohl(x) ((((x)&0xFF)<<24) \
3541 +(((x)&0x0000FF00)<<8) \
3542 +(((x)&0x00FF0000)>>8) )
3543 # define vtohs(x) ((((x)&0xFF)<<8) + (((x)>>8)&0xFF))
3544 # define htovl(x) vtohl(x)
3545 # define htovs(x) vtohs(x)
3547 /* otherwise default to functions in util.c */
3549 short htovs(short n);
3550 short vtohs(short n);
3556 /* *MAX Plus 1. A floating point value.
3557 Hopefully expressed in a way that dodgy floating point can't mess up.
3558 >> 2 rather than 1, so that value is safely less than I32_MAX after 1
3560 May find that some broken compiler will want the value cast to I32.
3561 [after the shift, as signed >> may not be as secure as unsigned >>]
3563 #define I32_MAX_P1 (2.0 * (1 + (((U32)I32_MAX) >> 1)))
3564 #define U32_MAX_P1 (4.0 * (1 + ((U32_MAX) >> 2)))
3565 /* For compilers that can't correctly cast NVs over 0x7FFFFFFF (or
3566 0x7FFFFFFFFFFFFFFF) to an unsigned integer. In the future, sizeof(UV)
3567 may be greater than sizeof(IV), so don't assume that half max UV is max IV.
3569 #define U32_MAX_P1_HALF (2.0 * (1 + ((U32_MAX) >> 2)))
3571 #define UV_MAX_P1 (4.0 * (1 + ((UV_MAX) >> 2)))
3572 #define IV_MAX_P1 (2.0 * (1 + (((UV)IV_MAX) >> 1)))
3573 #define UV_MAX_P1_HALF (2.0 * (1 + ((UV_MAX) >> 2)))
3575 /* This may look like unnecessary jumping through hoops, but converting
3576 out of range floating point values to integers *is* undefined behaviour,
3577 and it is starting to bite.
3580 #define I_32(what) (cast_i32((NV)(what)))
3581 #define U_32(what) (cast_ulong((NV)(what)))
3582 #define I_V(what) (cast_iv((NV)(what)))
3583 #define U_V(what) (cast_uv((NV)(what)))
3585 #define I_32(n) ((n) < I32_MAX_P1 ? ((n) < I32_MIN ? I32_MIN : (I32) (n)) \
3586 : ((n) < U32_MAX_P1 ? (I32)(U32) (n) \
3587 : ((n) > 0 ? (I32) U32_MAX : 0 /* NaN */)))
3588 #define U_32(n) ((n) < 0.0 ? ((n) < I32_MIN ? (UV) I32_MIN : (U32)(I32) (n)) \
3589 : ((n) < U32_MAX_P1 ? (U32) (n) \
3590 : ((n) > 0 ? U32_MAX : 0 /* NaN */)))
3591 #define I_V(n) ((n) < IV_MAX_P1 ? ((n) < IV_MIN ? IV_MIN : (IV) (n)) \
3592 : ((n) < UV_MAX_P1 ? (IV)(UV) (n) \
3593 : ((n) > 0 ? (IV)UV_MAX : 0 /* NaN */)))
3594 #define U_V(n) ((n) < 0.0 ? ((n) < IV_MIN ? (UV) IV_MIN : (UV)(IV) (n)) \
3595 : ((n) < UV_MAX_P1 ? (UV) (n) \
3596 : ((n) > 0 ? UV_MAX : 0 /* NaN */)))
3599 #define U_S(what) ((U16)U_32(what))
3600 #define U_I(what) ((unsigned int)U_32(what))
3601 #define U_L(what) U_32(what)
3604 # define Perl_signbit signbit
3607 /* These do not care about the fractional part, only about the range. */
3608 #define NV_WITHIN_IV(nv) (I_V(nv) >= IV_MIN && I_V(nv) <= IV_MAX)
3609 #define NV_WITHIN_UV(nv) ((nv)>=0.0 && U_V(nv) >= UV_MIN && U_V(nv) <= UV_MAX)
3611 /* Used with UV/IV arguments: */
3612 /* XXXX: need to speed it up */
3613 #define CLUMP_2UV(iv) ((iv) < 0 ? 0 : (UV)(iv))
3614 #define CLUMP_2IV(uv) ((uv) > (UV)IV_MAX ? IV_MAX : (IV)(uv))
3621 #if !(defined(UNDER_CE) || defined(SYMBIAN))
3622 Uid_t getuid (void);
3623 Uid_t geteuid (void);
3624 Gid_t getgid (void);
3625 Gid_t getegid (void);
3629 #ifndef Perl_debug_log
3630 # define Perl_debug_log PerlIO_stderr()
3633 #ifndef Perl_error_log
3634 # define Perl_error_log (PL_stderrgv \
3635 && isGV(PL_stderrgv) \
3636 && GvIOp(PL_stderrgv) \
3637 && IoOFP(GvIOp(PL_stderrgv)) \
3638 ? IoOFP(GvIOp(PL_stderrgv)) \
3643 #define DEBUG_p_FLAG 0x00000001 /* 1 */
3644 #define DEBUG_s_FLAG 0x00000002 /* 2 */
3645 #define DEBUG_l_FLAG 0x00000004 /* 4 */
3646 #define DEBUG_t_FLAG 0x00000008 /* 8 */
3647 #define DEBUG_o_FLAG 0x00000010 /* 16 */
3648 #define DEBUG_c_FLAG 0x00000020 /* 32 */
3649 #define DEBUG_P_FLAG 0x00000040 /* 64 */
3650 #define DEBUG_m_FLAG 0x00000080 /* 128 */
3651 #define DEBUG_f_FLAG 0x00000100 /* 256 */
3652 #define DEBUG_r_FLAG 0x00000200 /* 512 */
3653 #define DEBUG_x_FLAG 0x00000400 /* 1024 */
3654 #define DEBUG_u_FLAG 0x00000800 /* 2048 */
3655 /* U is reserved for Unofficial, exploratory hacking */
3656 #define DEBUG_U_FLAG 0x00001000 /* 4096 */
3657 #define DEBUG_H_FLAG 0x00002000 /* 8192 */
3658 #define DEBUG_X_FLAG 0x00004000 /* 16384 */
3659 #define DEBUG_D_FLAG 0x00008000 /* 32768 */
3660 /* 0x00010000 is unused, used to be S */
3661 #define DEBUG_T_FLAG 0x00020000 /* 131072 */
3662 #define DEBUG_R_FLAG 0x00040000 /* 262144 */
3663 #define DEBUG_J_FLAG 0x00080000 /* 524288 */
3664 #define DEBUG_v_FLAG 0x00100000 /*1048576 */
3665 #define DEBUG_C_FLAG 0x00200000 /*2097152 */
3666 #define DEBUG_A_FLAG 0x00400000 /*4194304 */
3667 #define DEBUG_q_FLAG 0x00800000 /*8388608 */
3668 #define DEBUG_M_FLAG 0x01000000 /*16777216*/
3669 #define DEBUG_B_FLAG 0x02000000 /*33554432*/
3670 #define DEBUG_MASK 0x03FEEFFF /* mask of all the standard flags */
3672 #define DEBUG_DB_RECURSE_FLAG 0x40000000
3673 #define DEBUG_TOP_FLAG 0x80000000 /* XXX what's this for ??? Signal
3674 that something was done? */
3676 # define DEBUG_p_TEST_ (PL_debug & DEBUG_p_FLAG)
3677 # define DEBUG_s_TEST_ (PL_debug & DEBUG_s_FLAG)
3678 # define DEBUG_l_TEST_ (PL_debug & DEBUG_l_FLAG)
3679 # define DEBUG_t_TEST_ (PL_debug & DEBUG_t_FLAG)
3680 # define DEBUG_o_TEST_ (PL_debug & DEBUG_o_FLAG)
3681 # define DEBUG_c_TEST_ (PL_debug & DEBUG_c_FLAG)
3682 # define DEBUG_P_TEST_ (PL_debug & DEBUG_P_FLAG)
3683 # define DEBUG_m_TEST_ (PL_debug & DEBUG_m_FLAG)
3684 # define DEBUG_f_TEST_ (PL_debug & DEBUG_f_FLAG)
3685 # define DEBUG_r_TEST_ (PL_debug & DEBUG_r_FLAG)
3686 # define DEBUG_x_TEST_ (PL_debug & DEBUG_x_FLAG)
3687 # define DEBUG_u_TEST_ (PL_debug & DEBUG_u_FLAG)
3688 # define DEBUG_U_TEST_ (PL_debug & DEBUG_U_FLAG)
3689 # define DEBUG_H_TEST_ (PL_debug & DEBUG_H_FLAG)
3690 # define DEBUG_X_TEST_ (PL_debug & DEBUG_X_FLAG)
3691 # define DEBUG_D_TEST_ (PL_debug & DEBUG_D_FLAG)
3692 # define DEBUG_T_TEST_ (PL_debug & DEBUG_T_FLAG)
3693 # define DEBUG_R_TEST_ (PL_debug & DEBUG_R_FLAG)
3694 # define DEBUG_J_TEST_ (PL_debug & DEBUG_J_FLAG)
3695 # define DEBUG_v_TEST_ (PL_debug & DEBUG_v_FLAG)
3696 # define DEBUG_C_TEST_ (PL_debug & DEBUG_C_FLAG)
3697 # define DEBUG_A_TEST_ (PL_debug & DEBUG_A_FLAG)
3698 # define DEBUG_q_TEST_ (PL_debug & DEBUG_q_FLAG)
3699 # define DEBUG_M_TEST_ (PL_debug & DEBUG_M_FLAG)
3700 # define DEBUG_B_TEST_ (PL_debug & DEBUG_B_FLAG)
3701 # define DEBUG_Xv_TEST_ (DEBUG_X_TEST_ && DEBUG_v_TEST_)
3702 # define DEBUG_Uv_TEST_ (DEBUG_U_TEST_ && DEBUG_v_TEST_)
3706 # define DEBUG_p_TEST DEBUG_p_TEST_
3707 # define DEBUG_s_TEST DEBUG_s_TEST_
3708 # define DEBUG_l_TEST DEBUG_l_TEST_
3709 # define DEBUG_t_TEST DEBUG_t_TEST_
3710 # define DEBUG_o_TEST DEBUG_o_TEST_
3711 # define DEBUG_c_TEST DEBUG_c_TEST_
3712 # define DEBUG_P_TEST DEBUG_P_TEST_
3713 # define DEBUG_m_TEST DEBUG_m_TEST_
3714 # define DEBUG_f_TEST DEBUG_f_TEST_
3715 # define DEBUG_r_TEST DEBUG_r_TEST_
3716 # define DEBUG_x_TEST DEBUG_x_TEST_
3717 # define DEBUG_u_TEST DEBUG_u_TEST_
3718 # define DEBUG_U_TEST DEBUG_U_TEST_
3719 # define DEBUG_H_TEST DEBUG_H_TEST_
3720 # define DEBUG_X_TEST DEBUG_X_TEST_
3721 # define DEBUG_D_TEST DEBUG_D_TEST_
3722 # define DEBUG_T_TEST DEBUG_T_TEST_
3723 # define DEBUG_R_TEST DEBUG_R_TEST_
3724 # define DEBUG_J_TEST DEBUG_J_TEST_
3725 # define DEBUG_v_TEST DEBUG_v_TEST_
3726 # define DEBUG_C_TEST DEBUG_C_TEST_
3727 # define DEBUG_A_TEST DEBUG_A_TEST_
3728 # define DEBUG_q_TEST DEBUG_q_TEST_
3729 # define DEBUG_M_TEST DEBUG_M_TEST_
3730 # define DEBUG_B_TEST DEBUG_B_TEST_
3731 # define DEBUG_Xv_TEST DEBUG_Xv_TEST_
3732 # define DEBUG_Uv_TEST DEBUG_Uv_TEST_
3734 # define PERL_DEB(a) a
3735 # define PERL_DEBUG(a) if (PL_debug) a
3736 # define DEBUG_p(a) if (DEBUG_p_TEST) a
3737 # define DEBUG_s(a) if (DEBUG_s_TEST) a
3738 # define DEBUG_l(a) if (DEBUG_l_TEST) a
3739 # define DEBUG_t(a) if (DEBUG_t_TEST) a
3740 # define DEBUG_o(a) if (DEBUG_o_TEST) a
3741 # define DEBUG_c(a) if (DEBUG_c_TEST) a
3742 # define DEBUG_P(a) if (DEBUG_P_TEST) a
3744 /* Temporarily turn off memory debugging in case the a
3745 * does memory allocation, either directly or indirectly. */
3746 # define DEBUG_m(a) \
3748 if (PERL_GET_INTERP) { dTHX; if (DEBUG_m_TEST) {PL_debug&=~DEBUG_m_FLAG; a; PL_debug|=DEBUG_m_FLAG;} } \
3751 # define DEBUG__(t, a) \
3753 if (t) STMT_START {a;} STMT_END; \
3756 # define DEBUG_f(a) DEBUG__(DEBUG_f_TEST, a)
3757 #ifndef PERL_EXT_RE_BUILD
3758 # define DEBUG_r(a) DEBUG__(DEBUG_r_TEST, a)
3760 # define DEBUG_r(a) STMT_START {a;} STMT_END
3761 #endif /* PERL_EXT_RE_BUILD */
3762 # define DEBUG_x(a) DEBUG__(DEBUG_x_TEST, a)
3763 # define DEBUG_u(a) DEBUG__(DEBUG_u_TEST, a)
3764 # define DEBUG_U(a) DEBUG__(DEBUG_U_TEST, a)
3765 # define DEBUG_H(a) DEBUG__(DEBUG_H_TEST, a)
3766 # define DEBUG_X(a) DEBUG__(DEBUG_X_TEST, a)
3767 # define DEBUG_D(a) DEBUG__(DEBUG_D_TEST, a)
3768 # define DEBUG_Xv(a) DEBUG__(DEBUG_Xv_TEST, a)
3769 # define DEBUG_Uv(a) DEBUG__(DEBUG_Uv_TEST, a)
3771 # define DEBUG_T(a) DEBUG__(DEBUG_T_TEST, a)
3772 # define DEBUG_R(a) DEBUG__(DEBUG_R_TEST, a)
3773 # define DEBUG_v(a) DEBUG__(DEBUG_v_TEST, a)
3774 # define DEBUG_C(a) DEBUG__(DEBUG_C_TEST, a)
3775 # define DEBUG_A(a) DEBUG__(DEBUG_A_TEST, a)
3776 # define DEBUG_q(a) DEBUG__(DEBUG_q_TEST, a)
3777 # define DEBUG_M(a) DEBUG__(DEBUG_M_TEST, a)
3778 # define DEBUG_B(a) DEBUG__(DEBUG_B_TEST, a)
3780 #else /* DEBUGGING */
3782 # define DEBUG_p_TEST (0)
3783 # define DEBUG_s_TEST (0)
3784 # define DEBUG_l_TEST (0)
3785 # define DEBUG_t_TEST (0)
3786 # define DEBUG_o_TEST (0)
3787 # define DEBUG_c_TEST (0)
3788 # define DEBUG_P_TEST (0)
3789 # define DEBUG_m_TEST (0)
3790 # define DEBUG_f_TEST (0)
3791 # define DEBUG_r_TEST (0)
3792 # define DEBUG_x_TEST (0)
3793 # define DEBUG_u_TEST (0)
3794 # define DEBUG_U_TEST (0)
3795 # define DEBUG_H_TEST (0)
3796 # define DEBUG_X_TEST (0)
3797 # define DEBUG_D_TEST (0)
3798 # define DEBUG_T_TEST (0)
3799 # define DEBUG_R_TEST (0)
3800 # define DEBUG_J_TEST (0)
3801 # define DEBUG_v_TEST (0)
3802 # define DEBUG_C_TEST (0)
3803 # define DEBUG_A_TEST (0)
3804 # define DEBUG_q_TEST (0)
3805 # define DEBUG_M_TEST (0)
3806 # define DEBUG_B_TEST (0)
3807 # define DEBUG_Xv_TEST (0)
3808 # define DEBUG_Uv_TEST (0)
3810 # define PERL_DEB(a)
3811 # define PERL_DEBUG(a)
3836 # define DEBUG_Xv(a)
3837 # define DEBUG_Uv(a)
3838 #endif /* DEBUGGING */
3841 #define DEBUG_SCOPE(where) \
3843 Perl_deb(aTHX_ "%s scope %ld (savestack=%ld) at %s:%d\n", \
3844 where, (long)PL_scopestack_ix, (long)PL_savestack_ix, \
3845 __FILE__, __LINE__));
3850 /* These constants should be used in preference to raw characters
3851 * when using magic. Note that some perl guts still assume
3852 * certain character properties of these constants, namely that
3853 * isUPPER() and toLOWER() may do useful mappings.
3855 * Update the magic_names table in dump.c when adding/amending these
3858 #define PERL_MAGIC_sv '\0' /* Special scalar variable */
3859 #define PERL_MAGIC_overload 'A' /* %OVERLOAD hash */
3860 #define PERL_MAGIC_overload_elem 'a' /* %OVERLOAD hash element */
3861 #define PERL_MAGIC_overload_table 'c' /* Holds overload table (AMT) on stash */
3862 #define PERL_MAGIC_bm 'B' /* Boyer-Moore (fast string search) */
3863 #define PERL_MAGIC_regdata 'D' /* Regex match position data
3865 #define PERL_MAGIC_regdatum 'd' /* Regex match position data element */
3866 #define PERL_MAGIC_env 'E' /* %ENV hash */
3867 #define PERL_MAGIC_envelem 'e' /* %ENV hash element */
3868 #define PERL_MAGIC_fm 'f' /* Formline ('compiled' format) */
3869 #define PERL_MAGIC_regex_global 'g' /* m//g target / study()ed string */
3870 #define PERL_MAGIC_hints 'H' /* %^H hash */
3871 #define PERL_MAGIC_hintselem 'h' /* %^H hash element */
3872 #define PERL_MAGIC_isa 'I' /* @ISA array */
3873 #define PERL_MAGIC_isaelem 'i' /* @ISA array element */
3874 #define PERL_MAGIC_nkeys 'k' /* scalar(keys()) lvalue */
3875 #define PERL_MAGIC_dbfile 'L' /* Debugger %_<filename */
3876 #define PERL_MAGIC_dbline 'l' /* Debugger %_<filename element */
3877 #define PERL_MAGIC_shared 'N' /* Shared between threads */
3878 #define PERL_MAGIC_shared_scalar 'n' /* Shared between threads */
3879 #define PERL_MAGIC_collxfrm 'o' /* Locale transformation */
3880 #define PERL_MAGIC_tied 'P' /* Tied array or hash */
3881 #define PERL_MAGIC_tiedelem 'p' /* Tied array or hash element */
3882 #define PERL_MAGIC_tiedscalar 'q' /* Tied scalar or handle */
3883 #define PERL_MAGIC_qr 'r' /* precompiled qr// regex */
3884 #define PERL_MAGIC_sig 'S' /* %SIG hash */
3885 #define PERL_MAGIC_sigelem 's' /* %SIG hash element */
3886 #define PERL_MAGIC_taint 't' /* Taintedness */
3887 #define PERL_MAGIC_uvar 'U' /* Available for use by extensions */
3888 #define PERL_MAGIC_uvar_elem 'u' /* Reserved for use by extensions */
3889 #define PERL_MAGIC_vec 'v' /* vec() lvalue */
3890 #define PERL_MAGIC_vstring 'V' /* SV was vstring literal */
3891 #define PERL_MAGIC_utf8 'w' /* Cached UTF-8 information */
3892 #define PERL_MAGIC_substr 'x' /* substr() lvalue */
3893 #define PERL_MAGIC_defelem 'y' /* Shadow "foreach" iterator variable /
3894 smart parameter vivification */
3895 #define PERL_MAGIC_arylen '#' /* Array length ($#ary) */
3896 #define PERL_MAGIC_pos '.' /* pos() lvalue */
3897 #define PERL_MAGIC_backref '<' /* for weak ref data */
3898 #define PERL_MAGIC_symtab ':' /* extra data for symbol tables */
3899 #define PERL_MAGIC_rhash '%' /* extra data for restricted hashes */
3900 #define PERL_MAGIC_arylen_p '@' /* to move arylen out of XPVAV */
3901 #define PERL_MAGIC_ext '~' /* Available for use by extensions */
3902 #define PERL_MAGIC_checkcall ']' /* inlining/mutation of call to this CV */
3904 #if defined(DEBUGGING) && defined(I_ASSERT)
3905 # include <assert.h>
3908 /* Keep the old croak based assert for those who want it, and as a fallback if
3909 the platform is so heretically non-ANSI that it can't assert. */
3911 #define Perl_assert(what) PERL_DEB( \
3912 ((what) ? ((void) 0) : \
3913 (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \
3914 "\", line %d", STRINGIFY(what), __LINE__), \
3918 # define assert(what) Perl_assert(what)
3922 I32 (*uf_val)(pTHX_ IV, SV*);
3923 I32 (*uf_set)(pTHX_ IV, SV*);
3927 /* In pre-5.7-Perls the PERL_MAGIC_uvar magic didn't get the thread context.
3928 * XS code wanting to be backward compatible can do something
3929 * like the following:
3931 #ifndef PERL_MG_UFUNC
3932 #define PERL_MG_UFUNC(name,ix,sv) I32 name(IV ix, SV *sv)
3935 static PERL_MG_UFUNC(foo_get, index, val)
3945 #ifndef PERL_MG_UFUNC
3946 #define PERL_MG_UFUNC(name,ix,sv) I32 name(pTHX_ IV ix, SV *sv)
3949 /* Fix these up for __STDC__ */
3950 #ifndef DONT_DECLARE_STD
3951 char *mktemp (char*);
3953 double atof (const char*);
3958 /* All of these are in stdlib.h or time.h for ANSI C */
3960 struct tm *gmtime(), *localtime();
3961 #if defined(OEMVS) || defined(__OPEN_VM)
3962 char *(strchr)(), *(strrchr)();
3963 char *(strcpy)(), *(strcat)();
3965 char *strchr(), *strrchr();
3966 char *strcpy(), *strcat();
3968 #endif /* ! STANDARD_C */
3975 double exp (double);
3976 double log (double);
3977 double log10 (double);
3978 double sqrt (double);
3979 double frexp (double,int*);
3980 double ldexp (double,int);
3981 double modf (double,double*);
3982 double sin (double);
3983 double cos (double);
3984 double atan2 (double,double);
3985 double pow (double,double);
3989 #if !defined(NV_INF) && defined(USE_LONG_DOUBLE) && defined(LDBL_INFINITY)
3990 # define NV_INF LDBL_INFINITY
3992 #if !defined(NV_INF) && defined(DBL_INFINITY)
3993 # define NV_INF (NV)DBL_INFINITY
3995 #if !defined(NV_INF) && defined(INFINITY)
3996 # define NV_INF (NV)INFINITY
3998 #if !defined(NV_INF) && defined(INF)
3999 # define NV_INF (NV)INF
4001 #if !defined(NV_INF) && defined(USE_LONG_DOUBLE) && defined(HUGE_VALL)
4002 # define NV_INF (NV)HUGE_VALL
4004 #if !defined(NV_INF) && defined(HUGE_VAL)
4005 # define NV_INF (NV)HUGE_VAL
4008 #if !defined(NV_NAN) && defined(USE_LONG_DOUBLE)
4009 # if !defined(NV_NAN) && defined(LDBL_NAN)
4010 # define NV_NAN LDBL_NAN
4012 # if !defined(NV_NAN) && defined(LDBL_QNAN)
4013 # define NV_NAN LDBL_QNAN
4015 # if !defined(NV_NAN) && defined(LDBL_SNAN)
4016 # define NV_NAN LDBL_SNAN
4019 #if !defined(NV_NAN) && defined(DBL_NAN)
4020 # define NV_NAN (NV)DBL_NAN
4022 #if !defined(NV_NAN) && defined(DBL_QNAN)
4023 # define NV_NAN (NV)DBL_QNAN
4025 #if !defined(NV_NAN) && defined(DBL_SNAN)
4026 # define NV_NAN (NV)DBL_SNAN
4028 #if !defined(NV_NAN) && defined(QNAN)
4029 # define NV_NAN (NV)QNAN
4031 #if !defined(NV_NAN) && defined(SNAN)
4032 # define NV_NAN (NV)SNAN
4034 #if !defined(NV_NAN) && defined(NAN)
4035 # define NV_NAN (NV)NAN
4039 # if defined(NeXT) || defined(__NeXT__) /* or whatever catches all NeXTs */
4040 char *crypt (); /* Maybe more hosts will need the unprototyped version */
4042 # if !defined(WIN32) && !defined(VMS)
4044 char *crypt (const char*, const char*);
4046 # endif /* !WIN32 */
4047 # endif /* !NeXT && !__NeXT__ */
4048 # ifndef DONT_DECLARE_STD
4050 char *getenv (const char*);
4051 # endif /* !getenv */
4052 # if !defined(HAS_LSEEK_PROTO) && !defined(EPOC) && !defined(__hpux)
4053 # ifdef _FILE_OFFSET_BITS
4054 # if _FILE_OFFSET_BITS == 64
4055 Off_t lseek (int,Off_t,int);
4059 # endif /* !DONT_DECLARE_STD */
4061 char *getlogin (void);
4063 #endif /* !__cplusplus */
4065 /* Fixme on VMS. This needs to be a run-time, not build time options */
4066 /* Also rename() is affected by this */
4067 #ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */
4068 #define UNLINK unlnk
4069 I32 unlnk (pTHX_ const char*);
4071 #define UNLINK PerlLIO_unlink
4074 /* some versions of glibc are missing the setresuid() proto */
4075 #if defined(HAS_SETRESUID) && !defined(HAS_SETRESUID_PROTO)
4076 int setresuid(uid_t ruid, uid_t euid, uid_t suid);
4078 /* some versions of glibc are missing the setresgid() proto */
4079 #if defined(HAS_SETRESGID) && !defined(HAS_SETRESGID_PROTO)
4080 int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
4083 #ifndef HAS_SETREUID
4084 # ifdef HAS_SETRESUID
4085 # define setreuid(r,e) setresuid(r,e,(Uid_t)-1)
4086 # define HAS_SETREUID
4089 #ifndef HAS_SETREGID
4090 # ifdef HAS_SETRESGID
4091 # define setregid(r,e) setresgid(r,e,(Gid_t)-1)
4092 # define HAS_SETREGID
4096 /* Sighandler_t defined in iperlsys.h */
4098 #ifdef HAS_SIGACTION
4099 typedef struct sigaction Sigsave_t;
4101 typedef Sighandler_t Sigsave_t;
4112 # define RUNOPS_DEFAULT Perl_runops_debug
4114 # define RUNOPS_DEFAULT Perl_runops_standard
4118 EXTERN_C void PerlIO_teardown(void);
4119 # ifdef USE_ITHREADS
4120 # define PERLIO_INIT MUTEX_INIT(&PL_perlio_mutex)
4121 # define PERLIO_TERM \
4123 PerlIO_teardown(); \
4124 MUTEX_DESTROY(&PL_perlio_mutex);\
4127 # define PERLIO_INIT
4128 # define PERLIO_TERM PerlIO_teardown()
4131 # define PERLIO_INIT
4132 # define PERLIO_TERM
4136 # ifdef MUTEX_INIT_CALLS_MALLOC
4137 # define MALLOC_INIT \
4139 PL_malloc_mutex = NULL; \
4140 MUTEX_INIT(&PL_malloc_mutex); \
4142 # define MALLOC_TERM \
4144 perl_mutex tmp = PL_malloc_mutex; \
4145 PL_malloc_mutex = NULL; \
4146 MUTEX_DESTROY(&tmp); \
4149 # define MALLOC_INIT MUTEX_INIT(&PL_malloc_mutex)
4150 # define MALLOC_TERM MUTEX_DESTROY(&PL_malloc_mutex)
4153 # define MALLOC_INIT
4154 # define MALLOC_TERM
4157 #if defined(PERL_IMPLICIT_CONTEXT)
4159 struct perl_memory_debug_header;
4160 struct perl_memory_debug_header {
4165 struct perl_memory_debug_header *prev;
4166 struct perl_memory_debug_header *next;
4169 # define sTHX (sizeof(struct perl_memory_debug_header) + \
4170 (MEM_ALIGNBYTES - sizeof(struct perl_memory_debug_header) \
4171 %MEM_ALIGNBYTES) % MEM_ALIGNBYTES)
4177 #ifdef PERL_TRACK_MEMPOOL
4178 # define INIT_TRACK_MEMPOOL(header, interp) \
4180 (header).interpreter = (interp); \
4181 (header).prev = (header).next = &(header); \
4184 # define INIT_TRACK_MEMPOOL(header, interp)
4187 #ifdef I_MALLOCMALLOC
4188 /* Needed for malloc_size(), malloc_good_size() on some systems */
4189 # include <malloc/malloc.h>
4193 # define Perl_safesysmalloc_size(where) Perl_malloced_size(where)
4195 # ifdef HAS_MALLOC_SIZE
4196 # ifdef PERL_TRACK_MEMPOOL
4197 # define Perl_safesysmalloc_size(where) \
4198 (malloc_size(((char *)(where)) - sTHX) - sTHX)
4200 # define Perl_safesysmalloc_size(where) malloc_size(where)
4203 # ifdef HAS_MALLOC_GOOD_SIZE
4204 # ifdef PERL_TRACK_MEMPOOL
4205 # define Perl_malloc_good_size(how_much) \
4206 (malloc_good_size((how_much) + sTHX) - sTHX)
4208 # define Perl_malloc_good_size(how_much) malloc_good_size(how_much)
4211 /* Having this as the identity operation makes some code simpler. */
4212 # define Perl_malloc_good_size(how_much) (how_much)
4216 typedef int (*runops_proc_t)(pTHX);
4217 typedef void (*share_proc_t) (pTHX_ SV *sv);
4218 typedef int (*thrhook_proc_t) (pTHX);
4219 typedef OP* (*PPADDR_t[]) (pTHX);
4220 typedef bool (*destroyable_proc_t) (pTHX_ SV *sv);
4221 typedef void (*despatch_signals_proc_t) (pTHX);
4223 /* NeXT has problems with crt0.o globals */
4224 #if defined(__DYNAMIC__) && \
4225 (defined(NeXT) || defined(__NeXT__) || defined(PERL_DARWIN))
4226 # if defined(NeXT) || defined(__NeXT)
4227 # include <mach-o/dyld.h>
4228 # define environ (*environ_pointer)
4229 EXT char *** environ_pointer;
4231 # if defined(PERL_DARWIN) && defined(PERL_CORE)
4232 # include <crt_externs.h> /* for the env array */
4233 # define environ (*_NSGetEnviron())
4237 /* VMS and some other platforms don't use the environ array */
4238 # ifdef USE_ENVIRON_ARRAY
4239 # if !defined(DONT_DECLARE_STD) || \
4240 (defined(__svr4__) && defined(__GNUC__) && defined(sun)) || \
4243 extern char ** environ; /* environment variables supplied via exec */
4250 /* handy constants */
4251 EXTCONST char PL_warn_uninit[]
4252 INIT("Use of uninitialized value%s%s%s");
4253 EXTCONST char PL_warn_nosemi[]
4254 INIT("Semicolon seems to be missing");
4255 EXTCONST char PL_warn_reserved[]
4256 INIT("Unquoted string \"%s\" may clash with future reserved word");
4257 EXTCONST char PL_warn_nl[]
4258 INIT("Unsuccessful %s on filename containing newline");
4259 EXTCONST char PL_no_wrongref[]
4260 INIT("Can't use %s ref as %s ref");
4261 /* The core no longer needs these here. If you require the string constant,
4262 please inline a copy into your own code. */
4263 EXTCONST char PL_no_symref[] __attribute__deprecated__
4264 INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");
4265 EXTCONST char PL_no_symref_sv[] __attribute__deprecated__
4266 INIT("Can't use string (\"%" SVf32 "\") as %s ref while \"strict refs\" in use");
4267 EXTCONST char PL_no_usym[]
4268 INIT("Can't use an undefined value as %s reference");
4269 EXTCONST char PL_no_aelem[]
4270 INIT("Modification of non-creatable array value attempted, subscript %d");
4271 EXTCONST char PL_no_helem_sv[]
4272 INIT("Modification of non-creatable hash value attempted, subscript \"%"SVf"\"");
4273 EXTCONST char PL_no_modify[]
4274 INIT("Modification of a read-only value attempted");
4275 EXTCONST char PL_no_mem[]
4276 INIT("Out of memory!\n");
4277 EXTCONST char PL_no_security[]
4278 INIT("Insecure dependency in %s%s");
4279 EXTCONST char PL_no_sock_func[]
4280 INIT("Unsupported socket function \"%s\" called");
4281 EXTCONST char PL_no_dir_func[]
4282 INIT("Unsupported directory function \"%s\" called");
4283 EXTCONST char PL_no_func[]
4284 INIT("The %s function is unimplemented");
4285 EXTCONST char PL_no_myglob[]
4286 INIT("\"%s\" variable %s can't be in a package");
4287 EXTCONST char PL_no_localize_ref[]
4288 INIT("Can't localize through a reference");
4289 EXTCONST char PL_memory_wrap[]
4290 INIT("panic: memory wrap");
4293 EXTCONST char PL_cshname[]
4295 # define PL_cshlen (sizeof(CSH "") - 1)
4298 EXTCONST char PL_uuemap[65]
4299 INIT("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
4302 EXTCONST char PL_uudmap[256] =
4305 EXTCONST char PL_bitcount[256] =
4306 # include "bitcount.h"
4308 EXTCONST char* const PL_sig_name[] = { SIG_NAME };
4309 EXTCONST int PL_sig_num[] = { SIG_NUM };
4311 EXTCONST char PL_uudmap[256];
4312 EXTCONST char PL_bitcount[256];
4313 EXTCONST char* const PL_sig_name[];
4314 EXTCONST int PL_sig_num[];
4317 /* fast conversion and case folding tables. The folding tables complement the
4318 * fold, so that 'a' maps to 'A' and 'A' maps to 'a', ignoring more complicated
4319 * folds such as outside the range or to multiple characters. */
4324 /* The EBCDIC fold table depends on the code page, and hence is found in
4327 EXTCONST unsigned char PL_fold[] = {
4328 0, 1, 2, 3, 4, 5, 6, 7,
4329 8, 9, 10, 11, 12, 13, 14, 15,
4330 16, 17, 18, 19, 20, 21, 22, 23,
4331 24, 25, 26, 27, 28, 29, 30, 31,
4332 32, 33, 34, 35, 36, 37, 38, 39,
4333 40, 41, 42, 43, 44, 45, 46, 47,
4334 48, 49, 50, 51, 52, 53, 54, 55,
4335 56, 57, 58, 59, 60, 61, 62, 63,
4336 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
4337 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
4338 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
4339 'x', 'y', 'z', 91, 92, 93, 94, 95,
4340 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
4341 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
4342 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
4343 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
4344 128, 129, 130, 131, 132, 133, 134, 135,
4345 136, 137, 138, 139, 140, 141, 142, 143,
4346 144, 145, 146, 147, 148, 149, 150, 151,
4347 152, 153, 154, 155, 156, 157, 158, 159,
4348 160, 161, 162, 163, 164, 165, 166, 167,
4349 168, 169, 170, 171, 172, 173, 174, 175,
4350 176, 177, 178, 179, 180, 181, 182, 183,
4351 184, 185, 186, 187, 188, 189, 190, 191,
4352 192, 193, 194, 195, 196, 197, 198, 199,
4353 200, 201, 202, 203, 204, 205, 206, 207,
4354 208, 209, 210, 211, 212, 213, 214, 215,
4355 216, 217, 218, 219, 220, 221, 222, 223,
4356 224, 225, 226, 227, 228, 229, 230, 231,
4357 232, 233, 234, 235, 236, 237, 238, 239,
4358 240, 241, 242, 243, 244, 245, 246, 247,
4359 248, 249, 250, 251, 252, 253, 254, 255
4361 EXTCONST unsigned char PL_fold_latin1[] = {
4362 /* Full latin1 complement folding, except for three problematic code points:
4363 * Micro sign (181 = 0xB5) and y with diearesis (255 = 0xFF) have their
4364 * fold complements outside the Latin1 range, so can't match something
4365 * that isn't in utf8.
4366 * German lower case sharp s (223 = 0xDF) folds to two characters, 'ss',
4367 * not one, so can't be represented in this table.
4369 * All have to be specially handled */
4370 0, 1, 2, 3, 4, 5, 6, 7,
4371 8, 9, 10, 11, 12, 13, 14, 15,
4372 16, 17, 18, 19, 20, 21, 22, 23,
4373 24, 25, 26, 27, 28, 29, 30, 31,
4374 32, 33, 34, 35, 36, 37, 38, 39,
4375 40, 41, 42, 43, 44, 45, 46, 47,
4376 48, 49, 50, 51, 52, 53, 54, 55,
4377 56, 57, 58, 59, 60, 61, 62, 63,
4378 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
4379 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
4380 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
4381 'x', 'y', 'z', 91, 92, 93, 94, 95,
4382 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
4383 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
4384 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
4385 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
4386 128, 129, 130, 131, 132, 133, 134, 135,
4387 136, 137, 138, 139, 140, 141, 142, 143,
4388 144, 145, 146, 147, 148, 149, 150, 151,
4389 152, 153, 154, 155, 156, 157, 158, 159,
4390 160, 161, 162, 163, 164, 165, 166, 167,
4391 168, 169, 170, 171, 172, 173, 174, 175,
4392 176, 177, 178, 179, 180, 181 /*micro */, 182, 183,
4393 184, 185, 186, 187, 188, 189, 190, 191,
4394 192+32, 193+32, 194+32, 195+32, 196+32, 197+32, 198+32, 199+32,
4395 200+32, 201+32, 202+32, 203+32, 204+32, 205+32, 206+32, 207+32,
4396 208+32, 209+32, 210+32, 211+32, 212+32, 213+32, 214+32, 215,
4397 216+32, 217+32, 218+32, 219+32, 220+32, 221+32, 222+32, 223 /* ss */,
4398 224-32, 225-32, 226-32, 227-32, 228-32, 229-32, 230-32, 231-32,
4399 232-32, 233-32, 234-32, 235-32, 236-32, 237-32, 238-32, 239-32,
4400 240-32, 241-32, 242-32, 243-32, 244-32, 245-32, 246-32, 247,
4401 248-32, 249-32, 250-32, 251-32, 252-32, 253-32, 254-32,
4402 255 /* y with diaeresis */
4404 #endif /* !EBCDIC, but still in DOINIT */
4406 /* If these tables are accessed through ebcdic, the access will be converted to
4408 EXTCONST unsigned char PL_latin1_lc[] = { /* lowercasing */
4409 0, 1, 2, 3, 4, 5, 6, 7,
4410 8, 9, 10, 11, 12, 13, 14, 15,
4411 16, 17, 18, 19, 20, 21, 22, 23,
4412 24, 25, 26, 27, 28, 29, 30, 31,
4413 32, 33, 34, 35, 36, 37, 38, 39,
4414 40, 41, 42, 43, 44, 45, 46, 47,
4415 48, 49, 50, 51, 52, 53, 54, 55,
4416 56, 57, 58, 59, 60, 61, 62, 63,
4417 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
4418 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
4419 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
4420 'x', 'y', 'z', 91, 92, 93, 94, 95,
4421 96, 97, 98, 99, 100, 101, 102, 103,
4422 104, 105, 106, 107, 108, 109, 110, 111,
4423 112, 113, 114, 115, 116, 117, 118, 119,
4424 120, 121, 122, 123, 124, 125, 126, 127,
4425 128, 129, 130, 131, 132, 133, 134, 135,
4426 136, 137, 138, 139, 140, 141, 142, 143,
4427 144, 145, 146, 147, 148, 149, 150, 151,
4428 152, 153, 154, 155, 156, 157, 158, 159,
4429 160, 161, 162, 163, 164, 165, 166, 167,
4430 168, 169, 170, 171, 172, 173, 174, 175,
4431 176, 177, 178, 179, 180, 181, 182, 183,
4432 184, 185, 186, 187, 188, 189, 190, 191,
4433 192+32, 193+32, 194+32, 195+32, 196+32, 197+32, 198+32, 199+32,
4434 200+32, 201+32, 202+32, 203+32, 204+32, 205+32, 206+32, 207+32,
4435 208+32, 209+32, 210+32, 211+32, 212+32, 213+32, 214+32, 215,
4436 216+32, 217+32, 218+32, 219+32, 220+32, 221+32, 222+32, 223,
4437 224, 225, 226, 227, 228, 229, 230, 231,
4438 232, 233, 234, 235, 236, 237, 238, 239,
4439 240, 241, 242, 243, 244, 245, 246, 247,
4440 248, 249, 250, 251, 252, 253, 254, 255
4443 /* upper and title case of latin1 characters, modified so that the three tricky
4444 * ones are mapped to 255 (which is one of the three) */
4445 EXTCONST unsigned char PL_mod_latin1_uc[] = {
4446 0, 1, 2, 3, 4, 5, 6, 7,
4447 8, 9, 10, 11, 12, 13, 14, 15,
4448 16, 17, 18, 19, 20, 21, 22, 23,
4449 24, 25, 26, 27, 28, 29, 30, 31,
4450 32, 33, 34, 35, 36, 37, 38, 39,
4451 40, 41, 42, 43, 44, 45, 46, 47,
4452 48, 49, 50, 51, 52, 53, 54, 55,
4453 56, 57, 58, 59, 60, 61, 62, 63,
4454 64, 65, 66, 67, 68, 69, 70, 71,
4455 72, 73, 74, 75, 76, 77, 78, 79,
4456 80, 81, 82, 83, 84, 85, 86, 87,
4457 88, 89, 90, 91, 92, 93, 94, 95,
4458 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
4459 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
4460 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
4461 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
4462 128, 129, 130, 131, 132, 133, 134, 135,
4463 136, 137, 138, 139, 140, 141, 142, 143,
4464 144, 145, 146, 147, 148, 149, 150, 151,
4465 152, 153, 154, 155, 156, 157, 158, 159,
4466 160, 161, 162, 163, 164, 165, 166, 167,
4467 168, 169, 170, 171, 172, 173, 174, 175,
4468 176, 177, 178, 179, 180, 255 /*micro*/, 182, 183,
4469 184, 185, 186, 187, 188, 189, 190, 191,
4470 192, 193, 194, 195, 196, 197, 198, 199,
4471 200, 201, 202, 203, 204, 205, 206, 207,
4472 208, 209, 210, 211, 212, 213, 214, 215,
4473 216, 217, 218, 219, 220, 221, 222, 255 /*sharp s*/,
4474 224-32, 225-32, 226-32, 227-32, 228-32, 229-32, 230-32, 231-32,
4475 232-32, 233-32, 234-32, 235-32, 236-32, 237-32, 238-32, 239-32,
4476 240-32, 241-32, 242-32, 243-32, 244-32, 245-32, 246-32, 247,
4477 248-32, 249-32, 250-32, 251-32, 252-32, 253-32, 254-32, 255
4479 #else /* ! DOINIT */
4480 EXTCONST unsigned char PL_fold[];
4481 EXTCONST unsigned char PL_fold_latin1[];
4482 EXTCONST unsigned char PL_mod_latin1_uc[];
4483 EXTCONST unsigned char PL_latin1_lc[];
4486 #ifndef PERL_GLOBAL_STRUCT /* or perlvars.h */
4488 EXT unsigned char PL_fold_locale[] = { /* Unfortunately not EXTCONST. */
4489 0, 1, 2, 3, 4, 5, 6, 7,
4490 8, 9, 10, 11, 12, 13, 14, 15,
4491 16, 17, 18, 19, 20, 21, 22, 23,
4492 24, 25, 26, 27, 28, 29, 30, 31,
4493 32, 33, 34, 35, 36, 37, 38, 39,
4494 40, 41, 42, 43, 44, 45, 46, 47,
4495 48, 49, 50, 51, 52, 53, 54, 55,
4496 56, 57, 58, 59, 60, 61, 62, 63,
4497 64, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
4498 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
4499 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
4500 'x', 'y', 'z', 91, 92, 93, 94, 95,
4501 96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
4502 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
4503 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
4504 'X', 'Y', 'Z', 123, 124, 125, 126, 127,
4505 128, 129, 130, 131, 132, 133, 134, 135,
4506 136, 137, 138, 139, 140, 141, 142, 143,
4507 144, 145, 146, 147, 148, 149, 150, 151,
4508 152, 153, 154, 155, 156, 157, 158, 159,
4509 160, 161, 162, 163, 164, 165, 166, 167,
4510 168, 169, 170, 171, 172, 173, 174, 175,
4511 176, 177, 178, 179, 180, 181, 182, 183,
4512 184, 185, 186, 187, 188, 189, 190, 191,
4513 192, 193, 194, 195, 196, 197, 198, 199,
4514 200, 201, 202, 203, 204, 205, 206, 207,
4515 208, 209, 210, 211, 212, 213, 214, 215,
4516 216, 217, 218, 219, 220, 221, 222, 223,
4517 224, 225, 226, 227, 228, 229, 230, 231,
4518 232, 233, 234, 235, 236, 237, 238, 239,
4519 240, 241, 242, 243, 244, 245, 246, 247,
4520 248, 249, 250, 251, 252, 253, 254, 255
4523 EXT unsigned char PL_fold_locale[]; /* Unfortunately not EXTCONST. */
4525 #endif /* !PERL_GLOBAL_STRUCT */
4529 EXTCONST unsigned char PL_freq[] = {/* EBCDIC frequencies for mixed English/C */
4530 1, 2, 84, 151, 154, 155, 156, 157,
4531 165, 246, 250, 3, 158, 7, 18, 29,
4532 40, 51, 62, 73, 85, 96, 107, 118,
4533 129, 140, 147, 148, 149, 150, 152, 153,
4534 255, 6, 8, 9, 10, 11, 12, 13,
4535 14, 15, 24, 25, 26, 27, 28, 226,
4536 29, 30, 31, 32, 33, 43, 44, 45,
4537 46, 47, 48, 49, 50, 76, 77, 78,
4538 79, 80, 81, 82, 83, 84, 85, 86,
4539 87, 94, 95, 234, 181, 233, 187, 190,
4540 180, 96, 97, 98, 99, 100, 101, 102,
4541 104, 112, 182, 174, 236, 232, 229, 103,
4542 228, 226, 114, 115, 116, 117, 118, 119,
4543 120, 121, 122, 235, 176, 230, 194, 162,
4544 130, 131, 132, 133, 134, 135, 136, 137,
4545 138, 139, 201, 205, 163, 217, 220, 224,
4546 5, 248, 227, 244, 242, 255, 241, 231,
4547 240, 253, 16, 197, 19, 20, 21, 187,
4548 23, 169, 210, 245, 237, 249, 247, 239,
4549 168, 252, 34, 196, 36, 37, 38, 39,
4550 41, 42, 251, 254, 238, 223, 221, 213,
4551 225, 177, 52, 53, 54, 55, 56, 57,
4552 58, 59, 60, 61, 63, 64, 65, 66,
4553 67, 68, 69, 70, 71, 72, 74, 75,
4554 205, 208, 186, 202, 200, 218, 198, 179,
4555 178, 214, 88, 89, 90, 91, 92, 93,
4556 217, 166, 170, 207, 199, 209, 206, 204,
4557 160, 212, 105, 106, 108, 109, 110, 111,
4558 203, 113, 216, 215, 192, 175, 193, 243,
4559 172, 161, 123, 124, 125, 126, 127, 128,
4560 222, 219, 211, 195, 188, 193, 185, 184,
4561 191, 183, 141, 142, 143, 144, 145, 146
4563 #else /* ascii rather than ebcdic */
4564 EXTCONST unsigned char PL_freq[] = { /* letter frequencies for mixed English/C */
4565 1, 2, 84, 151, 154, 155, 156, 157,
4566 165, 246, 250, 3, 158, 7, 18, 29,
4567 40, 51, 62, 73, 85, 96, 107, 118,
4568 129, 140, 147, 148, 149, 150, 152, 153,
4569 255, 182, 224, 205, 174, 176, 180, 217,
4570 233, 232, 236, 187, 235, 228, 234, 226,
4571 222, 219, 211, 195, 188, 193, 185, 184,
4572 191, 183, 201, 229, 181, 220, 194, 162,
4573 163, 208, 186, 202, 200, 218, 198, 179,
4574 178, 214, 166, 170, 207, 199, 209, 206,
4575 204, 160, 212, 216, 215, 192, 175, 173,
4576 243, 172, 161, 190, 203, 189, 164, 230,
4577 167, 248, 227, 244, 242, 255, 241, 231,
4578 240, 253, 169, 210, 245, 237, 249, 247,
4579 239, 168, 252, 251, 254, 238, 223, 221,
4580 213, 225, 177, 197, 171, 196, 159, 4,
4581 5, 6, 8, 9, 10, 11, 12, 13,
4582 14, 15, 16, 17, 19, 20, 21, 22,
4583 23, 24, 25, 26, 27, 28, 30, 31,
4584 32, 33, 34, 35, 36, 37, 38, 39,
4585 41, 42, 43, 44, 45, 46, 47, 48,
4586 49, 50, 52, 53, 54, 55, 56, 57,
4587 58, 59, 60, 61, 63, 64, 65, 66,
4588 67, 68, 69, 70, 71, 72, 74, 75,
4589 76, 77, 78, 79, 80, 81, 82, 83,
4590 86, 87, 88, 89, 90, 91, 92, 93,
4591 94, 95, 97, 98, 99, 100, 101, 102,
4592 103, 104, 105, 106, 108, 109, 110, 111,
4593 112, 113, 114, 115, 116, 117, 119, 120,
4594 121, 122, 123, 124, 125, 126, 127, 128,
4595 130, 131, 132, 133, 134, 135, 136, 137,
4596 138, 139, 141, 142, 143, 144, 145, 146
4600 EXTCONST unsigned char PL_freq[];
4605 EXTCONST char* const PL_block_type[] = {
4620 EXTCONST char* PL_block_type[];
4624 /* These are all the compile time options that affect binary compatibility.
4625 Other compile time options that are binary compatible are in perl.c
4626 Both are combined for the output of perl -V
4627 However, this string will be embedded in any shared perl library, which will
4628 allow us add a comparison check in perlmain.c in the near future. */
4630 EXTCONST char PL_bincompat_options[] =
4631 # ifdef DEBUG_LEAKING_SCALARS
4632 " DEBUG_LEAKING_SCALARS"
4634 # ifdef DEBUG_LEAKING_SCALARS_FORK_DUMP
4635 " DEBUG_LEAKING_SCALARS_FORK_DUMP"
4637 # ifdef FAKE_THREADS
4640 # ifdef MULTIPLICITY
4646 # ifdef PERL_DEBUG_READONLY_OPS
4647 " PERL_DEBUG_READONLY_OPS"
4649 # ifdef PERL_GLOBAL_STRUCT
4650 " PERL_GLOBAL_STRUCT"
4652 # ifdef PERL_IMPLICIT_CONTEXT
4653 " PERL_IMPLICIT_CONTEXT"
4655 # ifdef PERL_IMPLICIT_SYS
4656 " PERL_IMPLICIT_SYS"
4661 # ifdef PERL_NEED_APPCTX
4664 # ifdef PERL_NEED_TIMESBASE
4665 " PERL_NEED_TIMESBASE"
4667 # ifdef PERL_OLD_COPY_ON_WRITE
4668 " PERL_OLD_COPY_ON_WRITE"
4673 # ifdef PERL_TRACK_MEMPOOL
4674 " PERL_TRACK_MEMPOOL"
4676 # ifdef PERL_USES_PL_PIDSTATUS
4677 " PERL_USES_PL_PIDSTATUS"
4679 # ifdef PL_OP_SLAB_ALLOC
4682 # ifdef THREADS_HAVE_PIDS
4683 " THREADS_HAVE_PIDS"
4685 # ifdef USE_64_BIT_ALL
4688 # ifdef USE_64_BIT_INT
4694 # ifdef USE_ITHREADS
4697 # ifdef USE_LARGE_FILES
4700 # ifdef USE_LONG_DOUBLE
4706 # ifdef USE_REENTRANT_API
4707 " USE_REENTRANT_API"
4715 # ifdef VMS_DO_SOCKETS
4717 # ifdef DECCRTL_SOCKETS
4721 # ifdef VMS_WE_ARE_CASE_SENSITIVE
4722 " VMS_SYMBOL_CASE_AS_IS"
4724 # ifdef VMS_SHORTEN_LONG_SYMBOLS
4725 " VMS_SHORTEN_LONG_SYMBOLS"
4729 EXTCONST char PL_bincompat_options[];
4732 /* The interpreter phases. If these ever change, PL_phase_names right below will
4733 * need to be updated accordingly. */
4735 PERL_PHASE_CONSTRUCT = 0,
4736 PERL_PHASE_START = 1,
4737 PERL_PHASE_CHECK = 2,
4738 PERL_PHASE_INIT = 3,
4741 PERL_PHASE_DESTRUCT = 6
4745 EXTCONST char *const PL_phase_names[] = {
4755 EXTCONST char *const PL_phase_names[];
4759 /* Do not use this macro. It only exists for extensions that rely on PL_dirty
4760 * instead of using the newer PL_phase, which provides everything PL_dirty
4761 * provided, and more. */
4762 # define PL_dirty (PL_phase == PERL_PHASE_DESTRUCT)
4763 #endif /* !PERL_CORE */
4767 /*****************************************************************************/
4768 /* This lexer/parser stuff is currently global since yacc is hard to reenter */
4769 /*****************************************************************************/
4770 /* XXX This needs to be revisited, since BEGIN makes yacc re-enter... */
4773 /* LynxOS defines these in scsi.h which is included via ioctl.h */
4782 #define LEX_NOTPARSING 11 /* borrowed from toke.c */
4793 XTERMORDORDOR /* evil hack */
4794 /* update exp_name[] in toke.c if adding to this enum */
4797 enum { /* pass one of these to get_vtbl */
4823 want_vtbl_amagicelem,
4830 want_vtbl_hintselem,
4835 /* Hints are now stored in a dedicated U32, so the bottom 8 bits are no longer
4836 special and there is no need for HINT_PRIVATE_MASK for COPs
4837 However, bitops store HINT_INTEGER in their op_private. */
4838 #define HINT_INTEGER 0x00000001 /* integer pragma */
4839 #define HINT_STRICT_REFS 0x00000002 /* strict pragma */
4840 #define HINT_LOCALE 0x00000004 /* locale pragma */
4841 #define HINT_BYTES 0x00000008 /* bytes pragma */
4842 #define HINT_ARYBASE 0x00000010 /* $[ is non-zero */
4843 /* Note: 20,40,80 used for NATIVE_HINTS */
4844 /* currently defined by vms/vmsish.h */
4846 #define HINT_BLOCK_SCOPE 0x00000100
4847 #define HINT_STRICT_SUBS 0x00000200 /* strict pragma */
4848 #define HINT_STRICT_VARS 0x00000400 /* strict pragma */
4849 #define HINT_UNI_8_BIT 0x00000800 /* unicode_strings feature */
4851 /* The HINT_NEW_* constants are used by the overload pragma */
4852 #define HINT_NEW_INTEGER 0x00001000
4853 #define HINT_NEW_FLOAT 0x00002000
4854 #define HINT_NEW_BINARY 0x00004000
4855 #define HINT_NEW_STRING 0x00008000
4856 #define HINT_NEW_RE 0x00010000
4857 #define HINT_LOCALIZE_HH 0x00020000 /* %^H needs to be copied */
4858 #define HINT_LEXICAL_IO_IN 0x00040000 /* ${^OPEN} is set for input */
4859 #define HINT_LEXICAL_IO_OUT 0x00080000 /* ${^OPEN} is set for output */
4861 #define HINT_RE_TAINT 0x00100000 /* re pragma */
4862 #define HINT_RE_EVAL 0x00200000 /* re pragma */
4864 #define HINT_FILETEST_ACCESS 0x00400000 /* filetest pragma */
4865 #define HINT_UTF8 0x00800000 /* utf8 pragma */
4867 #define HINT_NO_AMAGIC 0x01000000 /* overloading pragma */
4869 #define HINT_RE_FLAGS 0x02000000 /* re '/xism' pragma */
4871 /* The following are stored in $^H{sort}, not in PL_hints */
4872 #define HINT_SORT_SORT_BITS 0x000000FF /* allow 256 different ones */
4873 #define HINT_SORT_QUICKSORT 0x00000001
4874 #define HINT_SORT_MERGESORT 0x00000002
4875 #define HINT_SORT_STABLE 0x00000100 /* sort styles (currently one) */
4877 /* Various states of the input record separator SV (rs) */
4878 #define RsSNARF(sv) (! SvOK(sv))
4879 #define RsSIMPLE(sv) (SvOK(sv) && (! SvPOK(sv) || SvCUR(sv)))
4880 #define RsPARA(sv) (SvPOK(sv) && ! SvCUR(sv))
4881 #define RsRECORD(sv) (SvROK(sv) && (SvIV(SvRV(sv)) > 0))
4883 /* A struct for keeping various DEBUGGING related stuff,
4884 * neatly packed. Currently only scratch variables for
4885 * constructing debug output are included. Needed always,
4886 * not just when DEBUGGING, though, because of the re extension. c*/
4887 struct perl_debug_pad {
4891 #define PERL_DEBUG_PAD(i) &(PL_debug_pad.pad[i])
4892 #define PERL_DEBUG_PAD_ZERO(i) (SvPVX(PERL_DEBUG_PAD(i))[0] = 0, \
4893 (((XPV*) SvANY(PERL_DEBUG_PAD(i)))->xpv_cur = 0), \
4896 /* Enable variables which are pointers to functions */
4897 typedef void (*peep_t)(pTHX_ OP* o);
4898 typedef regexp* (*regcomp_t) (pTHX_ char* exp, char* xend, PMOP* pm);
4899 typedef I32 (*regexec_t) (pTHX_ regexp* prog, char* stringarg,
4900 char* strend, char* strbeg, I32 minend,
4901 SV* screamer, void* data, U32 flags);
4902 typedef char* (*re_intuit_start_t) (pTHX_ regexp *prog, SV *sv,