Fixed some issues found by winapi_check.
[wine] / tools / winapi / c_type.pm
1 #
2 # Copyright 2002 Patrik Stridvall
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 #
18
19 package c_type;
20
21 use strict;
22
23 sub new {
24     my $proto = shift;
25     my $class = ref($proto) || $proto;
26     my $self  = {};
27     bless ($self, $class);
28
29     return $self;
30 }
31
32 sub kind {
33     my $self = shift;
34     my $kind = \${$self->{KIND}};
35
36     local $_ = shift;
37
38     if(defined($_)) { $$kind = $_; }
39
40     return $$kind;
41 }
42
43 sub _name {
44     my $self = shift;
45     my $_name = \${$self->{_NAME}};
46
47     local $_ = shift;
48
49     if(defined($_)) { $$_name = $_; }
50
51     return $$_name;
52 }
53
54 sub name {
55     my $self = shift;
56     my $name = \${$self->{NAME}};
57
58     local $_ = shift;
59
60     if(defined($_)) { $$name = $_; }
61
62     return $$name;
63 }
64
65 sub fields {
66     my $self = shift;
67
68     my @field_types = @{$self->field_types};
69     my @field_names = @{$self->field_names};
70
71     my $count = scalar(@field_types);
72     
73     my @fields = ();
74     for (my $n = 0; $n < $count; $n++) {
75         push @fields, [$field_types[$n], $field_names[$n]];
76     }
77     return @fields;
78 }
79
80
81 sub field_types {
82     my $self = shift;
83     my $field_types = \${$self->{FIELD_TYPES}};
84
85     local $_ = shift;
86
87     if(defined($_)) { $$field_types = $_; }
88
89     return $$field_types;
90 }
91
92 sub field_names {
93     my $self = shift;
94     my $field_names = \${$self->{FIELD_NAMES}};
95
96     local $_ = shift;
97
98     if(defined($_)) { $$field_names = $_; }
99
100     return $$field_names;
101 }
102
103 1;