use libdbm.nfs.a if available (libdbm.a is missing dbmclose())
[p5sagit/p5-mst-13.2.git] / regcomp.h
index c679ca4..d6ee2f1 100644 (file)
--- a/regcomp.h
+++ b/regcomp.h
@@ -66,10 +66,10 @@ typedef OP OP_4tree;                        /* Will be redefined later. */
  */
 
 struct regnode_string {
-    U8 flags;
+    U8 str_len;
     U8  type;
     U16 next_off;
-    U8 string[1];
+    char string[1];
 };
 
 struct regnode_1 {
@@ -133,6 +133,12 @@ struct regnode_2 {
 
 #define        OP(p)           ((p)->type)
 #define        OPERAND(p)      (((struct regnode_string *)p)->string)
+#define MASK(p)                ((char*)OPERAND(p))
+#define        STR_LEN(p)      (((struct regnode_string *)p)->str_len)
+#define        STRING(p)       (((struct regnode_string *)p)->string)
+#define STR_SZ(l)      ((l + sizeof(regnode) - 1) / sizeof(regnode))
+#define NODE_SZ_STR(p) (STR_SZ(STR_LEN(p))+1)
+
 #define        NODE_ALIGN(node)
 #define        ARG_LOC(p)      (((struct regnode_1 *)p)->arg1)
 #define        ARG1_LOC(p)     (((struct regnode_2 *)p)->arg1)
@@ -230,7 +236,7 @@ struct regnode_2 {
  */
 #ifndef lint
 #ifndef CHARMASK
-#define        UCHARAT(p)      ((int)*(unsigned char *)(p))
+#define        UCHARAT(p)      ((int)*(U8*)(p))
 #else
 #define        UCHARAT(p)      ((int)*(p)&CHARMASK)
 #endif
@@ -241,14 +247,14 @@ struct regnode_2 {
 #define        FAIL(m) \
     STMT_START {                                                       \
        if (!SIZE_ONLY)                                                 \
-           SAVEDESTRUCTOR(S_clear_re,(void*)PL_regcomp_rx);            \
+           SAVEDESTRUCTOR_X(clear_re,(void*)PL_regcomp_rx);            \
        Perl_croak(aTHX_ "/%.127s/: %s",  PL_regprecomp,m);             \
     } STMT_END
 
 #define        FAIL2(pat,m) \
     STMT_START {                                                       \
        if (!SIZE_ONLY)                                                 \
-           SAVEDESTRUCTOR(S_clear_re,(void*)PL_regcomp_rx);            \
+           SAVEDESTRUCTOR_X(clear_re,(void*)PL_regcomp_rx);            \
        S_re_croak2(aTHX_ "/%.127s/: ",pat,PL_regprecomp,m);            \
     } STMT_END
 
@@ -263,22 +269,22 @@ START_EXTERN_C
 
 #include "regnodes.h"
 
-/* The following have no fixed length. char* since we do strchr on it. */
+/* The following have no fixed length. U8 so we can do strchr() on it. */
 #ifndef DOINIT
-EXTCONST char PL_varies[];
+EXTCONST U8 PL_varies[];
 #else
-EXTCONST char PL_varies[] = {
+EXTCONST U8 PL_varies[] = {
     BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, REFF, REFFL, 
     WHILEM, CURLYM, CURLYN, BRANCHJ, IFTHEN, SUSPEND, CLUMP, 0
 };
 #endif
 
-/* The following always have a length of 1. char* since we do strchr on it. */
-/* (Note that lenght 1 means "one character" under UTF8, not "one octet".) */
+/* The following always have a length of 1. U8 we can do strchr() on it. */
+/* (Note that length 1 means "one character" under UTF8, not "one octet".) */
 #ifndef DOINIT
-EXTCONST char PL_simple[];
+EXTCONST U8 PL_simple[];
 #else
-EXTCONST char PL_simple[] = {
+EXTCONST U8 PL_simple[] = {
     REG_ANY, ANYUTF8, SANY, SANYUTF8, ANYOF, ANYOFUTF8,
     ALNUM, ALNUMUTF8, ALNUML, ALNUMLUTF8,
     NALNUM, NALNUMUTF8, NALNUML, NALNUMLUTF8,