This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.h: Use handy.h constants
authorKarl Williamson <public@khwilliamson.com>
Mon, 9 Jul 2012 21:17:28 +0000 (15:17 -0600)
committerKarl Williamson <public@khwilliamson.com>
Wed, 25 Jul 2012 03:13:49 +0000 (21:13 -0600)
This synchronizes the ANYOF_FOO usages to the isFOO() usages.  Future
commits will take advantage of this relationship.

handy.h
regcomp.h

diff --git a/handy.h b/handy.h
index 62752a8..e793039 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -599,13 +599,14 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
  * digits */
 #define isOCTAL_A(c)  cBOOL(FITS_IN_8_BITS(c) && (0xF8 & (c)) == '0')
 
-
 /* ASCII range only */
 #ifdef H_PERL       /* If have access to perl.h, lookup in its table */
 
-/* Character class numbers.  These are used in PL_charclass[].  These use names
- * used in l1_char_class_tab.h but their actual definitions are here.  If that
- * has a name not used here, it won't compile. */
+/* Character class numbers.  These are used in PL_charclass[] and the ones
+ * up through the one that corresponds to <_HIGHEST_REGCOMP_DOT_H_SYNC> are
+ * used by regcomp.h.  These use names used in l1_char_class_tab.h but their
+ * actual definitions are here.  If that has a name not used here, it won't
+ * compile. */
 #  define _CC_WORDCHAR           0
 #  define _CC_SPACE              1
 #  define _CC_DIGIT              2
@@ -621,6 +622,8 @@ patched there.  The file as of this writing is cpan/Devel-PPPort/parts/inc/misc
 #  define _CC_XDIGIT            12
 #  define _CC_PSXSPC            13
 #  define _CC_BLANK             14
+#  define _HIGHEST_REGCOMP_DOT_H_SYNC _CC_BLANK
+
 #  define _CC_IDFIRST           15
 #  define _CC_CHARNAME_CONT     16
 #  define _CC_NONLATIN1_FOLD    17
index 1fb6059..6eb13f2 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -387,38 +387,41 @@ struct regnode_charclass_class {
 /* Should be synchronized with a table in regprop() */
 /* 2n should be the normal one, paired with its complement at 2n+1 */
 
-#define ANYOF_ALNUM     0      /* \w, PL_utf8_alnum, utf8::IsWord, ALNUM */
-#define ANYOF_NALNUM    1
-#define ANYOF_SPACE     2      /* \s */
-#define ANYOF_NSPACE    3
-#define ANYOF_DIGIT     4      /* \d */
-#define ANYOF_NDIGIT    5
-#define ANYOF_ALNUMC    6      /* [[:alnum:]] isalnum(3), utf8::IsAlnum, ALNUMC */
-#define ANYOF_NALNUMC   7
-#define ANYOF_ALPHA     8
-#define ANYOF_NALPHA    9
-#define ANYOF_ASCII    10
-#define ANYOF_NASCII   11
-#define ANYOF_CNTRL    12
-#define ANYOF_NCNTRL   13
-#define ANYOF_GRAPH    14
-#define ANYOF_NGRAPH   15
-#define ANYOF_LOWER    16
-#define ANYOF_NLOWER   17
-#define ANYOF_PRINT    18
-#define ANYOF_NPRINT   19
-#define ANYOF_PUNCT    20
-#define ANYOF_NPUNCT   21
-#define ANYOF_UPPER    22
-#define ANYOF_NUPPER   23
-#define ANYOF_XDIGIT   24
-#define ANYOF_NXDIGIT  25
-#define ANYOF_PSXSPC   26      /* POSIX space: \s plus the vertical tab */
-#define ANYOF_NPSXSPC  27
-#define ANYOF_BLANK    28      /* GNU extension: space and tab: non-vertical space */
-#define ANYOF_NBLANK   29
+#define ANYOF_ALNUM    ((_CC_WORDCHAR) * 2)  /* \w, PL_utf8_alnum, utf8::IsWord, ALNUM */
+#define ANYOF_NALNUM   ((ANYOF_ALNUM) + 1)
+#define ANYOF_SPACE    ((_CC_SPACE) * 2)     /* \s */
+#define ANYOF_NSPACE   ((ANYOF_SPACE) + 1)
+#define ANYOF_DIGIT    ((_CC_DIGIT) * 2)     /* \d */
+#define ANYOF_NDIGIT   ((ANYOF_DIGIT) + 1)
+#define ANYOF_ALNUMC   ((_CC_ALNUMC) * 2)    /* [[:alnum:]] isalnum(3), utf8::IsAlnum, ALNUMC */
+#define ANYOF_NALNUMC  ((ANYOF_ALNUMC) + 1)
+#define ANYOF_ALPHA    ((_CC_ALPHA) * 2)
+#define ANYOF_NALPHA   ((ANYOF_ALPHA) + 1)
+#define ANYOF_ASCII    ((_CC_ASCII) * 2)
+#define ANYOF_NASCII   ((ANYOF_ASCII) + 1)
+#define ANYOF_CNTRL    ((_CC_CNTRL) * 2)
+#define ANYOF_NCNTRL   ((ANYOF_CNTRL) + 1)
+#define ANYOF_GRAPH    ((_CC_GRAPH) * 2)
+#define ANYOF_NGRAPH   ((ANYOF_GRAPH) + 1)
+#define ANYOF_LOWER    ((_CC_LOWER) * 2)
+#define ANYOF_NLOWER   ((ANYOF_LOWER) + 1)
+#define ANYOF_PRINT    ((_CC_PRINT) * 2)
+#define ANYOF_NPRINT   ((ANYOF_PRINT) + 1)
+#define ANYOF_PUNCT    ((_CC_PUNCT) * 2)
+#define ANYOF_NPUNCT   ((ANYOF_PUNCT) + 1)
+#define ANYOF_UPPER    ((_CC_UPPER) * 2)
+#define ANYOF_NUPPER   ((ANYOF_UPPER) + 1)
+#define ANYOF_XDIGIT   ((_CC_XDIGIT) * 2)
+#define ANYOF_NXDIGIT  ((ANYOF_XDIGIT) + 1)
+#define ANYOF_PSXSPC   ((_CC_PSXSPC) * 2)    /* POSIX space: \s plus the vertical tab */
+#define ANYOF_NPSXSPC  ((ANYOF_PSXSPC) + 1)
+#define ANYOF_BLANK    ((_CC_BLANK) * 2)     /* GNU extension: space and tab: non-vertical space */
+#define ANYOF_NBLANK   ((ANYOF_BLANK) + 1)
 
 #define ANYOF_MAX      32
+#if (ANYOF_MAX <= _HIGHEST_REGCOMP_DOT_H_SYNC * 2 + 1)
+#   error Problem with handy.h _CC_foo #defines
+#endif
 
 /* pseudo classes, not stored in the class bitmap, but used as flags
    during compilation of char classes */