Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
encoding.h
Go to the documentation of this file.
1/**********************************************************************
2
3 encoding.h -
4
5 $Author: matz $
6 created at: Thu May 24 11:49:41 JST 2007
7
8 Copyright (C) 2007 Yukihiro Matsumoto
9
10**********************************************************************/
11
12#ifndef RUBY_ENCODING_H
13#define RUBY_ENCODING_H 1
14
15#ifdef RUBY_INTERNAL_H
16#error "Include this file before internal.h"
17#endif
18
19#if defined(__cplusplus)
20extern "C" {
21#if 0
22} /* satisfy cc-mode */
23#endif
24#endif
25
26#include <stdarg.h>
27#include "ruby/ruby.h"
28#include "ruby/oniguruma.h"
29
31
36 /* RUBY_FL_USER10..RUBY_FL_USER16 */),
38};
39
40#define ENCODING_INLINE_MAX RUBY_ENCODING_INLINE_MAX
41#define ENCODING_SHIFT RUBY_ENCODING_SHIFT
42#define ENCODING_MASK RUBY_ENCODING_MASK
43
44#define RB_ENCODING_SET_INLINED(obj,i) do {\
45 RBASIC(obj)->flags &= ~RUBY_ENCODING_MASK;\
46 RBASIC(obj)->flags |= (VALUE)(i) << RUBY_ENCODING_SHIFT;\
47} while (0)
48#define RB_ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
49
50#define RB_ENCODING_GET_INLINED(obj) \
51 (int)((RBASIC(obj)->flags & RUBY_ENCODING_MASK)>>RUBY_ENCODING_SHIFT)
52#define RB_ENCODING_GET(obj) \
53 (RB_ENCODING_GET_INLINED(obj) != RUBY_ENCODING_INLINE_MAX ? \
54 RB_ENCODING_GET_INLINED(obj) : \
55 rb_enc_get_index(obj))
56
57#define RB_ENCODING_IS_ASCII8BIT(obj) (RB_ENCODING_GET_INLINED(obj) == 0)
58
59#define ENCODING_SET_INLINED(obj,i) RB_ENCODING_SET_INLINED(obj,i)
60#define ENCODING_SET(obj,i) RB_ENCODING_SET(obj,i)
61#define ENCODING_GET_INLINED(obj) RB_ENCODING_GET_INLINED(obj)
62#define ENCODING_GET(obj) RB_ENCODING_GET(obj)
63#define ENCODING_IS_ASCII8BIT(obj) RB_ENCODING_IS_ASCII8BIT(obj)
64#define ENCODING_MAXNAMELEN RUBY_ENCODING_MAXNAMELEN
65
68 RUBY_ENC_CODERANGE_7BIT = ((int)RUBY_FL_USER8),
69 RUBY_ENC_CODERANGE_VALID = ((int)RUBY_FL_USER9),
70 RUBY_ENC_CODERANGE_BROKEN = ((int)(RUBY_FL_USER8|RUBY_FL_USER9)),
74};
75
76static inline int
77rb_enc_coderange_clean_p(int cr)
78{
79 return (cr ^ (cr >> 1)) & RUBY_ENC_CODERANGE_7BIT;
80}
81#define RB_ENC_CODERANGE_CLEAN_P(cr) rb_enc_coderange_clean_p(cr)
82#define RB_ENC_CODERANGE(obj) ((int)RBASIC(obj)->flags & RUBY_ENC_CODERANGE_MASK)
83#define RB_ENC_CODERANGE_ASCIIONLY(obj) (RB_ENC_CODERANGE(obj) == RUBY_ENC_CODERANGE_7BIT)
84#define RB_ENC_CODERANGE_SET(obj,cr) (\
85 RBASIC(obj)->flags = \
86 (RBASIC(obj)->flags & ~RUBY_ENC_CODERANGE_MASK) | (cr))
87#define RB_ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_SET((obj),0)
88
89/* assumed ASCII compatibility */
90#define RB_ENC_CODERANGE_AND(a, b) \
91 ((a) == RUBY_ENC_CODERANGE_7BIT ? (b) : \
92 (a) != RUBY_ENC_CODERANGE_VALID ? RUBY_ENC_CODERANGE_UNKNOWN : \
93 (b) == RUBY_ENC_CODERANGE_7BIT ? RUBY_ENC_CODERANGE_VALID : (b))
94
95#define RB_ENCODING_CODERANGE_SET(obj, encindex, cr) \
96 do { \
97 VALUE rb_encoding_coderange_obj = (obj); \
98 RB_ENCODING_SET(rb_encoding_coderange_obj, (encindex)); \
99 RB_ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \
100 } while (0)
101
102#define ENC_CODERANGE_MASK RUBY_ENC_CODERANGE_MASK
103#define ENC_CODERANGE_UNKNOWN RUBY_ENC_CODERANGE_UNKNOWN
104#define ENC_CODERANGE_7BIT RUBY_ENC_CODERANGE_7BIT
105#define ENC_CODERANGE_VALID RUBY_ENC_CODERANGE_VALID
106#define ENC_CODERANGE_BROKEN RUBY_ENC_CODERANGE_BROKEN
107#define ENC_CODERANGE_CLEAN_P(cr) RB_ENC_CODERANGE_CLEAN_P(cr)
108#define ENC_CODERANGE(obj) RB_ENC_CODERANGE(obj)
109#define ENC_CODERANGE_ASCIIONLY(obj) RB_ENC_CODERANGE_ASCIIONLY(obj)
110#define ENC_CODERANGE_SET(obj,cr) RB_ENC_CODERANGE_SET(obj,cr)
111#define ENC_CODERANGE_CLEAR(obj) RB_ENC_CODERANGE_CLEAR(obj)
112#define ENC_CODERANGE_AND(a, b) RB_ENC_CODERANGE_AND(a, b)
113#define ENCODING_CODERANGE_SET(obj, encindex, cr) RB_ENCODING_CODERANGE_SET(obj, encindex, cr)
114
116
117int rb_char_to_option_kcode(int c, int *option, int *kcode);
118
119int rb_enc_replicate(const char *, rb_encoding *);
120int rb_define_dummy_encoding(const char *);
124void rb_enc_set_index(VALUE obj, int encindex);
126int rb_enc_find_index(const char *name);
127int rb_enc_alias(const char *alias, const char *orig);
136void rb_enc_copy(VALUE dst, VALUE src);
137
138VALUE rb_enc_str_new(const char*, long, rb_encoding*);
140VALUE rb_enc_str_new_static(const char*, long, rb_encoding*);
141VALUE rb_enc_reg_new(const char*, long, rb_encoding*, int);
142PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3);
144long rb_enc_strlen(const char*, const char*, rb_encoding*);
145char* rb_enc_nth(const char*, const char*, long, rb_encoding*);
147VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc);
148VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc);
149
153VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts);
154
155#ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
156#define rb_enc_str_new(str, len, enc) RB_GNUC_EXTENSION_BLOCK( \
157 (__builtin_constant_p(str) && __builtin_constant_p(len)) ? \
158 rb_enc_str_new_static((str), (len), (enc)) : \
159 rb_enc_str_new((str), (len), (enc)) \
160)
161#define rb_enc_str_new_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \
162 (__builtin_constant_p(str)) ? \
163 rb_enc_str_new_static((str), (long)strlen(str), (enc)) : \
164 rb_enc_str_new_cstr((str), (enc)) \
165)
166#endif
167
168PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4);
169
170/* index -> rb_encoding */
172
173/* name -> rb_encoding */
174rb_encoding *rb_enc_find(const char *name);
175
176/* rb_encoding * -> name */
177#define rb_enc_name(enc) (enc)->name
178
179/* rb_encoding * -> minlen/maxlen */
180#define rb_enc_mbminlen(enc) (enc)->min_enc_len
181#define rb_enc_mbmaxlen(enc) (enc)->max_enc_len
182
183/* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */
184int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc);
185
186/* -> mbclen (only for valid encoding) */
187int rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc);
188
189/* -> chlen, invalid or needmore */
190int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc);
191#define MBCLEN_CHARFOUND_P(ret) ONIGENC_MBCLEN_CHARFOUND_P(ret)
192#define MBCLEN_CHARFOUND_LEN(ret) ONIGENC_MBCLEN_CHARFOUND_LEN(ret)
193#define MBCLEN_INVALID_P(ret) ONIGENC_MBCLEN_INVALID_P(ret)
194#define MBCLEN_NEEDMORE_P(ret) ONIGENC_MBCLEN_NEEDMORE_P(ret)
195#define MBCLEN_NEEDMORE_LEN(ret) ONIGENC_MBCLEN_NEEDMORE_LEN(ret)
196
197/* -> 0x00..0x7f, -1 */
198int rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc);
199
200
201/* -> code (and len) or raise exception */
202unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_encoding *enc);
203
204/* prototype for obsolete function */
205unsigned int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc);
206/* overriding macro */
207#define rb_enc_codepoint(p,e,enc) rb_enc_codepoint_len((p),(e),0,(enc))
208#define rb_enc_mbc_to_codepoint(p, e, enc) ONIGENC_MBC_TO_CODE((enc),(UChar*)(p),(UChar*)(e))
209
210/* -> codelen>0 or raise exception */
211int rb_enc_codelen(int code, rb_encoding *enc);
212/* -> 0 for invalid codepoint */
213int rb_enc_code_to_mbclen(int code, rb_encoding *enc);
214#define rb_enc_code_to_mbclen(c, enc) ONIGENC_CODE_TO_MBCLEN((enc), (c));
215
216/* code,ptr,encoding -> write buf */
217#define rb_enc_mbcput(c,buf,enc) ONIGENC_CODE_TO_MBC((enc),(c),(UChar*)(buf))
218
219/* start, ptr, end, encoding -> prev_char */
220#define rb_enc_prev_char(s,p,e,enc) ((char *)onigenc_get_prev_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
221/* start, ptr, end, encoding -> next_char */
222#define rb_enc_left_char_head(s,p,e,enc) ((char *)onigenc_get_left_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
223#define rb_enc_right_char_head(s,p,e,enc) ((char *)onigenc_get_right_adjust_char_head((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e)))
224#define rb_enc_step_back(s,p,e,n,enc) ((char *)onigenc_step_back((enc),(UChar*)(s),(UChar*)(p),(UChar*)(e),(int)(n)))
225
226/* ptr, ptr, encoding -> newline_or_not */
227#define rb_enc_is_newline(p,end,enc) ONIGENC_IS_MBC_NEWLINE((enc),(UChar*)(p),(UChar*)(end))
228
229#define rb_enc_isctype(c,t,enc) ONIGENC_IS_CODE_CTYPE((enc),(c),(t))
230#define rb_enc_isascii(c,enc) ONIGENC_IS_CODE_ASCII(c)
231#define rb_enc_isalpha(c,enc) ONIGENC_IS_CODE_ALPHA((enc),(c))
232#define rb_enc_islower(c,enc) ONIGENC_IS_CODE_LOWER((enc),(c))
233#define rb_enc_isupper(c,enc) ONIGENC_IS_CODE_UPPER((enc),(c))
234#define rb_enc_ispunct(c,enc) ONIGENC_IS_CODE_PUNCT((enc),(c))
235#define rb_enc_isalnum(c,enc) ONIGENC_IS_CODE_ALNUM((enc),(c))
236#define rb_enc_isprint(c,enc) ONIGENC_IS_CODE_PRINT((enc),(c))
237#define rb_enc_isspace(c,enc) ONIGENC_IS_CODE_SPACE((enc),(c))
238#define rb_enc_isdigit(c,enc) ONIGENC_IS_CODE_DIGIT((enc),(c))
239
240static inline int
241rb_enc_asciicompat_inline(rb_encoding *enc)
242{
243 return rb_enc_mbminlen(enc)==1 && !rb_enc_dummy_p(enc);
244}
245#define rb_enc_asciicompat(enc) rb_enc_asciicompat_inline(enc)
246
247int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc);
249CONSTFUNC(int rb_enc_tolower(int c, rb_encoding *enc));
250ID rb_intern3(const char*, long, rb_encoding*);
251ID rb_interned_id_p(const char *, long, rb_encoding *);
252int rb_enc_symname_p(const char*, rb_encoding*);
253int rb_enc_symname2_p(const char*, long, rb_encoding*);
255long rb_str_coderange_scan_restartable(const char*, const char*, rb_encoding*, int*);
257#define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str))
267#ifndef rb_ascii8bit_encindex
269#endif
270#ifndef rb_utf8_encindex
271CONSTFUNC(int rb_utf8_encindex(void));
272#endif
273#ifndef rb_usascii_encindex
275#endif
276int rb_locale_encindex(void);
277int rb_filesystem_encindex(void);
283long rb_memsearch(const void*,long,const void*,long,rb_encoding*);
284char *rb_enc_path_next(const char *,const char *,rb_encoding*);
285char *rb_enc_path_skip_prefix(const char *,const char *,rb_encoding*);
286char *rb_enc_path_last_separator(const char *,const char *,rb_encoding*);
287char *rb_enc_path_end(const char *,const char *,rb_encoding*);
288const char *ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc);
289const char *ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc);
290ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc);
291VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc);
292
294
295/* econv stuff */
296
297typedef enum {
306
307typedef struct rb_econv_t rb_econv_t;
308
309VALUE rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts);
310int rb_econv_has_convpath_p(const char* from_encoding, const char* to_encoding);
311
312int rb_econv_prepare_options(VALUE opthash, VALUE *ecopts, int ecflags);
313int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts);
314
315rb_econv_t *rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags);
316rb_econv_t *rb_econv_open_opts(const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts);
317
319 const unsigned char **source_buffer_ptr, const unsigned char *source_buffer_end,
320 unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end,
321 int flags);
322void rb_econv_close(rb_econv_t *ec);
323
324/* result: 0:success -1:failure */
325int rb_econv_set_replacement(rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname);
326
327/* result: 0:success -1:failure */
328int rb_econv_decorate_at_first(rb_econv_t *ec, const char *decorator_name);
329int rb_econv_decorate_at_last(rb_econv_t *ec, const char *decorator_name);
330
331VALUE rb_econv_open_exc(const char *senc, const char *denc, int ecflags);
332
333/* result: 0:success -1:failure */
335 const unsigned char *str, size_t len, const char *str_encoding);
336
337/* encoding that rb_econv_insert_output doesn't need conversion */
339
340/* raise an error if the last rb_econv_convert is error */
342
343/* returns an exception object or nil */
345
347void rb_econv_putback(rb_econv_t *ec, unsigned char *p, int n);
348
349/* returns the corresponding ASCII compatible encoding for encname,
350 * or NULL if encname is not ASCII incompatible encoding. */
351const char *rb_econv_asciicompat_encoding(const char *encname);
352
354VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
356VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
357VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE dst, int flags);
358
360
362/* flags for rb_econv_open */
364
367
371
376
382
385
387#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
389#else
390 0,
391#endif
392#define ECONV_ERROR_HANDLER_MASK RUBY_ECONV_ERROR_HANDLER_MASK
393#define ECONV_INVALID_MASK RUBY_ECONV_INVALID_MASK
394#define ECONV_INVALID_REPLACE RUBY_ECONV_INVALID_REPLACE
395#define ECONV_UNDEF_MASK RUBY_ECONV_UNDEF_MASK
396#define ECONV_UNDEF_REPLACE RUBY_ECONV_UNDEF_REPLACE
397#define ECONV_UNDEF_HEX_CHARREF RUBY_ECONV_UNDEF_HEX_CHARREF
398#define ECONV_DECORATOR_MASK RUBY_ECONV_DECORATOR_MASK
399#define ECONV_NEWLINE_DECORATOR_MASK RUBY_ECONV_NEWLINE_DECORATOR_MASK
400#define ECONV_NEWLINE_DECORATOR_READ_MASK RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK
401#define ECONV_NEWLINE_DECORATOR_WRITE_MASK RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK
402#define ECONV_UNIVERSAL_NEWLINE_DECORATOR RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR
403#define ECONV_CRLF_NEWLINE_DECORATOR RUBY_ECONV_CRLF_NEWLINE_DECORATOR
404#define ECONV_CR_NEWLINE_DECORATOR RUBY_ECONV_CR_NEWLINE_DECORATOR
405#define ECONV_XML_TEXT_DECORATOR RUBY_ECONV_XML_TEXT_DECORATOR
406#define ECONV_XML_ATTR_CONTENT_DECORATOR RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR
407#define ECONV_STATEFUL_DECORATOR_MASK RUBY_ECONV_STATEFUL_DECORATOR_MASK
408#define ECONV_XML_ATTR_QUOTE_DECORATOR RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR
409#define ECONV_DEFAULT_NEWLINE_DECORATOR RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR
410/* end of flags for rb_econv_open */
411
412/* flags for rb_econv_convert */
415#define ECONV_PARTIAL_INPUT RUBY_ECONV_PARTIAL_INPUT
416#define ECONV_AFTER_OUTPUT RUBY_ECONV_AFTER_OUTPUT
417/* end of flags for rb_econv_convert */
419
421
422#if defined(__cplusplus)
423#if 0
424{ /* satisfy cc-mode */
425#endif
426} /* extern "C" { */
427#endif
428
429#endif /* RUBY_ENCODING_H */
struct RIMemo * ptr
Definition: debug.c:65
int rb_enc_dummy_p(rb_encoding *enc)
Definition: encoding.c:131
int rb_utf8_encindex(void)
Definition: encoding.c:1334
int rb_ascii8bit_encindex(void)
Definition: encoding.c:1322
int rb_enc_unicode_p(rb_encoding *enc)
Definition: encoding.c:521
int rb_enc_to_index(rb_encoding *enc)
Definition: encoding.c:125
int rb_enc_tolower(int c, rb_encoding *enc)
Definition: encoding.c:1112
int rb_enc_toupper(int c, rb_encoding *enc)
Definition: encoding.c:1106
int rb_usascii_encindex(void)
Definition: encoding.c:1346
int rb_econv_prepare_options(VALUE opthash, VALUE *ecopts, int ecflags)
Definition: transcode.c:2510
VALUE rb_obj_encoding(VALUE)
Definition: encoding.c:1004
ruby_coderange_type
Definition: encoding.h:66
@ RUBY_ENC_CODERANGE_MASK
Definition: encoding.h:71
@ RUBY_ENC_CODERANGE_VALID
Definition: encoding.h:69
@ RUBY_ENC_CODERANGE_7BIT
Definition: encoding.h:68
@ RUBY_ENC_CODERANGE_UNKNOWN
Definition: encoding.h:67
@ RUBY_ENC_CODERANGE_BROKEN
Definition: encoding.h:70
int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc)
Definition: encoding.c:1032
rb_encoding * rb_to_encoding(VALUE)
Definition: encoding.c:245
VALUE rb_econv_open_exc(const char *senc, const char *denc, int ecflags)
Definition: transcode.c:2019
int rb_enc_get_index(VALUE obj)
Definition: encoding.c:779
int rb_filesystem_encindex(void)
Definition: encoding.c:1378
const char * ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc)
Definition: file.c:4563
rb_encoding * rb_utf8_encoding(void)
Definition: encoding.c:1328
const char * rb_econv_encoding_to_insert_output(rb_econv_t *ec)
Definition: transcode.c:1486
VALUE rb_enc_associate(VALUE, rb_encoding *)
Definition: encoding.c:866
int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts)
Definition: transcode.c:2555
VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to)
Definition: string.c:1030
rb_encoding * rb_ascii8bit_encoding(void)
Definition: encoding.c:1316
VALUE rb_enc_str_new_cstr(const char *, rb_encoding *)
Definition: string.c:836
int rb_enc_codelen(int code, rb_encoding *enc)
Definition: encoding.c:1089
ID rb_intern3(const char *, long, rb_encoding *)
Definition: symbol.c:603
int rb_enc_replicate(const char *, rb_encoding *)
Definition: encoding.c:402
const OnigEncodingType rb_encoding
Definition: encoding.h:115
rb_encoding * rb_filesystem_encoding(void)
Definition: encoding.c:1387
char * rb_enc_path_end(const char *, const char *, rb_encoding *)
Definition: file.c:3480
ruby_encoding_consts
Definition: encoding.h:32
@ RUBY_ENCODING_MASK
Definition: encoding.h:35
@ RUBY_ENCODING_MAXNAMELEN
Definition: encoding.h:37
@ RUBY_ENCODING_SHIFT
Definition: encoding.h:34
@ RUBY_ENCODING_INLINE_MAX
Definition: encoding.h:33
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)
Definition: transcode.c:1429
VALUE rb_enc_vsprintf(rb_encoding *, const char *, va_list)
Definition: sprintf.c:1145
rb_econv_result_t
Definition: encoding.h:297
@ econv_incomplete_input
Definition: encoding.h:304
@ econv_finished
Definition: encoding.h:302
@ econv_undefined_conversion
Definition: encoding.h:299
@ econv_after_output
Definition: encoding.h:303
@ econv_source_buffer_empty
Definition: encoding.h:301
@ econv_destination_buffer_full
Definition: encoding.h:300
@ econv_invalid_byte_sequence
Definition: encoding.h:298
int rb_econv_putbackable(rb_econv_t *ec)
Definition: transcode.c:1725
rb_encoding * rb_default_internal_encoding(void)
Definition: encoding.c:1512
void rb_enc_copy(VALUE dst, VALUE src)
Definition: encoding.c:990
int rb_econv_has_convpath_p(const char *from_encoding, const char *to_encoding)
Definition: transcode.c:3167
rb_econv_t * rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags)
Definition: transcode.c:1052
int rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc)
Definition: encoding.c:1014
VALUE rb_enc_reg_new(const char *, long, rb_encoding *, int)
Definition: re.c:2933
long rb_memsearch(const void *, long, const void *, long, rb_encoding *)
Definition: re.c:239
int rb_define_dummy_encoding(const char *)
Definition: encoding.c:462
rb_encoding * rb_enc_from_index(int idx)
Definition: encoding.c:609
int rb_enc_symname2_p(const char *, long, rb_encoding *)
Definition: symbol.c:339
CONSTFUNC(int rb_enc_toupper(int c, rb_encoding *enc))
int rb_enc_str_coderange(VALUE)
Definition: string.c:657
VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags)
Definition: transcode.c:1848
unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_encoding *enc)
Definition: encoding.c:1068
VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
Definition: numeric.c:3380
VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags)
Definition: transcode.c:1839
VALUE rb_enc_str_new(const char *, long, rb_encoding *)
Definition: string.c:796
rb_encoding * rb_find_encoding(VALUE)
Definition: encoding.c:252
VALUE rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
Definition: string.c:914
int rb_enc_symname_p(const char *, rb_encoding *)
Definition: symbol.c:188
void rb_enc_set_index(VALUE obj, int encindex)
Definition: encoding.c:830
rb_encoding * rb_enc_get(VALUE)
Definition: encoding.c:872
VALUE rb_locale_charmap(VALUE klass)
Definition: localeinit.c:91
const char * rb_econv_asciicompat_encoding(const char *encname)
Definition: transcode.c:1769
void rb_enc_set_default_internal(VALUE encoding)
Definition: encoding.c:1563
VALUE rb_enc_default_external(void)
Definition: encoding.c:1441
char * rb_enc_path_next(const char *, const char *, rb_encoding *)
Definition: file.c:3398
int rb_econv_insert_output(rb_econv_t *ec, const unsigned char *str, size_t len, const char *str_encoding)
Definition: transcode.c:1570
VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags)
Definition: transcode.c:1860
rb_econv_t * rb_econv_open_opts(const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts)
Definition: transcode.c:2561
rb_encoding * rb_enc_find(const char *name)
Definition: encoding.c:728
VALUE rb_enc_from_encoding(rb_encoding *enc)
Definition: encoding.c:116
VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc)
Definition: string.c:2919
char * rb_enc_path_last_separator(const char *, const char *, rb_encoding *)
Definition: file.c:3446
int rb_to_encoding_index(VALUE)
Definition: encoding.c:197
int rb_econv_decorate_at_last(rb_econv_t *ec, const char *decorator_name)
Definition: transcode.c:1908
VALUE rb_enc_str_new_static(const char *, long, rb_encoding *)
Definition: string.c:890
void rb_econv_binmode(rb_econv_t *ec)
Definition: transcode.c:1925
#define rb_enc_codepoint(p, e, enc)
Definition: encoding.h:207
int rb_econv_decorate_at_first(rb_econv_t *ec, const char *decorator_name)
Definition: transcode.c:1891
VALUE rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts)
Definition: transcode.c:2870
rb_encoding * rb_default_external_encoding(void)
Definition: encoding.c:1427
int rb_enc_str_asciionly_p(VALUE)
Definition: string.c:678
PUREFUNC(int rb_enc_dummy_p(rb_encoding *enc))
int rb_locale_encindex(void)
Definition: encoding.c:1354
VALUE rb_econv_make_exception(rb_econv_t *ec)
Definition: transcode.c:4218
int rb_char_to_option_kcode(int c, int *option, int *kcode)
Definition: re.c:319
rb_encoding * rb_enc_check(VALUE, VALUE)
Definition: encoding.c:891
#define rb_enc_code_to_mbclen(c, enc)
Definition: encoding.h:214
void rb_econv_check_error(rb_econv_t *ec)
Definition: transcode.c:4224
const char * ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc)
Definition: file.c:4760
VALUE rb_enc_associate_index(VALUE, int)
Definition: encoding.c:838
int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc)
Definition: encoding.c:1020
char * rb_enc_path_skip_prefix(const char *, const char *, rb_encoding *)
Definition: file.c:3412
int rb_enc_capable(VALUE obj)
Definition: encoding.c:753
#define rb_enc_mbminlen(enc)
Definition: encoding.h:180
VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags)
Definition: transcode.c:1854
VALUE rb_enc_default_internal(void)
Definition: encoding.c:1521
PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char *,...), 2, 3)
VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc)
Definition: symbol.c:999
long rb_enc_strlen(const char *, const char *, rb_encoding *)
Definition: string.c:1740
long rb_str_coderange_scan_restartable(const char *, const char *, rb_encoding *, int *)
Definition: string.c:567
rb_encoding * rb_locale_encoding(void)
Definition: encoding.c:1372
rb_encoding * rb_enc_compatible(VALUE, VALUE)
Definition: encoding.c:974
rb_encoding * rb_usascii_encoding(void)
Definition: encoding.c:1340
void rb_enc_set_default_external(VALUE encoding)
Definition: encoding.c:1479
void rb_econv_close(rb_econv_t *ec)
Definition: transcode.c:1685
int rb_enc_find_index(const char *name)
Definition: encoding.c:693
int rb_enc_alias(const char *alias, const char *orig)
Definition: encoding.c:553
VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE dst, int flags)
Definition: transcode.c:1796
RUBY_EXTERN VALUE rb_cEncoding
Definition: encoding.h:293
ID rb_interned_id_p(const char *, long, rb_encoding *)
VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *)
Definition: string.c:1036
ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
Definition: symbol.c:988
void rb_econv_putback(rb_econv_t *ec, unsigned char *p, int n)
Definition: transcode.c:1736
char * rb_enc_nth(const char *, const char *, long, rb_encoding *)
Definition: string.c:2388
int rb_econv_set_replacement(rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname)
Definition: transcode.c:2181
int rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc)
Definition: encoding.c:1044
int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc)
VALUE rb_str_export_to_enc(VALUE, rb_encoding *)
Definition: string.c:1135
ruby_econv_flag_type
Definition: encoding.h:361
@ RUBY_ECONV_STATEFUL_DECORATOR_MASK
Definition: encoding.h:383
@ RUBY_ECONV_CRLF_NEWLINE_DECORATOR
Definition: encoding.h:378
@ RUBY_ECONV_AFTER_OUTPUT
Definition: encoding.h:414
@ RUBY_ECONV_FLAGS_PLACEHOLDER
Definition: encoding.h:418
@ RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK
Definition: encoding.h:375
@ RUBY_ECONV_ERROR_HANDLER_MASK
Definition: encoding.h:363
@ RUBY_ECONV_UNDEF_MASK
Definition: encoding.h:368
@ RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR
Definition: encoding.h:381
@ RUBY_ECONV_INVALID_REPLACE
Definition: encoding.h:366
@ RUBY_ECONV_XML_TEXT_DECORATOR
Definition: encoding.h:380
@ RUBY_ECONV_NEWLINE_DECORATOR_MASK
Definition: encoding.h:373
@ RUBY_ECONV_UNDEF_HEX_CHARREF
Definition: encoding.h:370
@ RUBY_ECONV_PARTIAL_INPUT
Definition: encoding.h:413
@ RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR
Definition: encoding.h:377
@ RUBY_ECONV_INVALID_MASK
Definition: encoding.h:365
@ RUBY_ECONV_UNDEF_REPLACE
Definition: encoding.h:369
@ RUBY_ECONV_DECORATOR_MASK
Definition: encoding.h:372
@ RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR
Definition: encoding.h:384
@ RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR
Definition: encoding.h:386
@ RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK
Definition: encoding.h:374
@ RUBY_ECONV_CR_NEWLINE_DECORATOR
Definition: encoding.h:379
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
@ RUBY_FL_USHIFT
Definition: ruby.h:853
void rb_enc_raise(rb_encoding *enc, VALUE exc, const char *fmt,...)
Definition: error.c:2652
const char * name
Definition: nkf.c:208
const char * alias
Definition: nkf.c:1159
const VALUE VALUE obj
const char size_t n
#define RUBY_SYMBOL_EXPORT_BEGIN
__inline__ const void *__restrict__ src
__inline__ const void *__restrict__ size_t len
#define NORETURN(x)
__gnuc_va_list va_list
#define RUBY_SYMBOL_EXPORT_END
__inline__ int
#define RUBY_EXTERN
unsigned long ID
unsigned long VALUE
Definition: ruby.h:102
VALUE rb_enc_sprintf(rb_encoding *enc, const char *format,...)
Definition: sprintf.c:1178
const char * source_encoding
Definition: transcode.c:137
const char * destination_encoding
Definition: transcode.c:138