1 /* Wide characters for gdb
2 Copyright (C) 2009 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* We handle three different modes here.
24 Capable systems have the full suite: wchar_t support and iconv
25 (perhaps via GNU libiconv). On these machines, full functionality
28 DJGPP is known to have libiconv but not wchar_t support. On
29 systems like this, we use the narrow character functions. The full
30 functionality is available to the user, but many characters (those
31 outside the narrow range) will be displayed as escapes.
33 Finally, some systems do not have iconv. Here we provide a phony
34 iconv which only handles a single character set, and we provide
35 wrappers for the wchar_t functionality we use. */
38 #define INTERMEDIATE_ENCODING "wchar_t"
40 #if defined (HAVE_ICONV)
43 /* This define is used elsewhere so we don't need to duplicate the
44 same checking logic in multiple places. */
48 /* We use "btowc" as a sentinel to detect functioning wchar_t
50 #if defined (HAVE_ICONV) && defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC)
55 typedef wchar_t gdb_wchar_t;
56 typedef wint_t gdb_wint_t;
58 #define gdb_wcslen wcslen
59 #define gdb_iswprint iswprint
60 #define gdb_iswdigit iswdigit
61 #define gdb_btowc btowc
64 #define LCST(X) L ## X
68 typedef char gdb_wchar_t;
69 typedef int gdb_wint_t;
71 #define gdb_wcslen strlen
72 #define gdb_iswprint isprint
73 #define gdb_iswdigit isdigit
74 #define gdb_btowc /* empty */
79 /* If we are using the narrow character set, we want to use the host
80 narrow encoding as our intermediate encoding. However, if we are
81 also providing a phony iconv, we might as well just stick with
84 #undef INTERMEDIATE_ENCODING
85 #define INTERMEDIATE_ENCODING host_charset ()
90 #endif /* GDB_WCHAR_H */