18 # 3. Or contain @publishedAll (Public by tag - now deprecated) |
18 # 3. Or contain @publishedAll (Public by tag - now deprecated) |
19 |
19 |
20 use strict; |
20 use strict; |
21 my $debug = 0; |
21 my $debug = 0; |
22 |
22 |
|
23 my @public_included = (); |
|
24 my $reason; |
|
25 |
23 sub is_public_api($$) |
26 sub is_public_api($$) |
24 { |
27 { |
25 my ($file,$name) = @_; |
28 my ($file,$name) = @_; |
26 |
29 |
27 if ($name =~ /^epoc32\/include\/platform\//) |
30 if ($name =~ /^epoc32\/include\/platform\//) |
28 { |
31 { |
29 # /epoc32/include/platform files are "Platform by export" |
32 # /epoc32/include/platform files are "Platform by export" |
|
33 $reason = "Platform by export"; |
30 return 0; # Not public |
34 return 0; # Not public |
31 } |
35 } |
32 |
36 |
|
37 if ($name =~ /\./ && $name !~ /\.(h|rh|hrh|inl|c|hpp)$/i) |
|
38 { |
|
39 # Not a file which contains APIs anyway |
|
40 $reason = "Wrong extension"; |
|
41 return 0; # not public |
|
42 } |
|
43 |
33 open FILE, "<$file" or print "ERROR: Cannot open $file: $!\n" and return 1; # assume Public |
44 open FILE, "<$file" or print "ERROR: Cannot open $file: $!\n" and return 1; # assume Public |
34 my @lines = <FILE>; # they are all of a modest size |
45 my @lines = <FILE>; # they are all of a modest size |
35 close FILE; |
46 close FILE; |
|
47 |
|
48 my @includelines = grep /^\s*#include\s+/, @lines; |
|
49 my @includefiles = (); |
|
50 foreach my $includeline (@includelines) |
|
51 { |
|
52 if ($includeline =~ /^\s*#include\s+["<](.*\.([^.]+))[">]/) |
|
53 { |
|
54 my $filename = $1; |
|
55 my $extension = $2; |
|
56 |
|
57 # print "++ $filename ($extension)\n"; |
|
58 if ($extension =~ /mbg|rsg|rls|ra/i) |
|
59 { |
|
60 # generated file referenced by #include |
|
61 push @includefiles, $filename; |
|
62 print STDERR "** $file - $includeline"; |
|
63 } |
|
64 } |
|
65 } |
36 |
66 |
37 my @apitaglines = grep /\@published|\@internal/, @lines; |
67 my @apitaglines = grep /\@published|\@internal/, @lines; |
38 if (scalar @apitaglines == 0) |
68 if (scalar @apitaglines == 0) |
39 { |
69 { |
40 # no API classification tags - must be "Public by export" |
70 # no API classification tags - must be "Public by export" |
41 return 1; # Public API |
71 $reason = "Public by export"; |
42 } |
72 } |
43 |
73 else |
44 if ($debug) |
|
45 { |
74 { |
46 print join("\n\t", $file, @apitaglines), "\n"; |
75 if ($debug) |
|
76 { |
|
77 print join("\n\t", $file, @apitaglines), "\n"; |
|
78 } |
|
79 my @publishedAll = grep /\@publishedAll/, @apitaglines; |
|
80 if (scalar @publishedAll == 0) |
|
81 { |
|
82 # the API classification tags are all @publishedPartner or @internal |
|
83 $reason = "Platform by tag"; |
|
84 return 0; # not public |
|
85 } |
|
86 # contains at least one @publishedAll element - must be "Public by tag" |
|
87 $reason = "Public by tag"; |
47 } |
88 } |
48 my @publishedAll = grep /\@publishedAll/, @apitaglines; |
89 push @public_included, @includefiles; # #included files are therefore also public |
49 if (scalar @publishedAll == 0) |
|
50 { |
|
51 # the API classification tags are all @publishedPartner or @internal |
|
52 return 0; # not public |
|
53 } |
|
54 # contains at least one @publishedAll element - must be "Public by tag" |
|
55 return 1; # Public API |
90 return 1; # Public API |
56 } |
91 } |
|
92 |
|
93 my %classification; |
|
94 my %origin; |
|
95 my %ignoring_case; |
57 |
96 |
58 sub scan_directory($$) |
97 sub scan_directory($$) |
59 { |
98 { |
60 my ($path, $name) = @_; |
99 my ($path, $name) = @_; |
61 |
100 |
74 next; |
113 next; |
75 } |
114 } |
76 |
115 |
77 if (is_public_api($newpath,$newname)) |
116 if (is_public_api($newpath,$newname)) |
78 { |
117 { |
79 print "$newname\n"; |
118 # print "PUBLIC\t$newname\t$reason\n"; |
80 } |
119 } |
81 else |
120 else |
82 { |
121 { |
83 # print "PARTNER\t$newname\n"; |
122 # print "PARTNER\t$newname\t$reason\n"; |
|
123 } |
|
124 $classification{$newname} = $reason; |
|
125 $origin{$newname} = "Symbian^2"; |
|
126 $ignoring_case{lc $newname} = $newname; |
|
127 } |
|
128 } |
|
129 |
|
130 scan_directory("/epoc32/include", "epoc32/include"); |
|
131 |
|
132 foreach my $file (@public_included) |
|
133 { |
|
134 # print "PUBLIC\tepoc32/include/$file\tIncluded\n"; |
|
135 my $newname = "epoc32/include/$file"; |
|
136 $newname = $ignoring_case{lc $newname}; |
|
137 $classification{$newname} = "Public by Inclusion"; |
|
138 } |
|
139 |
|
140 # Read list of Symbian^1 files |
|
141 my $line; |
|
142 while ($line = <>) |
|
143 { |
|
144 chomp $line; |
|
145 $line =~ s/\\/\//g; # Unix separators please |
|
146 if ($line =~ /(epoc32\/include\/.*)\s*$/) |
|
147 { |
|
148 my $name = $1; |
|
149 $origin{$name} = "Symbian^1"; |
|
150 if (!defined $ignoring_case{lc $name}) |
|
151 { |
|
152 $classification{$name} = "Deleted"; |
84 } |
153 } |
85 } |
154 } |
86 } |
155 } |
87 |
156 |
88 scan_directory("/epoc32/include", "epoc32/include"); |
157 print "Filename\tClassification\tReason\tOrigin\n"; |
|
158 foreach my $file (sort keys %classification) |
|
159 { |
|
160 my $reason = $classification{$file}; |
|
161 my $type = "Platform"; |
|
162 $type = "Public" if ($reason =~ /Public/); |
|
163 print "$file\t$type\t$reason\t$origin{$file}\n"; |
|
164 } |