* Bringing over SKY PKE disassembler feature from sky branch.
[deliverable/binutils-gdb.git] / gdb / gnu-regex.c
index 770df3ed3368d1a4cf50be3bb928534be56883ef..1c9b6fb57c82b0dfb9dcc0674def35f6c0c51126 100644 (file)
 #if defined STDC_HEADERS && !defined emacs
 # include <stddef.h>
 #else
-/* We need this for `regex.h', and perhaps for the Emacs include files.  */
+/* We need this for `gnu-regex.h', and perhaps for the Emacs include files.  */
 # include <sys/types.h>
 #endif
 
 /* For platform which support the ISO C amendement 1 functionality we
    support user defined character classes.  */
 #if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
-# include <wctype.h>
+ /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
 # include <wchar.h>
-
-/* We have to keep the namespace clean.  */
-# define regfree(preg) __regfree (preg)
-# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
-# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
-# define regerror(errcode, preg, errbuf, errbuf_size) \
-       __regerror(errcode, preg, errbuf, errbuf_size)
-# define re_set_registers(bu, re, nu, st, en) \
-       __re_set_registers (bu, re, nu, st, en)
-# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
-       __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
-# define re_match(bufp, string, size, pos, regs) \
-       __re_match (bufp, string, size, pos, regs)
-# define re_search(bufp, string, size, startpos, range, regs) \
-       __re_search (bufp, string, size, startpos, range, regs)
-# define re_compile_pattern(pattern, length, bufp) \
-       __re_compile_pattern (pattern, length, bufp)
-# define re_set_syntax(syntax) __re_set_syntax (syntax)
-# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
-       __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
-# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
-
-#define btowc __btowc
+# include <wctype.h>
 #endif
 
 /* This is for other GNU distributions with internationalized messages.  */
@@ -164,6 +142,9 @@ char *realloc ();
 /* How many characters in the character set.  */
 # define CHAR_SET_SIZE 256
 
+/* CYGNUS LOCAL: define _REGEX_RE_COMP to get BSD style re_comp and re_exec */
+#define _REGEX_RE_COMP
+
 # ifdef SYNTAX_TABLE
 
 extern char *re_syntax_table;
@@ -204,7 +185,8 @@ init_syntax_once ()
 #endif /* not emacs */
 \f
 /* Get the interface, including the syntax bits.  */
-#include "regex.h"
+/* CYGNUS LOCAL: call it gnu-regex.h, not regex.h, to avoid name conflicts */
+#include "gnu-regex.h"
 
 /* isalpha etc. are used for the character classes.  */
 #include <ctype.h>
@@ -978,7 +960,7 @@ reg_syntax_t re_syntax_options;
    different, incompatible syntaxes.
 
    The argument SYNTAX is a bit mask comprised of the various bits
-   defined in regex.h.  We return the old syntax.  */
+   defined in gnu-regex.h.  We return the old syntax.  */
 
 reg_syntax_t
 re_set_syntax (syntax)
@@ -1000,7 +982,7 @@ weak_alias (__re_set_syntax, re_set_syntax)
 #endif
 \f
 /* This table gives an error message for each of the error codes listed
-   in regex.h.  Obviously the order here has to be same as there.
+   in gnu-regex.h.  Obviously the order here has to be same as there.
    POSIX doesn't require that we do anything for REG_NOERROR,
    but why not be nice?  */
 
@@ -1796,7 +1778,7 @@ static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type
                                                 regnum_t regnum));
 
 /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
-   Returns one of error codes defined in `regex.h', or zero for success.
+   Returns one of error codes defined in `gnu-regex.h', or zero for success.
 
    Assumes the `allocated' (and perhaps `buffer') and `translate'
    fields are set in BUFP on entry.
@@ -2219,7 +2201,10 @@ regex_compile (pattern, size, syntax, bufp)
                        the leading `:' and `[' (but set bits for them).  */
                     if (c == ':' && *p == ']')
                       {
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+/* CYGNUS LOCAL: Skip this code if we don't have btowc().  btowc() is */
+/* defined in the 1994 Amendment 1 to ISO C and may not be present on */
+/* systems where we have wchar.h and wctype.h.   */
+#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_BTOWC)
                         boolean is_lower = STREQ (str, "lower");
                         boolean is_upper = STREQ (str, "upper");
                        wctype_t wt;
@@ -5583,7 +5568,7 @@ re_exec (s)
      routine will report only success or failure, and nothing about the
      registers.
 
-   It returns 0 if it succeeds, nonzero if it doesn't.  (See regex.h for
+   It returns 0 if it succeeds, nonzero if it doesn't.  (See gnu-regex.h for
    the return codes and their meanings.)  */
 
 int
This page took 0.025821 seconds and 4 git commands to generate.