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::Cplusplus::NameVisitor;
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4025
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.40';
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# builds $node->{cpp_name} and $node->{cpp_ns}
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new {
|
18
|
0
|
|
|
0
|
0
|
|
my $proto = shift;
|
19
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto;
|
20
|
0
|
|
|
|
|
|
my $self = {};
|
21
|
0
|
|
|
|
|
|
bless $self, $class;
|
22
|
0
|
|
|
|
|
|
my ($parser) = @_;
|
23
|
0
|
|
|
|
|
|
$self->{key} = 'cpp_name';
|
24
|
0
|
|
|
|
|
|
$self->{symbtab} = $parser->YYData->{symbtab};
|
25
|
0
|
|
|
|
|
|
$self->{cpp_keywords} = { # See 1.43 C++ Keywords
|
26
|
|
|
|
|
|
|
'and' => 1,
|
27
|
|
|
|
|
|
|
'and_ep' => 1,
|
28
|
|
|
|
|
|
|
'asm' => 1,
|
29
|
|
|
|
|
|
|
'auto' => 1,
|
30
|
|
|
|
|
|
|
'bitand' => 1,
|
31
|
|
|
|
|
|
|
'bitor' => 1,
|
32
|
|
|
|
|
|
|
'bool' => 1,
|
33
|
|
|
|
|
|
|
'break' => 1,
|
34
|
|
|
|
|
|
|
#IDL 'case' => 1,
|
35
|
|
|
|
|
|
|
'catch' => 1,
|
36
|
|
|
|
|
|
|
#IDL 'char' => 1,
|
37
|
|
|
|
|
|
|
'class' => 1,
|
38
|
|
|
|
|
|
|
'compl' => 1,
|
39
|
|
|
|
|
|
|
#IDL 'const' => 1,
|
40
|
|
|
|
|
|
|
'const_cast' => 1,
|
41
|
|
|
|
|
|
|
'continue' => 1,
|
42
|
|
|
|
|
|
|
#IDL 'default' => 1,
|
43
|
|
|
|
|
|
|
'delete' => 1,
|
44
|
|
|
|
|
|
|
'do' => 1,
|
45
|
|
|
|
|
|
|
#IDL 'double' => 1,
|
46
|
|
|
|
|
|
|
'dynamic_cast' => 1,
|
47
|
|
|
|
|
|
|
'else' => 1,
|
48
|
|
|
|
|
|
|
#IDL 'enum' => 1,
|
49
|
|
|
|
|
|
|
'explicit' => 1,
|
50
|
|
|
|
|
|
|
'export' => 1,
|
51
|
|
|
|
|
|
|
'extern' => 1,
|
52
|
|
|
|
|
|
|
#IDL 'false' => 1,
|
53
|
|
|
|
|
|
|
#IDL 'float' => 1,
|
54
|
|
|
|
|
|
|
'for' => 1,
|
55
|
|
|
|
|
|
|
'friend' => 1,
|
56
|
|
|
|
|
|
|
'goto' => 1,
|
57
|
|
|
|
|
|
|
'if' => 1,
|
58
|
|
|
|
|
|
|
'inline' => 1,
|
59
|
|
|
|
|
|
|
'int' => 1,
|
60
|
|
|
|
|
|
|
#IDL 'long' => 1,
|
61
|
|
|
|
|
|
|
'mutable' => 1,
|
62
|
|
|
|
|
|
|
'namespace' => 1,
|
63
|
|
|
|
|
|
|
'new' => 1,
|
64
|
|
|
|
|
|
|
'not' => 1,
|
65
|
|
|
|
|
|
|
'not_eq' => 1,
|
66
|
|
|
|
|
|
|
'operator' => 1,
|
67
|
|
|
|
|
|
|
'or' => 1,
|
68
|
|
|
|
|
|
|
'or_eq' => 1,
|
69
|
|
|
|
|
|
|
'private' => 1,
|
70
|
|
|
|
|
|
|
'protected' => 1,
|
71
|
|
|
|
|
|
|
'public' => 1,
|
72
|
|
|
|
|
|
|
'register' => 1,
|
73
|
|
|
|
|
|
|
'reinterpret_cast' => 1,
|
74
|
|
|
|
|
|
|
'return' => 1,
|
75
|
|
|
|
|
|
|
#IDL 'short' => 1,
|
76
|
|
|
|
|
|
|
'signed' => 1,
|
77
|
|
|
|
|
|
|
'sizeof' => 1,
|
78
|
|
|
|
|
|
|
'static' => 1,
|
79
|
|
|
|
|
|
|
'static_cast' => 1,
|
80
|
|
|
|
|
|
|
#IDL 'struct' => 1,
|
81
|
|
|
|
|
|
|
#IDL 'switch' => 1,
|
82
|
|
|
|
|
|
|
'template' => 1,
|
83
|
|
|
|
|
|
|
'this' => 1,
|
84
|
|
|
|
|
|
|
'throw' => 1,
|
85
|
|
|
|
|
|
|
#IDL 'true' => 1,
|
86
|
|
|
|
|
|
|
'try' => 1,
|
87
|
|
|
|
|
|
|
#IDL 'typedef' => 1,
|
88
|
|
|
|
|
|
|
'typeid' => 1,
|
89
|
|
|
|
|
|
|
'typename' => 1,
|
90
|
|
|
|
|
|
|
#IDL 'union' => 1,
|
91
|
|
|
|
|
|
|
#IDL 'unsigned' => 1,
|
92
|
|
|
|
|
|
|
'using' => 1,
|
93
|
|
|
|
|
|
|
'virtual' => 1,
|
94
|
|
|
|
|
|
|
#IDL 'void' => 1,
|
95
|
|
|
|
|
|
|
'volatile' => 1,
|
96
|
|
|
|
|
|
|
'wchar_t' => 1,
|
97
|
|
|
|
|
|
|
'while' => 1,
|
98
|
|
|
|
|
|
|
'xor' => 1,
|
99
|
|
|
|
|
|
|
'xor_eq' => 1
|
100
|
|
|
|
|
|
|
};
|
101
|
0
|
|
|
|
|
|
return $self;
|
102
|
|
|
|
|
|
|
}
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub _get_name { # See 1.1.2 Scoped Names
|
105
|
0
|
|
|
0
|
|
|
my $self = shift;
|
106
|
0
|
|
|
|
|
|
my ($node) = @_;
|
107
|
0
|
|
|
|
|
|
my $name = $node->{idf};
|
108
|
0
|
|
|
|
|
|
$name =~ s/^_get_//;
|
109
|
0
|
|
|
|
|
|
$name =~ s/^_set_//;
|
110
|
0
|
0
|
|
|
|
|
if (exists $self->{cpp_keywords}->{name}) {
|
111
|
0
|
|
|
|
|
|
return '_cxx_' . $name;
|
112
|
|
|
|
|
|
|
}
|
113
|
|
|
|
|
|
|
else {
|
114
|
0
|
|
|
|
|
|
return $name;
|
115
|
|
|
|
|
|
|
}
|
116
|
|
|
|
|
|
|
}
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub _get_ns {
|
119
|
0
|
|
|
0
|
|
|
my $self = shift;
|
120
|
0
|
|
|
|
|
|
my ($node) = @_;
|
121
|
0
|
|
|
|
|
|
my $pkg = $node->{full};
|
122
|
0
|
|
|
|
|
|
$pkg =~ s/::[0-9A-Z_a-z]+$//;
|
123
|
0
|
0
|
|
|
|
|
return q{} unless ($pkg);
|
124
|
0
|
|
|
|
|
|
my $defn = $self->{symbtab}->Lookup($pkg);
|
125
|
0
|
0
|
0
|
|
|
|
if ( $defn->isa('StructType')
|
|
|
|
0
|
|
|
|
|
126
|
|
|
|
|
|
|
or $defn->isa('UnionType')
|
127
|
|
|
|
|
|
|
or $defn->isa('ExceptionType') ) {
|
128
|
0
|
|
|
|
|
|
$pkg =~ s/::[0-9A-Z_a-z]+$//;
|
129
|
|
|
|
|
|
|
}
|
130
|
0
|
0
|
|
|
|
|
return q{} unless ($pkg);
|
131
|
0
|
|
|
|
|
|
my $ns = q{};
|
132
|
0
|
|
|
|
|
|
$pkg =~ s/^:://;
|
133
|
0
|
|
|
|
|
|
foreach (split /::/, $pkg) {
|
134
|
0
|
0
|
|
|
|
|
if (exists $self->{cpp_keywords}->{$_}) {
|
135
|
0
|
|
|
|
|
|
$ns .= '::_cxx_' . $_;
|
136
|
|
|
|
|
|
|
}
|
137
|
|
|
|
|
|
|
else {
|
138
|
0
|
|
|
|
|
|
$ns .= '::' . $_;
|
139
|
|
|
|
|
|
|
}
|
140
|
|
|
|
|
|
|
}
|
141
|
0
|
|
|
|
|
|
$ns =~ s/^:://;
|
142
|
0
|
|
|
|
|
|
return $ns;
|
143
|
|
|
|
|
|
|
}
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub _get_defn {
|
146
|
0
|
|
|
0
|
|
|
my $self = shift;
|
147
|
0
|
|
|
|
|
|
my ($defn) = @_;
|
148
|
0
|
0
|
|
|
|
|
if (ref $defn) {
|
149
|
0
|
|
|
|
|
|
return $defn;
|
150
|
|
|
|
|
|
|
}
|
151
|
|
|
|
|
|
|
else {
|
152
|
0
|
|
|
|
|
|
return $self->{symbtab}->Lookup($defn);
|
153
|
|
|
|
|
|
|
}
|
154
|
|
|
|
|
|
|
}
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
#
|
157
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification
|
158
|
|
|
|
|
|
|
#
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub visitSpecification {
|
161
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
162
|
0
|
|
|
|
|
|
my ($node) = @_;
|
163
|
0
|
0
|
|
|
|
|
if (exists $node->{list_import}) {
|
164
|
0
|
|
|
|
|
|
foreach (@{$node->{list_import}}) {
|
|
0
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
$_->visit($self);
|
166
|
|
|
|
|
|
|
}
|
167
|
|
|
|
|
|
|
}
|
168
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) {
|
|
0
|
|
|
|
|
|
|
169
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self);
|
170
|
|
|
|
|
|
|
}
|
171
|
|
|
|
|
|
|
}
|
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
#
|
174
|
|
|
|
|
|
|
# 3.6 Import Declaration
|
175
|
|
|
|
|
|
|
#
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub visitImport {
|
178
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
179
|
0
|
|
|
|
|
|
my ($node) = @_;
|
180
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) {
|
|
0
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self);
|
182
|
|
|
|
|
|
|
}
|
183
|
|
|
|
|
|
|
}
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
#
|
186
|
|
|
|
|
|
|
# 3.7 Module Declaration
|
187
|
|
|
|
|
|
|
#
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
sub visitModules {
|
190
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
191
|
0
|
|
|
|
|
|
my ($node) = @_;
|
192
|
0
|
|
|
|
|
|
my $ns_save = $self->{ns_curr};
|
193
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
194
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
195
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) {
|
|
0
|
|
|
|
|
|
|
196
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self);
|
197
|
|
|
|
|
|
|
}
|
198
|
|
|
|
|
|
|
}
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
#
|
201
|
|
|
|
|
|
|
# 3.8 Interface Declaration
|
202
|
|
|
|
|
|
|
#
|
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub visitBaseInterface {
|
205
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
206
|
0
|
|
|
|
|
|
my ($node) = @_;
|
207
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_name});
|
208
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
209
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
210
|
0
|
|
|
|
|
|
$node->{cpp_has_ptr} = 1;
|
211
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
212
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) {
|
|
0
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self);
|
214
|
|
|
|
|
|
|
}
|
215
|
|
|
|
|
|
|
}
|
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
sub visitForwardBaseInterface {
|
218
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
219
|
0
|
|
|
|
|
|
my ($node) = @_;
|
220
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_name});
|
221
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
222
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
223
|
0
|
|
|
|
|
|
$node->{cpp_has_ptr} = 1;
|
224
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
225
|
|
|
|
|
|
|
}
|
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
#
|
228
|
|
|
|
|
|
|
# 3.9 Value Declaration
|
229
|
|
|
|
|
|
|
#
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
sub visitStateMember {
|
232
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
233
|
0
|
|
|
|
|
|
my ($node) = @_;
|
234
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
235
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
236
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self);
|
237
|
|
|
|
|
|
|
}
|
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
sub visitInitializer {
|
240
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
241
|
0
|
|
|
|
|
|
my ($node) = @_;
|
242
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
243
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
244
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
246
|
|
|
|
|
|
|
}
|
247
|
|
|
|
|
|
|
}
|
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
#
|
250
|
|
|
|
|
|
|
# 3.10 Constant Declaration
|
251
|
|
|
|
|
|
|
#
|
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
sub visitConstant {
|
254
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
255
|
0
|
|
|
|
|
|
my ($node) = @_;
|
256
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
257
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
258
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self);
|
259
|
|
|
|
|
|
|
}
|
260
|
|
|
|
|
|
|
|
261
|
0
|
|
|
0
|
0
|
|
sub visitExpression {
|
262
|
|
|
|
|
|
|
# empty
|
263
|
|
|
|
|
|
|
}
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
#
|
266
|
|
|
|
|
|
|
# 3.11 Type Declaration
|
267
|
|
|
|
|
|
|
#
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
sub visitTypeDeclarator {
|
270
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
271
|
0
|
|
|
|
|
|
my ($node) = @_;
|
272
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_ns});
|
273
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
274
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
275
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
276
|
0
|
0
|
0
|
|
|
|
if ($type->isa('SequenceType') and !exists $node->{array_size}) {
|
277
|
0
|
|
|
|
|
|
$type->{repos_id} = $node->{repos_id};
|
278
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
279
|
0
|
|
|
|
|
|
$type->visit($self, $node->{cpp_name});
|
280
|
|
|
|
|
|
|
}
|
281
|
|
|
|
|
|
|
else {
|
282
|
0
|
|
|
|
|
|
$type->visit($self);
|
283
|
|
|
|
|
|
|
}
|
284
|
|
|
|
|
|
|
}
|
285
|
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
sub visitNativeType {
|
287
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
288
|
0
|
|
|
|
|
|
my ($node) = @_;
|
289
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
290
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
291
|
|
|
|
|
|
|
}
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
#
|
294
|
|
|
|
|
|
|
# 3.11.1 Basic Types
|
295
|
|
|
|
|
|
|
#
|
296
|
|
|
|
|
|
|
# See 1.5 Mapping for Basic Data Types
|
297
|
|
|
|
|
|
|
#
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub visitIntegerType {
|
300
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
301
|
0
|
|
|
|
|
|
my ($node) = @_;
|
302
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
303
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'short') {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
304
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Short';
|
305
|
|
|
|
|
|
|
}
|
306
|
|
|
|
|
|
|
elsif ($node->{value} eq 'unsigned short') {
|
307
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'UShort';
|
308
|
|
|
|
|
|
|
}
|
309
|
|
|
|
|
|
|
elsif ($node->{value} eq 'long') {
|
310
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Long';
|
311
|
|
|
|
|
|
|
}
|
312
|
|
|
|
|
|
|
elsif ($node->{value} eq 'unsigned long') {
|
313
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'ULong';
|
314
|
|
|
|
|
|
|
}
|
315
|
|
|
|
|
|
|
elsif ($node->{value} eq 'long long') {
|
316
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'LongLong';
|
317
|
|
|
|
|
|
|
}
|
318
|
|
|
|
|
|
|
elsif ($node->{value} eq 'unsigned long long') {
|
319
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'ULongLong';
|
320
|
|
|
|
|
|
|
}
|
321
|
|
|
|
|
|
|
else {
|
322
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitIntegerType $node->{value}.\n"
|
323
|
|
|
|
|
|
|
}
|
324
|
|
|
|
|
|
|
}
|
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub visitFloatingPtType {
|
327
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
328
|
0
|
|
|
|
|
|
my ($node) = @_;
|
329
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
330
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'float') {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
331
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Float';
|
332
|
|
|
|
|
|
|
}
|
333
|
|
|
|
|
|
|
elsif ($node->{value} eq 'double') {
|
334
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Double';
|
335
|
|
|
|
|
|
|
}
|
336
|
|
|
|
|
|
|
elsif ($node->{value} eq 'long double') {
|
337
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'LongDouble';
|
338
|
|
|
|
|
|
|
}
|
339
|
|
|
|
|
|
|
else {
|
340
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitFloatingPtType $node->{value}.\n"
|
341
|
|
|
|
|
|
|
}
|
342
|
|
|
|
|
|
|
}
|
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
sub visitCharType {
|
345
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
346
|
0
|
|
|
|
|
|
my ($node) = @_;
|
347
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
348
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Char';
|
349
|
|
|
|
|
|
|
}
|
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub visitWideCharType {
|
352
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
353
|
0
|
|
|
|
|
|
my ($node) = @_;
|
354
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
355
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'WChar';
|
356
|
|
|
|
|
|
|
}
|
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
sub visitBooleanType {
|
359
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
360
|
0
|
|
|
|
|
|
my ($node) = @_;
|
361
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
362
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Boolean';
|
363
|
|
|
|
|
|
|
}
|
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
sub visitOctetType {
|
366
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
367
|
0
|
|
|
|
|
|
my ($node) = @_;
|
368
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
369
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Octet';
|
370
|
|
|
|
|
|
|
}
|
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
sub visitAnyType {
|
373
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
374
|
0
|
|
|
|
|
|
my ($node) = @_;
|
375
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
376
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Any';
|
377
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
378
|
|
|
|
|
|
|
}
|
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
sub visitObjectType {
|
381
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
382
|
0
|
|
|
|
|
|
my ($node) = @_;
|
383
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
384
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'Object';
|
385
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
386
|
|
|
|
|
|
|
}
|
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
sub visitValueBaseType {
|
389
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
390
|
0
|
|
|
|
|
|
my ($node) = @_;
|
391
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
392
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'ValueBase';
|
393
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
394
|
|
|
|
|
|
|
}
|
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
#
|
397
|
|
|
|
|
|
|
# 3.11.2 Constructed Types
|
398
|
|
|
|
|
|
|
#
|
399
|
|
|
|
|
|
|
# 3.11.2.1 Structures
|
400
|
|
|
|
|
|
|
#
|
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
sub visitStructType {
|
403
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
404
|
0
|
|
|
|
|
|
my ($node) = @_;
|
405
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_ns});
|
406
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
407
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
408
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
409
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) {
|
|
0
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # member
|
411
|
|
|
|
|
|
|
}
|
412
|
|
|
|
|
|
|
}
|
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
sub visitMember {
|
415
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
416
|
0
|
|
|
|
|
|
my ($node) = @_;
|
417
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
418
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self);
|
419
|
|
|
|
|
|
|
}
|
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions
|
422
|
|
|
|
|
|
|
#
|
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
sub visitUnionType {
|
425
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
426
|
0
|
|
|
|
|
|
my ($node) = @_;
|
427
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_ns});
|
428
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
429
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
430
|
0
|
|
|
|
|
|
$node->{cpp_has_var} = 1;
|
431
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self);
|
432
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
433
|
0
|
|
|
|
|
|
$_->visit($self); # case
|
434
|
|
|
|
|
|
|
}
|
435
|
|
|
|
|
|
|
}
|
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
sub visitCase {
|
438
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
439
|
0
|
|
|
|
|
|
my ($node) = @_;
|
440
|
0
|
|
|
|
|
|
foreach (@{$node->{list_label}}) {
|
|
0
|
|
|
|
|
|
|
441
|
0
|
|
|
|
|
|
$_->visit($self); # default or expression
|
442
|
|
|
|
|
|
|
}
|
443
|
0
|
|
|
|
|
|
$node->{element}->visit($self);
|
444
|
|
|
|
|
|
|
}
|
445
|
|
|
|
|
|
|
|
446
|
0
|
|
|
0
|
0
|
|
sub visitDefault {
|
447
|
|
|
|
|
|
|
# empty
|
448
|
|
|
|
|
|
|
}
|
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
sub visitElement {
|
451
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
452
|
0
|
|
|
|
|
|
my ($node) = @_;
|
453
|
0
|
|
|
|
|
|
$self->_get_defn($node->{value})->visit($self); # member
|
454
|
|
|
|
|
|
|
}
|
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations
|
457
|
|
|
|
|
|
|
#
|
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
sub visitEnumType {
|
460
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
461
|
0
|
|
|
|
|
|
my ($node) = @_;
|
462
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
463
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
464
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
465
|
0
|
|
|
|
|
|
$_->visit($self); # enum
|
466
|
|
|
|
|
|
|
}
|
467
|
|
|
|
|
|
|
}
|
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
sub visitEnum {
|
470
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
471
|
0
|
|
|
|
|
|
my ($node) = @_;
|
472
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
473
|
|
|
|
|
|
|
}
|
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
#
|
476
|
|
|
|
|
|
|
# 3.11.3 Template Types
|
477
|
|
|
|
|
|
|
#
|
478
|
|
|
|
|
|
|
# See 1.13 Mapping for Sequence Types
|
479
|
|
|
|
|
|
|
#
|
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
sub visitSequenceType {
|
482
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
483
|
0
|
|
|
|
|
|
my ($node, $name) = @_;
|
484
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_ns});
|
485
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
486
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
487
|
0
|
|
|
|
|
|
$type->visit($self);
|
488
|
0
|
0
|
|
|
|
|
unless (defined $name) {
|
489
|
0
|
|
|
|
|
|
$name = '_seq_' . $type->{cpp_name};
|
490
|
0
|
0
|
|
|
|
|
if (exists $node->{max}) {
|
491
|
0
|
|
|
|
|
|
$name .= '_' . $node->{max}->{value};
|
492
|
0
|
|
|
|
|
|
$name =~ s/\+//g;
|
493
|
|
|
|
|
|
|
}
|
494
|
|
|
|
|
|
|
}
|
495
|
0
|
|
|
|
|
|
$node->{cpp_name} = $name;
|
496
|
|
|
|
|
|
|
}
|
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
#
|
499
|
|
|
|
|
|
|
# See 1.7 Mapping for String Types
|
500
|
|
|
|
|
|
|
#
|
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
sub visitStringType {
|
503
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
504
|
0
|
|
|
|
|
|
my ($node) = @_;
|
505
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
506
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'String';
|
507
|
|
|
|
|
|
|
}
|
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
#
|
510
|
|
|
|
|
|
|
# See 1.8 Mapping for Wide String Types
|
511
|
|
|
|
|
|
|
#
|
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
sub visitWideStringType {
|
514
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
515
|
0
|
|
|
|
|
|
my ($node) = @_;
|
516
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
517
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'WString';
|
518
|
|
|
|
|
|
|
}
|
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
#
|
521
|
|
|
|
|
|
|
#
|
522
|
|
|
|
|
|
|
#
|
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
sub visitFixedPtType {
|
525
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
526
|
0
|
|
|
|
|
|
my ($node) = @_;
|
527
|
0
|
|
|
|
|
|
my $name = 'Fixed';
|
528
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
529
|
0
|
|
|
|
|
|
$node->{cpp_name} = $name;
|
530
|
|
|
|
|
|
|
}
|
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
sub visitFixedPtConstType {
|
533
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
534
|
0
|
|
|
|
|
|
my ($node) = @_;
|
535
|
0
|
|
|
|
|
|
my $name = 'Fixed';
|
536
|
0
|
|
|
|
|
|
$node->{cpp_ns} = 'CORBA';
|
537
|
0
|
|
|
|
|
|
$node->{cpp_name} = $name;
|
538
|
|
|
|
|
|
|
}
|
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
#
|
541
|
|
|
|
|
|
|
# 3.12 Exception Declaration
|
542
|
|
|
|
|
|
|
#
|
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
sub visitException {
|
545
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
546
|
0
|
|
|
|
|
|
my ($node) = @_;
|
547
|
0
|
0
|
|
|
|
|
return if (exists $node->{cpp_ns});
|
548
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
549
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
550
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) {
|
|
0
|
|
|
|
|
|
|
551
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # member
|
552
|
|
|
|
|
|
|
}
|
553
|
|
|
|
|
|
|
}
|
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
#
|
556
|
|
|
|
|
|
|
# 3.13 Operation Declaration
|
557
|
|
|
|
|
|
|
#
|
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
sub visitOperation {
|
561
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
562
|
0
|
|
|
|
|
|
my ($node) = @_;
|
563
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
564
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
565
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self);
|
566
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
568
|
|
|
|
|
|
|
}
|
569
|
|
|
|
|
|
|
}
|
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
sub visitParameter {
|
572
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
573
|
0
|
|
|
|
|
|
my ($node) = @_;
|
574
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
575
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self);
|
576
|
|
|
|
|
|
|
}
|
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
sub visitVoidType {
|
579
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
580
|
0
|
|
|
|
|
|
my ($node) = @_;
|
581
|
0
|
|
|
|
|
|
$node->{cpp_name} = 'void';
|
582
|
|
|
|
|
|
|
}
|
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
#
|
585
|
|
|
|
|
|
|
# 3.14 Attribute Declaration
|
586
|
|
|
|
|
|
|
#
|
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sub visitAttribute {
|
589
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
590
|
0
|
|
|
|
|
|
my ($node) = @_;
|
591
|
0
|
|
|
|
|
|
$node->{_get}->visit($self);
|
592
|
0
|
0
|
|
|
|
|
$node->{_set}->visit($self) if (exists $node->{_set});
|
593
|
|
|
|
|
|
|
}
|
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
#
|
596
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations
|
597
|
|
|
|
|
|
|
#
|
598
|
|
|
|
|
|
|
|
599
|
0
|
|
|
0
|
0
|
|
sub visitTypeId {
|
600
|
|
|
|
|
|
|
# empty
|
601
|
|
|
|
|
|
|
}
|
602
|
|
|
|
|
|
|
|
603
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix {
|
604
|
|
|
|
|
|
|
# empty
|
605
|
|
|
|
|
|
|
}
|
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
#
|
608
|
|
|
|
|
|
|
# 3.16 Event Declaration
|
609
|
|
|
|
|
|
|
#
|
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
#
|
612
|
|
|
|
|
|
|
# 3.17 Component Declaration
|
613
|
|
|
|
|
|
|
#
|
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
sub visitProvides {
|
616
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
617
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
618
|
0
|
|
|
|
|
|
my ($node) = @_;
|
619
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
620
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
621
|
|
|
|
|
|
|
}
|
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
sub visitUses {
|
624
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
625
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
626
|
0
|
|
|
|
|
|
my ($node) = @_;
|
627
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
628
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
629
|
|
|
|
|
|
|
}
|
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
sub visitPublishes {
|
632
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
633
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
634
|
0
|
|
|
|
|
|
my ($node) = @_;
|
635
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
636
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
637
|
|
|
|
|
|
|
}
|
638
|
|
|
|
|
|
|
|
639
|
|
|
|
|
|
|
sub visitEmits {
|
640
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
641
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
642
|
0
|
|
|
|
|
|
my ($node) = @_;
|
643
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
644
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
645
|
|
|
|
|
|
|
}
|
646
|
|
|
|
|
|
|
|
647
|
|
|
|
|
|
|
sub visitConsumes {
|
648
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
649
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
650
|
0
|
|
|
|
|
|
my ($node) = @_;
|
651
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
652
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
653
|
|
|
|
|
|
|
}
|
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
#
|
656
|
|
|
|
|
|
|
# 3.18 Home Declaration
|
657
|
|
|
|
|
|
|
#
|
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
sub visitFactory {
|
660
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
661
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
662
|
0
|
|
|
|
|
|
my ($node) = @_;
|
663
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
664
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
665
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
666
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
667
|
|
|
|
|
|
|
}
|
668
|
|
|
|
|
|
|
}
|
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
sub visitFinder {
|
671
|
|
|
|
|
|
|
# C++ mapping is aligned with CORBA 2.3
|
672
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
673
|
0
|
|
|
|
|
|
my ($node) = @_;
|
674
|
0
|
|
|
|
|
|
$node->{cpp_ns} = $self->_get_ns($node);
|
675
|
0
|
|
|
|
|
|
$node->{cpp_name} = $self->_get_name($node);
|
676
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) {
|
|
0
|
|
|
|
|
|
|
677
|
0
|
|
|
|
|
|
$_->visit($self); # parameter
|
678
|
|
|
|
|
|
|
}
|
679
|
|
|
|
|
|
|
}
|
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
1;
|
682
|
|
|
|
|
|
|
|