1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sample/mkproto.rb: ditto and fix bug.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2002-07-26 07:47:50 +00:00
parent d365d1f568
commit 52ecaae5b6
2 changed files with 4 additions and 2 deletions

View file

@ -1,11 +1,11 @@
$/ = nil
while line = gets()
if /^((void|VALUE|int|char *\*|ID|struct [\w_]+ *\*|st_table *\*) *)?\n([\w\d_]+)\(.*\)\n\s*((.+;\n)*)\{/ =~ line
$_ = $'
line = $'
printf "%s %s(", $2, $3
args = []
for arg in $4.split(/;\n\s*/)
arg.gsub! ' +', ' '
arg.gsub!(/ +/, ' ')
if arg =~ /,/
if arg =~ /(([^*]+) *\** *[\w\d_]+),/
type = $2.strip