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

yarv-diff:92

From: ko1 atdot.net
Date: 18 Aug 2005 14:36:42 -0000
Subject: [yarv-diff:92] r248 - in trunk: . rb win32 yarvtest

Author: ko1
Date: 2005-08-18 23:36:41 +0900 (Thu, 18 Aug 2005)
New Revision: 248

Added:
   trunk/rb/ir.rb
Removed:
   trunk/rb/diff.rb
Modified:
   trunk/ChangeLog
   trunk/common.mk
   trunk/error.c
   trunk/parse.y
   trunk/test.rb
   trunk/variable.c
   trunk/version.c
   trunk/version.h
   trunk/win32/win32.c
   trunk/yarvtest/test_test.rb
   trunk/yarvtest/yarvtest.rb
Log:
	* common.mk : fix object file extension

	* rb/ir.rb : added (import ruby script)

	* rb/diff.rb : removed

	* import today's ruby HEAD



Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/ChangeLog	2005-08-18 14:36:41 UTC (rev 248)
@@ -4,14 +4,25 @@
 #  from Mon, 03 May 2004 01:24:19 +0900
 #
 
-2005-08-18(Thu) 12:59:38 +0900
+2005-08-18(Thu) 23:29:52 +0900  Koichi Sasada  <ko1 atdot.net>
 
-	* common.mk : 
+	* common.mk : fix object file extension
 
+	* rb/ir.rb : added (import ruby script)
+
+	* rb/diff.rb : removed
+
+	* import today's ruby HEAD
+
+
+2005-08-18(Thu) 12:59:38 +0900  Koichi Sasada  <ko1 atdot.net>
+
+	* common.mk : rule test -> test2, test1 -> test
+
 	* compile.c : fix when clause bug and splat arugment
 
 
-2005-08-17(Wed) 05:22:31 +0900
+2005-08-17(Wed) 05:22:31 +0900  Koichi Sasada  <ko1 atdot.net>
 
 	* compile.c : fix block local parameter setting routine and support
 	massign in block parameter initialze

Modified: trunk/common.mk
===================================================================
--- trunk/common.mk	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/common.mk	2005-08-18 14:36:41 UTC (rev 248)
@@ -339,15 +339,18 @@
   {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
   {$(VPATH)}version.h {$(VPATH)}yarv_version.h rev.inc
 
-compile.o:   {$(VPATH)}compile.c {$(VPATH)}yarvcore.h {$(VPATH)}compile.h {$(VPATH)}debug.h \
-             insns.inc insns_info.inc optinsn.inc opt_sc.inc optunifs.inc
-disasm.o:    {$(VPATH)}disasm.c {$(VPATH)}yarvcore.h {$(VPATH)}debug.h
-vm.o:        {$(VPATH)}vm.c {$(VPATH)}vm.h {$(VPATH)}insnhelper.h {$(VPATH)}yarvcore.h {$(VPATH)}debug.h \
-             {$(VPATH)}vm_evalbody.h insns.inc vm.inc vmtc.inc vm_macro.inc
-vm_dump.o:   {$(VPATH)}yarvcore.h {$(VPATH)}vm.h
-yarvcore.o:  {$(VPATH)}yarvcore.c {$(VPATH)}yarvcore.h {$(VPATH)}yarv_version.h {$(VPATH)}debug.h rev.inc
-debug.o:     {$(VPATH)}debug.h
-yarvsubst.o: {$(VPATH)}yarv.h
+compile.$(OBJEXT): {$(VPATH)}compile.c {$(VPATH)}yarvcore.h \
+        {$(VPATH)}compile.h {$(VPATH)}debug.h \
+        insns.inc insns_info.inc optinsn.inc opt_sc.inc optunifs.inc
+disasm.$(OBJEXT): {$(VPATH)}disasm.c {$(VPATH)}yarvcore.h {$(VPATH)}debug.h
+vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}vm.h {$(VPATH)}insnhelper.h \
+        {$(VPATH)}yarvcore.h {$(VPATH)}debug.h {$(VPATH)}vm_evalbody.h \
+        insns.inc vm.inc vmtc.inc vm_macro.inc
+vm_dump.$(OBJEXT): {$(VPATH)}yarvcore.h {$(VPATH)}vm.h
+yarvcore.$(OBJEXT): {$(VPATH)}yarvcore.c {$(VPATH)}yarvcore.h \
+        {$(VPATH)}yarv_version.h {$(VPATH)}debug.h rev.inc
+debug.$(OBJEXT): {$(VPATH)}debug.h
+yarvsubst.$(OBJEXT): {$(VPATH)}yarv.h
 
 
 BASERUBY = ruby
@@ -398,21 +401,21 @@
 	$(BASERUBY) -I$(srcdir)/lib $(srcdir)/test.rb $(MINIRUBY) $(BASERUBY) $(RUNOPT)
 
 run: all
-	$(MINIRUBY) $(srcdir)/test1.rb
+	$(MINIRUBY) $(srcdir)/test.rb
 
 parse: all
-	$(MINIRUBY) $(srcdir)/rb/parse.rb $(srcdir)/test1.rb
+	$(MINIRUBY) $(srcdir)/rb/parse.rb $(srcdir)/test.rb
 
 runp: all
-	$(MINIRUBY) $(srcdir)/rb/parse.rb $(srcdir)/test1.rb
-	$(MINIRUBY) $(srcdir)/test1.rb
+	$(MINIRUBY) $(srcdir)/rb/parse.rb $(srcdir)/test.rb
+	$(MINIRUBY) $(srcdir)/test.rb
 
 benchmark: all
 	$(BASERUBY) -I$(srcdir) $(srcdir)/benchmark/run_rite.rb $(OPT) $(ITEMS) --yarv-program=$(MINIRUBY) --ruby-program=$(BASERUBY)
 
 ITEM=bmx_temp
 tbench: all
-	$(RUBY) -I$(srcdir) $(srcdir)/benchmark/run_rite.rb $(ITEM) $(OPT) --yarv-program=$(MINIRUBY) --ruby-program=$(BASERUBY)
+	$(BASERUBY) -I$(srcdir) $(srcdir)/benchmark/run_rite.rb $(ITEM) $(OPT) --yarv-program=$(MINIRUBY) --ruby-program=$(BASERUBY)
 aotc:
 	$(RUBY) -I$(srcdir) -I. $(srcdir)/rb/aotcompile.rb $(INSNS2VMOPT)
 
@@ -420,4 +423,4 @@
 	echo run > run.gdb
 
 gdb: all run.gdb
-	gdb -x run.gdb --quiet --args $(MINIRUBY) -I$(srcdir) $(srcdir)/test1.rb
+	gdb -x run.gdb --quiet --args $(MINIRUBY) -I$(srcdir) $(srcdir)/test.rb

Modified: trunk/error.c
===================================================================
--- trunk/error.c	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/error.c	2005-08-18 14:36:41 UTC (rev 248)
@@ -11,6 +11,7 @@
 **********************************************************************/
 
 #include "ruby.h"
+#include "env.h"
 #include "st.h"
 
 #include <stdio.h>
@@ -32,12 +33,6 @@
 
 int ruby_nerrs;
 
-/* TODO */
-RUBY_EXTERN int ruby_in_eval;
-static ID rb_get_callee_id(){
-  return rb_intern("<TODO>");
-}
-
 static int
 err_position(buf, len)
     char *buf;
@@ -1149,7 +1144,7 @@
 {
   rb_raise(rb_eNotImpError,
            "The %s() function is unimplemented on this machine",
-           rb_id2name(rb_get_callee_id()));
+	     rb_id2name(ruby_frame->callee));
 }
 
 void

Modified: trunk/parse.y
===================================================================
--- trunk/parse.y	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/parse.y	2005-08-18 14:36:41 UTC (rev 248)
@@ -3,7 +3,7 @@
   parse.y -
 
   $Author: matz $
-  $Date: 2005/08/12 08:13:27 $
+  $Date: 2005/08/16 15:24:14 $
   created at: Fri May 28 18:02:42 JST 1993
 
   Copyright (C) 1993-2004 Yukihiro Matsumoto
@@ -16,9 +16,6 @@
 
 #include "ruby.h"
 #include "env.h"
-// TODO
-// static int ruby_in_eval = 1;
-
 #include "intern.h"
 #include "node.h"
 #include "st.h"
@@ -600,8 +597,8 @@
 		    /*%%%*/
 			lex_state = EXPR_BEG;
 			top_local_init();
-			class_nest = 0;//if (ruby_class == rb_cObject) class_nest = 0;
-                        //else class_nest = 1;
+			if (ruby_class == rb_cObject) class_nest = 0;
+                        else class_nest = 1;
 		    /*%
 		        lex_state = EXPR_BEG;
 		        class_nest = !parser->toplevel_p;
@@ -2609,8 +2606,7 @@
 			$$ = dispatch2(iter_block, $1, $2);
 		    %*/
 		    }
-		| tLAMBDA
-		  lambda
+		| tLAMBDA lambda
 		    {
 			$$ = $2;
 		    }
@@ -3181,13 +3177,15 @@
 		;
 
 lambda		: {
-			$<num>$ = lpar_beg;
-			lpar_beg = ++paren_nest;
 		    /*%%%*/
 			$<vars>$ = dyna_push();
 		    /*%
 		    %*/
 		    }
+                  {
+			$<num>$ = lpar_beg;
+ 			lpar_beg = ++paren_nest;
+		  }
 		  f_larglist
 		    {
 		        $<vars>$ = ruby_dyna_vars;
@@ -3195,11 +3193,12 @@
 		  lambda_body
 		    {
 		    /*%%%*/
-			$$ = $2;
-                        $$->nd_body = block_append($$->nd_body, $4);
+			$$ = $3;
+                        $$->nd_body = block_append($$->nd_body, $5);
 			dyna_pop($<vars>1);
+			lpar_beg = $<num>2;
 		    /*%
-		    	$$ = dispatch2(lambda, $2, $4);
+		    	$$ = dispatch2(lambda, $3, $5);
 		    %*/
 		    }
 		;
@@ -3222,15 +3221,11 @@
 		    }
 		;
 
-lambda_body	: tLAMBEG
-		  compstmt
-		  '}'
+lambda_body	: tLAMBEG compstmt '}'
 		    {
 			$$ = $2;
 		    }
-		| kDO_LAMBDA
-		  compstmt
-		  kEND
+		| kDO_LAMBDA compstmt kEND
 		    {
 			$$ = $2;
 		    }
@@ -4363,7 +4358,6 @@
 		    }
 		;
 %%
-
 # undef parser
 # undef yylex
 # undef yylval
@@ -6484,6 +6478,8 @@
       case '{':
 	if (lpar_beg && lpar_beg == paren_nest) {
 	    lex_state = EXPR_BEG;
+	    lpar_beg = 0;
+	    --paren_nest;
 	    return tLAMBEG;
 	}
 	if (IS_ARG() || lex_state == EXPR_END || lex_state == EXPR_END2)
@@ -6804,6 +6800,8 @@
 		    }
 		    if (kw->id[0] == kDO) {
 			if (lpar_beg && lpar_beg == paren_nest) {
+			    lpar_beg = 0;
+			    --paren_nest;
 			    return kDO_LAMBDA;
 			}
 			if (COND_P()) return kDO_COND;
@@ -8721,6 +8719,8 @@
     parser->parser_cond_stack = 0;
     parser->parser_cmdarg_stack = 0;
     parser->parser_class_nest = 0;
+    parser->parser_paren_nest = 0;
+    parser->parser_lpar_beg = 0;
     parser->parser_in_single = 0;
     parser->parser_in_def = 0;
     parser->parser_in_defined = 0;

Deleted: trunk/rb/diff.rb
===================================================================
--- trunk/rb/diff.rb	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/rb/diff.rb	2005-08-18 14:36:41 UTC (rev 248)
@@ -1,29 +0,0 @@
-rubydir = ARGV.shift or raise "specify Ruby HEAD directory"
-
-if rubydir == 'clean'
-  system('rm -f p.* *.rej *.orig')
-  exit
-end
-
-if ARGV.size > 0
-  dirs = ARGV
-else
-  dirs = Dir.glob('*.[chy]')
-end
-
-IGNORE = ['eval.c', 'version.c', 'inits.c']
-
-dirs.each{|f|
-  rubyfile = File.join(rubydir, f)
-  if FileTest.exist?(rubyfile) && !IGNORE.include?(f)
-    diff = `diff -b -U 8 #{f} #{rubyfile}`
-    if diff.size > 0
-      p f
-      open("p.#{f}", 'w'){|f|
-        f.write diff
-      }
-      puts diff
-    end
-  end
-}
-

Added: trunk/rb/ir.rb
===================================================================
--- trunk/rb/ir.rb	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/rb/ir.rb	2005-08-18 14:36:41 UTC (rev 248)
@@ -0,0 +1,52 @@
+#
+# import ruby
+
+
+IGNORE = ['eval.c', 'version.c', 'inits.c']
+
+def output_filename f
+  "_.#{f}".tr('/', '_')
+end
+
+def diff rubydir, *files
+  if files.size == 0
+    files = Dir.glob('**/*.[chy]') + Dir.glob('**/*.rb')
+  end
+  
+  files.each{|f|
+    rubyfile = File.join(rubydir, f)
+    if FileTest.exist?(rubyfile) && !IGNORE.include?(f)
+      diff = `diff -b -U 8 "#{f}" "#{rubyfile}"`
+      if diff.size > 0
+        p f
+        open(output_filename(f), 'w'){|f|
+          f.write diff
+        }
+        puts diff
+      end
+    end
+  }
+end
+
+def patch file
+  raise 'specify patched file: #{file.dump}' if !file || !FileTest.exist?(file)
+  cmd = "patch -lp0 --no-backup-if-mismatch -i #{output_filename(file)}"
+  puts cmd
+  if system(cmd)
+    `rm "#{output_filename(file)}"`
+  end
+end
+
+def cleanup
+  system('rm -f _.* *.rej *.orig')
+end
+
+
+case ARGV[0]
+when 'diff'
+  diff ARGV[1..-1]
+when 'patch'
+  patch ARGV[1]
+when 'cleanup'
+  cleanup
+end

Modified: trunk/test.rb
===================================================================
--- trunk/test.rb	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/test.rb	2005-08-18 14:36:41 UTC (rev 248)
@@ -1,23 +1,14 @@
-def m *args
-  p args
-end
+IO.popen('sort', 'r+'){|io|
+  io.write %Q{
+    p 1
+    p 3
+    p 2
+  }
+  io.print "\x1a"
 
-
-__END__
-def iter
-  yield 1,2
-end
-
-iter{|x, *a|
-  p a
+  while c = io.read(1)
+    p io.eof?
+    p c
+  end
 }
 
-
-__END__
-__END__
-a = 1
-END{
-  p a
-  p :POSTEXE
-}
-p :FINISH

Modified: trunk/variable.c
===================================================================
--- trunk/variable.c	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/variable.c	2005-08-18 14:36:41 UTC (rev 248)
@@ -13,7 +13,7 @@
 **********************************************************************/
 
 #include "ruby.h"
-// #include "env.h"
+#include "env.h"
 #include "node.h"
 #include "st.h"
 #include "util.h"
@@ -1249,8 +1249,7 @@
 rb_mod_const_missing(klass, name)
     VALUE klass, name;
 {
-  // TODO
-//    ruby_frame = ruby_frame->prev; /* pop frame for "const_missing" */
+    ruby_frame = ruby_frame->prev; /* pop frame for "const_missing" */
     uninitialized_constant(klass, rb_to_id(name));
     return Qnil;		/* not reached */
 }

Modified: trunk/version.c
===================================================================
--- trunk/version.c	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/version.c	2005-08-18 14:36:41 UTC (rev 248)
@@ -39,8 +39,7 @@
 {
 #include "rev.inc"
   printf("ruby %s (%s) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM);
-  printf("%s (rev: %s)\n", yarv_version, rev);
-  printf("YARVCore options: %s\n", yarv_options);
+  printf("%s (rev: %s) [opts: %s]\n", yarv_version, rev, yarv_options);
   fflush(stdout);
 }
 

Modified: trunk/version.h
===================================================================
--- trunk/version.h	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/version.h	2005-08-18 14:36:41 UTC (rev 248)
@@ -1,14 +1,14 @@
 #define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2005-08-15"
+#define RUBY_RELEASE_DATE "2005-08-18"
 #define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20050815
+#define RUBY_RELEASE_CODE 20050818
 
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 0
 #define RUBY_RELEASE_YEAR 2005
 #define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 15
+#define RUBY_RELEASE_DAY 18
 
 RUBY_EXTERN const char ruby_version[];
 RUBY_EXTERN const char ruby_release_date[];

Modified: trunk/win32/win32.c
===================================================================
--- trunk/win32/win32.c	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/win32/win32.c	2005-08-18 14:36:41 UTC (rev 248)
@@ -2503,7 +2503,7 @@
 
     RUBY_CRITICAL({
 	do {
-	    svr = socket(af, type, protocol);
+	    svr = open_ifs_socket(af, type, protocol);
 	    if (svr == INVALID_SOCKET)
 		break;
 	    if (bind(svr, addr, len) < 0)
@@ -2513,7 +2513,7 @@
 	    if (type == SOCK_STREAM)
 		listen(svr, 5);
 
-	    w = socket(af, type, protocol);
+	    w = open_ifs_socket(af, type, protocol);
 	    if (w == INVALID_SOCKET)
 		break;
 	    if (connect(w, addr, len) < 0)

Modified: trunk/yarvtest/test_test.rb
===================================================================
--- trunk/yarvtest/test_test.rb	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/yarvtest/test_test.rb	2005-08-18 14:36:41 UTC (rev 248)
@@ -3,5 +3,6 @@
 # test of syntax
 class TestTest < YarvTestBase
   def test_1
+    ae '100'
   end
 end

Modified: trunk/yarvtest/yarvtest.rb
===================================================================
--- trunk/yarvtest/yarvtest.rb	2005-08-18 04:01:48 UTC (rev 247)
+++ trunk/yarvtest/yarvtest.rb	2005-08-18 14:36:41 UTC (rev 248)
@@ -58,12 +58,17 @@
   end
 
   def exec exec_file, program
-    r = nil
+    r = ''
     IO.popen("#{exec_file}", 'r+'){|io|
       #
       io.write program
       io.close_write
-      r = io.read
+      begin
+        while line = io.gets
+          r << line
+        end
+      rescue => e
+      end
     }
     r
   end
@@ -74,11 +79,11 @@
         #{str}
       })
     }
-    
+
     ruby = exec(@ruby, str)
     yarv = exec(@yarv, str)
 
-    if $DEBUG
+    if $DEBUG #|| true
       puts "yarv (#@yarv): #{yarv}"
       puts "ruby (#@ruby): #{ruby}"
     end


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

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