summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog4
-rw-r--r--tool/transcode-tblgen.rb11
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0070fdd8352..9091febd25d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Sep 2 21:22:22 2008 Tanaka Akira <akr@fsij.org>
+
+ * tool/transcode-tblgen.rb: add prefix for byte_array and word_array.
+
Tue Sep 2 20:57:14 2008 Tanaka Akira <akr@fsij.org>
* enc/trans/make_transdb.rb: check foo.c only if foo.trans exists.
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