* 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

@ -2,6 +2,8 @@ Fri Jul 26 16:01:16 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* ext/extmk.rb.in (create_makefile): use Regexp in gsub. * ext/extmk.rb.in (create_makefile): use Regexp in gsub.
* sample/mkproto.rb: ditto and fix bug.
Fri Jul 26 14:31:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org> Fri Jul 26 14:31:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* random.c: replace with Mersenne Twister RNG. * random.c: replace with Mersenne Twister RNG.

View File

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