xref: /Universal-ctags/gnulib/regex.c (revision 820c1a8d46849a90376d8eb15b319ac05439f656)
1*820c1a8dSHiroo HAYASHI /* Extended regular expression matching and search library.
2*820c1a8dSHiroo HAYASHI    Copyright (C) 2002-2021 Free Software Foundation, Inc.
3*820c1a8dSHiroo HAYASHI    This file is part of the GNU C Library.
4*820c1a8dSHiroo HAYASHI    Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
5*820c1a8dSHiroo HAYASHI 
6*820c1a8dSHiroo HAYASHI    The GNU C Library is free software; you can redistribute it and/or
7*820c1a8dSHiroo HAYASHI    modify it under the terms of the GNU Lesser General Public
8*820c1a8dSHiroo HAYASHI    License as published by the Free Software Foundation; either
9*820c1a8dSHiroo HAYASHI    version 2.1 of the License, or (at your option) any later version.
10*820c1a8dSHiroo HAYASHI 
11*820c1a8dSHiroo HAYASHI    The GNU C Library is distributed in the hope that it will be useful,
12*820c1a8dSHiroo HAYASHI    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*820c1a8dSHiroo HAYASHI    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*820c1a8dSHiroo HAYASHI    Lesser General Public License for more details.
15*820c1a8dSHiroo HAYASHI 
16*820c1a8dSHiroo HAYASHI    You should have received a copy of the GNU Lesser General Public
17*820c1a8dSHiroo HAYASHI    License along with the GNU C Library; if not, see
18*820c1a8dSHiroo HAYASHI    <https://www.gnu.org/licenses/>.  */
19*820c1a8dSHiroo HAYASHI 
20*820c1a8dSHiroo HAYASHI #define __STDC_WANT_IEC_60559_BFP_EXT__
21*820c1a8dSHiroo HAYASHI 
22*820c1a8dSHiroo HAYASHI #ifndef _LIBC
23*820c1a8dSHiroo HAYASHI # include <libc-config.h>
24*820c1a8dSHiroo HAYASHI 
25*820c1a8dSHiroo HAYASHI # if __GNUC_PREREQ (4, 6)
26*820c1a8dSHiroo HAYASHI #  pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
27*820c1a8dSHiroo HAYASHI # endif
28*820c1a8dSHiroo HAYASHI # if __GNUC_PREREQ (4, 3)
29*820c1a8dSHiroo HAYASHI #  pragma GCC diagnostic ignored "-Wold-style-definition"
30*820c1a8dSHiroo HAYASHI #  pragma GCC diagnostic ignored "-Wtype-limits"
31*820c1a8dSHiroo HAYASHI # endif
32*820c1a8dSHiroo HAYASHI #endif
33*820c1a8dSHiroo HAYASHI 
34*820c1a8dSHiroo HAYASHI /* Make sure no one compiles this code with a C++ compiler.  */
35*820c1a8dSHiroo HAYASHI #if defined __cplusplus && defined _LIBC
36*820c1a8dSHiroo HAYASHI # error "This is C code, use a C compiler"
37*820c1a8dSHiroo HAYASHI #endif
38*820c1a8dSHiroo HAYASHI 
39*820c1a8dSHiroo HAYASHI #ifdef _LIBC
40*820c1a8dSHiroo HAYASHI /* We have to keep the namespace clean.  */
41*820c1a8dSHiroo HAYASHI # define regfree(preg) __regfree (preg)
42*820c1a8dSHiroo HAYASHI # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
43*820c1a8dSHiroo HAYASHI # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
44*820c1a8dSHiroo HAYASHI # define regerror(errcode, preg, errbuf, errbuf_size) \
45*820c1a8dSHiroo HAYASHI 	__regerror(errcode, preg, errbuf, errbuf_size)
46*820c1a8dSHiroo HAYASHI # define re_set_registers(bu, re, nu, st, en) \
47*820c1a8dSHiroo HAYASHI 	__re_set_registers (bu, re, nu, st, en)
48*820c1a8dSHiroo HAYASHI # define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
49*820c1a8dSHiroo HAYASHI 	__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
50*820c1a8dSHiroo HAYASHI # define re_match(bufp, string, size, pos, regs) \
51*820c1a8dSHiroo HAYASHI 	__re_match (bufp, string, size, pos, regs)
52*820c1a8dSHiroo HAYASHI # define re_search(bufp, string, size, startpos, range, regs) \
53*820c1a8dSHiroo HAYASHI 	__re_search (bufp, string, size, startpos, range, regs)
54*820c1a8dSHiroo HAYASHI # define re_compile_pattern(pattern, length, bufp) \
55*820c1a8dSHiroo HAYASHI 	__re_compile_pattern (pattern, length, bufp)
56*820c1a8dSHiroo HAYASHI # define re_set_syntax(syntax) __re_set_syntax (syntax)
57*820c1a8dSHiroo HAYASHI # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
58*820c1a8dSHiroo HAYASHI 	__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
59*820c1a8dSHiroo HAYASHI # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
60*820c1a8dSHiroo HAYASHI 
61*820c1a8dSHiroo HAYASHI # include "../locale/localeinfo.h"
62*820c1a8dSHiroo HAYASHI #endif
63*820c1a8dSHiroo HAYASHI 
64*820c1a8dSHiroo HAYASHI /* On some systems, limits.h sets RE_DUP_MAX to a lower value than
65*820c1a8dSHiroo HAYASHI    GNU regex allows.  Include it before <regex.h>, which correctly
66*820c1a8dSHiroo HAYASHI    #undefs RE_DUP_MAX and sets it to the right value.  */
67*820c1a8dSHiroo HAYASHI #include <limits.h>
68*820c1a8dSHiroo HAYASHI 
69*820c1a8dSHiroo HAYASHI #include <regex.h>
70*820c1a8dSHiroo HAYASHI #include "regex_internal.h"
71*820c1a8dSHiroo HAYASHI 
72*820c1a8dSHiroo HAYASHI #include "regex_internal.c"
73*820c1a8dSHiroo HAYASHI #include "regcomp.c"
74*820c1a8dSHiroo HAYASHI #include "regexec.c"
75*820c1a8dSHiroo HAYASHI 
76*820c1a8dSHiroo HAYASHI /* Binary backward compatibility.  */
77*820c1a8dSHiroo HAYASHI #if _LIBC
78*820c1a8dSHiroo HAYASHI # include <shlib-compat.h>
79*820c1a8dSHiroo HAYASHI # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
80*820c1a8dSHiroo HAYASHI link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
81*820c1a8dSHiroo HAYASHI int re_max_failures = 2000;
82*820c1a8dSHiroo HAYASHI # endif
83*820c1a8dSHiroo HAYASHI #endif
84