… | |
… | |
9 | for my $file (@ARGV) { |
9 | for my $file (@ARGV) { |
10 | open my $fh, "<:utf8", $file |
10 | open my $fh, "<:utf8", $file |
11 | or die "$file: $!"; |
11 | or die "$file: $!"; |
12 | |
12 | |
13 | while (<$fh>) { |
13 | while (<$fh>) { |
|
|
14 | if ($curclass eq $class) { |
14 | while (/ACC\s*\(R([WO])\s*,\s*([^)\]]+)(?:\[(\S+)\])?\)/g) { |
15 | while (/ACC\s*\(R([WO])\s*,\s*([^)\]]+)(?:\[(\S+)\])?\)/g) { |
15 | next unless $curclass eq $class; |
|
|
16 | |
|
|
17 | if ($3) { |
16 | if ($3) { |
18 | push @array_member, [$1, $2, $3]; |
17 | push @array_member, [$1, $2, $3]; |
19 | } else { |
18 | } else { |
20 | push @scalar_member, [$1, $2]; |
19 | push @scalar_member, [$1, $2]; |
|
|
20 | } |
|
|
21 | } |
|
|
22 | if (/MTH \s+ ([^(]*?) \s* ([A-Za-z_0-9]+) \s* \(([^)]*)\)/x) { |
|
|
23 | push @method_member, [$1, $2, $3]; |
21 | } |
24 | } |
22 | } |
25 | } |
23 | while (/INTERFACE_CLASS\s*\((\S+)\)/g) { |
26 | while (/INTERFACE_CLASS\s*\((\S+)\)/g) { |
24 | $curclass = $1; |
27 | $curclass = $1; |
25 | } |
28 | } |
26 | } |
29 | } |
|
|
30 | } |
|
|
31 | |
|
|
32 | for (@method_member) { |
|
|
33 | my ($rettype, $name, $params) = @$_; |
|
|
34 | |
|
|
35 | if ($rettype =~ s/static\s+//) { |
|
|
36 | my $args = join ", ", $params =~ m/.*?([a-zA-Z_0-9]+)(?:,\s*|$)/g; |
|
|
37 | if ($rettype ne "void") { |
|
|
38 | print "$rettype\n$name ($params)\n", |
|
|
39 | "\tCODE:\n", |
|
|
40 | "\tRETVAL = $class\::$name ($args);\n", |
|
|
41 | "\tOUTPUT:\n", |
|
|
42 | "\tRETVAL\n"; |
|
|
43 | } else { |
|
|
44 | print "$rettype\n$name ($params)\n", |
|
|
45 | "\tCODE:\n", |
|
|
46 | "\t$class\::$name ($args);\n", |
|
|
47 | } |
|
|
48 | } else { |
|
|
49 | print "$rettype\n$class\::$name ($params)\n"; |
|
|
50 | } |
|
|
51 | |
|
|
52 | print "\n"; |
27 | } |
53 | } |
28 | |
54 | |
29 | if (@scalar_member) { |
55 | if (@scalar_member) { |
30 | print "SV *$scalar_member[0][1] ($class *self, SV *newval = 0)\n"; |
56 | print "SV *$scalar_member[0][1] ($class *self, SV *newval = 0)\n"; |
31 | print "\tPROTOTYPE: \$;\$\n"; |
57 | print "\tPROTOTYPE: \$;\$\n"; |