diff options
author | Tom Tromey <tromey@redhat.com> | 2009-04-15 22:20:30 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2009-04-15 22:20:30 +0000 |
commit | e6b0c1ad0917384d1260865e7b20c6f9cb10f117 (patch) | |
tree | 5f4f366d767bed94f1db9859e814f0b0d145ec6b /gdb/gdb_wchar.h | |
parent | 841d691fed9a8fc9db1949ecb229b384e41bef15 (diff) | |
download | gdb-e6b0c1ad0917384d1260865e7b20c6f9cb10f117.tar.gz |
gdb
* c-lang.c (c_emit_char): Use INTERMEDIATE_ENCODING.
(c_printstr): Likewise.
* charset.c: Include gdb_wait.h.
(make_wchar_iterator): Use INTERMEDIATE_ENCODING.
(find_charset_names): Use pexecute. Handle libiconv's output.
Detect errors.
(_initialize_charset): Use xstrdup.
* gdb_wchar.h: Check HAVE_BTOWC. Split PHONY_ICONV and wchar
cases.
(INTERMEDIATE_ENCODING): New define.
* configure, config.in: Rebuild.
* configure.ac: Check for btowc.
gdb/doc
* gdb.texinfo (Character Sets): Document default character set.
Diffstat (limited to 'gdb/gdb_wchar.h')
-rw-r--r-- | gdb/gdb_wchar.h | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h index 583140eeb53..07a6c877cf4 100644 --- a/gdb/gdb_wchar.h +++ b/gdb/gdb_wchar.h @@ -19,13 +19,36 @@ #ifndef GDB_WCHAR_H #define GDB_WCHAR_H -/* If this host has wchar_t and if iconv is available (perhaps via GNU - libiconv), then we arrange to use those. Otherwise, we provide a - phony iconv which only handles a single character set, and we - provide wrappers for the wchar_t functionality we use. */ -#if defined(HAVE_ICONV) && defined(HAVE_WCHAR_H) - +/* We handle three different modes here. + + Capable systems have the full suite: wchar_t support and iconv + (perhaps via GNU libiconv). On these machines, full functionality + is available. + + DJGPP is known to have libiconv but not wchar_t support. On + systems like this, we use the narrow character functions. The full + functionality is available to the user, but many characters (those + outside the narrow range) will be displayed as escapes. + + Finally, some systems do not have iconv. Here we provide a phony + iconv which only handles a single character set, and we provide + wrappers for the wchar_t functionality we use. */ + + +#define INTERMEDIATE_ENCODING "wchar_t" + +#if defined (HAVE_ICONV) #include <iconv.h> +#else +/* This define is used elsewhere so we don't need to duplicate the + same checking logic in multiple places. */ +#define PHONY_ICONV +#endif + +/* We use "btowc" as a sentinel to detect functioning wchar_t + support. */ +#if defined (HAVE_ICONV) && defined (HAVE_WCHAR_H) && defined (HAVE_BTOWC) + #include <wchar.h> #include <wctype.h> @@ -53,10 +76,15 @@ typedef int gdb_wint_t; #define LCST(X) X -/* This define is used elsewhere so we don't need to duplicate the - same checking logic in multiple places. */ -#define PHONY_ICONV +/* If we are using the narrow character set, we want to use the host + narrow encoding as our intermediate encoding. However, if we are + also providing a phony iconv, we might as well just stick with + "wchar_t". */ +#ifndef PHONY_ICONV +#undef INTERMEDIATE_ENCODING +#define INTERMEDIATE_ENCODING host_charset () +#endif -#endif /* defined(HAVE_ICONV) && defined(HAVE_WCHAR_H) */ +#endif #endif /* GDB_WCHAR_H */ |