[前][次][番号順一覧][スレッド一覧]

ruby-changes:12623

From: usa <ko1@a...>
Date: Fri, 31 Jul 2009 15:09:33 +0900 (JST)
Subject: [ruby-changes:12623] Ruby:r24336 (trunk): * tool/compile_prelude.rb: too long string literal causes compile error

usa	2009-07-31 15:09:13 +0900 (Fri, 31 Jul 2009)

  New Revision: 24336

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24336

  Log:
    * tool/compile_prelude.rb: too long string literal causes compile error
      on some platforms.

  Modified files:
    trunk/ChangeLog
    trunk/tool/compile_prelude.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24335)
+++ ChangeLog	(revision 24336)
@@ -1,3 +1,8 @@
+Fri Jul 31 15:06:33 2009  NAKAMURA Usaku  <usa@r...>
+
+	* tool/compile_prelude.rb: too long string literal causes compile error
+	  on some platforms.
+
 Fri Jul 31 13:15:27 2009  NAKAMURA Usaku  <usa@r...>
 
 	* transcode.c (str_encode_bang): C99ism.
Index: tool/compile_prelude.rb
===================================================================
--- tool/compile_prelude.rb	(revision 24335)
+++ tool/compile_prelude.rb	(revision 24336)
@@ -51,17 +51,22 @@
         "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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]