line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Interface Definition Language (OMG IDL CORBA v3.0)
|
4
|
|
|
|
|
|
|
#
|
5
|
|
|
|
|
|
|
# C Language Mapping Specification, New Edition June 1999
|
6
|
|
|
|
|
|
|
#
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package CORBA::C::LiteralVisitor;
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
9
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5203
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.60';
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# needs $node->{c_name} (CnameVisitor) for Enum
|
16
|
|
|
|
|
|
|
# builds $node->{c_literal}
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new {
|
19
|
0
|
|
|
0
|
0
|
|
my $proto = shift;
|
20
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto;
|
21
|
0
|
|
|
|
|
|
my $self = {};
|
22
|
0
|
|
|
|
|
|
bless $self, $class;
|
23
|
0
|
|
|
|
|
|
my ($parser) = @_;
|
24
|
0
|
|
|
|
|
|
$self->{key} = 'c_literal';
|
25
|
0
|
|
|
|
|
|
$self->{symbtab} = $parser->YYData->{symbtab};
|
26
|
0
|
|
|
|
|
|
return $self;
|
27
|
|
|
|
|
|
|
}
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _get_defn {
|
30
|
0
|
|
|
0
|
|
|
my $self = shift;
|
31
|
0
|
|
|
|
|
|
my ($defn) = @_;
|
32
|
0
|
0
|
|
|
|
|
if (ref $defn) {
|
33
|
0
|
|
|
|
|
|
return $defn;
|
34
|
|
|
|
|
|
|
}
|
35
|
|
|
|
|
|
|
else {
|
36
|
0
|
|
|
|
|
|
return $self->{symbtab}->Lookup($defn);
|
37
|
|
|
|
|
|
|
}
|
38
|
|
|
|
|
|
|
}
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#
|
41
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification
|
42
|
|
|
|
|
|
|
#
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub visitSpecification {
|
45
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
46
|
0
|
|
|
|
|
|
my ($node) = @_;
|
47
|
0
|
0
|
|
|
|
|
if (exists $node->{list_import}) {
|
48
|
0
|
|
|
|
|
|
foreach (@{$node->{list_import}}) {
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$_->visit($self);
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
}
|
52
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) {
|
|
0
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self);
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
}
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#
|
58
|
|
|
|
|
|
|
# 3.6 Import Declaration
|
59
|
|
|
|
|
|
|
#
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub visitImport {
|
62
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
63
|
0
|
|
|
|
|
|
my ($node) = @_;
|
64
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) {
|
|
0
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self);
|
66
|
|
|
|
|
|
|
}
|
67
|
|
|
|
|
|
|
}
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#
|
70
|
|
|
|
|
|
|
# 3.7 Module Declaration
|
71
|
|
|
|
|
|
|
#
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub visitModules {
|
74
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
75
|
0
|
|
|
|
|
|
my ($node) = @_;
|
76
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) {
|
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self);
|
78
|
|
|
|
|
|
|
}
|
79
|
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#
|
82
|
|
|
|
|
|
|
# 3.8 Interface Declaration
|
83
|
|
|
|
|
|
|
#
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub visitBaseInterface {
|
86
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
87
|
0
|
|
|
|
|
|
my ($node) = @_;
|
88
|
0
|
0
|
|
|
|
|
return if (exists $node->{$self->{key}});
|
89
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 1;
|
90
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) {
|
|
0
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self);
|
92
|
|
|
|
|
|
|
}
|
93
|
|
|
|
|
|
|
}
|
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
0
|
0
|
|
sub visitForwardBaseInterface {
|
96
|
|
|
|
|
|
|
# empty
|
97
|
|
|
|
|
|
|
}
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
#
|
100
|
|
|
|
|
|
|
# 3.9 Value Declaration
|
101
|
|
|
|
|
|
|
#
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub visitStateMember {
|
104
|
|
|
|
|
|
|
# C mapping is aligned with CORBA 2.1
|
105
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
106
|
0
|
|
|
|
|
|
my ($node) = @_;
|
107
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
108
|
0
|
|
|
|
|
|
$type->visit($self);
|
109
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) {
|
110
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) {
|
|
0
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$_->visit($self); # expression
|
112
|
|
|
|
|
|
|
}
|
113
|
|
|
|
|
|
|
}
|
114
|
|
|
|
|
|
|
}
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub visitInitializer {
|
117
|
|
|
|
|
|
|
# C mapping is aligned with CORBA 2.1
|
118
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
119
|
0
|
|
|
|
|
|
my ($node) = @_;
|
120
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
122
|
|
|
|
|
|
|
}
|
123
|
|
|
|
|
|
|
}
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
#
|
126
|
|
|
|
|
|
|
# 3.10 Constant Declaration
|
127
|
|
|
|
|
|
|
#
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub visitConstant {
|
130
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
131
|
0
|
|
|
|
|
|
my ($node) = @_;
|
132
|
0
|
|
|
|
|
|
$node->{value}->visit($self); # expression
|
133
|
|
|
|
|
|
|
}
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _Eval {
|
136
|
0
|
|
|
0
|
|
|
my $self = shift;
|
137
|
0
|
|
|
|
|
|
my ($list_expr, $type) = @_;
|
138
|
0
|
|
|
|
|
|
my $elt = $self->_get_defn(pop @{$list_expr});
|
|
0
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
if ( $elt->isa('BinaryOp') ) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
my $right = $self->_Eval($list_expr, $type);
|
141
|
0
|
0
|
0
|
|
|
|
if ( $elt->{op} eq '>>'
|
142
|
|
|
|
|
|
|
or $elt->{op} eq '<<' ) {
|
143
|
0
|
|
|
|
|
|
$right =~ s/[LU]+$//;
|
144
|
|
|
|
|
|
|
}
|
145
|
0
|
|
|
|
|
|
my $left = $self->_Eval($list_expr, $type);
|
146
|
0
|
|
|
|
|
|
return '(' . $left . q{ } . $elt->{op} . q{ } . $right . ')';
|
147
|
|
|
|
|
|
|
}
|
148
|
|
|
|
|
|
|
elsif ( $elt->isa('UnaryOp') ) {
|
149
|
0
|
|
|
|
|
|
my $right = $self->_Eval($list_expr, $type);
|
150
|
0
|
|
|
|
|
|
return $elt->{op} . $right;
|
151
|
|
|
|
|
|
|
}
|
152
|
|
|
|
|
|
|
elsif ( $elt->isa('Constant') ) {
|
153
|
0
|
|
|
|
|
|
return $elt->{c_name};
|
154
|
|
|
|
|
|
|
}
|
155
|
|
|
|
|
|
|
elsif ( $elt->isa('Enum') ) {
|
156
|
0
|
|
|
|
|
|
return $elt->{c_name};
|
157
|
|
|
|
|
|
|
}
|
158
|
|
|
|
|
|
|
elsif ( $elt->isa('Literal') ) {
|
159
|
0
|
|
|
|
|
|
$elt->visit($self, $type);
|
160
|
0
|
|
|
|
|
|
return $elt->{$self->{key}};
|
161
|
|
|
|
|
|
|
}
|
162
|
|
|
|
|
|
|
else {
|
163
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::_Eval: INTERNAL ERROR ",ref $elt,".\n";
|
164
|
0
|
|
|
|
|
|
return undef;
|
165
|
|
|
|
|
|
|
}
|
166
|
|
|
|
|
|
|
}
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub visitExpression {
|
169
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
170
|
0
|
|
|
|
|
|
my ($node) = @_;
|
171
|
0
|
|
|
|
|
|
my @list_expr = @{$node->{list_expr}}; # create a copy
|
|
0
|
|
|
|
|
|
|
172
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
173
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) {
|
174
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type});
|
175
|
|
|
|
|
|
|
}
|
176
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $self->_Eval(\@list_expr, $type);
|
177
|
|
|
|
|
|
|
}
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub visitIntegerLiteral {
|
180
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
181
|
0
|
|
|
|
|
|
my ($node, $type) = @_;
|
182
|
0
|
|
|
|
|
|
my $str = $node->{value};
|
183
|
0
|
|
|
|
|
|
$str =~ s/^\+//;
|
184
|
0
|
0
|
|
|
|
|
unless (exists $type->{auto}) {
|
185
|
0
|
0
|
|
|
|
|
if ($node->{lexeme} =~ /^0+$/) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
$str = '0';
|
187
|
|
|
|
|
|
|
}
|
188
|
|
|
|
|
|
|
elsif ($node->{lexeme} =~ /^0[Xx]/) {
|
189
|
0
|
|
|
|
|
|
my $fmt;
|
190
|
0
|
0
|
|
|
|
|
if ($type->{value} eq 'octet') {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
$fmt = '0x%02x';
|
192
|
|
|
|
|
|
|
}
|
193
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'short' ) {
|
194
|
0
|
|
|
|
|
|
$fmt = '0x%04x';
|
195
|
|
|
|
|
|
|
}
|
196
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'unsigned short' ) {
|
197
|
0
|
|
|
|
|
|
$fmt = '0x%04x';
|
198
|
|
|
|
|
|
|
}
|
199
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'long' ) {
|
200
|
0
|
|
|
|
|
|
$fmt = '0x%08x';
|
201
|
|
|
|
|
|
|
}
|
202
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'unsigned long' ) {
|
203
|
0
|
|
|
|
|
|
$fmt = '0x%08x';
|
204
|
|
|
|
|
|
|
}
|
205
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'long long' ) {
|
206
|
0
|
|
|
|
|
|
$fmt = '0x%016x';
|
207
|
|
|
|
|
|
|
}
|
208
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'unsigned long long' ) {
|
209
|
0
|
|
|
|
|
|
$fmt = '0x%016x';
|
210
|
|
|
|
|
|
|
}
|
211
|
0
|
|
|
|
|
|
$str = sprintf($fmt, $node->{value});
|
212
|
|
|
|
|
|
|
}
|
213
|
|
|
|
|
|
|
elsif ($node->{lexeme} =~ /^0/) {
|
214
|
0
|
|
|
|
|
|
$str = sprintf('0%o', $node->{value});
|
215
|
|
|
|
|
|
|
}
|
216
|
|
|
|
|
|
|
else {
|
217
|
0
|
|
|
|
|
|
$str = sprintf('%d', $node->{value});
|
218
|
|
|
|
|
|
|
}
|
219
|
0
|
0
|
|
|
|
|
if ( $type->{value} eq 'short' ) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
220
|
0
|
|
|
|
|
|
$str = '(short)' . $str;
|
221
|
|
|
|
|
|
|
}
|
222
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'unsigned short' ) {
|
223
|
0
|
|
|
|
|
|
$str = '(unsigned short)' . $str . 'U';
|
224
|
|
|
|
|
|
|
}
|
225
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'long' ) {
|
226
|
0
|
|
|
|
|
|
$str .= 'L';
|
227
|
|
|
|
|
|
|
}
|
228
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'unsigned long' ) {
|
229
|
0
|
|
|
|
|
|
$str .= 'UL';
|
230
|
|
|
|
|
|
|
}
|
231
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'long long' ) {
|
232
|
0
|
|
|
|
|
|
$str .= 'LL';
|
233
|
|
|
|
|
|
|
}
|
234
|
|
|
|
|
|
|
elsif ( $type->{value} eq 'unsigned long long' ) {
|
235
|
0
|
|
|
|
|
|
$str .= 'ULL';
|
236
|
|
|
|
|
|
|
}
|
237
|
|
|
|
|
|
|
}
|
238
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str;
|
239
|
|
|
|
|
|
|
}
|
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
sub visitStringLiteral {
|
242
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
243
|
0
|
|
|
|
|
|
my ($node) = @_;
|
244
|
0
|
|
|
|
|
|
my @list = unpack 'C*', $node->{value};
|
245
|
0
|
|
|
|
|
|
my $str = q{"};
|
246
|
0
|
|
|
|
|
|
foreach (@list) {
|
247
|
0
|
0
|
0
|
|
|
|
if ($_ < 32 or $_ >= 128) {
|
248
|
0
|
|
|
|
|
|
$str .= sprintf "\\x%02x", $_;
|
249
|
|
|
|
|
|
|
}
|
250
|
|
|
|
|
|
|
else {
|
251
|
0
|
|
|
|
|
|
$str .= chr $_;
|
252
|
|
|
|
|
|
|
}
|
253
|
|
|
|
|
|
|
}
|
254
|
0
|
|
|
|
|
|
$str .= q{"};
|
255
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str;
|
256
|
|
|
|
|
|
|
}
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub visitWideStringLiteral {
|
259
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
260
|
0
|
|
|
|
|
|
my ($node) = @_;
|
261
|
0
|
|
|
|
|
|
my @list = unpack 'C*', $node->{value};
|
262
|
0
|
|
|
|
|
|
my $str = q{L"};
|
263
|
0
|
|
|
|
|
|
foreach (@list) {
|
264
|
0
|
0
|
0
|
|
|
|
if ($_ < 32 or ($_ >= 128 and $_ < 256)) {
|
|
|
0
|
0
|
|
|
|
|
265
|
0
|
|
|
|
|
|
$str .= sprintf "\\x%02x", $_;
|
266
|
|
|
|
|
|
|
}
|
267
|
|
|
|
|
|
|
elsif ($_ >= 256) {
|
268
|
0
|
|
|
|
|
|
$str .= sprintf "\\u%04x", $_;
|
269
|
|
|
|
|
|
|
}
|
270
|
|
|
|
|
|
|
else {
|
271
|
0
|
|
|
|
|
|
$str .= chr $_;
|
272
|
|
|
|
|
|
|
}
|
273
|
|
|
|
|
|
|
}
|
274
|
0
|
|
|
|
|
|
$str .= q{"};
|
275
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str;
|
276
|
|
|
|
|
|
|
}
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
sub visitCharacterLiteral {
|
279
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
280
|
0
|
|
|
|
|
|
my ($node) = @_;
|
281
|
0
|
|
|
|
|
|
my @list = unpack 'C', $node->{value};
|
282
|
0
|
|
|
|
|
|
my $c = $list[0];
|
283
|
0
|
|
|
|
|
|
my $str = q{'};
|
284
|
0
|
0
|
0
|
|
|
|
if ($c < 32 or $c >= 128) {
|
285
|
0
|
|
|
|
|
|
$str .= sprintf "\\x%02x", $c;
|
286
|
|
|
|
|
|
|
}
|
287
|
|
|
|
|
|
|
else {
|
288
|
0
|
|
|
|
|
|
$str .= chr $c;
|
289
|
|
|
|
|
|
|
}
|
290
|
0
|
|
|
|
|
|
$str .= q{'};
|
291
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str;
|
292
|
|
|
|
|
|
|
}
|
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
sub visitWideCharacterLiteral {
|
295
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
296
|
0
|
|
|
|
|
|
my ($node) = @_;
|
297
|
0
|
|
|
|
|
|
my @list = unpack 'C', $node->{value};
|
298
|
0
|
|
|
|
|
|
my $c = $list[0];
|
299
|
0
|
|
|
|
|
|
my $str = q{L'};
|
300
|
0
|
0
|
0
|
|
|
|
if ($c < 32 or ($c >= 128 and $c < 256)) {
|
|
|
0
|
0
|
|
|
|
|
301
|
0
|
|
|
|
|
|
$str .= sprintf "\\x%02x", $c;
|
302
|
|
|
|
|
|
|
}
|
303
|
|
|
|
|
|
|
elsif ($c >= 256) {
|
304
|
0
|
|
|
|
|
|
$str .= sprintf "\\u%04x", $c;
|
305
|
|
|
|
|
|
|
}
|
306
|
|
|
|
|
|
|
else {
|
307
|
0
|
|
|
|
|
|
$str .= chr $c;
|
308
|
|
|
|
|
|
|
}
|
309
|
0
|
|
|
|
|
|
$str .= q{'};
|
310
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str;
|
311
|
|
|
|
|
|
|
}
|
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
sub visitFixedPtLiteral {
|
314
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
315
|
0
|
|
|
|
|
|
my ($node) = @_;
|
316
|
0
|
|
|
|
|
|
my $str = q{"};
|
317
|
0
|
|
|
|
|
|
$str .= $node->{value};
|
318
|
0
|
|
|
|
|
|
$str .= q{"};
|
319
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $str;
|
320
|
|
|
|
|
|
|
}
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub visitFloatingPtLiteral {
|
323
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
324
|
0
|
|
|
|
|
|
my ($node) = @_;
|
325
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $node->{value};
|
326
|
|
|
|
|
|
|
}
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
sub visitBooleanLiteral {
|
329
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
330
|
0
|
|
|
|
|
|
my ($node) = @_;
|
331
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'TRUE') {
|
332
|
0
|
|
|
|
|
|
$node->{$self->{key}} = '1';
|
333
|
|
|
|
|
|
|
}
|
334
|
|
|
|
|
|
|
else {
|
335
|
0
|
|
|
|
|
|
$node->{$self->{key}} = '0';
|
336
|
|
|
|
|
|
|
}
|
337
|
|
|
|
|
|
|
}
|
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
#
|
340
|
|
|
|
|
|
|
# 3.11 Type Declaration
|
341
|
|
|
|
|
|
|
#
|
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
sub visitTypeDeclarator {
|
344
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
345
|
0
|
|
|
|
|
|
my ($node) = @_;
|
346
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
347
|
0
|
|
|
|
|
|
$type->visit($self);
|
348
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) {
|
349
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) {
|
|
0
|
|
|
|
|
|
|
350
|
0
|
|
|
|
|
|
$_->visit($self); # expression
|
351
|
|
|
|
|
|
|
}
|
352
|
|
|
|
|
|
|
}
|
353
|
|
|
|
|
|
|
}
|
354
|
|
|
|
|
|
|
|
355
|
0
|
|
|
0
|
0
|
|
sub visitNativeType {
|
356
|
|
|
|
|
|
|
# empty
|
357
|
|
|
|
|
|
|
}
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
#
|
360
|
|
|
|
|
|
|
# 3.11.1 Basic Types
|
361
|
|
|
|
|
|
|
#
|
362
|
|
|
|
|
|
|
|
363
|
0
|
|
|
0
|
0
|
|
sub visitBasicType {
|
364
|
|
|
|
|
|
|
# empty
|
365
|
|
|
|
|
|
|
}
|
366
|
|
|
|
|
|
|
|
367
|
0
|
|
|
0
|
0
|
|
sub visitAnyType {
|
368
|
|
|
|
|
|
|
# empty
|
369
|
|
|
|
|
|
|
}
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
#
|
372
|
|
|
|
|
|
|
# 3.11.2 Constructed Types
|
373
|
|
|
|
|
|
|
#
|
374
|
|
|
|
|
|
|
# 3.11.2.1 Structures
|
375
|
|
|
|
|
|
|
#
|
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
sub visitStructType {
|
378
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
379
|
0
|
|
|
|
|
|
my ($node) = @_;
|
380
|
0
|
0
|
|
|
|
|
return if (exists $node->{$self->{key}});
|
381
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 1;
|
382
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) {
|
|
0
|
|
|
|
|
|
|
383
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # member
|
384
|
|
|
|
|
|
|
}
|
385
|
|
|
|
|
|
|
}
|
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
sub visitMember {
|
388
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
389
|
0
|
|
|
|
|
|
my ($node) = @_;
|
390
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
391
|
0
|
|
|
|
|
|
$type->visit($self);
|
392
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) {
|
393
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) {
|
|
0
|
|
|
|
|
|
|
394
|
0
|
|
|
|
|
|
$_->visit($self); # expression
|
395
|
|
|
|
|
|
|
}
|
396
|
|
|
|
|
|
|
}
|
397
|
|
|
|
|
|
|
}
|
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions
|
400
|
|
|
|
|
|
|
#
|
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
sub visitUnionType {
|
403
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
404
|
0
|
|
|
|
|
|
my ($node) = @_;
|
405
|
0
|
0
|
|
|
|
|
return if (exists $node->{$self->{key}});
|
406
|
0
|
|
|
|
|
|
$node->{$self->{key}} = 1;
|
407
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
408
|
0
|
|
|
|
|
|
$type->visit($self);
|
409
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
$_->visit($self); # case
|
411
|
|
|
|
|
|
|
}
|
412
|
|
|
|
|
|
|
}
|
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
sub visitCase {
|
415
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
416
|
0
|
|
|
|
|
|
my ($node) = @_;
|
417
|
0
|
|
|
|
|
|
foreach (@{$node->{list_label}}) {
|
|
0
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
$_->visit($self); # default or expression
|
419
|
|
|
|
|
|
|
}
|
420
|
0
|
|
|
|
|
|
$node->{element}->visit($self);
|
421
|
|
|
|
|
|
|
}
|
422
|
|
|
|
|
|
|
|
423
|
0
|
|
|
0
|
0
|
|
sub visitDefault {
|
424
|
|
|
|
|
|
|
# empty
|
425
|
|
|
|
|
|
|
}
|
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
sub visitElement {
|
428
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
429
|
0
|
|
|
|
|
|
my ($node) = @_;
|
430
|
0
|
|
|
|
|
|
$self->_get_defn($node->{value})->visit($self); # member
|
431
|
|
|
|
|
|
|
}
|
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations
|
434
|
|
|
|
|
|
|
#
|
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
sub visitEnumType {
|
437
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
438
|
0
|
|
|
|
|
|
my ($node) = @_;
|
439
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
$_->visit($self); # enum
|
441
|
|
|
|
|
|
|
}
|
442
|
|
|
|
|
|
|
}
|
443
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
sub visitEnum {
|
445
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
446
|
0
|
|
|
|
|
|
my ($node) = @_;
|
447
|
0
|
|
|
|
|
|
$node->{$self->{key}} = $node->{value};
|
448
|
|
|
|
|
|
|
}
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
#
|
451
|
|
|
|
|
|
|
# 3.11.3 Template Types
|
452
|
|
|
|
|
|
|
#
|
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
sub visitSequenceType {
|
455
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
456
|
0
|
|
|
|
|
|
my ($node) = @_;
|
457
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
458
|
0
|
|
|
|
|
|
$type->visit($self);
|
459
|
0
|
0
|
|
|
|
|
$node->{max}->visit($self) if (exists $node->{max});
|
460
|
|
|
|
|
|
|
}
|
461
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
sub visitStringType {
|
463
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
464
|
0
|
|
|
|
|
|
my ($node) = @_;
|
465
|
0
|
0
|
|
|
|
|
$node->{max}->visit($self) if (exists $node->{max});
|
466
|
|
|
|
|
|
|
}
|
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
sub visitWideStringType {
|
469
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
470
|
0
|
|
|
|
|
|
my ($node) = @_;
|
471
|
0
|
0
|
|
|
|
|
$node->{max}->visit($self) if (exists $node->{max});
|
472
|
|
|
|
|
|
|
}
|
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
sub visitFixedPtType {
|
475
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
476
|
0
|
|
|
|
|
|
my ($node) = @_;
|
477
|
0
|
|
|
|
|
|
$node->{d}->visit($self);
|
478
|
0
|
|
|
|
|
|
$node->{s}->visit($self);
|
479
|
|
|
|
|
|
|
}
|
480
|
|
|
|
|
|
|
|
481
|
0
|
|
|
0
|
0
|
|
sub visitFixedPtConstType {
|
482
|
|
|
|
|
|
|
# empty
|
483
|
|
|
|
|
|
|
}
|
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
#
|
486
|
|
|
|
|
|
|
# 3.12 Exception Declaration
|
487
|
|
|
|
|
|
|
#
|
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
sub visitException {
|
490
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
491
|
0
|
|
|
|
|
|
my ($node) = @_;
|
492
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) {
|
|
0
|
|
|
|
|
|
|
493
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # member
|
494
|
|
|
|
|
|
|
}
|
495
|
|
|
|
|
|
|
}
|
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
#
|
498
|
|
|
|
|
|
|
# 3.13 Operation Declaration
|
499
|
|
|
|
|
|
|
#
|
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
sub visitOperation {
|
502
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
503
|
0
|
|
|
|
|
|
my ($node) = @_;
|
504
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); # param_type_spec or void
|
505
|
0
|
|
|
|
|
|
$type->visit($self);
|
506
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
507
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
508
|
|
|
|
|
|
|
}
|
509
|
|
|
|
|
|
|
}
|
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
sub visitParameter {
|
512
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
513
|
0
|
|
|
|
|
|
my ($node) = @_;
|
514
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); # param_type_spec
|
515
|
0
|
|
|
|
|
|
$type->visit($self);
|
516
|
|
|
|
|
|
|
}
|
517
|
|
|
|
|
|
|
|
518
|
0
|
|
|
0
|
0
|
|
sub visitVoidType {
|
519
|
|
|
|
|
|
|
# empty
|
520
|
|
|
|
|
|
|
}
|
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
#
|
523
|
|
|
|
|
|
|
# 3.14 Attribute Declaration
|
524
|
|
|
|
|
|
|
#
|
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
sub visitAttribute {
|
527
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
528
|
0
|
|
|
|
|
|
my ($node) = @_;
|
529
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); # param_type_spec
|
530
|
0
|
|
|
|
|
|
$type->visit($self);
|
531
|
|
|
|
|
|
|
}
|
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
#
|
534
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations
|
535
|
|
|
|
|
|
|
#
|
536
|
|
|
|
|
|
|
|
537
|
0
|
|
|
0
|
0
|
|
sub visitTypeId {
|
538
|
|
|
|
|
|
|
# empty
|
539
|
|
|
|
|
|
|
}
|
540
|
|
|
|
|
|
|
|
541
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix {
|
542
|
|
|
|
|
|
|
# empty
|
543
|
|
|
|
|
|
|
}
|
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
#
|
546
|
|
|
|
|
|
|
# 3.16 Event Declaration
|
547
|
|
|
|
|
|
|
#
|
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
#
|
550
|
|
|
|
|
|
|
# 3.17 Component Declaration
|
551
|
|
|
|
|
|
|
#
|
552
|
|
|
|
|
|
|
|
553
|
0
|
|
|
0
|
0
|
|
sub visitProvides {
|
554
|
|
|
|
|
|
|
# empty
|
555
|
|
|
|
|
|
|
}
|
556
|
|
|
|
|
|
|
|
557
|
0
|
|
|
0
|
0
|
|
sub visitUses {
|
558
|
|
|
|
|
|
|
# empty
|
559
|
|
|
|
|
|
|
}
|
560
|
|
|
|
|
|
|
|
561
|
0
|
|
|
0
|
0
|
|
sub visitPublishes {
|
562
|
|
|
|
|
|
|
# empty
|
563
|
|
|
|
|
|
|
}
|
564
|
|
|
|
|
|
|
|
565
|
0
|
|
|
0
|
0
|
|
sub visitEmits {
|
566
|
|
|
|
|
|
|
# empty
|
567
|
|
|
|
|
|
|
}
|
568
|
|
|
|
|
|
|
|
569
|
0
|
|
|
0
|
0
|
|
sub visitConsumes {
|
570
|
|
|
|
|
|
|
# empty
|
571
|
|
|
|
|
|
|
}
|
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
#
|
574
|
|
|
|
|
|
|
# 3.18 Home Declaration
|
575
|
|
|
|
|
|
|
#
|
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
sub visitFactory {
|
578
|
|
|
|
|
|
|
# C mapping is aligned with CORBA 2.1
|
579
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
580
|
0
|
|
|
|
|
|
my ($node) = @_;
|
581
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
582
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
583
|
|
|
|
|
|
|
}
|
584
|
|
|
|
|
|
|
}
|
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
sub visitFinder {
|
587
|
|
|
|
|
|
|
# C mapping is aligned with CORBA 2.1
|
588
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
589
|
0
|
|
|
|
|
|
my ($node) = @_;
|
590
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
591
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
592
|
|
|
|
|
|
|
}
|
593
|
|
|
|
|
|
|
}
|
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
1;
|
596
|
|
|
|
|
|
|
|