regex.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Extended regular expression matching and search library.
  2. Copyright (C) 2002, 2003 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2, or (at your option)
  8. any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License along
  14. with this program; if not, write to the Free Software Foundation,
  15. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
  16. #ifdef HAVE_CONFIG_H
  17. # include <config.h>
  18. #endif
  19. #ifdef _LIBC
  20. /* We have to keep the namespace clean. */
  21. # define regfree(preg) __regfree (preg)
  22. # define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
  23. # define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
  24. # define regerror(errcode, preg, errbuf, errbuf_size) \
  25. __regerror(errcode, preg, errbuf, errbuf_size)
  26. # define re_set_registers(bu, re, nu, st, en) \
  27. __re_set_registers (bu, re, nu, st, en)
  28. # define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
  29. __re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
  30. # define re_match(bufp, string, size, pos, regs) \
  31. __re_match (bufp, string, size, pos, regs)
  32. # define re_search(bufp, string, size, startpos, range, regs) \
  33. __re_search (bufp, string, size, startpos, range, regs)
  34. # define re_compile_pattern(pattern, length, bufp) \
  35. __re_compile_pattern (pattern, length, bufp)
  36. # define re_set_syntax(syntax) __re_set_syntax (syntax)
  37. # define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
  38. __re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
  39. # define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
  40. # include "../locale/localeinfo.h"
  41. #endif
  42. /* On some systems, limits.h sets RE_DUP_MAX to a lower value than
  43. GNU regex allows. Include it before <regex.h>, which correctly
  44. #undefs RE_DUP_MAX and sets it to the right value. */
  45. #include <limits.h>
  46. #include <regex.h>
  47. #include "regex_internal.h"
  48. #include "regex_internal.c"
  49. #include "regcomp.c"
  50. #include "regexec.c"
  51. /* Binary backward compatibility. */
  52. #if _LIBC
  53. # include <shlib-compat.h>
  54. # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
  55. link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
  56. int re_max_failures = 2000;
  57. # endif
  58. #endif