Ruby
2.5.0dev(2017-10-22revision60238)
|
Go to the source code of this file.
Data Structures | |
struct | rb_transcoding |
union | rb_transcoding::rb_transcoding_state_t |
struct | rb_econv_elem_t |
struct | rb_econv_t |
struct | transcoder_entry_t |
struct | search_path_queue_tag |
struct | search_path_bfs_t |
struct | trans_open_t |
struct | asciicompat_encoding_t |
struct | rb_econv_init_by_convpath_t |
Macros | |
#define | ENABLE_ECONV_NEWLINE_OPTION 1 |
#define | TRANSCODING_READBUF(tc) |
#define | TRANSCODING_WRITEBUF(tc) |
#define | TRANSCODING_WRITEBUF_SIZE(tc) |
#define | TRANSCODING_STATE_EMBED_MAX ((int)sizeof(union rb_transcoding_state_t)) |
#define | TRANSCODING_STATE(tc) |
#define | DECORATOR_P(sname, dname) (*(sname) == '\0') |
#define | encoding_equal(enc1, enc2) (STRCASECMP((enc1), (enc2)) == 0) |
#define | SUSPEND(ret, num) |
#define | SUSPEND_OBUF(num) |
#define | SUSPEND_AFTER_OUTPUT(num) |
#define | next_table (tc->next_table) |
#define | next_info (tc->next_info) |
#define | next_byte (tc->next_byte) |
#define | writebuf_len (tc->writebuf_len) |
#define | writebuf_off (tc->writebuf_off) |
#define | BYTE_ADDR(index) (tr->byte_array + (index)) |
#define | WORD_ADDR(index) (tr->word_array + INFO2WORDINDEX(index)) |
#define | BL_BASE BYTE_ADDR(BYTE_LOOKUP_BASE(WORD_ADDR(next_table))) |
#define | BL_INFO WORD_ADDR(BYTE_LOOKUP_INFO(WORD_ADDR(next_table))) |
#define | BL_MIN_BYTE (BL_BASE[0]) |
#define | BL_MAX_BYTE (BL_BASE[1]) |
#define | BL_OFFSET(byte) (BL_BASE[2+(byte)-BL_MIN_BYTE]) |
#define | BL_ACTION(byte) (BL_INFO[BL_OFFSET((byte))]) |
#define | MAX_ECFLAGS_DECORATORS 32 |
#define | hash_fallback rb_hash_aref |
Typedefs | |
typedef struct rb_transcoding | rb_transcoding |
typedef struct search_path_queue_tag | search_path_queue_t |
Functions | |
void | rb_register_transcoder (const rb_transcoder *tr) |
void | rb_declare_transcoder (const char *enc1, const char *enc2, const char *lib) |
rb_econv_t * | rb_econv_open (const char *sname, const char *dname, int ecflags) |
rb_econv_result_t | rb_econv_convert (rb_econv_t *ec, const unsigned char **input_ptr, const unsigned char *input_stop, unsigned char **output_ptr, unsigned char *output_stop, int flags) |
const char * | rb_econv_encoding_to_insert_output (rb_econv_t *ec) |
int | rb_econv_insert_output (rb_econv_t *ec, const unsigned char *str, size_t len, const char *str_encoding) |
void | rb_econv_close (rb_econv_t *ec) |
size_t | rb_econv_memsize (rb_econv_t *ec) |
int | rb_econv_putbackable (rb_econv_t *ec) |
void | rb_econv_putback (rb_econv_t *ec, unsigned char *p, int n) |
const char * | rb_econv_asciicompat_encoding (const char *ascii_incompat_name) |
VALUE | rb_econv_append (rb_econv_t *ec, const char *ss, long len, VALUE dst, int flags) |
VALUE | rb_econv_substr_append (rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int flags) |
VALUE | rb_econv_str_append (rb_econv_t *ec, VALUE src, VALUE dst, int flags) |
VALUE | rb_econv_substr_convert (rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags) |
VALUE | rb_econv_str_convert (rb_econv_t *ec, VALUE src, int flags) |
int | rb_econv_decorate_at_first (rb_econv_t *ec, const char *decorator_name) |
int | rb_econv_decorate_at_last (rb_econv_t *ec, const char *decorator_name) |
void | rb_econv_binmode (rb_econv_t *ec) |
VALUE | rb_econv_open_exc (const char *sname, const char *dname, int ecflags) |
int | rb_econv_set_replacement (rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname) |
int | rb_econv_prepare_options (VALUE opthash, VALUE *opts, int ecflags) |
int | rb_econv_prepare_opts (VALUE opthash, VALUE *opts) |
rb_econv_t * | rb_econv_open_opts (const char *source_encoding, const char *destination_encoding, int ecflags, VALUE opthash) |
VALUE | rb_str_encode (VALUE str, VALUE to, int ecflags, VALUE ecopts) |
int | rb_econv_has_convpath_p (const char *from_encoding, const char *to_encoding) |
VALUE | rb_econv_make_exception (rb_econv_t *ec) |
void | rb_econv_check_error (rb_econv_t *ec) |
void | Init_transcode (void) |
void | InitVM_transcode (void) |
Variables | |
VALUE | rb_eUndefinedConversionError |
VALUE | rb_eInvalidByteSequenceError |
VALUE | rb_eConverterNotFoundError |
VALUE | rb_cEncodingConverter |
#define BL_BASE BYTE_ADDR(BYTE_LOOKUP_BASE(WORD_ADDR(next_table))) |
#define BL_INFO WORD_ADDR(BYTE_LOOKUP_INFO(WORD_ADDR(next_table))) |
#define BL_MAX_BYTE (BL_BASE[1]) |
#define BL_MIN_BYTE (BL_BASE[0]) |
#define BL_OFFSET | ( | byte | ) | (BL_BASE[2+(byte)-BL_MIN_BYTE]) |
#define BYTE_ADDR | ( | index | ) | (tr->byte_array + (index)) |
#define DECORATOR_P | ( | sname, | |
dname | |||
) | (*(sname) == '\0') |
Definition at line 152 of file transcode.c.
#define ENABLE_ECONV_NEWLINE_OPTION 1 |
Definition at line 16 of file transcode.c.
#define encoding_equal | ( | enc1, | |
enc2 | |||
) | (STRCASECMP((enc1), (enc2)) == 0) |
Definition at line 239 of file transcode.c.
Referenced by rb_econv_insert_output(), and rb_econv_set_replacement().
#define hash_fallback rb_hash_aref |
Definition at line 2242 of file transcode.c.
#define MAX_ECFLAGS_DECORATORS 32 |
Definition at line 1022 of file transcode.c.
Referenced by rb_econv_open().
#define next_byte (tc->next_byte) |
#define next_info (tc->next_info) |
#define next_table (tc->next_table) |
#define SUSPEND | ( | ret, | |
num | |||
) |
#define SUSPEND_AFTER_OUTPUT | ( | num | ) |
#define SUSPEND_OBUF | ( | num | ) |
#define TRANSCODING_READBUF | ( | tc | ) |
Definition at line 82 of file transcode.c.
Referenced by rb_econv_putback().
#define TRANSCODING_STATE | ( | tc | ) |
Definition at line 95 of file transcode.c.
#define TRANSCODING_STATE_EMBED_MAX ((int)sizeof(union rb_transcoding_state_t)) |
Definition at line 94 of file transcode.c.
#define TRANSCODING_WRITEBUF | ( | tc | ) |
Definition at line 86 of file transcode.c.
#define TRANSCODING_WRITEBUF_SIZE | ( | tc | ) |
Definition at line 90 of file transcode.c.
#define WORD_ADDR | ( | index | ) | (tr->word_array + INFO2WORDINDEX(index)) |
#define writebuf_len (tc->writebuf_len) |
#define writebuf_off (tc->writebuf_off) |
typedef struct rb_transcoding rb_transcoding |
typedef struct search_path_queue_tag search_path_queue_t |
void Init_transcode | ( | void | ) |
Definition at line 4411 of file transcode.c.
References st_init_strcasetable().
void InitVM_transcode | ( | void | ) |
Definition at line 4448 of file transcode.c.
References rb_cEncoding, rb_cString, rb_define_class_under(), rb_define_method(), rb_eConverterNotFoundError, rb_eEncodingError, rb_eInvalidByteSequenceError, and rb_eUndefinedConversionError.
Definition at line 231 of file transcode.c.
References rb_eArgError, and rb_raise().
VALUE rb_econv_append | ( | rb_econv_t * | ec, |
const char * | ss, | ||
long | len, | ||
VALUE | dst, | ||
int | flags | ||
) |
Definition at line 1809 of file transcode.c.
References rb_econv_t::destination_encoding, dp, econv_destination_buffer_full, rb_econv_t::last_tc, len, LONG_MAX, rb_transcoder::max_output, NIL_P, rb_eArgError, rb_econv_check_error(), rb_econv_convert(), rb_enc_associate(), rb_raise(), rb_str_buf_new(), rb_str_capacity(), rb_str_resize(), rb_str_set_len(), RSTRING_LEN, RSTRING_PTR, and rb_transcoding::transcoder.
Referenced by rb_econv_substr_append().
Definition at line 1782 of file transcode.c.
References asciicompat_encoding_t::ascii_compat_name, asciicompat_encoding_t::ascii_incompat_name, NULL, st_table::num_entries, st_data_t, st_foreach, and st_lookup.
void rb_econv_binmode | ( | rb_econv_t * | ec | ) |
Definition at line 1939 of file transcode.c.
References ECONV_CR_NEWLINE_DECORATOR, ECONV_CRLF_NEWLINE_DECORATOR, ECONV_NEWLINE_DECORATOR_MASK, ECONV_UNIVERSAL_NEWLINE_DECORATOR, and rb_econv_t::flags.
Referenced by rb_io_binmode().
void rb_econv_check_error | ( | rb_econv_t * | ec | ) |
Definition at line 4231 of file transcode.c.
Referenced by rb_econv_append().
void rb_econv_close | ( | rb_econv_t * | ec | ) |
Definition at line 1698 of file transcode.c.
References rb_econv_t::num_trans, rb_econv_t::replacement_allocated, rb_econv_t::replacement_str, and xfree().
rb_econv_result_t rb_econv_convert | ( | rb_econv_t * | ec, |
const unsigned char ** | input_ptr, | ||
const unsigned char * | input_stop, | ||
unsigned char ** | output_ptr, | ||
unsigned char * | output_stop, | ||
int | flags | ||
) |
Definition at line 1442 of file transcode.c.
References rb_econv_t::started.
Referenced by rb_econv_append().
int rb_econv_decorate_at_first | ( | rb_econv_t * | ec, |
const char * | decorator_name | ||
) |
Definition at line 1905 of file transcode.c.
References rb_econv_t::num_trans.
int rb_econv_decorate_at_last | ( | rb_econv_t * | ec, |
const char * | decorator_name | ||
) |
Definition at line 1922 of file transcode.c.
References rb_econv_t::num_trans.
const char* rb_econv_encoding_to_insert_output | ( | rb_econv_t * | ec | ) |
Definition at line 1499 of file transcode.c.
References asciicompat_encoder, rb_transcoder::asciicompat_type, rb_transcoder::dst_encoding, rb_econv_t::last_tc, NULL, rb_transcoder::src_encoding, and rb_transcoding::transcoder.
Referenced by rb_econv_insert_output(), and rb_econv_set_replacement().
Definition at line 3172 of file transcode.c.
References Qnil.
int rb_econv_insert_output | ( | rb_econv_t * | ec, |
const unsigned char * | str, | ||
size_t | len, | ||
const char * | str_encoding | ||
) |
Definition at line 1583 of file transcode.c.
References encoding_equal, len, NULL, rb_econv_encoding_to_insert_output(), and rb_econv_t::started.
VALUE rb_econv_make_exception | ( | rb_econv_t * | ec | ) |
Definition at line 4225 of file transcode.c.
size_t rb_econv_memsize | ( | rb_econv_t * | ec | ) |
Definition at line 1716 of file transcode.c.
References rb_econv_t::num_trans, rb_econv_t::replacement_allocated, rb_econv_t::replacement_len, and size.
Referenced by rb_io_memsize().
rb_econv_t* rb_econv_open | ( | const char * | sname, |
const char * | dname, | ||
int | ecflags | ||
) |
Definition at line 1063 of file transcode.c.
References MAX_ECFLAGS_DECORATORS.
Definition at line 2033 of file transcode.c.
References rb_str_new_cstr().
rb_econv_t* rb_econv_open_opts | ( | const char * | source_encoding, |
const char * | destination_encoding, | ||
int | ecflags, | ||
VALUE | opthash | ||
) |
Definition at line 2575 of file transcode.c.
References NIL_P, OBJ_FROZEN, Qnil, rb_bug(), rb_hash_aref(), RB_TYPE_P, and T_HASH.
Definition at line 2524 of file transcode.c.
Referenced by rb_econv_prepare_opts().
Definition at line 2569 of file transcode.c.
References rb_econv_prepare_options().
void rb_econv_putback | ( | rb_econv_t * | ec, |
unsigned char * | p, | ||
int | n | ||
) |
Definition at line 1749 of file transcode.c.
References rb_econv_t::elems, rb_econv_t::num_trans, rb_transcoding::readagain_len, rb_transcoding::recognized_len, rb_econv_elem_t::tc, and TRANSCODING_READBUF.
int rb_econv_putbackable | ( | rb_econv_t * | ec | ) |
Definition at line 1738 of file transcode.c.
References rb_econv_t::elems, rb_econv_t::num_trans, rb_transcoding::readagain_len, and rb_econv_elem_t::tc.
int rb_econv_set_replacement | ( | rb_econv_t * | ec, |
const unsigned char * | str, | ||
size_t | len, | ||
const char * | encname | ||
) |
Definition at line 2195 of file transcode.c.
References encoding_equal, len, MEMCPY, rb_econv_encoding_to_insert_output(), and xmalloc.
VALUE rb_econv_str_append | ( | rb_econv_t * | ec, |
VALUE | src, | ||
VALUE | dst, | ||
int | flags | ||
) |
Definition at line 1862 of file transcode.c.
References rb_econv_substr_append(), and RSTRING_LEN.
VALUE rb_econv_str_convert | ( | rb_econv_t * | ec, |
VALUE | src, | ||
int | flags | ||
) |
Definition at line 1874 of file transcode.c.
References Qnil, rb_econv_substr_append(), and RSTRING_LEN.
VALUE rb_econv_substr_append | ( | rb_econv_t * | ec, |
VALUE | src, | ||
long | off, | ||
long | len, | ||
VALUE | dst, | ||
int | flags | ||
) |
Definition at line 1852 of file transcode.c.
References OBJ_INFECT_RAW, rb_econv_append(), RB_GC_GUARD, rb_str_new_frozen(), and RSTRING_PTR.
Referenced by rb_econv_str_append(), rb_econv_str_convert(), and rb_econv_substr_convert().
VALUE rb_econv_substr_convert | ( | rb_econv_t * | ec, |
VALUE | src, | ||
long | byteoff, | ||
long | bytesize, | ||
int | flags | ||
) |
Definition at line 1868 of file transcode.c.
References Qnil, and rb_econv_substr_append().
void rb_register_transcoder | ( | const rb_transcoder * | tr | ) |
Definition at line 203 of file transcode.c.
References rb_transcoder::dst_encoding, and rb_transcoder::src_encoding.
Definition at line 2884 of file transcode.c.
Referenced by rb_str_ellipsize().
VALUE rb_cEncodingConverter |
Definition at line 23 of file transcode.c.
VALUE rb_eConverterNotFoundError |
Definition at line 21 of file transcode.c.
Referenced by InitVM_transcode().
VALUE rb_eInvalidByteSequenceError |
Definition at line 20 of file transcode.c.
Referenced by InitVM_transcode().
VALUE rb_eUndefinedConversionError |
Definition at line 19 of file transcode.c.
Referenced by InitVM_transcode().