Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/smanonr..../opt/alt/ruby27/include/ruby
File: encoding.h
/**********************************************************************
[0] Fix | Delete
[1] Fix | Delete
encoding.h -
[2] Fix | Delete
[3] Fix | Delete
$Author: matz $
[4] Fix | Delete
created at: Thu May 24 11:49:41 JST 2007
[5] Fix | Delete
[6] Fix | Delete
Copyright (C) 2007 Yukihiro Matsumoto
[7] Fix | Delete
[8] Fix | Delete
**********************************************************************/
[9] Fix | Delete
[10] Fix | Delete
#ifndef RUBY_ENCODING_H
[11] Fix | Delete
#define RUBY_ENCODING_H 1
[12] Fix | Delete
[13] Fix | Delete
#ifdef RUBY_INTERNAL_H
[14] Fix | Delete
#error "Include this file before internal.h"
[15] Fix | Delete
#endif
[16] Fix | Delete
[17] Fix | Delete
#if defined(__cplusplus)
[18] Fix | Delete
extern "C" {
[19] Fix | Delete
#if 0
[20] Fix | Delete
} /* satisfy cc-mode */
[21] Fix | Delete
#endif
[22] Fix | Delete
#endif
[23] Fix | Delete
[24] Fix | Delete
#include <stdarg.h>
[25] Fix | Delete
#include "ruby/ruby.h"
[26] Fix | Delete
#include "ruby/oniguruma.h"
[27] Fix | Delete
[28] Fix | Delete
RUBY_SYMBOL_EXPORT_BEGIN
[29] Fix | Delete
[30] Fix | Delete
enum ruby_encoding_consts {
[31] Fix | Delete
RUBY_ENCODING_INLINE_MAX = 127,
[32] Fix | Delete
RUBY_ENCODING_SHIFT = (RUBY_FL_USHIFT+10),
[33] Fix | Delete
RUBY_ENCODING_MASK = (RUBY_ENCODING_INLINE_MAX<<RUBY_ENCODING_SHIFT
[34] Fix | Delete
/* RUBY_FL_USER10..RUBY_FL_USER16 */),
[35] Fix | Delete
RUBY_ENCODING_MAXNAMELEN = 42
[36] Fix | Delete
};
[37] Fix | Delete
[38] Fix | Delete
#define ENCODING_INLINE_MAX RUBY_ENCODING_INLINE_MAX
[39] Fix | Delete
#define ENCODING_SHIFT RUBY_ENCODING_SHIFT
[40] Fix | Delete
#define ENCODING_MASK RUBY_ENCODING_MASK
[41] Fix | Delete
[42] Fix | Delete
#define RB_ENCODING_SET_INLINED(obj,i) do {\
[43] Fix | Delete
RBASIC(obj)->flags &= ~RUBY_ENCODING_MASK;\
[44] Fix | Delete
RBASIC(obj)->flags |= (VALUE)(i) << RUBY_ENCODING_SHIFT;\
[45] Fix | Delete
} while (0)
[46] Fix | Delete
#define RB_ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
[47] Fix | Delete
[48] Fix | Delete
#define RB_ENCODING_GET_INLINED(obj) \
[49] Fix | Delete
(int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
[50] Fix | Delete
#define RB_ENCODING_GET(obj) \
[51] Fix | Delete
(RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
[52] Fix | Delete
RB_ENCODING_GET_INLINED(obj) : \
[53] Fix | Delete
rb_enc_get_index(obj))
[54] Fix | Delete
[55] Fix | Delete
#define RB_ENCODING_IS_ASCII8BIT(obj) (RB_ENCODING_GET_INLINED(obj) == 0)
[56] Fix | Delete
[57] Fix | Delete
#define ENCODING_SET_INLINED(obj,i) RB_ENCODING_SET_INLINED(obj,i)
[58] Fix | Delete
#define ENCODING_SET(obj,i) RB_ENCODING_SET(obj,i)
[59] Fix | Delete
#define ENCODING_GET_INLINED(obj) RB_ENCODING_GET_INLINED(obj)
[60] Fix | Delete
#define ENCODING_GET(obj) RB_ENCODING_GET(obj)
[61] Fix | Delete
#define ENCODING_IS_ASCII8BIT(obj) RB_ENCODING_IS_ASCII8BIT(obj)
[62] Fix | Delete
#define ENCODING_MAXNAMELEN RUBY_ENCODING_MAXNAMELEN
[63] Fix | Delete
[64] Fix | Delete
enum ruby_coderange_type {
[65] Fix | Delete
RUBY_ENC_CODERANGE_UNKNOWN = 0,
[66] Fix | Delete
RUBY_ENC_CODERANGE_7BIT = ((int)RUBY_FL_USER8),
[67] Fix | Delete
RUBY_ENC_CODERANGE_VALID = ((int)RUBY_FL_USER9),
[68] Fix | Delete
RUBY_ENC_CODERANGE_BROKEN = ((int)(RUBY_FL_USER8|RUBY_FL_USER9)),
[69] Fix | Delete
RUBY_ENC_CODERANGE_MASK = (RUBY_ENC_CODERANGE_7BIT|
[70] Fix | Delete
RUBY_ENC_CODERANGE_VALID|
[71] Fix | Delete
RUBY_ENC_CODERANGE_BROKEN)
[72] Fix | Delete
};
[73] Fix | Delete
[74] Fix | Delete
static inline int
[75] Fix | Delete
rb_enc_coderange_clean_p(int cr)
[76] Fix | Delete
{
[77] Fix | Delete
return (cr ^ (cr >> 1)) & RUBY_ENC_CODERANGE_7BIT;
[78] Fix | Delete
}
[79] Fix | Delete
#define RB_ENC_CODERANGE_CLEAN_P(cr) rb_enc_coderange_clean_p(cr)
[80] Fix | Delete
#define RB_ENC_CODERANGE(obj) ((int)RBASIC(obj)->flags & RUBY_ENC_CODERANGE_MASK)
[81] Fix | Delete
#define RB_ENC_CODERANGE_ASCIIONLY(obj) (RB_ENC_CODERANGE(obj) == RUBY_ENC_CODERANGE_7BIT)
[82] Fix | Delete
#define RB_ENC_CODERANGE_SET(obj,cr) (\
[83] Fix | Delete
RBASIC(obj)->flags = \
[84] Fix | Delete
(RBASIC(obj)->flags & ~RUBY_ENC_CODERANGE_MASK) | (cr))
[85] Fix | Delete
#define RB_ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_SET((obj),0)
[86] Fix | Delete
[87] Fix | Delete
/* assumed ASCII compatibility */
[88] Fix | Delete
#define RB_ENC_CODERANGE_AND(a, b) \
[89] Fix | Delete
((a) == RUBY_ENC_CODERANGE_7BIT ? (b) : \
[90] Fix | Delete
(a) != RUBY_ENC_CODERANGE_VALID ? RUBY_ENC_CODERANGE_UNKNOWN : \
[91] Fix | Delete
(b) == RUBY_ENC_CODERANGE_7BIT ? RUBY_ENC_CODERANGE_VALID : (b))
[92] Fix | Delete
[93] Fix | Delete
#define RB_ENCODING_CODERANGE_SET(obj, encindex, cr) \
[94] Fix | Delete
do { \
[95] Fix | Delete
VALUE rb_encoding_coderange_obj = (obj); \
[96] Fix | Delete
RB_ENCODING_SET(rb_encoding_coderange_obj, (encindex)); \
[97] Fix | Delete
RB_ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \
[98] Fix | Delete
} while (0)
[99] Fix | Delete
[100] Fix | Delete
#define ENC_CODERANGE_MASK RUBY_ENC_CODERANGE_MASK
[101] Fix | Delete
#define ENC_CODERANGE_UNKNOWN RUBY_ENC_CODERANGE_UNKNOWN
[102] Fix | Delete
#define ENC_CODERANGE_7BIT RUBY_ENC_CODERANGE_7BIT
[103] Fix | Delete
#define ENC_CODERANGE_VALID RUBY_ENC_CODERANGE_VALID
[104] Fix | Delete
#define ENC_CODERANGE_BROKEN RUBY_ENC_CODERANGE_BROKEN
[105] Fix | Delete
#define ENC_CODERANGE_CLEAN_P(cr) RB_ENC_CODERANGE_CLEAN_P(cr)
[106] Fix | Delete
#define ENC_CODERANGE(obj) RB_ENC_CODERANGE(obj)
[107] Fix | Delete
#define ENC_CODERANGE_ASCIIONLY(obj) RB_ENC_CODERANGE_ASCIIONLY(obj)
[108] Fix | Delete
#define ENC_CODERANGE_SET(obj,cr) RB_ENC_CODERANGE_SET(obj,cr)
[109] Fix | Delete
#define ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_CLEAR(obj)
[110] Fix | Delete
#define ENC_CODERANGE_AND(a, b) RB_ENC_CODERANGE_AND(a, b)
[111] Fix | Delete
#define ENCODING_CODERANGE_SET(obj, encindex, cr) RB_ENCODING_CODERANGE_SET(obj, encindex, cr)
[112] Fix | Delete
[113] Fix | Delete
typedef const OnigEncodingType rb_encoding;
[114] Fix | Delete
[115] Fix | Delete
int rb_char_to_option_kcode(int c, int *option, int *kcode);
[116] Fix | Delete
[117] Fix | Delete
int rb_enc_replicate(const char *, rb_encoding *);
[118] Fix | Delete
int rb_define_dummy_encoding(const char *);
[119] Fix | Delete
PUREFUNC(int rb_enc_dummy_p(rb_encoding *enc));
[120] Fix | Delete
PUREFUNC(int rb_enc_to_index(rb_encoding *enc));
[121] Fix | Delete
int rb_enc_get_index(VALUE obj);
[122] Fix | Delete
void rb_enc_set_index(VALUE obj, int encindex);
[123] Fix | Delete
int rb_enc_capable(VALUE obj);
[124] Fix | Delete
int rb_enc_find_index(const char *name);
[125] Fix | Delete
int rb_enc_alias(const char *alias, const char *orig);
[126] Fix | Delete
int rb_to_encoding_index(VALUE);
[127] Fix | Delete
rb_encoding *rb_to_encoding(VALUE);
[128] Fix | Delete
rb_encoding *rb_find_encoding(VALUE);
[129] Fix | Delete
rb_encoding *rb_enc_get(VALUE);
[130] Fix | Delete
rb_encoding *rb_enc_compatible(VALUE,VALUE);
[131] Fix | Delete
rb_encoding *rb_enc_check(VALUE,VALUE);
[132] Fix | Delete
VALUE rb_enc_associate_index(VALUE, int);
[133] Fix | Delete
VALUE rb_enc_associate(VALUE, rb_encoding*);
[134] Fix | Delete
void rb_enc_copy(VALUE dst, VALUE src);
[135] Fix | Delete
[136] Fix | Delete
VALUE rb_enc_str_new(const char*, long, rb_encoding*);
[137] Fix | Delete
VALUE rb_enc_str_new_cstr(const char*, rb_encoding*);
[138] Fix | Delete
VALUE rb_enc_str_new_static(const char*, long, rb_encoding*);
[139] Fix | Delete
VALUE rb_enc_reg_new(const char*, long, rb_encoding*, int);
[140] Fix | Delete
PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3);
[141] Fix | Delete
VALUE rb_enc_vsprintf(rb_encoding *, const char*, va_list);
[142] Fix | Delete
long rb_enc_strlen(const char*, const char*, rb_encoding*);
[143] Fix | Delete
char* rb_enc_nth(const char*, const char*, long, rb_encoding*);
[144] Fix | Delete
VALUE rb_obj_encoding(VALUE);
[145] Fix | Delete
VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc);
[146] Fix | Delete
VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc);
[147] Fix | Delete
[148] Fix | Delete
VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *);
[149] Fix | Delete
VALUE rb_str_export_to_enc(VALUE, rb_encoding *);
[150] Fix | Delete
VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to);
[151] Fix | Delete
VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts);
[152] Fix | Delete
[153] Fix | Delete
#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
[154] Fix | Delete
#define rb_enc_str_new(str, len, enc) RB_GNUC_EXTENSION_BLOCK( \
[155] Fix | Delete
(__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
[156] Fix | Delete
rb_enc_str_new_static((str), (len), (enc)) : \
[157] Fix | Delete
rb_enc_str_new((str), (len), (enc)) \
[158] Fix | Delete
)
[159] Fix | Delete
#define rb_enc_str_new_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \
[160] Fix | Delete
(__builtin_constant_p(str)) ? \
[161] Fix | Delete
rb_enc_str_new_static((str), (long)strlen(str), (enc)) : \
[162] Fix | Delete
rb_enc_str_new_cstr((str), (enc)) \
[163] Fix | Delete
)
[164] Fix | Delete
#endif
[165] Fix | Delete
[166] Fix | Delete
PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4);
[167] Fix | Delete
[168] Fix | Delete
/* index -> rb_encoding */
[169] Fix | Delete
rb_encoding *rb_enc_from_index(int idx);
[170] Fix | Delete
[171] Fix | Delete
/* name -> rb_encoding */
[172] Fix | Delete
rb_encoding *rb_enc_find(const char *name);
[173] Fix | Delete
[174] Fix | Delete
/* rb_encoding * -> name */
[175] Fix | Delete
#define rb_enc_name(enc) (enc)->name
[176] Fix | Delete
[177] Fix | Delete
/* rb_encoding * -> minlen/maxlen */
[178] Fix | Delete
#define rb_enc_mbminlen(enc) (enc)->min_enc_len
[179] Fix | Delete
#define rb_enc_mbmaxlen(enc) (enc)->max_enc_len
[180] Fix | Delete
[181] Fix | Delete
/* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */
[182] Fix | Delete
int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc);
[183] Fix | Delete
[184] Fix | Delete
/* -> mbclen (only for valid encoding) */
[185] Fix | Delete
int rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc);
[186] Fix | Delete
[187] Fix | Delete
/* -> chlen, invalid or needmore */
[188] Fix | Delete
int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc);
[189] Fix | Delete
#define MBCLEN_CHARFOUND_P(ret) ONIGENC_MBCLEN_CHARFOUND_P(ret)
[190] Fix | Delete
#define MBCLEN_CHARFOUND_LEN(ret) ONIGENC_MBCLEN_CHARFOUND_LEN(ret)
[191] Fix | Delete
#define MBCLEN_INVALID_P(ret) ONIGENC_MBCLEN_INVALID_P(ret)
[192] Fix | Delete
#define MBCLEN_NEEDMORE_P(ret) ONIGENC_MBCLEN_NEEDMORE_P(ret)
[193] Fix | Delete
#define MBCLEN_NEEDMORE_LEN(ret) ONIGENC_MBCLEN_NEEDMORE_LEN(ret)
[194] Fix | Delete
[195] Fix | Delete
/* -> 0x00..0x7f, -1 */
[196] Fix | Delete
int rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc);
[197] Fix | Delete
[198] Fix | Delete
[199] Fix | Delete
/* -> code (and len) or raise exception */
[200] Fix | Delete
unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_encoding *enc);
[201] Fix | Delete
[202] Fix | Delete
/* prototype for obsolete function */
[203] Fix | Delete
unsigned int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc);
[204] Fix | Delete
/* overriding macro */
[205] Fix | Delete
#define rb_enc_codepoint(p,e,enc) rb_enc_codepoint_len((p),(e),0,(enc))
[206] Fix | Delete
#define rb_enc_mbc_to_codepoint(p, e, enc) ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
[207] Fix | Delete
[208] Fix | Delete
/* -> codelen>0 or raise exception */
[209] Fix | Delete
int rb_enc_codelen(int code, rb_encoding *enc);
[210] Fix | Delete
/* -> 0 for invalid codepoint */
[211] Fix | Delete
int rb_enc_code_to_mbclen(int code, rb_encoding *enc);
[212] Fix | Delete
#define rb_enc_code_to_mbclen(c, enc) ONIGENC_CODE_TO_MBCLEN((enc), (c));
[213] Fix | Delete
[214] Fix | Delete
/* code,ptr,encoding -> write buf */
[215] Fix | Delete
#define rb_enc_mbcput(c,buf,enc) ONIGENC_CODE_TO_MBC((enc),(c),(UChar*)(buf))
[216] Fix | Delete
[217] Fix | Delete
/* start, ptr, end, encoding -> prev_char */
[218] Fix | Delete
#define rb_enc_prev_char(s,p,e,enc) ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
[219] Fix | Delete
/* start, ptr, end, encoding -> next_char */
[220] Fix | Delete
#define rb_enc_left_char_head(s,p,e,enc) ((char *)onigenc_get_left_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
[221] Fix | Delete
#define rb_enc_right_char_head(s,p,e,enc) ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
[222] Fix | Delete
#define rb_enc_step_back(s,p,e,n,enc) ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))
[223] Fix | Delete
[224] Fix | Delete
/* ptr, ptr, encoding -> newline_or_not */
[225] Fix | Delete
#define rb_enc_is_newline(p,end,enc) ONIGENC_IS_MBC_NEWLINE((enc),(UChar*)(p),(UChar*)(end))
[226] Fix | Delete
[227] Fix | Delete
#define rb_enc_isctype(c,t,enc) ONIGENC_IS_CODE_CTYPE((enc),(c),(t))
[228] Fix | Delete
#define rb_enc_isascii(c,enc) ONIGENC_IS_CODE_ASCII(c)
[229] Fix | Delete
#define rb_enc_isalpha(c,enc) ONIGENC_IS_CODE_ALPHA((enc),(c))
[230] Fix | Delete
#define rb_enc_islower(c,enc) ONIGENC_IS_CODE_LOWER((enc),(c))
[231] Fix | Delete
#define rb_enc_isupper(c,enc) ONIGENC_IS_CODE_UPPER((enc),(c))
[232] Fix | Delete
#define rb_enc_ispunct(c,enc) ONIGENC_IS_CODE_PUNCT((enc),(c))
[233] Fix | Delete
#define rb_enc_isalnum(c,enc) ONIGENC_IS_CODE_ALNUM((enc),(c))
[234] Fix | Delete
#define rb_enc_isprint(c,enc) ONIGENC_IS_CODE_PRINT((enc),(c))
[235] Fix | Delete
#define rb_enc_isspace(c,enc) ONIGENC_IS_CODE_SPACE((enc),(c))
[236] Fix | Delete
#define rb_enc_isdigit(c,enc) ONIGENC_IS_CODE_DIGIT((enc),(c))
[237] Fix | Delete
[238] Fix | Delete
static inline int
[239] Fix | Delete
rb_enc_asciicompat_inline(rb_encoding *enc)
[240] Fix | Delete
{
[241] Fix | Delete
return rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc);
[242] Fix | Delete
}
[243] Fix | Delete
#define rb_enc_asciicompat(enc) rb_enc_asciicompat_inline(enc)
[244] Fix | Delete
[245] Fix | Delete
int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc);
[246] Fix | Delete
CONSTFUNC(int rb_enc_toupper(int c, rb_encoding *enc));
[247] Fix | Delete
CONSTFUNC(int rb_enc_tolower(int c, rb_encoding *enc));
[248] Fix | Delete
ID rb_intern3(const char*, long, rb_encoding*);
[249] Fix | Delete
ID rb_interned_id_p(const char *, long, rb_encoding *);
[250] Fix | Delete
int rb_enc_symname_p(const char*, rb_encoding*);
[251] Fix | Delete
int rb_enc_symname2_p(const char*, long, rb_encoding*);
[252] Fix | Delete
int rb_enc_str_coderange(VALUE);
[253] Fix | Delete
long rb_str_coderange_scan_restartable(const char*, const char*, rb_encoding*, int*);
[254] Fix | Delete
int rb_enc_str_asciionly_p(VALUE);
[255] Fix | Delete
#define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str))
[256] Fix | Delete
VALUE rb_enc_from_encoding(rb_encoding *enc);
[257] Fix | Delete
PUREFUNC(int rb_enc_unicode_p(rb_encoding *enc));
[258] Fix | Delete
rb_encoding *rb_ascii8bit_encoding(void);
[259] Fix | Delete
rb_encoding *rb_utf8_encoding(void);
[260] Fix | Delete
rb_encoding *rb_usascii_encoding(void);
[261] Fix | Delete
rb_encoding *rb_locale_encoding(void);
[262] Fix | Delete
rb_encoding *rb_filesystem_encoding(void);
[263] Fix | Delete
rb_encoding *rb_default_external_encoding(void);
[264] Fix | Delete
rb_encoding *rb_default_internal_encoding(void);
[265] Fix | Delete
#ifndef rb_ascii8bit_encindex
[266] Fix | Delete
CONSTFUNC(int rb_ascii8bit_encindex(void));
[267] Fix | Delete
#endif
[268] Fix | Delete
#ifndef rb_utf8_encindex
[269] Fix | Delete
CONSTFUNC(int rb_utf8_encindex(void));
[270] Fix | Delete
#endif
[271] Fix | Delete
#ifndef rb_usascii_encindex
[272] Fix | Delete
CONSTFUNC(int rb_usascii_encindex(void));
[273] Fix | Delete
#endif
[274] Fix | Delete
int rb_locale_encindex(void);
[275] Fix | Delete
int rb_filesystem_encindex(void);
[276] Fix | Delete
VALUE rb_enc_default_external(void);
[277] Fix | Delete
VALUE rb_enc_default_internal(void);
[278] Fix | Delete
void rb_enc_set_default_external(VALUE encoding);
[279] Fix | Delete
void rb_enc_set_default_internal(VALUE encoding);
[280] Fix | Delete
VALUE rb_locale_charmap(VALUE klass);
[281] Fix | Delete
long rb_memsearch(const void*,long,const void*,long,rb_encoding*);
[282] Fix | Delete
char *rb_enc_path_next(const char *,const char *,rb_encoding*);
[283] Fix | Delete
char *rb_enc_path_skip_prefix(const char *,const char *,rb_encoding*);
[284] Fix | Delete
char *rb_enc_path_last_separator(const char *,const char *,rb_encoding*);
[285] Fix | Delete
char *rb_enc_path_end(const char *,const char *,rb_encoding*);
[286] Fix | Delete
const char *ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc);
[287] Fix | Delete
const char *ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc);
[288] Fix | Delete
ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc);
[289] Fix | Delete
VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc);
[290] Fix | Delete
[291] Fix | Delete
RUBY_EXTERN VALUE rb_cEncoding;
[292] Fix | Delete
[293] Fix | Delete
/* econv stuff */
[294] Fix | Delete
[295] Fix | Delete
typedef enum {
[296] Fix | Delete
econv_invalid_byte_sequence,
[297] Fix | Delete
econv_undefined_conversion,
[298] Fix | Delete
econv_destination_buffer_full,
[299] Fix | Delete
econv_source_buffer_empty,
[300] Fix | Delete
econv_finished,
[301] Fix | Delete
econv_after_output,
[302] Fix | Delete
econv_incomplete_input
[303] Fix | Delete
} rb_econv_result_t;
[304] Fix | Delete
[305] Fix | Delete
typedef struct rb_econv_t rb_econv_t;
[306] Fix | Delete
[307] Fix | Delete
VALUE rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts);
[308] Fix | Delete
int rb_econv_has_convpath_p(const char* from_encoding, const char* to_encoding);
[309] Fix | Delete
[310] Fix | Delete
int rb_econv_prepare_options(VALUE opthash, VALUE *ecopts, int ecflags);
[311] Fix | Delete
int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts);
[312] Fix | Delete
[313] Fix | Delete
rb_econv_t *rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags);
[314] Fix | Delete
rb_econv_t *rb_econv_open_opts(const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts);
[315] Fix | Delete
[316] Fix | Delete
rb_econv_result_t rb_econv_convert(rb_econv_t *ec,
[317] Fix | Delete
const unsigned char **source_buffer_ptr, const unsigned char *source_buffer_end,
[318] Fix | Delete
unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end,
[319] Fix | Delete
int flags);
[320] Fix | Delete
void rb_econv_close(rb_econv_t *ec);
[321] Fix | Delete
[322] Fix | Delete
/* result: 0:success -1:failure */
[323] Fix | Delete
int rb_econv_set_replacement(rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname);
[324] Fix | Delete
[325] Fix | Delete
/* result: 0:success -1:failure */
[326] Fix | Delete
int rb_econv_decorate_at_first(rb_econv_t *ec, const char *decorator_name);
[327] Fix | Delete
int rb_econv_decorate_at_last(rb_econv_t *ec, const char *decorator_name);
[328] Fix | Delete
[329] Fix | Delete
VALUE rb_econv_open_exc(const char *senc, const char *denc, int ecflags);
[330] Fix | Delete
[331] Fix | Delete
/* result: 0:success -1:failure */
[332] Fix | Delete
int rb_econv_insert_output(rb_econv_t *ec,
[333] Fix | Delete
const unsigned char *str, size_t len, const char *str_encoding);
[334] Fix | Delete
[335] Fix | Delete
/* encoding that rb_econv_insert_output doesn't need conversion */
[336] Fix | Delete
const char *rb_econv_encoding_to_insert_output(rb_econv_t *ec);
[337] Fix | Delete
[338] Fix | Delete
/* raise an error if the last rb_econv_convert is error */
[339] Fix | Delete
void rb_econv_check_error(rb_econv_t *ec);
[340] Fix | Delete
[341] Fix | Delete
/* returns an exception object or nil */
[342] Fix | Delete
VALUE rb_econv_make_exception(rb_econv_t *ec);
[343] Fix | Delete
[344] Fix | Delete
int rb_econv_putbackable(rb_econv_t *ec);
[345] Fix | Delete
void rb_econv_putback(rb_econv_t *ec, unsigned char *p, int n);
[346] Fix | Delete
[347] Fix | Delete
/* returns the corresponding ASCII compatible encoding for encname,
[348] Fix | Delete
* or NULL if encname is not ASCII incompatible encoding. */
[349] Fix | Delete
const char *rb_econv_asciicompat_encoding(const char *encname);
[350] Fix | Delete
[351] Fix | Delete
VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags);
[352] Fix | Delete
VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
[353] Fix | Delete
VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags);
[354] Fix | Delete
VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
[355] Fix | Delete
VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE dst, int flags);
[356] Fix | Delete
[357] Fix | Delete
void rb_econv_binmode(rb_econv_t *ec);
[358] Fix | Delete
[359] Fix | Delete
enum ruby_econv_flag_type {
[360] Fix | Delete
/* flags for rb_econv_open */
[361] Fix | Delete
RUBY_ECONV_ERROR_HANDLER_MASK = 0x000000ff,
[362] Fix | Delete
[363] Fix | Delete
RUBY_ECONV_INVALID_MASK = 0x0000000f,
[364] Fix | Delete
RUBY_ECONV_INVALID_REPLACE = 0x00000002,
[365] Fix | Delete
[366] Fix | Delete
RUBY_ECONV_UNDEF_MASK = 0x000000f0,
[367] Fix | Delete
RUBY_ECONV_UNDEF_REPLACE = 0x00000020,
[368] Fix | Delete
RUBY_ECONV_UNDEF_HEX_CHARREF = 0x00000030,
[369] Fix | Delete
[370] Fix | Delete
RUBY_ECONV_DECORATOR_MASK = 0x0000ff00,
[371] Fix | Delete
RUBY_ECONV_NEWLINE_DECORATOR_MASK = 0x00003f00,
[372] Fix | Delete
RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK = 0x00000f00,
[373] Fix | Delete
RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK = 0x00003000,
[374] Fix | Delete
[375] Fix | Delete
RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR = 0x00000100,
[376] Fix | Delete
RUBY_ECONV_CRLF_NEWLINE_DECORATOR = 0x00001000,
[377] Fix | Delete
RUBY_ECONV_CR_NEWLINE_DECORATOR = 0x00002000,
[378] Fix | Delete
RUBY_ECONV_XML_TEXT_DECORATOR = 0x00004000,
[379] Fix | Delete
RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR = 0x00008000,
[380] Fix | Delete
[381] Fix | Delete
RUBY_ECONV_STATEFUL_DECORATOR_MASK = 0x00f00000,
[382] Fix | Delete
RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR = 0x00100000,
[383] Fix | Delete
[384] Fix | Delete
RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR =
[385] Fix | Delete
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
[386] Fix | Delete
RUBY_ECONV_CRLF_NEWLINE_DECORATOR,
[387] Fix | Delete
#else
[388] Fix | Delete
0,
[389] Fix | Delete
#endif
[390] Fix | Delete
#define ECONV_ERROR_HANDLER_MASK RUBY_ECONV_ERROR_HANDLER_MASK
[391] Fix | Delete
#define ECONV_INVALID_MASK RUBY_ECONV_INVALID_MASK
[392] Fix | Delete
#define ECONV_INVALID_REPLACE RUBY_ECONV_INVALID_REPLACE
[393] Fix | Delete
#define ECONV_UNDEF_MASK RUBY_ECONV_UNDEF_MASK
[394] Fix | Delete
#define ECONV_UNDEF_REPLACE RUBY_ECONV_UNDEF_REPLACE
[395] Fix | Delete
#define ECONV_UNDEF_HEX_CHARREF RUBY_ECONV_UNDEF_HEX_CHARREF
[396] Fix | Delete
#define ECONV_DECORATOR_MASK RUBY_ECONV_DECORATOR_MASK
[397] Fix | Delete
#define ECONV_NEWLINE_DECORATOR_MASK RUBY_ECONV_NEWLINE_DECORATOR_MASK
[398] Fix | Delete
#define ECONV_NEWLINE_DECORATOR_READ_MASK RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK
[399] Fix | Delete
#define ECONV_NEWLINE_DECORATOR_WRITE_MASK RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK
[400] Fix | Delete
#define ECONV_UNIVERSAL_NEWLINE_DECORATOR RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR
[401] Fix | Delete
#define ECONV_CRLF_NEWLINE_DECORATOR RUBY_ECONV_CRLF_NEWLINE_DECORATOR
[402] Fix | Delete
#define ECONV_CR_NEWLINE_DECORATOR RUBY_ECONV_CR_NEWLINE_DECORATOR
[403] Fix | Delete
#define ECONV_XML_TEXT_DECORATOR RUBY_ECONV_XML_TEXT_DECORATOR
[404] Fix | Delete
#define ECONV_XML_ATTR_CONTENT_DECORATOR RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR
[405] Fix | Delete
#define ECONV_STATEFUL_DECORATOR_MASK RUBY_ECONV_STATEFUL_DECORATOR_MASK
[406] Fix | Delete
#define ECONV_XML_ATTR_QUOTE_DECORATOR RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR
[407] Fix | Delete
#define ECONV_DEFAULT_NEWLINE_DECORATOR RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR
[408] Fix | Delete
/* end of flags for rb_econv_open */
[409] Fix | Delete
[410] Fix | Delete
/* flags for rb_econv_convert */
[411] Fix | Delete
RUBY_ECONV_PARTIAL_INPUT = 0x00010000,
[412] Fix | Delete
RUBY_ECONV_AFTER_OUTPUT = 0x00020000,
[413] Fix | Delete
#define ECONV_PARTIAL_INPUT RUBY_ECONV_PARTIAL_INPUT
[414] Fix | Delete
#define ECONV_AFTER_OUTPUT RUBY_ECONV_AFTER_OUTPUT
[415] Fix | Delete
/* end of flags for rb_econv_convert */
[416] Fix | Delete
RUBY_ECONV_FLAGS_PLACEHOLDER};
[417] Fix | Delete
[418] Fix | Delete
RUBY_SYMBOL_EXPORT_END
[419] Fix | Delete
[420] Fix | Delete
#if defined(__cplusplus)
[421] Fix | Delete
#if 0
[422] Fix | Delete
{ /* satisfy cc-mode */
[423] Fix | Delete
#endif
[424] Fix | Delete
} /* extern "C" { */
[425] Fix | Delete
#endif
[426] Fix | Delete
[427] Fix | Delete
#endif /* RUBY_ENCODING_H */
[428] Fix | Delete
[429] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function