Updated all fields with Ukrainian values.
[wine/testsucceed.git] / tools / winapi_check / nativeapi.pm
blob023523a57aed8d857c62b87ba6c0727dc168cb5a
1 package nativeapi;
3 use strict;
5 sub new {
6 my $proto = shift;
7 my $class = ref($proto) || $proto;
8 my $self = {};
9 bless ($self, $class);
11 my $options = \${$self->{OPTIONS}};
12 my $output = \${$self->{OUTPUT}};
13 my $functions = \%{$self->{FUNCTIONS}};
14 my $conditionals = \%{$self->{CONDITIONALS}};
15 my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
16 my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
18 $$options = shift;
19 $$output = shift;
20 my $api_file = shift;
21 my $configure_in_file = shift;
22 my $config_h_in_file = shift;
24 $api_file =~ s/^\.\///;
25 $configure_in_file =~ s/^\.\///;
26 $config_h_in_file =~ s/^\.\///;
28 if($$options->progress) {
29 $$output->progress("$api_file");
32 open(IN, "< $api_file");
33 local $/ = "\n";
34 while(<IN>) {
35 s/^\s*?(.*?)\s*$/$1/; # remove whitespace at begin and end of line
36 s/^(.*?)\s*#.*$/$1/; # remove comments
37 /^$/ && next; # skip empty lines
39 $$functions{$_}++;
41 close(IN);
43 if($$options->progress) {
44 $$output->progress("$configure_in_file");
47 my $again = 0;
48 open(IN, "< $configure_in_file");
49 local $/ = "\n";
50 while($again || (defined($_ = <IN>))) {
51 $again = 0;
52 chomp;
53 if(/^(.*?)\\$/) {
54 my $current = $1;
55 my $next = <IN>;
56 if(defined($next)) {
57 # remove trailing whitespace
58 $current =~ s/\s+$//;
60 # remove leading whitespace
61 $next =~ s/^\s+//;
63 $_ = $current . " " . $next;
65 $again = 1;
66 next;
70 # remove leading and trailing whitespace
71 s/^\s*(.*?)\s*$/$1/;
73 # skip emty lines
74 if(/^$/) { next; }
76 # skip comments
77 if(/^dnl/) { next; }
79 if(/^AC_CHECK_HEADERS\(\s*(.*?)\)\s*$/) {
80 my @arguments = split(/,/,$1);
81 foreach my $name (split(/\s+/, $arguments[0])) {
82 $$conditional_headers{$name}++;
84 } elsif(/^AC_CHECK_FUNCS\(\s*(.*?)\)\s*$/) {
85 my @arguments = split(/,/,$1);
86 foreach my $name (split(/\s+/, $arguments[0])) {
87 $$conditional_functions{$name}++;
89 } elsif(/^AC_FUNC_ALLOCA/) {
90 $$conditional_headers{"alloca.h"}++;
94 close(IN);
96 if($$options->progress) {
97 $$output->progress("$config_h_in_file");
100 open(IN, "< $config_h_in_file");
101 local $/ = "\n";
102 while(<IN>) {
103 # remove leading and trailing whitespace
104 s/^\s*(.*?)\s*$/$1/;
106 # skip emty lines
107 if(/^$/) { next; }
109 if(/^\#undef\s+(\S+)$/) {
110 $$conditionals{$1}++;
113 close(IN);
115 return $self;
118 sub is_function {
119 my $self = shift;
120 my $functions = \%{$self->{FUNCTIONS}};
122 my $name = shift;
124 return $$functions{$name};
127 sub is_conditional {
128 my $self = shift;
129 my $conditionals = \%{$self->{CONDITIONALS}};
131 my $name = shift;
133 return $$conditionals{$name};
136 sub found_conditional {
137 my $self = shift;
138 my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
140 my $name = shift;
142 $$conditional_found{$name}++;
145 sub is_conditional_header {
146 my $self = shift;
147 my $conditional_headers = \%{$self->{CONDITIONAL_HEADERS}};
149 my $name = shift;
151 return $$conditional_headers{$name};
154 sub is_conditional_function {
155 my $self = shift;
156 my $conditional_functions = \%{$self->{CONDITIONAL_FUNCTIONS}};
158 my $name = shift;
160 return $$conditional_functions{$name};
163 sub global_report {
164 my $self = shift;
166 my $output = \${$self->{OUTPUT}};
167 my $conditional_found = \%{$self->{CONDITIONAL_FOUND}};
168 my $conditionals = \%{$self->{CONDITIONALS}};
170 my @messages;
171 foreach my $name (sort(keys(%$conditionals))) {
172 if($name =~ /^const|inline|size_t$/) { next; }
174 if(0 && !$$conditional_found{$name}) {
175 push @messages, "config.h.in: conditional $name not used\n";
179 foreach my $message (sort(@messages)) {
180 $$output->write($message);