mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* transcode_data.h (rb_transcoder_stateful_type_t): defined.
(rb_transcoder): add field: stateful_type. * tool/transcode-tblgen.rb: generate stateful_type field as stateless_converter. * enc/trans/iso2022.trans: follow rb_transcoder change. * enc/trans/newline.trans: ditto. * enc/trans/utf_16_32.trans: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
aafb3af52b
commit
a55e167b68
6 changed files with 36 additions and 0 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
Sat Aug 16 08:11:04 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* transcode_data.h (rb_transcoder_stateful_type_t): defined.
|
||||||
|
(rb_transcoder): add field: stateful_type.
|
||||||
|
|
||||||
|
* tool/transcode-tblgen.rb: generate stateful_type field as
|
||||||
|
stateless_converter.
|
||||||
|
|
||||||
|
* enc/trans/iso2022.trans: follow rb_transcoder change.
|
||||||
|
|
||||||
|
* enc/trans/newline.trans: ditto.
|
||||||
|
|
||||||
|
* enc/trans/utf_16_32.trans: ditto.
|
||||||
|
|
||||||
Fri Aug 15 23:07:48 2008 Tanaka Akira <akr@fsij.org>
|
Fri Aug 15 23:07:48 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* transcode.c (econv_just_convert): extracted from rb_econv_output.
|
* transcode.c (econv_just_convert): extracted from rb_econv_output.
|
||||||
|
|
|
@ -61,6 +61,7 @@ rb_ISO_2022_JP_to_EUC_JP = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
3, /* max_input */
|
3, /* max_input */
|
||||||
3, /* max_output */
|
3, /* max_output */
|
||||||
|
stateful_decoder, /* stateful_type */
|
||||||
NULL, fun_si_iso2022jp_to_eucjp, NULL, fun_so_iso2022jp_to_eucjp
|
NULL, fun_si_iso2022jp_to_eucjp, NULL, fun_so_iso2022jp_to_eucjp
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,6 +145,7 @@ rb_EUC_JP_to_ISO_2022_JP = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
3, /* max_input */
|
3, /* max_input */
|
||||||
5, /* max_output */
|
5, /* max_output */
|
||||||
|
stateful_encoder, /* stateful_type */
|
||||||
NULL, NULL, NULL, fun_so_eucjp_to_iso2022jp,
|
NULL, NULL, NULL, fun_so_eucjp_to_iso2022jp,
|
||||||
finish_eucjp_to_iso2022jp,
|
finish_eucjp_to_iso2022jp,
|
||||||
iso2022jp_reset_sequence_size, finish_eucjp_to_iso2022jp
|
iso2022jp_reset_sequence_size, finish_eucjp_to_iso2022jp
|
||||||
|
|
|
@ -44,6 +44,7 @@ rb_universal_newline = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
1, /* max_input */
|
1, /* max_input */
|
||||||
1, /* max_output */
|
1, /* max_output */
|
||||||
|
stateful_decoder, /* stateful_type */
|
||||||
NULL, NULL, NULL, fun_so_universal_newline
|
NULL, NULL, NULL, fun_so_universal_newline
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ rb_crlf_newline = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
1, /* max_input */
|
1, /* max_input */
|
||||||
2, /* max_output */
|
2, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,6 +80,7 @@ rb_cr_newline = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
1, /* max_input */
|
1, /* max_input */
|
||||||
1, /* max_output */
|
1, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, NULL
|
NULL, NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,7 @@ rb_from_UTF_16BE = {
|
||||||
2, /* input_unit_length */
|
2, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_from_utf_16be
|
NULL, NULL, NULL, &fun_so_from_utf_16be
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -259,6 +260,7 @@ rb_to_UTF_16BE = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_to_utf_16be
|
NULL, NULL, NULL, &fun_so_to_utf_16be
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -275,6 +277,7 @@ rb_from_UTF_16LE = {
|
||||||
2, /* input_unit_length */
|
2, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_from_utf_16le
|
NULL, NULL, NULL, &fun_so_from_utf_16le
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -284,6 +287,7 @@ rb_to_UTF_16LE = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_to_utf_16le
|
NULL, NULL, NULL, &fun_so_to_utf_16le
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -300,6 +304,7 @@ rb_from_UTF_32BE = {
|
||||||
4, /* input_unit_length */
|
4, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_from_utf_32be
|
NULL, NULL, NULL, &fun_so_from_utf_32be
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -309,6 +314,7 @@ rb_to_UTF_32BE = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_to_utf_32be
|
NULL, NULL, NULL, &fun_so_to_utf_32be
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -325,6 +331,7 @@ rb_from_UTF_32LE = {
|
||||||
4, /* input_unit_length */
|
4, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_from_utf_32le
|
NULL, NULL, NULL, &fun_so_from_utf_32le
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -334,6 +341,7 @@ rb_to_UTF_32LE = {
|
||||||
1, /* input_unit_length */
|
1, /* input_unit_length */
|
||||||
4, /* max_input */
|
4, /* max_input */
|
||||||
4, /* max_output */
|
4, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, &fun_so_to_utf_32le
|
NULL, NULL, NULL, &fun_so_to_utf_32le
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -449,6 +449,7 @@ static const rb_transcoder
|
||||||
#{input_unit_length}, /* input_unit_length */
|
#{input_unit_length}, /* input_unit_length */
|
||||||
#{max_input}, /* max_input */
|
#{max_input}, /* max_input */
|
||||||
#{max_output}, /* max_output */
|
#{max_output}, /* max_output */
|
||||||
|
stateless_converter, /* stateful_type */
|
||||||
NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL,
|
||||||
NULL, NULL, NULL
|
NULL, NULL, NULL
|
||||||
};
|
};
|
||||||
|
|
|
@ -56,6 +56,13 @@ typedef struct byte_lookup {
|
||||||
#define TWOTRAIL /* legal but undefined if two more trailing UTF-8 */
|
#define TWOTRAIL /* legal but undefined if two more trailing UTF-8 */
|
||||||
#define THREETRAIL /* legal but undefined if three more trailing UTF-8 */
|
#define THREETRAIL /* legal but undefined if three more trailing UTF-8 */
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
stateless_converter, /* stateless -> stateless */
|
||||||
|
stateful_decoder, /* stateful -> stateless */
|
||||||
|
stateful_encoder /* stateless -> stateful */
|
||||||
|
/* stateful -> stateful is intentionally ommitted. */
|
||||||
|
} rb_transcoder_stateful_type_t;
|
||||||
|
|
||||||
typedef struct rb_transcoder rb_transcoder;
|
typedef struct rb_transcoder rb_transcoder;
|
||||||
|
|
||||||
/* dynamic structure, one per conversion (similar to iconv_t) */
|
/* dynamic structure, one per conversion (similar to iconv_t) */
|
||||||
|
@ -103,6 +110,7 @@ struct rb_transcoder {
|
||||||
int input_unit_length;
|
int input_unit_length;
|
||||||
int max_input;
|
int max_input;
|
||||||
int max_output;
|
int max_output;
|
||||||
|
rb_transcoder_stateful_type_t stateful_type;
|
||||||
VALUE (*func_ii)(rb_transcoding*, VALUE); /* info -> info */
|
VALUE (*func_ii)(rb_transcoding*, VALUE); /* info -> info */
|
||||||
VALUE (*func_si)(rb_transcoding*, const unsigned char*, size_t); /* start -> info */
|
VALUE (*func_si)(rb_transcoding*, const unsigned char*, size_t); /* start -> info */
|
||||||
int (*func_io)(rb_transcoding*, VALUE, const unsigned char*); /* info -> output */
|
int (*func_io)(rb_transcoding*, VALUE, const unsigned char*); /* info -> output */
|
||||||
|
|
Loading…
Reference in a new issue