1998-01-16 07:13:05 -05:00
|
|
|
$/ = nil
|
|
|
|
while gets()
|
1998-01-16 07:19:22 -05:00
|
|
|
if /^((void|VALUE|int|char *\*|ID|struct [\w_]+ *\*|st_table *\*) *)?\n([\w\d_]+)\(.*\)\n\s*((.+;\n)*)\{/
|
1998-01-16 07:13:05 -05:00
|
|
|
$_ = $'
|
|
|
|
printf "%s %s(", $2, $3
|
|
|
|
args = []
|
|
|
|
for arg in $4.split(/;\n\s*/)
|
|
|
|
arg.gsub! ' +', ' '
|
|
|
|
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
|