From 5604b9a5eef98a3ecdff62d4a561f054a86f48c6 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 1 Sep 2008 18:18:50 +0000 Subject: * tool/transcode-tblgen.rb: define TRANSCODE_TABLE_INFO in generated code. use it in rb_transcoder. * enc/trans/newline.trans: use TRANSCODE_TABLE_INFO. * enc/trans/iso2022.trans: ditto. * enc/trans/utf_16_32.trans: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 +++++++++++ enc/trans/iso2022.trans | 4 ++-- enc/trans/newline.trans | 6 +++--- enc/trans/utf_16_32.trans | 16 ++++++++-------- tool/transcode-tblgen.rb | 7 +++++-- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c879da90..00d2dc253 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Tue Sep 2 03:16:42 2008 Tanaka Akira + + * tool/transcode-tblgen.rb: define TRANSCODE_TABLE_INFO in generated + code. use it in rb_transcoder. + + * enc/trans/newline.trans: use TRANSCODE_TABLE_INFO. + + * enc/trans/iso2022.trans: ditto. + + * enc/trans/utf_16_32.trans: ditto. + Tue Sep 2 03:04:33 2008 Tanaka Akira * tool/transcode-tblgen.rb: record infos and BYTE_LOOKUPs as index of diff --git a/enc/trans/iso2022.trans b/enc/trans/iso2022.trans index a11424c2c..49da2c3f6 100644 --- a/enc/trans/iso2022.trans +++ b/enc/trans/iso2022.trans @@ -70,7 +70,7 @@ fun_so_iso2022jp_to_eucjp(rb_transcoding* t, const unsigned char* s, size_t l, u static const rb_transcoder rb_ISO_2022_JP_to_EUC_JP = { "ISO-2022-JP", "EUC-JP", iso2022jp_to_eucjp, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 3, /* max_input */ 3, /* max_output */ @@ -143,7 +143,7 @@ finish_eucjp_to_iso2022jp(rb_transcoding *t, unsigned char *o) static const rb_transcoder rb_EUC_JP_to_ISO_2022_JP = { "EUC-JP", "ISO-2022-JP", eucjp_to_iso2022jp, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 3, /* max_input */ 5, /* max_output */ diff --git a/enc/trans/newline.trans b/enc/trans/newline.trans index 6431a7d95..da8202eea 100644 --- a/enc/trans/newline.trans +++ b/enc/trans/newline.trans @@ -55,7 +55,7 @@ fun_so_universal_newline(rb_transcoding* t, const unsigned char* s, size_t l, un static const rb_transcoder rb_universal_newline = { "universal_newline", "", universal_newline, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 1, /* max_input */ 1, /* max_output */ @@ -66,7 +66,7 @@ rb_universal_newline = { static const rb_transcoder rb_crlf_newline = { "", "crlf_newline", crlf_newline, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 1, /* max_input */ 2, /* max_output */ @@ -77,7 +77,7 @@ rb_crlf_newline = { static const rb_transcoder rb_cr_newline = { "", "cr_newline", cr_newline, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 1, /* max_input */ 1, /* max_output */ diff --git a/enc/trans/utf_16_32.trans b/enc/trans/utf_16_32.trans index bb6db9d5e..d5333581c 100644 --- a/enc/trans/utf_16_32.trans +++ b/enc/trans/utf_16_32.trans @@ -262,7 +262,7 @@ fun_so_to_utf_32le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned static const rb_transcoder rb_from_UTF_16BE = { "UTF-16BE", "UTF-8", from_UTF_16BE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 2, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -273,7 +273,7 @@ rb_from_UTF_16BE = { static const rb_transcoder rb_to_UTF_16BE = { "UTF-8", "UTF-16BE", to_UTF_16BE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -284,7 +284,7 @@ rb_to_UTF_16BE = { static const rb_transcoder rb_from_UTF_16LE = { "UTF-16LE", "UTF-8", from_UTF_16LE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 2, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -295,7 +295,7 @@ rb_from_UTF_16LE = { static const rb_transcoder rb_to_UTF_16LE = { "UTF-8", "UTF-16LE", to_UTF_16BE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -306,7 +306,7 @@ rb_to_UTF_16LE = { static const rb_transcoder rb_from_UTF_32BE = { "UTF-32BE", "UTF-8", from_UTF_32BE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 4, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -317,7 +317,7 @@ rb_from_UTF_32BE = { static const rb_transcoder rb_to_UTF_32BE = { "UTF-8", "UTF-32BE", to_UTF_16BE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -328,7 +328,7 @@ rb_to_UTF_32BE = { static const rb_transcoder rb_from_UTF_32LE = { "UTF-32LE", "UTF-8", from_UTF_32LE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 4, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ @@ -339,7 +339,7 @@ rb_from_UTF_32LE = { static const rb_transcoder rb_to_UTF_32LE = { "UTF-8", "UTF-32LE", to_UTF_16BE, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, 1, /* input_unit_length */ 4, /* max_input */ 4, /* max_output */ diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb index 1915d31f6..928e722a5 100644 --- a/tool/transcode-tblgen.rb +++ b/tool/transcode-tblgen.rb @@ -587,7 +587,7 @@ def transcode_tblgen(from, to, map) static const rb_transcoder #{transcoder_name} = { #{c_esc from}, #{c_esc to}, #{real_tree_name}, - byte_array, word_array, sizeof(uintptr_t), + TRANSCODE_TABLE_INFO, #{input_unit_length}, /* input_unit_length */ #{max_input}, /* max_input */ #{max_output}, /* max_output */ @@ -607,7 +607,10 @@ def transcode_generate_node(am, name_hint=nil) end def transcode_generated_code - TRANSCODE_GENERATED_BYTES_CODE + TRANSCODE_GENERATED_WORDS_CODE + TRANSCODE_GENERATED_TRANSCODER_CODE + TRANSCODE_GENERATED_BYTES_CODE + + TRANSCODE_GENERATED_WORDS_CODE + + "\#define TRANSCODE_TABLE_INFO byte_array, word_array, sizeof(uintptr_t)\n" + + TRANSCODE_GENERATED_TRANSCODER_CODE end def transcode_register_code -- cgit