Ruby
1.9.3p551(2014-11-13revision48407)
|
#include "ruby/ruby.h"
#include <errno.h>
#include <iconv.h>
#include <assert.h>
#include "ruby/st.h"
#include "ruby/encoding.h"
Go to the source code of this file.
Data Structures | |
struct | iconv_env_t |
struct | rb_iconv_opt_t |
Macros | |
#define | VALUE2ICONV(v) ((iconv_t)((VALUE)(v) ^ -1)) |
#define | ICONV2VALUE(c) ((VALUE)(c) ^ -1) |
#define | rb_sys_fail(s) rb_iconv_sys_fail(s) |
#define | ICONV_FREE iconv_dfree |
#define | ICONV_INPTR_CAST (char **) |
#define | FAILED_MAXLEN 16 |
#define | iconv_ctl(self, func, val) |
#define | iconv_s_list rb_f_notimplement |
#define | iconv_trivialp rb_f_notimplement |
#define | iconv_get_transliterate rb_f_notimplement |
#define | iconv_set_transliterate rb_f_notimplement |
#define | iconv_get_discard_ilseq rb_f_notimplement |
#define | iconv_set_discard_ilseq rb_f_notimplement |
Variables | |
static ID | id_transliterate |
static ID | id_discard_ilseq |
static VALUE | rb_eIconvInvalidEncoding |
static VALUE | rb_eIconvFailure |
static VALUE | rb_eIconvIllegalSeq |
static VALUE | rb_eIconvInvalidChar |
static VALUE | rb_eIconvOutOfRange |
static VALUE | rb_eIconvBrokenLibrary |
static ID | rb_success |
static ID | rb_failed |
static VALUE | charset_map |
#define FAILED_MAXLEN 16 |
Definition at line 354 of file iconv.c.
Referenced by iconv_fail().
Definition at line 80 of file iconv.c.
Referenced by iconv_initialize(), iconv_s_conv(), iconv_s_iconv(), and iconv_s_open().
#define ICONV_FREE iconv_dfree |
Definition at line 295 of file iconv.c.
Referenced by check_iconv(), iconv_s_allocate(), and iconv_s_open().
#define iconv_get_discard_ilseq rb_f_notimplement |
Definition at line 1045 of file iconv.c.
Referenced by Init_iconv().
#define iconv_get_transliterate rb_f_notimplement |
Definition at line 1008 of file iconv.c.
Referenced by Init_iconv().
#define ICONV_INPTR_CAST (char **) |
Referenced by iconv_try().
#define iconv_s_list rb_f_notimplement |
Definition at line 853 of file iconv.c.
Referenced by Init_iconv().
#define iconv_set_discard_ilseq rb_f_notimplement |
Definition at line 1063 of file iconv.c.
Referenced by Init_iconv().
#define iconv_set_transliterate rb_f_notimplement |
Definition at line 1026 of file iconv.c.
Referenced by Init_iconv().
#define iconv_trivialp rb_f_notimplement |
Definition at line 989 of file iconv.c.
Referenced by Init_iconv().
#define rb_sys_fail | ( | s | ) | rb_iconv_sys_fail(s) |
Definition at line 187 of file iconv.c.
Referenced by iconv_create(), iconv_free(), iconv_try(), and rb_iconv_sys_fail().
Definition at line 79 of file iconv.c.
Referenced by iconv_conv(), iconv_dfree(), iconv_free(), iconv_iconv(), and iconv_init_state().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 306 of file iconv.c.
References Check_Type, CLASS_OF, DATA_PTR(), ICONV_FREE, rb_class2name(), rb_eArgError, rb_raise(), RDATA, and T_DATA.
Referenced by iconv_conv(), iconv_finish(), iconv_iconv(), and iconv_initialize().
|
static |
Definition at line 619 of file iconv.c.
References rb_iconv_opt_t::discard_ilseq, get_iconv_opt_i(), NIL_P, Qundef, rb_block_call, rb_intern, and rb_iconv_opt_t::transliterate.
Referenced by iconv_initialize(), and iconv_s_open().
Definition at line 564 of file iconv.c.
References rb_iconv_opt_t::discard_ilseq, id_discard_ilseq, id_transliterate, name, Qnil, rb_Array(), rb_ary_entry(), rb_eArgError, rb_inspect(), rb_notimplement(), rb_raise(), s, StringValueCStr, SYM2ID, SYMBOL_P, rb_iconv_opt_t::transliterate, val, and void.
Referenced by get_iconv_opt().
Definition at line 952 of file iconv.c.
References iconv_env_t::cd, check_iconv(), ENCODING_GET, iconv_convert(), NULL, Qnil, rb_str_buf_append(), RSTRING_LEN, s, str, iconv_env_t::toidx, and VALUE2ICONV.
Referenced by Init_iconv().
|
static |
Definition at line 417 of file iconv.c.
References c, FIX2INT, FIXNUM_P, i, iconv_fail_retry(), iconv_try(), len, length, memcmp(), NIL_P, NULL, OBJ_INFECT, Qfalse, Qnil, RARRAY_LEN, RARRAY_PTR(), rb_eArgError, rb_eIconvOutOfRange, rb_enc_associate_index(), rb_raise(), rb_str_buf_cat(), rb_str_cat(), rb_str_concat(), rb_str_derive(), rb_str_new(), iconv_env_t::ret, RSTRING_LEN, RSTRING_PTR, RTEST, start, StringValue, T_ARRAY, and TYPE.
Referenced by iconv_conv(), iconv_iconv(), iconv_init_state(), and iconv_s_convert().
|
static |
Definition at line 190 of file iconv.c.
References iconv_env_t::cd, rb_iconv_opt_t::discard_ilseq, errno, flag, iconv_fail(), map_charset(), msg, NULL, Qnil, Qundef, rb_ary_new3(), rb_eIconvInvalidEncoding, rb_enc_find_index(), rb_exc_raise(), rb_gc(), rb_str_equal(), rb_str_new(), rb_str_plus(), rb_str_resize(), rb_str_set_len, rb_sys_fail, rb_warning(), RSTRING_LEN, RSTRING_PTR, RTEST, s, strip_glibc_option(), strlen(), and rb_iconv_opt_t::transliterate.
Referenced by iconv_initialize(), iconv_s_conv(), iconv_s_iconv(), and iconv_s_open().
Definition at line 290 of file iconv.c.
References VALUE2ICONV.
|
static |
Definition at line 366 of file iconv.c.
References iconv_env_t::argc, args, iconv_env_t::argv, FAILED_MAXLEN, rb_ary_new4(), rb_class_new_instance(), rb_inspect(), rb_obj_dup(), rb_str_cat2(), rb_str_new2(), rb_str_substr(), iconv_env_t::ret, RSTRING_LEN, T_STRING, and TYPE.
Referenced by iconv_create(), iconv_fail_retry(), and rb_iconv_sys_fail().
|
static |
Definition at line 393 of file iconv.c.
References iconv_fail(), rb_block_given_p(), rb_exc_raise(), rb_set_errinfo(), and rb_yield().
Referenced by iconv_convert().
Definition at line 1123 of file iconv.c.
References rb_attr_get(), and rb_failed.
Referenced by Init_iconv().
|
static |
Definition at line 357 of file iconv.c.
References rb_call_super(), rb_failed, rb_ivar_set(), and rb_success.
Referenced by Init_iconv().
Definition at line 1135 of file iconv.c.
References CLASS_OF, rb_attr_get(), rb_class2name(), rb_failed, rb_inspect(), rb_str_buf_append(), rb_str_buf_cat(), rb_str_buf_cat2(), rb_str_new2(), rb_success, and str.
Referenced by Init_iconv().
Definition at line 1110 of file iconv.c.
References rb_attr_get(), and rb_success.
Referenced by Init_iconv().
Definition at line 876 of file iconv.c.
References iconv_env_t::cd, check_iconv(), iconv_free(), iconv_init_state(), Qnil, and rb_ensure().
Referenced by iconv_s_open(), and Init_iconv().
Definition at line 298 of file iconv.c.
References Qnil, rb_sys_fail, and VALUE2ICONV.
Referenced by iconv_finish(), iconv_initialize(), iconv_s_conv(), and iconv_s_iconv().
Definition at line 912 of file iconv.c.
References iconv_env_t::cd, check_iconv(), e, enc, ENCODING_GET, iconv_convert(), length, n, NIL_P, NULL, NUM2LONG(), rb_enc_get(), rb_enc_nth(), rb_range_beg_len(), rb_scan_args(), rb_str_length(), RSTRING_LEN, RSTRING_PTR, RTEST, s, start, str, StringValue, and VALUE2ICONV.
Referenced by Init_iconv().
Definition at line 868 of file iconv.c.
References iconv_env_t::cd, DATA_PTR(), ENCODING_GET, iconv_convert(), NULL, Qnil, and VALUE2ICONV.
Referenced by iconv_finish().
Definition at line 652 of file iconv.c.
References check_iconv(), DATA_PTR(), ENCODING_SET, get_iconv_opt(), ICONV2VALUE, iconv_create(), iconv_free(), idx, NULL, and rb_scan_args().
Referenced by Init_iconv().
Definition at line 558 of file iconv.c.
References Data_Wrap_Struct(), and ICONV_FREE.
Referenced by Init_iconv().
Definition at line 760 of file iconv.c.
References iconv_env_t::argc, iconv_env_t::argv, iconv_env_t::cd, ICONV2VALUE, iconv_create(), iconv_free(), iconv_s_convert(), NULL, rb_ensure(), rb_str_append(), rb_str_new(), iconv_env_t::ret, str, and iconv_env_t::toidx.
Referenced by Init_iconv().
|
static |
Definition at line 698 of file iconv.c.
References iconv_env_t::argc, iconv_env_t::argv, iconv_env_t::cd, iconv_convert(), last, NIL_P, Qnil, iconv_env_t::ret, RSTRING_LEN, s, and iconv_env_t::toidx.
Referenced by iconv_s_conv(), and iconv_s_iconv().
Definition at line 1073 of file iconv.c.
References ary, ID2SYM, rb_ary_new(), rb_ary_push(), and rb_intern.
Referenced by Init_iconv().
Definition at line 736 of file iconv.c.
References iconv_env_t::argc, iconv_env_t::argv, iconv_env_t::cd, ICONV2VALUE, iconv_create(), iconv_free(), iconv_s_convert(), NULL, rb_ary_new2(), rb_ary_push(), rb_eArgError, rb_ensure(), rb_raise(), iconv_env_t::ret, and iconv_env_t::toidx.
Referenced by Init_iconv().
Definition at line 676 of file iconv.c.
References iconv_env_t::cd, Data_Wrap_Struct(), ENCODING_SET, get_iconv_opt(), ICONV2VALUE, iconv_create(), iconv_finish(), ICONV_FREE, idx, NULL, rb_block_given_p(), rb_ensure(), rb_scan_args(), and rb_yield().
Referenced by Init_iconv().
|
static |
Definition at line 316 of file iconv.c.
References errno, iconv, ICONV_INPTR_CAST, Qfalse, Qnil, rb_eIconvBrokenLibrary, rb_eIconvIllegalSeq, rb_eIconvInvalidChar, rb_sys_fail, and iconv_env_t::ret.
Referenced by iconv_convert().
Definition at line 1207 of file iconv.c.
References charset_map, charset_map_get(), iconv_conv(), iconv_failure_failed(), iconv_failure_initialize(), iconv_failure_inspect(), iconv_failure_success(), iconv_finish(), iconv_get_discard_ilseq, iconv_get_transliterate, iconv_iconv(), iconv_initialize(), iconv_s_allocate(), iconv_s_conv(), iconv_s_ctlmethods(), iconv_s_iconv(), iconv_s_list, iconv_s_open(), iconv_set_discard_ilseq, iconv_set_transliterate, iconv_trivialp, id_discard_ilseq, id_transliterate, NIL_P, rb_cData, rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), rb_define_method(), rb_define_module_under(), rb_define_singleton_method(), rb_eArgError, rb_eIconvBrokenLibrary, rb_eIconvFailure, rb_eIconvIllegalSeq, rb_eIconvInvalidChar, rb_eIconvInvalidEncoding, rb_eIconvOutOfRange, rb_eRuntimeError, rb_failed, rb_gc_register_address(), rb_hash_new(), rb_include_module(), rb_intern, rb_success, ruby_verbose, and warn_deprecated().
|
static |
Definition at line 162 of file iconv.c.
References charset_map, data, key, rb_funcall2(), rb_intern, RHASH_SIZE, RHASH_TBL, st_lookup, StringValue, StringValuePtr, and val.
Referenced by iconv_create().
NORETURN | ( | static void | rb_iconv_sys_failconst char *s | ) |
Definition at line 179 of file iconv.c.
References errno, iconv_fail(), NULL, Qnil, rb_eIconvBrokenLibrary, rb_exc_raise(), and rb_sys_fail.
Definition at line 402 of file iconv.c.
References NIL_P, OBJ_INFECT, rb_str_new(), rb_str_subseq(), iconv_env_t::ret, RSTRING_LEN, and RSTRING_PTR.
Referenced by iconv_convert().
Definition at line 146 of file iconv.c.
References ptr, rb_str_subseq(), RSTRING_END, RSTRING_PTR, StringValue, and val.
Referenced by iconv_create().
Definition at line 1183 of file iconv.c.
References i, msg, NIL_P, Qnil, RARRAY_LEN, RARRAY_PTR(), rb_io_puts(), rb_make_backtrace(), rb_stderr, rb_str_cat(), rb_str_new_cstr(), RSTRING_PTR, and s.
Referenced by Init_iconv().
|
static |
Definition at line 131 of file iconv.c.
Referenced by charset_map_get(), Init_iconv(), and map_charset().
|
static |
Definition at line 98 of file iconv.c.
Referenced by get_iconv_opt_i(), and Init_iconv().
|
static |
Definition at line 98 of file iconv.c.
Referenced by get_iconv_opt_i(), and Init_iconv().
|
static |
Definition at line 105 of file iconv.c.
Referenced by iconv_try(), Init_iconv(), and rb_iconv_sys_fail().
|
static |
Definition at line 101 of file iconv.c.
Referenced by Init_iconv().
|
static |
Definition at line 102 of file iconv.c.
Referenced by iconv_try(), and Init_iconv().
|
static |
Definition at line 103 of file iconv.c.
Referenced by iconv_try(), and Init_iconv().
|
static |
Definition at line 100 of file iconv.c.
Referenced by iconv_create(), and Init_iconv().
|
static |
Definition at line 104 of file iconv.c.
Referenced by iconv_convert(), and Init_iconv().
|
static |
Definition at line 107 of file iconv.c.
Referenced by iconv_failure_failed(), iconv_failure_initialize(), iconv_failure_inspect(), and Init_iconv().
|
static |
Definition at line 107 of file iconv.c.
Referenced by iconv_failure_initialize(), iconv_failure_inspect(), iconv_failure_success(), and Init_iconv().