diff options
Diffstat (limited to 'harness/tools/genintf.pl')
-rw-r--r-- | harness/tools/genintf.pl | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/harness/tools/genintf.pl b/harness/tools/genintf.pl index 6f53951..d446d83 100644 --- a/harness/tools/genintf.pl +++ b/harness/tools/genintf.pl @@ -6,25 +6,38 @@ print "#ifndef _PLUG_INTF\n"; print "#define _PLUG_INTF\n"; print "\n#include <stdint.h>\n"; print "\ntypedef void* opqst_t;\n"; -while (<>) { + +while (<STDIN>) { if (/^\s*\/\*/) { $_ =~ s/^\s*//; $comment="$_"; + next; } if (/^\s*\*/) { $_ =~ s/^\s*/ /; $comment="$comment$_"; + next; } - if (/^\s*EXPORT_INCLUDE\((.*)\)/) { - print "#include $1\n"; - } elsif (/^\s*EXPORT\(\s*((?:\w|\s*\*\s*)+)\s*\(\*(\w+)\)\s*\((.*)\)\);/) { - print "$comment"; - print "$1 $2($3);\n\n"; - $comment=""; - } elsif (/^\s*EXPORT\((.*)\)/) { - print "$1\n"; + if (/^\s*EXPORT/) { + my $line = "$_"; + while (not ($line =~ /;$/)) { + my $nextline = <STDIN>; + last unless defined $nextline; + + $line="$line$nextline"; + } + + if ($line =~ /^\s*EXPORT_INCLUDE\((.*)\)/s) { + print "#include $1\n"; + } elsif ($line =~ /^\s*EXPORT\(\s*((?:\w|\s*\*\s*)+)\s*\(\*(\w+)\)\s*\((.*)\)\);/s) { + print "$comment"; + print "$1 $2($3);\n\n"; + $comment=""; + } elsif ($line =~ /^\s*EXPORT\((.*)\);/s) { + print "$1\n"; + } } } print "#endif /* _PLUG_INTF */\n"; |