Ruby
2.4.2p198(2017-09-14revision59899)
|
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 | |
static unsigned char * | allocate_converted_string (const char *sname, const char *dname, const unsigned char *str, size_t len, unsigned char *caller_dst_buf, size_t caller_dst_bufsize, size_t *dst_len_ptr) |
static transcoder_entry_t * | make_transcoder_entry (const char *sname, const char *dname) |
static transcoder_entry_t * | get_transcoder_entry (const char *sname, const char *dname) |
void | rb_register_transcoder (const rb_transcoder *tr) |
static void | declare_transcoder (const char *sname, const char *dname, const char *lib) |
void | rb_declare_transcoder (const char *enc1, const char *enc2, const char *lib) |
static int | transcode_search_path_i (st_data_t key, st_data_t val, st_data_t arg) |
static int | transcode_search_path (const char *sname, const char *dname, void(*callback)(const char *sname, const char *dname, int depth, void *arg), void *arg) |
static const rb_transcoder * | load_transcoder_entry (transcoder_entry_t *entry) |
static const char * | get_replacement_character (const char *encname, size_t *len_ret, const char **repl_encname_ptr) |
static const unsigned char * | transcode_char_start (rb_transcoding *tc, const unsigned char *in_start, const unsigned char *inchar_start, const unsigned char *in_p, size_t *char_len_ptr) |
static rb_econv_result_t | transcode_restartable0 (const unsigned char **in_pos, unsigned char **out_pos, const unsigned char *in_stop, unsigned char *out_stop, rb_transcoding *tc, const int opt) |
static rb_econv_result_t | transcode_restartable (const unsigned char **in_pos, unsigned char **out_pos, const unsigned char *in_stop, unsigned char *out_stop, rb_transcoding *tc, const int opt) |
static rb_transcoding * | rb_transcoding_open_by_transcoder (const rb_transcoder *tr, int flags) |
static rb_econv_result_t | rb_transcoding_convert (rb_transcoding *tc, const unsigned char **input_ptr, const unsigned char *input_stop, unsigned char **output_ptr, unsigned char *output_stop, int flags) |
static void | rb_transcoding_close (rb_transcoding *tc) |
static size_t | rb_transcoding_memsize (rb_transcoding *tc) |
static rb_econv_t * | rb_econv_alloc (int n_hint) |
static int | rb_econv_add_transcoder_at (rb_econv_t *ec, const rb_transcoder *tr, int i) |
static rb_econv_t * | rb_econv_open_by_transcoder_entries (int n, transcoder_entry_t **entries) |
static void | trans_open_i (const char *sname, const char *dname, int depth, void *arg) |
static rb_econv_t * | rb_econv_open0 (const char *sname, const char *dname, int ecflags) |
static int | decorator_names (int ecflags, const char **decorators_ret) |
rb_econv_t * | rb_econv_open (const char *sname, const char *dname, int ecflags) |
static int | trans_sweep (rb_econv_t *ec, const unsigned char **input_ptr, const unsigned char *input_stop, unsigned char **output_ptr, unsigned char *output_stop, int flags, int start) |
static rb_econv_result_t | rb_trans_conv (rb_econv_t *ec, const unsigned char **input_ptr, const unsigned char *input_stop, unsigned char **output_ptr, unsigned char *output_stop, int flags, int *result_position_ptr) |
static rb_econv_result_t | rb_econv_convert0 (rb_econv_t *ec, const unsigned char **input_ptr, const unsigned char *input_stop, unsigned char **output_ptr, unsigned char *output_stop, int flags) |
static int | output_replacement_character (rb_econv_t *ec) |
static int | output_hex_charref (rb_econv_t *ec) |
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) |
static int | asciicompat_encoding_i (st_data_t key, st_data_t val, st_data_t arg) |
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) |
static int | rb_econv_add_converter (rb_econv_t *ec, const char *sname, const char *dname, int n) |
static int | rb_econv_decorate_at (rb_econv_t *ec, const char *decorator_name, int n) |
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) |
static VALUE | econv_description (const char *sname, const char *dname, int ecflags, VALUE mesg) |
VALUE | rb_econv_open_exc (const char *sname, const char *dname, int ecflags) |
static VALUE | make_econv_exception (rb_econv_t *ec) |
static void | more_output_buffer (VALUE destination, unsigned char *(*resize_destination)(VALUE, size_t, size_t), int max_output, unsigned char **out_start_ptr, unsigned char **out_pos, unsigned char **out_stop_ptr) |
static int | make_replacement (rb_econv_t *ec) |
int | rb_econv_set_replacement (rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname) |
static VALUE | proc_fallback (VALUE fallback, VALUE c) |
static VALUE | method_fallback (VALUE fallback, VALUE c) |
static VALUE | aref_fallback (VALUE fallback, VALUE c) |
static void | transcode_loop (const unsigned char **in_pos, unsigned char **out_pos, const unsigned char *in_stop, unsigned char *out_stop, VALUE destination, unsigned char *(*resize_destination)(VALUE, size_t, size_t), const char *src_encoding, const char *dst_encoding, int ecflags, VALUE ecopts) |
static unsigned char * | str_transcoding_resize (VALUE destination, size_t len, size_t new_len) |
static int | econv_opts (VALUE opt, int ecflags) |
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) |
static int | enc_arg (VALUE *arg, const char **name_p, rb_encoding **enc_p) |
static int | str_transcode_enc_args (VALUE str, VALUE *arg1, VALUE *arg2, const char **sname_p, rb_encoding **senc_p, const char **dname_p, rb_encoding **denc_p) |
static int | str_transcode0 (int argc, VALUE *argv, VALUE *self, int ecflags, VALUE ecopts) |
static int | str_transcode (int argc, VALUE *argv, VALUE *self) |
static VALUE | str_encode_associate (VALUE str, int encidx) |
static VALUE | str_encode_bang (int argc, VALUE *argv, VALUE str) |
static VALUE | encoded_dup (VALUE newstr, VALUE str, int encidx) |
static VALUE | str_encode (int argc, VALUE *argv, VALUE str) |
VALUE | rb_str_encode (VALUE str, VALUE to, int ecflags, VALUE ecopts) |
static void | econv_free (void *ptr) |
static size_t | econv_memsize (const void *ptr) |
static VALUE | econv_s_allocate (VALUE klass) |
static rb_encoding * | make_dummy_encoding (const char *name) |
static rb_encoding * | make_encoding (const char *name) |
static VALUE | make_encobj (const char *name) |
static VALUE | econv_s_asciicompat_encoding (VALUE klass, VALUE arg) |
static void | econv_args (int argc, VALUE *argv, VALUE *snamev_p, VALUE *dnamev_p, const char **sname_p, const char **dname_p, rb_encoding **senc_p, rb_encoding **denc_p, int *ecflags_p, VALUE *ecopts_p) |
static int | decorate_convpath (VALUE convpath, int ecflags) |
static void | search_convpath_i (const char *sname, const char *dname, int depth, void *arg) |
static VALUE | econv_s_search_convpath (int argc, VALUE *argv, VALUE klass) |
int | rb_econv_has_convpath_p (const char *from_encoding, const char *to_encoding) |
static void | rb_econv_init_by_convpath_i (const char *sname, const char *dname, int depth, void *arg) |
static rb_econv_t * | rb_econv_init_by_convpath (VALUE self, VALUE convpath, const char **sname_p, const char **dname_p, rb_encoding **senc_p, rb_encoding **denc_p) |
static VALUE | econv_init (int argc, VALUE *argv, VALUE self) |
static VALUE | econv_inspect (VALUE self) |
static rb_econv_t * | check_econv (VALUE self) |
static VALUE | econv_source_encoding (VALUE self) |
static VALUE | econv_destination_encoding (VALUE self) |
static VALUE | econv_convpath (VALUE self) |
static VALUE | econv_equal (VALUE self, VALUE other) |
static VALUE | econv_result_to_symbol (rb_econv_result_t res) |
static VALUE | econv_primitive_convert (int argc, VALUE *argv, VALUE self) |
static VALUE | econv_convert (VALUE self, VALUE source_string) |
static VALUE | econv_finish (VALUE self) |
static VALUE | econv_primitive_errinfo (VALUE self) |
static VALUE | econv_insert_output (VALUE self, VALUE string) |
static VALUE | econv_putback (int argc, VALUE *argv, VALUE self) |
static VALUE | econv_last_error (VALUE self) |
static VALUE | econv_get_replacement (VALUE self) |
static VALUE | econv_set_replacement (VALUE self, VALUE arg) |
VALUE | rb_econv_make_exception (rb_econv_t *ec) |
void | rb_econv_check_error (rb_econv_t *ec) |
static VALUE | ecerr_source_encoding_name (VALUE self) |
static VALUE | ecerr_source_encoding (VALUE self) |
static VALUE | ecerr_destination_encoding_name (VALUE self) |
static VALUE | ecerr_destination_encoding (VALUE self) |
static VALUE | ecerr_error_char (VALUE self) |
static VALUE | ecerr_error_bytes (VALUE self) |
static VALUE | ecerr_readagain_bytes (VALUE self) |
static VALUE | ecerr_incomplete_input (VALUE self) |
void | Init_transcode (void) |
void | InitVM_transcode (void) |
Variables | |
VALUE | rb_eUndefinedConversionError |
VALUE | rb_eInvalidByteSequenceError |
VALUE | rb_eConverterNotFoundError |
VALUE | rb_cEncodingConverter |
static VALUE | sym_invalid |
static VALUE | sym_undef |
static VALUE | sym_replace |
static VALUE | sym_fallback |
static VALUE | sym_aref |
static VALUE | sym_xml |
static VALUE | sym_text |
static VALUE | sym_attr |
static VALUE | sym_universal_newline |
static VALUE | sym_crlf_newline |
static VALUE | sym_cr_newline |
static VALUE | sym_newline |
static VALUE | sym_universal |
static VALUE | sym_crlf |
static VALUE | sym_cr |
static VALUE | sym_lf |
static VALUE | sym_partial_input |
static VALUE | sym_invalid_byte_sequence |
static VALUE | sym_undefined_conversion |
static VALUE | sym_destination_buffer_full |
static VALUE | sym_source_buffer_empty |
static VALUE | sym_finished |
static VALUE | sym_after_output |
static VALUE | sym_incomplete_input |
static st_table * | transcoder_table |
static const char | transcoder_lib_prefix [] = "enc/trans/" |
static const rb_data_type_t | econv_data_type |
Referenced by transcode_restartable0().
#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]) |
Referenced by transcode_restartable0().
#define BL_MIN_BYTE (BL_BASE[0]) |
Referenced by transcode_restartable0().
#define BL_OFFSET | ( | byte | ) | (BL_BASE[2+(byte)-BL_MIN_BYTE]) |
#define BYTE_ADDR | ( | index | ) | (tr->byte_array + (index)) |
Referenced by transcode_restartable0().
#define DECORATOR_P | ( | sname, | |
dname | |||
) | (*(sname) == '\0') |
Definition at line 152 of file transcode.c.
Referenced by asciicompat_encoding_i(), decorate_convpath(), econv_convpath(), econv_init(), make_econv_exception(), rb_econv_add_transcoder_at(), rb_econv_decorate_at_first(), rb_econv_decorate_at_last(), rb_econv_init_by_convpath(), and search_convpath_i().
#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 get_replacement_character(), output_hex_charref(), rb_econv_insert_output(), rb_econv_set_replacement(), str_transcode0(), and transcode_search_path().
#define hash_fallback rb_hash_aref |
Definition at line 2242 of file transcode.c.
Referenced by transcode_loop().
#define MAX_ECFLAGS_DECORATORS 32 |
Definition at line 1022 of file transcode.c.
Referenced by decorate_convpath(), and 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 | |||
) |
Referenced by transcode_restartable0().
#define SUSPEND_AFTER_OUTPUT | ( | num | ) |
Referenced by transcode_restartable0().
#define SUSPEND_OBUF | ( | num | ) |
Referenced by transcode_restartable0().
#define TRANSCODING_READBUF | ( | tc | ) |
Definition at line 82 of file transcode.c.
Referenced by rb_econv_convert0(), rb_econv_insert_output(), rb_econv_putback(), transcode_char_start(), and transcode_restartable().
#define TRANSCODING_STATE | ( | tc | ) |
Definition at line 95 of file transcode.c.
Referenced by rb_transcoding_close(), rb_transcoding_open_by_transcoder(), and transcode_restartable0().
#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.
Referenced by transcode_restartable0().
#define TRANSCODING_WRITEBUF_SIZE | ( | tc | ) |
Definition at line 90 of file transcode.c.
Referenced by transcode_restartable0().
#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 |
|
static |
Definition at line 1515 of file transcode.c.
References dp, econv_destination_buffer_full, econv_finished, fail, len, memcpy, NULL, rb_econv_close(), rb_econv_convert(), rb_econv_open(), SIZE_MAX, xfree(), xmalloc, and xrealloc.
Referenced by output_hex_charref(), rb_econv_insert_output(), and rb_econv_set_replacement().
Definition at line 2257 of file transcode.c.
References rb_funcall3, and sym_aref.
Referenced by transcode_loop().
Definition at line 1765 of file transcode.c.
References asciicompat_encoding_t::ascii_compat_name, asciicompat_decoder, rb_transcoder::asciicompat_type, DECORATOR_P, transcoder_entry_t::dname, rb_transcoder::dst_encoding, load_transcoder_entry(), transcoder_entry_t::sname, ST_CONTINUE, and ST_STOP.
Referenced by rb_econv_asciicompat_encoding().
|
static |
Definition at line 3463 of file transcode.c.
References rb_econv_init_by_convpath_t::ec, rb_eTypeError, rb_raise(), and TypedData_Get_Struct.
Referenced by econv_convert(), econv_convpath(), econv_destination_encoding(), econv_equal(), econv_finish(), econv_get_replacement(), econv_insert_output(), econv_last_error(), econv_primitive_convert(), econv_primitive_errinfo(), econv_putback(), econv_set_replacement(), and econv_source_encoding().
Definition at line 220 of file transcode.c.
References transcoder_entry_t::lib, and make_transcoder_entry().
Referenced by rb_declare_transcoder().
|
static |
Definition at line 3056 of file transcode.c.
References asciicompat_encoder, rb_transcoder::asciicompat_type, decorator_names(), DECORATOR_P, rb_transcoder::dst_encoding, get_transcoder_entry(), len, load_transcoder_entry(), MAX_ECFLAGS_DECORATORS, RARRAY_AREF, RARRAY_LENINT, rb_ary_store(), rb_enc_name, rb_str_new_cstr(), rb_to_encoding(), RB_TYPE_P, rb_transcoder::src_encoding, and T_ARRAY.
Referenced by econv_s_search_convpath().
|
static |
Definition at line 1025 of file transcode.c.
References ECONV_CR_NEWLINE_DECORATOR, ECONV_CRLF_NEWLINE_DECORATOR, ECONV_NEWLINE_DECORATOR_MASK, ECONV_UNIVERSAL_NEWLINE_DECORATOR, ECONV_XML_ATTR_CONTENT_DECORATOR, ECONV_XML_ATTR_QUOTE_DECORATOR, and ECONV_XML_TEXT_DECORATOR.
Referenced by decorate_convpath(), and rb_econv_open().
Definition at line 4298 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4286 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4340 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4319 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4382 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4352 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4274 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
Definition at line 4248 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by InitVM_transcode().
|
static |
Definition at line 2996 of file transcode.c.
References NIL_P, NULL, NUM2INT, Qnil, rb_econv_prepare_opts(), rb_enc_from_index(), rb_enc_name, rb_error_arity(), rb_scan_args(), rb_to_encoding_index(), rb_to_int(), StringValue, and StringValueCStr.
Referenced by econv_init(), and econv_s_search_convpath().
Definition at line 3841 of file transcode.c.
References check_econv(), ECONV_PARTIAL_INPUT, econv_primitive_convert(), INT2NUM, make_econv_exception(), NULL, Qnil, rb_bug(), rb_eArgError, rb_exc_raise(), rb_raise(), rb_str_dup(), rb_str_new(), rb_econv_init_by_convpath_t::ret, StringValue, sym_finished, sym_incomplete_input, sym_invalid_byte_sequence, sym_source_buffer_empty, and sym_undefined_conversion.
Referenced by InitVM_transcode().
Definition at line 3527 of file transcode.c.
References check_econv(), DECORATOR_P, rb_transcoder::dst_encoding, rb_econv_t::elems, make_encobj(), rb_econv_t::num_trans, rb_ary_new(), rb_ary_push(), rb_assoc_new(), rb_str_new_cstr(), result, rb_transcoder::src_encoding, rb_econv_elem_t::tc, and rb_transcoding::transcoder.
Referenced by InitVM_transcode().
|
static |
Definition at line 1975 of file transcode.c.
References ECONV_CR_NEWLINE_DECORATOR, ECONV_CRLF_NEWLINE_DECORATOR, ECONV_NEWLINE_DECORATOR_MASK, ECONV_UNIVERSAL_NEWLINE_DECORATOR, ECONV_XML_ATTR_CONTENT_DECORATOR, ECONV_XML_ATTR_QUOTE_DECORATOR, ECONV_XML_TEXT_DECORATOR, NIL_P, NULL, rb_str_cat2(), rb_str_catf(), and rb_str_new().
Referenced by econv_inspect(), and rb_econv_open_exc().
Definition at line 3496 of file transcode.c.
References check_econv(), rb_econv_t::destination_encoding, Qnil, and rb_enc_from_encoding().
Referenced by InitVM_transcode().
Definition at line 3551 of file transcode.c.
References check_econv(), DATA_PTR, rb_econv_t::destination_encoding_name, rb_econv_t::elems, rb_econv_t::flags, memcmp(), rb_econv_t::num_trans, Qfalse, Qnil, Qtrue, rb_typeddata_is_kind_of(), rb_econv_t::replacement_enc, rb_econv_t::replacement_len, rb_econv_t::replacement_str, rb_econv_t::source_encoding_name, rb_econv_elem_t::tc, and rb_transcoding::transcoder.
Referenced by InitVM_transcode().
Definition at line 3891 of file transcode.c.
References check_econv(), econv_primitive_convert(), INT2FIX, make_econv_exception(), NULL, Qnil, rb_bug(), rb_exc_raise(), rb_str_new(), rb_econv_init_by_convpath_t::ret, sym_finished, sym_incomplete_input, sym_invalid_byte_sequence, and sym_undefined_conversion.
Referenced by InitVM_transcode().
|
static |
Definition at line 2909 of file transcode.c.
References rb_transcoding::rb_transcoding_state_t::ptr, and rb_econv_close().
Definition at line 4175 of file transcode.c.
References check_econv(), make_replacement(), rb_enc_find(), rb_enc_str_new(), rb_eUndefinedConversionError, rb_raise(), rb_econv_t::replacement_enc, rb_econv_t::replacement_len, rb_econv_t::replacement_str, and rb_econv_init_by_convpath_t::ret.
Referenced by InitVM_transcode().
Definition at line 3384 of file transcode.c.
References DATA_PTR, DECORATOR_P, rb_econv_t::destination_encoding, rb_econv_init_by_convpath_t::ec, econv_args(), make_dummy_encoding(), NIL_P, Qnil, rb_check_array_type(), rb_check_typeddata(), rb_econv_init_by_convpath(), rb_econv_open_exc(), rb_econv_open_opts(), rb_eTypeError, rb_exc_raise(), RB_GC_GUARD, rb_raise(), and rb_econv_t::source_encoding.
Referenced by InitVM_transcode().
Definition at line 4057 of file transcode.c.
References check_econv(), Qnil, rb_eArgError, rb_econv_encoding_to_insert_output(), rb_econv_insert_output(), rb_enc_find(), rb_enc_from_encoding(), rb_raise(), rb_str_encode(), rb_econv_init_by_convpath_t::ret, RSTRING_LEN, RSTRING_PTR, and StringValue.
Referenced by InitVM_transcode().
Definition at line 3443 of file transcode.c.
References rb_econv_t::destination_encoding_name, rb_econv_init_by_convpath_t::ec, econv_description(), rb_econv_t::flags, rb_obj_classname(), rb_sprintf(), rb_str_cat2(), rb_econv_t::source_encoding_name, and TypedData_Get_Struct.
Referenced by InitVM_transcode().
Definition at line 4151 of file transcode.c.
References check_econv(), make_econv_exception(), NIL_P, and Qnil.
Referenced by InitVM_transcode().
|
static |
Definition at line 2916 of file transcode.c.
|
static |
Definition at line 2425 of file transcode.c.
References ECONV_CR_NEWLINE_DECORATOR, ECONV_CRLF_NEWLINE_DECORATOR, ECONV_INVALID_REPLACE, ECONV_NEWLINE_DECORATOR_MASK, ECONV_UNDEF_HEX_CHARREF, ECONV_UNDEF_REPLACE, ECONV_UNIVERSAL_NEWLINE_DECORATOR, ECONV_XML_ATTR_CONTENT_DECORATOR, ECONV_XML_ATTR_QUOTE_DECORATOR, ECONV_XML_TEXT_DECORATOR, NIL_P, PRIsVALUE, rb_eArgError, rb_hash_aref(), rb_raise(), rb_sym2str, RB_TYPE_P, RTEST, sym_attr, sym_cr, sym_cr_newline, sym_crlf, sym_crlf_newline, sym_invalid, sym_lf, sym_newline, sym_replace, sym_text, sym_undef, sym_universal, sym_universal_newline, sym_xml, SYMBOL_P, and T_SYMBOL.
Referenced by rb_econv_prepare_options().
Definition at line 3695 of file transcode.c.
References check_econv(), rb_econv_t::destination_encoding, ECONV_AFTER_OUTPUT, econv_destination_buffer_full, ECONV_PARTIAL_INPUT, econv_result_to_symbol(), rb_transcoding::flags, input, LONG_MAX, NIL_P, NULL, NUM2INT, NUM2LONG, OBJ_INFECT_RAW, output, Qnil, rb_eArgError, rb_econv_convert(), rb_enc_associate(), rb_error_arity(), rb_hash_aref(), rb_raise(), rb_scan_args(), rb_str_capacity(), rb_str_drop_bytes(), rb_str_modify(), rb_str_resize(), rb_str_set_len(), rb_to_int(), RSTRING_EMBED_LEN_MAX, RSTRING_LEN, RSTRING_PTR, RTEST, StringValue, sym_after_output, and sym_partial_input.
Referenced by econv_convert(), econv_finish(), and InitVM_transcode().
Definition at line 3999 of file transcode.c.
References rb_transcoding::rb_transcoding_state_t::ary, check_econv(), rb_econv_t::destination_encoding, econv_result_to_symbol(), rb_econv_t::error_bytes_len, rb_econv_t::error_bytes_start, rb_econv_t::last_error, Qnil, rb_ary_new2, rb_ary_store(), rb_str_new(), rb_str_new2, rb_econv_t::readagain_len, rb_econv_t::result, and rb_econv_t::source_encoding.
Referenced by InitVM_transcode().
Definition at line 4102 of file transcode.c.
References check_econv(), max(), NIL_P, NULL, NUM2INT, rb_econv_putback(), rb_econv_putbackable(), rb_enc_associate(), rb_scan_args(), rb_str_new(), RSTRING_PTR, and rb_econv_t::source_encoding.
Referenced by InitVM_transcode().
|
static |
Definition at line 3586 of file transcode.c.
References econv_after_output, econv_destination_buffer_full, econv_finished, econv_incomplete_input, econv_invalid_byte_sequence, econv_source_buffer_empty, econv_undefined_conversion, INT2NUM, sym_after_output, sym_destination_buffer_full, sym_finished, sym_incomplete_input, sym_invalid_byte_sequence, sym_source_buffer_empty, and sym_undefined_conversion.
Referenced by econv_primitive_convert(), and econv_primitive_errinfo().
Definition at line 2928 of file transcode.c.
References NULL, and TypedData_Wrap_Struct.
Referenced by InitVM_transcode().
Definition at line 2978 of file transcode.c.
References enc_arg(), make_encoding(), NULL, Qnil, rb_econv_asciicompat_encoding(), and rb_enc_from_encoding().
Referenced by InitVM_transcode().
Definition at line 3139 of file transcode.c.
References decorate_convpath(), econv_args(), NIL_P, Qnil, rb_econv_open_exc(), rb_exc_raise(), RB_GC_GUARD, search_convpath_i(), and transcode_search_path().
Referenced by InitVM_transcode().
Definition at line 4201 of file transcode.c.
References check_econv(), rb_econv_set_replacement(), rb_enc_get(), rb_enc_name, rb_eUndefinedConversionError, rb_raise(), rb_econv_init_by_convpath_t::ret, RSTRING_LEN, RSTRING_PTR, and StringValue.
Referenced by InitVM_transcode().
Definition at line 3481 of file transcode.c.
References check_econv(), Qnil, rb_enc_from_encoding(), and rb_econv_t::source_encoding.
Referenced by InitVM_transcode().
|
static |
Definition at line 2610 of file transcode.c.
References NULL, rb_enc_from_index(), rb_enc_name, rb_to_encoding_index(), and StringValueCStr.
Referenced by econv_s_asciicompat_encoding(), rb_econv_init_by_convpath(), and str_transcode_enc_args().
Definition at line 2894 of file transcode.c.
References rb_enc_associate_index(), rb_obj_class(), rb_str_dup(), RBASIC_SET_CLASS, and str_encode_associate().
Referenced by rb_str_encode(), str_encode(), and str_encode_bang().
|
static |
Definition at line 388 of file transcode.c.
References encoding_equal.
Referenced by make_replacement().
|
static |
Definition at line 187 of file transcode.c.
References NULL, st_data_t, st_lookup, and val.
Referenced by decorate_convpath(), rb_econv_add_converter(), rb_econv_binmode(), and trans_open_i().
void Init_transcode | ( | void | ) |
Definition at line 4411 of file transcode.c.
References ID2SYM, InitVM, rb_intern, st_init_strcasetable(), sym_after_output, sym_aref, sym_attr, sym_cr, sym_cr_newline, sym_crlf, sym_crlf_newline, sym_destination_buffer_full, sym_fallback, sym_finished, sym_incomplete_input, sym_invalid, sym_invalid_byte_sequence, sym_lf, sym_newline, sym_partial_input, sym_replace, sym_source_buffer_empty, sym_text, sym_undef, sym_undefined_conversion, sym_universal, sym_universal_newline, and sym_xml.
void InitVM_transcode | ( | void | ) |
Definition at line 4448 of file transcode.c.
References ecerr_destination_encoding(), ecerr_destination_encoding_name(), ecerr_error_bytes(), ecerr_error_char(), ecerr_incomplete_input(), ecerr_readagain_bytes(), ecerr_source_encoding(), ecerr_source_encoding_name(), ECONV_AFTER_OUTPUT, econv_convert(), econv_convpath(), ECONV_CR_NEWLINE_DECORATOR, ECONV_CRLF_NEWLINE_DECORATOR, econv_destination_encoding(), econv_equal(), econv_finish(), econv_get_replacement(), econv_init(), econv_insert_output(), econv_inspect(), ECONV_INVALID_MASK, ECONV_INVALID_REPLACE, econv_last_error(), ECONV_PARTIAL_INPUT, econv_primitive_convert(), econv_primitive_errinfo(), econv_putback(), econv_s_allocate(), econv_s_asciicompat_encoding(), econv_s_search_convpath(), econv_set_replacement(), econv_source_encoding(), ECONV_UNDEF_HEX_CHARREF, ECONV_UNDEF_MASK, ECONV_UNDEF_REPLACE, ECONV_UNIVERSAL_NEWLINE_DECORATOR, ECONV_XML_ATTR_CONTENT_DECORATOR, ECONV_XML_ATTR_QUOTE_DECORATOR, ECONV_XML_TEXT_DECORATOR, Init_newline(), INT2FIX, rb_cData, rb_cEncoding, rb_cEncodingConverter, rb_cString, rb_define_alloc_func(), rb_define_class_under(), rb_define_const(), rb_define_method(), rb_define_singleton_method(), rb_eConverterNotFoundError, rb_eEncodingError, rb_eInvalidByteSequenceError, rb_eUndefinedConversionError, str_encode(), and str_encode_bang().
|
static |
Definition at line 360 of file transcode.c.
References FL_TAINT, FL_UNSET, len, transcoder_entry_t::lib, memcpy, NULL, OBJ_FREEZE, rb_require_safe(), rb_safe_level(), rb_str_new(), rb_str_set_len(), RSTRING_PTR, strlen(), transcoder_entry_t::transcoder, and transcoder_lib_prefix.
Referenced by asciicompat_encoding_i(), decorate_convpath(), rb_econv_add_converter(), and rb_econv_open_by_transcoder_entries().
|
static |
Definition at line 2934 of file transcode.c.
References rb_define_dummy_encoding(), and rb_enc_from_index().
Referenced by econv_init(), and make_encoding().
|
static |
Definition at line 2044 of file transcode.c.
References DECORATOR_P, rb_econv_t::destination_encoding, rb_econv_t::destination_encoding_name, rb_transcoder::dst_encoding, econv_incomplete_input, econv_invalid_byte_sequence, econv_undefined_conversion, rb_econv_t::elems, err, rb_econv_t::error_bytes_len, rb_econv_t::error_bytes_start, rb_econv_t::last_error, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, rb_econv_t::num_trans, Qfalse, Qnil, Qtrue, rb_eInvalidByteSequenceError, rb_enc_associate_index(), rb_enc_find_index(), rb_enc_from_encoding(), rb_enc_from_index(), rb_enc_mbc_to_codepoint, rb_enc_precise_mbclen(), rb_eUndefinedConversionError, rb_exc_new3, rb_intern, rb_ivar_set(), rb_sprintf(), rb_str_catf(), rb_str_dump(), rb_str_new(), rb_str_new2, rb_utf8_encoding(), rb_econv_t::readagain_len, rb_econv_t::result, rb_econv_t::source_encoding, rb_econv_t::source_encoding_name, rb_transcoder::src_encoding, StringValueCStr, rb_econv_elem_t::tc, and rb_transcoding::transcoder.
Referenced by econv_convert(), econv_finish(), econv_last_error(), rb_econv_check_error(), rb_econv_make_exception(), and transcode_loop().
Definition at line 2954 of file transcode.c.
References make_encoding(), and rb_enc_from_encoding().
Referenced by econv_convpath(), and search_convpath_i().
|
static |
Definition at line 2944 of file transcode.c.
References make_dummy_encoding(), and rb_enc_find().
Referenced by econv_s_asciicompat_encoding(), and make_encobj().
|
static |
Definition at line 2161 of file transcode.c.
References rb_transcoder::dst_encoding, get_replacement_character(), rb_econv_t::last_tc, len, rb_econv_encoding_to_insert_output(), rb_enc_find(), rb_econv_t::replacement_allocated, rb_econv_t::replacement_enc, rb_econv_t::replacement_len, rb_econv_t::replacement_str, and rb_transcoding::transcoder.
Referenced by econv_get_replacement(), and output_replacement_character().
|
static |
Definition at line 164 of file transcode.c.
References ALLOC, transcoder_entry_t::dname, transcoder_entry_t::lib, NULL, transcoder_entry_t::sname, st_add_direct, st_data_t, st_init_strcasetable(), st_lookup, transcoder_entry_t::transcoder, and val.
Referenced by declare_transcoder(), and rb_register_transcoder().
Definition at line 2251 of file transcode.c.
References rb_method_call().
Referenced by transcode_loop().
|
static |
Definition at line 1386 of file transcode.c.
References allocate_converted_string(), encoding_equal, rb_econv_t::error_bytes_len, rb_econv_t::error_bytes_start, fail, rb_econv_t::last_error, rb_econv_insert_output(), snprintf, rb_econv_t::source_encoding, strlen(), and xfree().
Referenced by rb_econv_convert().
|
static |
Definition at line 2227 of file transcode.c.
References make_replacement(), rb_econv_insert_output(), rb_econv_t::replacement_enc, rb_econv_t::replacement_len, and rb_econv_t::replacement_str.
Referenced by rb_econv_convert(), and rb_econv_convert0().
Definition at line 2245 of file transcode.c.
References rb_ary_new4, and rb_proc_call().
Referenced by transcode_loop().
Definition at line 231 of file transcode.c.
References declare_transcoder(), rb_eArgError, and rb_raise().
|
static |
Definition at line 1880 of file transcode.c.
References get_transcoder_entry(), load_transcoder_entry(), rb_econv_add_transcoder_at(), and rb_econv_t::started.
Referenced by rb_econv_decorate_at(), rb_econv_init_by_convpath(), and rb_econv_init_by_convpath_i().
|
static |
Definition at line 889 of file transcode.c.
References DECORATOR_P, rb_transcoder::dst_encoding, econv_source_buffer_empty, rb_econv_t::elems, rb_econv_elem_t::last_result, rb_econv_t::last_tc, MEMMOVE, rb_econv_t::num_allocated, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_end, rb_econv_elem_t::out_buf_start, rb_econv_elem_t::out_data_end, rb_econv_elem_t::out_data_start, rb_transcoding_open_by_transcoder(), REALLOC_N, rb_transcoder::src_encoding, rb_econv_elem_t::tc, rb_transcoding::transcoder, and xmalloc.
Referenced by rb_econv_add_converter(), and rb_econv_open_by_transcoder_entries().
|
static |
Definition at line 851 of file transcode.c.
References ALLOC, ALLOC_N, rb_econv_t::destination_encoding, rb_econv_t::destination_encoding_name, econv_source_buffer_empty, rb_econv_t::elems, rb_econv_t::error_bytes_len, rb_econv_t::error_bytes_start, rb_econv_t::error_tc, rb_econv_t::flags, rb_econv_t::in_buf_end, rb_econv_t::in_buf_start, rb_econv_t::in_data_end, rb_econv_t::in_data_start, rb_econv_t::last_error, rb_econv_t::last_tc, NULL, rb_econv_t::num_allocated, rb_econv_t::num_finished, rb_econv_t::num_trans, rb_econv_t::readagain_len, rb_econv_t::replacement_allocated, rb_econv_t::replacement_enc, rb_econv_t::replacement_len, rb_econv_t::replacement_str, rb_econv_t::result, rb_econv_t::source_encoding, rb_econv_t::source_encoding_name, and rb_econv_t::started.
Referenced by rb_econv_init_by_convpath(), and rb_econv_open_by_transcoder_entries().
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 append_wstr(), and 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, asciicompat_encoding_i(), NULL, st_table::num_entries, st_data_t, st_foreach, and st_lookup.
Referenced by econv_s_asciicompat_encoding(), and make_writeconv().
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, rb_econv_t::elems, rb_econv_t::flags, get_transcoder_entry(), rb_econv_t::num_trans, rb_econv_elem_t::out_buf_start, rb_transcoding_close(), rb_econv_elem_t::tc, rb_transcoding::transcoder, transcoder_entry_t::transcoder, and xfree().
Referenced by rb_io_binmode().
void rb_econv_check_error | ( | rb_econv_t * | ec | ) |
Definition at line 4231 of file transcode.c.
References make_econv_exception(), NIL_P, and rb_exc_raise().
Referenced by fill_cbuf(), gzfile_getc(), and rb_econv_append().
void rb_econv_close | ( | rb_econv_t * | ec | ) |
Definition at line 1698 of file transcode.c.
References rb_econv_t::elems, rb_econv_t::in_buf_start, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_start, rb_transcoding_close(), rb_econv_t::replacement_allocated, rb_econv_t::replacement_str, rb_econv_elem_t::tc, and xfree().
Referenced by allocate_converted_string(), append_wstr(), clear_readconv(), clear_writeconv(), econv_free(), gzfile_reset(), io_ascii8bit_binmode(), rb_econv_open(), rb_econv_open_by_transcoder_entries(), rb_econv_open_opts(), str_cat_conv_enc_opts(), and transcode_loop().
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 econv_incomplete_input, econv_invalid_byte_sequence, ECONV_INVALID_MASK, ECONV_INVALID_REPLACE, ECONV_UNDEF_HEX_CHARREF, ECONV_UNDEF_MASK, ECONV_UNDEF_REPLACE, econv_undefined_conversion, rb_econv_t::flags, output_hex_charref(), output_replacement_character(), rb_econv_convert0(), and rb_econv_t::started.
Referenced by allocate_converted_string(), econv_primitive_convert(), fill_cbuf(), finish_writeconv(), gzfile_getc(), rb_econv_append(), str_cat_conv_enc_opts(), and transcode_loop().
|
static |
Definition at line 1262 of file transcode.c.
References rb_econv_t::destination_encoding, rb_transcoder::dst_encoding, econv_after_output, ECONV_AFTER_OUTPUT, econv_destination_buffer_full, econv_finished, econv_incomplete_input, econv_invalid_byte_sequence, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, econv_undefined_conversion, rb_econv_t::elems, rb_econv_t::error_bytes_len, rb_econv_t::error_bytes_start, rb_econv_t::error_tc, rb_econv_t::in_buf_start, rb_econv_t::in_data_end, rb_econv_t::in_data_start, rb_econv_t::last_error, len, memcpy, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_start, rb_econv_elem_t::out_data_end, rb_econv_elem_t::out_data_start, output_replacement_character(), rb_trans_conv(), rb_transcoding::readagain_len, rb_econv_t::readagain_len, rb_transcoding::recognized_len, rb_econv_t::result, rb_econv_t::source_encoding, rb_transcoder::src_encoding, rb_econv_elem_t::tc, rb_transcoding::transcoder, and TRANSCODING_READBUF.
Referenced by rb_econv_convert().
|
static |
Definition at line 1899 of file transcode.c.
References rb_econv_add_converter().
Referenced by rb_econv_decorate_at_first(), and rb_econv_decorate_at_last().
int rb_econv_decorate_at_first | ( | rb_econv_t * | ec, |
const char * | decorator_name | ||
) |
Definition at line 1905 of file transcode.c.
References asciicompat_decoder, rb_transcoder::asciicompat_type, DECORATOR_P, rb_transcoder::dst_encoding, rb_econv_t::elems, rb_econv_t::num_trans, rb_econv_decorate_at(), rb_transcoder::src_encoding, rb_econv_elem_t::tc, and rb_transcoding::transcoder.
int rb_econv_decorate_at_last | ( | rb_econv_t * | ec, |
const char * | decorator_name | ||
) |
Definition at line 1922 of file transcode.c.
References asciicompat_encoder, rb_transcoder::asciicompat_type, DECORATOR_P, rb_transcoder::dst_encoding, rb_econv_t::elems, rb_econv_t::num_trans, rb_econv_decorate_at(), rb_transcoder::src_encoding, rb_econv_elem_t::tc, and rb_transcoding::transcoder.
Referenced by rb_econv_open().
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 econv_insert_output(), make_replacement(), rb_econv_insert_output(), and rb_econv_set_replacement().
Definition at line 3172 of file transcode.c.
References Qnil, RTEST, search_convpath_i(), and transcode_search_path().
Referenced by rb_w32_write_console().
|
static |
Definition at line 3202 of file transcode.c.
References DATA_PTR, DECORATOR_P, rb_econv_t::destination_encoding_name, rb_transcoder::dst_encoding, rb_econv_init_by_convpath_t::ec, rb_econv_t::elems, enc_arg(), rb_econv_init_by_convpath_t::index, msg, NIL_P, NULL, rb_econv_t::num_trans, RARRAY_LEN, RARRAY_LENINT, rb_ary_entry(), rb_check_array_type(), rb_eArgError, rb_econv_add_converter(), rb_econv_alloc(), rb_econv_init_by_convpath_i(), rb_exc_new_str(), rb_exc_raise(), RB_GC_GUARD, rb_raise(), rb_sprintf(), rb_econv_init_by_convpath_t::ret, rb_econv_t::source_encoding_name, rb_transcoder::src_encoding, StringValueCStr, rb_econv_elem_t::tc, transcode_search_path(), and rb_transcoding::transcoder.
Referenced by econv_init().
|
static |
Definition at line 3187 of file transcode.c.
References rb_econv_init_by_convpath_t::ec, rb_econv_init_by_convpath_t::index, rb_econv_add_converter(), and rb_econv_init_by_convpath_t::ret.
Referenced by rb_econv_init_by_convpath().
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 allocate_converted_string(), asciicompat_encoder, rb_transcoder::asciicompat_type, buf, rb_econv_t::elems, encoding_equal, fail, rb_econv_t::in_buf_end, rb_econv_t::in_buf_start, rb_econv_t::in_data_end, rb_econv_t::in_data_start, len, memcpy, MEMMOVE, NULL, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_end, rb_econv_elem_t::out_buf_start, rb_econv_elem_t::out_data_end, rb_econv_elem_t::out_data_start, rb_econv_encoding_to_insert_output(), rb_transcoding::readagain_len, rb_transcoding::recognized_len, rb_econv_t::started, rb_econv_elem_t::tc, rb_transcoding::transcoder, TRANSCODING_READBUF, xfree(), xmalloc, and xrealloc.
Referenced by econv_insert_output(), output_hex_charref(), output_replacement_character(), and transcode_loop().
VALUE rb_econv_make_exception | ( | rb_econv_t * | ec | ) |
Definition at line 4225 of file transcode.c.
References make_econv_exception().
Referenced by fill_cbuf(), and finish_writeconv().
size_t rb_econv_memsize | ( | rb_econv_t * | ec | ) |
Definition at line 1716 of file transcode.c.
References rb_econv_t::elems, rb_econv_t::in_buf_end, rb_econv_t::in_buf_start, rb_econv_t::num_allocated, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_end, rb_econv_elem_t::out_buf_start, rb_transcoding_memsize(), rb_econv_t::replacement_allocated, rb_econv_t::replacement_len, size, and rb_econv_elem_t::tc.
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 decorator_names(), ECONV_ERROR_HANDLER_MASK, rb_econv_t::flags, MAX_ECFLAGS_DECORATORS, NULL, rb_econv_close(), rb_econv_decorate_at_last(), and rb_econv_open0().
Referenced by allocate_converted_string(), append_wstr(), and rb_econv_open_opts().
|
static |
Definition at line 971 of file transcode.c.
References rb_econv_t::destination_encoding_name, trans_open_t::entries, rb_econv_t::flags, NULL, trans_open_t::num_additional, rb_econv_open_by_transcoder_entries(), rb_enc_find_index(), rb_enc_from_index(), rb_econv_t::source_encoding_name, trans_open_i(), transcode_search_path(), and xfree().
Referenced by rb_econv_open().
|
static |
Definition at line 928 of file transcode.c.
References load_transcoder_entry(), NULL, rb_econv_t::num_trans, rb_econv_add_transcoder_at(), rb_econv_alloc(), and rb_econv_close().
Referenced by rb_econv_open0().
Definition at line 2033 of file transcode.c.
References econv_description(), rb_eConverterNotFoundError, rb_exc_new3, rb_str_cat2(), and rb_str_new_cstr().
Referenced by econv_init(), econv_s_search_convpath(), make_readconv(), make_writeconv(), and transcode_loop().
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, NULL, OBJ_FROZEN, Qnil, rb_bug(), rb_econv_close(), rb_econv_open(), rb_econv_set_replacement(), rb_enc_get(), rb_enc_name, rb_hash_aref(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, sym_replace, and T_HASH.
Referenced by econv_init(), gzfile_reset(), make_readconv(), make_writeconv(), rb_gzfile_ecopts(), str_cat_conv_enc_opts(), and transcode_loop().
Definition at line 2524 of file transcode.c.
References econv_opts(), ENC_CODERANGE_BROKEN, NIL_P, Qnil, rb_check_hash_type(), rb_eArgError, rb_enc_get(), rb_enc_name, rb_enc_str_coderange(), rb_hash_aref(), rb_hash_aset(), rb_hash_freeze(), rb_hash_new(), rb_obj_is_method(), rb_obj_is_proc(), rb_raise(), rb_respond_to(), rb_str_dump(), rb_str_new_frozen(), StringValue, StringValueCStr, sym_aref, sym_fallback, and sym_replace.
Referenced by io_encoding_set(), rb_econv_prepare_opts(), and rb_io_extract_modeenc().
Definition at line 2569 of file transcode.c.
References rb_econv_prepare_options().
Referenced by econv_args(), rb_gzfile_ecopts(), and str_transcode().
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, memcpy, rb_econv_t::num_trans, rb_transcoding::readagain_len, rb_transcoding::recognized_len, rb_econv_elem_t::tc, and TRANSCODING_READBUF.
Referenced by econv_putback(), and fill_cbuf().
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.
Referenced by econv_putback(), and fill_cbuf().
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 allocate_converted_string(), encoding_equal, len, MEMCPY, NULL, rb_econv_encoding_to_insert_output(), rb_econv_t::replacement_allocated, rb_econv_t::replacement_enc, rb_econv_t::replacement_len, rb_econv_t::replacement_str, xfree(), and xmalloc.
Referenced by econv_set_replacement(), and rb_econv_open_opts().
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.
Referenced by do_writeconv(), and gzfile_newstr().
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, make_transcoder_entry(), rb_eArgError, rb_raise(), rb_transcoder::src_encoding, and transcoder_entry_t::transcoder.
Definition at line 2884 of file transcode.c.
References argc, argv, encoded_dup(), and str_transcode0().
Referenced by do_writeconv(), econv_insert_output(), rb_io_getline_0(), rb_reg_to_s(), rb_str_ellipsize(), and rb_str_enumerate_lines().
|
static |
Definition at line 1171 of file transcode.c.
References econv_after_output, ECONV_AFTER_OUTPUT, econv_destination_buffer_full, econv_finished, econv_incomplete_input, econv_invalid_byte_sequence, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, econv_undefined_conversion, rb_econv_t::elems, rb_econv_elem_t::last_result, NULL, rb_econv_t::num_trans, rb_bug(), and trans_sweep().
Referenced by rb_econv_convert0().
|
static |
Definition at line 817 of file transcode.c.
References rb_transcoding::ary, rb_transcoder::max_input, rb_transcoder::max_output, rb_transcoding::ptr, rb_transcoding::rb_transcoding_state_t::ptr, rb_transcoding::readbuf, rb_transcoding::state, rb_transcoder::state_fini_func, rb_transcoding::transcoder, TRANSCODING_STATE, rb_transcoding::writebuf, and xfree().
Referenced by rb_econv_binmode(), and rb_econv_close().
|
static |
Definition at line 805 of file transcode.c.
References transcode_restartable().
Referenced by trans_sweep().
|
static |
Definition at line 833 of file transcode.c.
References rb_transcoding::ary, rb_transcoder::max_input, rb_transcoder::max_output, rb_transcoding::readbuf, size, rb_transcoder::state_size, rb_transcoding::transcoder, and rb_transcoding::writebuf.
Referenced by rb_econv_memsize().
|
static |
Definition at line 778 of file transcode.c.
References ALLOC, rb_transcoding::ary, rb_transcoding::flags, rb_transcoder::max_input, rb_transcoder::max_output, rb_transcoding::ptr, rb_transcoding::rb_transcoding_state_t::ptr, rb_transcoding::readagain_len, rb_transcoding::readbuf, rb_transcoding::recognized_len, rb_transcoding::resume_position, rb_transcoding::state, rb_transcoder::state_init_func, rb_transcoder::state_size, rb_transcoding::transcoder, TRANSCODING_STATE, rb_transcoding::writebuf, rb_transcoding::writebuf_len, rb_transcoding::writebuf_off, and xmalloc.
Referenced by rb_econv_add_transcoder_at().
|
static |
Definition at line 3095 of file transcode.c.
References DECORATOR_P, make_encobj(), Qnil, rb_ary_new(), rb_ary_store(), rb_assoc_new(), and rb_str_new_cstr().
Referenced by econv_s_search_convpath(), and rb_econv_has_convpath_p().
Definition at line 2876 of file transcode.c.
References encoded_dup(), and str_transcode().
Referenced by InitVM_transcode().
Definition at line 2766 of file transcode.c.
References ENC_CODERANGE_SET, ENC_CODERANGE_VALID, rb_enc_asciicompat, rb_enc_associate_index(), rb_enc_from_index(), rb_str_coderange_scan_restartable(), RSTRING_END, and RSTRING_PTR.
Referenced by encoded_dup(), and str_encode_bang().
Definition at line 2798 of file transcode.c.
References encoded_dup(), rb_check_frozen, rb_enc_associate_index(), rb_str_shared_replace(), str_encode_associate(), and str_transcode().
Referenced by InitVM_transcode().
Definition at line 2752 of file transcode.c.
References NIL_P, NULL, Qnil, rb_econv_prepare_opts(), rb_scan_args(), and str_transcode0().
Referenced by str_encode(), and str_encode_bang().
|
static |
Definition at line 2661 of file transcode.c.
References bp, buf, ECONV_INVALID_MASK, ECONV_INVALID_REPLACE, ECONV_NEWLINE_DECORATOR_MASK, ECONV_UNDEF_REPLACE, ECONV_XML_ATTR_CONTENT_DECORATOR, ECONV_XML_ATTR_QUOTE_DECORATOR, ECONV_XML_TEXT_DECORATOR, ENC_CODERANGE_7BIT, encoding_equal, FALSE, NIL_P, PRIdPTRDIFF, Qnil, rb_check_arity, rb_define_dummy_encoding(), rb_eArgError, rb_enc_asciicompat, rb_enc_default_internal(), rb_enc_str_coderange(), rb_enc_str_scrub(), RB_GC_GUARD, rb_hash_aref(), rb_obj_encoding(), rb_raise(), rb_str_set_len(), rb_str_tmp_new(), RSTRING_LEN, RSTRING_PTR, str_transcode_enc_args(), str_transcoding_resize(), sym_replace, transcode_loop(), and TRUE.
Referenced by rb_str_encode(), and str_transcode().
|
static |
Definition at line 2634 of file transcode.c.
References enc_arg(), NIL_P, rb_enc_from_index(), rb_enc_get_index(), and rb_enc_name.
Referenced by str_transcode0().
|
static |
Definition at line 2418 of file transcode.c.
References rb_str_resize(), and RSTRING_PTR.
Referenced by str_transcode0().
Definition at line 960 of file transcode.c.
References ALLOC_N, trans_open_t::entries, get_transcoder_entry(), and trans_open_t::num_additional.
Referenced by rb_econv_open0().
|
static |
Definition at line 1090 of file transcode.c.
References econv_after_output, ECONV_AFTER_OUTPUT, econv_destination_buffer_full, econv_finished, econv_incomplete_input, econv_invalid_byte_sequence, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, econv_undefined_conversion, rb_econv_t::elems, f, rb_transcoding::flags, rb_econv_elem_t::last_result, len, MEMMOVE, rb_econv_t::num_finished, rb_econv_t::num_trans, rb_econv_elem_t::out_buf_end, rb_econv_elem_t::out_buf_start, rb_econv_elem_t::out_data_end, rb_econv_elem_t::out_data_start, rb_transcoding_convert(), and rb_econv_elem_t::tc.
Referenced by rb_trans_conv().
|
static |
Definition at line 407 of file transcode.c.
References MEMCPY, rb_transcoding::rb_transcoding_state_t::ptr, rb_transcoding::recognized_len, and TRANSCODING_READBUF.
Referenced by transcode_restartable0().
|
static |
Definition at line 2263 of file transcode.c.
References aref_fallback(), econv_destination_buffer_full, econv_finished, econv_incomplete_input, econv_invalid_byte_sequence, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, econv_undefined_conversion, rb_econv_t::error_bytes_len, rb_econv_t::error_bytes_start, hash_fallback, rb_econv_t::last_error, rb_econv_t::last_tc, make_econv_exception(), rb_transcoder::max_output, method_fallback(), more_output_buffer(), NIL_P, NULL, proc_fallback(), rb_transcoding::rb_transcoding_state_t::ptr, Qnil, Qundef, rb_eArgError, rb_econv_close(), rb_econv_convert(), rb_econv_insert_output(), rb_econv_open_exc(), rb_econv_open_opts(), rb_enc_find(), rb_enc_get(), rb_enc_name, rb_enc_str_new(), rb_exc_raise(), rb_hash_aref(), rb_obj_is_method(), rb_obj_is_proc(), rb_raise(), RB_TYPE_P, RSTRING_LEN, RSTRING_PTR, rb_econv_t::source_encoding, StringValue, sym_fallback, T_HASH, and rb_transcoding::transcoder.
Referenced by str_transcode0().
|
static |
Definition at line 752 of file transcode.c.
References ALLOCA_N, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, MEMCPY, rb_transcoding::readagain_len, rb_transcoding::recognized_len, transcode_restartable0(), and TRANSCODING_READBUF.
Referenced by rb_transcoding_convert().
|
static |
Definition at line 427 of file transcode.c.
References BL_ACTION, BL_MAX_BYTE, BL_MIN_BYTE, BYTE_ADDR, rb_transcoder::conv_tree_start, econv_finished, econv_incomplete_input, econv_invalid_byte_sequence, ECONV_PARTIAL_INPUT, econv_source_buffer_empty, econv_undefined_conversion, rb_transcoder::finish_func, FOURbt, rb_transcoder::func_ii, rb_transcoder::func_io, rb_transcoder::func_si, rb_transcoder::func_sio, rb_transcoder::func_so, FUNii, FUNio, FUNsi, FUNsio, FUNso, GB4bt, getBT0, getBT1, getBT2, getBT3, getGB4bt0, getGB4bt1, getGB4bt2, getGB4bt3, rb_transcoder::input_unit_length, INVALID, rb_transcoder::max_output, rb_transcoding::next_info, NOMAP, ONEbt, rb_transcoding::output_index, rb_eRuntimeError, rb_raise(), rb_transcoding::recognized_len, rb_transcoding::resume_position, STR1, STR1_BYTEINDEX, STR1_LENGTH, SUSPEND, SUSPEND_AFTER_OUTPUT, SUSPEND_OBUF, THREEbt, transcode_char_start(), rb_transcoding::transcoder, TRANSCODING_STATE, TRANSCODING_WRITEBUF, TRANSCODING_WRITEBUF_SIZE, TWObt, UNDEF, rb_transcoding::writebuf_off, and ZERObt.
Referenced by transcode_restartable().
|
static |
Definition at line 275 of file transcode.c.
References ALLOC, search_path_bfs_t::base_enc, callback(), search_path_queue_tag::enc, encoding_equal, search_path_queue_tag::next, NULL, search_path_bfs_t::queue, search_path_bfs_t::queue_last_ptr, st_add_direct, st_data_t, st_foreach, st_free_table, st_init_strcasetable(), st_lookup, transcode_search_path_i(), val, search_path_bfs_t::visited, and xfree().
Referenced by econv_s_search_convpath(), rb_econv_has_convpath_p(), rb_econv_init_by_convpath(), and rb_econv_open0().
Definition at line 254 of file transcode.c.
References ALLOC, search_path_bfs_t::base_enc, search_path_queue_tag::enc, search_path_queue_tag::next, NULL, search_path_bfs_t::queue_last_ptr, st_add_direct, ST_CONTINUE, st_data_t, st_lookup, val, and search_path_bfs_t::visited.
Referenced by transcode_search_path().
|
static |
Definition at line 2921 of file transcode.c.
VALUE rb_cEncodingConverter |
Definition at line 23 of file transcode.c.
Referenced by InitVM_transcode(), and str_cat_conv_enc_opts().
VALUE rb_eConverterNotFoundError |
Definition at line 21 of file transcode.c.
Referenced by InitVM_transcode(), and rb_econv_open_exc().
VALUE rb_eInvalidByteSequenceError |
Definition at line 20 of file transcode.c.
Referenced by InitVM_transcode(), and make_econv_exception().
VALUE rb_eUndefinedConversionError |
Definition at line 19 of file transcode.c.
Referenced by econv_get_replacement(), econv_set_replacement(), InitVM_transcode(), and make_econv_exception().
|
static |
Definition at line 40 of file transcode.c.
Referenced by econv_primitive_convert(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 25 of file transcode.c.
Referenced by aref_fallback(), Init_transcode(), and rb_econv_prepare_options().
|
static |
Definition at line 26 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 31 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 29 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 31 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 28 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 37 of file transcode.c.
Referenced by econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 25 of file transcode.c.
Referenced by Init_transcode(), rb_econv_prepare_options(), and transcode_loop().
|
static |
Definition at line 39 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 41 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 25 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 35 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 31 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 31 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 33 of file transcode.c.
Referenced by econv_primitive_convert(), and Init_transcode().
|
static |
Definition at line 25 of file transcode.c.
Referenced by econv_opts(), Init_transcode(), rb_econv_open_opts(), rb_econv_prepare_options(), and str_transcode0().
|
static |
Definition at line 38 of file transcode.c.
Referenced by econv_convert(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 26 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 25 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 36 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 31 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 27 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 26 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 228 of file transcode.c.
Referenced by load_transcoder_entry().
|
static |
Definition at line 161 of file transcode.c.