gdb:
[deliverable/binutils-gdb.git] / gdb / gdb_wchar.h
1 /* Wide characters for gdb
2 Copyright (C) 2009 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
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.
10
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.
15
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/>. */
18
19 #ifndef GDB_WCHAR_H
20 #define GDB_WCHAR_H
21
22 /* If this host has wchar_t and if iconv is available (perhaps via GNU
23 libiconv), then we arrange to use those. Otherwise, we provide a
24 phony iconv which only handles a single character set, and we
25 provide wrappers for the wchar_t functionality we use. */
26 #if defined(HAVE_ICONV) && defined(HAVE_WCHAR_H)
27
28 #include <iconv.h>
29 #include <wchar.h>
30 #include <wctype.h>
31
32 typedef wchar_t gdb_wchar_t;
33 typedef wint_t gdb_wint_t;
34
35 #define gdb_wcslen wcslen
36 #define gdb_iswprint iswprint
37 #define gdb_iswdigit iswdigit
38 #define gdb_btowc btowc
39 #define gdb_WEOF WEOF
40
41 #define LCST(X) L ## X
42
43 #else
44
45 typedef char gdb_wchar_t;
46 typedef int gdb_wint_t;
47
48 #define gdb_wcslen strlen
49 #define gdb_iswprint isprint
50 #define gdb_iswdigit isdigit
51 #define gdb_btowc /* empty */
52 #define gdb_WEOF EOF
53
54 #define LCST(X) X
55
56 /* This define is used elsewhere so we don't need to duplicate the
57 same checking logic in multiple places. */
58 #define PHONY_ICONV
59
60 #endif /* defined(HAVE_ICONV) && defined(HAVE_WCHAR_H) */
61
62 #endif /* GDB_WCHAR_H */
This page took 0.032401 seconds and 5 git commands to generate.