line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Interface Definition Language (OMG IDL CORBA v3.0) |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# IDL to Java Language Mapping Specification, Version 1.2 August 2002 |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package CORBA::JAVA::UidVisitor; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.61'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
12
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
16
|
1
|
|
|
1
|
|
5
|
use Digest::SHA1 qw(sha1_hex); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1527
|
|
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->{symbtab} = $parser->YYData->{symbtab}; |
25
|
0
|
|
|
|
|
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _get_defn { |
29
|
0
|
|
|
0
|
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my ($defn) = @_; |
31
|
0
|
0
|
|
|
|
|
if (ref $defn) { |
32
|
0
|
|
|
|
|
|
return $defn; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else { |
35
|
0
|
|
|
|
|
|
return $self->{symbtab}->Lookup($defn); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _get_uid { |
40
|
0
|
|
|
0
|
|
|
my $self = shift; |
41
|
0
|
|
|
|
|
|
my ($tree) = @_; |
42
|
0
|
|
|
|
|
|
return uc(substr(sha1_hex(Dumper($tree)), 0, 16)); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub visitSpecification { |
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
0
|
|
|
|
|
|
my ($node) = @_; |
52
|
0
|
0
|
|
|
|
|
if (exists $node->{list_import}) { |
53
|
0
|
|
|
|
|
|
foreach (@{$node->{list_import}}) { |
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# |
63
|
|
|
|
|
|
|
# 3.6 Import Declaration |
64
|
|
|
|
|
|
|
# |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub visitImport { |
67
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
68
|
0
|
|
|
|
|
|
my ($node) = @_; |
69
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
0
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# |
75
|
|
|
|
|
|
|
# 3.7 Module Declaration |
76
|
|
|
|
|
|
|
# |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub visitModules { |
79
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
80
|
0
|
|
|
|
|
|
my ($node) = @_; |
81
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# |
87
|
|
|
|
|
|
|
# 3.8 Interface Declaration |
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub visitBaseInterface { |
91
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
92
|
0
|
|
|
|
|
|
my ($node) = @_; |
93
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_uid}); |
94
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
96
|
|
|
|
|
|
|
} |
97
|
0
|
|
|
|
|
|
my $uid = {}; |
98
|
0
|
|
|
|
|
|
$uid->{$node->{java_name}} = undef; |
99
|
0
|
0
|
|
|
|
|
if (exists $node->{inheritance}) { |
100
|
0
|
0
|
|
|
|
|
if (exists $node->{inheritance}->{list_interface}) { |
101
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_interface}}) { |
|
0
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
103
|
0
|
|
|
|
|
|
$uid->{$base->{java_name}} = $base->{java_uid}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
0
|
0
|
|
|
|
|
if (exists $node->{inheritance}->{list_value}) { |
107
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_value}}) { |
|
0
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
109
|
0
|
|
|
|
|
|
$uid->{$base->{java_name}} = $base->{java_uid}; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
} |
113
|
0
|
0
|
|
|
|
|
if ($node->{list_member}) { |
114
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
0
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
my $defn = $self->_get_defn($_); |
116
|
0
|
|
|
|
|
|
$defn->visit($self); # 'Member' |
117
|
0
|
|
|
|
|
|
$uid->{$defn->{java_name}} = $defn->{java_type}; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
} |
120
|
0
|
|
|
|
|
|
$node->{java_uid} = $self->_get_uid($uid); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
0
|
0
|
|
sub visitForwardBaseInterface { |
124
|
|
|
|
|
|
|
# empty |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# |
128
|
|
|
|
|
|
|
# 3.9 Value Declaration |
129
|
|
|
|
|
|
|
# |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
0
|
0
|
|
sub visitStateMember { |
132
|
|
|
|
|
|
|
# empty |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
0
|
0
|
|
sub visitInitializer { |
136
|
|
|
|
|
|
|
# empty |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub visitBoxedValue { |
140
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
141
|
0
|
|
|
|
|
|
my ($node) = @_; |
142
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_uid}); |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
145
|
0
|
|
|
|
|
|
$type->visit($self); |
146
|
0
|
|
|
|
|
|
my $uid = {}; |
147
|
0
|
|
|
|
|
|
$uid->{$node->{java_name}} = $node->{java_type_code}; |
148
|
0
|
|
|
|
|
|
$node->{java_uid} = $self->_get_uid($uid); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
# |
152
|
|
|
|
|
|
|
# 3.10 Constant Declaration |
153
|
|
|
|
|
|
|
# |
154
|
|
|
|
|
|
|
|
155
|
0
|
|
|
0
|
0
|
|
sub visitConstant { |
156
|
|
|
|
|
|
|
# empty |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# |
160
|
|
|
|
|
|
|
# 3.11 Type Declaration |
161
|
|
|
|
|
|
|
# |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub visitTypeDeclarator { |
164
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
165
|
0
|
|
|
|
|
|
my ($node) = @_; |
166
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
167
|
0
|
|
|
|
|
|
$type->visit($self); |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
0
|
|
|
0
|
0
|
|
sub visitNativeType { |
171
|
|
|
|
|
|
|
# empty |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# |
175
|
|
|
|
|
|
|
# 3.11.1 Basic Types |
176
|
|
|
|
|
|
|
# |
177
|
|
|
|
|
|
|
|
178
|
0
|
|
|
0
|
0
|
|
sub visitBasicType { |
179
|
|
|
|
|
|
|
# empty |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
# |
183
|
|
|
|
|
|
|
# 3.11.2 Constructed Types |
184
|
|
|
|
|
|
|
# |
185
|
|
|
|
|
|
|
# 3.11.2.1 Structures |
186
|
|
|
|
|
|
|
# |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub visitStructType { |
189
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
190
|
0
|
|
|
|
|
|
my ($node) = @_; |
191
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_uid}); |
192
|
0
|
|
|
|
|
|
my $uid = {}; |
193
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
0
|
|
|
|
|
|
|
194
|
0
|
|
|
|
|
|
my $defn = $self->_get_defn($_); |
195
|
0
|
|
|
|
|
|
$uid->{$defn->{java_name}} = $defn->{java_type}; |
196
|
0
|
|
|
|
|
|
$self->_get_defn($defn->{type})->visit($self); |
197
|
|
|
|
|
|
|
} |
198
|
0
|
|
|
|
|
|
$node->{java_uid} = $self->_get_uid($uid); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions |
202
|
|
|
|
|
|
|
# |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
sub visitUnionType { |
205
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
206
|
0
|
|
|
|
|
|
my ($node) = @_; |
207
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_uid}); |
208
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self); |
209
|
0
|
|
|
|
|
|
my $uid = {}; |
210
|
0
|
|
|
|
|
|
$uid->{_d} = $self->_get_defn($node->{type})->{java_type}; |
211
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
0
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
my $elt = $self->_get_defn($_->{element}); |
213
|
0
|
|
|
|
|
|
$elt->visit($self); |
214
|
0
|
|
|
|
|
|
foreach my $label (@{$_->{list_label}}) { |
|
0
|
|
|
|
|
|
|
215
|
0
|
0
|
|
|
|
|
if (ref $label eq 'CORBA::IDL::Default') { |
216
|
0
|
|
|
|
|
|
$uid->{default} = $elt->{java_Name}; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
else { |
219
|
0
|
|
|
|
|
|
$uid->{$label->{java_literal}} = $elt->{java_Name}; |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
} |
223
|
0
|
|
|
|
|
|
$node->{java_uid} = $self->_get_uid($uid); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub visitElement { |
227
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
228
|
0
|
|
|
|
|
|
my ($node) = @_; |
229
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($node->{value}); |
230
|
0
|
|
|
|
|
|
$self->_get_defn($member->{type})->visit($self); |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations |
234
|
|
|
|
|
|
|
# |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
sub visitEnumType { |
237
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
238
|
0
|
|
|
|
|
|
my ($node) = @_; |
239
|
0
|
|
|
|
|
|
my $uid = {}; |
240
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
0
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
$uid->{$_->{java_name}} = undef; |
242
|
|
|
|
|
|
|
} |
243
|
0
|
|
|
|
|
|
$node->{java_uid} = $self->_get_uid($uid); |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
# |
247
|
|
|
|
|
|
|
# 3.11.3 Template Types |
248
|
|
|
|
|
|
|
# |
249
|
|
|
|
|
|
|
|
250
|
0
|
|
|
0
|
0
|
|
sub visit_TemplateType { |
251
|
|
|
|
|
|
|
# empty |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
# |
255
|
|
|
|
|
|
|
# 3.12 Exception Declaration |
256
|
|
|
|
|
|
|
# |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub visitException { |
259
|
0
|
|
|
0
|
0
|
|
shift->visitStructType(@_); |
260
|
|
|
|
|
|
|
} |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
# |
263
|
|
|
|
|
|
|
# 3.13 Operation Declaration |
264
|
|
|
|
|
|
|
# |
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
0
|
0
|
|
sub visitOperation { |
267
|
|
|
|
|
|
|
# empty |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
# |
271
|
|
|
|
|
|
|
# 3.14 Attribute Declaration |
272
|
|
|
|
|
|
|
# |
273
|
|
|
|
|
|
|
|
274
|
0
|
|
|
0
|
0
|
|
sub visitAttribute { |
275
|
|
|
|
|
|
|
# empty |
276
|
|
|
|
|
|
|
} |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
# |
279
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations |
280
|
|
|
|
|
|
|
# |
281
|
|
|
|
|
|
|
|
282
|
0
|
|
|
0
|
0
|
|
sub visitTypeId { |
283
|
|
|
|
|
|
|
# empty |
284
|
|
|
|
|
|
|
} |
285
|
|
|
|
|
|
|
|
286
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix { |
287
|
|
|
|
|
|
|
# empty |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
# |
291
|
|
|
|
|
|
|
# 3.16 Event Declaration |
292
|
|
|
|
|
|
|
# |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
# |
295
|
|
|
|
|
|
|
# 3.17 Component Declaration |
296
|
|
|
|
|
|
|
# |
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
0
|
0
|
|
sub visitProvides { |
299
|
|
|
|
|
|
|
# empty |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
|
302
|
0
|
|
|
0
|
0
|
|
sub visitUses { |
303
|
|
|
|
|
|
|
# empty |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
|
306
|
0
|
|
|
0
|
0
|
|
sub visitPublishes { |
307
|
|
|
|
|
|
|
# empty |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
|
310
|
0
|
|
|
0
|
0
|
|
sub visitEmits { |
311
|
|
|
|
|
|
|
# empty |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
0
|
0
|
|
sub visitConsumes { |
315
|
|
|
|
|
|
|
# empty |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
# |
319
|
|
|
|
|
|
|
# 3.18 Home Declaration |
320
|
|
|
|
|
|
|
# |
321
|
|
|
|
|
|
|
|
322
|
0
|
|
|
0
|
0
|
|
sub visitFactory { |
323
|
|
|
|
|
|
|
# empty |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
0
|
|
|
0
|
0
|
|
sub visitFinder { |
327
|
|
|
|
|
|
|
# empty |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
1; |
331
|
|
|
|
|
|
|
|