2002-02-28 07:40:08 +01:00
|
|
|
/* Extended regular expression matching and search library.
|
2003-02-21 02:52:32 +01:00
|
|
|
Copyright (C) 2002, 2003 Free Software Foundation, Inc.
|
2001-07-06 06:58:11 +02:00
|
|
|
This file is part of the GNU C Library.
|
2002-02-28 07:40:08 +01:00
|
|
|
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
1995-05-18 11:00:09 +02:00
|
|
|
|
1997-02-15 05:31:36 +01:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 06:58:11 +02:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1995-05-18 11:00:09 +02:00
|
|
|
|
1997-02-15 05:31:36 +01:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 06:58:11 +02:00
|
|
|
Lesser General Public License for more details.
|
1995-05-18 11:00:09 +02:00
|
|
|
|
2001-07-06 06:58:11 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
1995-05-18 11:00:09 +02:00
|
|
|
|
2004-01-14 05:11:30 +01:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _AIX
|
|
|
|
#pragma alloca
|
|
|
|
#else
|
|
|
|
# ifndef allocax /* predefined by HP cc +Olibcalls */
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# define alloca(size) __builtin_alloca (size)
|
|
|
|
# else
|
|
|
|
# if HAVE_ALLOCA_H
|
|
|
|
# include <alloca.h>
|
|
|
|
# else
|
|
|
|
# ifdef __hpux
|
|
|
|
void *alloca ();
|
|
|
|
# else
|
|
|
|
# if !defined __OS2__ && !defined WIN32
|
|
|
|
char *alloca ();
|
|
|
|
# else
|
|
|
|
# include <malloc.h> /* OS/2 defines alloca in here */
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2002-02-28 07:40:08 +01:00
|
|
|
#ifdef _LIBC
|
1998-04-08 22:27:31 +02:00
|
|
|
/* We have to keep the namespace clean. */
|
2003-11-16 08:14:28 +01:00
|
|
|
# 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) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__regerror(errcode, preg, errbuf, errbuf_size)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_set_registers(bu, re, nu, st, en) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_set_registers (bu, re, nu, st, en)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_match(bufp, string, size, pos, regs) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_match (bufp, string, size, pos, regs)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_search(bufp, string, size, startpos, range, regs) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_search (bufp, string, size, startpos, range, regs)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_compile_pattern(pattern, length, bufp) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_compile_pattern (pattern, length, bufp)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_set_syntax(syntax) __re_set_syntax (syntax)
|
|
|
|
# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
|
1998-04-08 22:27:31 +02:00
|
|
|
__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
|
2003-11-16 08:14:28 +01:00
|
|
|
# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
|
|
|
|
|
|
|
|
# include "../locale/localeinfo.h"
|
2001-06-19 02:43:55 +02:00
|
|
|
#endif
|
|
|
|
|
2003-02-21 02:52:32 +01:00
|
|
|
/* POSIX says that <sys/types.h> must be included (by the caller) before
|
|
|
|
<regex.h>. */
|
|
|
|
#include <sys/types.h>
|
2004-01-30 06:22:32 +01:00
|
|
|
|
|
|
|
/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
|
|
|
|
GNU regex allows. Include it before <regex.h>, which correctly
|
|
|
|
#undefs RE_DUP_MAX and sets it to the right value. */
|
|
|
|
#include <limits.h>
|
|
|
|
|
2003-02-21 02:52:32 +01:00
|
|
|
#include <regex.h>
|
|
|
|
#include "regex_internal.h"
|
2002-03-12 03:04:08 +01:00
|
|
|
|
2003-02-21 02:52:32 +01:00
|
|
|
#include "regex_internal.c"
|
2002-02-28 07:40:08 +01:00
|
|
|
#include "regcomp.c"
|
|
|
|
#include "regexec.c"
|
2002-04-25 00:02:03 +02:00
|
|
|
|
|
|
|
/* Binary backward compatibility. */
|
|
|
|
#if _LIBC
|
|
|
|
# include <shlib-compat.h>
|
|
|
|
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
|
|
|
link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
|
|
|
|
int re_max_failures = 2000;
|
|
|
|
# endif
|
|
|
|
#endif
|