- chop;
- s/#.*$//;
- if (m/^header (.*) (.*) \{/) {
- $library = $1;
- $header = $2;
- push @headers, $header;
-
- print STDERR "cproto -q -x ${cprotoArgs} $basedir/$header\n";
- %proto = ();
- open (PROTO, "cproto -q -x ${cprotoArgs} $basedir/$header|") || die("cproto failed");
-
- while (<PROTO>) {
- chop;
- $cproto = $_;
- if (m/([a-zA-Z0-9_]*)\(/) {
- $func = $1;
- $proto{$func} = $cproto;
- }
- }
- close PROTO;
-
- if ($library ne $last_library) {
- push @functions, "#$library";
- $last_library = $library;
- }
- $mode = "proto";
- } elsif (m/^java (.*) (.*) \{/) {
- $name = $1;
- $class = $2;
- $mode = "java";
- push @classes,"#$name:$class";
- } elsif (m/^}$/) {
- $mode = "";
- } elsif ($mode eq "proto") {
- if (m/\s*([a-zA-Z0-9_]+)/) {
- my $func= $1;
- my $cproto = $proto{$func};
-
- die ("No function $func in $header") if !defined($cproto);
-
- push @functions, $cproto;
+ chop;
+ s/#.*$//;
+ if (m/^header (.*) (.*) \{/) {
+ $library = $1;
+ $header = $2;
+ push @headers, $header;
+
+ print STDERR "cproto -q -x ${cprotoArgs} $basedir/$header\n";
+ %proto = ();
+ open (PROTO, "cproto -q -x ${cprotoArgs} $basedir/$header|") || die("cproto failed");
+
+ while (<PROTO>) {
+ chop;
+ $cproto = $_;
+ if (m/([a-zA-Z0-9_]*)\(/) {
+ $func = $1;
+ $proto{$func} = $cproto;
+ }
+ }
+ close PROTO;
+
+ if ($library ne $last_library) {
+ push @functions, "#$library";
+ $last_library = $library;
+ }
+ $mode = "proto";
+ } elsif (m/^java (.*) (.*) \{/) {
+ $name = $1;
+ $class = $2;
+ $mode = "java";
+ push @classes,"#$name:$class";
+ } elsif (m/^}$/) {
+ $mode = "";
+ } elsif ($mode eq "proto") {
+ if (m/\s*([a-zA-Z0-9_]+)/) {
+ my $func= $1;
+ my $cproto = $proto{$func};
+
+ die ("No function $func in $header") if !defined($cproto);
+
+ push @functions, $cproto;
+ }
+ } elsif ($mode eq "java") {
+ # maps to strict "[static|],name,(arguments)"
+ if (m/(static)? *([\w<>]*) *, *([\[\w\$<>\(\)\/;]*)/) {
+ push @classes,"$1,$2,$3";
+ }