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