summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-02 12:22:56 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-02 12:22:56 +0000
commit39f172f9d73d140e5e8ed914f151e130f0cb883c (patch)
tree8052651cdece1f97e8f6dd51d98b5c50dfcd92af /tool
parent5cea1b07f4f468cce46367da2a27a6d1e69c68f2 (diff)
* tool/transcode-tblgen.rb: add prefix for byte_array and word_array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r--tool/transcode-tblgen.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index e33c7f13ca7..96f2e8f640a 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -328,7 +328,7 @@ class ActionMap
if bytes_code.empty?
bytes_code << <<"End"
static const unsigned char
-byte_array[0] = {
+#{OUTPUT_PREFIX}byte_array[0] = {
};
End
end
@@ -345,7 +345,7 @@ End
if words_code.empty?
words_code << <<"End"
static const uintptr_t
-word_array[0] = {
+#{OUTPUT_PREFIX}word_array[0] = {
};
End
end
@@ -609,7 +609,7 @@ end
def transcode_generated_code
TRANSCODE_GENERATED_BYTES_CODE +
TRANSCODE_GENERATED_WORDS_CODE +
- "\#define TRANSCODE_TABLE_INFO byte_array, word_array, sizeof(uintptr_t)\n" +
+ "\#define TRANSCODE_TABLE_INFO #{OUTPUT_PREFIX}byte_array, #{OUTPUT_PREFIX}word_array, sizeof(uintptr_t)\n" +
TRANSCODE_GENERATED_TRANSCODER_CODE
end
@@ -716,6 +716,11 @@ op.parse!
VERBOSE_MODE = verbose_mode
+OUTPUT_FILENAME = output_filename
+OUTPUT_PREFIX = output_filename ? File.basename(output_filename)[/\A[A-Za-z0-9_]*/] : ""
+OUTPUT_PREFIX.sub!(/\A_+/, '')
+OUTPUT_PREFIX.sub!(/_*\z/, '_')
+
arg = ARGV.shift
$srcdir = File.dirname(arg)
$:.unshift $srcdir unless $:.include? $srcdir