Ruby
1.9.3p448(2013-06-27revision41675)
|
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "internal.h"
#include "transcode_data.h"
#include <ctype.h>
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 | MAX_TRANSCODER_LIBNAME_LEN 64 |
#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_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 (volatile VALUE *arg, const char **name_p, rb_encoding **enc_p) |
static int | str_transcode_enc_args (VALUE str, volatile VALUE *arg1, volatile 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, volatile VALUE *snamev_p, volatile 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) |
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 154 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 18 of file transcode.c.
#define encoding_equal | ( | enc1, | |
enc2 | |||
) | (STRCASECMP((enc1), (enc2)) == 0) |
Definition at line 243 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 2255 of file transcode.c.
Referenced by transcode_loop().
#define MAX_ECFLAGS_DECORATORS 32 |
Definition at line 1032 of file transcode.c.
Referenced by decorate_convpath(), and rb_econv_open().
#define MAX_TRANSCODER_LIBNAME_LEN 64 |
Definition at line 230 of file transcode.c.
Referenced by load_transcoder_entry(), and rb_declare_transcoder().
#define next_byte (tc->next_byte) |
Referenced by get_info(), and transcode_restartable0().
#define next_info (tc->next_info) |
Referenced by buf_apply(), get_info(), and transcode_restartable0().
#define next_table (tc->next_table) |
Referenced by transcode_restartable0().
#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 84 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 97 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 96 of file transcode.c.
#define TRANSCODING_WRITEBUF | ( | tc | ) |
Definition at line 88 of file transcode.c.
Referenced by transcode_restartable0().
#define TRANSCODING_WRITEBUF_SIZE | ( | tc | ) |
Definition at line 92 of file transcode.c.
Referenced by transcode_restartable0().
#define WORD_ADDR | ( | index | ) | (tr->word_array + INFO2WORDINDEX(index)) |
#define writebuf_len (tc->writebuf_len) |
Referenced by transcode_restartable0().
#define writebuf_off (tc->writebuf_off) |
Referenced by transcode_restartable0().
typedef struct rb_transcoding rb_transcoding |
typedef struct search_path_queue_tag search_path_queue_t |
|
static |
Definition at line 1525 of file transcode.c.
References dp, econv_destination_buffer_full, econv_finished, fail, len, 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 2270 of file transcode.c.
References rb_funcall3(), and sym_aref.
Referenced by transcode_loop().
Definition at line 1775 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 3449 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 222 of file transcode.c.
References transcoder_entry_t::lib, and make_transcoder_entry().
Referenced by rb_declare_transcoder().
|
static |
Definition at line 3059 of file transcode.c.
References asciicompat_encoder, rb_transcoder::asciicompat_type, decorator_names(), DECORATOR_P, rb_transcoder::dst_encoding, get_transcoder_entry(), i, len, load_transcoder_entry(), MAX_ECFLAGS_DECORATORS, RARRAY_LENINT, RARRAY_PTR, rb_ary_store(), rb_enc_name, rb_str_new_cstr(), rb_to_encoding(), rb_transcoder::src_encoding, T_ARRAY, and TYPE.
Referenced by econv_s_search_convpath().
|
static |
Definition at line 1035 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 4280 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4268 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4322 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4301 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4364 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4334 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4256 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
Definition at line 4230 of file transcode.c.
References rb_attr_get(), and rb_intern.
Referenced by Init_transcode().
|
static |
Definition at line 2998 of file transcode.c.
References NIL_P, NULL, NUM2INT, Qnil, rb_eArgError, rb_econv_prepare_opts(), rb_enc_from_index(), rb_enc_name, rb_raise(), 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 3823 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 Init_transcode().
Definition at line 3513 of file transcode.c.
References check_econv(), DECORATOR_P, rb_transcoder::dst_encoding, rb_econv_t::elems, i, 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, rb_transcoding::transcoder, and v.
Referenced by Init_transcode().
|
static |
Definition at line 1987 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 3482 of file transcode.c.
References check_econv(), rb_econv_t::destination_encoding, Qnil, and rb_enc_from_encoding().
Referenced by Init_transcode().
Definition at line 3537 of file transcode.c.
References check_econv(), DATA_PTR, rb_econv_t::destination_encoding_name, rb_econv_t::elems, rb_econv_t::flags, i, 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 Init_transcode().
Definition at line 3873 of file transcode.c.
References check_econv(), econv_primitive_convert(), INT2NUM(), 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 Init_transcode().
|
static |
Definition at line 2912 of file transcode.c.
References rb_econv_close().
Definition at line 4157 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 Init_transcode().
Definition at line 3375 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_raise(), and rb_econv_t::source_encoding.
Referenced by Init_transcode().
Definition at line 4039 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 Init_transcode().
Definition at line 3429 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 Init_transcode().
Definition at line 4133 of file transcode.c.
References check_econv(), make_econv_exception(), NIL_P, and Qnil.
Referenced by Init_transcode().
|
static |
Definition at line 2919 of file transcode.c.
|
static |
Definition at line 2438 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, rb_eArgError, rb_hash_aref(), rb_id2name(), rb_raise(), RTEST, SYM2ID, 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, T_SYMBOL, TYPE, and v.
Referenced by rb_econv_prepare_options().
Definition at line 3678 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(), input, long, LONG_MAX, NIL_P, NULL, NUM2INT, NUM2LONG(), output, Qnil, rb_eArgError, rb_econv_convert(), rb_enc_associate(), 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, sym_partial_input, and v.
Referenced by econv_convert(), econv_finish(), and Init_transcode().
Definition at line 3981 of file transcode.c.
References 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 Init_transcode().
Definition at line 4084 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 Init_transcode().
|
static |
Definition at line 3572 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 2930 of file transcode.c.
References NULL, and TypedData_Wrap_Struct.
Referenced by Init_transcode().
Definition at line 2980 of file transcode.c.
References enc_arg(), make_encoding(), NULL, Qnil, rb_econv_asciicompat_encoding(), and rb_enc_from_encoding().
Referenced by Init_transcode().
Definition at line 3142 of file transcode.c.
References decorate_convpath(), econv_args(), NIL_P, Qnil, rb_econv_open_exc(), rb_exc_raise(), search_convpath_i(), and transcode_search_path().
Referenced by Init_transcode().
Definition at line 4183 of file transcode.c.
References arg, 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 Init_transcode().
Definition at line 3467 of file transcode.c.
References check_econv(), Qnil, rb_enc_from_encoding(), and rb_econv_t::source_encoding.
Referenced by Init_transcode().
|
static |
Definition at line 2623 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 2897 of file transcode.c.
References rb_enc_associate_index(), rb_obj_class(), rb_str_dup(), RBASIC, and str_encode_associate().
Referenced by rb_str_encode(), and str_encode().
|
static |
Definition at line 396 of file transcode.c.
References encoding_equal.
Referenced by make_replacement().
|
static |
Definition at line 189 of file transcode.c.
References NULL, and st_lookup.
Referenced by decorate_convpath(), rb_econv_add_converter(), rb_econv_binmode(), and trans_open_i().
void Init_transcode | ( | void | ) |
Definition at line 4392 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, ID2SYM, 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, rb_intern, st_init_strcasetable(), str_encode(), str_encode_bang(), 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.
|
static |
Definition at line 364 of file transcode.c.
References FL_TAINT, FL_UNSET, FL_UNTRUSTED, len, transcoder_entry_t::lib, MAX_TRANSCODER_LIBNAME_LEN, NULL, OBJ_FREEZE, rb_require_safe(), rb_safe_level, rb_str_new2(), 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 2936 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 2056 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, i, 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 2956 of file transcode.c.
References make_encoding(), and rb_enc_from_encoding().
Referenced by econv_convpath(), and search_convpath_i().
|
static |
Definition at line 2946 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 2173 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 166 of file transcode.c.
References ALLOC, transcoder_entry_t::dname, transcoder_entry_t::lib, NULL, transcoder_entry_t::sname, st_add_direct, st_init_strcasetable(), st_lookup, and transcoder_entry_t::transcoder.
Referenced by declare_transcoder(), and rb_register_transcoder().
Definition at line 2264 of file transcode.c.
References rb_method_call().
Referenced by transcode_loop().
|
static |
Definition at line 1396 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, p, rb_econv_insert_output(), snprintf, rb_econv_t::source_encoding, strlen(), and xfree().
Referenced by rb_econv_convert().
|
static |
Definition at line 2240 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().
Definition at line 2258 of file transcode.c.
References rb_ary_new4(), and rb_proc_call().
Referenced by transcode_loop().
Definition at line 234 of file transcode.c.
References declare_transcoder(), MAX_TRANSCODER_LIBNAME_LEN, rb_eArgError, rb_raise(), and strlen().
|
static |
Definition at line 1881 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 897 of file transcode.c.
References DECORATOR_P, rb_transcoder::dst_encoding, econv_source_buffer_empty, rb_econv_t::elems, i, 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, p, 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 859 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().
Definition at line 1792 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_foreach, st_lookup, and v.
Referenced by econv_s_asciicompat_encoding(), and make_writeconv().
void rb_econv_binmode | ( | rb_econv_t * | ec | ) |
Definition at line 1940 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(), i, 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 4213 of file transcode.c.
References make_econv_exception(), NIL_P, and rb_exc_raise().
Referenced by fill_cbuf(), gzfile_getc(), and rb_econv_substr_append().
void rb_econv_close | ( | rb_econv_t * | ec | ) |
Definition at line 1708 of file transcode.c.
References rb_econv_t::elems, i, 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(), clear_readconv(), clear_writeconv(), econv_free(), gzfile_reset(), rb_econv_open(), rb_econv_open_by_transcoder_entries(), rb_econv_open_opts(), rb_io_ascii8bit_binmode(), RUBY_ALIAS_FUNCTION(), 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 1452 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_substr_append(), RUBY_ALIAS_FUNCTION(), and transcode_loop().
|
static |
Definition at line 1272 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, 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, 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 1900 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 1906 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 1923 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 1509 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 3171 of file transcode.c.
References Qnil, RTEST, search_convpath_i(), and transcode_search_path().
Referenced by rb_w32_write_console().
|
static |
Definition at line 3201 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(), i, rb_econv_init_by_convpath_t::index, 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_raise(), 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 3186 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 1593 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, 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 4207 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 1726 of file transcode.c.
References rb_econv_t::elems, i, 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 1073 of file transcode.c.
References decorator_names(), ECONV_ERROR_HANDLER_MASK, rb_econv_t::flags, i, MAX_ECFLAGS_DECORATORS, NULL, rb_econv_close(), rb_econv_decorate_at_last(), and rb_econv_open0().
Referenced by allocate_converted_string(), and rb_econv_open_opts().
|
static |
Definition at line 979 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 936 of file transcode.c.
References i, 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 2045 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 2588 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(), RSTRING_LEN, RSTRING_PTR, sym_replace, T_HASH, and TYPE.
Referenced by econv_init(), gzfile_reset(), make_readconv(), make_writeconv(), rb_gzfile_ecopts(), RUBY_ALIAS_FUNCTION(), and transcode_loop().
Definition at line 2537 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, sym_replace, and v.
Referenced by io_encoding_set(), rb_econv_prepare_opts(), and rb_io_extract_modeenc().
Definition at line 2582 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 1759 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.
Referenced by econv_putback(), and fill_cbuf().
int rb_econv_putbackable | ( | rb_econv_t * | ec | ) |
Definition at line 1748 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 2208 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 1863 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 1875 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 1819 of file transcode.c.
References rb_econv_t::destination_encoding, dp, econv_destination_buffer_full, rb_econv_t::last_tc, len, long, 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_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 1869 of file transcode.c.
References Qnil, and rb_econv_substr_append().
void rb_register_transcoder | ( | const rb_transcoder * | tr | ) |
Definition at line 205 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.
Referenced by Init_big5(), Init_chinese(), Init_emoji(), Init_emoji_iso2022_kddi(), Init_emoji_sjis_docomo(), Init_emoji_sjis_kddi(), Init_emoji_sjis_softbank(), Init_escape(), Init_gb18030(), Init_gbk(), Init_iso2022(), Init_japanese(), Init_japanese_euc(), Init_japanese_sjis(), Init_korean(), Init_newline(), Init_single_byte(), Init_utf8_mac(), and Init_utf_16_32().
Definition at line 2887 of file transcode.c.
References argc, argv, encoded_dup(), and str_transcode0().
Referenced by do_writeconv(), econv_insert_output(), fix_string_encoding(), get_user_from_path(), rb_file_expand_path_internal(), rb_io_getline_1(), rb_str_ellipsize(), rb_str_encode_ospath(), rb_w32_conv_from_wchar(), and rb_w32_write_console().
|
static |
Definition at line 1181 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, i, 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 825 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 813 of file transcode.c.
References transcode_restartable().
Referenced by trans_sweep().
|
static |
Definition at line 841 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 786 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 3098 of file transcode.c.
References arg, DECORATOR_P, make_encobj(), Qnil, rb_ary_new(), rb_ary_store(), rb_assoc_new(), rb_str_new_cstr(), and v.
Referenced by econv_s_search_convpath(), and rb_econv_has_convpath_p().
Definition at line 2879 of file transcode.c.
References encoded_dup(), and str_transcode().
Referenced by Init_transcode().
Definition at line 2765 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 2797 of file transcode.c.
References rb_check_frozen, rb_enc_associate_index(), rb_str_shared_replace(), str_encode_associate(), and str_transcode().
Referenced by Init_transcode().
Definition at line 2751 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 2674 of file transcode.c.
References bp, buf, 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, NIL_P, PRIdPTRDIFF, Qnil, rb_define_dummy_encoding(), rb_eArgError, rb_enc_asciicompat, rb_enc_default_internal(), rb_enc_str_coderange(), rb_obj_encoding(), rb_raise(), rb_str_set_len, rb_str_tmp_new(), RSTRING_LEN, RSTRING_PTR, str_transcode_enc_args(), str_transcoding_resize(), and transcode_loop().
Referenced by rb_str_encode(), and str_transcode().
|
static |
Definition at line 2647 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 2431 of file transcode.c.
References rb_str_resize(), and RSTRING_PTR.
Referenced by str_transcode0().
Definition at line 968 of file transcode.c.
References ALLOC_N, arg, trans_open_t::entries, get_transcoder_entry(), and trans_open_t::num_additional.
Referenced by rb_econv_open0().
|
static |
Definition at line 1100 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, i, 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 415 of file transcode.c.
References MEMCPY, rb_transcoding::recognized_len, and TRANSCODING_READBUF.
Referenced by transcode_restartable0().
|
static |
Definition at line 2276 of file transcode.c.
References aref_fallback(), econv_destination_buffer_full, econv_incomplete_input, econv_invalid_byte_sequence, 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, proc_fallback(), 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, rb_transcoding::transcoder, and TYPE.
Referenced by str_transcode0().
|
static |
Definition at line 760 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 435 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, next_byte, next_info, next_table, NOMAP, ONEbt, rb_transcoding::output_index, p, 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, writebuf_len, writebuf_off, and ZERObt.
Referenced by transcode_restartable().
|
static |
Definition at line 279 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_foreach, st_free_table, st_init_strcasetable(), st_lookup, transcode_search_path_i(), 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 258 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_lookup, and search_path_bfs_t::visited.
Referenced by transcode_search_path().
|
static |
Definition at line 2924 of file transcode.c.
VALUE rb_cEncodingConverter |
Definition at line 25 of file transcode.c.
Referenced by Init_transcode().
VALUE rb_eConverterNotFoundError |
Definition at line 23 of file transcode.c.
Referenced by Init_transcode(), and rb_econv_open_exc().
VALUE rb_eInvalidByteSequenceError |
Definition at line 22 of file transcode.c.
Referenced by Init_transcode(), and make_econv_exception().
VALUE rb_eUndefinedConversionError |
Definition at line 21 of file transcode.c.
Referenced by econv_get_replacement(), econv_set_replacement(), Init_transcode(), and make_econv_exception().
|
static |
Definition at line 42 of file transcode.c.
Referenced by econv_primitive_convert(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 27 of file transcode.c.
Referenced by aref_fallback(), Init_transcode(), and rb_econv_prepare_options().
|
static |
Definition at line 28 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 33 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_opts(), and Init_transcode().
|
static |
Definition at line 30 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 39 of file transcode.c.
Referenced by econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 27 of file transcode.c.
Referenced by Init_transcode(), rb_econv_prepare_options(), and transcode_loop().
|
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 43 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 27 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 37 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 33 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 33 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
|
static |
Definition at line 35 of file transcode.c.
Referenced by econv_primitive_convert(), and Init_transcode().
|
static |
Definition at line 27 of file transcode.c.
Referenced by econv_opts(), Init_transcode(), rb_econv_open_opts(), and rb_econv_prepare_options().
|
static |
Definition at line 40 of file transcode.c.
Referenced by econv_convert(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 28 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 38 of file transcode.c.
Referenced by econv_convert(), econv_finish(), econv_result_to_symbol(), and Init_transcode().
|
static |
Definition at line 33 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 28 of file transcode.c.
Referenced by econv_opts(), and Init_transcode().
Definition at line 231 of file transcode.c.
Referenced by load_transcoder_entry().
|
static |
Definition at line 163 of file transcode.c.