Debian Codegraph @

include/ruby/internal/encoding/transcode.h

raw
1 #ifndef RUBY_INTERNAL_ENCODING_TRANSCODE_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RUBY_INTERNAL_ENCODING_TRANSCODE_H
3 /**
4 * @file
5 * @author Ruby developers <[email protected]>
6 * @copyright This file is a part of the programming language Ruby.
7 * Permission is hereby granted, to either redistribute and/or
8 * modify this file, provided that the conditions mentioned in the
9 * file COPYING are met. Consult the file for details.
10 * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11 * implementation details. Don't take them as canon. They could
12 * rapidly appear then vanish. The name (path) of this header file
13 * is also an implementation detail. Do not expect it to persist
14 * at the place it is now. Developers are free to move it anywhere
15 * anytime at will.
16 * @note To ruby-core: remember that this header can be possibly
17 * recursively included from extension libraries written in C++.
18 * Do not expect for instance `__VA_ARGS__` is always available.
19 * We assume C99 for ruby itself but we don't assume languages of
20 * extension libraries. They could be written in C++98.
21 * @brief econv stuff
22 */
23
24 #include "ruby/internal/dllexport.h"
25 #include "ruby/internal/value.h"
26
27 RBIMPL_SYMBOL_EXPORT_BEGIN()
28
29 /** return value of rb_econv_convert() */
30 typedef enum {
31
32 /**
33 * The conversion stopped when it found an invalid sequence.
34 */
35 econv_invalid_byte_sequence,
36
37 /**
38 * The conversion stopped when it found a character in the input which
39 * cannot be representable in the output.
40 */
41 econv_undefined_conversion,
42
43 /**
44 * The conversion stopped because there is no destination.
45 */
46 econv_destination_buffer_full,
47
48 /**
49 * The conversion stopped because there is no input.
50 */
51 econv_source_buffer_empty,
52
53 /**
54 * The conversion stopped after converting everything. This is arguably
55 * the expected normal end of conversion.
56 */
57 econv_finished,
58
59 /**
60 * The conversion stopped after writing something to somewhere, before
61 * reading everything.
62 */
63 econv_after_output,
64
65 /**
66 * The conversion stopped in middle of reading a character, possibly due to
67 * a partial read of a socket etc.
68 */
69 econv_incomplete_input
70 } rb_econv_result_t;
71
72 /** An opaque struct that represents a lowest level of encoding conversion. */
73 typedef struct rb_econv_t rb_econv_t;
74
75 /**
76 * Converts the contents of the passed string from its encoding to the passed
77 * one.
78 *
79 * @param[in] str Target string.
80 * @param[in] to Destination encoding.
81 * @param[in] ecflags A set of enum
82 * ::ruby_econv_flag_type.
83 * @param[in] ecopts A keyword hash, like
84 * ::rb_io_t::rb_io_enc_t::ecopts.
85 * @exception rb_eArgError Not fully converted.
86 * @exception rb_eInvalidByteSequenceError `str` is malformed.
87 * @exception rb_eUndefinedConversionError `str` has a character not
88 * representable using `to`.
89 * @exception rb_eConversionNotFoundError There is no known conversion from
90 * `str`'s encoding to `to`.
91 * @return A string whose encoding is `to`, and whose contents is converted
92 * contents of `str`.
93 * @note Use rb_econv_prepare_options() to generate `ecopts`.
94 */
95 VALUE rb_str_encode(VALUE str, VALUE to, int ecflags, VALUE ecopts);
96
97 /**
98 * Queries if there is more than one way to convert between the passed two
99 * encodings. Encoding conversion are has_and_belongs_to_many relationships.
100 * There could be no direct conversion defined for the passed pair. Ruby tries
101 * to find an indirect way to do so then. For instance ISO-8859-1 has no
102 * direct conversion to ISO-2022-JP. But there is ISO-8859-1 to UTF-8
103 * conversion; then there is UTF-8 to EUC-JP conversion; finally there also is
104 * EUC-JP to ISO-2022-JP conversion. So in short ISO-8859-1 can be converted
105 * to ISO-2022-JP using that path. This function returns true. Obviously not
106 * everything that can be represented using UTF-8 can also be represented using
107 * EUC-JP. Conversions in practice can fail depending on the actual input, and
108 * that renders exceptions in case of rb_str_encode().
109 *
110 * @param[in] from_encoding One encoding.
111 * @param[in] to_encoding Another encoding.
112 * @retval 0 No way to convert the two.
113 * @retval 1 At least one way to convert the two.
114 *
115 * @internal
116 *
117 * Practically @shyouhei knows no way for this function to return 0. It seems
118 * everything can eventually be converted to/from UTF-8, which connects
119 * everything.
120 */
121 int rb_econv_has_convpath_p(const char* from_encoding, const char* to_encoding);
122
123 /**
124 * Identical to rb_econv_prepare_opts(), except it additionally takes the
125 * initial value of flags. The extra bits are bitwise-ORed to the return
126 * value.
127 *
128 * @param[in] opthash Keyword arguments.
129 * @param[out] ecopts Return buffer.
130 * @param[in] ecflags Default set of enum ::ruby_econv_flag_type.
131 * @exception rb_eArgError Unknown/Broken values passed.
132 * @return Calculated set of enum ::ruby_econv_flag_type.
133 * @post `ecopts` holds a hash object suitable for
134 * ::rb_io_t::rb_io_enc_t::ecopts.
135 */
136 int rb_econv_prepare_options(VALUE opthash, VALUE *ecopts, int ecflags);
137
138 /**
139 * Splits a keyword arguments hash (that for instance `String#encode` took)
140 * into a set of enum ::ruby_econv_flag_type and a hash storing replacement
141 * characters etc.
142 *
143 * @param[in] opthash Keyword arguments.
144 * @param[out] ecopts Return buffer.
145 * @exception rb_eArgError Unknown/Broken values passed.
146 * @return Calculated set of enum ::ruby_econv_flag_type.
147 * @post `ecopts` holds a hash object suitable for
148 * ::rb_io_t::rb_io_enc_t::ecopts.
149 */
150 int rb_econv_prepare_opts(VALUE opthash, VALUE *ecopts);
151
152 /**
153 * Creates a new instance of struct ::rb_econv_t.
154 *
155 * @param[in] source_encoding Name of an encoding.
156 * @param[in] destination_encoding Name of another encoding.
157 * @param[in] ecflags A set of enum ::ruby_econv_flag_type.
158 * @exception rb_eArgError No such encoding.
159 * @retval NULL Failed to create a struct ::rb_econv_t.
160 * @retval otherwise Allocated struct ::rb_econv_t.
161 * @warning Return value must be passed to rb_econv_close() exactly once.
162 */
163 rb_econv_t *rb_econv_open(const char *source_encoding, const char *destination_encoding, int ecflags);
164
165 /**
166 * Identical to rb_econv_open(), except it additionally takes a hash of
167 * optional strings.
168 *
169 *
170 * @param[in] source_encoding Name of an encoding.
171 * @param[in] destination_encoding Name of another encoding.
172 * @param[in] ecflags A set of enum ::ruby_econv_flag_type.
173 * @param[in] ecopts Optional set of strings.
174 * @exception rb_eArgError No such encoding.
175 * @retval NULL Failed to create a struct ::rb_econv_t.
176 * @retval otherwise Allocated struct ::rb_econv_t.
177 * @warning Return value must be passed to rb_econv_close() exactly once.
178 */
179 rb_econv_t *rb_econv_open_opts(const char *source_encoding, const char *destination_encoding, int ecflags, VALUE ecopts);
180
181 /**
182 * Converts a string from an encoding to another.
183 *
184 * Possible flags are either ::RUBY_ECONV_PARTIAL_INPUT (means the source
185 * buffer is a part of much larger one), ::RUBY_ECONV_AFTER_OUTPUT (instructs
186 * the converter to stop after output before input), or both of them.
187 *
188 * @param[in,out] ec Conversion specification/state etc.
189 * @param[in] source_buffer_ptr Target string.
190 * @param[in] source_buffer_end End of target string.
191 * @param[out] destination_buffer_ptr Return buffer.
192 * @param[out] destination_buffer_end End of return buffer.
193 * @param[in] flags Flags (see above).
194 * @return The status of the conversion.
195 * @post `destination_buffer_ptr` holds conversion results.
196 */
197 rb_econv_result_t rb_econv_convert(rb_econv_t *ec,
198 const unsigned char **source_buffer_ptr, const unsigned char *source_buffer_end,
199 unsigned char **destination_buffer_ptr, unsigned char *destination_buffer_end,
200 int flags);
201
202 /**
203 * Destructs a converter. Note that a converter can have a buffer, and can be
204 * non-empty. Calling this would lose your data then.
205 *
206 * @param[out] ec The converter to destroy.
207 * @post `ec` is no longer a valid pointer.
208 */
209 void rb_econv_close(rb_econv_t *ec);
210
211 /**
212 * Assigns the replacement string. The string passed here would appear in
213 * converted string when it cannot represent its source counterpart. This can
214 * happen for instance you convert an emoji to ISO-8859-1.
215 *
216 * @param[out] ec Target converter.
217 * @param[in] str Replacement string.
218 * @param[in] len Number of bytes of `str`.
219 * @param[in] encname Name of encoding of `str`.
220 * @retval 0 Success.
221 * @retval -1 Failure (ENOMEM etc.).
222 * @post `ec`'s replacement string is set to `str`.
223 */
224 int rb_econv_set_replacement(rb_econv_t *ec, const unsigned char *str, size_t len, const char *encname);
225
226 /**
227 * "Decorate"s a converter. There are special kind of converters that
228 * transforms the contents, like replacing CR into CRLF. You can add such
229 * decorators to a converter using this API. By using this function a
230 * decorator is prepended at the beginning of a conversion sequence: in case of
231 * CRLF conversion, newlines are converted before encodings are converted.
232 *
233 * @param[out] ec Target converter to decorate.
234 * @param[in] decorator_name Name of decorator to prepend.
235 * @retval 0 Success.
236 * @retval -1 Failure (no such decorator etc.).
237 * @post Decorator works before encoding conversion happens.
238 *
239 * @internal
240 *
241 * What is the possible value of the `decorator_name` is not public. You have
242 * to read through `transcode.c` carefully.
243 */
244 int rb_econv_decorate_at_first(rb_econv_t *ec, const char *decorator_name);
245
246 /**
247 * Identical to rb_econv_decorate_at_first(), except it adds to the opposite
248 * direction. For instance CRLF conversion would run _after_ encodings are
249 * converted.
250 *
251 * @param[out] ec Target converter to decorate.
252 * @param[in] decorator_name Name of decorator to prepend.
253 * @retval 0 Success.
254 * @retval -1 Failure (no such decorator etc.).
255 * @post Decorator works after encoding conversion happens.
256 */
257 int rb_econv_decorate_at_last(rb_econv_t *ec, const char *decorator_name);
258
259 /**
260 * Creates a `rb_eConverterNotFoundError` exception object (but does not
261 * raise).
262 *
263 * @param[in] senc Name of source encoding.
264 * @param[in] denc Name of destination encoding.
265 * @param[in] ecflags A set of enum ::ruby_econv_flag_type.
266 * @return An instance of `rb_eConverterNotFoundError`.
267 */
268 VALUE rb_econv_open_exc(const char *senc, const char *denc, int ecflags);
269
270 /**
271 * Appends the passed string to the passed converter's output buffer. This can
272 * be handy when an encoding needs bytes out of thin air; for instance
273 * ISO-2022-JP has "shift function" which does not correspond to any
274 * characters.
275 *
276 * @param[out] ec Target converter.
277 * @param[in] str String to insert.
278 * @param[in] len Number of bytes of `str`.
279 * @param[in] str_encoding Encoding of `str`.
280 * @retval 0 Success.
281 * @retval -1 Failure (conversion error etc.).
282 * @note `str_encoding` can be anything, and `str` itself is converted
283 * when necessary.
284 */
285 int rb_econv_insert_output(rb_econv_t *ec,
286 const unsigned char *str, size_t len, const char *str_encoding);
287
288 /**
289 * Queries an encoding name which best suits for rb_econv_insert_output()'s
290 * last parameter. Strings in this encoding need no conversion when inserted;
291 * can be both time/space efficient.
292 *
293 * @param[in] ec Target converter.
294 * @return Its encoding for insertion.
295 */
296 const char *rb_econv_encoding_to_insert_output(rb_econv_t *ec);
297
298 /**
299 * This is a rb_econv_make_exception() + rb_exc_raise() combo.
300 *
301 * @param[in] ec (Possibly failed) conversion.
302 * @exception rb_eInvalidByteSequenceError Invalid byte sequence.
303 * @exception rb_eUndefinedConversionError Conversion undefined.
304 * @note This function can return when no error.
305 */
306 void rb_econv_check_error(rb_econv_t *ec);
307
308 /**
309 * This function makes sense right after rb_econv_convert() returns. As listed
310 * in ::rb_econv_result_t, rb_econv_convert() can bail out for various reasons.
311 * This function checks the passed converter's internal state and convert it to
312 * an appropriate exception object.
313 *
314 * @param[in] ec Target converter.
315 * @retval RUBY_Qnil The converter has no error.
316 * @retval otherwise Conversion error turned into an exception.
317 */
318 VALUE rb_econv_make_exception(rb_econv_t *ec);
319
320 /**
321 * Queries if rb_econv_putback() makes sense, i.e. there are invalid byte
322 * sequences remain in the buffer.
323 *
324 * @param[in] ec Target converter.
325 * @return Number of bytes that can be pushed back.
326 */
327 int rb_econv_putbackable(rb_econv_t *ec);
328
329 /**
330 * Puts back the bytes. In case of ::econv_invalid_byte_sequence, some of
331 * those invalid bytes are discarded and the others are buffered to be
332 * converted later. The latter bytes can be put back using this API.
333 *
334 * @param[out] ec Target converter (invalid byte sequence).
335 * @param[out] p Return buffer.
336 * @param[in] n Max number of bytes to put back.
337 * @post At most `n` bytes of what was put back is written to `p`.
338 */
339 void rb_econv_putback(rb_econv_t *ec, unsigned char *p, int n);
340
341 /**
342 * Queries the passed encoding's corresponding ASCII compatible encoding. "The
343 * corresponding ASCII compatible encoding" in this context is an ASCII
344 * compatible encoding which can represent exactly the same character sets as
345 * the given ASCII incompatible encoding. For instance that of UTF-16LE is
346 * UTF-8.
347 *
348 * @param[in] encname Name of an ASCII incompatible encoding.
349 * @retval NULL `encname` is already ASCII compatible.
350 * @retval otherwise The corresponding ASCII compatible encoding.
351 */
352 const char *rb_econv_asciicompat_encoding(const char *encname);
353
354 /**
355 * Identical to rb_econv_convert(), except it takes Ruby's string instead of
356 * C's pointer.
357 *
358 * @param[in,out] ec Target converter.
359 * @param[in] src Source string.
360 * @param[in] flags Flags (see rb_econv_convert).
361 * @exception rb_eArgError Converted string is too long.
362 * @exception rb_eInvalidByteSequenceError Invalid byte sequence.
363 * @exception rb_eUndefinedConversionError Conversion undefined.
364 * @return The conversion result.
365 */
366 VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags);
367
368 /**
369 * Identical to rb_econv_str_convert(), except it converts only a part of the
370 * passed string. Can be handy when you for instance want to do line-buffered
371 * conversion.
372 *
373 * @param[in,out] ec Target converter.
374 * @param[in] src Source string.
375 * @param[in] byteoff Number of bytes to seek.
376 * @param[in] bytesize Number of bytes to read.
377 * @param[in] flags Flags (see rb_econv_convert).
378 * @exception rb_eArgError Converted string is too long.
379 * @exception rb_eInvalidByteSequenceError Invalid byte sequence.
380 * @exception rb_eUndefinedConversionError Conversion undefined.
381 * @return The conversion result.
382 */
383 VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
384
385 /**
386 * Identical to rb_econv_str_convert(), except it appends the conversion result
387 * to the additionally passed string instead of creating a new string. It can
388 * also be seen as a routine identical to rb_econv_append(), except it takes a
389 * Ruby's string instead of C's pointer.
390 *
391 * @param[in,out] ec Target converter.
392 * @param[in] src Source string.
393 * @param[in] dst Return buffer.
394 * @param[in] flags Flags (see rb_econv_convert).
395 * @exception rb_eArgError Converted string is too long.
396 * @exception rb_eInvalidByteSequenceError Invalid byte sequence.
397 * @exception rb_eUndefinedConversionError Conversion undefined.
398 * @return The conversion result.
399 */
400 VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags);
401
402 /**
403 * Identical to rb_econv_str_append(), except it appends only a part of the
404 * passed string with conversion. It can also be seen as a routine identical
405 * to rb_econv_substr_convert(), except it appends the conversion result to the
406 * additionally passed string instead of creating a new string.
407 *
408 * @param[in,out] ec Target converter.
409 * @param[in] src Source string.
410 * @param[in] byteoff Number of bytes to seek.
411 * @param[in] bytesize Number of bytes to read.
412 * @param[in] dst Return buffer.
413 * @param[in] flags Flags (see rb_econv_convert).
414 * @exception rb_eArgError Converted string is too long.
415 * @exception rb_eInvalidByteSequenceError Invalid byte sequence.
416 * @exception rb_eUndefinedConversionError Conversion undefined.
417 * @return The conversion result.
418 */
419 VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
420
421 /**
422 * Converts the passed C's pointer according to the passed converter, then
423 * append the conversion result to the passed Ruby's string. This way buffer
424 * overflow is properly avoided to resize the destination properly.
425 *
426 * @param[in,out] ec Target converter.
427 * @param[in] bytesrc Target string.
428 * @param[in] bytesize Number of bytes of `bytesrc`.
429 * @param[in] dst Return buffer.
430 * @param[in] flags Flags (see rb_econv_convert).
431 * @exception rb_eArgError Converted string is too long.
432 * @exception rb_eInvalidByteSequenceError Invalid byte sequence.
433 * @exception rb_eUndefinedConversionError Conversion undefined.
434 * @return The conversion result.
435 */
436 VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE dst, int flags);
437
438 /**
439 * This badly named function does not set the destination encoding to binary,
440 * but instead just nullifies newline conversion decorators if any. Other
441 * ordinal character conversions still happen after this; something non-binary
442 * would still be generated.
443 *
444 * @param[out] ec Target converter to modify.
445 * @post Any newline conversions, if any, would be killed.
446 */
447 void rb_econv_binmode(rb_econv_t *ec);
448
449 /**
450 * This enum is kind of omnibus. Gathers various constants.
451 */
452 enum ruby_econv_flag_type {
453
454 /**
455 * @name Flags for rb_econv_open()
456 *
457 * @{
458 */
459
460 /** Mask for error handling related bits. */
461 RUBY_ECONV_ERROR_HANDLER_MASK = 0x000000ff,
462
463 /** Special handling of invalid sequences are there. */
464 RUBY_ECONV_INVALID_MASK = 0x0000000f,
465
466 /** Invalid sequences shall be replaced. */
467 RUBY_ECONV_INVALID_REPLACE = 0x00000002,
468
469 /** Special handling of undefined conversion are there. */
470 RUBY_ECONV_UNDEF_MASK = 0x000000f0,
471
472 /** Undefined characters shall be replaced. */
473 RUBY_ECONV_UNDEF_REPLACE = 0x00000020,
474
475 /** Undefined characters shall be escaped. */
476 RUBY_ECONV_UNDEF_HEX_CHARREF = 0x00000030,
477
478 /** Decorators are there. */
479 RUBY_ECONV_DECORATOR_MASK = 0x0001ff00,
480
481 /** Newline converters are there. */
482 RUBY_ECONV_NEWLINE_DECORATOR_MASK = 0x00007f00,
483
484 /** (Unclear; seems unused). */
485 RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK = 0x00000f00,
486
487 /** (Unclear; seems unused). */
488 RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK = 0x00007000,
489
490 /** Universal newline mode. */
491 RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR = 0x00000100,
492
493 /** CR to CRLF conversion shall happen. */
494 RUBY_ECONV_CRLF_NEWLINE_DECORATOR = 0x00001000,
495
496 /** CRLF to CR conversion shall happen. */
497 RUBY_ECONV_CR_NEWLINE_DECORATOR = 0x00002000,
498
499 /** CRLF to LF conversion shall happen. */
500 RUBY_ECONV_LF_NEWLINE_DECORATOR = 0x00004000,
501
502 /** Texts shall be XML-escaped. */
503 RUBY_ECONV_XML_TEXT_DECORATOR = 0x00008000,
504
505 /** Texts shall be AttrValue escaped */
506 RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR = 0x00010000,
507
508 /** (Unclear; seems unused). */
509 RUBY_ECONV_STATEFUL_DECORATOR_MASK = 0x00f00000,
510
511 /** Texts shall be AttrValue escaped. */
512 RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR = 0x00100000,
513
514 /** Newline decorator's default. */
515 RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR =
516 #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
517 RUBY_ECONV_CRLF_NEWLINE_DECORATOR,
518 #else
519 0,
520 #endif
521
522 #define ECONV_ERROR_HANDLER_MASK RUBY_ECONV_ERROR_HANDLER_MASK /**< @old{RUBY_ECONV_ERROR_HANDLER_MASK} */
523 #define ECONV_INVALID_MASK RUBY_ECONV_INVALID_MASK /**< @old{RUBY_ECONV_INVALID_MASK} */
524 #define ECONV_INVALID_REPLACE RUBY_ECONV_INVALID_REPLACE /**< @old{RUBY_ECONV_INVALID_REPLACE} */
525 #define ECONV_UNDEF_MASK RUBY_ECONV_UNDEF_MASK /**< @old{RUBY_ECONV_UNDEF_MASK} */
526 #define ECONV_UNDEF_REPLACE RUBY_ECONV_UNDEF_REPLACE /**< @old{RUBY_ECONV_UNDEF_REPLACE} */
527 #define ECONV_UNDEF_HEX_CHARREF RUBY_ECONV_UNDEF_HEX_CHARREF /**< @old{RUBY_ECONV_UNDEF_HEX_CHARREF} */
528 #define ECONV_DECORATOR_MASK RUBY_ECONV_DECORATOR_MASK /**< @old{RUBY_ECONV_DECORATOR_MASK} */
529 #define ECONV_NEWLINE_DECORATOR_MASK RUBY_ECONV_NEWLINE_DECORATOR_MASK /**< @old{RUBY_ECONV_NEWLINE_DECORATOR_MASK} */
530 #define ECONV_NEWLINE_DECORATOR_READ_MASK RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK /**< @old{RUBY_ECONV_NEWLINE_DECORATOR_READ_MASK} */
531 #define ECONV_NEWLINE_DECORATOR_WRITE_MASK RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK /**< @old{RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK} */
532 #define ECONV_UNIVERSAL_NEWLINE_DECORATOR RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR /**< @old{RUBY_ECONV_UNIVERSAL_NEWLINE_DECORATOR} */
533 #define ECONV_CRLF_NEWLINE_DECORATOR RUBY_ECONV_CRLF_NEWLINE_DECORATOR /**< @old{RUBY_ECONV_CRLF_NEWLINE_DECORATOR} */
534 #define ECONV_CR_NEWLINE_DECORATOR RUBY_ECONV_CR_NEWLINE_DECORATOR /**< @old{RUBY_ECONV_CR_NEWLINE_DECORATOR} */
535 #define ECONV_LF_NEWLINE_DECORATOR RUBY_ECONV_LF_NEWLINE_DECORATOR /**< @old{RUBY_ECONV_LF_NEWLINE_DECORATOR} */
536 #define ECONV_XML_TEXT_DECORATOR RUBY_ECONV_XML_TEXT_DECORATOR /**< @old{RUBY_ECONV_XML_TEXT_DECORATOR} */
537 #define ECONV_XML_ATTR_CONTENT_DECORATOR RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR /**< @old{RUBY_ECONV_XML_ATTR_CONTENT_DECORATOR} */
538 #define ECONV_STATEFUL_DECORATOR_MASK RUBY_ECONV_STATEFUL_DECORATOR_MASK /**< @old{RUBY_ECONV_STATEFUL_DECORATOR_MASK} */
539 #define ECONV_XML_ATTR_QUOTE_DECORATOR RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR /**< @old{RUBY_ECONV_XML_ATTR_QUOTE_DECORATOR} */
540 #define ECONV_DEFAULT_NEWLINE_DECORATOR RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR /**< @old{RUBY_ECONV_DEFAULT_NEWLINE_DECORATOR} */
541 /** @} */
542
543 /**
544 * @name Flags for rb_econv_convert()
545 *
546 * @{
547 */
548
549 /** Indicates the input is a part of much larger one. */
550 RUBY_ECONV_PARTIAL_INPUT = 0x00020000,
551
552 /** Instructs the converter to stop after output. */
553 RUBY_ECONV_AFTER_OUTPUT = 0x00040000,
554 #define ECONV_PARTIAL_INPUT RUBY_ECONV_PARTIAL_INPUT /**< @old{RUBY_ECONV_PARTIAL_INPUT} */
555 #define ECONV_AFTER_OUTPUT RUBY_ECONV_AFTER_OUTPUT /**< @old{RUBY_ECONV_AFTER_OUTPUT} */
556
557 RUBY_ECONV_FLAGS_PLACEHOLDER /**< Placeholder (not used) */
558 };
559
560 RBIMPL_SYMBOL_EXPORT_END()
561
562 #endif /* RUBY_INTERNAL_ENCODING_TRANSCODE_H */