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)
20 extern "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 
30 RUBY_SYMBOL_EXPORT_BEGIN
31 
32 enum ruby_encoding_consts {
33     RUBY_ENCODING_INLINE_MAX = 127,
34     RUBY_ENCODING_SHIFT = (RUBY_FL_USHIFT+10),
35     RUBY_ENCODING_MASK = (RUBY_ENCODING_INLINE_MAX<<RUBY_ENCODING_SHIFT
36 			  /* RUBY_FL_USER10..RUBY_FL_USER16 */),
37     RUBY_ENCODING_MAXNAMELEN = 42
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 
66 enum ruby_coderange_type {
67     RUBY_ENC_CODERANGE_UNKNOWN	= 0,
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)),
71     RUBY_ENC_CODERANGE_MASK	= (RUBY_ENC_CODERANGE_7BIT|
72 				   RUBY_ENC_CODERANGE_VALID|
73 				   RUBY_ENC_CODERANGE_BROKEN)
74 };
75 
76 static inline int
rb_enc_coderange_clean_p(int cr)77 rb_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 
115 typedef const OnigEncodingType rb_encoding;
116 
117 int rb_char_to_option_kcode(int c, int *option, int *kcode);
118 
119 int rb_enc_replicate(const char *, rb_encoding *);
120 int rb_define_dummy_encoding(const char *);
121 PUREFUNC(int rb_enc_dummy_p(rb_encoding *enc));
122 PUREFUNC(int rb_enc_to_index(rb_encoding *enc));
123 int rb_enc_get_index(VALUE obj);
124 void rb_enc_set_index(VALUE obj, int encindex);
125 int rb_enc_capable(VALUE obj);
126 int rb_enc_find_index(const char *name);
127 int rb_enc_alias(const char *alias, const char *orig);
128 int rb_to_encoding_index(VALUE);
129 rb_encoding *rb_to_encoding(VALUE);
130 rb_encoding *rb_find_encoding(VALUE);
131 rb_encoding *rb_enc_get(VALUE);
132 rb_encoding *rb_enc_compatible(VALUE,VALUE);
133 rb_encoding *rb_enc_check(VALUE,VALUE);
134 VALUE rb_enc_associate_index(VALUE, int);
135 VALUE rb_enc_associate(VALUE, rb_encoding*);
136 void rb_enc_copy(VALUE dst, VALUE src);
137 
138 VALUE rb_enc_str_new(const char*, long, rb_encoding*);
139 VALUE rb_enc_str_new_cstr(const char*, rb_encoding*);
140 VALUE rb_enc_str_new_static(const char*, long, rb_encoding*);
141 VALUE rb_enc_reg_new(const char*, long, rb_encoding*, int);
142 PRINTF_ARGS(VALUE rb_enc_sprintf(rb_encoding *, const char*, ...), 2, 3);
143 VALUE rb_enc_vsprintf(rb_encoding *, const char*, va_list);
144 long rb_enc_strlen(const char*, const char*, rb_encoding*);
145 char* rb_enc_nth(const char*, const char*, long, rb_encoding*);
146 VALUE rb_obj_encoding(VALUE);
147 VALUE rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *enc);
148 VALUE rb_enc_uint_chr(unsigned int code, rb_encoding *enc);
149 
150 VALUE rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *);
151 VALUE rb_str_export_to_enc(VALUE, rb_encoding *);
152 VALUE rb_str_conv_enc(VALUE str, rb_encoding *from, rb_encoding *to);
153 VALUE 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 
168 PRINTF_ARGS(NORETURN(void rb_enc_raise(rb_encoding *, VALUE, const char*, ...)), 3, 4);
169 
170 /* index -> rb_encoding */
171 rb_encoding *rb_enc_from_index(int idx);
172 
173 /* name -> rb_encoding */
174 rb_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) */
184 int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc);
185 
186 /* -> mbclen (only for valid encoding) */
187 int rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc);
188 
189 /* -> chlen, invalid or needmore */
190 int 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 */
198 int rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc);
199 
200 
201 /* -> code (and len) or raise exception */
202 unsigned int rb_enc_codepoint_len(const char *p, const char *e, int *len, rb_encoding *enc);
203 
204 /* prototype for obsolete function */
205 unsigned 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 */
211 int rb_enc_codelen(int code, rb_encoding *enc);
212 /* -> 0 for invalid codepoint */
213 int 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 
240 static inline int
rb_enc_asciicompat_inline(rb_encoding * enc)241 rb_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 
247 int rb_enc_casefold(char *to, const char *p, const char *e, rb_encoding *enc);
248 CONSTFUNC(int rb_enc_toupper(int c, rb_encoding *enc));
249 CONSTFUNC(int rb_enc_tolower(int c, rb_encoding *enc));
250 ID rb_intern3(const char*, long, rb_encoding*);
251 ID rb_interned_id_p(const char *, long, rb_encoding *);
252 int rb_enc_symname_p(const char*, rb_encoding*);
253 int rb_enc_symname2_p(const char*, long, rb_encoding*);
254 int rb_enc_str_coderange(VALUE);
255 long rb_str_coderange_scan_restartable(const char*, const char*, rb_encoding*, int*);
256 int rb_enc_str_asciionly_p(VALUE);
257 #define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str))
258 VALUE rb_enc_from_encoding(rb_encoding *enc);
259 PUREFUNC(int rb_enc_unicode_p(rb_encoding *enc));
260 rb_encoding *rb_ascii8bit_encoding(void);
261 rb_encoding *rb_utf8_encoding(void);
262 rb_encoding *rb_usascii_encoding(void);
263 rb_encoding *rb_locale_encoding(void);
264 rb_encoding *rb_filesystem_encoding(void);
265 rb_encoding *rb_default_external_encoding(void);
266 rb_encoding *rb_default_internal_encoding(void);
267 #ifndef rb_ascii8bit_encindex
268 CONSTFUNC(int rb_ascii8bit_encindex(void));
269 #endif
270 #ifndef rb_utf8_encindex
271 CONSTFUNC(int rb_utf8_encindex(void));
272 #endif
273 #ifndef rb_usascii_encindex
274 CONSTFUNC(int rb_usascii_encindex(void));
275 #endif
276 int rb_locale_encindex(void);
277 int rb_filesystem_encindex(void);
278 VALUE rb_enc_default_external(void);
279 VALUE rb_enc_default_internal(void);
280 void rb_enc_set_default_external(VALUE encoding);
281 void rb_enc_set_default_internal(VALUE encoding);
282 VALUE rb_locale_charmap(VALUE klass);
283 long rb_memsearch(const void*,long,const void*,long,rb_encoding*);
284 char *rb_enc_path_next(const char *,const char *,rb_encoding*);
285 char *rb_enc_path_skip_prefix(const char *,const char *,rb_encoding*);
286 char *rb_enc_path_last_separator(const char *,const char *,rb_encoding*);
287 char *rb_enc_path_end(const char *,const char *,rb_encoding*);
288 const char *ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encoding *enc);
289 const char *ruby_enc_find_extname(const char *name, long *len, rb_encoding *enc);
290 ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc);
291 VALUE rb_check_symbol_cstr(const char *ptr, long len, rb_encoding *enc);
292 
293 RUBY_EXTERN VALUE rb_cEncoding;
294 
295 /* econv stuff */
296 
297 typedef enum {
298     econv_invalid_byte_sequence,
299     econv_undefined_conversion,
300     econv_destination_buffer_full,
301     econv_source_buffer_empty,
302     econv_finished,
303     econv_after_output,
304     econv_incomplete_input
305 } rb_econv_result_t;
306 
307 typedef struct rb_econv_t rb_econv_t;
308 
309 VALUE rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts);
310 int rb_econv_has_convpath_p(const char* from_encoding, const char* to_encoding);
311 
312 int rb_econv_prepare_options(VALUE opthash, VALUE *ecopts, int ecflags);
313 int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts);
314 
315 rb_econv_t *rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags);
316 rb_econv_t *rb_econv_open_opts(const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts);
317 
318 rb_econv_result_t rb_econv_convert(rb_econv_t *ec,
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);
322 void rb_econv_close(rb_econv_t *ec);
323 
324 /* result: 0:success -1:failure */
325 int 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 */
328 int rb_econv_decorate_at_first(rb_econv_t *ec, const char *decorator_name);
329 int rb_econv_decorate_at_last(rb_econv_t *ec, const char *decorator_name);
330 
331 VALUE rb_econv_open_exc(const char *senc, const char *denc, int ecflags);
332 
333 /* result: 0:success -1:failure */
334 int rb_econv_insert_output(rb_econv_t *ec,
335     const unsigned char *str, size_t len, const char *str_encoding);
336 
337 /* encoding that rb_econv_insert_output doesn't need conversion */
338 const char *rb_econv_encoding_to_insert_output(rb_econv_t *ec);
339 
340 /* raise an error if the last rb_econv_convert is error */
341 void rb_econv_check_error(rb_econv_t *ec);
342 
343 /* returns an exception object or nil */
344 VALUE rb_econv_make_exception(rb_econv_t *ec);
345 
346 int rb_econv_putbackable(rb_econv_t *ec);
347 void 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. */
351 const char *rb_econv_asciicompat_encoding(const char *encname);
352 
353 VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags);
354 VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
355 VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags);
356 VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
357 VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE dst, int flags);
358 
359 void rb_econv_binmode(rb_econv_t *ec);
360 
361 enum ruby_econv_flag_type {
362 /* flags for rb_econv_open */
363     RUBY_ECONV_ERROR_HANDLER_MASK               = 0x000000ff,
364 
365     RUBY_ECONV_INVALID_MASK                     = 0x0000000f,
366     RUBY_ECONV_INVALID_REPLACE                  = 0x00000002,
367 
368     RUBY_ECONV_UNDEF_MASK                       = 0x000000f0,
369     RUBY_ECONV_UNDEF_REPLACE                    = 0x00000020,
370     RUBY_ECONV_UNDEF_HEX_CHARREF                = 0x00000030,
371 
372     RUBY_ECONV_DECORATOR_MASK                   = 0x0000ff00,
373     RUBY_ECONV_NEWLINE_DECORATOR_MASK           = 0x00003f00,
374     RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK      = 0x00000f00,
375     RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK     = 0x00003000,
376 
377     RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR      = 0x00000100,
378     RUBY_ECONV_CRLF_NEWLINE_DECORATOR           = 0x00001000,
379     RUBY_ECONV_CR_NEWLINE_DECORATOR             = 0x00002000,
380     RUBY_ECONV_XML_TEXT_DECORATOR               = 0x00004000,
381     RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR       = 0x00008000,
382 
383     RUBY_ECONV_STATEFUL_DECORATOR_MASK          = 0x00f00000,
384     RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR         = 0x00100000,
385 
386     RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR        =
387 #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
388 	RUBY_ECONV_CRLF_NEWLINE_DECORATOR,
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 */
413     RUBY_ECONV_PARTIAL_INPUT                    = 0x00010000,
414     RUBY_ECONV_AFTER_OUTPUT                     = 0x00020000,
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 */
418 RUBY_ECONV_FLAGS_PLACEHOLDER};
419 
420 RUBY_SYMBOL_EXPORT_END
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 */
430