[前][次][番号順一覧][スレッド一覧][生データ]

yarv-diff:342

From: ko1 atdot.net
Date: 4 Jul 2006 11:06:35 -0000
Subject: [yarv-diff:342] r508 - in trunk: . rb yarvtest

Author: ko1
Date: 2006-07-04 20:06:34 +0900 (Tue, 04 Jul 2006)
New Revision: 508

Added:
   trunk/rb/compile.rb
Modified:
   trunk/
   trunk/ChangeLog
   trunk/yarvtest/yarvtest.rb
Log:
 r790@lermite:  ko1 | 2006-07-04 20:06:10 +0900
 	* rb/compile.rb : added
 
 	* yarvtest/yarvtest.rb : disable load/store test
 



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:787
   + 81cd9672-7512-7e48-ae48-6936450e977d:/local/yarv/trunk:790

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-04 09:27:24 UTC (rev 507)
+++ trunk/ChangeLog	2006-07-04 11:06:34 UTC (rev 508)
@@ -4,6 +4,13 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
+2006-07-04(Tue) 20:05:38 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* rb/compile.rb : added
+
+	* yarvtest/yarvtest.rb : disable load/store test
+
+
 2006-07-04(Tue) 18:17:15 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* compile.c : fix some bugs about load iseq data

Added: trunk/rb/compile.rb
===================================================================
--- trunk/rb/compile.rb	2006-07-04 09:27:24 UTC (rev 507)
+++ trunk/rb/compile.rb	2006-07-04 11:06:34 UTC (rev 508)
@@ -0,0 +1,46 @@
+require 'optparse'
+require 'pp'
+
+def compile_to_rb infile, outfile
+  iseq = YARVCore::parse(IO.read(infile), infile, 1)
+  
+  open(outfile, 'w'){|f|
+    f.puts "YARVCore::InstructionSequence.load(" +
+           "Marshal.load(<<EOS____.unpack('m*')[0])).eval"
+    f.puts [Marshal.dump(iseq.to_a)].pack('m*')
+    f.puts "EOS____"
+  }
+end
+
+def compile_to_rbc infile, outfile
+  iseq = YARVCore::parse(IO.read(infile), infile, 1)
+  
+  open(outfile, 'wb'){|f|
+    f.puts Marshal.dump(iseq.to_a, f)
+  }
+end
+
+## main
+
+outfile = 'a.rb'
+
+opt = OptionParser.new{|opt|
+  opt.on('-o file'){|o|
+    outfile = o
+  }
+  opt.version = '0.0.1'
+}
+
+opt.parse!(ARGV)
+
+ARGV.each{|file|
+  case outfile
+  when /\.rb\Z/
+    compile_to_rb file, outfile
+  when /\.rbc\Z/
+    compile_to_rbc file, outfile
+  else
+    raise
+  end
+}
+

Modified: trunk/yarvtest/yarvtest.rb
===================================================================
--- trunk/yarvtest/yarvtest.rb	2006-07-04 09:27:24 UTC (rev 507)
+++ trunk/yarvtest/yarvtest.rb	2006-07-04 11:06:34 UTC (rev 508)
@@ -123,7 +123,7 @@
     assert_equal(ruby.gsub(/\r/, ''), yarv.gsub(/\r/, ''))
 
     # store/load test
-    if false || true
+    if false # || true
       yarvasm = dump_and_exec(@yarv, str)
       assert_equal(ruby.gsub(/\r/, ''), yarvasm.gsub(/\r/, ''))
     end


-- 
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]