summaryrefslogtreecommitdiff
path: root/libc/misc/regex/regex.c
blob: edf02a89d5f22a3349ba1e4f6142fea37b8f3cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* Extended regular expression matching and search library.
   Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.

   The GNU C Library is free software; you can redistribute it and/or
   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.

   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
   Lesser General Public License for more details.

   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.  */

#include <features.h>

#ifdef __UCLIBC__
/* TODO: having _LIBC *off* is very confusing - the rest of uclibc
 * has it *on*. Fix it. */
# undef _LIBC
# define _REGEX_RE_COMP
# define HAVE_LANGINFO
# define HAVE_LANGINFO_CODESET
# include <stdbool.h>
# include <stdint.h>
# include <string.h>
# include <stdlib.h>
# ifdef __UCLIBC_HAS_WCHAR__
#  define RE_ENABLE_I18N
#  include <wchar.h>
#  include <wctype.h>
#  define __iswctype iswctype
#  define __wcrtomb wcrtomb
#  define __btowc btowc
#  define __wctype wctype
# endif
# include <ctype.h>
# ifdef __UCLIBC_HAS_CTYPE_TABLES__
#  define __toupper toupper
#  define __tolower tolower
# endif
#endif

/* Make sure noone compiles this code with a C++ compiler.  */
#ifdef __cplusplus
# error "This is C code, use a C compiler"
#endif

/* 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>

#include <regex.h>

#include "regex_internal.h"
#include "regex_internal.c"
#include "regcomp.c"
#include "regexec.c"