/* this is used for functions which take a depth trailing
* argument under debugging */
#ifdef DEBUGGING
-#define _pDEPTH ,U32 depth
-#define _aDEPTH ,depth
+# define _pDEPTH ,U32 depth
+# define _aDEPTH ,depth
#else
-#define _pDEPTH
-#define _aDEPTH
+# define _pDEPTH
+# define _aDEPTH
#endif
/* NOTE 1: that with gcc -std=c89 the __STDC_VERSION__ is *not* defined
/* <--- here ends the logic shared by perl.h and makedef.pl */
/*
-=for apidoc_section Compiler directives
+=for apidoc_section $directives
=for apidoc AmnUu|void|EXTERN_C
When not compiling using C++, expands to nothing.
Otherwise is used in a declaration of a function to indicate the function
#undef END_EXTERN_C
#undef EXTERN_C
#ifdef __cplusplus
-# define START_EXTERN_C extern "C" {
-# define END_EXTERN_C }
# define EXTERN_C extern "C"
+# define START_EXTERN_C EXTERN_C {
+# define END_EXTERN_C }
#else
# define START_EXTERN_C
# define END_EXTERN_C
# endif
#endif
-/* this used to be off by default, now its on, see perlio.h */
-#define PERLIO_FUNCS_CONST
+/*
+=for apidoc_section $concurrency
+=for apidoc AmU|void|dTHXa|PerlInterpreter * a
+On threaded perls, set C<pTHX> to C<a>; on unthreaded perls, do nothing
+
+=for apidoc AmU|void|dTHXoa|PerlInterpreter * a
+Now a synonym for C<L</dTHXa>>.
+
+=cut
+*/
#ifdef PERL_IMPLICIT_CONTEXT
# ifndef MULTIPLICITY
*
* The only one Devel::PPPort handles is this; list it as deprecated
-=for apidoc_section Concurrency
+=for apidoc_section $concurrency
=for apidoc AmD|void|CPERLscope|void x
Now a no-op.
=cut
*/
-#define CPERLscope(x) x
-#define CPERLarg void
-#define CPERLarg_
-#define _CPERLarg
-#define PERL_OBJECT_THIS
-#define _PERL_OBJECT_THIS
-#define PERL_OBJECT_THIS_
-#define CALL_FPTR(fptr) (*fptr)
-#define MEMBER_TO_FPTR(name) name
+# define CPERLscope(x) x
+# define CPERLarg void
+# define CPERLarg_
+# define _CPERLarg
+# define PERL_OBJECT_THIS
+# define _PERL_OBJECT_THIS
+# define PERL_OBJECT_THIS_
+# define CALL_FPTR(fptr) (*fptr)
+# define MEMBER_TO_FPTR(name) name
#endif /* !PERL_CORE */
#define CALLRUNOPS PL_runops
RX_ENGINE(rx)->qr_package(aTHX_ (rx))
#if defined(USE_ITHREADS)
-#define CALLREGDUPE(prog,param) \
+# define CALLREGDUPE(prog,param) \
Perl_re_dup(aTHX_ (prog),(param))
-#define CALLREGDUPE_PVT(prog,param) \
+# define CALLREGDUPE_PVT(prog,param) \
(prog ? RX_ENGINE(prog)->dupe(aTHX_ (prog),(param)) \
: (REGEXP *)NULL)
#endif
*/
#ifndef PERL_MICRO
-#if defined __GNUC__ && !defined(__INTEL_COMPILER)
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3 /* 3.1 -> */
-# define HASATTRIBUTE_DEPRECATED
-# endif
-# if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */
-# define HASATTRIBUTE_FORMAT
-# if defined __MINGW32__
-# define PRINTF_FORMAT_NULL_OK
+# if defined __GNUC__ && !defined(__INTEL_COMPILER)
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 1 || __GNUC__ > 3 /* 3.1 -> */
+# define HASATTRIBUTE_DEPRECATED
+# endif
+# if __GNUC__ >= 3 /* 3.0 -> */ /* XXX Verify this version */
+# define HASATTRIBUTE_FORMAT
+# if defined __MINGW32__
+# define PRINTF_FORMAT_NULL_OK
+# endif
+# endif
+# if __GNUC__ >= 3 /* 3.0 -> */
+# define HASATTRIBUTE_MALLOC
+# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */
+# define HASATTRIBUTE_NONNULL
+# endif
+# if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */
+# define HASATTRIBUTE_NORETURN
+# endif
+# if __GNUC__ >= 3 /* gcc 3.0 -> */
+# define HASATTRIBUTE_PURE
+# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
+# define HASATTRIBUTE_UNUSED
+# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ == 3 && !defined(__cplusplus)
+# define HASATTRIBUTE_UNUSED /* gcc-3.3, but not g++-3.3. */
+# endif
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
+# define HASATTRIBUTE_WARN_UNUSED_RESULT
+# endif
+ /* always_inline is buggy in gcc <= 4.6 and causes compilation errors */
+# if __GNUC__ == 4 && __GNUC_MINOR__ >= 7 || __GNUC__ > 4 /* 4.7 -> */
+# define HASATTRIBUTE_ALWAYS_INLINE
# endif
# endif
-# if __GNUC__ >= 3 /* 3.0 -> */
-# define HASATTRIBUTE_MALLOC
-# endif
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 3 || __GNUC__ > 3 /* 3.3 -> */
-# define HASATTRIBUTE_NONNULL
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 || __GNUC__ > 2 /* 2.5 -> */
-# define HASATTRIBUTE_NORETURN
-# endif
-# if __GNUC__ >= 3 /* gcc 3.0 -> */
-# define HASATTRIBUTE_PURE
-# endif
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
-# define HASATTRIBUTE_UNUSED
-# endif
-# if __GNUC__ == 3 && __GNUC_MINOR__ == 3 && !defined(__cplusplus)
-# define HASATTRIBUTE_UNUSED /* gcc-3.3, but not g++-3.3. */
-# endif
-# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3 /* 3.4 -> */
-# define HASATTRIBUTE_WARN_UNUSED_RESULT
-# endif
-/* always_inline is buggy in gcc <= 4.6 and causes compilation errors */
-# if __GNUC__ == 4 && __GNUC_MINOR__ >= 7 || __GNUC__ > 4 /* 4.7 -> */
-# define HASATTRIBUTE_ALWAYS_INLINE
-# endif
-#endif
#endif /* #ifndef PERL_MICRO */
#ifdef HASATTRIBUTE_DEPRECATED
* cpp macros like PERL_UNUSED_DECL cannot work for this purpose, even
* if it were PERL_UNUSED_DECL(x), which it cannot be (see above).
-=for apidoc_section Compiler directives
+=for apidoc_section $directives
=for apidoc AmnU||PERL_UNUSED_DECL
Tells the compiler that the parameter in the function prototype just before it
is not necessarily expected to be used in the function. Not that many
# endif
#endif
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && _MSC_VER < 1400
/* XXX older MSVC versions have a smallish macro buffer */
-#define PERL_SMALL_MACRO_BUFFER
+# define PERL_SMALL_MACRO_BUFFER
#endif
/* on gcc (and clang), specify that a warning should be temporarily
#define MSVC_DIAG_IGNORE_STMT(x) MSVC_DIAG_IGNORE(x) NOOP
#define MSVC_DIAG_RESTORE_STMT MSVC_DIAG_RESTORE NOOP
+/*
+=for apidoc Amns||NOOP
+Do nothing; typically used as a placeholder to replace something that used to
+do something.
+
+=for apidoc Amns||dNOOP
+Declare nothing; typically used as a placeholder to replace something that used
+to declare something. Works on compilers that require declarations before any
+code.
+
+=cut
+*/
#define NOOP /*EMPTY*/(void)0
#define dNOOP struct Perl___notused_struct
# define pTHX_12 12
#endif
+/*
+=for apidoc_section $concurrency
+=for apidoc AmnU||dVAR
+This is now a synonym for dNOOP: declare nothing
+
+=for apidoc_section $XS
+=for apidoc Amns||dMY_CXT_SV
+Now a placeholder that declares nothing
+
+=cut
+*/
+
#ifndef PERL_CORE
-/* Backwards compatibility macro for XS code. It used to be part of
- * the PERL_GLOBAL_STRUCT(_PRIVATE) feature, which no longer exists */
+ /* Backwards compatibility macro for XS code. It used to be part of the
+ * PERL_GLOBAL_STRUCT(_PRIVATE) feature, which no longer exists */
# define dVAR dNOOP
-#endif
-/* these are only defined for compatibility; should not be used internally */
-#if !defined(pTHXo) && !defined(PERL_CORE)
-# define pTHXo pTHX
-# define pTHXo_ pTHX_
-# define aTHXo aTHX
-# define aTHXo_ aTHX_
-# define dTHXo dTHX
-# define dTHXoa(x) dTHXa(x)
+ /* these are only defined for compatibility; should not be used internally.
+ * */
+# define dMY_CXT_SV dNOOP
+# ifndef pTHXo
+# define pTHXo pTHX
+# define pTHXo_ pTHX_
+# define aTHXo aTHX
+# define aTHXo_ aTHX_
+# define dTHXo dTHX
+# define dTHXoa(x) dTHXa(x)
+# endif
#endif
#ifndef pTHXx
#endif
/*
-=for apidoc_section Compiler directives
+=for apidoc_section $directives
=for apidoc AmnUu|void|STMT_START
=for apidoc_item ||STMT_END
/* Macros for correct constant construction. These are in C99 <stdint.h>
* (so they will not be available in strict C89 mode), but they are nice, so
* let's define them if necessary.
-=for apidoc_section Integer configuration values
+=for apidoc_section $integer
=for apidoc Am|I16|INT16_C|number
=for apidoc_item |I32|INT32_C|number
=for apidoc_item |I64|INT64_C|number
corresponding integer type on the machine.
If the machine does not have a 64-bit type, C<INT64_C> is undefined.
+Use C<L</INTMAX_C>> to get the largest type available on the platform.
=for apidoc Am|U16|UINT16_C|number
=for apidoc_item |U32|UINT32_C|number
corresponding unsigned integer type on the machine.
If the machine does not have a 64-bit type, C<UINT64_C> is undefined.
+Use C<L</UINTMAX_C>> to get the largest type available on the platform.
=cut
# endif
/*
-=for apidoc_section Integer configuration values
+=for apidoc_section $integer
=for apidoc Am||INTMAX_C|number
Returns a token the C compiler recognizes for the constant C<number> of the
widest integer type on the machine. For example, if the machine has C<long
-1LL
+See also, for example, C<L</INT32_C>>.
+
+Use L</IV> to declare variables of the maximum usable size on this platform.
+
=for apidoc Am||UINTMAX_C|number
Returns a token the C compiler recognizes for the constant C<number> of the
widest unsigned integer type on the machine. For example, if the machine has
1UL
+See also, for example, C<L</UINT32_C>>.
+
+Use L</UV> to declare variables of the maximum usable size on this platform.
+
=cut
*/
#define MALLOC_TOO_LATE_FOR(ch) TOO_LATE_FOR_(ch, " with $ENV{PERL_MALLOC_OPT}")
#define MALLOC_CHECK_TAINT2(argc,argv) MALLOC_CHECK_TAINT(argc,argv,NULL)
+/*
+=for apidoc Am|void|memzero|void * d|Size_t l
+Set the C<l> bytes starting at C<*d> to all zeroes.
+
+=cut
+*/
#ifndef memzero
# define memzero(d,l) memset(d,0,l)
#endif
#endif
/*
-=for apidoc_section Errno
+=for apidoc_section $errno
=for apidoc m|void|SETERRNO|int errcode|int vmserrcode
#endif
/*
-=for apidoc_section Warning and Dieing
+=for apidoc_section $warning
=for apidoc Amn|SV *|ERRSV
#endif
/*
-=for apidoc_section SV Handling
+=for apidoc_section $SV
=for apidoc Amn|SV *|DEFSV
Returns the SV associated with C<$_>
* longer need that. XS modules can (and do) use this name, so it must remain
* a part of the API that's visible to modules.
-=for apidoc_section String Handling
+=for apidoc_section $string
=for apidoc ATmD|int|my_sprintf|NN char *buffer|NN const char *pat|...
Do NOT use this due to the possibility of overflowing C<buffer>. Instead use
# define PTR2ul(p) INT2PTR(unsigned long,p)
#endif
+/*
+=for apidoc_section Casting
+=for apidoc Cyh|type|NUM2PTR|type|int value
+You probably want to be using L<C</INT2PTR>> instead.
+
+=cut
+*/
+
#define NUM2PTR(any,d) (any)(PTRV)(d)
#define PTR2IV(p) INT2PTR(IV,p)
#define PTR2UV(p) INT2PTR(UV,p)
# define Perl_fp_class_snan(x) (_fpclass(x) & _FPCLASS_SNAN)
# define Perl_fp_class_qnan(x) (_fpclass(x) & _FPCLASS_QNAN)
# define Perl_fp_class_nan(x) (_fpclass(x) & (_FPCLASS_SNAN|_FPCLASS_QNAN))
-# define Perl_fp_class_ninf(x) (_fpclass(x) & _FPCLASS_NINF))
-# define Perl_fp_class_pinf(x) (_fpclass(x) & _FPCLASS_PINF))
+# define Perl_fp_class_ninf(x) (_fpclass(x) & _FPCLASS_NINF)
+# define Perl_fp_class_pinf(x) (_fpclass(x) & _FPCLASS_PINF)
# define Perl_fp_class_inf(x) (_fpclass(x) & (_FPCLASS_NINF|_FPCLASS_PINF))
# define Perl_fp_class_nnorm(x) (_fpclass(x) & _FPCLASS_NN)
# define Perl_fp_class_pnorm(x) (_fpclass(x) & _FPCLASS_PN)
#define my_atof2(a,b) my_atof3(a,b,0)
/*
+=for apidoc_section $numeric
+=for apidoc AmT|NV|Perl_acos|NV x
+=for apidoc_item |NV|Perl_asin|NV x
+=for apidoc_item |NV|Perl_atan|NV x
+=for apidoc_item |NV|Perl_atan2|NV x|NV y
+=for apidoc_item |NV|Perl_ceil|NV x
+=for apidoc_item |NV|Perl_cos|NV x
+=for apidoc_item |NV|Perl_cosh|NV x
+=for apidoc_item |NV|Perl_exp|NV x
+=for apidoc_item |NV|Perl_floor|NV x
+=for apidoc_item |NV|Perl_fmod|NV x|NV y
+=for apidoc_item |NV|Perl_frexp|NV x|int *exp
+=for apidoc_item |IV|Perl_isfinite|NV x
+=for apidoc_item |IV|Perl_isinf|NV x
+=for apidoc_item |IV|Perl_isnan|NV x
+=for apidoc_item |NV|Perl_ldexp|NV x|int exp
+=for apidoc_item |NV|Perl_log|NV x
+=for apidoc_item |NV|Perl_log10|NV x
+=for apidoc_item |NV|Perl_modf|NV x|NV *iptr
+=for apidoc_item |NV|Perl_pow|NV x|NV y
+=for apidoc_item |NV|Perl_sin|NV x
+=for apidoc_item |NV|Perl_sinh|NV x
+=for apidoc_item |NV|Perl_sqrt|NV x
+=for apidoc_item |NV|Perl_tan|NV x
+=for apidoc_item |NV|Perl_tanh|NV x
+
+These perform the corresponding mathematical operation on the operand(s), using
+the libc function designed for the task that has just enough precision for an
+NV on this platform. If no such function with sufficient precision exists,
+the highest precision one available is used.
+
+=cut
+*/
+
+/*
* CHAR_MIN and CHAR_MAX are not included here, as the (char) type may be
* ambiguous. It may be equivalent to (signed char) or (unsigned char)
* depending on local options. Until Configure detects this (or at least
#endif
/*
-=for apidoc_section Integer configuration values
+=for apidoc_section $integer
=for apidoc AmnU||PERL_INT_MAX
=for apidoc_item ||PERL_INT_MIN
typedef struct io IO;
typedef struct context PERL_CONTEXT;
typedef struct block BLOCK;
+typedef struct invlist INVLIST;
typedef struct magic MAGIC;
typedef struct xpv XPV;
# define USE_ENVIRON_ARRAY
#endif
-#ifdef USE_ITHREADS
- /* On some platforms it would be safe to use a read/write mutex with many
- * readers possible at the same time. On other platforms, notably IBM ones,
- * subsequent getenv calls destroy earlier ones. Those platforms would not
- * be able to handle simultaneous getenv calls */
-# define ENV_LOCK MUTEX_LOCK(&PL_env_mutex)
-# define ENV_UNLOCK MUTEX_UNLOCK(&PL_env_mutex)
-# define ENV_INIT MUTEX_INIT(&PL_env_mutex);
-# define ENV_TERM MUTEX_DESTROY(&PL_env_mutex);
-#else
-# define ENV_LOCK NOOP;
-# define ENV_UNLOCK NOOP;
-# define ENV_INIT NOOP;
-# define ENV_TERM NOOP;
-#endif
-
-/* Some critical sections need to lock both the locale and the environment.
- * XXX khw intends to change this to lock both mutexes, but that brings up
- * issues of potential deadlock, so should be done at the beginning of a
- * development cycle. So for now, it just locks the environment. Note that
- * many modern platforms are locale-thread-safe anyway, so locking the locale
- * mutex is a no-op anyway */
-#define ENV_LOCALE_LOCK ENV_LOCK
-#define ENV_LOCALE_UNLOCK ENV_UNLOCK
-
-/* And some critical sections care only that no one else is writing either the
- * locale nor the environment. XXX Again this is for the future. This can be
- * simulated with using COND_WAIT in thread.h */
-#define ENV_LOCALE_READ_LOCK ENV_LOCALE_LOCK
-#define ENV_LOCALE_READ_UNLOCK ENV_LOCALE_UNLOCK
-
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
/* having sigaction(2) means that the OS supports both 1-arg and 3-arg
* signal handlers. But the perl core itself only fully supports 1-arg
#endif
/*
-=for apidoc_section Embedding and Interpreter Cloning
+=for apidoc_section $embedding
=for apidoc Am|void|PERL_SYS_INIT|int *argc|char*** argv
Provides system-specific tune up of the C runtime environment necessary to
typedef pthread_cond_t perl_cond;
typedef pthread_key_t perl_key;
# endif
+
+/* Many readers; single writer */
+typedef struct {
+ perl_mutex lock;
+ perl_cond wakeup;
+ Size_t readers_count;
+} perl_RnW1_mutex_t;
+
+
#endif /* USE_ITHREADS */
#ifdef PERL_TSA_ACTIVE
#define PNfARG(pn) (int)1, (UV)PadnameLEN(pn), (void *)PadnamePV(pn)
#ifdef PERL_CORE
-/* not used; but needed for backward compatibility with XS code? - RMB */
+/* not used; but needed for backward compatibility with XS code? - RMB
+=for apidoc AmnD|const char *|UVf
+
+Obsolete form of C<UVuf>, which you should convert to instead use
+
+=cut
+*/
# undef UVf
#elif !defined(UVf)
# define UVf UVuf
#endif
/*
-=for apidoc_section Compiler directives
+=for apidoc_section $directives
=for apidoc Am||LIKELY|bool expr
# define __has_builtin(x) 0 /* not a clang style compiler */
#endif
-/* ASSUME is like assert(), but it has a benefit in a release build. It is a
- hint to a compiler about a statement of fact in a function call free
- expression, which allows the compiler to generate better machine code.
- In a debug build, ASSUME(x) is a synonym for assert(x). ASSUME(0) means
- the control path is unreachable. In a for loop, ASSUME can be used to hint
- that a loop will run at least X times. ASSUME is based off MSVC's __assume
- intrinsic function, see its documents for more details.
+/*
+=for apidoc Am||ASSUME|bool expr
+C<ASSUME> is like C<assert()>, but it has a benefit in a release build. It is a
+hint to a compiler about a statement of fact in a function call free
+expression, which allows the compiler to generate better machine code. In a
+debug build, C<ASSUME(x)> is a synonym for C<assert(x)>. C<ASSUME(0)> means the
+control path is unreachable. In a for loop, C<ASSUME> can be used to hint that
+a loop will run at least X times. C<ASSUME> is based off MSVC's C<__assume>
+intrinsic function, see its documents for more details.
+
+=cut
*/
-#ifndef DEBUGGING
-# if __has_builtin(__builtin_unreachable) \
- || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5 || __GNUC__ > 4) /* 4.5 -> */
+#ifdef DEBUGGING
+# define ASSUME(x) assert(x)
+# if __has_builtin(__builtin_unreachable)
+# define HAS_BUILTIN_UNREACHABLE
+# elif (defined(__GNUC__) && ( __GNUC__ > 4 \
+ || __GNUC__ == 4 && __GNUC_MINOR__ >= 5))
+# define HAS_BUILTIN_UNREACHABLE
+# endif
+#endif
+
+#if defined(__sun) || (defined(__hpux) && !defined(__GNUC__))
+# ifndef ASSUME
+# define ASSUME(x) /* ASSUME() generates warnings on Solaris */
+# endif
+# define NOT_REACHED
+#elif defined(HAS_BUILTIN_UNREACHABLE)
+# ifndef ASSUME
# define ASSUME(x) ((x) ? (void) 0 : __builtin_unreachable())
-# elif defined(_MSC_VER)
+# endif
+# define NOT_REACHED \
+ STMT_START { \
+ ASSUME(!"UNREACHABLE"); __builtin_unreachable(); \
+ } STMT_END
+#else
+# if defined(_MSC_VER)
# define ASSUME(x) __assume(x)
# elif defined(__ARMCC_VERSION) /* untested */
# define ASSUME(x) __promise(x)
# else
-/* a random compiler might define assert to its own special optimization token
- so pass it through to C lib as a last resort */
+ /* a random compiler might define assert to its own special optimization
+ * token so pass it through to C lib as a last resort */
# define ASSUME(x) assert(x)
# endif
-#else
-# define ASSUME(x) assert(x)
-#endif
-
-#if defined(__sun) /* ASSUME() generates warnings on Solaris */
-# define NOT_REACHED
-#elif defined(DEBUGGING) && (__has_builtin(__builtin_unreachable) \
- || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5 || __GNUC__ > 4)) /* 4.5 -> */
-# define NOT_REACHED STMT_START { ASSUME(!"UNREACHABLE"); __builtin_unreachable(); } STMT_END
-#else
# define NOT_REACHED ASSUME(!"UNREACHABLE")
#endif
+#undef HAS_BUILTIN_UNREACHABLE
/* Some unistd.h's give a prototype for pause() even though
HAS_PAUSE ends up undefined. This causes the #define
#ifndef PERL_CALLCONV
# ifdef __cplusplus
-# define PERL_CALLCONV extern "C"
+# define PERL_CALLCONV EXTERN_C
# else
# define PERL_CALLCONV
# endif
#ifndef PERL_STATIC_NO_RET
# define PERL_STATIC_NO_RET STATIC
#endif
-/* PERL_STATIC_NO_RET is supposed to be equivalent to PERL_STATIC_INLINE on
- builds that dont have a noreturn as a declaration specifier
+
+/* PERL_STATIC_INLINE_NO_RET is supposed to be equivalent to PERL_STATIC_INLINE
+ * on builds that dont have a noreturn as a declaration specifier
*/
#ifndef PERL_STATIC_INLINE_NO_RET
# define PERL_STATIC_INLINE_NO_RET PERL_STATIC_INLINE
/* This may look like unnecessary jumping through hoops, but converting
out of range floating point values to integers *is* undefined behaviour,
and it is starting to bite.
+
+=for apidoc_section $casting
+=for apidoc Am|I32|I_32|NV what
+Cast an NV to I32 while avoiding undefined C behavior
+
+=for apidoc Am|U32|U_32|NV what
+Cast an NV to U32 while avoiding undefined C behavior
+
+=for apidoc Am|IV|I_V|NV what
+Cast an NV to IV while avoiding undefined C behavior
+
+=for apidoc Am|UV|U_V|NV what
+Cast an NV to UV while avoiding undefined C behavior
+
+=cut
*/
#ifndef CAST_INLINE
#define I_32(what) (cast_i32((NV)(what)))
#define U_I(what) ((unsigned int)U_32(what))
#define U_L(what) U_32(what)
+/*
+=for apidoc_section $integer
+=for apidoc Amn|IV|IV_MAX
+The largest signed integer that fits in an IV on this platform.
+
+=for apidoc Amn|IV|IV_MIN
+The negative signed integer furthest away from 0 that fits in an IV on this
+platform.
+
+=for apidoc Amn|UV|UV_MAX
+The largest unsigned integer that fits in a UV on this platform.
+
+=for apidoc Amn|UV|UV_MIN
+The smallest unsigned integer that fits in a UV on this platform. It should
+equal zero.
+
+=cut
+*/
+
#ifdef HAS_SIGNBIT
# ifndef Perl_signbit
# define Perl_signbit signbit
INIT("0");
/*
-=for apidoc_section Numeric Functions
+=for apidoc_section $numeric
=for apidoc AmTuU|const char *|PL_hexdigit|U8 value
This array, indexed by an integer, converts that value into the character that
* byte ones (as they are always legal) are to this state.
*/
-# define NUM_CLASSES 18
-# define N0 0
-# define N1 ((N0) + NUM_CLASSES)
-# define N2 ((N1) + NUM_CLASSES)
-# define N3 ((N2) + NUM_CLASSES)
-# define N4 ((N3) + NUM_CLASSES)
-# define N5 ((N4) + NUM_CLASSES)
-# define N6 ((N5) + NUM_CLASSES)
-# define N7 ((N6) + NUM_CLASSES)
-# define N8 ((N7) + NUM_CLASSES)
-# define N9 ((N8) + NUM_CLASSES)
-# define N10 ((N9) + NUM_CLASSES)
+# if defined(PERL_CORE)
+# define NUM_CLASSES 18
+# define N0 0
+# define N1 ((N0) + NUM_CLASSES)
+# define N2 ((N1) + NUM_CLASSES)
+# define N3 ((N2) + NUM_CLASSES)
+# define N4 ((N3) + NUM_CLASSES)
+# define N5 ((N4) + NUM_CLASSES)
+# define N6 ((N5) + NUM_CLASSES)
+# define N7 ((N6) + NUM_CLASSES)
+# define N8 ((N7) + NUM_CLASSES)
+# define N9 ((N8) + NUM_CLASSES)
+# define N10 ((N9) + NUM_CLASSES)
/*Class: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 */
/*N0*/ 0, 1,N1,N2,N3,N4,N5, 1, 1, 1, 1, 1, 1,N6,N7,N8,N9,N10,
* byte ones (as they are always legal) are to this state.
*/
-# undef N0
-# undef N1
-# undef N2
-# undef N3
-# undef N4
-# undef N5
-# undef N6
-# undef N7
-# undef N8
-# undef N9
-# undef NUM_CLASSES
-# define NUM_CLASSES 19
-# define N0 0
-# define N1 ((N0) + NUM_CLASSES)
-# define N2 ((N1) + NUM_CLASSES)
-# define N3 ((N2) + NUM_CLASSES)
-# define N4 ((N3) + NUM_CLASSES)
-# define N5 ((N4) + NUM_CLASSES)
-# define N6 ((N5) + NUM_CLASSES)
-# define N7 ((N6) + NUM_CLASSES)
-# define N8 ((N7) + NUM_CLASSES)
-# define N9 ((N8) + NUM_CLASSES)
-# define N10 ((N9) + NUM_CLASSES)
-# define N11 ((N10) + NUM_CLASSES)
+# undef N0
+# undef N1
+# undef N2
+# undef N3
+# undef N4
+# undef N5
+# undef N6
+# undef N7
+# undef N8
+# undef N9
+# undef NUM_CLASSES
+# define NUM_CLASSES 19
+# define N0 0
+# define N1 ((N0) + NUM_CLASSES)
+# define N2 ((N1) + NUM_CLASSES)
+# define N3 ((N2) + NUM_CLASSES)
+# define N4 ((N3) + NUM_CLASSES)
+# define N5 ((N4) + NUM_CLASSES)
+# define N6 ((N5) + NUM_CLASSES)
+# define N7 ((N6) + NUM_CLASSES)
+# define N8 ((N7) + NUM_CLASSES)
+# define N9 ((N8) + NUM_CLASSES)
+# define N10 ((N9) + NUM_CLASSES)
+# define N11 ((N10) + NUM_CLASSES)
/*Class: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 */
/*N0*/ 0, 1, N1, N2, N4, N7, N6, N3, N5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
* byte ones (as they are always legal) are to this state.
*/
-# undef N0
-# undef N1
-# undef N2
-# undef N3
-# undef N4
-# undef N5
-# undef N6
-# undef N7
-# undef NUM_CLASSES
-# define NUM_CLASSES 12
-# define N0 0
-# define N1 ((N0) + NUM_CLASSES)
-# define N2 ((N1) + NUM_CLASSES)
-# define N3 ((N2) + NUM_CLASSES)
-# define N4 ((N3) + NUM_CLASSES)
-# define N5 ((N4) + NUM_CLASSES)
-# define N6 ((N5) + NUM_CLASSES)
-# define N7 ((N6) + NUM_CLASSES)
+# undef N0
+# undef N1
+# undef N2
+# undef N3
+# undef N4
+# undef N5
+# undef N6
+# undef N7
+# undef NUM_CLASSES
+# define NUM_CLASSES 12
+# define N0 0
+# define N1 ((N0) + NUM_CLASSES)
+# define N2 ((N1) + NUM_CLASSES)
+# define N3 ((N2) + NUM_CLASSES)
+# define N4 ((N3) + NUM_CLASSES)
+# define N5 ((N4) + NUM_CLASSES)
+# define N6 ((N5) + NUM_CLASSES)
+# define N7 ((N6) + NUM_CLASSES)
/*Class: 0 1 2 3 4 5 6 7 8 9 10 11 */
/*N0*/ 0, 1, N1, N2, N5, N7, N3, N4, N6, 1, 1, 1,
/*N7*/ 1, 1, 1, 1, 1, 1, 1, 1, 1, N2, 1, 1,
};
+# endif /* defined(PERL_CORE) */
# else /* End of is DOINIT */
EXTCONST U8 PL_extended_utf8_dfa_tab[];
# endif
#endif /* end of isn't EBCDIC */
-#ifndef PERL_NO_INLINE_FUNCTIONS
-/* Static inline funcs that depend on includes and declarations above.
- Some of these reference functions in the perl object files, and some
- compilers aren't smart enough to eliminate unused static inline
- functions, so including this file in source code can cause link errors
- even if the source code uses none of the functions. Hence including these
- can be suppressed by setting PERL_NO_INLINE_FUNCTIONS. Doing this will
- (obviously) result in unworkable XS code, but allows simple probing code
- to continue to work, because it permits tests to include the perl headers
- for definitions without creating a link dependency on the perl library
- (which may not exist yet).
-*/
-
-# include "inline.h"
-#endif
-
#include "overload.h"
END_EXTERN_C
cBOOL(PL_hints & (HINT_LOCALE|HINT_LOCALE_PARTIAL))
/*
-=for apidoc_section Locales
+=for apidoc_section $locale
=for apidoc Amn|bool|IN_LOCALE
#endif
-/* Locale/thread synchronization macros. These aren't needed if using
- * thread-safe locale operations, except if something is broken */
-#if defined(USE_LOCALE) \
- && defined(USE_ITHREADS) \
- && (! defined(USE_THREAD_SAFE_LOCALE) || defined(TS_W32_BROKEN_LOCALECONV))
+/* Locale/thread synchronization macros. */
+#if ! ( defined(USE_LOCALE) \
+ && defined(USE_ITHREADS) \
+ && ( ! defined(USE_THREAD_SAFE_LOCALE) \
+ || ( defined(HAS_LOCALECONV) \
+ && ( ! defined(HAS_LOCALECONV_L) \
+ || defined(TS_W32_BROKEN_LOCALECONV))) \
+ || ( defined(HAS_NL_LANGINFO) \
+ && ! defined(HAS_THREAD_SAFE_NL_LANGINFO_L)) \
+ || (defined(HAS_MBLEN) && ! defined(HAS_MBRLEN)) \
+ || (defined(HAS_MBTOWC) && ! defined(HAS_MBRTOWC)) \
+ || (defined(HAS_WCTOMB) && ! defined(HAS_WCRTOMB))))
-/* We have a locale object holding the 'C' locale for Posix 2008 */
-# ifndef USE_POSIX_2008_LOCALE
-# define _LOCALE_TERM_POSIX_2008 NOOP
-# else
-# define _LOCALE_TERM_POSIX_2008 \
- STMT_START { \
- if (PL_C_locale_obj) { \
- /* Make sure we aren't using the locale \
- * space we are about to free */ \
- uselocale(LC_GLOBAL_LOCALE); \
- freelocale(PL_C_locale_obj); \
- PL_C_locale_obj = (locale_t) NULL; \
- } \
- } STMT_END
-# endif
+/* The whole expression just above was complemented, so here we have no need
+ * for thread synchronization, most likely it would be that this isn't a
+ * threaded build. */
+# define LOCALE_INIT
+# define LOCALE_TERM
+# define LC_NUMERIC_LOCK(cond) NOOP
+# define LC_NUMERIC_UNLOCK NOOP
+# define LOCALECONV_LOCK NOOP
+# define LOCALECONV_UNLOCK NOOP
+# define LOCALE_READ_LOCK NOOP
+# define LOCALE_READ_UNLOCK NOOP
+# define MBLEN_LOCK NOOP
+# define MBLEN_UNLOCK NOOP
+# define MBTOWC_LOCK NOOP
+# define MBTOWC_UNLOCK NOOP
+# define NL_LANGINFO_LOCK NOOP
+# define NL_LANGINFO_UNLOCK NOOP
+# define SETLOCALE_LOCK NOOP
+# define SETLOCALE_UNLOCK NOOP
+# define WCTOMB_LOCK NOOP
+# define WCTOMB_UNLOCK NOOP
+#else
-/* This is used as a generic lock for locale operations. For example this is
- * used when calling nl_langinfo() so that another thread won't zap the
- * contents of its buffer before it gets saved; and it's called when changing
- * the locale of LC_MESSAGES. On some systems the latter can cause the
- * nl_langinfo buffer to be zapped under a race condition.
- *
- * If combined with LC_NUMERIC_LOCK, calls to this and its corresponding unlock
- * should be contained entirely within the locked portion of LC_NUMERIC. This
- * mutex should be used only in very short sections of code, while
- * LC_NUMERIC_LOCK may span more operations. By always following this
- * convention, deadlock should be impossible. But if necessary, the two
- * mutexes could be combined.
- *
- * Actually, the two macros just below with the '_V' suffixes are used in just
- * a few places where there is a broken localeconv(), but otherwise things are
- * thread safe, and hence don't need locking. Just below LOCALE_LOCK and
- * LOCALE_UNLOCK are defined in terms of these for use everywhere else */
-# define LOCALE_LOCK_V \
+ /* Here, we will need critical sections in locale handling, because one or
+ * more of the above conditions are true. This could be because the
+ * platform doesn't have thread-safe locales, or that at least one of the
+ * locale-dependent functions in the core isn't thread-safe. The latter
+ * case is generally because they return a pointer to a static buffer, which
+ * may be per-process instead of per-thread. There are supposedly
+ * re-entrant, safe versions for all of them Perl currently uses (which the
+ * #if above checks for), but most platforms don't have all the needed ones
+ * available, and the Posix standard doesn't require nl_langinfo_l() to be
+ * fully thread-safe, so a Configure probe was written. localeconv_l() is
+ * uncommon, and judging by bug reports on the web, some earlier library
+ * localeconv_l versions were broken, so perhaps a probe is in order for
+ * that, but it would be a pain to write.
+ *
+ * On non-thread-safe systems, some of the above functions are vulnerable to
+ * races should another thread get control and change the locale in the
+ * middle of their execution.
+ *
+ * We currently use a single mutex for all these cases. This solves both
+ * the problem of another thread changing the locale, and the buffer being
+ * overwritten (the code copies the results to a safe place before releasing
+ * the mutex). Ideally, for locale thread-safe platforms where the only
+ * issue is another thread clobbering the function's static buffer, there
+ * would be a separate mutex for each such buffer. Otherwise, things get
+ * locked that don't need to. But, it is not expected that any of these
+ * will be called frequently, and the locked interval should be short, and
+ * modern platforms will have reentrant versions (which don't lock) for
+ * almost all of them, so khw thinks a single mutex should suffice. */
+# define LOCALE_LOCK_ \
STMT_START { \
DEBUG_Lv(PerlIO_printf(Perl_debug_log, \
"%s: %d: locking locale\n", __FILE__, __LINE__)); \
MUTEX_LOCK(&PL_locale_mutex); \
} STMT_END
-# define LOCALE_UNLOCK_V \
+# define LOCALE_UNLOCK_ \
STMT_START { \
DEBUG_Lv(PerlIO_printf(Perl_debug_log, \
"%s: %d: unlocking locale\n", __FILE__, __LINE__)); \
MUTEX_UNLOCK(&PL_locale_mutex); \
} STMT_END
-/* On windows, we just need the mutex for LOCALE_LOCK */
-# ifdef TS_W32_BROKEN_LOCALECONV
-# define LOCALE_LOCK NOOP
-# define LOCALE_UNLOCK NOOP
-# define LOCALE_INIT MUTEX_INIT(&PL_locale_mutex);
-# define LOCALE_TERM MUTEX_DESTROY(&PL_locale_mutex)
-# define LC_NUMERIC_LOCK(cond)
-# define LC_NUMERIC_UNLOCK
+ /* We do define a different macro for each case; then if we want to have
+ * separate mutexes for some of them, the only changes needed are here.
+ * Define just the necessary macros. The compiler should then croak if the
+ * #ifdef's in the code are incorrect */
+# if defined(HAS_LOCALECONV) && ( ! defined(HAS_POSIX_2008_LOCALE) \
+ || ! defined(HAS_LOCALECONV_L) \
+ || defined(TS_W32_BROKEN_LOCALECONV))
+# define LOCALECONV_LOCK LOCALE_LOCK_
+# define LOCALECONV_UNLOCK LOCALE_UNLOCK_
+# endif
+# if defined(HAS_NL_LANGINFO) && ( ! defined(HAS_THREAD_SAFE_NL_LANGINFO_L) \
+ || ! defined(HAS_POSIX_2008_LOCALE))
+# define NL_LANGINFO_LOCK LOCALE_LOCK_
+# define NL_LANGINFO_UNLOCK LOCALE_UNLOCK_
+# endif
+# if defined(HAS_MBLEN) && ! defined(HAS_MBRLEN)
+# define MBLEN_LOCK LOCALE_LOCK_
+# define MBLEN_UNLOCK LOCALE_UNLOCK_
+# endif
+# if defined(HAS_MBTOWC) && ! defined(HAS_MBRTOWC)
+# define MBTOWC_LOCK LOCALE_LOCK_
+# define MBTOWC_UNLOCK LOCALE_UNLOCK_
+# endif
+# if defined(HAS_WCTOMB) && ! defined(HAS_WCRTOMB)
+# define WCTOMB_LOCK LOCALE_LOCK_
+# define WCTOMB_UNLOCK LOCALE_UNLOCK_
+# endif
+# if defined(USE_THREAD_SAFE_LOCALE)
+ /* On locale thread-safe systems, we don't need these workarounds */
+# define LOCALE_TERM_LC_NUMERIC_ NOOP
+# define LOCALE_INIT_LC_NUMERIC_ NOOP
+# define LC_NUMERIC_LOCK(cond) NOOP
+# define LC_NUMERIC_UNLOCK NOOP
+# define LOCALE_INIT_LC_NUMERIC_ NOOP
+# define LOCALE_TERM_LC_NUMERIC_ NOOP
+
+ /* There may be instance core where we this is invoked yet should do
+ * nothing. Rather than have #ifdef's around them, define it here */
+# define SETLOCALE_LOCK NOOP
+# define SETLOCALE_UNLOCK NOOP
# else
-# define LOCALE_LOCK LOCALE_LOCK_V
-# define LOCALE_UNLOCK LOCALE_UNLOCK_V
-
- /* We also need to lock LC_NUMERIC for non-windows (hence Posix 2008)
- * systems */
-# define LOCALE_INIT STMT_START { \
- MUTEX_INIT(&PL_locale_mutex); \
- MUTEX_INIT(&PL_lc_numeric_mutex); \
- } STMT_END
-
-# define LOCALE_TERM STMT_START { \
- MUTEX_DESTROY(&PL_locale_mutex); \
- MUTEX_DESTROY(&PL_lc_numeric_mutex); \
- _LOCALE_TERM_POSIX_2008; \
- } STMT_END
-
- /* This mutex is used to create critical sections where we want the
- * LC_NUMERIC locale to be locked into either the C (standard) locale, or
- * the underlying locale, so that other threads interrupting this one don't
- * change it to the wrong state before we've had a chance to complete our
- * operation. It can stay locked over an entire printf operation, for
- * example. And so is made distinct from the LOCALE_LOCK mutex.
+# define SETLOCALE_LOCK LOCALE_LOCK_
+# define SETLOCALE_UNLOCK LOCALE_UNLOCK_
+
+ /* On platforms without per-thread locales, when another thread can switch
+ * our locale, we need another mutex to create critical sections where we
+ * want the LC_NUMERIC locale to be locked into either the C (standard)
+ * locale, or the underlying locale, so that other threads interrupting
+ * this one don't change it to the wrong state before we've had a chance to
+ * complete our operation. It can stay locked over an entire printf
+ * operation, for example. And so is made distinct from the LOCALE_LOCK
+ * mutex.
*
* This simulates kind of a general semaphore. The current thread will
* lock the mutex if the per-thread variable is zero, and then increments
*
* Clang improperly gives warnings for this, if not silenced:
* https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#conditional-locks
- * */
+ *
+ * If LC_NUMERIC_LOCK is combined with one of the LOCKs above, calls to
+ * that and its corresponding unlock should be contained entirely within
+ * the locked portion of LC_NUMERIC. Those mutexes should be used only in
+ * very short sections of code, while LC_NUMERIC_LOCK may span more
+ * operations. By always following this convention, deadlock should be
+ * impossible. But if necessary, the two mutexes could be combined. */
# define LC_NUMERIC_LOCK(cond_to_panic_if_already_locked) \
CLANG_DIAG_IGNORE(-Wthread-safety) \
STMT_START { \
} STMT_END \
CLANG_DIAG_RESTORE
-# endif /* End of needs locking LC_NUMERIC */
-#else /* Below is no locale sync needed */
-# define LOCALE_INIT
-# define LOCALE_LOCK
-# define LOCALE_LOCK_V
-# define LOCALE_UNLOCK
-# define LOCALE_UNLOCK_V
-# define LC_NUMERIC_LOCK(cond)
-# define LC_NUMERIC_UNLOCK
-# define LOCALE_TERM
+# define LOCALE_INIT_LC_NUMERIC_ MUTEX_INIT(&PL_lc_numeric_mutex)
+# define LOCALE_TERM_LC_NUMERIC_ MUTEX_DESTROY(&PL_lc_numeric_mutex)
+# endif
+
+# ifdef USE_POSIX_2008_LOCALE
+ /* We have a locale object holding the 'C' locale for Posix 2008 */
+# define LOCALE_TERM_POSIX_2008_ \
+ STMT_START { \
+ if (PL_C_locale_obj) { \
+ /* Make sure we aren't using the locale \
+ * space we are about to free */ \
+ uselocale(LC_GLOBAL_LOCALE); \
+ freelocale(PL_C_locale_obj); \
+ PL_C_locale_obj = (locale_t) NULL; \
+ } \
+ } STMT_END
+# else
+# define LOCALE_TERM_POSIX_2008_ NOOP
+# endif
+
+# define LOCALE_INIT STMT_START { \
+ MUTEX_INIT(&PL_locale_mutex); \
+ LOCALE_INIT_LC_NUMERIC_; \
+ } STMT_END
+
+# define LOCALE_TERM STMT_START { \
+ MUTEX_DESTROY(&PL_locale_mutex); \
+ LOCALE_TERM_LC_NUMERIC_; \
+ LOCALE_TERM_POSIX_2008_; \
+ } STMT_END
#endif
#ifdef USE_LOCALE_NUMERIC
* operations used by Perl, namely the decimal point, and even the thousands
* separator.)
-=for apidoc_section Locales
+=for apidoc_section $locale
=for apidoc Amn|void|DECLARATION_FOR_LC_NUMERIC_MANIPULATION
#endif /* !USE_LOCALE_NUMERIC */
+#ifdef USE_ITHREADS
+# define ENV_LOCK PERL_WRITE_LOCK(&PL_env_mutex)
+# define ENV_UNLOCK PERL_WRITE_UNLOCK(&PL_env_mutex)
+# define ENV_READ_LOCK PERL_READ_LOCK(&PL_env_mutex)
+# define ENV_READ_UNLOCK PERL_READ_UNLOCK(&PL_env_mutex)
+# define ENV_INIT PERL_RW_MUTEX_INIT(&PL_env_mutex)
+# define ENV_TERM PERL_RW_MUTEX_DESTROY(&PL_env_mutex)
+
+ /* On platforms where the static buffer contained in getenv() is per-thread
+ * rather than process-wide, another thread executing a getenv() at the same
+ * time won't destroy ours before we have copied the result safely away and
+ * unlocked the mutex. On such platforms (which is most), we can have many
+ * readers of the environment at the same time. */
+# ifdef GETENV_PRESERVES_OTHER_THREAD
+# define GETENV_LOCK ENV_READ_LOCK
+# define GETENV_UNLOCK ENV_READ_UNLOCK
+# else
+ /* If, on the other hand, another thread could zap our getenv() return, we
+ * need to keep them from executing until we are done */
+# define GETENV_LOCK ENV_LOCK
+# define GETENV_UNLOCK ENV_UNLOCK
+# endif
+#else
+# define ENV_LOCK NOOP
+# define ENV_UNLOCK NOOP
+# define ENV_READ_LOCK NOOP
+# define ENV_READ_UNLOCK NOOP
+# define ENV_INIT NOOP
+# define ENV_TERM NOOP
+# define GETENV_LOCK NOOP
+# define GETENV_UNLOCK NOOP
+#endif
+
+#ifndef PERL_NO_INLINE_FUNCTIONS
+/* Static inline funcs that depend on includes and declarations above.
+ Some of these reference functions in the perl object files, and some
+ compilers aren't smart enough to eliminate unused static inline
+ functions, so including this file in source code can cause link errors
+ even if the source code uses none of the functions. Hence including these
+ can be suppressed by setting PERL_NO_INLINE_FUNCTIONS. Doing this will
+ (obviously) result in unworkable XS code, but allows simple probing code
+ to continue to work, because it permits tests to include the perl headers
+ for definitions without creating a link dependency on the perl library
+ (which may not exist yet).
+*/
+
+START_EXTERN_C
+
+# include "inline.h"
+
+END_EXTERN_C
+
+#endif
+
+/* Some critical sections need to lock both the locale and the environment.
+ * XXX khw intends to change this to lock both mutexes, but that brings up
+ * issues of potential deadlock, so should be done at the beginning of a
+ * development cycle. So for now, it just locks the environment. Note that
+ * many modern platforms are locale-thread-safe anyway, so locking the locale
+ * mutex is a no-op anyway */
+#define ENV_LOCALE_LOCK ENV_LOCK
+#define ENV_LOCALE_UNLOCK ENV_UNLOCK
+
+/* And some critical sections care only that no one else is writing either the
+ * locale nor the environment. XXX Again this is for the future. This can be
+ * simulated with using COND_WAIT in thread.h */
+#define ENV_LOCALE_READ_LOCK ENV_LOCALE_LOCK
+#define ENV_LOCALE_READ_UNLOCK ENV_LOCALE_UNLOCK
+
#define Atof my_atof
/*
-=for apidoc_section Numeric Functions
+=for apidoc_section $numeric
=for apidoc AmTR|NV|Strtod|NN const char * const s|NULLOK char ** e
# define _aMY_CXT ,aMY_CXT
#else /* PERL_IMPLICIT_CONTEXT */
-
# define START_MY_CXT static my_cxt_t my_cxt;
-# define dMY_CXT_SV dNOOP
# define dMY_CXT dNOOP
# define dMY_CXT_INTERP(my_perl) dNOOP
# define MY_CXT_INIT NOOP
#define IS_NUMBER_TRAILING 0x40 /* number has trailing trash */
/*
-=for apidoc_section Numeric Functions
+=for apidoc_section $numeric
=for apidoc AmdR|bool|GROK_NUMERIC_RADIX|NN const char **sp|NN const char *send
#define PERL_MAGIC_UTF8_CACHESIZE 2
+#ifdef PERL_CORE
+
#define PERL_UNICODE_STDIN_FLAG 0x0001
#define PERL_UNICODE_STDOUT_FLAG 0x0002
#define PERL_UNICODE_STDERR_FLAG 0x0004
#define PERL_UNICODE_WIDESYSCALLS 'W'
#define PERL_UNICODE_UTF8CACHEASSERT 'a'
+#endif
+
/*
-=for apidoc_section Signals
+=for apidoc_section $signals
=for apidoc Amn|U32|PERL_SIGNALS_UNSAFE_FLAG
If this bit in C<PL_signals> is set, the system is uing the pre-Perl 5.8
unsafe signals. See L<perlrun/PERL_SIGNALS> and L<perlipc/Deferred Signals
#define PERL_SIGNALS_UNSAFE_FLAG 0x0001
/*
-=for apidoc_section Numeric Functions
+=for apidoc_section $numeric
-=for apidoc Am|int|PERL_ABS|int
+=for apidoc Am|int|PERL_ABS|int x
Typeless C<abs> or C<fabs>, I<etc>. (The usage below indicates it is for
integers, but it works for any type.) Use instead of these, since the C
/*
-=for apidoc_section Utility Functions
+=for apidoc_section $utility
=for apidoc Am|bool|IS_SAFE_SYSCALL|NN const char *pv|STRLEN len|NN const char *what|NN const char *op_name