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

ruby-changes:25819

From: ko1 <ko1@a...>
Date: Tue, 27 Nov 2012 08:25:45 +0900 (JST)
Subject: [ruby-changes:25819] ko1:r37876 (trunk): * vm_trace.c: rename TracePoint#file and TracePoint#line

ko1	2012-11-27 08:25:21 +0900 (Tue, 27 Nov 2012)

  New Revision: 37876

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

  Log:
    * vm_trace.c: rename TracePoint#file and TracePoint#line
      to TracePoint#path and TracePoint#lineno respectively.
      They are consistent to RubyVM::Backtrace::Location.
    * include/ruby/debug.h: ditto.
    * vm_core.h: ditto.
    * test/ruby/test_settracefunc.rb: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/debug.h
    trunk/test/ruby/test_settracefunc.rb
    trunk/vm_core.h
    trunk/vm_trace.c

Index: include/ruby/debug.h
===================================================================
--- include/ruby/debug.h	(revision 37875)
+++ include/ruby/debug.h	(revision 37876)
@@ -52,8 +52,8 @@
 VALUE rb_tracepoint_enabled_p(VALUE tpval);
 
 VALUE rb_tracepoint_attr_event(VALUE tpval);
-VALUE rb_tracepoint_attr_line(VALUE tpval);
-VALUE rb_tracepoint_attr_file(VALUE tpval);
+VALUE rb_tracepoint_attr_lineno(VALUE tpval);
+VALUE rb_tracepoint_attr_path(VALUE tpval);
 VALUE rb_tracepoint_attr_id(VALUE tpval);
 VALUE rb_tracepoint_attr_klass(VALUE tpval);
 VALUE rb_tracepoint_attr_binding(VALUE tpval);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 37875)
+++ ChangeLog	(revision 37876)
@@ -1,3 +1,15 @@
+Tue Nov 27 08:16:03 2012  Koichi Sasada  <ko1@a...>
+
+	* vm_trace.c: rename TracePoint#file and TracePoint#line
+	  to TracePoint#path and TracePoint#lineno respectively.
+	  They are consistent to RubyVM::Backtrace::Location.
+
+	* include/ruby/debug.h: ditto.
+
+	* vm_core.h: ditto.
+
+	* test/ruby/test_settracefunc.rb: ditto.
+
 Tue Nov 27 08:04:26 2012  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 37875)
+++ vm_core.h	(revision 37876)
@@ -909,8 +909,8 @@
     int klass_solved;
 
     /* calc from cfp */
-    int line;
-    VALUE file;
+    int lineno;
+    VALUE path;
 } rb_trace_arg_t;
 
 void rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg);
@@ -926,7 +926,7 @@
 	    trace_arg.id = (id_); \
 	    trace_arg.klass = (klass_); \
 	    trace_arg.data = (data_); \
-	    trace_arg.file = Qundef; \
+	    trace_arg.path = Qundef; \
 	    trace_arg.klass_solved = 0; \
 	    rb_threadptr_exec_event_hooks(&trace_arg); \
 	} \
Index: vm_trace.c
===================================================================
--- vm_trace.c	(revision 37875)
+++ vm_trace.c	(revision 37876)
@@ -643,38 +643,38 @@
 VALUE rb_binding_new_with_cfp(rb_thread_t *th, rb_control_frame_t *src_cfp);
 
 static void
-fill_file_and_line(rb_trace_arg_t *trace_arg)
+fill_path_and_lineno(rb_trace_arg_t *trace_arg)
 {
-    if (trace_arg->file == Qundef) {
+    if (trace_arg->path == Qundef) {
 	rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(trace_arg->th, trace_arg->cfp);
 
 	if (cfp) {
-	    trace_arg->file = cfp->iseq->location.path;
-	    trace_arg->line = rb_vm_get_sourceline(cfp);
+	    trace_arg->path = cfp->iseq->location.path;
+	    trace_arg->lineno = rb_vm_get_sourceline(cfp);
 	}
 	else {
-	    trace_arg->file = Qnil;
-	    trace_arg->line = 0;
+	    trace_arg->path = Qnil;
+	    trace_arg->lineno = 0;
 	}
     }
 }
 
 VALUE
-rb_tracepoint_attr_line(VALUE tpval)
+rb_tracepoint_attr_lineno(VALUE tpval)
 {
     rb_tp_t *tp = tpptr(tpval);
     tp_attr_check_active(tp);
-    fill_file_and_line(tp->trace_arg);
-    return INT2FIX(tp->trace_arg->line);
+    fill_path_and_lineno(tp->trace_arg);
+    return INT2FIX(tp->trace_arg->lineno);
 }
 
 VALUE
-rb_tracepoint_attr_file(VALUE tpval)
+rb_tracepoint_attr_path(VALUE tpval)
 {
     rb_tp_t *tp = tpptr(tpval);
     tp_attr_check_active(tp);
-    fill_file_and_line(tp->trace_arg);
-    return tp->trace_arg->file;
+    fill_path_and_lineno(tp->trace_arg);
+    return tp->trace_arg->path;
 }
 
 static void
@@ -957,8 +957,8 @@
     rb_define_method(rb_cTracePoint, "enabled?", rb_tracepoint_enabled_p, 0);
 
     rb_define_method(rb_cTracePoint, "event", rb_tracepoint_attr_event, 0);
-    rb_define_method(rb_cTracePoint, "line", rb_tracepoint_attr_line, 0);
-    rb_define_method(rb_cTracePoint, "file", rb_tracepoint_attr_file, 0);
+    rb_define_method(rb_cTracePoint, "lineno", rb_tracepoint_attr_lineno, 0);
+    rb_define_method(rb_cTracePoint, "path", rb_tracepoint_attr_path, 0);
     rb_define_method(rb_cTracePoint, "id", rb_tracepoint_attr_id, 0);
     rb_define_method(rb_cTracePoint, "klass", rb_tracepoint_attr_klass, 0);
     rb_define_method(rb_cTracePoint, "binding", rb_tracepoint_attr_binding, 0);
Index: test/ruby/test_settracefunc.rb
===================================================================
--- test/ruby/test_settracefunc.rb	(revision 37875)
+++ test/ruby/test_settracefunc.rb	(revision 37876)
@@ -418,7 +418,7 @@
 
     eval <<-EOF.gsub(/^.*?: /, ""), nil, 'xyzzy'
     1: trace = TracePoint.trace(*trace_events){|tp|
-    2:   events << [tp.event, tp.line, tp.file, tp.klass, tp.id, tp.self, tp.binding.eval("local_var"), get_data.(tp)]
+    2:   events << [tp.event, tp.lineno, tp.path, tp.klass, tp.id, tp.self, tp.binding.eval("local_var"), get_data.(tp)]
     3: }
     4: 1.times{|;local_var| local_var = :inner
     5:   tap{}
@@ -584,9 +584,9 @@
     tap{}
     trace.disable
 
-    assert_raise(RuntimeError){tp_store.line}
+    assert_raise(RuntimeError){tp_store.lineno}
     assert_raise(RuntimeError){tp_store.event}
-    assert_raise(RuntimeError){tp_store.file}
+    assert_raise(RuntimeError){tp_store.path}
     assert_raise(RuntimeError){tp_store.id}
     assert_raise(RuntimeError){tp_store.klass}
     assert_raise(RuntimeError){tp_store.binding}

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

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