Ruby  2.1.10p492(2016-04-01revision54464)
Data Structures | Macros | Functions | Variables
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 is_obj_encoding(obj)   (RB_TYPE_P((obj), T_DATA) && is_data_encoding(obj))
 
#define ENC_REGISTER(enc)   enc_register_at(ENCINDEX_##enc, rb_enc_name(&OnigEncoding##enc), &OnigEncoding##enc)
 
#define ENCDB_REGISTER(name, enc)   enc_register_at(ENCINDEX_##enc, name, NULL)
 
#define rb_intern(str)   rb_intern_const(str)
 
#define ctype_test(c, ctype)   (rb_isascii(c) && ONIGENC_IS_ASCII_CODE_CTYPE((c), (ctype)))
 

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)
 
 NORETURN (static void not_encoding(VALUE enc))
 
static void not_encoding (VALUE enc)
 
static rb_encodingmust_encoding (VALUE enc)
 
static rb_encodingmust_encindex (int index)
 
int rb_to_encoding_index (VALUE enc)
 
static int str_find_encindex (VALUE enc)
 
static int str_to_encindex (VALUE enc)
 
static rb_encodingstr_to_encoding (VALUE enc)
 
rb_encodingrb_to_encoding (VALUE enc)
 
rb_encodingrb_find_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_encodingset_base_encoding (int index, rb_encoding *base)
 
void rb_enc_set_base (const char *name, const char *orig)
 
int rb_enc_set_dummy (int index)
 
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 st_data_t enc_dup_name (st_data_t name)
 
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)
 
void rb_encdb_set_unicode (int index)
 
rb_encodingrb_enc_from_index (int index)
 
rb_encodingrb_enc_get_from_index (int index)
 
static VALUE require_enc (VALUE enclib)
 
int rb_enc_find_index (const char *name)
 
rb_encodingrb_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_encodingrb_enc_get (VALUE obj)
 
rb_encodingrb_enc_check (VALUE str1, VALUE str2)
 
rb_encodingrb_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_code_to_mbclen (int code, 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_s_alloc (VALUE klass)
 
static VALUE enc_dump (int argc, VALUE *argv, VALUE self)
 
static VALUE enc_load (VALUE klass, VALUE str)
 
static VALUE enc_m_loader (VALUE klass, VALUE str)
 
rb_encodingrb_ascii8bit_encoding (void)
 
int rb_ascii8bit_encindex (void)
 
rb_encodingrb_utf8_encoding (void)
 
int rb_utf8_encindex (void)
 
rb_encodingrb_usascii_encoding (void)
 
int rb_usascii_encindex (void)
 
int rb_locale_encindex (void)
 
rb_encodingrb_locale_encoding (void)
 
int rb_filesystem_encindex (void)
 
rb_encodingrb_filesystem_encoding (void)
 
int Init_enc_set_filesystem_encoding (void)
 
static int enc_set_default_encoding (struct default_encoding *def, VALUE encoding, const char *name)
 
rb_encodingrb_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_encodingrb_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)
 
void rb_enc_foreach_name (int(*func)(st_data_t name, st_data_t idx, st_data_t arg), st_data_t arg)
 

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)))
#define enc_autoload_p (   enc)    (!rb_enc_mbmaxlen(enc))
#define ENC_REGISTER (   enc)    enc_register_at(ENCINDEX_##enc, rb_enc_name(&OnigEncoding##enc), &OnigEncoding##enc)

Referenced by rb_enc_init().

#define ENCDB_REGISTER (   name,
  enc 
)    enc_register_at(ENCINDEX_##enc, name, NULL)

Referenced by rb_enc_init().

#define ENCODING_COUNT   ENCINDEX_BUILTIN_MAX

Definition at line 55 of file encoding.c.

Referenced by rb_enc_init().

#define ENCODING_NAMELEN_MAX   63

Definition at line 58 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 77 of file encoding.c.

Referenced by enc_capable(), enc_inspect(), and rb_enc_get_index().

#define is_obj_encoding (   obj)    (RB_TYPE_P((obj), T_DATA) && is_data_encoding(obj))

Definition at line 78 of file encoding.c.

Referenced by enc_check_encoding(), and enc_find().

#define rb_intern (   str)    rb_intern_const(str)
#define UNSPECIFIED_ENCODING   INT_MAX

Definition at line 56 of file encoding.c.

Referenced by enc_find(), enc_set_default_encoding(), and rb_enc_find_index().

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

Definition at line 59 of file encoding.c.

Referenced by enc_alias(), and enc_register_at().

Function Documentation

static int check_encoding ( rb_encoding enc)
static

Definition at line 113 of file encoding.c.

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

Referenced by enc_check_encoding().

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

Definition at line 512 of file encoding.c.

References enc_dup_name(), enc_table, st_data_t, and st_insert2().

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

static VALUE enc_ascii_compatible_p ( VALUE  enc)
static

Definition at line 487 of file encoding.c.

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

Referenced by Init_Encoding().

static int enc_autoload ( rb_encoding enc)
static
static int enc_capable ( VALUE  obj)
inlinestatic

Definition at line 716 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 338 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
static VALUE enc_compatible_p ( VALUE  klass,
VALUE  str1,
VALUE  str2 
)
static

Definition at line 1200 of file encoding.c.

References 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 471 of file encoding.c.

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

Referenced by Init_Encoding().

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

Definition at line 1221 of file encoding.c.

References enc_name, and rb_scan_args().

Referenced by Init_Encoding().

static st_data_t enc_dup_name ( st_data_t  name)
static

Definition at line 502 of file encoding.c.

References st_data_t, and strdup.

Referenced by enc_alias_internal().

static VALUE enc_find ( VALUE  klass,
VALUE  enc 
)
static
static VALUE enc_inspect ( VALUE  self)
static
static VALUE enc_list ( VALUE  klass)
static

Definition at line 1135 of file encoding.c.

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

static VALUE enc_load ( VALUE  klass,
VALUE  str 
)
static

Definition at line 1229 of file encoding.c.

References str.

Referenced by Init_Encoding().

static VALUE enc_m_loader ( VALUE  klass,
VALUE  str 
)
static

Definition at line 1236 of file encoding.c.

References enc_find().

Referenced by Init_Encoding().

static size_t enc_memsize ( const void p)
static

Definition at line 66 of file encoding.c.

static VALUE enc_name ( VALUE  self)
static

Definition at line 1079 of file encoding.c.

References DATA_PTR(), rb_enc_name, and rb_usascii_str_new2.

static VALUE enc_names ( VALUE  self)
static

Definition at line 1106 of file encoding.c.

References args, enc_names_i(), enc_table, rb_ary_new2, rb_to_encoding_index(), st_data_t, 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 1085 of file encoding.c.

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

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
static int enc_register_at ( int  index,
const char *  name,
rb_encoding encoding 
)
static
static VALUE enc_replicate ( VALUE  encoding,
VALUE  name 
)
static

Definition at line 401 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
static VALUE enc_s_alloc ( VALUE  klass)
static

Definition at line 1213 of file encoding.c.

References Qnil, and rb_undefined_alloc().

Referenced by Init_Encoding().

static int enc_set_default_encoding ( struct default_encoding def,
VALUE  encoding,
const char *  name 
)
static
static void enc_set_index ( VALUE  obj,
int  idx 
)
static
static int enc_table_expand ( int  newsize)
static

Definition at line 241 of file encoding.c.

References count, enc_table, memset(), and realloc().

Referenced by enc_register(), and rb_enc_init().

static VALUE get_default_external ( VALUE  klass)
static

Definition at line 1412 of file encoding.c.

References rb_enc_default_external().

Referenced by Init_Encoding().

static VALUE get_default_internal ( VALUE  klass)
static

Definition at line 1497 of file encoding.c.

References rb_enc_default_internal().

Referenced by Init_Encoding().

int Init_enc_set_filesystem_encoding ( void  )
void Init_Encoding ( void  )
static int load_encoding ( const char *  name)
static
static rb_encoding* must_encindex ( int  index)
static
static rb_encoding* must_encoding ( VALUE  enc)
static

Definition at line 142 of file encoding.c.

References DATA_PTR(), enc_check_encoding(), index, and not_encoding().

Referenced by enc_ascii_compatible_p(), and enc_dummy_p().

NORETURN ( static void   not_encodingVALUE enc)
static void not_encoding ( VALUE  enc)
static

Definition at line 135 of file encoding.c.

References PRIsVALUE, rb_eTypeError, rb_obj_class(), and rb_raise().

Referenced by enc_inspect(), and must_encoding().

int rb_ascii8bit_encindex ( void  )

Definition at line 1251 of file encoding.c.

References ENCINDEX_ASCII.

rb_encoding* rb_ascii8bit_encoding ( void  )
rb_encoding* rb_default_external_encoding ( void  )
rb_encoding* rb_default_internal_encoding ( void  )
int rb_define_dummy_encoding ( const char *  name)
int rb_enc_alias ( const char *  alias,
const char *  orig 
)
static VALUE rb_enc_aliases ( VALUE  klass)
static

Definition at line 1679 of file encoding.c.

References enc_table, rb_ary_new(), rb_enc_aliases_enc_i(), rb_hash_new(), st_data_t, 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
int rb_enc_ascget ( const char *  p,
const char *  e,
int len,
rb_encoding enc 
)
VALUE rb_enc_associate ( VALUE  obj,
rb_encoding enc 
)
VALUE rb_enc_associate_index ( VALUE  obj,
int  idx 
)
rb_encoding* rb_enc_check ( VALUE  str1,
VALUE  str2 
)
int rb_enc_code_to_mbclen ( int  code,
rb_encoding enc 
)

Definition at line 1025 of file encoding.c.

References ONIGENC_CODE_TO_MBCLEN.

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

Definition at line 1008 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 
)
rb_encoding* rb_enc_compatible ( VALUE  str1,
VALUE  str2 
)
void rb_enc_copy ( VALUE  obj1,
VALUE  obj2 
)
VALUE rb_enc_default_external ( void  )

Definition at line 1380 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 1460 of file encoding.c.

References rb_default_internal_encoding(), and rb_enc_from_encoding().

Referenced by get_default_internal(), if(), and str_transcode0().

int rb_enc_fast_mbclen ( const char *  p,
const char *  e,
rb_encoding enc 
)
rb_encoding* rb_enc_find ( const char *  name)
int rb_enc_find_index ( const char *  name)
void rb_enc_foreach_name ( int(*)(st_data_t name, st_data_t idx, st_data_t arg func,
st_data_t  arg 
)

Definition at line 1964 of file encoding.c.

References enc_table, func, and st_foreach().

Referenced by Init_w32_codepage().

VALUE rb_enc_from_encoding ( rb_encoding encoding)
static VALUE rb_enc_from_encoding_index ( int  idx)
static
rb_encoding* rb_enc_from_index ( int  index)
rb_encoding* rb_enc_get ( VALUE  obj)

Definition at line 832 of file encoding.c.

References rb_enc_from_index(), and rb_enc_get_index().

Referenced by check_dirname(), check_path_encoding(), check_pipe_command(), do_writeconv(), econv_set_replacement(), file_s_fnmatch(), fnmatch_brace(), intern_str(), io_encoding_set(), literal_concat0(), must_be_ascii_compatible(), must_not_be_anonymous(), ole_vstr2wc(), parser_prepare(), parser_yyerror(), path_check_0(), path_sub_ext(), prepare_getline_args(), push_glob(), rb_econv_open_opts(), rb_econv_prepare_options(), rb_enc_check(), rb_file_dirname(), rb_file_expand_path_internal(), rb_file_join(), rb_file_s_basename(), rb_file_s_extname(), rb_gzreader_ungetc(), rb_gzwriter_write(), rb_inspect(), rb_mod_const_defined(), rb_mod_const_get(), rb_must_asciicompat(), 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_conv_enc_opts(), rb_str_dump(), rb_str_ellipsize(), rb_str_encode_ospath(), rb_str_enumerate_chars(), rb_str_enumerate_lines(), rb_str_fill_terminator(), rb_str_format(), rb_str_symname_type(), rb_string_value_cstr(), rb_to_encoding_index(), realpath_rec(), reg_enc_error(), reg_fragment_setenc_gen(), reg_named_capture_assign_gen(), ruby__sfvextra(), str_find_encindex(), strio_each_codepoint(), strio_external_encoding(), strio_getc(), strio_getline(), strio_substr(), strio_ungetc(), strio_write(), strscan_getch(), sym_check_asciionly(), syserr_initialize(), time_strftime(), transcode_loop(), and update_char_offset().

rb_encoding* rb_enc_get_from_index ( int  index)

Definition at line 602 of file encoding.c.

References must_encindex().

Referenced by get_actual_encoding().

int rb_enc_get_index ( VALUE  obj)
void rb_enc_init ( void  )
int rb_enc_mbclen ( const char *  p,
const char *  e,
rb_encoding enc 
)
static VALUE rb_enc_name_list ( VALUE  klass)
static

Definition at line 1634 of file encoding.c.

References ary, enc_table, rb_ary_new2, rb_enc_name_list_i(), st_data_t, 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 1610 of file encoding.c.

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

Referenced by rb_enc_name_list().

int rb_enc_precise_mbclen ( const char *  p,
const char *  e,
rb_encoding enc 
)
int rb_enc_register ( const char *  name,
rb_encoding encoding 
)
int rb_enc_registered ( const char *  name)
int rb_enc_replicate ( const char *  name,
rb_encoding encoding 
)
void rb_enc_set_base ( const char *  name,
const char *  orig 
)

Definition at line 360 of file encoding.c.

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

void rb_enc_set_default_external ( VALUE  encoding)

Definition at line 1418 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 1503 of file encoding.c.

References enc_set_default_encoding().

Referenced by process_options(), and set_default_internal().

int rb_enc_set_dummy ( int  index)

Definition at line 371 of file encoding.c.

References enc, ENC_SET_DUMMY, enc_table, and index.

void rb_enc_set_index ( VALUE  obj,
int  idx 
)

Definition at line 790 of file encoding.c.

References enc_set_index(), must_encindex(), and rb_check_frozen.

Referenced by pack_pack(), and str_enc_copy().

int rb_enc_tolower ( int  c,
rb_encoding enc 
)
int rb_enc_toupper ( int  c,
rb_encoding enc 
)
int rb_enc_unicode_p ( rb_encoding enc)

Definition at line 496 of file encoding.c.

References ONIGENC_IS_UNICODE.

Referenced by rb_reg_expr_str(), and rb_str_inspect().

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

Definition at line 543 of file encoding.c.

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

void rb_encdb_declare ( const char *  name)
int rb_encdb_dummy ( const char *  name)
int rb_encdb_replicate ( const char *  name,
const char *  orig 
)
void rb_encdb_set_unicode ( int  index)

Definition at line 554 of file encoding.c.

References OnigEncodingTypeST::flags, ONIGENC_FLAG_UNICODE, and rb_enc_from_index().

int rb_filesystem_encindex ( void  )

Definition at line 1315 of file encoding.c.

References ENCINDEX_ASCII, idx, and rb_enc_registered().

Referenced by rb_filesystem_encoding().

rb_encoding* rb_filesystem_encoding ( void  )
rb_encoding* rb_find_encoding ( VALUE  enc)

Definition at line 226 of file encoding.c.

References enc_check_encoding(), idx, NULL, rb_enc_from_index(), RDATA, and str_find_encindex().

Referenced by find_encoding().

void rb_gc_mark_encodings ( void  )

Definition at line 236 of file encoding.c.

Referenced by gc_mark_roots().

ID rb_id_encoding ( void  )

Definition at line 732 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 1938 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_ALNUM.

int rb_isalpha ( int  c)

Definition at line 1939 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_ALPHA.

int rb_isblank ( int  c)

Definition at line 1940 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_BLANK.

int rb_iscntrl ( int  c)

Definition at line 1941 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_CNTRL.

int rb_isdigit ( int  c)

Definition at line 1942 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_DIGIT.

Referenced by f_format().

int rb_isgraph ( int  c)

Definition at line 1943 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_GRAPH.

int rb_islower ( int  c)

Definition at line 1944 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_LOWER.

int rb_isprint ( int  c)

Definition at line 1945 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_PRINT.

int rb_ispunct ( int  c)

Definition at line 1946 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_PUNCT.

Referenced by rb_id2str().

int rb_isspace ( int  c)

Definition at line 1947 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 1948 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_UPPER.

int rb_isxdigit ( int  c)

Definition at line 1949 of file encoding.c.

References ctype_test, and ONIGENC_CTYPE_XDIGIT.

VALUE rb_locale_charmap ( VALUE  klass)

Definition at line 23 of file localeinit.c.

Referenced by Init_Encoding(), and rb_locale_encindex().

int rb_locale_encindex ( void  )
rb_encoding* rb_locale_encoding ( void  )
VALUE rb_obj_encoding ( VALUE  obj)
rb_encoding* rb_to_encoding ( VALUE  enc)
int rb_to_encoding_index ( VALUE  enc)
int rb_tolower ( int  c)

Definition at line 1952 of file encoding.c.

References c, ONIGENC_ASCII_CODE_TO_LOWER_CASE, and rb_isascii.

Referenced by readline_attempted_completion_function().

int rb_toupper ( int  c)

Definition at line 1958 of file encoding.c.

References c, ONIGENC_ASCII_CODE_TO_UPPER_CASE, and rb_isascii.

int rb_usascii_encindex ( void  )

Definition at line 1281 of file encoding.c.

References ENCINDEX_US_ASCII.

rb_encoding* rb_usascii_encoding ( void  )
int rb_utf8_encindex ( void  )

Definition at line 1266 of file encoding.c.

References ENCINDEX_UTF_8.

rb_encoding* rb_utf8_encoding ( void  )
static VALUE require_enc ( VALUE  enclib)
static

Definition at line 621 of file encoding.c.

References rb_require_safe(), rb_safe_level, and safe.

Referenced by load_encoding().

static rb_encoding* set_base_encoding ( int  index,
rb_encoding base 
)
static
static VALUE set_default_external ( VALUE  klass,
VALUE  encoding 
)
static

Definition at line 1441 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 1523 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
static int str_find_encindex ( VALUE  enc)
static
static int str_to_encindex ( VALUE  enc)
static

Definition at line 203 of file encoding.c.

References idx, PRIsVALUE, rb_eArgError, rb_raise(), and str_find_encindex().

Referenced by enc_find(), and str_to_encoding().

static rb_encoding* str_to_encoding ( VALUE  enc)
static

Definition at line 213 of file encoding.c.

References rb_enc_from_index(), and str_to_encindex().

Referenced by rb_to_encoding().

Variable Documentation

int count
struct default_encoding default_external = {0}
static

Definition at line 1334 of file encoding.c.

struct default_encoding default_internal = {-2}
static

Definition at line 1448 of file encoding.c.

struct { ... } enc_table
const rb_data_type_t encoding_data_type
static
Initial value:
= {
"encoding",
{0, 0, enc_memsize,},
}
#define RUBY_TYPED_FREE_IMMEDIATELY
static size_t enc_memsize(const void *p)
Definition: encoding.c:66
#define NULL
Definition: _sdbm.c:102

Definition at line 71 of file encoding.c.

ID id_encoding
static

Definition at line 36 of file encoding.c.

Referenced by rb_id_encoding().

struct rb_encoding_entry* list
st_table* names

Definition at line 50 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
VALUE rb_encoding_list
static

Definition at line 38 of file encoding.c.

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

long size = memo->u3.cnt

Definition at line 49 of file encoding.c.

Referenced by add_code_range_to_buf0(), argf_memsize(), backtrace_each(), backtrace_to_location_ary(), backtrace_to_str_ary(), BSD_vfprintf(), check_machine_stack_size(), closure_memsize(), cont_capture(), cont_memsize(), cont_save_machine_stack(), date_strftime_alloc(), dh_generate(), dlcfunc_memsize(), dln_find_exe_r(), dln_find_file_r(), dsa_generate(), enum_each_cons_size(), enum_each_slice_size(), enumerator_init(), enumerator_initialize(), enumerator_size(), env_memsize(), fiber_memsize(), finish_overlapped(), finish_overlapped_socket(), fmt_setup(), function_memsize(), get_keys(), get_line_info(), get_user_from_path(), get_values(), getifaddrs(), heap_pages_expand_sorted(), io_fread(), iseq_memsize(), iseq_set_local_table(), lazy_initialize(), make_readconv(), mmrot3_(), mmswap_(), obj_memsize_of(), objspace_malloc_fixup(), objspace_malloc_prepare(), objspace_xcalloc(), ole_mb2wc(), ole_vstr2wc(), ole_wc2mb_alloc(), onig_memsize(), onig_region_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_fiddle_ptr_initialize(), rb_fiddle_ptr_minus(), rb_fiddle_ptr_new2(), rb_fiddle_ptr_plus(), rb_fiddle_ptr_s_malloc(), rb_fiddle_ptr_size_get(), rb_fiddle_ptr_size_set(), rb_file_expand_path_internal(), rb_hash_hash(), rb_hash_keys(), rb_hash_values(), rb_io_memsize(), rb_iseq_disasm(), 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(), remove_invalid_alternative_data(), replace_to_long_name(), resize_property_list(), rsa_generate(), ruby_qsort(), sendmsg(), st_init_table_with_size(), strscan_memsize(), tcltklib_compile_info(), thread_memsize(), unset_addr_list_add(), unset_addr_list_init(), vm_memsize(), wmap_aset_update(), wmap_final_func(), wmap_finalize(), wmap_memsize(), wstati64(), yaml_emitter_set_output_string(), yaml_parser_set_input_string(), yaml_parser_update_buffer(), yaml_string_read_handler(), and yaml_string_write_handler().