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::Name2Visitor; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
11
|
1
|
|
|
1
|
|
1259
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.64'; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use CORBA::JAVA::NameVisitor; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
16
|
1
|
|
|
1
|
|
4
|
use base qw(CORBA::JAVA::NameVisitor); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6026
|
|
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_Helper { |
29
|
0
|
|
|
0
|
|
|
my $self = shift; |
30
|
0
|
|
|
|
|
|
my ($node, $java_package) = @_; |
31
|
0
|
0
|
|
|
|
|
$java_package = $node->{java_package} unless (defined $java_package); |
32
|
0
|
0
|
|
|
|
|
if ($java_package) { |
33
|
0
|
|
|
|
|
|
return $java_package . '.' . $node->{java_helper}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else { |
36
|
0
|
|
|
|
|
|
return $node->{java_helper}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _get_stub { |
41
|
0
|
|
|
0
|
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
my ($node) = @_; |
43
|
0
|
0
|
|
|
|
|
if ($node->{java_package}) { |
44
|
0
|
|
|
|
|
|
return $node->{java_package} . '._' . $node->{java_name} . 'Stub'; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
else { |
47
|
0
|
|
|
|
|
|
return '_' . $node->{java_name} . 'Stub'; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub visitSpecification { |
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my ($node) = @_; |
58
|
0
|
0
|
|
|
|
|
if (exists $node->{list_import}) { |
59
|
0
|
|
|
|
|
|
foreach (@{$node->{list_import}}) { |
|
0
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# |
69
|
|
|
|
|
|
|
# 3.6 Import Declaration |
70
|
|
|
|
|
|
|
# |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub visitImport { |
73
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
74
|
0
|
|
|
|
|
|
my ($node) = @_; |
75
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# |
81
|
|
|
|
|
|
|
# 3.7 Module Declaration |
82
|
|
|
|
|
|
|
# |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub visitModules { |
85
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
86
|
0
|
|
|
|
|
|
my ($node) = @_; |
87
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
# 3.8 Interface Declaration |
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub visitBaseInterface { |
97
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
98
|
0
|
|
|
|
|
|
my ($node) = @_; |
99
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
100
|
0
|
|
|
|
|
|
$node->{java_stub} = $self->_get_stub($node); |
101
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
102
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
103
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
104
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
105
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
106
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
107
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
108
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub visitForwardBaseInterface { |
114
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
115
|
0
|
|
|
|
|
|
my ($node) = @_; |
116
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
117
|
0
|
|
|
|
|
|
$node->{java_stub} = $self->_get_stub($node); |
118
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
119
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
120
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
121
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
122
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
123
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
124
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
# |
128
|
|
|
|
|
|
|
# 3.9 Value Declaration |
129
|
|
|
|
|
|
|
# |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub visitValue { |
132
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
133
|
0
|
|
|
|
|
|
my ($node) = @_; |
134
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
135
|
0
|
|
|
|
|
|
$node->{java_stub} = $self->_get_stub($node); |
136
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
137
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
138
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
139
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
140
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
141
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
142
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
143
|
0
|
|
|
|
|
|
foreach (@{$node->{list_export}}) { |
|
0
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
$self->{symbtab}->Lookup($_)->visit($self); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub visitStateMember { |
149
|
0
|
|
|
0
|
0
|
|
shift->visitMember(@_); |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub visitInitializer { |
153
|
0
|
|
|
0
|
0
|
|
shift->visitOperation(@_); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
sub visitBoxedValue { |
157
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
158
|
0
|
|
|
|
|
|
my ($node) = @_; |
159
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
162
|
0
|
|
|
|
|
|
$type->visit($self); |
163
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
164
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
165
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
166
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
167
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
168
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
169
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
170
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
else { |
173
|
0
|
|
|
|
|
|
$node->{java_helper} = $self->_get_name($node); |
174
|
0
|
|
|
|
|
|
$node->{java_Helper} = $self->_get_Helper($node) . 'Helper'; |
175
|
0
|
|
|
|
|
|
$node->{java_Holder} = $self->_get_Helper($node) . 'Holder'; |
176
|
0
|
|
|
|
|
|
$node->{java_init} = $type->{java_init}; |
177
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
178
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
179
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
180
|
|
|
|
|
|
|
} |
181
|
|
|
|
|
|
|
} |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# |
184
|
|
|
|
|
|
|
# 3.10 Constant Declaration |
185
|
|
|
|
|
|
|
# |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
sub visitConstant { |
188
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
189
|
0
|
|
|
|
|
|
my ($node) = @_; |
190
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
191
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self); |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
0
|
|
|
0
|
0
|
|
sub visitExpression { |
195
|
|
|
|
|
|
|
# empty |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
# |
199
|
|
|
|
|
|
|
# 3.11 Type Declaration |
200
|
|
|
|
|
|
|
# |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub visitTypeDeclarator { |
203
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
204
|
0
|
|
|
|
|
|
my ($node) = @_; |
205
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
206
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
207
|
0
|
|
|
|
|
|
$type->visit($self); |
208
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
209
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
210
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
211
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
212
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
213
|
|
|
|
|
|
|
# $node->{java_init} = "new java.util.Vector (0)"; |
214
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
215
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
216
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
217
|
|
|
|
|
|
|
} |
218
|
|
|
|
|
|
|
else { |
219
|
0
|
0
|
|
|
|
|
if ($type->isa('SequenceType')) { |
220
|
0
|
|
|
|
|
|
$node->{java_helper} = $self->_get_name($node); |
221
|
0
|
|
|
|
|
|
$node->{java_Helper} = $self->_get_Helper($node) . 'Helper'; |
222
|
0
|
|
|
|
|
|
$node->{java_Holder} = $self->_get_Helper($node) . 'Holder'; |
223
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
224
|
|
|
|
|
|
|
# $node->{java_init} = "new java.util.Vector (0)"; |
225
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
226
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
227
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
else { |
230
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('BasicType') |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
231
|
|
|
|
|
|
|
or $type->isa('StringType') |
232
|
|
|
|
|
|
|
or $type->isa('WideStringType') |
233
|
|
|
|
|
|
|
or $type->isa('FixedPtType') ) { |
234
|
0
|
|
|
|
|
|
$node->{java_helper} = $self->_get_name($node); |
235
|
0
|
|
|
|
|
|
$node->{java_Helper} = $self->_get_Helper($node) . 'Helper'; |
236
|
0
|
|
|
|
|
|
$node->{java_Holder} = $type->{java_Holder}; |
237
|
0
|
|
|
|
|
|
$node->{java_init} = $type->{java_init}; |
238
|
0
|
|
|
|
|
|
$node->{java_read} = $type->{java_read}; |
239
|
0
|
|
|
|
|
|
$node->{java_write} = $type->{java_write}; |
240
|
0
|
|
|
|
|
|
$node->{java_type_code} = $type->{java_type_code}; |
241
|
0
|
0
|
|
|
|
|
$node->{java_tk} = $type->{java_tk} if (exists $type->{java_tk}); |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
else { |
244
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
245
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
246
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
247
|
|
|
|
|
|
|
# $node->{java_init} = 'null'; |
248
|
0
|
|
|
|
|
|
$node->{java_init} = $type->{java_init}; |
249
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
250
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
251
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
sub visitNativeType { |
258
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
259
|
0
|
|
|
|
|
|
my ($node) = @_; |
260
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
261
|
0
|
|
|
|
|
|
$node->{java_Helper} = $self->_get_Helper($node, $self->_get_pkg($node)) . 'Helper'; |
262
|
0
|
|
|
|
|
|
$node->{java_Holder} = $self->_get_Helper($node, $self->_get_pkg($node)) . 'Holder'; |
263
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
264
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
265
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
266
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
# |
270
|
|
|
|
|
|
|
# 3.11.1 Basic Types |
271
|
|
|
|
|
|
|
# |
272
|
|
|
|
|
|
|
# See 1.4 Mapping for Basic Data Types |
273
|
|
|
|
|
|
|
# |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
sub visitIntegerType { |
276
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
277
|
0
|
|
|
|
|
|
my ($node) = @_; |
278
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'short') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
279
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.ShortHolder'; |
280
|
0
|
|
|
|
|
|
$node->{java_init} = '(short)0'; |
281
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_short ()"; |
282
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_short ("; |
283
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short)"; |
284
|
0
|
|
|
|
|
|
$node->{java_tk} = 'short'; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
elsif ($node->{value} eq 'unsigned short') { |
287
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.ShortHolder'; |
288
|
0
|
|
|
|
|
|
$node->{java_init} = '(short)0'; |
289
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_ushort ()"; |
290
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_ushort ("; |
291
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort)"; |
292
|
0
|
|
|
|
|
|
$node->{java_tk} = 'ushort'; |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
elsif ($node->{value} eq 'long') { |
295
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.IntHolder'; |
296
|
0
|
|
|
|
|
|
$node->{java_init} = '0'; |
297
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_long ()"; |
298
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_long ("; |
299
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long)"; |
300
|
0
|
|
|
|
|
|
$node->{java_tk} = 'long'; |
301
|
|
|
|
|
|
|
} |
302
|
|
|
|
|
|
|
elsif ($node->{value} eq 'unsigned long') { |
303
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.IntHolder'; |
304
|
0
|
|
|
|
|
|
$node->{java_init} = '0'; |
305
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_ulong ()"; |
306
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_ulong ("; |
307
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong)"; |
308
|
0
|
|
|
|
|
|
$node->{java_tk} = 'ulong'; |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
elsif ($node->{value} eq 'long long') { |
311
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.LongHolder'; |
312
|
0
|
|
|
|
|
|
$node->{java_init} = '(long)0'; |
313
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_longlong ()"; |
314
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_longlong ("; |
315
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong)"; |
316
|
0
|
|
|
|
|
|
$node->{java_tk} = 'longlong'; |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
elsif ($node->{value} eq 'unsigned long long') { |
319
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.LongHolder'; |
320
|
0
|
|
|
|
|
|
$node->{java_init} = '(long)0'; |
321
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_ulonglong ()"; |
322
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_ulonglong ("; |
323
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong)"; |
324
|
0
|
|
|
|
|
|
$node->{java_tk} = 'ulonglong'; |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
else { |
327
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitIntegerType $node->{value}.\n"; |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
sub visitFloatingPtType { |
332
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
333
|
0
|
|
|
|
|
|
my ($node) = @_; |
334
|
0
|
0
|
|
|
|
|
if ($node->{value} eq 'float') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
335
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.FloatHolder'; |
336
|
0
|
|
|
|
|
|
$node->{java_init} = '(float)0'; |
337
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_float ()"; |
338
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_float ("; |
339
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float)"; |
340
|
0
|
|
|
|
|
|
$node->{java_tk} = 'float'; |
341
|
|
|
|
|
|
|
} |
342
|
|
|
|
|
|
|
elsif ($node->{value} eq 'double') { |
343
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.DoubleHolder'; |
344
|
0
|
|
|
|
|
|
$node->{java_init} = '(double)0'; |
345
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_double ()"; |
346
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_double ("; |
347
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_double)"; |
348
|
0
|
|
|
|
|
|
$node->{java_tk} = 'double'; |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
elsif ($node->{value} eq 'long double') { |
351
|
0
|
|
|
|
|
|
warn __PACKAGE__," 'long double' not available at this time for Java.\n"; |
352
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.DoubleHolder'; |
353
|
0
|
|
|
|
|
|
$node->{java_init} = '(double)0'; |
354
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_double ()"; |
355
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_double ("; |
356
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_double)"; |
357
|
0
|
|
|
|
|
|
$node->{java_tk} = 'double'; |
358
|
|
|
|
|
|
|
} |
359
|
|
|
|
|
|
|
else { |
360
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitFloatingPtType $node->{value}.\n"; |
361
|
|
|
|
|
|
|
} |
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
sub visitCharType { |
365
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
366
|
0
|
|
|
|
|
|
my ($node) = @_; |
367
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.CharHolder'; |
368
|
0
|
|
|
|
|
|
$node->{java_init} = "'\\0'"; |
369
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_char ()"; |
370
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_char ("; |
371
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_char)"; |
372
|
0
|
|
|
|
|
|
$node->{java_tk} = 'char'; |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
sub visitWideCharType { |
376
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
377
|
0
|
|
|
|
|
|
my ($node) = @_; |
378
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.CharHolder'; |
379
|
0
|
|
|
|
|
|
$node->{java_init} = "'\\0'"; |
380
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_wchar ()"; |
381
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_wchar ("; |
382
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_wchar)"; |
383
|
0
|
|
|
|
|
|
$node->{java_tk} = 'wchar'; |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
sub visitBooleanType { |
387
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
388
|
0
|
|
|
|
|
|
my ($node) = @_; |
389
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.BooleanHolder'; |
390
|
0
|
|
|
|
|
|
$node->{java_init} = 'false'; |
391
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_boolean ()"; |
392
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_boolean ("; |
393
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean)"; |
394
|
0
|
|
|
|
|
|
$node->{java_tk} = 'boolean'; |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
sub visitOctetType { |
398
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
399
|
0
|
|
|
|
|
|
my ($node) = @_; |
400
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.ByteHolder'; |
401
|
0
|
|
|
|
|
|
$node->{java_init} = '(byte)0'; |
402
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_octet ()"; |
403
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_octet ("; |
404
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet)"; |
405
|
0
|
|
|
|
|
|
$node->{java_tk} = 'octet'; |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
sub visitAnyType { |
409
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
410
|
0
|
|
|
|
|
|
my ($node) = @_; |
411
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.AnyHolder'; |
412
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
413
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_any ()"; |
414
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_any ("; |
415
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any)"; |
416
|
0
|
|
|
|
|
|
$node->{java_tk} = 'any'; |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
sub visitObjectType { |
420
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
421
|
0
|
|
|
|
|
|
my ($node) = @_; |
422
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.ObjectHolder'; |
423
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
424
|
0
|
|
|
|
|
|
$node->{java_read} = "org.omg.CORBA.ObjectHelper.read (\$is)"; |
425
|
0
|
|
|
|
|
|
$node->{java_write} = "org.omg.CORBA.ObjectHelper.write (\$os, "; |
426
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref)"; |
427
|
0
|
|
|
|
|
|
$node->{java_tk} = 'objref'; |
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
sub visitValueBaseType { |
431
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
432
|
0
|
|
|
|
|
|
my ($node) = @_; |
433
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.ValueBaseHolder'; |
434
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
435
|
0
|
|
|
|
|
|
$node->{java_read} = "org.omg.CORBA.ValueBaseHelper.read (\$is)"; |
436
|
0
|
|
|
|
|
|
$node->{java_write} = "org.omg.CORBA.ValueBaseHelper.write (\$os, "; |
437
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ValueBaseHelper.type ()"; |
438
|
|
|
|
|
|
|
# $node->{java_tk} = 'objref'; |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
# |
442
|
|
|
|
|
|
|
# 3.11.2 Constructed Types |
443
|
|
|
|
|
|
|
# |
444
|
|
|
|
|
|
|
# 3.11.2.1 Structures |
445
|
|
|
|
|
|
|
# |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
sub visitStructType { |
448
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
449
|
0
|
|
|
|
|
|
my ($node) = @_; |
450
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
451
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
452
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
453
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
454
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
455
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
456
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
457
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
458
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
0
|
|
|
|
|
|
|
459
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # 'Member' |
460
|
|
|
|
|
|
|
} |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
sub visitMember { |
464
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
465
|
0
|
|
|
|
|
|
my ($node) = @_; |
466
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
467
|
0
|
|
|
|
|
|
my $array = q{}; |
468
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
469
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
0
|
|
|
|
|
|
|
470
|
0
|
|
|
|
|
|
$array .= '[]'; |
471
|
|
|
|
|
|
|
} |
472
|
|
|
|
|
|
|
} |
473
|
0
|
|
0
|
|
|
|
while ($type->isa('TypeDeclarator') and !exists($type->{array_size})) { |
474
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
475
|
|
|
|
|
|
|
} |
476
|
0
|
|
0
|
|
|
|
while ($type->isa('SequenceType') or exists ($type->{array_size})) { |
477
|
0
|
0
|
|
|
|
|
if ($type->{array_size}) { |
478
|
0
|
|
|
|
|
|
foreach (@{$type->{array_size}}) { |
|
0
|
|
|
|
|
|
|
479
|
0
|
|
|
|
|
|
$array .= '[]'; |
480
|
|
|
|
|
|
|
} |
481
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
482
|
0
|
|
0
|
|
|
|
while ($type->isa('TypeDeclarator') and !exists($type->{array_size})) { |
483
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
} |
486
|
0
|
0
|
|
|
|
|
if ($type->isa('SequenceType')) { |
487
|
0
|
|
|
|
|
|
$array .= '[]'; |
488
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
489
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) { |
490
|
0
|
0
|
|
|
|
|
if (exists $type->{array_size}) { |
491
|
0
|
|
|
|
|
|
foreach (@{$type->{array_size}}) { |
|
0
|
|
|
|
|
|
|
492
|
0
|
|
|
|
|
|
$array .= '[]'; |
493
|
|
|
|
|
|
|
} |
494
|
|
|
|
|
|
|
} |
495
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
} |
499
|
0
|
|
|
|
|
|
$type->visit($self); |
500
|
0
|
|
|
|
|
|
$node->{type_java} = $type; |
501
|
0
|
|
|
|
|
|
$node->{java_array} = $array; |
502
|
0
|
|
|
|
|
|
$node->{java_type} = $type->{java_Name} . $array; |
503
|
0
|
0
|
|
|
|
|
if (length $array) { |
504
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
else { |
507
|
0
|
|
|
|
|
|
$node->{java_init} = $type->{java_init}; |
508
|
0
|
0
|
|
|
|
|
if ($type->isa('FloatingPtType')) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
509
|
0
|
0
|
|
|
|
|
if ($type->{value} eq 'float') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
510
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Float'; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
elsif ($type->{value} eq 'double') { |
513
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Double'; |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
elsif ($type->{value} eq 'long double') { |
516
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Double'; |
517
|
|
|
|
|
|
|
} |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
elsif ($type->isa('IntegerType')) { |
520
|
0
|
0
|
|
|
|
|
if ($type->{value} eq 'short') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Short'; |
522
|
|
|
|
|
|
|
} |
523
|
|
|
|
|
|
|
elsif ($type->{value} eq 'unsigned short') { |
524
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Short'; |
525
|
|
|
|
|
|
|
} |
526
|
|
|
|
|
|
|
elsif ($type->{value} eq 'long') { |
527
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Integer'; |
528
|
|
|
|
|
|
|
} |
529
|
|
|
|
|
|
|
elsif ($type->{value} eq 'unsigned long') { |
530
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Integer'; |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
elsif ($type->{value} eq 'long long') { |
533
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Long'; |
534
|
|
|
|
|
|
|
} |
535
|
|
|
|
|
|
|
elsif ($type->{value} eq 'unsigned long long') { |
536
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Long'; |
537
|
|
|
|
|
|
|
} |
538
|
|
|
|
|
|
|
} |
539
|
|
|
|
|
|
|
elsif ($type->isa('CharType')) { |
540
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Character'; |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
elsif ($type->isa('WideCharType')) { |
543
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Character'; |
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
elsif ($type->isa('BooleanType')) { |
546
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Boolean'; |
547
|
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
|
elsif ($type->isa('OctetType')) { |
549
|
0
|
|
|
|
|
|
$node->{java_object} = 'java.lang.Byte'; |
550
|
|
|
|
|
|
|
} |
551
|
|
|
|
|
|
|
} |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions |
555
|
|
|
|
|
|
|
# |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
sub visitUnionType { |
558
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
559
|
0
|
|
|
|
|
|
my ($node) = @_; |
560
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
561
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
562
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
563
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
564
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
565
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
566
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
567
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
568
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self); |
569
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
0
|
|
|
|
|
|
|
570
|
0
|
|
|
|
|
|
$_->visit($self); # case |
571
|
|
|
|
|
|
|
} |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
sub visitCase { |
575
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
576
|
0
|
|
|
|
|
|
my ($node) = @_; |
577
|
0
|
|
|
|
|
|
foreach (@{$node->{list_label}}) { |
|
0
|
|
|
|
|
|
|
578
|
0
|
|
|
|
|
|
$_->visit($self); # default or expression |
579
|
|
|
|
|
|
|
} |
580
|
0
|
|
|
|
|
|
$node->{element}->visit($self); |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
0
|
|
|
0
|
0
|
|
sub visitDefault { |
584
|
|
|
|
|
|
|
# empty |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
sub visitElement { |
588
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
589
|
0
|
|
|
|
|
|
my ($node) = @_; |
590
|
0
|
|
|
|
|
|
$self->_get_defn($node->{value})->visit($self); # single or array |
591
|
|
|
|
|
|
|
} |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations |
594
|
|
|
|
|
|
|
# |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
sub visitEnumType { |
597
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
598
|
0
|
|
|
|
|
|
my ($node) = @_; |
599
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
600
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
601
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
602
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
603
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
604
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
605
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
606
|
|
|
|
|
|
|
} |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
# |
609
|
|
|
|
|
|
|
# 3.11.3 Template Types |
610
|
|
|
|
|
|
|
# |
611
|
|
|
|
|
|
|
# See 1.11 Mapping for Sequence Types |
612
|
|
|
|
|
|
|
# |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
sub visitSequenceType { |
615
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
616
|
0
|
|
|
|
|
|
my ($node) = @_; |
617
|
0
|
0
|
|
|
|
|
return if (exists $node->{java_Helper}); |
618
|
0
|
|
|
|
|
|
$self->_get_defn($node->{type})->visit($self); |
619
|
0
|
|
|
|
|
|
$node->{java_Helper} = $node->{java_Name} . 'Helper'; |
620
|
0
|
|
|
|
|
|
$node->{java_helper} = $node->{java_name}; |
621
|
0
|
|
|
|
|
|
$node->{java_Holder} = $node->{java_Name} . 'Holder'; |
622
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
623
|
|
|
|
|
|
|
# $node->{java_init} = "new java.util.Vector (0)"; |
624
|
0
|
|
|
|
|
|
$node->{java_read} = $node->{java_Helper} . ".read (\$is)"; |
625
|
0
|
|
|
|
|
|
$node->{java_write} = $node->{java_Helper} . ".write (\$os, "; |
626
|
0
|
|
|
|
|
|
$node->{java_type_code} = $node->{java_Helper} . ".type ()"; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
# |
630
|
|
|
|
|
|
|
# See 1.12 Mapping for Strings |
631
|
|
|
|
|
|
|
# |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
sub visitStringType { |
634
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
635
|
0
|
|
|
|
|
|
my ($node) = @_; |
636
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.StringHolder'; |
637
|
0
|
|
|
|
|
|
$node->{java_init} = "\"\""; |
638
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_string ()"; |
639
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_string ("; |
640
|
0
|
0
|
|
|
|
|
if (exists $node->{max}) { |
641
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().create_string_tc (" . $node->{max}->{java_literal} . ")"; |
642
|
|
|
|
|
|
|
} |
643
|
|
|
|
|
|
|
else { |
644
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().create_string_tc (0)"; |
645
|
|
|
|
|
|
|
} |
646
|
|
|
|
|
|
|
} |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
# |
649
|
|
|
|
|
|
|
# See 1.13 Mapping for Wide Strings |
650
|
|
|
|
|
|
|
# |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
sub visitWideStringType { |
653
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
654
|
0
|
|
|
|
|
|
my ($node) = @_; |
655
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.StringHolder'; |
656
|
0
|
|
|
|
|
|
$node->{java_init} = "\"\""; |
657
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_wstring ()"; |
658
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_wstring ("; |
659
|
0
|
0
|
|
|
|
|
if (exists $node->{max}) { |
660
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().create_string_tc (" . $node->{max}->{java_literal} . ")"; |
661
|
|
|
|
|
|
|
} |
662
|
|
|
|
|
|
|
else { |
663
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().create_wstring_tc (0)"; |
664
|
|
|
|
|
|
|
} |
665
|
|
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
# |
668
|
|
|
|
|
|
|
# See 1.14 Mapping for Fixed |
669
|
|
|
|
|
|
|
# |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
sub visitFixedPtType { |
672
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
673
|
0
|
|
|
|
|
|
my ($node) = @_; |
674
|
0
|
|
|
|
|
|
$node->{java_Holder} = 'org.omg.CORBA.FixedHolder'; |
675
|
0
|
|
|
|
|
|
$node->{java_init} = 'null'; |
676
|
0
|
|
|
|
|
|
$node->{java_read} = "\$is.read_fixed ()"; # deprecated by CORBA 2.4 |
677
|
0
|
|
|
|
|
|
$node->{java_write} = "\$os.write_fixed ("; # deprecated by CORBA 2.4 |
678
|
0
|
|
|
|
|
|
$node->{java_type_code} = "org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_fixed)"; |
679
|
|
|
|
|
|
|
} |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
sub visitFixedPtConstType { |
682
|
0
|
|
|
0
|
0
|
|
shift->visitFixedPtType(@_); |
683
|
|
|
|
|
|
|
} |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
# |
686
|
|
|
|
|
|
|
# 3.12 Exception Declaration |
687
|
|
|
|
|
|
|
# |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
sub visitException { |
690
|
0
|
|
|
0
|
0
|
|
shift->visitStructType(@_); |
691
|
|
|
|
|
|
|
} |
692
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
# |
694
|
|
|
|
|
|
|
# 3.13 Operation Declaration |
695
|
|
|
|
|
|
|
# |
696
|
|
|
|
|
|
|
# See 1.4 Inheritance and Operation Names |
697
|
|
|
|
|
|
|
# |
698
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
sub visitOperation { |
700
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
701
|
0
|
|
|
|
|
|
my ($node) = @_; |
702
|
0
|
0
|
|
|
|
|
if (exists $node->{type}) { # initializer or factory or finder |
703
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
704
|
0
|
|
|
|
|
|
$type->visit($self); |
705
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
706
|
|
|
|
|
|
|
and exists $type->{java_primitive} ) { |
707
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
708
|
|
|
|
|
|
|
} |
709
|
0
|
|
|
|
|
|
$node->{java_Type} = $type->{java_Name}; |
710
|
|
|
|
|
|
|
} |
711
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) { |
|
0
|
|
|
|
|
|
|
712
|
0
|
|
|
|
|
|
$_->visit($self); # parameter |
713
|
|
|
|
|
|
|
} |
714
|
0
|
|
|
|
|
|
$node->{java_params} = q{}; |
715
|
0
|
|
|
|
|
|
my $first = 1; |
716
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) { |
|
0
|
|
|
|
|
|
|
717
|
0
|
0
|
|
|
|
|
$node->{java_params} .= ", " unless ($first); |
718
|
0
|
|
|
|
|
|
$node->{java_params} .= $_->{java_Type}; |
719
|
0
|
|
|
|
|
|
$node->{java_params} .= " " . $_->{java_name}; |
720
|
0
|
|
|
|
|
|
$first = 0; |
721
|
|
|
|
|
|
|
} |
722
|
0
|
0
|
|
|
|
|
if (exists $node->{list_context}) { |
723
|
0
|
0
|
|
|
|
|
$node->{java_params} .= ", " unless ($first); |
724
|
0
|
|
|
|
|
|
$node->{java_params} .= "org.omg.CORBA.Context context"; |
725
|
|
|
|
|
|
|
} |
726
|
0
|
|
|
|
|
|
$node->{java_proto} = q{}; |
727
|
0
|
0
|
|
|
|
|
if (exists $node->{type}) { # initializer or factory or finder |
728
|
0
|
|
|
|
|
|
$node->{java_proto} = $node->{java_Type} . q{ }; |
729
|
|
|
|
|
|
|
} |
730
|
0
|
|
|
|
|
|
$node->{java_proto} .= $node->{java_name} . ' (' . $node->{java_params} . ')'; |
731
|
0
|
0
|
|
|
|
|
if (exists $node->{list_raise}) { |
732
|
0
|
|
|
|
|
|
$node->{java_proto} .= ' throws '; |
733
|
0
|
|
|
|
|
|
$first = 1; |
734
|
0
|
|
|
|
|
|
foreach (@{$node->{list_raise}}) { # exception |
|
0
|
|
|
|
|
|
|
735
|
0
|
|
|
|
|
|
my $defn = $self->_get_defn($_); |
736
|
0
|
0
|
|
|
|
|
$node->{java_proto} .= ', ' unless ($first); |
737
|
0
|
|
|
|
|
|
$node->{java_proto} .= $defn->{java_Name}; |
738
|
0
|
|
|
|
|
|
$first = 0; |
739
|
|
|
|
|
|
|
} |
740
|
|
|
|
|
|
|
} |
741
|
0
|
|
|
|
|
|
$node->{java_call} = $node->{java_name} . ' ('; |
742
|
0
|
|
|
|
|
|
$first = 1; |
743
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) { |
|
0
|
|
|
|
|
|
|
744
|
0
|
0
|
|
|
|
|
$node->{java_call} .= ', ' unless ($first); |
745
|
0
|
|
|
|
|
|
$node->{java_call} .= $_->{java_name}; |
746
|
0
|
|
|
|
|
|
$first = 0; |
747
|
|
|
|
|
|
|
} |
748
|
0
|
0
|
|
|
|
|
if (exists $node->{list_context}) { |
749
|
0
|
0
|
|
|
|
|
$node->{java_call} .= ', ' unless ($first); |
750
|
0
|
|
|
|
|
|
$node->{java_call} .= 'context'; |
751
|
|
|
|
|
|
|
} |
752
|
0
|
|
|
|
|
|
$node->{java_call} .= ')'; |
753
|
|
|
|
|
|
|
} |
754
|
|
|
|
|
|
|
|
755
|
|
|
|
|
|
|
sub visitParameter { |
756
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
757
|
0
|
|
|
|
|
|
my($node) = @_; |
758
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
759
|
0
|
|
|
|
|
|
$type->visit($self); |
760
|
0
|
0
|
|
|
|
|
if ($node->{attr} eq 'in') { |
761
|
0
|
|
|
|
|
|
my $array = q{}; |
762
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
763
|
|
|
|
|
|
|
and exists $type->{java_primitive} ) { |
764
|
0
|
0
|
|
|
|
|
if (exists $type->{array_size}) { |
765
|
0
|
|
|
|
|
|
foreach (@{$type->{array_size}}) { |
|
0
|
|
|
|
|
|
|
766
|
0
|
|
|
|
|
|
$array .= '[]'; |
767
|
|
|
|
|
|
|
} |
768
|
|
|
|
|
|
|
} |
769
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
770
|
|
|
|
|
|
|
} |
771
|
0
|
|
|
|
|
|
$node->{java_Type} = $type->{java_Name} . $array; |
772
|
|
|
|
|
|
|
} |
773
|
|
|
|
|
|
|
else { |
774
|
0
|
|
|
|
|
|
$node->{java_Type} = $type->{java_Holder}; |
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
} |
777
|
|
|
|
|
|
|
|
778
|
0
|
|
|
0
|
0
|
|
sub visitVoidType { |
779
|
|
|
|
|
|
|
# empty |
780
|
|
|
|
|
|
|
} |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
# |
783
|
|
|
|
|
|
|
# 3.14 Attribute Declaration |
784
|
|
|
|
|
|
|
# |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
sub visitAttribute { |
787
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
788
|
0
|
|
|
|
|
|
my ($node) = @_; |
789
|
0
|
|
|
|
|
|
$node->{_get}->visit($self); |
790
|
0
|
0
|
|
|
|
|
$node->{_set}->visit($self) if (exists $node->{_set}); |
791
|
|
|
|
|
|
|
} |
792
|
|
|
|
|
|
|
|
793
|
|
|
|
|
|
|
# |
794
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations |
795
|
|
|
|
|
|
|
# |
796
|
|
|
|
|
|
|
|
797
|
0
|
|
|
0
|
0
|
|
sub visitTypeId { |
798
|
|
|
|
|
|
|
# empty |
799
|
|
|
|
|
|
|
} |
800
|
|
|
|
|
|
|
|
801
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix { |
802
|
|
|
|
|
|
|
# empty |
803
|
|
|
|
|
|
|
} |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
# |
806
|
|
|
|
|
|
|
# 3.16 Event Declaration |
807
|
|
|
|
|
|
|
# |
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
# |
810
|
|
|
|
|
|
|
# 3.17 Component Declaration |
811
|
|
|
|
|
|
|
# |
812
|
|
|
|
|
|
|
|
813
|
0
|
|
|
0
|
0
|
|
sub visitProvides { |
814
|
|
|
|
|
|
|
# empty |
815
|
|
|
|
|
|
|
} |
816
|
|
|
|
|
|
|
|
817
|
0
|
|
|
0
|
0
|
|
sub visitUses { |
818
|
|
|
|
|
|
|
# empty |
819
|
|
|
|
|
|
|
} |
820
|
|
|
|
|
|
|
|
821
|
0
|
|
|
0
|
0
|
|
sub visitPublishes { |
822
|
|
|
|
|
|
|
# empty |
823
|
|
|
|
|
|
|
} |
824
|
|
|
|
|
|
|
|
825
|
0
|
|
|
0
|
0
|
|
sub visitEmits { |
826
|
|
|
|
|
|
|
# empty |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
|
829
|
0
|
|
|
0
|
0
|
|
sub visitConsumes { |
830
|
|
|
|
|
|
|
# empty |
831
|
|
|
|
|
|
|
} |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
# |
834
|
|
|
|
|
|
|
# 3.18 Home Declaration |
835
|
|
|
|
|
|
|
# |
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
sub visitFactory { |
838
|
0
|
|
|
0
|
0
|
|
shift->visitOperation(@_); |
839
|
|
|
|
|
|
|
} |
840
|
|
|
|
|
|
|
|
841
|
|
|
|
|
|
|
sub visitFinder { |
842
|
0
|
|
|
0
|
0
|
|
shift->visitOperation(@_); |
843
|
|
|
|
|
|
|
} |
844
|
|
|
|
|
|
|
|
845
|
|
|
|
|
|
|
1; |
846
|
|
|
|
|
|
|
|