summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-15 23:13:01 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-15 23:13:01 +0000
commita55e167b68d123866b44a14f31411eafdcb56037 (patch)
tree5d4ab3bc9bf7c6f10677cedd63848fb7430bca6d
parentaafb3af52b99f5bc708ac4fd033b9a6899f1dacc (diff)
* 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
-rw-r--r--ChangeLog14
-rw-r--r--enc/trans/iso2022.trans2
-rw-r--r--enc/trans/newline.trans3
-rw-r--r--enc/trans/utf_16_32.trans8
-rw-r--r--tool/transcode-tblgen.rb1
-rw-r--r--transcode_data.h8
6 files changed, 36 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2c3c18e..7c74f84 100644
--- a/ChangeLog
+++ b/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>
* transcode.c (econv_just_convert): extracted from rb_econv_output.
diff --git a/enc/trans/iso2022.trans b/enc/trans/iso2022.trans
index 0414493..76a68d9 100644
--- a/enc/trans/iso2022.trans
+++ b/enc/trans/iso2022.trans
@@ -61,6 +61,7 @@ rb_ISO_2022_JP_to_EUC_JP = {
1, /* input_unit_length */
3, /* max_input */
3, /* max_output */
+ stateful_decoder, /* stateful_type */
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 */
3, /* max_input */
5, /* max_output */
+ stateful_encoder, /* stateful_type */
NULL, NULL, NULL, fun_so_eucjp_to_iso2022jp,
finish_eucjp_to_iso2022jp,
iso2022jp_reset_sequence_size, finish_eucjp_to_iso2022jp
diff --git a/enc/trans/newline.trans b/enc/trans/newline.trans
index 3b70712..409da1d 100644
--- a/enc/trans/newline.trans
+++ b/enc/trans/newline.trans
@@ -44,6 +44,7 @@ rb_universal_newline = {
1, /* input_unit_length */
1, /* max_input */
1, /* max_output */
+ stateful_decoder, /* stateful_type */
NULL, NULL, NULL, fun_so_universal_newline
};
@@ -61,6 +62,7 @@ rb_crlf_newline = {
1, /* input_unit_length */
1, /* max_input */
2, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, NULL
};
@@ -78,6 +80,7 @@ rb_cr_newline = {
1, /* input_unit_length */
1, /* max_input */
1, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, NULL
};
diff --git a/enc/trans/utf_16_32.trans b/enc/trans/utf_16_32.trans
index aea2ab5..3b11654 100644
--- a/enc/trans/utf_16_32.trans
+++ b/enc/trans/utf_16_32.trans
@@ -235,6 +235,7 @@ rb_from_UTF_16BE = {
2, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_from_utf_16be
};
@@ -259,6 +260,7 @@ rb_to_UTF_16BE = {
1, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_to_utf_16be
};
@@ -275,6 +277,7 @@ rb_from_UTF_16LE = {
2, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_from_utf_16le
};
@@ -284,6 +287,7 @@ rb_to_UTF_16LE = {
1, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_to_utf_16le
};
@@ -300,6 +304,7 @@ rb_from_UTF_32BE = {
4, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_from_utf_32be
};
@@ -309,6 +314,7 @@ rb_to_UTF_32BE = {
1, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_to_utf_32be
};
@@ -325,6 +331,7 @@ rb_from_UTF_32LE = {
4, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_from_utf_32le
};
@@ -334,6 +341,7 @@ rb_to_UTF_32LE = {
1, /* input_unit_length */
4, /* max_input */
4, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, &fun_so_to_utf_32le
};
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index 87bb29c..f79fc55 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -449,6 +449,7 @@ static const rb_transcoder
#{input_unit_length}, /* input_unit_length */
#{max_input}, /* max_input */
#{max_output}, /* max_output */
+ stateless_converter, /* stateful_type */
NULL, NULL, NULL, NULL,
NULL, NULL, NULL
};
diff --git a/transcode_data.h b/transcode_data.h
index 69f3048..1b8eeae 100644
--- a/transcode_data.h
+++ b/transcode_data.h
@@ -56,6 +56,13 @@ typedef struct byte_lookup {
#define TWOTRAIL /* legal but undefined if two 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;
/* dynamic structure, one per conversion (similar to iconv_t) */
@@ -103,6 +110,7 @@ struct rb_transcoder {
int input_unit_length;
int max_input;
int max_output;
+ rb_transcoder_stateful_type_t stateful_type;
VALUE (*func_ii)(rb_transcoding*, VALUE); /* info -> info */
VALUE (*func_si)(rb_transcoding*, const unsigned char*, size_t); /* start -> info */
int (*func_io)(rb_transcoding*, VALUE, const unsigned char*); /* info -> output */