aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 06:09:13 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-31 06:09:13 +0000
commitbc70ea70cd455261d185ec386e4c04ce9ccabf62 (patch)
tree2abf5e35fed67c4cba083cb0ae0dc63a39ae56ac
parenta436212282330a6b132e0a4174178a4ca253dea0 (diff)
downloadruby-bc70ea70cd455261d185ec386e4c04ce9ccabf62.tar.gz
* tool/compile_prelude.rb: too long string literal causes compile error
on some platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rwxr-xr-xtool/compile_prelude.rb15
2 files changed, 15 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3a1bf6c469..503a24fc17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 31 15:06:33 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * tool/compile_prelude.rb: too long string literal causes compile error
+ on some platforms.
+
Fri Jul 31 13:15:27 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* transcode.c (str_encode_bang): C99ism.
diff --git a/tool/compile_prelude.rb b/tool/compile_prelude.rb
index 48b9e2e1cf..88b7d69f11 100755
--- a/tool/compile_prelude.rb
+++ b/tool/compile_prelude.rb
@@ -51,17 +51,22 @@ lines_list = preludes.map {|filename|
"nil"
end
}
- line.gsub!(/require\s*(\(?)\s*(["'])(.*?)\2\s*\1/) {
+ if /require\s*(\(?)\s*(["'])(.*?)\2\s*\1/ =~ line
orig, path = $&, $3
srcdir = File.expand_path("../..", __FILE__)
path = File.expand_path(path, srcdir)
if File.exist?(path)
- "eval(%s, TOPLEVEL_BINDING, %s, %d)" % [ File.read(path).dump, prelude_name(filename, path).dump, 1]
+ lines << c_esc("eval(")
+ File.readlines(path).each do |line|
+ lines << c_esc(line.dump)
+ end
+ lines << c_esc(", TOPLEVEL_BINDING, %s, %d)" % [ prelude_name(filename, path).dump, 1])
else
- orig
+ lines << c_esc(orig)
end
- }
- lines << c_esc(line)
+ else
+ lines << c_esc(line)
+ end
}
setup_lines = []
if need_ruby_prefix