osprey-gcc/libcpp/charset.c File Reference

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

Include dependency graph for charset.c:

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 ucharconvert_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 ucharconvert_hex (cpp_reader *pfile, const uchar *from, const uchar *limit, struct _cpp_strbuf *tbuf, bool wide)
static const ucharconvert_oct (cpp_reader *pfile, const uchar *from, const uchar *limit, struct _cpp_strbuf *tbuf, bool wide)
static const ucharconvert_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 Documentation

#define APPLY_CONVERSION ( CONVERTER,
FROM,
FLEN,
TO   )     CONVERTER.func (CONVERTER.cd, FROM, FLEN, TO)

#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

#define iconv ( a,
b,
c,
d,
 )     (errno = EINVAL, (size_t)-1)

Definition at line 77 of file charset.c.

Referenced by java_new_lexer(), and java_read_char().

#define iconv_close (  )     (void)0

#define ICONV_CONST

Definition at line 79 of file charset.c.

#define iconv_open ( x,
 )     (errno = EINVAL, (iconv_t)-1)

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

Definition at line 84 of file charset.c.

Referenced by cpp_host_to_exec_charset().

#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().


Function Documentation

uchar* _cpp_convert_input ( cpp_reader pfile,
const char *  input_charset,
uchar input,
size_t  size,
size_t  len,
off_t st_size 
)

Definition at line 1429 of file charset.c.

Referenced by read_file_guts().

const char* _cpp_default_encoding ( void   ) 

Definition at line 1480 of file charset.c.

void _cpp_destroy_iconv ( cpp_reader pfile  ) 

Definition at line 708 of file charset.c.

cppchar_t _cpp_valid_ucn ( cpp_reader pfile,
const uchar **  pstr,
const uchar limit,
int  identifier_pos 
)

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]

static const uchar* convert_escape ( cpp_reader pfile,
const uchar from,
const uchar limit,
struct _cpp_strbuf tbuf,
bool  wide 
) [static]

static const uchar* convert_hex ( cpp_reader pfile,
const uchar from,
const uchar limit,
struct _cpp_strbuf tbuf,
bool  wide 
) [static]

static bool convert_no_conversion ( iconv_t cd  ATTRIBUTE_UNUSED,
const uchar from,
size_t  flen,
struct _cpp_strbuf to 
) [static]

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]

static bool convert_utf16_utf8 ( iconv_t  cd,
const uchar from,
size_t  flen,
struct _cpp_strbuf to 
) [static]

Definition at line 521 of file charset.c.

References conversion_loop(), and one_utf16_to_utf8().

static bool convert_utf32_utf8 ( iconv_t  cd,
const uchar from,
size_t  flen,
struct _cpp_strbuf to 
) [static]

Definition at line 528 of file charset.c.

References conversion_loop(), and one_utf32_to_utf8().

static bool convert_utf8_utf16 ( iconv_t  cd,
const uchar from,
size_t  flen,
struct _cpp_strbuf to 
) [static]

Definition at line 507 of file charset.c.

References conversion_loop(), and one_utf8_to_utf16().

static bool convert_utf8_utf32 ( iconv_t  cd,
const uchar from,
size_t  flen,
struct _cpp_strbuf to 
) [static]

Definition at line 514 of file charset.c.

References conversion_loop(), and one_utf8_to_utf32().

cppchar_t cpp_host_to_exec_charset ( cpp_reader pfile,
cppchar_t  c 
)

Definition at line 732 of file charset.c.

Referenced by c_common_to_target_charset().

void cpp_init_iconv ( cpp_reader pfile  ) 

Definition at line 680 of file charset.c.

Referenced by c_common_init(), and reader_init().

cppchar_t cpp_interpret_charconst ( cpp_reader pfile,
const cpp_token token,
unsigned int *  pchars_seen,
int *  unsignedp 
)

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 
)

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]

static struct cset_converter init_iconv_desc ( cpp_reader pfile,
const char *  to,
const char *  from 
) [static, read]

static cppchar_t narrow_str_to_charconst ( cpp_reader pfile,
cpp_string  str,
unsigned int *  pchars_seen,
int *  unsignedp 
) [static]

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]

static size_t width_to_mask ( size_t  width  )  [inline, static]


Variable Documentation

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 },
}

Definition at line 602 of file charset.c.


Generated on Wed Apr 8 14:23:15 2009 for Open64 by  doxygen 1.5.6