Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Functions | Variables
encoding.c File Reference
`#include "ruby/encoding.h"`
`#include "internal.h"`
`#include "encindex.h"`
`#include "regenc.h"`
`#include <ctype.h>`
`#include "ruby/util.h"`
`#include "ruby_assert.h"`

Go to the source code of this file.

## Data Structures
struct | rb_encoding_entry
struct | default_encoding

## Macros
#define | ENC_DEBUG 0
#define | ENC_ASSERT(expr) RUBY_ASSERT_WHEN(ENC_DEBUG, expr)
#define | MUST_STRING(str) (ENC_ASSERT(RB_TYPE_P(str, T_STRING)), str)
#define | ENC_DUMMY_FLAG (1<<24)
#define | ENC_INDEX_MASK (~(~0U<<24))
#define | ENC_TO_ENCINDEX(enc) (int)((enc)->ruby_encoding_index & ENC_INDEX_MASK)
#define | ENC_DUMMY_P(enc) ((enc)->ruby_encoding_index & ENC_DUMMY_FLAG)
#define | ENC_SET_DUMMY(enc) ((enc)->ruby_encoding_index |= ENC_DUMMY_FLAG)
#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)

## Typedefs
typedef OnigEncodingType | rb_raw_encoding

## Functions
int | rb_data_is_encoding (VALUE obj)
VALUE | rb_enc_from_encoding (rb_encoding *encoding)
int | rb_enc_to_index (rb_encoding *enc)
int | rb_enc_dummy_p (rb_encoding *enc)
| NORETURN (static void not_encoding(VALUE enc))
int | rb_to_encoding_index (VALUE enc)
rb_encoding * | rb_to_encoding (VALUE enc)
rb_encoding * | rb_find_encoding (VALUE enc)
int | rb_enc_registered (const char *name)
int | rb_enc_register (const char *name, rb_encoding *encoding)
void | rb_encdb_declare (const char *name)
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)
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)
int | rb_enc_unicode_p (rb_encoding *enc)
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)
void | rb_enc_init (void)
rb_encoding * | rb_enc_from_index (int index)
rb_encoding * | rb_enc_get_from_index (int index)
int | rb_enc_find_index (const char *name)
int | rb_enc_find_index2 (const char *name, long len)
rb_encoding * | rb_enc_find (const char *name)
int | rb_enc_capable (VALUE obj)
ID | rb_id_encoding (void)
int | rb_enc_get_index (VALUE obj)
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_str (VALUE str1, VALUE str2)
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_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)
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_charmap_index (void)
int | rb_locale_encindex (void)
rb_encoding * | rb_locale_encoding (void)
int | rb_filesystem_encindex (void)
rb_encoding * | rb_filesystem_encoding (void)
rb_encoding * | rb_default_external_encoding (void)
VALUE | rb_enc_default_external (void)
void | rb_enc_set_default_external (VALUE encoding)
rb_encoding * | rb_default_internal_encoding (void)
VALUE | rb_enc_default_internal (void)
void | rb_enc_set_default_internal (VALUE encoding)
void | Init_Encoding (void)
void | Init_encodings (void)
void | rb_enc_foreach_name (int(*func)(st_data_t name, st_data_t idx, st_data_t arg), st_data_t arg)

## Variables
VALUE | rb_cEncoding

## Macro Definition Documentation

## ◆ ENC_ASSERT

#define ENC_ASSERT | ( |  | expr | ) | RUBY_ASSERT_WHEN(ENC_DEBUG, expr)

Definition at line 23 of file encoding.c.

## ◆ enc_autoload_p

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

Definition at line 75 of file encoding.c.

## ◆ ENC_DEBUG

#define ENC_DEBUG 0

Definition at line 21 of file encoding.c.

## ◆ ENC_DUMMY_FLAG

#define ENC_DUMMY_FLAG (1<<24)

Definition at line 62 of file encoding.c.

## ◆ ENC_DUMMY_P

#define ENC_DUMMY_P | ( |  | enc | ) | ((enc)->ruby_encoding_index & ENC_DUMMY_FLAG)

Definition at line 66 of file encoding.c.

## ◆ ENC_INDEX_MASK

#define ENC_INDEX_MASK (~(~0U<<24))

Definition at line 63 of file encoding.c.

## ◆ ENC_REGISTER

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

## ◆ ENC_SET_DUMMY

#define ENC_SET_DUMMY | ( |  | enc | ) | ((enc)->ruby_encoding_index |= ENC_DUMMY_FLAG)

Definition at line 67 of file encoding.c.

## ◆ ENC_TO_ENCINDEX

#define ENC_TO_ENCINDEX | ( |  | enc | ) | (int)((enc)->ruby_encoding_index & ENC_INDEX_MASK)

Definition at line 65 of file encoding.c.

## ◆ ENCDB_REGISTER

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

## ◆ ENCODING_COUNT

#define ENCODING_COUNT ENCINDEX_BUILTIN_MAX

Definition at line 69 of file encoding.c.

## ◆ ENCODING_NAMELEN_MAX

#define ENCODING_NAMELEN_MAX 63

Definition at line 72 of file encoding.c.

## ◆ is_data_encoding

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

Definition at line 85 of file encoding.c.

## ◆ is_obj_encoding

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

Definition at line 86 of file encoding.c.

## ◆ MUST_STRING

#define MUST_STRING | ( |  | str | ) | (ENC_ASSERT(RB_TYPE_P(str, T_STRING)), str)

Definition at line 24 of file encoding.c.

## ◆ rb_intern

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

## ◆ UNSPECIFIED_ENCODING

#define UNSPECIFIED_ENCODING INT_MAX

Definition at line 70 of file encoding.c.

## ◆ valid_encoding_name_p

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

Definition at line 73 of file encoding.c.

## Typedef Documentation

## ◆ rb_raw_encoding

typedef OnigEncodingType rb_raw_encoding

Definition at line 30 of file encoding.c.

## Function Documentation

## ◆ Init_Encoding()

void Init_Encoding | ( | void |  | ) |

Definition at line 1919 of file encoding.c.

References i, list, rb_cEncoding, rb_cObject, rb_define_alloc_func(), and rb_define_class().

## ◆ Init_encodings()

void Init_encodings | ( | void |  | ) |

Definition at line 1964 of file encoding.c.

References rb_enc_init().

## ◆ NORETURN()

NORETURN | ( | static void | not_encodingVALUE enc | ) |

## ◆ rb_ascii8bit_encindex()

int rb_ascii8bit_encindex | ( | void |  | ) |

Definition at line 1322 of file encoding.c.

References ENCINDEX_ASCII.

Referenced by rb_char_to_option_kcode(), rb_external_str_new_with_enc(), rb_external_str_with_enc(), and rb_str_coderange_scan_restartable().

## ◆ rb_ascii8bit_encoding()

rb_encoding* rb_ascii8bit_encoding | ( | void |  | ) |

Definition at line 1316 of file encoding.c.

Referenced by rb_define_dummy_encoding(), rb_glob(), rb_str_conv_enc_opts(), rb_symname_p(), ruby_brace_glob(), and ruby_init_loadpath().

## ◆ rb_data_is_encoding()

int rb_data_is_encoding | ( | VALUE | obj | ) |

Definition at line 89 of file encoding.c.

References is_data_encoding, and obj.

## ◆ rb_default_external_encoding()

rb_encoding* rb_default_external_encoding | ( | void |  | ) |

Definition at line 1427 of file encoding.c.

Referenced by Init_enc_set_filesystem_encoding(), rb_enc_default_external(), rb_external_str_new(), rb_external_str_new_cstr(), rb_inspect(), rb_str_export(), rb_str_quote_unprintable(), and rb_str_symname_p().

## ◆ rb_default_internal_encoding()

rb_encoding* rb_default_internal_encoding | ( | void |  | ) |

Definition at line 1512 of file encoding.c.

Referenced by rb_enc_default_internal(), rb_external_str_with_enc(), rb_inspect(), rb_str_quote_unprintable(), rb_str_symname_p(), and rsock_raise_socket_error().

## ◆ rb_define_dummy_encoding()

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

Definition at line 462 of file encoding.c.

References rb_encoding_entry::enc, index, name, rb_ascii8bit_encoding(), rb_enc_replicate(), and rb_encoding.

## ◆ rb_enc_alias()

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

Definition at line 553 of file encoding.c.

## ◆ rb_enc_ascget()

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

Definition at line 1044 of file encoding.c.

References char, rb_encoding_entry::enc, ISASCII, len, MBCLEN_CHARFOUND_P, rb_enc_asciicompat, rb_enc_isascii, rb_enc_mbc_to_codepoint, and rb_enc_precise_mbclen().

Referenced by rb_reg_quote(), and rb_str_end_with_asciichar().

## ◆ rb_enc_associate()

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

Definition at line 866 of file encoding.c.

References rb_encoding_entry::enc, obj, rb_enc_associate_index(), and rb_enc_to_index().

Referenced by rb_econv_append(), rb_reg_quote(), rb_str_conv_enc_opts(), rb_str_ellipsize(), and rb_str_initialize().

## ◆ rb_enc_associate_index()

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

Definition at line 838 of file encoding.c.

References rb_encoding_entry::enc, obj, rb_check_frozen, rb_eArgError, rb_enc_get_index(), rb_encoding, rb_raise(), and SPECIAL_CONST_P.

Referenced by rb_dir_getwd(), rb_enc_associate(), rb_enc_copy(), rb_external_str_with_enc(), rb_str_concat(), and rb_utf8_str_new_cstr().

## ◆ rb_enc_capable()

int rb_enc_capable | ( | VALUE | obj | ) |

Definition at line 753 of file encoding.c.

## ◆ rb_enc_check()

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

Definition at line 891 of file encoding.c.

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

## ◆ rb_enc_check_str()

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

Definition at line 880 of file encoding.c.

References rb_encoding_entry::enc, and rb_encoding.

Referenced by rb_str_plus().

## ◆ rb_enc_code_to_mbclen()

int rb_enc_code_to_mbclen | ( | int | code,
|  | rb_encoding * | enc
| ) |  |

Definition at line 1100 of file encoding.c.

References rb_encoding_entry::enc, and ONIGENC_CODE_TO_MBCLEN.

## ◆ rb_enc_codelen()

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

Definition at line 1089 of file encoding.c.

References rb_encoding_entry::enc, n, ONIGENC_CODE_TO_MBCLEN, rb_eArgError, rb_enc_name, and rb_raise().

Referenced by rb_enc_uint_chr(), rb_str_buf_cat_ascii(), and rb_str_concat().

## ◆ rb_enc_codepoint()

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

Definition at line 1083 of file encoding.c.

References rb_encoding_entry::enc, and rb_enc_codepoint_len().

## ◆ 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 1068 of file encoding.c.

References rb_encoding_entry::enc, 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_enc_compatible()

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

Definition at line 974 of file encoding.c.

References rb_enc_from_index(), and rb_enc_get_index().

Referenced by rb_enc_check().

## ◆ rb_enc_copy()

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

Definition at line 990 of file encoding.c.

References obj2, rb_enc_associate_index(), and rb_enc_get_index().

Referenced by rb_reg_quote(), and rb_str_concat_literals().

## ◆ rb_enc_default_external()

VALUE rb_enc_default_external | ( | void |  | ) |

Definition at line 1441 of file encoding.c.

References rb_default_external_encoding(), and rb_enc_from_encoding().

## ◆ rb_enc_default_internal()

VALUE rb_enc_default_internal | ( | void |  | ) |

Definition at line 1521 of file encoding.c.

References rb_default_internal_encoding(), and rb_enc_from_encoding().

## ◆ rb_enc_dummy_p()

int rb_enc_dummy_p | ( | rb_encoding * | enc | ) |

Definition at line 131 of file encoding.c.

References rb_encoding_entry::enc, and ENC_DUMMY_P.

Referenced by rb_enc_str_coderange().

## ◆ rb_enc_fast_mbclen()

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

Definition at line 1014 of file encoding.c.

References rb_encoding_entry::enc, ONIGENC_MBC_ENC_LEN, and UChar.

## ◆ rb_enc_find()

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

Definition at line 728 of file encoding.c.

References name, rb_enc_find_index(), and rb_enc_from_index().

## ◆ rb_enc_find_index()

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

Definition at line 693 of file encoding.c.

References rb_encoding_entry::enc, i, name, rb_enc_registered(), and rb_encoding.

Referenced by Init_enc_set_filesystem_encoding(), rb_enc_find(), rb_enc_find_index2(), and rb_nkf_enc_get().

## ◆ rb_enc_find_index2()

int rb_enc_find_index2 | ( | const char * | name,
|  | long | len
| ) |  |

Definition at line 717 of file encoding.c.

References buf, ENCODING_NAMELEN_MAX, len, memcpy(), name, and rb_enc_find_index().

## ◆ rb_enc_foreach_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 1972 of file encoding.c.

References st_foreach().

## ◆ rb_enc_from_encoding()

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

Definition at line 116 of file encoding.c.

References ENC_TO_ENCINDEX, and Qnil.

Referenced by rb_enc_default_external(), rb_enc_default_internal(), and rb_str_ellipsize().

## ◆ rb_enc_from_index()

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

Definition at line 609 of file encoding.c.

References index, and UNLIKELY.

Referenced by rb_enc_compatible(), rb_enc_find(), rb_enc_get(), rb_enc_register(), rb_enc_str_coderange(), rb_encdb_set_unicode(), rb_filesystem_encoding(), rb_locale_encoding(), rb_str_buf_cat_ascii(), rb_str_comparable(), rb_str_dump(), rb_str_encode_ospath(), rb_str_end_with_asciichar(), rb_str_escape(), rb_str_inspect(), and rb_w32_conv_from_wchar().

## ◆ rb_enc_get()

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

Definition at line 872 of file encoding.c.

References obj, rb_enc_from_index(), and rb_enc_get_index().

Referenced by rb_enc_check(), rb_file_dirname(), rb_inspect(), rb_must_asciicompat(), rb_path_to_class(), rb_readlink(), rb_reg_check_preprocess(), rb_reg_quote(), rb_reg_regsub(), rb_str_conv_enc_opts(), and rb_str_ellipsize().

## ◆ rb_enc_get_from_index()

rb_encoding* rb_enc_get_from_index | ( | int | index | ) |

Definition at line 618 of file encoding.c.

## ◆ rb_enc_get_index()

int rb_enc_get_index | ( | VALUE | obj | ) |

Definition at line 779 of file encoding.c.

References i, obj, SPECIAL_CONST_P, and SYMBOL_P.

Referenced by rb_enc_associate_index(), rb_enc_compatible(), rb_enc_copy(), rb_enc_get(), rb_obj_encoding(), rb_str_dump(), and rb_str_opt_plus().

## ◆ rb_enc_init()

void rb_enc_init | ( | void |  | ) |

Definition at line 582 of file encoding.c.

Referenced by Init_encodings().

## ◆ rb_enc_mbclen()

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

Definition at line 1020 of file encoding.c.

References rb_encoding_entry::enc, int, MBCLEN_CHARFOUND_LEN, MBCLEN_CHARFOUND_P, n, ONIGENC_PRECISE_MBC_ENC_LEN, rb_enc_mbminlen, and UChar.

## ◆ rb_enc_precise_mbclen()

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

Definition at line 1032 of file encoding.c.

References rb_encoding_entry::enc, n, ONIGENC_CONSTRUCT_MBCLEN_NEEDMORE, ONIGENC_PRECISE_MBC_ENC_LEN, and UChar.

Referenced by rb_enc_ascget(), rb_enc_codepoint_len(), rb_enc_uint_chr(), and rb_str_concat().

## ◆ rb_enc_register()

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

Definition at line 326 of file encoding.c.

References index, name, rb_enc_from_index(), rb_enc_name, rb_enc_registered(), rb_encoding, and STRCASECMP.

## ◆ rb_enc_registered()

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

Definition at line 624 of file encoding.c.

References name.

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

## ◆ rb_enc_replicate()

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

Definition at line 402 of file encoding.c.

Referenced by rb_define_dummy_encoding().

## ◆ rb_enc_set_base()

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

Definition at line 382 of file encoding.c.

References name, and rb_enc_registered().

## ◆ rb_enc_set_default_external()

void rb_enc_set_default_external | ( | VALUE | encoding | ) |

Definition at line 1479 of file encoding.c.

References NIL_P, rb_eArgError, and rb_raise().

## ◆ rb_enc_set_default_internal()

void rb_enc_set_default_internal | ( | VALUE | encoding | ) |

Definition at line 1563 of file encoding.c.

## ◆ rb_enc_set_dummy()

int rb_enc_set_dummy | ( | int | index | ) |

Definition at line 393 of file encoding.c.

References rb_encoding_entry::enc, and rb_encoding.

## ◆ rb_enc_set_index()

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

Definition at line 830 of file encoding.c.

References obj, and rb_check_frozen.

Referenced by rb_str_concat_literals().

## ◆ rb_enc_to_index()

int rb_enc_to_index | ( | rb_encoding * | enc | ) |

Definition at line 125 of file encoding.c.

References rb_encoding_entry::enc, and ENC_TO_ENCINDEX.

Referenced by Init_enc_set_filesystem_encoding(), rb_dir_getwd(), rb_enc_associate(), rb_enc_str_buf_cat(), rb_external_str_new_with_enc(), rb_external_str_with_enc(), rb_str_coderange_scan_restartable(), rb_str_concat(), rb_w32_conv_from_wchar(), and rb_w32_readdir().

## ◆ rb_enc_tolower()

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

Definition at line 1112 of file encoding.c.

References ONIGENC_ASCII_CODE_TO_LOWER_CASE, and ONIGENC_IS_ASCII_CODE.

## ◆ rb_enc_toupper()

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

Definition at line 1106 of file encoding.c.

References ONIGENC_ASCII_CODE_TO_UPPER_CASE, and ONIGENC_IS_ASCII_CODE.

## ◆ rb_enc_unicode_p()

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

Definition at line 521 of file encoding.c.

References rb_encoding_entry::enc, and ONIGENC_IS_UNICODE.

## ◆ rb_encdb_alias()

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

Definition at line 565 of file encoding.c.

References rb_enc_registered().

Referenced by Init_enc().

## ◆ rb_encdb_declare()

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

Definition at line 350 of file encoding.c.

References name, and rb_enc_registered().

Referenced by Init_enc().

## ◆ rb_encdb_dummy()

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

Definition at line 472 of file encoding.c.

References index.

## ◆ rb_encdb_replicate()

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

Definition at line 450 of file encoding.c.

References name, and rb_enc_registered().

## ◆ rb_encdb_set_unicode()

void rb_encdb_set_unicode | ( | int | index | ) |

Definition at line 576 of file encoding.c.

References index, ONIGENC_FLAG_UNICODE, and rb_enc_from_index().

## ◆ rb_filesystem_encindex()

int rb_filesystem_encindex | ( | void |  | ) |

Definition at line 1378 of file encoding.c.

References ENCINDEX_ASCII, and rb_enc_registered().

Referenced by rb_filesystem_encoding(), and rb_str_encode_ospath().

## ◆ rb_filesystem_encoding()

rb_encoding* rb_filesystem_encoding | ( | void |  | ) |

Definition at line 1387 of file encoding.c.

References rb_enc_from_index(), and rb_filesystem_encindex().

Referenced by rb_dir_getwd(), rb_filesystem_str_new(), and rb_filesystem_str_new_cstr().

## ◆ rb_find_encoding()

rb_encoding* rb_find_encoding | ( | VALUE | enc | ) |

Definition at line 252 of file encoding.c.

## ◆ rb_id_encoding()

ID rb_id_encoding | ( | void |  | ) |

Definition at line 759 of file encoding.c.

References CONST_ID.

## ◆ rb_locale_charmap_index()

int rb_locale_charmap_index | ( | void |  | ) |

Definition at line 109 of file localeinit.c.

References ENCINDEX_US_ASCII.

Referenced by rb_locale_encindex().

## ◆ rb_locale_encindex()

int rb_locale_encindex | ( | void |  | ) |

Definition at line 1354 of file encoding.c.

References ENCINDEX_ASCII, Init_w32_codepage(), rb_enc_registered(), and rb_locale_charmap_index().

Referenced by rb_locale_encoding().

## ◆ rb_locale_encoding()

rb_encoding* rb_locale_encoding | ( | void |  | ) |

Definition at line 1372 of file encoding.c.

References rb_enc_from_index(), and rb_locale_encindex().

Referenced by rb_loaderror(), rb_loaderror_with_path(), rb_locale_str_new(), rb_locale_str_new_cstr(), and rb_str_export_locale().

## ◆ rb_obj_encoding()

VALUE rb_obj_encoding | ( | VALUE | obj | ) |

Definition at line 1004 of file encoding.c.

References obj, rb_enc_get_index(), rb_eTypeError, and rb_raise().

## ◆ rb_to_encoding()

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

Definition at line 245 of file encoding.c.

## ◆ rb_to_encoding_index()

int rb_to_encoding_index | ( | VALUE | enc | ) |

Definition at line 197 of file encoding.c.

## ◆ rb_usascii_encindex()

int rb_usascii_encindex | ( | void |  | ) |

Definition at line 1346 of file encoding.c.

References ENCINDEX_US_ASCII.

Referenced by rb_external_str_new_with_enc(), rb_external_str_with_enc(), rb_usascii_str_new(), and rb_usascii_str_new_cstr().

## ◆ rb_usascii_encoding()

rb_encoding* rb_usascii_encoding | ( | void |  | ) |

Definition at line 1340 of file encoding.c.

Referenced by rb_intern2(), rb_iv_get(), rb_reg_quote(), and rb_sym_intern_ascii().

## ◆ rb_utf8_encindex()

int rb_utf8_encindex | ( | void |  | ) |

Definition at line 1334 of file encoding.c.

References ENCINDEX_UTF_8.

Referenced by rb_char_to_option_kcode(), and rb_utf8_str_new_cstr().

## ◆ rb_utf8_encoding()

rb_encoding* rb_utf8_encoding | ( | void |  | ) |

Definition at line 1328 of file encoding.c.

Referenced by rb_str_encode_ospath().

## Variable Documentation

## ◆ count

int count

Definition at line 57 of file encoding.c.

Referenced by asn1time_to_time(), EVENTSINK_Invoke(), ffi_closure_SYSV(), ffi_prep_args(), ffi_prep_cif_machdep(), rb_ivar_count(), rb_vm_bugreport(), and ruby_malloc_size_overflow().

## ◆ list

struct rb_encoding_entry* list

Definition at line 56 of file encoding.c.

Referenced by Init_Encoding(), onig_node_list_add(), rb_hook_list_remove_tracepoint(), rb_objspace_free(), and rb_set_end_proc().

## ◆ names

st_table* names

Definition at line 59 of file encoding.c.

## ◆ rb_cEncoding

VALUE rb_cEncoding

Definition at line 46 of file encoding.c.

Referenced by Init_Encoding().

## ◆ size

int size

Definition at line 58 of file encoding.c.

Referenced by ffi_call(), ffi_closure_call_SYSV(), ffi_closure_helper_DARWIN(), ffi_closure_helper_SYSV(), ffi_closure_osf_inner(), ffi_closure_sparc_inner_v8(), ffi_closure_sparc_inner_v9(), ffi_closure_SYSV_inner(), ffi_prep_args(), ffi_prep_cif_machdep(), onig_bbuf_init(), onig_memsize(), onig_region_memsize(), rb_aligned_malloc(), rb_ast_memsize(), rb_ec_initialize_vm_stack(), rb_ec_set_vm_stack(), rb_econv_memsize(), rb_hash_new_with_size(), rb_io_memsize(), rb_iseq_insns_info_decode_positions(), rb_iseq_insns_info_encode_positions(), rb_iseq_mark_insn_storage(), rb_iseq_memsize(), rb_load_with_builtin_functions(), rb_mem_clear(), rb_parser_calloc(), rb_parser_malloc(), rb_parser_realloc(), rb_struct_new(), rb_vm_bugreport(), rb_w32_read(), rb_w32_reparse_symlink_p(), rb_w32_write(), reg_get_val(), RUBY_ALIAS_FUNCTION(), ruby_getcwd(), ruby_mimmalloc(), ruby_xcalloc(), ruby_xmalloc(), ruby_xmalloc2(), ruby_xmalloc_body(), ruby_xrealloc2_body(), and st_init_numtable_with_size().