2012-11-13 01:13:39 -05:00
|
|
|
#!/usr/bin/ruby
|
2012-11-16 12:02:39 -05:00
|
|
|
# -*- coding: us-ascii -*-
|
2012-11-13 01:13:39 -05:00
|
|
|
|
|
|
|
text = ARGF.read
|
2012-11-22 03:41:19 -05:00
|
|
|
text.gsub!(/^(?!#)(.*)/){$1.upcase}
|
2012-11-13 01:13:39 -05:00
|
|
|
|
|
|
|
# remove the pragma declarations
|
2012-11-22 03:41:19 -05:00
|
|
|
text.gsub!(/^#pragma.*$/, '')
|
2012-11-13 01:13:39 -05:00
|
|
|
|
|
|
|
# replace the provider section with the start of the header file
|
2012-11-16 12:02:39 -05:00
|
|
|
text.gsub!(/PROVIDER RUBY \{/, "#ifndef\t_PROBES_H\n#define\t_PROBES_H\n#define DTRACE_PROBES_DISABLED 1\n")
|
2012-11-13 01:13:39 -05:00
|
|
|
|
|
|
|
# finish up the #ifndef sandwich
|
|
|
|
text.gsub!(/\};/, "#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!(/ *PROBE ([^\(]*)(\([^\)]*\));/, "#define RUBY_DTRACE_\\1_ENABLED() 0\n#define RUBY_DTRACE_\\1\\2\ do \{ \} while\(0\)")
|
2012-12-01 10:25:31 -05:00
|
|
|
puts "/* -*- c -*- */"
|
2012-11-13 01:13:39 -05:00
|
|
|
print text
|
2012-11-22 03:41:19 -05:00
|
|
|
|