- API files update.
[wine] / tools / winapi_check / modules.pm
1 package modules;
2
3 use strict;
4
5 sub new {
6     my $proto = shift;
7     my $class = ref($proto) || $proto;
8     my $self  = {};
9     bless ($self, $class);
10
11     my $options = \${$self->{OPTIONS}};
12     my $output = \${$self->{OUTPUT}};
13     my $modules = \%{$self->{MODULES}};
14
15     $$options = shift;
16     $$output = shift;
17     my $module_file = shift;
18
19     $module_file =~ s/^\.\///;
20
21     if($$options->progress) {
22         $$output->progress("$module_file");
23     }
24
25     my $allowed_dir;
26     my $spec_file;
27
28     open(IN, "< $module_file");
29     local $/ = "\n";
30     while(<IN>) {
31         s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begining and end of line
32         s/^(.*?)\s*#.*$/$1/;  # remove comments
33         /^$/ && next;         # skip empty lines
34
35         if(/^%\s+(.*?)$/) {
36             $spec_file = $1;
37             next;
38         } else {
39             $allowed_dir = $1;
40         }
41
42         $$modules{$allowed_dir}{$spec_file}++;
43     }
44     close(IN);
45
46     return $self;
47 }
48
49 1;