1998-01-16 07:13:05 -05:00
|
|
|
$/ = nil
|
2000-12-28 00:00:47 -05:00
|
|
|
while line = gets()
|
|
|
|
if /^((void|VALUE|int|char *\*|ID|struct [\w_]+ *\*|st_table *\*) *)?\n([\w\d_]+)\(.*\)\n\s*((.+;\n)*)\{/ =~ line
|
2002-07-26 03:47:50 -04:00
|
|
|
line = $'
|
1998-01-16 07:13:05 -05:00
|
|
|
printf "%s %s(", $2, $3
|
|
|
|
args = []
|
|
|
|
for arg in $4.split(/;\n\s*/)
|
2002-07-26 03:47:50 -04:00
|
|
|
arg.gsub!(/ +/, ' ')
|
1998-01-16 07:13:05 -05:00
|
|
|
if arg =~ /,/
|
|
|
|
if arg =~ /(([^*]+) *\** *[\w\d_]+),/
|
1999-01-19 23:59:39 -05:00
|
|
|
type = $2.strip
|
|
|
|
args.push $1.strip
|
1998-01-16 07:13:05 -05:00
|
|
|
arg = $'
|
|
|
|
else
|
|
|
|
type = ""
|
|
|
|
end
|
2000-02-08 03:54:01 -05:00
|
|
|
while arg.sub!(/(\** *[\w\d_]+)(,|$)/, "") && $~
|
1999-01-19 23:59:39 -05:00
|
|
|
args.push type + " " + $1.strip
|
1998-01-16 07:13:05 -05:00
|
|
|
end
|
|
|
|
else
|
1999-01-19 23:59:39 -05:00
|
|
|
args.push arg.strip
|
1998-01-16 07:13:05 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
printf "%s);\n", args.join(', ')
|
|
|
|
redo
|
|
|
|
end
|
|
|
|
end
|