Several bug fixes and additions.
[wine] / tools / winapi_check / winapi_function.pm
1 package winapi_function;
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     return $self;
12 }
13
14 sub file {
15     my $self = shift;
16     my $file = \${$self->{FILE}};
17
18     local $_ = shift;
19
20     if(defined($_)) { $$file = $_; }
21     
22     return $$file;
23 }
24
25 sub documentation {
26     my $self = shift;
27     my $documentation = \${$self->{DOCUMENTATION}};
28
29     local $_ = shift;
30
31     if(defined($_)) { $$documentation = $_; }
32     
33     return $$documentation;
34 }
35
36 sub documentation_line {
37     my $self = shift;
38     my $documentation_line = \${$self->{DOCUMENTATION_LINE}};
39
40     local $_ = shift;
41
42     if(defined($_)) { $$documentation_line = $_; }
43     
44     return $$documentation_line;
45 }
46
47 sub linkage {
48     my $self = shift;
49     my $linkage = \${$self->{LINKAGE}};
50
51     local $_ = shift;
52
53     if(defined($_)) { $$linkage = $_; }
54     
55     return $$linkage;
56 }
57
58 sub return_type {
59     my $self = shift;
60     my $return_type = \${$self->{RETURN_TYPE}};
61
62     local $_ = shift;
63
64     if(defined($_)) { $$return_type = $_; }
65     
66     return $$return_type;
67 }
68
69 sub calling_convention {
70     my $self = shift;
71     my $calling_convention = \${$self->{CALLING_CONVENTION}};
72
73     local $_ = shift;
74
75     if(defined($_)) { $$calling_convention = $_; }
76     
77     return $$calling_convention;
78 }
79
80 sub external_name16 {
81     my $self = shift;
82     my $external_name16 = \${$self->{EXTERNAL_NAME16}};
83
84     local $_ = shift;
85
86     if(defined($_)) { $$external_name16 = $_; }
87     
88     return $$external_name16;
89 }
90
91 sub external_name32 {
92     my $self = shift;
93     my $external_name32 = \${$self->{EXTERNAL_NAME32}};
94
95     local $_ = shift;
96
97     if(defined($_)) { $$external_name32 = $_; }
98     
99     return $$external_name32;
100 }
101
102 sub internal_name {
103     my $self = shift;
104     my $internal_name = \${$self->{INTERNAL_NAME}};
105
106     local $_ = shift;
107
108     if(defined($_)) { $$internal_name = $_; }
109     
110     return $$internal_name;
111 }
112
113 sub argument_types {
114     my $self = shift;
115     my $argument_types = \${$self->{ARGUMENT_TYPES}};
116
117     local $_ = shift;
118
119     if(defined($_)) { $$argument_types = $_; }
120     
121     return $$argument_types;
122 }
123
124 sub argument_names {
125     my $self = shift;
126     my $argument_names = \${$self->{ARGUMENT_NAMES}};
127
128     local $_ = shift;
129
130     if(defined($_)) { $$argument_names = $_; }
131     
132     return $$argument_names;
133 }
134
135 sub argument_documentations {
136     my $self = shift;
137     my $argument_documentations = \${$self->{ARGUMENT_DOCUMENTATIONS}};
138
139     local $_ = shift;
140
141     if(defined($_)) { $$argument_documentations = $_; }
142     
143     return $$argument_documentations;
144 }
145
146 sub module16 {
147     my $self = shift;
148     my $module16 = \${$self->{MODULE16}};
149
150     local $_ = shift;
151
152     if(defined($_)) { $$module16 = $_; }
153     return $$module16;
154 }
155
156 sub module32 {
157     my $self = shift;
158     my $module32 = \${$self->{MODULE32}};
159
160     local $_ = shift;
161     
162     if(defined($_)) { $$module32 = $_; }        
163     return $$module32;
164 }
165
166 sub statements {
167     my $self = shift;
168     my $statements = \${$self->{STATEMENTS}};
169
170     local $_ = shift;
171
172     if(defined($_)) { $$statements = $_; }
173     
174     return $$statements;
175 }
176
177 sub module {
178     my $self = shift;
179     my $module16 = \${$self->{MODULE16}};
180     my $module32 = \${$self->{MODULE32}};
181
182     my $module;
183     if(defined($$module16) && defined($$module32)) {
184         $module = "$$module16 & $$module32";
185     } elsif(defined($$module16)) {
186         $module = $$module16;
187     } elsif(defined($$module32)) {
188         $module = $$module32;
189     } else {
190         $module = "";
191     }
192 }
193
194 sub function_called {    
195     my $self = shift;
196     my $called_function_names = \%{$self->{CALLED_FUNCTION_NAMES}};
197
198     my $name = shift;
199
200     $$called_function_names{$name}++;
201 }
202
203 sub function_called_by { 
204    my $self = shift;
205    my $called_by_function_names = \%{$self->{CALLED_BY_FUNCTION_NAMES}};
206
207    my $name = shift;
208
209    $$called_by_function_names{$name}++;
210 }
211
212 sub called_function_names {    
213     my $self = shift;
214     my $called_function_names = \%{$self->{CALLED_FUNCTION_NAMES}};
215
216     return sort(keys(%$called_function_names));
217 }
218
219 sub called_by_function_names {    
220     my $self = shift;
221     my $called_by_function_names = \%{$self->{CALLED_BY_FUNCTION_NAMES}};
222
223     return sort(keys(%$called_by_function_names));
224 }
225
226
227 1;