summaryrefslogtreecommitdiff
path: root/tool/transcode-tblgen.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-01 16:22:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-01 16:22:49 +0000
commit752e053a1df0446b6ca20815b1976dd322d736bd (patch)
tree7ece75f0de59fd63b1263145479927001796a1c3 /tool/transcode-tblgen.rb
parent2ae7b0328e9bf0caf16411eabc924effedccfb5c (diff)
* transcode_data.h (BYTE_LOOKUP): change to uintptr_t array.
(BYTE_LOOKUP_BASE): follow the type change. (BYTE_LOOKUP_INFO): ditto. (PType): ditto. (rb_transcoding): ditto. * tool/transcode-tblgen.rb: follow the type change. * transcode.c: ditto. * enc/trans/newline.trans: ditto. * enc/trans/iso2022.trans: ditto. * enc/trans/utf_16_32.trans: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/transcode-tblgen.rb')
-rw-r--r--tool/transcode-tblgen.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index 22587ac..cdeb27f 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -273,7 +273,7 @@ class ActionMap
"o3(0x#$1,0x#$2,0x#$3)"
when /\A([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])\z/i
"o4(0x#$1,0x#$2,0x#$3,0x#$4)"
- when /\A&/ # pointer to BYTE_LOOKUP structure
+ when /\A\/\*BYTE_LOOKUP\*\// # pointer to BYTE_LOOKUP structure
info.to_s
else
raise "unexpected action: #{info.inspect}"
@@ -347,8 +347,9 @@ End
else
infos_name = "#{name}_infos"
infos_code = <<"End"
-static const struct byte_lookup* const
+static const uintptr_t
#{infos_name}[#{infos.length}] = #{format_infos(infos)};
+\#define #{infos_name} ((uintptr_t)#{infos_name})
End
InfosMemo[infos] = infos_name
end
@@ -356,9 +357,10 @@ End
r = infos_code + <<"End"
static const BYTE_LOOKUP
#{name} = {
- #{offsets_name},
+ (uintptr_t)#{offsets_name},
#{infos_name}
};
+\#define #{name} ((uintptr_t)#{name})
End
words_code << r
@@ -380,7 +382,7 @@ End
else
name_hint2 = nil
name_hint2 = "#{name_hint}_#{'%02X' % byte}" if name_hint
- table[byte] = "&" + rest.generate_node(bytes_code, words_code, name_hint2, rest_valid_encoding)
+ table[byte] = "/*BYTE_LOOKUP*/" + rest.generate_node(bytes_code, words_code, name_hint2, rest_valid_encoding)
end
}
@@ -572,7 +574,7 @@ def transcode_tblgen(from, to, map)
transcoder_code = <<"End"
static const rb_transcoder
#{transcoder_name} = {
- #{c_esc from}, #{c_esc to}, &#{real_tree_name},
+ #{c_esc from}, #{c_esc to}, #{real_tree_name},
#{input_unit_length}, /* input_unit_length */
#{max_input}, /* max_input */
#{max_output}, /* max_output */