Made a new improved version of winapi-check in perl.
[wine] / tools / winapi_check / nativeapi.pm
1 package nativeapi;
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 $functions = \%{$self->{FUNCTIONS}};
12
13     my $file = shift;
14
15     open(IN, "< $file");
16     $/ = "\n";
17     while(<IN>) {
18         s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begin and end of line
19         s/^(.*?)\s*#.*$/$1/;  # remove comments
20         /^$/ && next;         # skip empty lines   
21         
22         $$functions{$_} = 1;
23     }
24     close(IN);
25
26     return $self;
27 }
28
29 sub is_function {
30     my $self = shift;
31     my $functions = \%{$self->{FUNCTIONS}};
32
33     my $name = shift;
34
35     return $$functions{$name};
36 }
37
38 1;