Ruby  1.9.3p551(2014-11-13revision48407)
Macros | Typedefs | Enumerations | Functions | Variables
encoding.h File Reference
#include <stdarg.h>
#include "ruby/oniguruma.h"

Go to the source code of this file.

Macros

#define ENCODING_INLINE_MAX   1023
 
#define ENCODING_SHIFT   (FL_USHIFT+10)
 
#define ENCODING_MASK   (((VALUE)ENCODING_INLINE_MAX)<<ENCODING_SHIFT)
 
#define ENCODING_SET_INLINED(obj, i)
 
#define ENCODING_SET(obj, i)
 
#define ENCODING_GET_INLINED(obj)   (int)((RBASIC(obj)->flags & ENCODING_MASK)>>ENCODING_SHIFT)
 
#define ENCODING_GET(obj)
 
#define ENCODING_IS_ASCII8BIT(obj)   (ENCODING_GET_INLINED(obj) == 0)
 
#define ENCODING_MAXNAMELEN   42
 
#define ENC_CODERANGE_MASK   ((int)(FL_USER8|FL_USER9))
 
#define ENC_CODERANGE_UNKNOWN   0
 
#define ENC_CODERANGE_7BIT   ((int)FL_USER8)
 
#define ENC_CODERANGE_VALID   ((int)FL_USER9)
 
#define ENC_CODERANGE_BROKEN   ((int)(FL_USER8|FL_USER9))
 
#define ENC_CODERANGE(obj)   ((int)RBASIC(obj)->flags & ENC_CODERANGE_MASK)
 
#define ENC_CODERANGE_ASCIIONLY(obj)   (ENC_CODERANGE(obj) == ENC_CODERANGE_7BIT)
 
#define ENC_CODERANGE_SET(obj, cr)
 
#define ENC_CODERANGE_CLEAR(obj)   ENC_CODERANGE_SET((obj),0)
 
#define ENC_CODERANGE_AND(a, b)
 
#define ENCODING_CODERANGE_SET(obj, encindex, cr)
 
#define rb_enc_to_index(enc)   ((enc) ? ENC_TO_ENCINDEX(enc) : 0)
 
#define rb_enc_name(enc)   (enc)->name
 
#define rb_enc_mbminlen(enc)   (enc)->min_enc_len
 
#define rb_enc_mbmaxlen(enc)   (enc)->max_enc_len
 
#define MBCLEN_CHARFOUND_P(ret)   ONIGENC_MBCLEN_CHARFOUND_P(ret)
 
#define MBCLEN_CHARFOUND_LEN(ret)   ONIGENC_MBCLEN_CHARFOUND_LEN(ret)
 
#define MBCLEN_INVALID_P(ret)   ONIGENC_MBCLEN_INVALID_P(ret)
 
#define MBCLEN_NEEDMORE_P(ret)   ONIGENC_MBCLEN_NEEDMORE_P(ret)
 
#define MBCLEN_NEEDMORE_LEN(ret)   ONIGENC_MBCLEN_NEEDMORE_LEN(ret)
 
#define rb_enc_codepoint(p, e, enc)   rb_enc_codepoint_len((p),(e),0,(enc))
 
#define rb_enc_mbc_to_codepoint(p, e, enc)   ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
 
#define rb_enc_mbcput(c, buf, enc)   ONIGENC_CODE_TO_MBC((enc),(c),(UChar*)(buf))
 
#define rb_enc_prev_char(s, p, e, enc)   ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
 
#define rb_enc_left_char_head(s, p, e, enc)   ((char *)onigenc_get_left_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
 
#define rb_enc_right_char_head(s, p, e, enc)   ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
 
#define rb_enc_step_back(s, p, e, n, enc)   ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))
 
#define rb_enc_is_newline(p, end, enc)   ONIGENC_IS_MBC_NEWLINE((enc),(UChar*)(p),(UChar*)(end))
 
#define rb_enc_isctype(c, t, enc)   ONIGENC_IS_CODE_CTYPE((enc),(c),(t))
 
#define rb_enc_isascii(c, enc)   ONIGENC_IS_CODE_ASCII(c)
 
#define rb_enc_isalpha(c, enc)   ONIGENC_IS_CODE_ALPHA((enc),(c))
 
#define rb_enc_islower(c, enc)   ONIGENC_IS_CODE_LOWER((enc),(c))
 
#define rb_enc_isupper(c, enc)   ONIGENC_IS_CODE_UPPER((enc),(c))
 
#define rb_enc_ispunct(c, enc)   ONIGENC_IS_CODE_PUNCT((enc),(c))
 
#define rb_enc_isalnum(c, enc)   ONIGENC_IS_CODE_ALNUM((enc),(c))
 
#define rb_enc_isprint(c, enc)   ONIGENC_IS_CODE_PRINT((enc),(c))
 
#define rb_enc_isspace(c, enc)   ONIGENC_IS_CODE_SPACE((enc),(c))
 
#define rb_enc_isdigit(c, enc)   ONIGENC_IS_CODE_DIGIT((enc),(c))
 
#define rb_enc_asciicompat(enc)   (rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc))
 
#define rb_enc_str_asciicompat_p(str)   rb_enc_asciicompat(rb_enc_get(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 ECONV_ERROR_HANDLER_MASK   0x000000ff
 
#define ECONV_INVALID_MASK   0x0000000f
 
#define ECONV_INVALID_REPLACE   0x00000002
 
#define ECONV_UNDEF_MASK   0x000000f0
 
#define ECONV_UNDEF_REPLACE   0x00000020
 
#define ECONV_UNDEF_HEX_CHARREF   0x00000030
 
#define ECONV_DECORATOR_MASK   0x0000ff00
 
#define ECONV_NEWLINE_DECORATOR_MASK   0x00003f00
 
#define ECONV_NEWLINE_DECORATOR_READ_MASK   0x00000f00
 
#define ECONV_NEWLINE_DECORATOR_WRITE_MASK   0x00003000
 
#define ECONV_UNIVERSAL_NEWLINE_DECORATOR   0x00000100
 
#define ECONV_CRLF_NEWLINE_DECORATOR   0x00001000
 
#define ECONV_CR_NEWLINE_DECORATOR   0x00002000
 
#define ECONV_XML_TEXT_DECORATOR   0x00004000
 
#define ECONV_XML_ATTR_CONTENT_DECORATOR   0x00008000
 
#define ECONV_STATEFUL_DECORATOR_MASK   0x00f00000
 
#define ECONV_XML_ATTR_QUOTE_DECORATOR   0x00100000
 
#define ECONV_DEFAULT_NEWLINE_DECORATOR   0
 
#define ECONV_PARTIAL_INPUT   0x00010000
 
#define ECONV_AFTER_OUTPUT   0x00020000
 

Typedefs

typedef OnigEncodingType rb_encoding
 
typedef struct rb_econv_t rb_econv_t
 

Enumerations

enum  rb_econv_result_t {
  econv_invalid_byte_sequence, econv_undefined_conversion, econv_destination_buffer_full, econv_source_buffer_empty,
  econv_finished, econv_after_output, econv_incomplete_input
}
 

Functions

int rb_char_to_option_kcode (int c, int *option, int *kcode)
 
int rb_enc_replicate (const char *, rb_encoding *)
 
int rb_define_dummy_encoding (const char *)
 
int rb_enc_get_index (VALUE obj)
 
void rb_enc_set_index (VALUE obj, int encindex)
 
int rb_enc_find_index (const char *name)
 
int rb_to_encoding_index (VALUE)
 
rb_encodingrb_to_encoding (VALUE)
 
rb_encodingrb_enc_get (VALUE)
 
rb_encodingrb_enc_compatible (VALUE, VALUE)
 
rb_encodingrb_enc_check (VALUE, VALUE)
 
VALUE rb_enc_associate_index (VALUE, int)
 
VALUE rb_enc_associate (VALUE, rb_encoding *)
 
void rb_enc_copy (VALUE dst, VALUE src)
 
VALUE rb_enc_str_new (const char *, long, rb_encoding *)
 
VALUE rb_enc_reg_new (const char *, long, rb_encoding *, int)
 
 PRINTF_ARGS (VALUE rb_enc_sprintf(rb_encoding *, const char *,...), 2, 3)
 
VALUE rb_enc_vsprintf (rb_encoding *, const char *, va_list)
 
long rb_enc_strlen (const char *, const char *, rb_encoding *)
 
char * rb_enc_nth (const char *, const char *, long, rb_encoding *)
 
VALUE rb_obj_encoding (VALUE)
 
VALUE rb_enc_str_buf_cat (VALUE str, const char *ptr, long len, rb_encoding *enc)
 
VALUE rb_enc_uint_chr (unsigned int code, rb_encoding *enc)
 
VALUE rb_external_str_new_with_enc (const char *ptr, long len, rb_encoding *)
 
VALUE rb_str_export_to_enc (VALUE, rb_encoding *)
 
VALUE rb_str_conv_enc (VALUE str, rb_encoding *from, rb_encoding *to)
 
VALUE rb_str_conv_enc_opts (VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
 
rb_encodingrb_enc_from_index (int idx)
 
rb_encodingrb_enc_find (const char *name)
 
int rb_enc_mbclen (const char *p, const char *e, rb_encoding *enc)
 
int rb_enc_fast_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, rb_encoding *enc)
 
unsigned int rb_enc_codepoint (const char *p, const char *e, rb_encoding *enc)
 
int rb_enc_codelen (int code, rb_encoding *enc)
 
int rb_enc_casefold (char *to, const char *p, const char *e, rb_encoding *enc)
 
int rb_enc_toupper (int c, rb_encoding *enc)
 
int rb_enc_tolower (int c, rb_encoding *enc)
 
ID rb_intern3 (const char *, long, rb_encoding *)
 
ID rb_interned_id_p (const char *, long, rb_encoding *)
 
int rb_enc_symname_p (const char *, rb_encoding *)
 
int rb_enc_symname2_p (const char *, long, rb_encoding *)
 
int rb_enc_str_coderange (VALUE)
 
long rb_str_coderange_scan_restartable (const char *, const char *, rb_encoding *, int *)
 
int rb_enc_str_asciionly_p (VALUE)
 
VALUE rb_enc_from_encoding (rb_encoding *enc)
 
int rb_enc_unicode_p (rb_encoding *enc)
 
rb_encodingrb_ascii8bit_encoding (void)
 
rb_encodingrb_utf8_encoding (void)
 
rb_encodingrb_usascii_encoding (void)
 
rb_encodingrb_locale_encoding (void)
 
rb_encodingrb_filesystem_encoding (void)
 
rb_encodingrb_default_external_encoding (void)
 
rb_encodingrb_default_internal_encoding (void)
 
int rb_ascii8bit_encindex (void)
 
int rb_utf8_encindex (void)
 
int rb_usascii_encindex (void)
 
int rb_locale_encindex (void)
 
int rb_filesystem_encindex (void)
 
VALUE rb_enc_default_external (void)
 
VALUE rb_enc_default_internal (void)
 
void rb_enc_set_default_external (VALUE encoding)
 
void rb_enc_set_default_internal (VALUE encoding)
 
VALUE rb_locale_charmap (VALUE klass)
 
long rb_memsearch (const void *, long, const void *, long, rb_encoding *)
 
char * rb_enc_path_next (const char *, const char *, rb_encoding *)
 
char * rb_enc_path_skip_prefix (const char *, const char *, rb_encoding *)
 
char * rb_enc_path_last_separator (const char *, const char *, rb_encoding *)
 
char * rb_enc_path_end (const char *, const char *, rb_encoding *)
 
const char * ruby_enc_find_basename (const char *name, long *baselen, long *alllen, rb_encoding *enc)
 
const char * ruby_enc_find_extname (const char *name, long *len, rb_encoding *enc)
 
static int rb_enc_dummy_p (rb_encoding *enc)
 
VALUE rb_str_encode (VALUE str, VALUE to, int ecflags, VALUE ecopts)
 
int rb_econv_has_convpath_p (const char *from_encoding, const char *to_encoding)
 
int rb_econv_prepare_options (VALUE opthash, VALUE *ecopts, int ecflags)
 
int rb_econv_prepare_opts (VALUE opthash, VALUE *ecopts)
 
rb_econv_trb_econv_open (const char *source_encoding, const char *destination_encoding, int ecflags)
 
rb_econv_trb_econv_open_opts (const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts)
 
rb_econv_result_t rb_econv_convert (rb_econv_t *ec, const unsigned char **source_buffer_ptr, const unsigned char *source_buffer_end, unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end, int flags)
 
void rb_econv_close (rb_econv_t *ec)
 
int rb_econv_set_replacement (rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname)
 
int rb_econv_decorate_at_first (rb_econv_t *ec, const char *decorator_name)
 
int rb_econv_decorate_at_last (rb_econv_t *ec, const char *decorator_name)
 
VALUE rb_econv_open_exc (const char *senc, const char *denc, int ecflags)
 
int rb_econv_insert_output (rb_econv_t *ec, const unsigned char *str, size_t len, const char *str_encoding)
 
const char * rb_econv_encoding_to_insert_output (rb_econv_t *ec)
 
void rb_econv_check_error (rb_econv_t *ec)
 
VALUE rb_econv_make_exception (rb_econv_t *ec)
 
int rb_econv_putbackable (rb_econv_t *ec)
 
void rb_econv_putback (rb_econv_t *ec, unsigned char *p, int n)
 
const char * rb_econv_asciicompat_encoding (const char *encname)
 
VALUE rb_econv_str_convert (rb_econv_t *ec, VALUE src, int flags)
 
VALUE rb_econv_substr_convert (rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags)
 
VALUE rb_econv_str_append (rb_econv_t *ec, VALUE src, VALUE dst, int flags)
 
VALUE rb_econv_substr_append (rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags)
 
void rb_econv_binmode (rb_econv_t *ec)
 

Variables

RUBY_EXTERN VALUE rb_cEncoding
 

Macro Definition Documentation

#define ECONV_AFTER_OUTPUT   0x00020000
#define ECONV_CR_NEWLINE_DECORATOR   0x00002000
#define ECONV_CRLF_NEWLINE_DECORATOR   0x00001000
#define ECONV_DECORATOR_MASK   0x0000ff00

Definition at line 312 of file encoding.h.

#define ECONV_DEFAULT_NEWLINE_DECORATOR   0
#define ECONV_ERROR_HANDLER_MASK   0x000000ff

Definition at line 303 of file encoding.h.

Referenced by make_writeconv(), and rb_econv_open().

#define ECONV_INVALID_MASK   0x0000000f

Definition at line 305 of file encoding.h.

Referenced by Init_transcode(), and rb_econv_convert().

#define ECONV_INVALID_REPLACE   0x00000002
#define ECONV_NEWLINE_DECORATOR_MASK   0x00003f00
#define ECONV_NEWLINE_DECORATOR_READ_MASK   0x00000f00

Definition at line 314 of file encoding.h.

Referenced by make_writeconv().

#define ECONV_NEWLINE_DECORATOR_WRITE_MASK   0x00003000

Definition at line 315 of file encoding.h.

Referenced by make_readconv().

#define ECONV_PARTIAL_INPUT   0x00010000
#define ECONV_STATEFUL_DECORATOR_MASK   0x00f00000

Definition at line 323 of file encoding.h.

Referenced by make_writeconv().

#define ECONV_UNDEF_HEX_CHARREF   0x00000030

Definition at line 310 of file encoding.h.

Referenced by econv_opts(), Init_transcode(), and rb_econv_convert().

#define ECONV_UNDEF_MASK   0x000000f0

Definition at line 308 of file encoding.h.

Referenced by Init_transcode(), and rb_econv_convert().

#define ECONV_UNDEF_REPLACE   0x00000020
#define ECONV_UNIVERSAL_NEWLINE_DECORATOR   0x00000100
#define ECONV_XML_ATTR_CONTENT_DECORATOR   0x00008000
#define ECONV_XML_ATTR_QUOTE_DECORATOR   0x00100000
#define ECONV_XML_TEXT_DECORATOR   0x00004000
#define ENC_CODERANGE (   obj)    ((int)RBASIC(obj)->flags & ENC_CODERANGE_MASK)
#define ENC_CODERANGE_7BIT   ((int)FL_USER8)
#define ENC_CODERANGE_AND (   a,
 
)
Value:
((a) == ENC_CODERANGE_7BIT ? (b) : \
ENC_CODERANGE_UNKNOWN)

Definition at line 68 of file encoding.h.

Referenced by rb_str_justify(), rb_str_plus(), and rb_str_splice().

#define ENC_CODERANGE_ASCIIONLY (   obj)    (ENC_CODERANGE(obj) == ENC_CODERANGE_7BIT)

Definition at line 62 of file encoding.h.

Referenced by rb_enc_associate_index().

#define ENC_CODERANGE_BROKEN   ((int)(FL_USER8|FL_USER9))
#define ENC_CODERANGE_CLEAR (   obj)    ENC_CODERANGE_SET((obj),0)
#define ENC_CODERANGE_MASK   ((int)(FL_USER8|FL_USER9))

Definition at line 56 of file encoding.h.

#define ENC_CODERANGE_SET (   obj,
  cr 
)
#define ENC_CODERANGE_UNKNOWN   0
#define ENC_CODERANGE_VALID   ((int)FL_USER9)
#define ENC_DUMMY_FLAG   (1<<24)

Definition at line 222 of file encoding.h.

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

Definition at line 227 of file encoding.h.

Referenced by enc_dummy_p(), rb_enc_dummy_p(), and rb_enc_register().

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

Definition at line 223 of file encoding.h.

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

Definition at line 228 of file encoding.h.

Referenced by rb_define_dummy_encoding(), rb_encdb_dummy(), and set_base_encoding().

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

Definition at line 225 of file encoding.h.

Referenced by enc_autoload(), and rb_enc_from_encoding().

#define ENCODING_CODERANGE_SET (   obj,
  encindex,
  cr 
)
Value:
do { \
VALUE rb_encoding_coderange_obj = (obj); \
ENCODING_SET(rb_encoding_coderange_obj, (encindex)); \
ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \
} while (0)

Definition at line 73 of file encoding.h.

Referenced by code_page(), enc_inspect(), pack_pack(), pack_unpack(), rb_enc_cr_str_buf_cat(), rb_str_plus(), rb_usascii_str_new(), and RUBY_ALIAS_FUNCTION().

#define ENCODING_GET (   obj)
#define ENCODING_GET_INLINED (   obj)    (int)((RBASIC(obj)->flags & ENCODING_MASK)>>ENCODING_SHIFT)

Definition at line 46 of file encoding.h.

Referenced by rb_enc_get_index().

#define ENCODING_INLINE_MAX   1023

Definition at line 29 of file encoding.h.

Referenced by enc_set_index(), and rb_enc_get_index().

#define ENCODING_IS_ASCII8BIT (   obj)    (ENCODING_GET_INLINED(obj) == 0)

Definition at line 52 of file encoding.h.

Referenced by rb_enc_cr_str_buf_cat(), and reg_fragment_setenc_gen().

#define ENCODING_MASK   (((VALUE)ENCODING_INLINE_MAX)<<ENCODING_SHIFT)

Definition at line 31 of file encoding.h.

#define ENCODING_MAXNAMELEN   42

Definition at line 54 of file encoding.h.

Referenced by parse_mode_enc().

#define ENCODING_SET (   obj,
  i 
)
Value:
do {\
VALUE rb_encoding_set_obj = (obj); \
int encoding_set_enc_index = (i); \
if (encoding_set_enc_index < ENCODING_INLINE_MAX) \
ENCODING_SET_INLINED(rb_encoding_set_obj, encoding_set_enc_index); \
rb_enc_set_index(rb_encoding_set_obj, encoding_set_enc_index); \
} while (0)

Definition at line 37 of file encoding.h.

Referenced by iconv_initialize(), iconv_s_open(), and reg_fragment_setenc_gen().

#define ENCODING_SET_INLINED (   obj,
  i 
)
Value:
do {\
RBASIC(obj)->flags &= ~ENCODING_MASK;\
RBASIC(obj)->flags |= (VALUE)(i) << ENCODING_SHIFT;\
} while (0)

Definition at line 33 of file encoding.h.

Referenced by enc_set_index().

#define ENCODING_SHIFT   (FL_USHIFT+10)

Definition at line 30 of file encoding.h.

#define MBCLEN_CHARFOUND_LEN (   ret)    ONIGENC_MBCLEN_CHARFOUND_LEN(ret)
#define MBCLEN_CHARFOUND_P (   ret)    ONIGENC_MBCLEN_CHARFOUND_P(ret)
#define MBCLEN_INVALID_P (   ret)    ONIGENC_MBCLEN_INVALID_P(ret)
#define MBCLEN_NEEDMORE_LEN (   ret)    ONIGENC_MBCLEN_NEEDMORE_LEN(ret)

Definition at line 139 of file encoding.h.

Referenced by gzreader_charboundary().

#define MBCLEN_NEEDMORE_P (   ret)    ONIGENC_MBCLEN_NEEDMORE_P(ret)
#define rb_enc_asciicompat (   enc)    (rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc))
#define rb_enc_codepoint (   p,
  e,
  enc 
)    rb_enc_codepoint_len((p),(e),0,(enc))
#define rb_enc_is_newline (   p,
  end,
  enc 
)    ONIGENC_IS_MBC_NEWLINE((enc),(UChar*)(p),(UChar*)(end))

Definition at line 168 of file encoding.h.

Referenced by rb_str_chomp_bang(), and rb_str_each_line().

#define rb_enc_isalnum (   c,
  enc 
)    ONIGENC_IS_CODE_ALNUM((enc),(c))

Definition at line 176 of file encoding.h.

Referenced by parser_yylex().

#define rb_enc_isalpha (   c,
  enc 
)    ONIGENC_IS_CODE_ALPHA((enc),(c))

Definition at line 172 of file encoding.h.

Referenced by rb_enc_symname2_p().

#define rb_enc_isascii (   c,
  enc 
)    ONIGENC_IS_CODE_ASCII(c)
#define rb_enc_isctype (   c,
  t,
  enc 
)    ONIGENC_IS_CODE_CTYPE((enc),(c),(t))

Definition at line 170 of file encoding.h.

Referenced by enc_succ_alnum_char().

#define rb_enc_isdigit (   c,
  enc 
)    ONIGENC_IS_CODE_DIGIT((enc),(c))

Definition at line 179 of file encoding.h.

Referenced by is_special_global_name(), and rb_intern3().

#define rb_enc_islower (   c,
  enc 
)    ONIGENC_IS_CODE_LOWER((enc),(c))
#define rb_enc_isprint (   c,
  enc 
)    ONIGENC_IS_CODE_PRINT((enc),(c))

Definition at line 177 of file encoding.h.

Referenced by rb_reg_expr_str(), rb_str_format(), rb_str_inspect(), and sym_printable().

#define rb_enc_ispunct (   c,
  enc 
)    ONIGENC_IS_CODE_PUNCT((enc),(c))

Definition at line 175 of file encoding.h.

Referenced by rb_intern3().

#define rb_enc_isspace (   c,
  enc 
)    ONIGENC_IS_CODE_SPACE((enc),(c))

Definition at line 178 of file encoding.h.

Referenced by parser_yylex(), and rb_reg_expr_str().

#define rb_enc_isupper (   c,
  enc 
)    ONIGENC_IS_CODE_UPPER((enc),(c))
#define rb_enc_left_char_head (   s,
  p,
  e,
  enc 
)    ((char *)onigenc_get_left_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
#define rb_enc_mbc_to_codepoint (   p,
  e,
  enc 
)    ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
#define rb_enc_mbcput (   c,
  buf,
  enc 
)    ONIGENC_CODE_TO_MBC((enc),(c),(UChar*)(buf))
#define rb_enc_mbmaxlen (   enc)    (enc)->max_enc_len
#define rb_enc_mbminlen (   enc)    (enc)->min_enc_len
#define rb_enc_name (   enc)    (enc)->name
#define rb_enc_prev_char (   s,
  p,
  e,
  enc 
)    ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
#define rb_enc_right_char_head (   s,
  p,
  e,
  enc 
)    ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))

Definition at line 164 of file encoding.h.

Referenced by rb_str_index(), rb_str_split_m(), and strio_getline().

#define rb_enc_step_back (   s,
  p,
  e,
  n,
  enc 
)    ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))

Definition at line 165 of file encoding.h.

Referenced by rb_str_ellipsize().

#define rb_enc_str_asciicompat_p (   str)    rb_enc_asciicompat(rb_enc_get(str))
#define rb_enc_to_index (   enc)    ((enc) ? ENC_TO_ENCINDEX(enc) : 0)

Typedef Documentation

typedef struct rb_econv_t rb_econv_t

Definition at line 248 of file encoding.h.

Definition at line 80 of file encoding.h.

Enumeration Type Documentation

Enumerator
econv_invalid_byte_sequence 
econv_undefined_conversion 
econv_destination_buffer_full 
econv_source_buffer_empty 
econv_finished 
econv_after_output 
econv_incomplete_input 

Definition at line 238 of file encoding.h.

Function Documentation

PRINTF_ARGS ( VALUE   rb_enc_sprintfrb_encoding *, const char *,...,
,
 
)
int rb_ascii8bit_encindex ( void  )
rb_encoding* rb_ascii8bit_encoding ( void  )
int rb_char_to_option_kcode ( int  c,
int *  option,
int *  kcode 
)
rb_encoding* rb_default_external_encoding ( void  )
rb_encoding* rb_default_internal_encoding ( void  )
int rb_define_dummy_encoding ( const char *  )
const char* rb_econv_asciicompat_encoding ( const char *  encname)
void rb_econv_binmode ( rb_econv_t ec)
void rb_econv_check_error ( rb_econv_t ec)

Definition at line 4213 of file transcode.c.

References make_econv_exception(), NIL_P, and rb_exc_raise().

Referenced by fill_cbuf(), gzfile_getc(), and rb_econv_substr_append().

void rb_econv_close ( rb_econv_t ec)
rb_econv_result_t rb_econv_convert ( rb_econv_t ec,
const unsigned char **  source_buffer_ptr,
const unsigned char *  source_buffer_end,
unsigned char **  destination_buffer_ptr,
unsigned char *  destination_buffer_end,
int  flags 
)
int rb_econv_decorate_at_first ( rb_econv_t ec,
const char *  decorator_name 
)
int rb_econv_decorate_at_last ( rb_econv_t ec,
const char *  decorator_name 
)
const char* rb_econv_encoding_to_insert_output ( rb_econv_t ec)
int rb_econv_has_convpath_p ( const char *  from_encoding,
const char *  to_encoding 
)

Definition at line 3171 of file transcode.c.

References Qnil, RTEST, search_convpath_i(), and transcode_search_path().

Referenced by rb_w32_write_console().

int rb_econv_insert_output ( rb_econv_t ec,
const unsigned char *  str,
size_t  len,
const char *  str_encoding 
)
VALUE rb_econv_make_exception ( rb_econv_t ec)

Definition at line 4207 of file transcode.c.

References make_econv_exception().

Referenced by fill_cbuf(), and finish_writeconv().

rb_econv_t* rb_econv_open ( const char *  source_encoding,
const char *  destination_encoding,
int  ecflags 
)
VALUE rb_econv_open_exc ( const char *  senc,
const char *  denc,
int  ecflags 
)
rb_econv_t* rb_econv_open_opts ( const char *  source_encoding,
const char *  destination_encoding,
int  ecflags,
VALUE  ecopts 
)
int rb_econv_prepare_options ( VALUE  opthash,
VALUE ecopts,
int  ecflags 
)
int rb_econv_prepare_opts ( VALUE  opthash,
VALUE ecopts 
)

Definition at line 2582 of file transcode.c.

References rb_econv_prepare_options().

Referenced by econv_args(), rb_gzfile_ecopts(), and str_transcode().

void rb_econv_putback ( rb_econv_t ec,
unsigned char *  p,
int  n 
)
int rb_econv_putbackable ( rb_econv_t ec)
int rb_econv_set_replacement ( rb_econv_t ec,
const unsigned char *  str,
size_t  len,
const char *  encname 
)
VALUE rb_econv_str_append ( rb_econv_t ec,
VALUE  src,
VALUE  dst,
int  flags 
)

Definition at line 1863 of file transcode.c.

References rb_econv_substr_append(), and RSTRING_LEN.

VALUE rb_econv_str_convert ( rb_econv_t ec,
VALUE  src,
int  flags 
)

Definition at line 1875 of file transcode.c.

References Qnil, rb_econv_substr_append(), and RSTRING_LEN.

Referenced by do_writeconv(), and gzfile_newstr().

VALUE rb_econv_substr_append ( rb_econv_t ec,
VALUE  src,
long  byteoff,
long  bytesize,
VALUE  dst,
int  flags 
)
VALUE rb_econv_substr_convert ( rb_econv_t ec,
VALUE  src,
long  byteoff,
long  bytesize,
int  flags 
)

Definition at line 1869 of file transcode.c.

References Qnil, and rb_econv_substr_append().

int rb_enc_ascget ( const char *  p,
const char *  e,
int *  len,
rb_encoding enc 
)
VALUE rb_enc_associate ( VALUE  ,
rb_encoding  
)
VALUE rb_enc_associate_index ( VALUE  ,
int   
)
int rb_enc_casefold ( char *  to,
const char *  p,
const char *  e,
rb_encoding enc 
)
rb_encoding* rb_enc_check ( VALUE  ,
VALUE   
)
int rb_enc_codelen ( int  code,
rb_encoding enc 
)
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,
rb_encoding enc 
)
rb_encoding* rb_enc_compatible ( VALUE  ,
VALUE   
)
void rb_enc_copy ( VALUE  dst,
VALUE  src 
)
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().

static int rb_enc_dummy_p ( rb_encoding enc)
inlinestatic
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)
int rb_enc_find_index ( const char *  name)
VALUE rb_enc_from_encoding ( rb_encoding enc)
rb_encoding* rb_enc_from_index ( int  idx)
rb_encoding* rb_enc_get ( VALUE  )

Definition at line 733 of file encoding.c.

References rb_enc_from_index(), and rb_enc_get_index().

Referenced by check_dirname(), 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(), 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_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(), realpath_rec(), 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)
int rb_enc_mbclen ( const char *  p,
const char *  e,
rb_encoding enc 
)
char* rb_enc_nth ( const char *  ,
const char *  ,
long  ,
rb_encoding  
)

Definition at line 1523 of file string.c.

References str_nth_len().

Referenced by iconv_iconv(), rb_str_ellipsize(), and rb_str_format().

char* rb_enc_path_end ( const char *  ,
const char *  ,
rb_encoding  
)

Definition at line 2781 of file file.c.

References chompdirsep(), and isdirsep.

Referenced by check_dirname(), and rb_path_end().

char* rb_enc_path_last_separator ( const char *  ,
const char *  ,
rb_encoding  
)

Definition at line 2747 of file file.c.

References Inc, isdirsep, last, and NULL.

Referenced by rb_path_last_separator().

char* rb_enc_path_next ( const char *  ,
const char *  ,
rb_encoding  
)

Definition at line 2699 of file file.c.

References Inc, and isdirsep.

Referenced by rb_enc_path_skip_prefix(), rb_path_next(), and realpath_rec().

char* rb_enc_path_skip_prefix ( const char *  ,
const char *  ,
rb_encoding  
)

Definition at line 2713 of file file.c.

References isdirsep, and rb_enc_path_next().

Referenced by check_dirname(), rb_path_skip_prefix(), and ruby_glob0().

int rb_enc_precise_mbclen ( const char *  p,
const char *  e,
rb_encoding enc 
)
VALUE rb_enc_reg_new ( const char *  ,
long  ,
rb_encoding ,
int   
)

Definition at line 2497 of file re.c.

References err, NULL, rb_enc_reg_raise(), rb_reg_alloc(), and rb_reg_initialize().

Referenced by rb_reg_new().

int rb_enc_replicate ( const char *  ,
rb_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  encindex 
)

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_str_asciionly_p ( VALUE  )
VALUE rb_enc_str_buf_cat ( VALUE  str,
const char *  ptr,
long  len,
rb_encoding enc 
)

Definition at line 2000 of file string.c.

References ENC_CODERANGE_UNKNOWN, NULL, rb_enc_cr_str_buf_cat(), and rb_enc_to_index.

Referenced by rb_reg_regsub(), and str_gsub().

int rb_enc_str_coderange ( VALUE  )
VALUE rb_enc_str_new ( const char *  ,
long  ,
rb_encoding  
)
long rb_enc_strlen ( const char *  ,
const char *  ,
rb_encoding  
)

Definition at line 980 of file string.c.

References ENC_CODERANGE_UNKNOWN, and enc_strlen().

Referenced by rb_str_format(), and update_char_offset().

int rb_enc_symname2_p ( const char *  ,
long  ,
rb_encoding  
)
int rb_enc_symname_p ( const char *  ,
rb_encoding  
)

Definition at line 16041 of file ripper.c.

References rb_enc_symname2_p(), and strlen().

Referenced by rb_symname_p(), and sym_inspect().

int rb_enc_tolower ( int  c,
rb_encoding enc 
)
int rb_enc_toupper ( int  c,
rb_encoding enc 
)
VALUE rb_enc_uint_chr ( unsigned int  code,
rb_encoding enc 
)
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().

VALUE rb_enc_vsprintf ( rb_encoding ,
const char *  ,
va_list   
)
VALUE rb_external_str_new_with_enc ( const char *  ptr,
long  len,
rb_encoding  
)
int rb_filesystem_encindex ( void  )

Definition at line 1196 of file encoding.c.

References rb_ascii8bit_encindex(), and rb_enc_registered().

Referenced by rb_filesystem_encoding().

rb_encoding* rb_filesystem_encoding ( void  )
ID rb_intern3 ( const char *  ,
long  ,
rb_encoding  
)
ID rb_interned_id_p ( const char *  ,
long  ,
rb_encoding  
)
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  )
rb_encoding* rb_locale_encoding ( void  )
long rb_memsearch ( const void *  ,
long  ,
const void *  ,
long  ,
rb_encoding  
)
VALUE rb_obj_encoding ( VALUE  )
long rb_str_coderange_scan_restartable ( const char *  ,
const char *  ,
rb_encoding ,
int *   
)
VALUE rb_str_conv_enc ( VALUE  str,
rb_encoding from,
rb_encoding to 
)
VALUE rb_str_conv_enc_opts ( VALUE  str,
rb_encoding from,
rb_encoding to,
int  ecflags,
VALUE  ecopts 
)

Referenced by gzfile_newstr(), and rb_str_conv_enc().

VALUE rb_str_encode ( VALUE  str,
VALUE  to,
int  ecflags,
VALUE  ecopts 
)
VALUE rb_str_export_to_enc ( VALUE  ,
rb_encoding  
)

Definition at line 597 of file string.c.

References rb_str_conv_enc(), and STR_ENC_GET.

Referenced by alias(), scalar(), start_document(), start_mapping(), and start_sequence().

rb_encoding* rb_to_encoding ( VALUE  )
int rb_to_encoding_index ( VALUE  )
int rb_usascii_encindex ( void  )
rb_encoding* rb_usascii_encoding ( void  )
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  )
const char* ruby_enc_find_basename ( const char *  name,
long baselen,
long alllen,
rb_encoding enc 
)

Definition at line 3598 of file file.c.

References chompdirsep(), Inc, isdirsep, name, p, skipprefix, and strrdirsep.

Referenced by rb_file_s_basename(), and ruby_find_basename().

const char* ruby_enc_find_extname ( const char *  name,
long len,
rb_encoding enc 
)

Definition at line 3804 of file file.c.

References Inc, isdirsep, istrailinggarbage, last, long, name, p, strlen(), and strrdirsep.

Referenced by path_sub_ext(), rb_file_s_extname(), and ruby_find_extname().

Variable Documentation

RUBY_EXTERN VALUE rb_cEncoding

Definition at line 221 of file encoding.h.