]> code.delx.au - gnu-emacs/blobdiff - src/regex.h
(move_it_vertically_backward): Eliminate two xasserts.
[gnu-emacs] / src / regex.h
index d0c32d50d27cc3cbd06a1be1ebd2e206d9a4f96d..2cdb02993b1f6103341b81cc9accdd300ba4fa58 100644 (file)
@@ -144,19 +144,22 @@ typedef unsigned long int reg_syntax_t;
    If not set, then the GNU regex operators are recognized. */
 #define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
 
+/* If this bit is set, then *?, +? and ?? match non greedily. */
+#define RE_FRUGAL (RE_NO_GNU_OPS << 1)
+
+/* If this bit is set, then (?:...) is treated as a shy group.  */
+#define RE_SHY_GROUPS (RE_FRUGAL << 1)
+
+/* If this bit is set, ^ and $ only match at beg/end of buffer.  */
+#define RE_NO_NEWLINE_ANCHOR (RE_SHY_GROUPS << 1)
+
 /* If this bit is set, turn on internal regex debugging.
    If not set, and debugging was on, turn it off.
    This only works if regex.c is compiled -DDEBUG.
    We define this bit always, so that all that's needed to turn on
    debugging is to recompile regex.c; the calling code can always have
    this bit set, and it won't affect anything in the normal case. */
-#define RE_DEBUG (RE_NO_GNU_OPS << 1)
-
-/* If this bit is set, then *?, +? and ?? match non greedily. */
-#define RE_FRUGAL (RE_DEBUG << 1)
-
-/* If this bit is set, then (?:...) is treated as a shy group.  */
-#define RE_SHY_GROUPS (RE_FRUGAL << 1)
+#define RE_DEBUG (RE_NO_NEWLINE_ANCHOR << 1)
 
 /* This global variable defines the particular regexp syntax to use (for
    some interfaces).  When a regexp is compiled, the syntax used is
@@ -313,7 +316,8 @@ typedef enum
   /* Error codes we've added.  */
   REG_EEND,            /* Premature end.  */
   REG_ESIZE,           /* Compiled pattern bigger than 2^16 bytes.  */
-  REG_ERPAREN          /* Unmatched ) or \); not returned from regcomp.  */
+  REG_ERPAREN,         /* Unmatched ) or \); not returned from regcomp.  */
+  REG_ERANGEX          /* Range striding over charsets.  */
 } reg_errcode_t;
 \f
 /* This data structure represents a compiled pattern.  Before calling
@@ -335,10 +339,10 @@ struct re_pattern_buffer
   unsigned char *buffer;
 
        /* Number of bytes to which `buffer' points.  */
-  unsigned long int allocated;
+  size_t allocated;
 
        /* Number of bytes actually used in `buffer'.  */
-  unsigned long int used;
+  size_t used;
 
         /* Syntax setting with which the pattern was compiled.  */
   reg_syntax_t syntax;
@@ -387,9 +391,6 @@ struct re_pattern_buffer
         /* Similarly for an end-of-line anchor.  */
   unsigned not_eol : 1;
 
-        /* If true, an anchor at a newline matches.  */
-  unsigned newline_anchor : 1;
-
 #ifdef emacs
   /* If true, multi-byte form in the `buffer' should be recognized as a
      multibyte character. */
@@ -535,10 +536,12 @@ extern int re_exec _RE_ARGS ((const char *));
 #  endif
 # endif
 #endif
-/* For now unconditionally define __restrict_arr to expand to nothing.
+/* For now conditionally define __restrict_arr to expand to nothing.
    Ideally we would have a test for the compiler which allows defining
    it to restrict.  */
-#define __restrict_arr
+#ifndef __restrict_arr
+# define __restrict_arr
+#endif
 
 /* POSIX compatibility.  */
 extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
@@ -560,6 +563,49 @@ extern void regfree _RE_ARGS ((regex_t *__preg));
 }
 #endif /* C++ */
 
+/* For platform which support the ISO C amendement 1 functionality we
+   support user defined character classes.  */
+#if WIDE_CHAR_SUPPORT
+/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
+# include <wchar.h>
+# include <wctype.h>
+#endif
+
+#if WIDE_CHAR_SUPPORT
+/* The GNU C library provides support for user-defined character classes
+   and the functions from ISO C amendement 1.  */
+# ifdef CHARCLASS_NAME_MAX
+#  define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
+# else
+/* This shouldn't happen but some implementation might still have this
+   problem.  Use a reasonable default value.  */
+#  define CHAR_CLASS_MAX_LENGTH 256
+# endif
+typedef wctype_t re_wctype_t;
+typedef wchar_t re_wchar_t;
+# define re_wctype wctype
+# define re_iswctype iswctype
+# define re_wctype_to_bit(cc) 0
+#else
+# define CHAR_CLASS_MAX_LENGTH  9 /* Namely, `multibyte'.  */
+# define btowc(c) c
+
+/* Character classes.  */
+typedef enum { RECC_ERROR = 0,
+              RECC_ALNUM, RECC_ALPHA, RECC_WORD,
+              RECC_GRAPH, RECC_PRINT,
+              RECC_LOWER, RECC_UPPER,
+              RECC_PUNCT, RECC_CNTRL,
+              RECC_DIGIT, RECC_XDIGIT,
+              RECC_BLANK, RECC_SPACE,
+              RECC_MULTIBYTE, RECC_NONASCII,
+              RECC_ASCII, RECC_UNIBYTE
+} re_wctype_t;
+
+typedef int re_wchar_t;
+
+#endif /* not WIDE_CHAR_SUPPORT */
+
 #endif /* regex.h */
 \f
 /*
@@ -569,3 +615,6 @@ version-control: t
 trim-versions-without-asking: nil
 End:
 */
+
+/* arch-tag: bda6e3ec-3c02-4237-a55a-01ad2e120083
+   (do not change this comment) */