#include "config.h"#include "system.h"#include "cpplib.h"#include "internal.h"#include "ucnid.h"

Go to the source code of this file.
Data Types | |
| type | _cpp_strbuf |
| type | conversion |
Defines | |
| #define | iconv_open(x, y) (errno = EINVAL, (iconv_t)-1) |
| #define | iconv(a, b, c, d, e) (errno = EINVAL, (size_t)-1) |
| #define | iconv_close(x) (void)0 |
| #define | ICONV_CONST |
| #define | SOURCE_CHARSET "UTF-8" |
| #define | LAST_POSSIBLY_BASIC_SOURCE_CHAR 0x7e |
| #define | EILSEQ EINVAL |
| #define | OUTBUF_BLOCK_SIZE 256 |
| #define | convert_using_iconv 0 |
| #define | APPLY_CONVERSION(CONVERTER, FROM, FLEN, TO) CONVERTER.func (CONVERTER.cd, FROM, FLEN, TO) |
Functions/Subroutines | |
| static int | one_utf8_to_cppchar (const uchar **inbufp, size_t *inbytesleftp, cppchar_t *cp) |
| static int | one_cppchar_to_utf8 (cppchar_t c, uchar **outbufp, size_t *outbytesleftp) |
| static int | one_utf8_to_utf32 (iconv_t bigend, const uchar **inbufp, size_t *inbytesleftp, uchar **outbufp, size_t *outbytesleftp) |
| static int | one_utf32_to_utf8 (iconv_t bigend, const uchar **inbufp, size_t *inbytesleftp, uchar **outbufp, size_t *outbytesleftp) |
| static int | one_utf8_to_utf16 (iconv_t bigend, const uchar **inbufp, size_t *inbytesleftp, uchar **outbufp, size_t *outbytesleftp) |
| static int | one_utf16_to_utf8 (iconv_t bigend, const uchar **inbufp, size_t *inbytesleftp, uchar **outbufp, size_t *outbytesleftp) |
| static bool | conversion_loop (int(*const one_conversion)(iconv_t, const uchar **, size_t *, uchar **, size_t *), iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to) |
| static bool | convert_utf8_utf16 (iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to) |
| static bool | convert_utf8_utf32 (iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to) |
| static bool | convert_utf16_utf8 (iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to) |
| static bool | convert_utf32_utf8 (iconv_t cd, const uchar *from, size_t flen, struct _cpp_strbuf *to) |
| static bool | convert_no_conversion (iconv_t cd ATTRIBUTE_UNUSED, const uchar *from, size_t flen, struct _cpp_strbuf *to) |
| static struct cset_converter | init_iconv_desc (cpp_reader *pfile, const char *to, const char *from) |
| void | cpp_init_iconv (cpp_reader *pfile) |
| void | _cpp_destroy_iconv (cpp_reader *pfile) |
| cppchar_t | cpp_host_to_exec_charset (cpp_reader *pfile, cppchar_t c) |
| static size_t | width_to_mask (size_t width) |
| static int | ucn_valid_in_identifier (cpp_reader *pfile, cppchar_t c) |
| cppchar_t | _cpp_valid_ucn (cpp_reader *pfile, const uchar **pstr, const uchar *limit, int identifier_pos) |
| static const uchar * | convert_ucn (cpp_reader *pfile, const uchar *from, const uchar *limit, struct _cpp_strbuf *tbuf, bool wide) |
| static void | emit_numeric_escape (cpp_reader *pfile, cppchar_t n, struct _cpp_strbuf *tbuf, bool wide) |
| static const uchar * | convert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit, struct _cpp_strbuf *tbuf, bool wide) |
| static const uchar * | convert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit, struct _cpp_strbuf *tbuf, bool wide) |
| static const uchar * | convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit, struct _cpp_strbuf *tbuf, bool wide) |
| bool | cpp_interpret_string (cpp_reader *pfile, const cpp_string *from, size_t count, cpp_string *to, bool wide) |
| bool | cpp_interpret_string_notranslate (cpp_reader *pfile, const cpp_string *from, size_t count, cpp_string *to, bool wide) |
| static cppchar_t | narrow_str_to_charconst (cpp_reader *pfile, cpp_string str, unsigned int *pchars_seen, int *unsignedp) |
| static cppchar_t | wide_str_to_charconst (cpp_reader *pfile, cpp_string str, unsigned int *pchars_seen, int *unsignedp) |
| cppchar_t | cpp_interpret_charconst (cpp_reader *pfile, const cpp_token *token, unsigned int *pchars_seen, int *unsignedp) |
| uchar * | _cpp_convert_input (cpp_reader *pfile, const char *input_charset, uchar *input, size_t size, size_t len, off_t *st_size) |
| const char * | _cpp_default_encoding (void) |
Variables | |
| static struct conversion | conversion_tab [] |
| #define APPLY_CONVERSION | ( | CONVERTER, | |||
| FROM, | |||||
| FLEN, | |||||
| TO | ) | CONVERTER.func (CONVERTER.cd, FROM, FLEN, TO) |
Definition at line 593 of file charset.c.
Referenced by _cpp_convert_input(), convert_escape(), convert_ucn(), cpp_host_to_exec_charset(), and cpp_interpret_string().
| #define convert_using_iconv 0 |
Definition at line 587 of file charset.c.
Referenced by _cpp_convert_input(), _cpp_destroy_iconv(), and init_iconv_desc().
| #define EILSEQ EINVAL |
Definition at line 93 of file charset.c.
Referenced by one_utf16_to_utf8(), one_utf32_to_utf8(), one_utf8_to_cppchar(), and one_utf8_to_utf16().
| #define iconv_close | ( | x | ) | (void)0 |
Definition at line 78 of file charset.c.
Referenced by _cpp_convert_input(), _cpp_destroy_iconv(), _nl_free_domain_conv(), java_destroy_lexer(), and java_new_lexer().
Definition at line 76 of file charset.c.
Referenced by _nl_init_domain_conv(), init_iconv_desc(), and java_new_lexer().
| #define LAST_POSSIBLY_BASIC_SOURCE_CHAR 0x7e |
| #define OUTBUF_BLOCK_SIZE 256 |
Definition at line 109 of file charset.c.
Referenced by conversion_loop(), cpp_interpret_string(), and emit_numeric_escape().
| #define SOURCE_CHARSET "UTF-8" |
Definition at line 83 of file charset.c.
Referenced by _cpp_convert_input(), _cpp_default_encoding(), and cpp_init_iconv().
| void _cpp_destroy_iconv | ( | cpp_reader * | pfile | ) |
| cppchar_t _cpp_valid_ucn | ( | cpp_reader * | pfile, | |
| const uchar ** | pstr, | |||
| const uchar * | limit, | |||
| int | identifier_pos | |||
| ) |
Definition at line 855 of file charset.c.
References abort, base, c, CPP_DL_ERROR, CPP_DL_WARNING, cpp_error(), CPP_OPTION, CPP_WTRADITIONAL, hex_value, ISXDIGIT, length, result, str, uchar, and ucn_valid_in_identifier().
Referenced by convert_ucn(), and forms_identifier_p().
| static bool conversion_loop | ( | int(*)(iconv_t, const uchar **, size_t *, uchar **, size_t *) | one_conversion, | |
| iconv_t | cd, | |||
| const uchar * | from, | |||
| size_t | flen, | |||
| struct _cpp_strbuf * | to | |||
| ) | [inline, static] |
Definition at line 456 of file charset.c.
References __builtin_expect, _cpp_strbuf::asize, errno, _cpp_strbuf::len, outbuf, OUTBUF_BLOCK_SIZE, _cpp_strbuf::text, uchar, and xrealloc().
Referenced by convert_utf16_utf8(), convert_utf32_utf8(), convert_utf8_utf16(), and convert_utf8_utf32().
| static const uchar* convert_escape | ( | cpp_reader * | pfile, | |
| const uchar * | from, | |||
| const uchar * | limit, | |||
| struct _cpp_strbuf * | tbuf, | |||
| bool | wide | |||
| ) | [static] |
Definition at line 1106 of file charset.c.
References APPLY_CONVERSION, c, convert_hex(), convert_oct(), convert_ucn(), CPP_DL_ERROR, CPP_DL_PEDWARN, CPP_DL_WARNING, cpp_errno(), cpp_error(), CPP_PEDANTIC, CPP_WTRADITIONAL, ISGRAPH, cpp_reader::narrow_cset_desc, uchar, unknown, and cpp_reader::wide_cset_desc.
Referenced by cpp_interpret_string().
| static const uchar* convert_hex | ( | cpp_reader * | pfile, | |
| const uchar * | from, | |||
| const uchar * | limit, | |||
| struct _cpp_strbuf * | tbuf, | |||
| bool | wide | |||
| ) | [static] |
Definition at line 1018 of file charset.c.
References c, CPP_DL_ERROR, CPP_DL_PEDWARN, CPP_DL_WARNING, cpp_error(), CPP_OPTION, CPP_WTRADITIONAL, emit_numeric_escape(), hex_p, hex_value, n, overflow, and width_to_mask().
Referenced by convert_escape().
| static bool convert_no_conversion | ( | iconv_t cd | ATTRIBUTE_UNUSED, | |
| const uchar * | from, | |||
| size_t | flen, | |||
| struct _cpp_strbuf * | to | |||
| ) | [static] |
Definition at line 536 of file charset.c.
References _cpp_strbuf::asize, _cpp_strbuf::len, memcpy, _cpp_strbuf::text, and xrealloc().
Referenced by _cpp_convert_input(), cpp_interpret_string_notranslate(), and init_iconv_desc().
| static const uchar* convert_oct | ( | cpp_reader * | pfile, | |
| const uchar * | from, | |||
| const uchar * | limit, | |||
| struct _cpp_strbuf * | tbuf, | |||
| bool | wide | |||
| ) | [static] |
Definition at line 1069 of file charset.c.
References c, count, CPP_DL_PEDWARN, cpp_error(), CPP_OPTION, emit_numeric_escape(), n, overflow, and width_to_mask().
Referenced by convert_escape().
| static const uchar* convert_ucn | ( | cpp_reader * | pfile, | |
| const uchar * | from, | |||
| const uchar * | limit, | |||
| struct _cpp_strbuf * | tbuf, | |||
| bool | wide | |||
| ) | [static] |
Definition at line 934 of file charset.c.
References _cpp_valid_ucn(), APPLY_CONVERSION, buf, CPP_DL_ERROR, cpp_errno(), errno, cpp_reader::narrow_cset_desc, one_cppchar_to_utf8(), uchar, and cpp_reader::wide_cset_desc.
Referenced by convert_escape().
| cppchar_t cpp_host_to_exec_charset | ( | cpp_reader * | pfile, | |
| cppchar_t | c | |||
| ) |
| void cpp_init_iconv | ( | cpp_reader * | pfile | ) |
| cppchar_t cpp_interpret_charconst | ( | cpp_reader * | pfile, | |
| const cpp_token * | token, | |||
| unsigned int * | pchars_seen, | |||
| int * | unsignedp | |||
| ) |
Definition at line 1391 of file charset.c.
References CPP_DL_ERROR, cpp_error(), cpp_interpret_string(), free(), cpp_string::len, narrow_str_to_charconst(), result, str, cpp_token::str, cpp_string::text, cpp_token::val, and wide_str_to_charconst().
| bool cpp_interpret_string | ( | cpp_reader * | pfile, | |
| const cpp_string * | from, | |||
| size_t | count, | |||
| cpp_string * | to, | |||
| bool | wide | |||
| ) |
Definition at line 1196 of file charset.c.
Referenced by cb_ident(), cp_parser_string_literal(), cpp_interpret_charconst(), cpp_interpret_string_notranslate(), and fname_as_string().
| bool cpp_interpret_string_notranslate | ( | cpp_reader * | pfile, | |
| const cpp_string * | from, | |||
| size_t | count, | |||
| cpp_string * | to, | |||
| bool | wide | |||
| ) |
Definition at line 1251 of file charset.c.
Referenced by cp_parser_string_literal(), do_line(), and do_linemarker().
| static void emit_numeric_escape | ( | cpp_reader * | pfile, | |
| cppchar_t | n, | |||
| struct _cpp_strbuf * | tbuf, | |||
| bool | wide | |||
| ) | [static] |
Definition at line 968 of file charset.c.
References _cpp_strbuf::asize, c, cmask, CPP_OPTION, i, _cpp_strbuf::len, OUTBUF_BLOCK_SIZE, _cpp_strbuf::text, width_to_mask(), and xrealloc().
Referenced by convert_hex(), convert_oct(), and cpp_interpret_string().
| static struct cset_converter init_iconv_desc | ( | cpp_reader * | pfile, | |
| const char * | to, | |||
| const char * | from | |||
| ) | [static, read] |
Definition at line 619 of file charset.c.
References alloca, ARRAY_SIZE, cset_converter::cd, convert_no_conversion(), convert_using_iconv, CPP_DL_ERROR, cpp_errno(), cpp_error(), errno, conversion::fake_cd, cset_converter::func, conversion::func, HAVE_ICONV, i, iconv_open, strcasecmp(), strcat(), strcpy, and strlen().
Referenced by _cpp_convert_input(), and cpp_init_iconv().
| static cppchar_t narrow_str_to_charconst | ( | cpp_reader * | pfile, | |
| cpp_string | str, | |||
| unsigned int * | pchars_seen, | |||
| int * | unsignedp | |||
| ) | [static] |
Definition at line 1272 of file charset.c.
References BITS_PER_CPPCHAR_T, c, CPP_DL_WARNING, cpp_error(), CPP_OPTION, i, cpp_string::len, result, cpp_string::text, and width_to_mask().
Referenced by cpp_interpret_charconst().
| static int one_cppchar_to_utf8 | ( | cppchar_t | c, | |
| uchar ** | outbufp, | |||
| size_t * | outbytesleftp | |||
| ) | [inline, static] |
Definition at line 230 of file charset.c.
References buf, outbuf, p, and uchar.
Referenced by _cpp_interpret_identifier(), convert_ucn(), one_utf16_to_utf8(), and one_utf32_to_utf8().
| static int one_utf16_to_utf8 | ( | iconv_t | bigend, | |
| const uchar ** | inbufp, | |||
| size_t * | inbytesleftp, | |||
| uchar ** | outbufp, | |||
| size_t * | outbytesleftp | |||
| ) | [inline, static] |
Definition at line 401 of file charset.c.
References EILSEQ, lo, one_cppchar_to_utf8(), s, and uchar.
Referenced by convert_utf16_utf8().
| static int one_utf32_to_utf8 | ( | iconv_t | bigend, | |
| const uchar ** | inbufp, | |||
| size_t * | inbytesleftp, | |||
| uchar ** | outbufp, | |||
| size_t * | outbytesleftp | |||
| ) | [inline, static] |
Definition at line 308 of file charset.c.
References EILSEQ, one_cppchar_to_utf8(), s, and uchar.
Referenced by convert_utf32_utf8().
| static int one_utf8_to_cppchar | ( | const uchar ** | inbufp, | |
| size_t * | inbytesleftp, | |||
| cppchar_t * | cp | |||
| ) | [inline, static] |
Definition at line 170 of file charset.c.
References c, EILSEQ, i, n, and uchar.
Referenced by one_utf8_to_utf16(), and one_utf8_to_utf32().
| static int one_utf8_to_utf16 | ( | iconv_t | bigend, | |
| const uchar ** | inbufp, | |||
| size_t * | inbytesleftp, | |||
| uchar ** | outbufp, | |||
| size_t * | outbytesleftp | |||
| ) | [inline, static] |
Definition at line 338 of file charset.c.
References EILSEQ, lo, one_utf8_to_cppchar(), outbuf, s, and uchar.
Referenced by convert_utf8_utf16().
| static int one_utf8_to_utf32 | ( | iconv_t | bigend, | |
| const uchar ** | inbufp, | |||
| size_t * | inbytesleftp, | |||
| uchar ** | outbufp, | |||
| size_t * | outbytesleftp | |||
| ) | [inline, static] |
Definition at line 281 of file charset.c.
References one_utf8_to_cppchar(), outbuf, s, and uchar.
Referenced by convert_utf8_utf32().
| static int ucn_valid_in_identifier | ( | cpp_reader * | pfile, | |
| cppchar_t | c | |||
| ) | [static] |
Definition at line 796 of file charset.c.
References ARRAY_SIZE, C99, CPP_OPTION, CPP_PEDANTIC, CXX, DIG, ucnrange::flags, lo, and ucnranges.
Referenced by _cpp_valid_ucn().
| static cppchar_t wide_str_to_charconst | ( | cpp_reader * | pfile, | |
| cpp_string | str, | |||
| unsigned int * | pchars_seen, | |||
| int * | unsignedp | |||
| ) | [static] |
Definition at line 1341 of file charset.c.
References BITS_PER_CPPCHAR_T, c, cmask, CPP_DL_WARNING, cpp_error(), CPP_OPTION, i, cpp_string::len, result, cpp_string::text, and width_to_mask().
Referenced by cpp_interpret_charconst().
Definition at line 780 of file charset.c.
References BITS_PER_CPPCHAR_T, CHAR_BIT, MIN, and size_t.
Referenced by convert_hex(), convert_oct(), emit_numeric_escape(), narrow_str_to_charconst(), and wide_str_to_charconst().
struct conversion conversion_tab[] [static] |
Initial value:
{
{ "UTF-8/UTF-32LE", convert_utf8_utf32, (iconv_t)0 },
{ "UTF-8/UTF-32BE", convert_utf8_utf32, (iconv_t)1 },
{ "UTF-8/UTF-16LE", convert_utf8_utf16, (iconv_t)0 },
{ "UTF-8/UTF-16BE", convert_utf8_utf16, (iconv_t)1 },
{ "UTF-32LE/UTF-8", convert_utf32_utf8, (iconv_t)0 },
{ "UTF-32BE/UTF-8", convert_utf32_utf8, (iconv_t)1 },
{ "UTF-16LE/UTF-8", convert_utf16_utf8, (iconv_t)0 },
{ "UTF-16BE/UTF-8", convert_utf16_utf8, (iconv_t)1 },
}
1.5.6