encoding.c File Reference
`#include "ruby/ruby.h"`
`#include "ruby/encoding.h"`
`#include "internal.h"`
`#include "regenc.h"`
`#include <ctype.h>`
`#include "ruby/util.h"`

Go to the source code of this file.

## Data Structures

struct | rb_encoding_entry
struct | default_encoding

## Macros

#define | ENCODING_COUNT ENCINDEX_BUILTIN_MAX
#define | UNSPECIFIED_ENCODING INT_MAX
#define | ENCODING_NAMELEN_MAX 63
#define | valid_encoding_name_p(name) ((name) && strlen(name) <= ENCODING_NAMELEN_MAX)
#define | enc_autoload_p(enc) (!rb_enc_mbmaxlen(enc))
#define | is_data_encoding(obj) (RTYPEDDATA_P(obj) && RTYPEDDATA_TYPE(obj) == &encoding_data_type)
#define | ENC_REGISTER(enc) enc_register_at(ENCINDEX_##enc, rb_enc_name(&OnigEncoding##enc), &OnigEncoding##enc)
#define | rb_intern(str) rb_intern_const(str)
#define | ctype_test(c, ctype) (rb_isascii(c) && ONIGENC_IS_ASCII_CODE_CTYPE((c), (ctype)))

## Enumerations

enum | { ENCINDEX_ASCII, ENCINDEX_UTF_8, ENCINDEX_US_ASCII, ENCINDEX_BUILTIN_MAX }

## Functions

void | rb_enc_init (void)
static int | load_encoding (const char *name)
static size_t | enc_memsize (const void *p)
static VALUE | enc_new (rb_encoding *encoding)
static VALUE | rb_enc_from_encoding_index (int idx)
VALUE | rb_enc_from_encoding (rb_encoding *encoding)
static int | enc_autoload (rb_encoding *)
static int | check_encoding (rb_encoding *enc)
static int | enc_check_encoding (VALUE obj)
static int | must_encoding (VALUE enc)
int | rb_to_encoding_index (VALUE enc)
static rb_encoding * | to_encoding (VALUE enc)
rb_encoding * | rb_to_encoding (VALUE enc)
void | rb_gc_mark_encodings (void)
static int | enc_table_expand (int newsize)
static int | enc_register_at (int index, const char *name, rb_encoding *encoding)
static int | enc_register (const char *name, rb_encoding *encoding)
static void | set_encoding_const (const char *, rb_encoding *)
int | rb_enc_registered (const char *name)
int | rb_enc_register (const char *name, rb_encoding *encoding)
void | rb_encdb_declare (const char *name)
static void | enc_check_duplication (const char *name)
static rb_encoding * | set_base_encoding (int index, rb_encoding *base)
void | rb_enc_set_base (const char *name, const char *orig)
int | rb_enc_replicate (const char *name, rb_encoding *encoding)
static VALUE | enc_replicate (VALUE encoding, VALUE name)
static int | enc_replicate_with_index (const char *name, rb_encoding *origenc, int idx)
int | rb_encdb_replicate (const char *name, const char *orig)
int | rb_define_dummy_encoding (const char *name)
int | rb_encdb_dummy (const char *name)
static VALUE | enc_dummy_p (VALUE enc)
static VALUE | enc_ascii_compatible_p (VALUE enc)
int | rb_enc_unicode_p (rb_encoding *enc)
static int | enc_alias_internal (const char *alias, int idx)
static int | enc_alias (const char *alias, int idx)
int | rb_enc_alias (const char *alias, const char *orig)
int | rb_encdb_alias (const char *alias, const char *orig)
rb_encoding * | rb_enc_from_index (int index)
static VALUE | require_enc (VALUE enclib)
int | rb_enc_find_index (const char *name)
rb_encoding * | rb_enc_find (const char *name)
static int | enc_capable (VALUE obj)
ID | rb_id_encoding (void)
int | rb_enc_get_index (VALUE obj)
static void | enc_set_index (VALUE obj, int idx)
void | rb_enc_set_index (VALUE obj, int idx)
VALUE | rb_enc_associate_index (VALUE obj, int idx)
VALUE | rb_enc_associate (VALUE obj, rb_encoding *enc)
rb_encoding * | rb_enc_get (VALUE obj)
rb_encoding * | rb_enc_check (VALUE str1, VALUE str2)
rb_encoding * | rb_enc_compatible (VALUE str1, VALUE str2)
void | rb_enc_copy (VALUE obj1, VALUE obj2)
VALUE | rb_obj_encoding (VALUE obj)
int | rb_enc_fast_mbclen (const char *p, const char *e, rb_encoding *enc)
int | rb_enc_mbclen (const char *p, const char *e, rb_encoding *enc)
int | rb_enc_precise_mbclen (const char *p, const char *e, rb_encoding *enc)
int | rb_enc_ascget (const char *p, const char *e, int *len, rb_encoding *enc)
unsigned int | rb_enc_codepoint_len (const char *p, const char *e, int *len_p, rb_encoding *enc)
unsigned int | rb_enc_codepoint (const char *p, const char *e, rb_encoding *enc)
int | rb_enc_codelen (int c, rb_encoding *enc)
int | rb_enc_toupper (int c, rb_encoding *enc)
int | rb_enc_tolower (int c, rb_encoding *enc)
static VALUE | enc_inspect (VALUE self)
static VALUE | enc_name (VALUE self)
static int | enc_names_i (st_data_t name, st_data_t idx, st_data_t args)
static VALUE | enc_names (VALUE self)
static VALUE | enc_list (VALUE klass)
static VALUE | enc_find (VALUE klass, VALUE enc)
static VALUE | enc_compatible_p (VALUE klass, VALUE str1, VALUE str2)
static VALUE | enc_dump (int argc, VALUE *argv, VALUE self)
static VALUE | enc_load (VALUE klass, VALUE str)
rb_encoding * | rb_ascii8bit_encoding (void)
int | rb_ascii8bit_encindex (void)
rb_encoding * | rb_utf8_encoding (void)
int | rb_utf8_encindex (void)
rb_encoding * | rb_usascii_encoding (void)
int | rb_usascii_encindex (void)
int | rb_locale_encindex (void)
rb_encoding * | rb_locale_encoding (void)
static int | enc_set_filesystem_encoding (void)
int | rb_filesystem_encindex (void)
rb_encoding * | rb_filesystem_encoding (void)
static int | enc_set_default_encoding (struct default_encoding *def, VALUE encoding, const char *name)
rb_encoding * | rb_default_external_encoding (void)
VALUE | rb_enc_default_external (void)
static VALUE | get_default_external (VALUE klass)
void | rb_enc_set_default_external (VALUE encoding)
static VALUE | set_default_external (VALUE klass, VALUE encoding)
rb_encoding * | rb_default_internal_encoding (void)
VALUE | rb_enc_default_internal (void)
static VALUE | get_default_internal (VALUE klass)
void | rb_enc_set_default_internal (VALUE encoding)
static VALUE | set_default_internal (VALUE klass, VALUE encoding)
VALUE | rb_locale_charmap (VALUE klass)
static int | rb_enc_name_list_i (st_data_t name, st_data_t idx, st_data_t arg)
static VALUE | rb_enc_name_list (VALUE klass)
static int | rb_enc_aliases_enc_i (st_data_t name, st_data_t orig, st_data_t arg)
static VALUE | rb_enc_aliases (VALUE klass)
void | Init_Encoding (void)
int | rb_isalnum (int c)
int | rb_isalpha (int c)
int | rb_isblank (int c)
int | rb_iscntrl (int c)
int | rb_isdigit (int c)
int | rb_isgraph (int c)
int | rb_islower (int c)
int | rb_isprint (int c)
int | rb_ispunct (int c)
int | rb_isspace (int c)
int | rb_isupper (int c)
int | rb_isxdigit (int c)
int | rb_tolower (int c)
int | rb_toupper (int c)

## Variables

static ID | id_encoding
VALUE | rb_cEncoding
static VALUE | rb_encoding_list
struct {
struct rb_encoding_entry * list
int count
int size
st_table * names
} | enc_table
static const rb_data_type_t | encoding_data_type
rb_encoding | OnigEncodingUTF_8
rb_encoding | OnigEncodingUS_ASCII
static struct default_encoding | default_external = {0}
static struct default_encoding | default_internal = {-2}

## Macro Definition Documentation

#define ctype_test | ( |  | c,
|  |  | ctype
| ) |  | (rb_isascii(c) && ONIGENC_IS_ASCII_CODE_CTYPE((c), (ctype)))

Definition at line 1635 of file encoding.c.

Referenced by rb_isalnum(), rb_isalpha(), rb_isblank(), rb_iscntrl(), rb_isdigit(), rb_isgraph(), rb_islower(), rb_isprint(), rb_ispunct(), rb_isspace(), rb_isupper(), and rb_isxdigit().

#define enc_autoload_p | ( |  | enc | ) | (!rb_enc_mbmaxlen(enc))

Definition at line 63 of file encoding.c.

Referenced by check_encoding(), enc_autoload(), load_encoding(), rb_enc_find_index(), and rb_enc_register().

#define ENC_REGISTER | ( |  | enc | ) | enc_register_at(ENCINDEX_##enc, rb_enc_name(&OnigEncoding##enc), &OnigEncoding##enc)

Referenced by rb_enc_init().

#define ENCODING_COUNT ENCINDEX_BUILTIN_MAX

Definition at line 57 of file encoding.c.

Referenced by rb_enc_init().

#define ENCODING_NAMELEN_MAX 63

Definition at line 60 of file encoding.c.

Referenced by set_encoding_const().

#define is_data_encoding | ( |  | obj | ) | (RTYPEDDATA_P(obj) && RTYPEDDATA_TYPE(obj) == &encoding_data_type)

Definition at line 78 of file encoding.c.

Referenced by enc_capable(), and rb_enc_get_index().

#define rb_intern | ( |  | str | ) | rb_intern_const(str)

#define UNSPECIFIED_ENCODING INT_MAX

Definition at line 58 of file encoding.c.

Referenced by enc_set_default_encoding(), and rb_enc_find_index().

#define valid_encoding_name_p | ( |  | name | ) | ((name) && strlen(name) <= ENCODING_NAMELEN_MAX)

Definition at line 61 of file encoding.c.

Referenced by enc_alias(), and enc_register_at().

## Enumeration Type Documentation

anonymous enum

Enumerator
ENCINDEX_ASCII |
ENCINDEX_UTF_8 |
ENCINDEX_US_ASCII |
ENCINDEX_BUILTIN_MAX |

Definition at line 486 of file encoding.c.

## Function Documentation

static int check_encoding | ( | rb_encoding * | enc | ) |

static

Definition at line 113 of file encoding.c.

References enc_autoload(), enc_autoload_p, rb_enc_from_index(), and rb_enc_to_index.

Referenced by enc_check_encoding().

static int enc_alias | ( | const char * | alias,
|  | int | idx
| ) |  |

static

Definition at line 452 of file encoding.c.

References enc_alias_internal(), rb_enc_from_index(), set_encoding_const(), and valid_encoding_name_p.

Referenced by rb_enc_alias(), and rb_encdb_alias().

static int enc_alias_internal | ( | const char * | alias,
|  | int | idx
| ) |  |

static

Definition at line 445 of file encoding.c.

References enc_table, st_insert2(), and strdup.

Referenced by enc_alias(), enc_set_default_encoding(), enc_set_filesystem_encoding(), and rb_locale_encindex().

static VALUE enc_ascii_compatible_p | ( | VALUE | enc | ) |

static

Definition at line 425 of file encoding.c.

References enc_table, must_encoding(), Qfalse, Qtrue, and rb_enc_asciicompat.

Referenced by Init_Encoding().

static int enc_autoload | ( | rb_encoding * | enc | ) |

static

Definition at line 573 of file encoding.c.

References rb_encoding_entry::base, enc_autoload_p, enc_register_at(), enc_table, ENC_TO_ENCINDEX, i, load_encoding(), and rb_enc_name.

Referenced by check_encoding(), and rb_enc_find_index().

static int enc_capable | ( | VALUE | obj | ) |

inline static

Definition at line 628 of file encoding.c.

References BUILTIN_TYPE, FALSE, is_data_encoding, SPECIAL_CONST_P, SYMBOL_P, T_DATA, T_FILE, T_REGEXP, T_STRING, and TRUE.

Referenced by enc_compatible_p().

static void enc_check_duplication | ( | const char * | name | ) |

static

Definition at line 288 of file encoding.c.

References rb_eArgError, rb_enc_registered(), and rb_raise().

Referenced by rb_enc_alias(), and rb_enc_replicate().

static int enc_check_encoding | ( | VALUE | obj | ) |

static

Definition at line 125 of file encoding.c.

References check_encoding(), rb_typeddata_is_kind_of(), RDATA, and SPECIAL_CONST_P.

Referenced by must_encoding(), rb_enc_get_index(), rb_to_encoding(), and rb_to_encoding_index().

static VALUE enc_compatible_p | ( | VALUE | klass,
|  | VALUE | str1,
|  | VALUE | str2
| ) |  |

static

Definition at line 1083 of file encoding.c.

References rb_encoding_entry::enc, enc_capable(), Qnil, rb_enc_compatible(), and rb_enc_from_encoding().

Referenced by Init_Encoding().

static VALUE enc_dummy_p | ( | VALUE | enc | ) |

static

Definition at line 409 of file encoding.c.

References ENC_DUMMY_P, enc_table, must_encoding(), Qfalse, and Qtrue.

Referenced by enc_inspect(), and Init_Encoding().

static VALUE enc_dump | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | self
| ) |  |

static

Definition at line 1096 of file encoding.c.

References enc_name(), and rb_scan_args().

Referenced by Init_Encoding().

static VALUE enc_find | ( | VALUE | klass,
|  | VALUE | enc
| ) |  |

static

Definition at line 1053 of file encoding.c.

References rb_enc_from_encoding(), and rb_to_encoding().

Referenced by enc_load(), and Init_Encoding().

static VALUE enc_inspect | ( | VALUE | self | ) |

static

Definition at line 947 of file encoding.c.

References DATA_PTR, ENC_CODERANGE_7BIT, enc_dummy_p(), ENCODING_CODERANGE_SET, rb_enc_name, rb_obj_classname(), rb_sprintf(), and rb_usascii_encindex().

Referenced by Init_Encoding().

static VALUE enc_list | ( | VALUE | klass | ) |

static

Definition at line 1021 of file encoding.c.

References rb_ary_new2(), rb_ary_replace(), and rb_encoding_list.

Referenced by Init_Encoding().

static VALUE enc_load | ( | VALUE | klass,
|  | VALUE | str
| ) |  |

static

Definition at line 1104 of file encoding.c.

References enc_find().

Referenced by Init_Encoding().

static size_t enc_memsize | ( | const void * | p | ) |

static

Definition at line 68 of file encoding.c.

static VALUE enc_name | ( | VALUE | self | ) |

static

Definition at line 965 of file encoding.c.

References DATA_PTR, rb_enc_name, and rb_usascii_str_new2().

Referenced by enc_dump(), Init_Encoding(), lib_set_system_encoding(), ole_cp2encoding(), and proc_options().

static VALUE enc_names | ( | VALUE | self | ) |

static

Definition at line 992 of file encoding.c.

References args, enc_names_i(), enc_table, rb_ary_new2(), rb_to_encoding_index(), and st_foreach.

Referenced by Init_Encoding().

static int enc_names_i | ( | st_data_t | name,
|  | st_data_t | idx,
|  | st_data_t | args
| ) |  |

static

Definition at line 971 of file encoding.c.

References arg, OBJ_FREEZE, rb_ary_push(), rb_usascii_str_new2(), and ST_CONTINUE.

Referenced by enc_names().

static VALUE enc_new | ( | rb_encoding * | encoding | ) |

static

Definition at line 81 of file encoding.c.

References rb_cEncoding, and TypedData_Wrap_Struct.

Referenced by enc_register_at(), and Init_Encoding().

static int enc_register | ( | const char * | name,
|  | rb_encoding * | encoding
| ) |  |

static

Definition at line 241 of file encoding.c.

References enc_register_at(), enc_table, and enc_table_expand().

Referenced by enc_replicate_with_index(), rb_enc_register(), rb_enc_replicate(), rb_encdb_alias(), rb_encdb_declare(), and rb_encdb_replicate().

static int enc_register_at | ( | int | index,
|  | const char * | name,
|  | rb_encoding * | encoding
| ) |  |

static

Definition at line 207 of file encoding.c.

References rb_encoding_entry::enc, enc_new(), enc_table, list, rb_encoding_entry::name, OnigEncodingTypeST::name, name, NIL_P, rb_ary_entry(), rb_ary_store(), rb_encoding_list, OnigEncodingTypeST::ruby_encoding_index, st_insert, STRCASECMP, strdup, valid_encoding_name_p, and xmalloc.

Referenced by enc_autoload(), enc_register(), enc_replicate_with_index(), and rb_enc_register().

static VALUE enc_replicate | ( | VALUE | encoding,
|  | VALUE | name
| ) |  |

static

Definition at line 339 of file encoding.c.

References rb_enc_from_encoding_index(), rb_enc_replicate(), rb_to_encoding(), and StringValueCStr.

Referenced by Init_Encoding().

static int enc_replicate_with_index | ( | const char * | name,
|  | rb_encoding * | origenc,
|  | int | idx
| ) |  |

static

Definition at line 347 of file encoding.c.

References enc_register(), enc_register_at(), rb_enc_from_index(), set_base_encoding(), and set_encoding_const().

Referenced by rb_encdb_dummy(), and rb_encdb_replicate().

static int enc_set_default_encoding | ( | struct default_encoding * | def,
|  | VALUE | encoding,
|  | const char * | name
| ) |  |

static

Definition at line 1218 of file encoding.c.

References default_encoding::enc, enc_alias_internal(), enc_set_filesystem_encoding(), enc_table, FALSE, default_encoding::index, NIL_P, rb_enc_to_index, rb_to_encoding(), st_insert, strdup, TRUE, and UNSPECIFIED_ENCODING.

Referenced by rb_enc_set_default_external(), and rb_enc_set_default_internal().

static int enc_set_filesystem_encoding | ( | void |  | ) |

static

Definition at line 1177 of file encoding.c.

References enc_alias_internal(), rb_ascii8bit_encindex(), rb_default_external_encoding(), rb_enc_find_index(), rb_enc_to_index, and snprintf.

Referenced by enc_set_default_encoding().

static void enc_set_index | ( | VALUE | obj,
|  | int | idx
| ) |  |

static

Definition at line 691 of file encoding.c.

References ENCODING_INLINE_MAX, ENCODING_SET_INLINED, INT2NUM(), rb_id_encoding(), and rb_ivar_set().

Referenced by rb_enc_associate_index(), and rb_enc_set_index().

static int enc_table_expand | ( | int | newsize | ) |

static

Definition at line 191 of file encoding.c.

References count, enc_table, and realloc().

Referenced by enc_register(), and rb_enc_init().

static VALUE get_default_external | ( | VALUE | klass | ) |

static

Definition at line 1291 of file encoding.c.

References rb_enc_default_external().

Referenced by Init_Encoding().

static VALUE get_default_internal | ( | VALUE | klass | ) |

static

Definition at line 1377 of file encoding.c.

References rb_enc_default_internal().

Referenced by Init_Encoding().

void Init_Encoding | ( | void |  | ) |

Definition at line 1591 of file encoding.c.

References CLASS_OF, enc_ascii_compatible_p(), enc_compatible_p(), enc_dummy_p(), enc_dump(), enc_find(), enc_inspect(), enc_list(), enc_load(), enc_name(), enc_names(), enc_new(), enc_replicate(), enc_table, get_default_external(), get_default_internal(), i, list, rb_ary_new2(), rb_ary_push(), rb_cEncoding, rb_cObject, rb_define_class(), rb_define_method(), rb_define_singleton_method(), rb_enc_aliases(), rb_enc_name_list(), rb_encoding_list, rb_gc_register_mark_object(), rb_locale_charmap(), rb_undef_alloc_func(), rb_undef_method(), RBASIC, set_default_external(), and set_default_internal().

static int load_encoding | ( | const char * | name | ) |

static

Definition at line 544 of file encoding.c.

References debug, enc_autoload_p, enc_table, FL_TAINT, FL_UNSET, FL_UNTRUSTED, ISALNUM, ISUPPER, NIL_P, OBJ_FREEZE, Qfalse, Qnil, rb_enc_registered(), rb_protect(), rb_set_errinfo(), rb_sprintf(), require_enc(), RSTRING_END, RSTRING_PTR, ruby_debug, ruby_verbose, and TOLOWER.

Referenced by enc_autoload(), and rb_enc_find_index().

static int must_encoding | ( | VALUE | enc | ) |

static

Definition at line 134 of file encoding.c.

References enc_check_encoding(), rb_eTypeError, rb_obj_classname(), and rb_raise().

Referenced by enc_ascii_compatible_p(), and enc_dummy_p().

int rb_ascii8bit_encindex | ( | void |  | ) |

Definition at line 1119 of file encoding.c.

References ENCINDEX_ASCII.

Referenced by enc_set_filesystem_encoding(), pack_unpack(), parser_regx_options(), rb_char_to_option_kcode(), rb_filesystem_encindex(), and rb_locale_encindex().

rb_encoding* rb_ascii8bit_encoding | ( | void |  | ) |

Definition at line 1110 of file encoding.c.

References enc_table, ENCINDEX_ASCII, and rb_enc_init().

Referenced by do_opendir(), do_writeconv(), file_path_convert(), int_chr(), load_file_internal(), make_writeconv(), parser_str_new(), rb_define_dummy_encoding(), rb_encdb_dummy(), rb_external_str_new_with_enc(), rb_file_open_internal(), rb_glob(), rb_gzreader_ungetc(), rb_gzwriter_write(), rb_intern3(), rb_io_ascii8bit_binmode(), rb_io_ext_int_to_encs(), rb_io_extract_modeenc(), rb_reg_initialize(), rb_reg_initialize_m(), rb_reg_initialize_str(), rb_reg_new(), rb_reg_prepare_enc(), rb_reg_preprocess_dregexp(), rb_reg_s_union(), rb_str_concat(), rb_str_dump(), rb_str_encode_ospath(), rb_symname_p(), rb_w32_conv_from_wchar(), rb_w32_readdir_with_enc(), reg_fragment_setenc_gen(), RUBY_ALIAS_FUNCTION(), ruby_brace_glob(), ruby_glob(), strio_read(), strio_ungetc(), and strio_write().

rb_encoding* rb_default_external_encoding | ( | void |  | ) |

Definition at line 1245 of file encoding.c.

References default_encoding::enc, default_encoding::index, rb_enc_from_index(), and rb_locale_encoding().

Referenced by argf_external_encoding(), argf_internal_encoding(), enc_set_filesystem_encoding(), gzfile_new(), io_read_encoding(), ole_init_cp(), rb_enc_default_external(), rb_enc_reg_error_desc(), rb_external_str_new(), rb_external_str_new_cstr(), rb_io_ext_int_to_encs(), rb_reg_desc(), rb_str_export(), rb_str_inspect(), strio_init(), strio_set_encoding(), sym_inspect(), and validate_enc_binmode().

rb_encoding* rb_default_internal_encoding | ( | void |  | ) |

Definition at line 1330 of file encoding.c.

References default_encoding::enc, default_encoding::index, and rb_enc_from_index().

Referenced by file_path_convert(), int_chr(), ole_init_cp(), parse(), process_options(), rb_enc_default_internal(), rb_enc_reg_error_desc(), rb_external_str_new_with_enc(), rb_io_ext_int_to_encs(), rb_reg_desc(), rb_str_inspect(), and sym_inspect().

int rb_define_dummy_encoding | ( | const char * | name | ) |

Definition at line 375 of file encoding.c.

References rb_encoding_entry::enc, ENC_SET_DUMMY, enc_table, rb_ascii8bit_encoding(), and rb_enc_replicate().

Referenced by create_dummy_encoding_for_tk_core(), make_dummy_encoding(), ole_cp2encoding(), rb_nkf_enc_get(), and str_transcode0().

int rb_enc_alias | ( | const char * | alias,
|  | const char * | orig
| ) |  |

Definition at line 461 of file encoding.c.

References enc_alias(), enc_check_duplication(), enc_table, rb_enc_find_index(), and rb_enc_init().

static VALUE rb_enc_aliases | ( | VALUE | klass | ) |

static

Definition at line 1581 of file encoding.c.

References enc_table, rb_ary_new(), rb_enc_aliases_enc_i(), rb_hash_new(), and st_foreach.

Referenced by Init_Encoding().

static int rb_enc_aliases_enc_i | ( | st_data_t | name,
|  | st_data_t | orig,
|  | st_data_t | arg
| ) |  |

static

Definition at line 1544 of file encoding.c.

References default_encoding::enc, NIL_P, OBJ_FREEZE, p, rb_ary_entry(), rb_ary_store(), rb_enc_from_index(), rb_enc_name, rb_hash_aset(), rb_usascii_str_new2(), ST_CONTINUE, and STRCASECMP.

Referenced by rb_enc_aliases().

int rb_enc_ascget | ( | const char * | p,
|  | const char * | e,
|  | int * | len,
|  | rb_encoding * | enc
| ) |  |

Definition at line 871 of file encoding.c.

References ISASCII, MBCLEN_CHARFOUND_P, rb_enc_asciicompat, rb_enc_isascii, rb_enc_mbc_to_codepoint, and rb_enc_precise_mbclen().

Referenced by check_pipe_command(), chopped_length(), rb_reg_expr_str(), rb_reg_quote(), rb_str_casecmp(), rb_str_chomp_bang(), rb_str_split_m(), str_end_with_asciichar(), swallow(), tr_setup_table(), and tr_trans().

VALUE rb_enc_associate | ( | VALUE | obj,
|  | rb_encoding * | enc
| ) |  |

Definition at line 727 of file encoding.c.

References rb_enc_associate_index(), and rb_enc_to_index.

Referenced by bug_str_enc_associate(), econv_primitive_convert(), econv_putback(), file_expand_path(), gzfile_getc(), gzfile_newstr(), io_enc_str(), io_shift_cbuf(), lex_getline(), load_file_internal(), locale_path(), parser_nextc(), parser_str_new(), process_options(), rb_ary_join(), rb_dir_getwd(), rb_econv_substr_append(), rb_enc_reg_error_desc(), rb_enc_str_new(), rb_enc_vsprintf(), rb_external_str_new_with_enc(), rb_intern3(), rb_nkf_convert(), rb_reg_desc(), rb_reg_initialize(), rb_reg_preprocess(), rb_reg_preprocess_dregexp(), rb_reg_quote(), rb_reg_s_union(), rb_str_append(), rb_str_concat(), rb_str_dump(), rb_str_ellipsize(), rb_str_encode_ospath(), rb_str_force_encoding(), rb_str_format(), rb_str_inspect(), rb_str_justify(), rb_str_shared_replace(), rb_str_splice(), rb_str_sub_bang(), rb_str_subpat_set(), reg_fragment_setenc_gen(), RUBY_ALIAS_FUNCTION(), str_gsub(), strio_read(), strio_set_encoding(), syck_genericresolver_node_import(), syserr_initialize(), tr_trans(), and yaml_org_handler().

VALUE rb_enc_associate_index | ( | VALUE | obj,
|  | int | idx
| ) |  |

Definition at line 709 of file encoding.c.

References ENC_CODERANGE_ASCIIONLY, ENC_CODERANGE_CLEAR, enc_set_index(), rb_check_frozen, rb_eArgError, rb_enc_asciicompat, rb_enc_from_index(), rb_enc_get_index(), rb_raise(), and SPECIAL_CONST_P.

Referenced by file_expand_path(), iconv_convert(), lib_fromUTF8_core(), lib_split_tklist_core(), lib_toUTF8_core(), lib_UTF_backslash_core(), make_econv_exception(), parser_set_encode(), r_ivar(), r_symreal(), rb_enc_associate(), rb_enc_copy(), rb_home_dir(), and str_encode_associate().

rb_encoding* rb_enc_check | ( | VALUE | str1,
|  | VALUE | str2
| ) |  |

Definition at line 739 of file encoding.c.

References rb_encoding_entry::enc, rb_eEncCompatError, rb_enc_compatible(), rb_enc_get(), rb_enc_name, and rb_raise().

Referenced by file_expand_path(), rb_file_s_basename(), rb_str_append(), rb_str_chomp_bang(), rb_str_count(), rb_str_delete_bang(), rb_str_each_line(), rb_str_end_with(), rb_str_format(), rb_str_index(), rb_str_index_m(), rb_str_justify(), rb_str_plus(), rb_str_rindex(), rb_str_splice(), rb_str_split_m(), rb_str_squeeze_bang(), rb_str_start_with(), rb_str_subpat_set(), rb_str_upto(), readline_attempted_completion_function(), and tr_trans().

int rb_enc_codelen | ( | int | c,
|  | rb_encoding * | enc
| ) |  |

Definition at line 916 of file encoding.c.

References ONIGENC_CODE_TO_MBCLEN, rb_eArgError, rb_enc_name, and rb_raise().

Referenced by parser_tokaddmbc(), rb_enc_uint_chr(), rb_str_buf_cat_ascii(), rb_str_concat(), rb_str_format(), strio_ungetc(), and tr_trans().

unsigned int rb_enc_codepoint | ( | const char * | p,
|  | const char * | e,
|  | rb_encoding * | enc
| ) |  |

Definition at line 910 of file encoding.c.

References rb_enc_codepoint_len().

unsigned int rb_enc_codepoint_len | ( | const char * | p,
|  | const char * | e,
|  | int * | len_p,
|  | rb_encoding * | enc
| ) |  |

Definition at line 894 of file encoding.c.

References MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, rb_eArgError, rb_enc_mbc_to_codepoint, rb_enc_name, rb_enc_precise_mbclen(), and rb_raise().

Referenced by rb_enc_codepoint(), rb_str_capitalize_bang(), rb_str_count(), rb_str_delete_bang(), rb_str_downcase_bang(), rb_str_each_codepoint(), rb_str_each_line(), rb_str_format(), rb_str_lstrip_bang(), rb_str_split_m(), rb_str_squeeze_bang(), rb_str_swapcase_bang(), rb_str_upcase_bang(), readline_attempted_completion_function(), strio_each_codepoint(), sym_printable(), tr_trans(), and trnext().

rb_encoding* rb_enc_compatible | ( | VALUE | str1,
|  | VALUE | str2
| ) |  |

Definition at line 750 of file encoding.c.

References ENC_CODERANGE_7BIT, ENCINDEX_US_ASCII, rb_enc_asciicompat, rb_enc_from_index(), rb_enc_get_index(), rb_enc_str_asciionly_p(), rb_enc_str_coderange(), RB_TYPE_P, RSTRING_LEN, and T_STRING.

Referenced by enc_compatible_p(), literal_concat0(), rb_enc_check(), rb_str_casecmp(), rb_str_sub_bang(), and vm_backtrace_push().

void rb_enc_copy | ( | VALUE | obj1,
|  | VALUE | obj2
| ) |  |

Definition at line 817 of file encoding.c.

References rb_enc_associate_index(), and rb_enc_get_index().

Referenced by ary_join_0(), ary_join_1(), date_s__parse_internal(), date_s__strptime_internal(), date_strftime_internal(), file_expand_path(), inspect_ary(), inspect_i(), rb_attr(), rb_file_dirname(), rb_file_join(), rb_file_s_basename(), rb_file_s_extname(), rb_reg_desc(), rb_reg_quote(), rb_reg_s_union(), rb_reg_to_s(), rb_str_format(), RUBY_ALIAS_FUNCTION(), str_new(), strio_read(), and time_strftime().

VALUE rb_enc_default_external | ( | void |  | ) |

Definition at line 1259 of file encoding.c.

References rb_default_external_encoding(), and rb_enc_from_encoding().

Referenced by get_default_external().

VALUE rb_enc_default_internal | ( | void |  | ) |

Definition at line 1339 of file encoding.c.

References rb_default_internal_encoding(), and rb_enc_from_encoding().

Referenced by get_default_internal(), and str_transcode0().

int rb_enc_fast_mbclen | ( | const char * | p,
|  | const char * | e,
|  | rb_encoding * | enc
| ) |  |

Definition at line 841 of file encoding.c.

References ONIGENC_MBC_ENC_LEN, and UChar.

Referenced by enc_strlen(), rb_str_each_char(), rb_str_reverse(), rb_str_split_m(), scan_once(), and str_gsub().

rb_encoding* rb_enc_find | ( | const char * | name | ) |

Definition at line 620 of file encoding.c.

References rb_enc_find_index(), and rb_enc_from_index().

Referenced by econv_get_replacement(), econv_insert_output(), Init_gb2312(), make_encoding(), make_replacement(), rb_str_inspect(), rb_w32_conv_from_wchar(), rb_w32_write_console(), and transcode_loop().

int rb_enc_find_index | ( | const char * | name | ) |

Definition at line 596 of file encoding.c.

References rb_encoding_entry::enc, enc_autoload(), enc_autoload_p, i, load_encoding(), rb_eArgError, rb_enc_from_index(), rb_enc_registered(), rb_raise(), rb_warn(), and UNSPECIFIED_ENCODING.

Referenced by create_dummy_encoding_for_tk_core(), enc_set_filesystem_encoding(), iconv_create(), id2encidx(), Init_tcltklib(), io_strip_bom(), lib_fromUTF8_core(), make_econv_exception(), ole_cp2encoding(), opt_enc_index(), parse_mode_enc(), parser_set_encode(), process_options(), rb_char_to_option_kcode(), rb_econv_open0(), rb_enc_alias(), rb_enc_find(), rb_locale_encindex(), rb_nkf_enc_get(), rb_to_encoding_index(), and to_encoding().

VALUE rb_enc_from_encoding | ( | rb_encoding * | encoding | ) |

Definition at line 102 of file encoding.c.

References ENC_TO_ENCINDEX, Qnil, and rb_enc_from_encoding_index().

Referenced by argf_external_encoding(), argf_internal_encoding(), create_dummy_encoding_for_tk_core(), do_writeconv(), econv_destination_encoding(), econv_insert_output(), econv_s_asciicompat_encoding(), econv_source_encoding(), enc_compatible_p(), enc_find(), gettable_gen(), Init_nkf(), io_set_encoding_by_bom(), load_file_internal(), make_econv_exception(), make_encobj(), process_options(), rb_enc_default_external(), rb_enc_default_internal(), rb_io_external_encoding(), rb_io_getline_1(), rb_io_internal_encoding(), rb_nkf_guess(), rb_obj_encoding(), rb_parser_encoding(), rb_str_ellipsize(), rb_str_encode_ospath(), rb_w32_conv_from_wchar(), rb_w32_write_console(), readline_attempted_completion_function(), set_encoding_const(), and strio_external_encoding().

static VALUE rb_enc_from_encoding_index | ( | int | idx | ) |

static

Definition at line 87 of file encoding.c.

References rb_encoding_entry::enc, list, NIL_P, rb_ary_entry(), rb_bug(), and rb_encoding_list.

Referenced by enc_replicate(), and rb_enc_from_encoding().

rb_encoding* rb_enc_from_index | ( | int | index | ) |

Definition at line 512 of file encoding.c.

References enc_table, and rb_enc_init().

Referenced by check_encoding(), create_dummy_encoding_for_tk_core(), econv_args(), enc_alias(), enc_arg(), enc_replicate_with_index(), file_path_convert(), io_set_encoding_by_bom(), load_file_internal(), make_dummy_encoding(), make_econv_exception(), ole_cp2encoding(), opt_enc_index(), parse_mode_enc(), parser_set_encode(), process_options(), rb_default_external_encoding(), rb_default_internal_encoding(), rb_econv_open0(), rb_enc_aliases_enc_i(), rb_enc_associate_index(), rb_enc_compatible(), rb_enc_cr_str_buf_cat(), rb_enc_find(), rb_enc_find_index(), rb_enc_get(), rb_enc_register(), rb_enc_replicate(), rb_enc_set_base(), rb_encdb_declare(), rb_encdb_replicate(), rb_filesystem_encoding(), rb_io_extract_encoding_option(), rb_locale_encoding(), rb_nkf_enc_get(), rb_str_buf_cat_ascii(), rb_str_comparable(), str_encode_associate(), str_end_with_asciichar(), str_transcode_enc_args(), to_encoding(), and w_encoding().

rb_encoding* rb_enc_get | ( | VALUE | obj | ) |

Definition at line 733 of file encoding.c.

References rb_enc_from_index(), and rb_enc_get_index().

Referenced by check_pipe_command(), do_writeconv(), econv_set_replacement(), file_s_fnmatch(), iconv_iconv(), io_encoding_set(), literal_concat0(), must_be_ascii_compatible(), must_not_be_anonymous(), ole_vstr2wc(), parser_prepare(), parser_yyerror(), prepare_getline_args(), push_glob(), rb_econv_open_opts(), rb_econv_prepare_options(), rb_enc_check(), rb_file_s_basename(), rb_get_path_check(), rb_gzreader_ungetc(), rb_gzwriter_write(), rb_intern3(), rb_intern_str(), rb_obj_encoding(), rb_path_to_class(), rb_push_glob(), rb_realpath_internal(), rb_reg_check_preprocess(), rb_reg_desc(), rb_reg_error_desc(), rb_reg_init_copy(), rb_reg_initialize_m(), rb_reg_initialize_str(), rb_reg_prepare_enc(), rb_reg_preprocess_dregexp(), rb_reg_quote(), rb_reg_regsub(), rb_reg_s_union(), rb_reg_source(), rb_reg_to_s(), rb_str_chomp_bang(), rb_str_dump(), rb_str_each_char(), rb_str_each_line(), rb_str_ellipsize(), rb_str_encode_ospath(), rb_str_format(), rb_str_hex(), rb_str_oct(), rb_to_encoding_index(), rb_w32_write_console(), reg_enc_error(), reg_fragment_setenc_gen(), reg_named_capture_assign_gen(), strio_each_codepoint(), strio_external_encoding(), strio_getc(), strio_getline(), strio_substr(), strio_ungetc(), strio_write(), strscan_getch(), syserr_initialize(), to_encoding(), transcode_loop(), and update_char_offset().

int rb_enc_get_index | ( | VALUE | obj | ) |

Definition at line 651 of file encoding.c.

References BUILTIN_TYPE, enc_check_encoding(), ENCODING_GET_INLINED, ENCODING_INLINE_MAX, i, is_data_encoding, NIL_P, NUM2INT, rb_funcall(), rb_id2str(), rb_id_encoding(), rb_intern, rb_ivar_get(), SPECIAL_CONST_P, SYM2ID, SYMBOL_P, T_DATA, T_FILE, T_REGEXP, and T_STRING.

Referenced by lib_fromUTF8_core(), lib_split_tklist_core(), rb_enc_associate_index(), rb_enc_compatible(), rb_enc_copy(), rb_enc_get(), str_transcode_enc_args(), w_encoding(), and w_symbol().

void rb_enc_init | ( | void |  | ) |

Definition at line 497 of file encoding.c.

References ASCII, ENC_REGISTER, enc_table, enc_table_expand(), ENCINDEX_BUILTIN_MAX, ENCODING_COUNT, st_init_strcasetable(), and UTF_8.

Referenced by rb_ascii8bit_encoding(), rb_enc_alias(), rb_enc_from_index(), rb_usascii_encoding(), and rb_utf8_encoding().

int rb_enc_mbclen | ( | const char * | p,
|  | const char * | e,
|  | rb_encoding * | enc
| ) |  |

Definition at line 847 of file encoding.c.

References MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, min(), ONIGENC_PRECISE_MBC_ENC_LEN, rb_enc_mbminlen, and UChar.

Referenced by bracket(), enc_strlen(), gzfile_getc(), io_getc(), is_special_global_name(), rb_enc_symname2_p(), rb_intern3(), rb_str_casecmp(), rb_str_each_char(), rb_str_each_line(), rb_str_format(), rb_str_reverse(), str_nth_len(), strio_getc(), strio_ungetc(), and strscan_getch().

static VALUE rb_enc_name_list | ( | VALUE | klass | ) |

static

Definition at line 1536 of file encoding.c.

References enc_table, rb_ary_new2(), rb_enc_name_list_i(), and st_foreach.

Referenced by Init_Encoding().

static int rb_enc_name_list_i | ( | st_data_t | name,
|  | st_data_t | idx,
|  | st_data_t | arg
| ) |  |

static

Definition at line 1512 of file encoding.c.

References OBJ_FREEZE, rb_ary_push(), rb_usascii_str_new2(), and ST_CONTINUE.

Referenced by rb_enc_name_list().

int rb_enc_precise_mbclen | ( | const char * | p,
|  | const char * | e,
|  | rb_encoding * | enc
| ) |  |

Definition at line 859 of file encoding.c.

References ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE, ONIGENC_PRECISE_MBC_ENC_LEN, and UChar.

Referenced by coderange_scan(), enc_pred_char(), enc_succ_char(), fnmatch_helper(), gzreader_charboundary(), io_getc(), make_econv_exception(), rb_enc_ascget(), rb_enc_codepoint_len(), rb_enc_strlen_cr(), rb_enc_uint_chr(), rb_io_each_codepoint(), rb_io_getline_1(), rb_reg_expr_str(), rb_str_coderange_scan_restartable(), rb_str_concat(), rb_str_dump(), rb_str_inspect(), rb_str_succ(), unescape_escaped_nonascii(), and unescape_nonascii().

int rb_enc_register | ( | const char * | name,
|  | rb_encoding * | encoding
| ) |  |

Definition at line 254 of file encoding.c.

References enc_autoload_p, ENC_DUMMY_P, enc_register(), enc_register_at(), rb_eArgError, rb_enc_from_index(), rb_enc_name, rb_enc_registered(), rb_raise(), set_encoding_const(), and STRCASECMP.

Referenced by Init_gb2312().

int rb_enc_registered | ( | const char * | name | ) |

Definition at line 524 of file encoding.c.

References enc_table, and st_lookup.

Referenced by enc_check_duplication(), load_encoding(), rb_enc_find_index(), rb_enc_register(), rb_enc_set_base(), rb_encdb_alias(), rb_encdb_declare(), rb_encdb_dummy(), rb_encdb_replicate(), rb_filesystem_encindex(), and rb_locale_encindex().

int rb_enc_replicate | ( | const char * | name,
|  | rb_encoding * | encoding
| ) |  |

Definition at line 318 of file encoding.c.

References enc_check_duplication(), enc_register(), rb_enc_from_index(), set_base_encoding(), and set_encoding_const().

Referenced by enc_replicate(), and rb_define_dummy_encoding().

void rb_enc_set_base | ( | const char * | name,
|  | const char * | orig
| ) |  |

Definition at line 310 of file encoding.c.

References rb_enc_from_index(), rb_enc_registered(), and set_base_encoding().

void rb_enc_set_default_external | ( | VALUE | encoding | ) |

Definition at line 1297 of file encoding.c.

References enc_set_default_encoding(), NIL_P, rb_eArgError, and rb_raise().

Referenced by process_options(), and set_default_external().

void rb_enc_set_default_internal | ( | VALUE | encoding | ) |

Definition at line 1383 of file encoding.c.

References enc_set_default_encoding().

Referenced by process_options(), and set_default_internal().

void rb_enc_set_index | ( | VALUE | obj,
|  | int | idx
| ) |  |

Definition at line 702 of file encoding.c.

References enc_set_index(), and rb_check_frozen.

Referenced by pack_pack(), and str_enc_copy().

int rb_enc_tolower | ( | int | c,
|  | rb_encoding * | enc
| ) |  |

Definition at line 932 of file encoding.c.

References ONIGENC_ASCII_CODE_TO_LOWER_CASE, and ONIGENC_IS_ASCII_CODE.

Referenced by rb_str_capitalize_bang(), rb_str_downcase_bang(), and rb_str_swapcase_bang().

int rb_enc_toupper | ( | int | c,
|  | rb_encoding * | enc
| ) |  |

Definition at line 926 of file encoding.c.

References ONIGENC_ASCII_CODE_TO_UPPER_CASE, and ONIGENC_IS_ASCII_CODE.

Referenced by bracket(), fnmatch_helper(), rb_str_capitalize_bang(), rb_str_format(), rb_str_swapcase_bang(), and rb_str_upcase_bang().

int rb_enc_unicode_p | ( | rb_encoding * | enc | ) |

Definition at line 434 of file encoding.c.

References name, and rb_enc_name.

Referenced by rb_reg_expr_str(), and rb_str_inspect().

int rb_encdb_alias | ( | const char * | alias,
|  | const char * | orig
| ) |  |

Definition at line 476 of file encoding.c.

References enc_alias(), enc_register(), and rb_enc_registered().

void rb_encdb_declare | ( | const char * | name | ) |

Definition at line 278 of file encoding.c.

References enc_register(), rb_enc_from_index(), rb_enc_registered(), and set_encoding_const().

int rb_encdb_dummy | ( | const char * | name | ) |

Definition at line 385 of file encoding.c.

References rb_encoding_entry::enc, enc_replicate_with_index(), ENC_SET_DUMMY, enc_table, rb_ascii8bit_encoding(), and rb_enc_registered().

int rb_encdb_replicate | ( | const char * | name,
|  | const char * | orig
| ) |  |

Definition at line 363 of file encoding.c.

References enc_register(), enc_replicate_with_index(), rb_enc_from_index(), and rb_enc_registered().

int rb_filesystem_encindex | ( | void |  | ) |

Definition at line 1196 of file encoding.c.

References rb_ascii8bit_encindex(), and rb_enc_registered().

Referenced by file_expand_path(), rb_filesystem_encoding(), and rb_home_dir().

rb_encoding* rb_filesystem_encoding | ( | void |  | ) |

Definition at line 1205 of file encoding.c.

References rb_enc_from_index(), and rb_filesystem_encindex().

Referenced by coverage(), debug_lines(), dir_initialize(), etc_systmpdir(), file_path_convert(), gettable_gen(), push_glob(), rb_dir_getwd(), rb_filesystem_str_new(), rb_filesystem_str_new_cstr(), rb_str_encode_ospath(), and rb_w32_special_folder().

void rb_gc_mark_encodings | ( | void |  | ) |

Definition at line 186 of file encoding.c.

Referenced by gc_marks().

ID rb_id_encoding | ( | void |  | ) |

Definition at line 644 of file encoding.c.

References CONST_ID, and id_encoding.

Referenced by enc_set_index(), id2encidx(), rb_enc_get_index(), w_encoding(), and w_obj_each().

int rb_isalnum | ( | int | c | ) |

Definition at line 1638 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_ALNUM.

int rb_isalpha | ( | int | c | ) |

Definition at line 1639 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_ALPHA.

int rb_isblank | ( | int | c | ) |

Definition at line 1640 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_BLANK.

int rb_iscntrl | ( | int | c | ) |

Definition at line 1641 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_CNTRL.

int rb_isdigit | ( | int | c | ) |

Definition at line 1642 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_DIGIT.

Referenced by f_format(), and string_to_r_internal().

int rb_isgraph | ( | int | c | ) |

Definition at line 1643 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_GRAPH.

int rb_islower | ( | int | c | ) |

Definition at line 1644 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_LOWER.

int rb_isprint | ( | int | c | ) |

Definition at line 1645 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_PRINT.

Referenced by curses_getch(), and window_getch().

int rb_ispunct | ( | int | c | ) |

Definition at line 1646 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_PUNCT.

Referenced by rb_id2str().

int rb_isspace | ( | int | c | ) |

Definition at line 1647 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_SPACE.

Referenced by rb_str_lstrip_bang(), rb_str_rstrip_bang(), and rb_str_split_m().

int rb_isupper | ( | int | c | ) |

Definition at line 1648 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_UPPER.

int rb_isxdigit | ( | int | c | ) |

Definition at line 1649 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_XDIGIT.

VALUE rb_locale_charmap | ( | VALUE | klass | ) |

Definition at line 1436 of file encoding.c.

References nl_langinfo_codeset(), Qnil, rb_usascii_str_new2(), and snprintf.

Referenced by Init_Encoding(), and rb_locale_encindex().

int rb_locale_encindex | ( | void |  | ) |

Definition at line 1155 of file encoding.c.

References enc_alias_internal(), NIL_P, rb_ascii8bit_encindex(), rb_cEncoding, rb_enc_find_index(), rb_enc_registered(), rb_locale_charmap(), rb_usascii_encindex(), and StringValueCStr.

Referenced by rb_locale_encoding().

rb_encoding* rb_locale_encoding | ( | void |  | ) |

Definition at line 1171 of file encoding.c.

References rb_enc_from_index(), and rb_locale_encindex().

Referenced by load_file_internal(), locale_path(), process_options(), rb_default_external_encoding(), rb_loaderror(), rb_locale_str_new(), rb_locale_str_new_cstr(), rb_str_export_locale(), readline_attempted_completion_function(), and syserr_initialize().

VALUE rb_obj_encoding | ( | VALUE | obj | ) |

Definition at line 831 of file encoding.c.

References rb_encoding_entry::enc, rb_enc_from_encoding(), rb_enc_get(), rb_eTypeError, and rb_raise().

Referenced by Init_Regexp(), Init_String(), lib_toUTF8_core(), str_transcode0(), and sym_encoding().

rb_encoding* rb_to_encoding | ( | VALUE | enc | ) |

Definition at line 179 of file encoding.c.

References enc_check_encoding(), RDATA, and to_encoding().

Referenced by bug_str_enc_associate(), decorate_convpath(), dir_initialize(), enc_find(), enc_replicate(), enc_set_default_encoding(), int_chr(), io_encoding_set(), rb_io_extract_encoding_option(), rb_str_force_encoding(), and strio_set_encoding().

int rb_to_encoding_index | ( | VALUE | enc | ) |

Definition at line 145 of file encoding.c.

References enc_check_encoding(), NIL_P, rb_check_string_type(), rb_enc_asciicompat, rb_enc_find_index(), rb_enc_get(), and StringValueCStr.

Referenced by econv_args(), enc_arg(), enc_names(), lib_fromUTF8_core(), and rb_io_extract_encoding_option().

int rb_tolower | ( | int | c | ) |

Definition at line 1652 of file encoding.c.

References ONIGENC_ASCII_CODE_TO_LOWER_CASE, and rb_isascii.

Referenced by readline_attempted_completion_function().

int rb_toupper | ( | int | c | ) |

Definition at line 1658 of file encoding.c.

References ONIGENC_ASCII_CODE_TO_UPPER_CASE, and rb_isascii.

int rb_usascii_encindex | ( | void |  | ) |

Definition at line 1149 of file encoding.c.

References ENCINDEX_US_ASCII.

Referenced by enc_inspect(), id2encidx(), pack_pack(), r_symreal(), rb_locale_encindex(), rb_usascii_str_new(), RUBY_ALIAS_FUNCTION(), w_encoding(), and w_symbol().

rb_encoding* rb_usascii_encoding | ( | void |  | ) |

Definition at line 1140 of file encoding.c.

References enc_table, ENCINDEX_US_ASCII, and rb_enc_init().

Referenced by do_opendir(), file_path_convert(), glob_helper(), Init_id(), load_file_internal(), mk_inspect(), of2str(), parser_initialize(), parser_str_new(), push_glob(), rb_ary_join(), rb_external_str_new_with_enc(), rb_intern2(), rb_intern3(), rb_intern_str(), rb_nkf_convert(), rb_reg_desc(), rb_reg_initialize(), rb_reg_quote(), rb_str_concat(), rb_str_inspect(), rb_str_upto(), reg_fragment_setenc_gen(), and setup_exception().

int rb_utf8_encindex | ( | void |  | ) |

Definition at line 1134 of file encoding.c.

References ENCINDEX_UTF_8.

Referenced by id2encidx(), io_strip_bom(), pack_pack(), parse(), rb_char_to_option_kcode(), and w_encoding().

rb_encoding* rb_utf8_encoding | ( | void |  | ) |

Definition at line 1125 of file encoding.c.

References enc_table, ENCINDEX_UTF_8, and rb_enc_init().

Referenced by alias(), append_utf8(), do_opendir(), Init_nkf(), Init_tcltklib(), make_econv_exception(), parser_prepare(), parser_str_new(), rb_memsearch(), rb_str_dump(), rb_str_encode_ospath(), rb_str_substr(), scalar(), start_document(), start_mapping(), start_sequence(), str_strlen(), syck_genericresolver_node_import(), and yaml_org_handler().

static VALUE require_enc | ( | VALUE | enclib | ) |

static

Definition at line 537 of file encoding.c.

References rb_require_safe(), and rb_safe_level.

Referenced by load_encoding().

static rb_encoding* set_base_encoding | ( | int | index,
|  | rb_encoding * | base
| ) |  |

static

Definition at line 296 of file encoding.c.

References rb_encoding_entry::base, rb_encoding_entry::enc, ENC_SET_DUMMY, enc_table, and rb_enc_dummy_p().

Referenced by enc_replicate_with_index(), rb_enc_replicate(), and rb_enc_set_base().

static VALUE set_default_external | ( | VALUE | klass,
|  | VALUE | encoding
| ) |  |

static

Definition at line 1320 of file encoding.c.

References rb_enc_set_default_external(), and rb_warning().

Referenced by Init_Encoding().

static VALUE set_default_internal | ( | VALUE | klass,
|  | VALUE | encoding
| ) |  |

static

Definition at line 1403 of file encoding.c.

References rb_enc_set_default_internal(), and rb_warning().

Referenced by Init_Encoding().

static void set_encoding_const | ( | const char * | name,
|  | rb_encoding * | enc
| ) |  |

static

Definition at line 1461 of file encoding.c.

References ALLOCA_N, ENCODING_NAMELEN_MAX, ISALNUM, ISDIGIT, ISLOWER, ISUPPER, len, MEMCPY, name, ONIGENC_ASCII_CODE_TO_UPPER_CASE, rb_cEncoding, rb_define_const(), rb_enc_from_encoding(), and strlen().

Referenced by enc_alias(), enc_replicate_with_index(), rb_enc_register(), rb_enc_replicate(), and rb_encdb_declare().

static rb_encoding* to_encoding | ( | VALUE | enc | ) |

static

Definition at line 163 of file encoding.c.

References rb_eArgError, rb_enc_asciicompat, rb_enc_find_index(), rb_enc_from_index(), rb_enc_get(), rb_raise(), RSTRING_PTR, StringValue, and StringValueCStr.

Referenced by rb_to_encoding().

## Variable Documentation

int count

Definition at line 50 of file encoding.c.

Referenced by enc_table_expand(), EVENTSINK_Invoke(), find_coclass(), find_iid(), gc_count(), nkf_split_options(), ole_const_load(), ole_types_from_typelib(), oleclass_from_typelib(), ossl_x509_get_extensions(), ossl_x509crl_get_extensions(), ossl_x509req_get_attributes(), ossl_x509revoked_get_extensions(), rb_ivar_count(), rb_read_internal(), rb_write_internal(), string_to_r_internal(), syck_move_tokens(), sycklex_bytecode_utf8(), typeinfo_from_ole(), update_coverage(), and waitpid().

struct default_encoding default_external = {0}

static

Definition at line 1215 of file encoding.c.

struct default_encoding default_internal = {-2}

static

Definition at line 1327 of file encoding.c.

struct { ... } enc_table

Referenced by enc_alias_internal(), enc_ascii_compatible_p(), enc_autoload(), enc_dummy_p(), enc_names(), enc_register(), enc_register_at(), enc_set_default_encoding(), enc_table_expand(), Init_Encoding(), load_encoding(), rb_ascii8bit_encoding(), rb_define_dummy_encoding(), rb_enc_alias(), rb_enc_aliases(), rb_enc_from_index(), rb_enc_init(), rb_enc_name_list(), rb_enc_registered(), rb_encdb_dummy(), rb_usascii_encoding(), rb_utf8_encoding(), and set_base_encoding().

const rb_data_type_t encoding_data_type

static

Initial value:
= {
"encoding",
{0, 0, enc_memsize,},
}

Definition at line 73 of file encoding.c.

ID id_encoding

static

Definition at line 38 of file encoding.c.

Referenced by rb_id_encoding().

struct rb_encoding_entry* list

Definition at line 49 of file encoding.c.

Referenced by add_modules(), cbsubst_get_subst_key(), class_instance_method_list(), enc_register_at(), fc_i(), gc_marks(), get_destination_insn(), get_next_insn(), get_prev_insn(), glob_free_pattern(), glob_make_pattern(), Init_Encoding(), iseq_insns_unification(), iseq_optimize(), iseq_peephole_optimize(), iseq_set_sequence(), iseq_set_sequence_stackcaching(), libyaml_version(), list_append_gen(), method_entry_i(), pipe_add_fptr(), pipe_atexit(), pipe_del_fptr(), rb_enc_from_encoding_index(), rb_obj_singleton_methods(), rb_objspace_call_finalizer(), rb_objspace_free(), rb_set_end_proc(), recursive_list_access(), require_libraries(), resize_property_list(), ruby_glob0(), select_internal(), verify_list(), and yyparse().

st_table* names

Definition at line 52 of file encoding.c.

Referenced by make_hostent_internal(), match_inspect(), and sock_s_gethostbyaddr().

rb_encoding OnigEncodingUS_ASCII

rb_encoding OnigEncodingUTF_8

VALUE rb_cEncoding

Definition at line 39 of file encoding.c.

Referenced by enc_new(), Init_Encoding(), Init_Exception(), Init_transcode(), rb_locale_encindex(), and set_encoding_const().

VALUE rb_encoding_list

static

Definition at line 40 of file encoding.c.

Referenced by enc_list(), enc_register_at(), Init_Encoding(), and rb_enc_from_encoding_index().

int size

Definition at line 51 of file encoding.c.

Referenced by add_code_range_to_buf0(), allocate_sorted_heaps(), ary2list(), ary2list2(), bdigbitsize(), BSD_vfprintf(), buf_bytesize(), closure_memsize(), cont_memsize(), cont_save_machine_stack(), date_strftime_alloc(), dlcfunc_memsize(), each_cons_i(), each_slice_i(), enum_each_cons(), enum_each_slice(), env_memsize(), fiber_memsize(), find_prev_line_no(), finish_overlapped_socket(), fmt_setup(), function_memsize(), get_insn_info(), iseq_memsize(), iseq_set_local_table(), make_readconv(), memsize_of(), mmrot3_(), mmswap_(), ole_mb2wc(), ole_vstr2wc(), ole_wc2mb(), onig_memsize(), onig_set_match_stack_limit_size(), ossl_dh_s_generate(), ossl_rsa_s_generate(), overlapped_socket_io(), parser_memsize(), rb_ary_initialize(), rb_dlptr_initialize(), rb_dlptr_minus(), rb_dlptr_new2(), rb_dlptr_plus(), rb_dlptr_s_malloc(), rb_dlptr_size_get(), rb_dlptr_size_set(), rb_econv_memsize(), rb_io_memsize(), rb_iseq_disasm(), rb_stat_s(), rb_str_justify(), rb_strftime_alloc(), rb_struct_new(), rb_transcoding_memsize(), rb_w32_read(), rb_w32_write(), rb_zstream_set_avail_out(), recvmsg(), reg_get_val(), resize_property_list(), ruby_qsort(), sendmsg(), st_init_table_with_size(), tcltklib_compile_info(), thread_memsize(), tk_conv_args(), vm_malloc_fixup(), vm_malloc_prepare(), vm_xcalloc(), vm_xfree(), vm_xrealloc(), and wstati64().