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

ruby-changes:27667

From: nobu <ko1@a...>
Date: Mon, 11 Mar 2013 14:25:15 +0900 (JST)
Subject: [ruby-changes:27667] nobu:r39719 (trunk): gen_dummy_probes.rb

nobu	2013-03-11 14:25:06 +0900 (Mon, 11 Mar 2013)

  New Revision: 39719

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

  Log:
    gen_dummy_probes.rb
    
    * tool/gen_dummy_probes.rb: remove empty lines and compact.
    
    * tool/gen_dummy_probes.rb: allow arbitrary number of arguments.

  Modified files:
    trunk/probes.d
    trunk/tool/gen_dummy_probes.rb

Index: probes.d
===================================================================
--- probes.d	(revision 39718)
+++ probes.d	(revision 39719)
@@ -1,3 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/probes.d#L1
+/* -*- c -*- */
 #include "vm_opts.h"
 
 provider ruby {
Index: tool/gen_dummy_probes.rb
===================================================================
--- tool/gen_dummy_probes.rb	(revision 39718)
+++ tool/gen_dummy_probes.rb	(revision 39719)
@@ -5,24 +5,22 @@ text = ARGF.read https://github.com/ruby/ruby/blob/trunk/tool/gen_dummy_probes.rb#L5
 text.gsub!(/^(?!#)(.*)/){$1.upcase}
 
 # remove comments
-text.gsub!(%r'/\*.*?\*/'m, '')
+text.gsub!(%r'(?:^ *)?/\*.*?\*/\n?'m, '')
 
 # remove the pragma declarations
-text.gsub!(/^#pragma.*$/, '')
+text.gsub!(/^#pragma.*\n/, '')
 
 # replace the provider section with the start of the header file
 text.gsub!(/PROVIDER RUBY \{/, "#ifndef\t_PROBES_H\n#define\t_PROBES_H\n#define DTRACE_PROBES_DISABLED 1\n")
 
 # finish up the #ifndef sandwich
-text.gsub!(/\};/, "#endif\t/* _PROBES_H */")
+text.gsub!(/\};/, "\n#endif\t/* _PROBES_H */")
 
 text.gsub!(/__/, '_')
 
-text.gsub!(/\([^,)]+\)/, '(arg0)')
-text.gsub!(/\([^,)]+,[^,)]+\)/, '(arg0, arg1)')
-text.gsub!(/\([^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2)')
-text.gsub!(/\([^,)]+,[^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2, arg3)')
-text.gsub!(/\([^,)]+,[^,)]+,[^,)]+,[^,)]+,[^,)]+\)/, '(arg0, arg1, arg2, arg3, arg4)')
+text.gsub!(/\((.+?)(?=\);)/) {
+  "(arg" << (0..$1.count(',')).to_a.join(", arg")
+}
 
 text.gsub!(/ *PROBE ([^\(]*)(\([^\)]*\));/, "#define RUBY_DTRACE_\\1_ENABLED() 0\n#define RUBY_DTRACE_\\1\\2\ do \{ \} while\(0\)")
 puts "/* -*- c -*- */"

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

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