This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Comment grammar and clarity fix
[perl5.git] / handy.h
diff --git a/handy.h b/handy.h
index d966bfe..18e2d1c 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -208,19 +208,6 @@ typedef U64TYPE U64;
 #   endif
 #endif
 
-/* HMB H.Merijn Brand - a placeholder for preparing Configure patches:
- * 
- * USE_DTRACE  HAS_PSEUDOFORK  HAS_TIMEGM      LOCALTIME_R_NEEDS_TZSET 
- * GMTIME_MAX  GMTIME_MIN      LOCALTIME_MAX   LOCALTIME_MIN
- * HAS_CTIME64 HAS_LOCALTIME64 HAS_GMTIME64    HAS_DIFFTIME64
- * HAS_MKTIME64        HAS_ASCTIME64   HAS_GETADDRINFO HAS_GETNAMEINFO
- * HAS_INETNTOP        HAS_INETPTON    CHARBITS        HAS_PRCTL
- * Not (yet) used at top level, but mention them for metaconfig
- */
-
-/* Mention I8SIZE, U8SIZE, I16SIZE, U16SIZE, I32SIZE, U32SIZE,
-   I64SIZE, and U64SIZE here so that metaconfig pulls them in. */
-
 #if defined(UINT8_MAX) && defined(INT16_MAX) && defined(INT32_MAX)
 
 /* I8_MAX and I8_MIN constants are not defined, as I8 is an ambiguous type.
@@ -592,7 +579,51 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
 
 /* ASCII range only */
 #ifdef H_PERL       /* If have access to perl.h, lookup in its table */
-#   include "l1_char_class_tab.h"
+/* Bits for PL_charclass[] */
+#  define _CC_ALNUMC_A         (1<<0)
+#  define _CC_ALNUMC_L1        (1<<1)
+#  define _CC_ALPHA_A          (1<<2)
+#  define _CC_ALPHA_L1         (1<<3)
+#  define _CC_BLANK_A          (1<<4)
+#  define _CC_BLANK_L1         (1<<5)
+#  define _CC_CHARNAME_CONT    (1<<6)
+#  define _CC_CNTRL_A          (1<<7)
+#  define _CC_CNTRL_L1         (1<<8)
+#  define _CC_DIGIT_A          (1<<9)
+#  define _CC_GRAPH_A          (1<<10)
+#  define _CC_GRAPH_L1         (1<<11)
+#  define _CC_IDFIRST_A        (1<<12)
+#  define _CC_IDFIRST_L1       (1<<13)
+#  define _CC_LOWER_A          (1<<14)
+#  define _CC_LOWER_L1         (1<<15)
+#  define _CC_OCTAL_A          (1<<16)
+#  define _CC_PRINT_A          (1<<17)
+#  define _CC_PRINT_L1         (1<<18)
+#  define _CC_PSXSPC_A         (1<<19)
+#  define _CC_PSXSPC_L1        (1<<20)
+#  define _CC_PUNCT_A          (1<<21)
+#  define _CC_PUNCT_L1         (1<<22)
+#  define _CC_SPACE_A          (1<<23)
+#  define _CC_SPACE_L1         (1<<24)
+#  define _CC_UPPER_A          (1<<25)
+#  define _CC_UPPER_L1         (1<<26)
+#  define _CC_WORDCHAR_A       (1<<27)
+#  define _CC_WORDCHAR_L1      (1<<28)
+#  define _CC_XDIGIT_A         (1<<29)
+#  define _CC_NONLATIN1_FOLD   (1<<30)
+/* Unused
+ *                             (1<<31)
+ */
+
+#  ifdef DOINIT
+EXTCONST  U32 PL_charclass[] = {
+#    include "l1_char_class_tab.h"
+};
+
+#  else /* ! DOINIT */
+EXTCONST U32 PL_charclass[];
+#  endif
+
 #   define isALNUMC_A(c) cBOOL(FITS_IN_8_BITS(c) && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_ALNUMC_A))
 #   define isALPHA_A(c)  cBOOL(FITS_IN_8_BITS(c) && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_ALPHA_A))
 #   define isBLANK_A(c)  cBOOL(FITS_IN_8_BITS(c) && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_BLANK_A))
@@ -609,6 +640,9 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
 #   define isUPPER_A(c)  cBOOL(FITS_IN_8_BITS(c) && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_UPPER_A))
 #   define isWORDCHAR_A(c) cBOOL(FITS_IN_8_BITS(c) && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_WORDCHAR_A))
 #   define isXDIGIT_A(c)  cBOOL(FITS_IN_8_BITS(c) && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_XDIGIT_A))
+    /* Either participates in a fold with a character above 255, or is a
+     * multi-char fold */
+#   define _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(c) ((! cBOOL(FITS_IN_8_BITS(c))) || (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_NONLATIN1_FOLD))
 #else   /* No perl.h. */
 #   define isOCTAL_A(c)  ((c) >= '0' && (c) <= '9')
 #   ifdef EBCDIC
@@ -849,10 +883,13 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
 #define isBLANK_LC_uni(c)      isBLANK(c) /* could be wrong */
 
 #define isALNUM_utf8(p)                is_utf8_alnum(p)
-/* The ID_Start of Unicode is quite limiting: it assumes a L-class
- * character (meaning that you cannot have, say, a CJK character).
- * Instead, let's allow ID_Continue but not digits. */
-#define isIDFIRST_utf8(p)      (is_utf8_idcont(p) && !is_utf8_digit(p))
+/* To prevent S_scan_word in toke.c from hanging, we have to make sure that
+ * IDFIRST is an alnum.  See
+ * http://rt.perl.org/rt3/Ticket/Display.html?id=74022
+ * for more detail than you ever wanted to know about.  This used to be not the
+ * XID version, but we decided to go with the more modern Unicode definition */
+#define isIDFIRST_utf8(p)      (is_utf8_xidfirst(p) && is_utf8_alnum(p))
+#define isIDCONT_utf8(p)       is_utf8_xidcont(p)
 #define isALPHA_utf8(p)                is_utf8_alpha(p)
 #define isSPACE_utf8(p)                is_utf8_space(p)
 #define isDIGIT_utf8(p)                is_utf8_digit(p)
@@ -917,7 +954,7 @@ The XSUB-writer's interface to the C C<malloc> function.
 In 5.9.3, Newx() and friends replace the older New() API, and drops
 the first parameter, I<x>, a debug aid which allowed callers to identify
 themselves.  This aid has been superseded by a new build option,
-PERL_MEM_LOG (see L<perlhack/PERL_MEM_LOG>).  The older API is still
+PERL_MEM_LOG (see L<perlhacktips/PERL_MEM_LOG>).  The older API is still
 there for use in XS modules supporting older perls.
 
 =for apidoc Am|void|Newxc|void* ptr|int nitems|type|cast