1998-01-16 15:13:05 +03:00
|
|
|
$/ = nil
|
2000-12-28 08:00:47 +03:00
|
|
|
while line = gets()
|
2010-04-06 07:01:52 +04:00
|
|
|
if /^((void|VALUE|int|char *\*|ID|struct \w+ *\*|st_table *\*) *)?\n(\w+)\(.*\)\n\s*((.+;\n)*)\{/ =~ line
|
2002-07-26 11:47:50 +04:00
|
|
|
line = $'
|
1998-01-16 15:13:05 +03:00
|
|
|
printf "%s %s(", $2, $3
|
|
|
|
args = []
|
|
|
|
for arg in $4.split(/;\n\s*/)
|
2002-07-26 11:47:50 +04:00
|
|
|
arg.gsub!(/ +/, ' ')
|
1998-01-16 15:13:05 +03:00
|
|
|
if arg =~ /,/
|
2010-04-06 07:01:52 +04:00
|
|
|
if arg =~ /(([^*]+) *\** *\w+),/
|
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
|
2010-04-06 07:01:52 +04:00
|
|
|
while arg.sub!(/(\** *\w+)(,|$)/, "") && $~
|
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
|