2 * mbsupport.h --- Localize determination of whether we have multibyte stuff.
6 * Copyright (C) 2004, 2005, 2011, 2012 the Free Software Foundation, Inc.
8 * This file is part of GAWK, the GNU implementation of the
9 * AWK Programming Language.
11 * GAWK is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * GAWK is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
27 * This file is needed because we test for i18n support in 3 different
28 * places, and we want a consistent definition in all of them. Following
29 * the ``Don't Repeat Yourself'' principle from "The Pragmatic Programmer",
30 * we centralize the tests here.
32 * This test is the union of all the current tests.
41 #if defined(HAVE_ISWCTYPE) \
42 && defined(HAVE_LOCALE_H) \
43 && (defined(HAVE_BTOWC) || defined(ZOS_USS)) \
44 && defined(HAVE_MBRLEN) \
45 && defined(HAVE_MBRTOWC) \
46 && defined(HAVE_WCHAR_H) \
47 && defined(HAVE_WCRTOMB) \
48 && defined(HAVE_WCSCOLL) \
49 && defined(HAVE_WCTYPE) \
50 && defined(HAVE_WCTYPE_H) \
51 && defined(HAVE_WCTYPE_T) \
52 && defined(HAVE_WINT_T) \
53 && defined(HAVE_ISWLOWER) \
54 && defined(HAVE_ISWUPPER) \
55 && defined(HAVE_TOWLOWER) \
56 && defined(HAVE_TOWUPPER) \
57 && (defined(HAVE_STDLIB_H) && defined(MB_CUR_MAX)) \
58 /* We can handle multibyte strings. */
59 # define MBS_SUPPORT 1
61 # define MBS_SUPPORT 0
64 #else /* NO_MBSUPPORT is defined */
65 # define MBS_SUPPORT 0
72 /* All this glop is for dfa.c. Bleah. */
82 #define towupper toupper
83 #define towlower tolower
85 #define btowc(x) ((int)x)
87 #define iswalnum isalnum
88 #define iswalpha isalpha
89 #define iswupper isupper
102 extern wctype_t wctype(const char *name);
103 extern int iswctype(wint_t wc, wctype_t desc);
104 extern int wcscoll(const wchar_t *ws1, const wchar_t *ws2);