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 =~ /,/
|
2013-07-20 17:41:02 +04:00
|
|
|
if arg =~ /(([^*]+) *\** *\w+),/
|
|
|
|
type = $2.strip
|
|
|
|
args.push $1.strip
|
|
|
|
arg = $'
|
|
|
|
else
|
|
|
|
type = ""
|
|
|
|
end
|
|
|
|
while arg.sub!(/(\** *\w+)(,|$)/, "") && $~
|
|
|
|
args.push type + " " + $1.strip
|
|
|
|
end
|
1998-01-16 15:13:05 +03:00
|
|
|
else
|
2013-07-20 17:41:02 +04:00
|
|
|
args.push arg.strip
|
1998-01-16 15:13:05 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
printf "%s);\n", args.join(', ')
|
|
|
|
redo
|
|
|
|
end
|
|
|
|
end
|