aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/charset.c3
-rw-r--r--libcpp/directives.c14
-rw-r--r--libcpp/include/cpplib.h5
-rw-r--r--libcpp/internal.h2
4 files changed, 24 insertions, 0 deletions
diff --git a/libcpp/charset.c b/libcpp/charset.c
index 28b81c9c..3e5578b 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -638,6 +638,9 @@ init_iconv_desc (cpp_reader *pfile, const char *to, const char *from)
char *pair;
size_t i;
+ ret.to = to;
+ ret.from = from;
+
if (!strcasecmp (to, from))
{
ret.func = convert_no_conversion;
diff --git a/libcpp/directives.c b/libcpp/directives.c
index 7511560..0d09da7 100644
--- a/libcpp/directives.c
+++ b/libcpp/directives.c
@@ -2596,6 +2596,20 @@ cpp_set_callbacks (cpp_reader *pfile, cpp_callbacks *cb)
pfile->cb = *cb;
}
+/* The narrow character set identifier. */
+const char *
+cpp_get_narrow_charset_name (cpp_reader *pfile)
+{
+ return pfile->narrow_cset_desc.to;
+}
+
+/* The wide character set identifier. */
+const char *
+cpp_get_wide_charset_name (cpp_reader *pfile)
+{
+ return pfile->wide_cset_desc.to;
+}
+
/* The dependencies structure. (Creates one if it hasn't already been.) */
class mkdeps *
cpp_get_deps (cpp_reader *pfile)
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 2becd2e..692aee5 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -1005,6 +1005,11 @@ extern class mkdeps *cpp_get_deps (cpp_reader *) ATTRIBUTE_PURE;
extern const char *cpp_find_header_unit (cpp_reader *, const char *file,
bool angle_p, location_t);
+/* Call these to get name data about the various compile-time
+ charsets. */
+extern const char *cpp_get_narrow_charset_name (cpp_reader *) ATTRIBUTE_PURE;
+extern const char *cpp_get_wide_charset_name (cpp_reader *) ATTRIBUTE_PURE;
+
/* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the
input file, except for preprocessed input. This will generate at
diff --git a/libcpp/internal.h b/libcpp/internal.h
index 45bbbdd..4010af8 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -48,6 +48,8 @@ struct cset_converter
convert_f func;
iconv_t cd;
int width;
+ const char* from;
+ const char* to;
};
#define BITS_PER_CPPCHAR_T (CHAR_BIT * sizeof (cppchar_t))