summaryrefslogtreecommitdiff
path: root/tool/transcode-tblgen.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-31 17:35:00 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-31 17:35:00 +0000
commit8841969485b9d65aad60cab456e24e7f8bcbcd3c (patch)
treea686ef98a5c30bc01fdaf2fadb990418bfa2b29c /tool/transcode-tblgen.rb
parent6b2efe107f8de34e75da95ec78a9dd6cb0b11be1 (diff)
* tool/transcode-tblgen.rb (transcode_generated_code): defined for
generating table at once. (transcode_tblgen): returns an empty string. (transcode_generate_node): ditto. * enc/trans/newline.trans: use transcode_generated_code. * enc/trans/iso2022.trans: ditto. * enc/trans/single_byte.trans: ditto. * enc/trans/utf_16_32.trans: ditto. * enc/trans/japanese.trans: ditto. * enc/trans/korean.trans: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/transcode-tblgen.rb')
-rw-r--r--tool/transcode-tblgen.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index c3f7ee3..44be6a9 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -389,6 +389,12 @@ End
code << generate_lookup_node(name_hint, table)
name_hint
end
+
+ def gennode(name_hint=nil, valid_encoding=nil)
+ code = ''
+ name = generate_node(code, name_hint, valid_encoding)
+ return name, code
+ end
end
def citrus_mskanji_cstomb(csid, index)
@@ -529,12 +535,12 @@ def transcode_compile_tree(name, from, map)
valid_encoding = nil
end
- code = ''
- defined_name = am.generate_node(code, name, valid_encoding)
+ defined_name, code = am.gennode(name, valid_encoding)
return defined_name, code, max_input
end
TRANSCODERS = []
+TRANSCODE_GENERATED_CODE = ''
def transcode_tblgen(from, to, map)
STDERR.puts "converter from #{from} to #{to}" if VERBOSE_MODE
@@ -565,14 +571,19 @@ static const rb_transcoder
NULL, NULL, NULL
};
End
- tree_code + "\n" + transcoder_code
+ TRANSCODE_GENERATED_CODE << tree_code + "\n" + transcoder_code
+ ''
end
def transcode_generate_node(am, name_hint=nil)
STDERR.puts "converter for #{name_hint}" if VERBOSE_MODE
- code = ''
- am.generate_node(code, name_hint)
- code
+ name, code = am.gennode(name_hint)
+ TRANSCODE_GENERATED_CODE << code
+ ''
+end
+
+def transcode_generated_code
+ TRANSCODE_GENERATED_CODE
end
def transcode_register_code