| 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::ClassVisitor; |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
10
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '2.63'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1597
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
13287
|
|
|
|
1
|
|
|
|
|
74
|
|
|
16
|
1
|
|
|
1
|
|
1019
|
use Digest::SHA1 qw(sha1_hex); |
|
|
1
|
|
|
|
|
49919
|
|
|
|
1
|
|
|
|
|
112
|
|
|
17
|
1
|
|
|
1
|
|
13
|
use File::Basename; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
98
|
|
|
18
|
1
|
|
|
1
|
|
6
|
use File::Path; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
65
|
|
|
19
|
1
|
|
|
1
|
|
940
|
use POSIX qw(ctime); |
|
|
1
|
|
|
|
|
9876
|
|
|
|
1
|
|
|
|
|
12
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# needs $node->{java_name} (JavaNameVisitor), $node->{java_literal} (JavaLiteralVisitor) |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
|
24
|
0
|
|
|
0
|
0
|
|
my $proto = shift; |
|
25
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
|
26
|
0
|
|
|
|
|
|
my $self = {}; |
|
27
|
0
|
|
|
|
|
|
bless $self, $class; |
|
28
|
0
|
|
|
|
|
|
my ($parser) = @_; |
|
29
|
0
|
|
|
|
|
|
$self->{srcname} = $parser->YYData->{srcname}; |
|
30
|
0
|
|
|
|
|
|
$self->{srcname_size} = $parser->YYData->{srcname_size}; |
|
31
|
0
|
|
|
|
|
|
$self->{srcname_mtime} = $parser->YYData->{srcname_mtime}; |
|
32
|
0
|
|
|
|
|
|
$self->{symbtab} = $parser->YYData->{symbtab}; |
|
33
|
0
|
|
|
|
|
|
$self->{done_hash} = {}; |
|
34
|
0
|
|
|
|
|
|
$self->{num_key} = 'num_java'; |
|
35
|
0
|
|
|
|
|
|
$self->{toString} = 1; |
|
36
|
0
|
|
|
|
|
|
$self->{equals} = 1; |
|
37
|
0
|
|
|
|
|
|
return $self; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub open_stream { |
|
41
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
42
|
0
|
|
|
|
|
|
my ($node, $suffix) = @_; |
|
43
|
0
|
|
|
|
|
|
my $filename; |
|
44
|
0
|
|
|
|
|
|
my $prefix = q{}; |
|
45
|
0
|
0
|
|
|
|
|
$prefix = '_' if ($suffix =~ /^Stub/); |
|
46
|
0
|
|
|
|
|
|
my $dirname = $node->{java_package}; |
|
47
|
0
|
0
|
|
|
|
|
if ($dirname) { |
|
48
|
0
|
|
|
|
|
|
$dirname =~ s/\./\//g; |
|
49
|
0
|
0
|
|
|
|
|
unless (-d $dirname) { |
|
50
|
0
|
0
|
|
|
|
|
mkpath($dirname) |
|
51
|
|
|
|
|
|
|
or die "can't create $dirname ($!).\n"; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
0
|
|
|
|
|
|
$filename = $dirname . '/' . $prefix . $node->{java_helper} . $suffix; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
else { |
|
56
|
0
|
|
|
|
|
|
$filename = $prefix . $node->{java_helper} . $suffix; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
0
|
0
|
|
|
|
|
open $self->{out}, '>', $filename |
|
59
|
|
|
|
|
|
|
or die "can't open $filename ($!).\n",caller(),"\n"; |
|
60
|
0
|
|
|
|
|
|
$self->{filename} = $filename; |
|
61
|
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
63
|
0
|
|
|
|
|
|
print $FH "/* ex: set ro: */\n"; |
|
64
|
0
|
0
|
|
|
|
|
print $FH "package ",$node->{java_package},";\n" |
|
65
|
|
|
|
|
|
|
if ($node->{java_package}); |
|
66
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
67
|
0
|
|
|
|
|
|
print $FH "/**\n"; |
|
68
|
0
|
|
|
|
|
|
print $FH " * ",$self->{filename},"\n"; |
|
69
|
0
|
|
|
|
|
|
print $FH " * This file was generated (by ",basename($0),"). DO NOT modify it\n"; |
|
70
|
0
|
|
|
|
|
|
print $FH " * from file : ",$self->{srcname},", ",$self->{srcname_size}," octets, ",POSIX::ctime($self->{srcname_mtime}); |
|
71
|
0
|
|
|
|
|
|
print $FH " */\n"; |
|
72
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _no_mapping { |
|
76
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
77
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
78
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
79
|
0
|
|
|
|
|
|
my $class = ref $node; |
|
80
|
0
|
|
|
|
|
|
$class = substr $class, rindex($class, ':') + 1; |
|
81
|
0
|
0
|
|
|
|
|
if ($class =~ /^Forward/) { |
|
82
|
0
|
|
|
|
|
|
$node = $self->{symbtab}->Lookup($node->{full}); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
85
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
86
|
0
|
|
|
|
|
|
print $FH "/* no mapping for ",$node->{java_name}," (",ref $node,")*/\n"; |
|
87
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _get_defn { |
|
91
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
92
|
0
|
|
|
|
|
|
my ($defn) = @_; |
|
93
|
0
|
0
|
|
|
|
|
if (ref $defn) { |
|
94
|
0
|
|
|
|
|
|
return $defn; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
else { |
|
97
|
0
|
|
|
|
|
|
return $self->{symbtab}->Lookup($defn); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub _format_javadoc { |
|
102
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
103
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
104
|
0
|
0
|
|
|
|
|
return q{} unless ($node->{doc}); |
|
105
|
0
|
|
|
|
|
|
my $str = "\n/**\n"; |
|
106
|
0
|
|
|
|
|
|
foreach (split /\n/, $node->{doc}) { |
|
107
|
0
|
|
|
|
|
|
s/^\s+//; |
|
108
|
0
|
0
|
|
|
|
|
next unless ($_); |
|
109
|
0
|
|
|
|
|
|
$str .= " * " . $_ . "\n"; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
0
|
|
|
|
|
|
$str .= " */\n"; |
|
112
|
0
|
|
|
|
|
|
return $str; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub _holder { |
|
116
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
117
|
0
|
|
|
|
|
|
my ($node, $type, @array) = @_; |
|
118
|
0
|
0
|
|
|
|
|
$type = $node unless ($type); |
|
119
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Holder.java'); |
|
120
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
121
|
0
|
|
|
|
|
|
print $FH "public final class ",$node->{java_helper},"Holder implements org.omg.CORBA.portable.Streamable\n"; |
|
122
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
123
|
0
|
|
|
|
|
|
print $FH " public ",$type->{java_Name},@array," value;\n"; |
|
124
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
125
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_helper},"Holder ()\n"; |
|
126
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
127
|
0
|
0
|
|
|
|
|
if (scalar(@array)) { |
|
128
|
0
|
|
|
|
|
|
print $FH " value = null;\n"; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
else { |
|
131
|
0
|
|
|
|
|
|
print $FH " value = ",$type->{java_init},";\n"; |
|
132
|
|
|
|
|
|
|
} |
|
133
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
134
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
135
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_helper},"Holder (",$type->{java_Name},@array," initialValue)\n"; |
|
136
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
137
|
0
|
|
|
|
|
|
print $FH " value = initialValue;\n"; |
|
138
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
139
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
140
|
0
|
|
|
|
|
|
print $FH " public void _read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
141
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
142
|
0
|
|
|
|
|
|
print $FH " value = ",$node->{java_read},";\n"; |
|
143
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
144
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
145
|
0
|
|
|
|
|
|
print $FH " public void _write (org.omg.CORBA.portable.OutputStream \$os)\n"; |
|
146
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
147
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_write},"value);\n"; |
|
148
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
149
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
150
|
0
|
|
|
|
|
|
print $FH " public org.omg.CORBA.TypeCode _type ()\n"; |
|
151
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
152
|
0
|
|
|
|
|
|
print $FH " return ",$node->{java_Helper},".type ();\n"; |
|
153
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
154
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
155
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
156
|
0
|
|
|
|
|
|
close $FH; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# |
|
160
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification |
|
161
|
|
|
|
|
|
|
# |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub visitSpecification { |
|
164
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
165
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
166
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
167
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
# |
|
172
|
|
|
|
|
|
|
# 3.7 Module Declaration |
|
173
|
|
|
|
|
|
|
# |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub visitModules { |
|
176
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
177
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
178
|
0
|
0
|
|
|
|
|
unless (exists $node->{$self->{num_key}}) { |
|
179
|
0
|
|
|
|
|
|
$node->{$self->{num_key}} = 0; |
|
180
|
|
|
|
|
|
|
} |
|
181
|
0
|
|
|
|
|
|
my $module = ${$node->{list_decl}}[$node->{$self->{num_key}}]; |
|
|
0
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
|
$module->visit($self); |
|
183
|
0
|
|
|
|
|
|
$node->{$self->{num_key}} ++; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
sub visitModule { |
|
187
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
188
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
189
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
|
191
|
|
|
|
|
|
|
} |
|
192
|
|
|
|
|
|
|
} |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
# |
|
195
|
|
|
|
|
|
|
# 3.8 Interface Declaration |
|
196
|
|
|
|
|
|
|
# |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub _interface_helper { |
|
199
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
200
|
|
|
|
|
|
|
|
|
201
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
202
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
203
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
204
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
205
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
206
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
207
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
208
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
209
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
210
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
211
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
212
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
213
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
214
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
215
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
216
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
217
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
218
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
219
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
220
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
221
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
222
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
223
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
224
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
225
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
226
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
227
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
228
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
229
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
230
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
231
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
232
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
233
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
234
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
235
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (_id, \"",$node->{java_name},"\");\n"; |
|
236
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
237
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
238
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
239
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
240
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
241
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
242
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
243
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
244
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
245
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
246
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
247
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
248
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
249
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
250
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
251
|
0
|
|
|
|
|
|
print $FH " return narrow (((org.omg.CORBA_2_3.portable.InputStream)\$is).read_abstract_interface (_",$node->{java_name},"Stub.class));\n"; |
|
252
|
|
|
|
|
|
|
} |
|
253
|
|
|
|
|
|
|
else { |
|
254
|
0
|
|
|
|
|
|
print $FH " return narrow (\$is.read_Object (_",$node->{java_name},"Stub.class));\n"; |
|
255
|
|
|
|
|
|
|
} |
|
256
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
257
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
258
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
259
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
260
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
261
|
0
|
|
|
|
|
|
print $FH " ((org.omg.CORBA_2_3.portable.OutputStream)\$os).write_abstract_interface ((java.lang.Object)value);\n"; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
else { |
|
264
|
0
|
|
|
|
|
|
print $FH " \$os.write_Object ((org.omg.CORBA.Object)value);\n"; |
|
265
|
|
|
|
|
|
|
} |
|
266
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
267
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
268
|
0
|
0
|
0
|
|
|
|
if ($node->isa('RegularInterface') and exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) { |
|
|
|
|
0
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
my $has_abstract = 0; |
|
270
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_interface}}) { |
|
|
0
|
|
|
|
|
|
|
|
271
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
272
|
0
|
0
|
|
|
|
|
$has_abstract = 1 if ($base->isa('AbstractInterface')); |
|
273
|
|
|
|
|
|
|
} |
|
274
|
0
|
0
|
|
|
|
|
if ($has_abstract) { |
|
275
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," narrow (java.lang.Object obj)\n"; |
|
276
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
277
|
0
|
|
|
|
|
|
print $FH " if (obj == null)\n"; |
|
278
|
0
|
|
|
|
|
|
print $FH " return null;\n"; |
|
279
|
0
|
|
|
|
|
|
print $FH " else if (obj instanceof org.omg.CORBA.Object)\n"; |
|
280
|
0
|
|
|
|
|
|
print $FH " return _narrow ((org.omg.CORBA.Object)obj, false);\n"; |
|
281
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
282
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
283
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
284
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," unchecked_narrow (java.lang.Object obj)\n"; |
|
285
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
286
|
0
|
|
|
|
|
|
print $FH " if (obj == null)\n"; |
|
287
|
0
|
|
|
|
|
|
print $FH " return null;\n"; |
|
288
|
0
|
|
|
|
|
|
print $FH " else if (obj instanceof org.omg.CORBA.Object)\n"; |
|
289
|
0
|
|
|
|
|
|
print $FH " return _narrow ((org.omg.CORBA.Object)obj, true);\n"; |
|
290
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
291
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
292
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
293
|
|
|
|
|
|
|
} |
|
294
|
|
|
|
|
|
|
} |
|
295
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
296
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," narrow (java.lang.Object obj)\n"; |
|
297
|
|
|
|
|
|
|
} |
|
298
|
|
|
|
|
|
|
else { |
|
299
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," narrow (org.omg.CORBA.Object obj)\n"; |
|
300
|
|
|
|
|
|
|
} |
|
301
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
302
|
0
|
|
|
|
|
|
print $FH " return _narrow(obj, false);\n"; |
|
303
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
304
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
305
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
306
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," unchecked_narrow (java.lang.Object obj)\n"; |
|
307
|
|
|
|
|
|
|
} |
|
308
|
|
|
|
|
|
|
else { |
|
309
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," unchecked_narrow (org.omg.CORBA.Object obj)\n"; |
|
310
|
|
|
|
|
|
|
} |
|
311
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
312
|
0
|
|
|
|
|
|
print $FH " return _narrow(obj, true);\n"; |
|
313
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
314
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
315
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
316
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," _narrow (java.lang.Object obj, boolean is_a)\n"; |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
else { |
|
319
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," _narrow (org.omg.CORBA.Object obj, boolean is_a)\n"; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
322
|
0
|
|
|
|
|
|
print $FH " if (obj == null)\n"; |
|
323
|
0
|
|
|
|
|
|
print $FH " return null;\n"; |
|
324
|
0
|
|
|
|
|
|
print $FH " else if (obj instanceof ",$node->{java_Name},")\n"; |
|
325
|
0
|
|
|
|
|
|
print $FH " return (",$node->{java_Name},")obj;\n"; |
|
326
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
327
|
0
|
|
|
|
|
|
print $FH " else if ((obj instanceof org.omg.CORBA.portable.ObjectImpl) &&\n"; |
|
328
|
0
|
|
|
|
|
|
print $FH " (is_a || ((org.omg.CORBA.Object)obj)._is_a (id ())))\n"; |
|
329
|
|
|
|
|
|
|
} |
|
330
|
|
|
|
|
|
|
else { |
|
331
|
0
|
|
|
|
|
|
print $FH " else if (is_a || obj._is_a (id ()))\n"; |
|
332
|
|
|
|
|
|
|
} |
|
333
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
334
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj;\n"; |
|
335
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.Delegate delegate = impl._get_delegate ();\n"; |
|
336
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_stub}," stub = new ",$node->{java_stub}," ();\n"; |
|
337
|
0
|
|
|
|
|
|
print $FH " stub._set_delegate (delegate);\n"; |
|
338
|
0
|
|
|
|
|
|
print $FH " return stub;\n"; |
|
339
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
340
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
341
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
342
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
343
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
344
|
0
|
|
|
|
|
|
close $FH; |
|
345
|
|
|
|
|
|
|
} |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
sub _interface { |
|
348
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
349
|
|
|
|
|
|
|
|
|
350
|
0
|
|
|
|
|
|
$self->{constants} = q{}; |
|
351
|
0
|
|
|
|
|
|
$self->{methodes} = q{}; |
|
352
|
0
|
|
|
|
|
|
$self->{stub} = q{}; |
|
353
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
354
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
|
355
|
|
|
|
|
|
|
} |
|
356
|
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
358
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
359
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
360
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) { |
|
361
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name}," extends "; |
|
362
|
0
|
|
|
|
|
|
my $first = 1; |
|
363
|
0
|
0
|
|
|
|
|
unless ($node->isa('AbstractInterface')) { |
|
364
|
0
|
|
|
|
|
|
print $FH $node->{java_name},"Operations"; |
|
365
|
0
|
|
|
|
|
|
$first = 0; |
|
366
|
|
|
|
|
|
|
} |
|
367
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_interface}}) { |
|
|
0
|
|
|
|
|
|
|
|
368
|
0
|
0
|
|
|
|
|
print $FH ", " unless ($first); |
|
369
|
0
|
|
|
|
|
|
print $FH $self->_get_defn($_)->{java_Name}; |
|
370
|
0
|
|
|
|
|
|
$first = 0; |
|
371
|
|
|
|
|
|
|
} |
|
372
|
0
|
0
|
|
|
|
|
print $FH ", " unless ($first); |
|
373
|
0
|
|
|
|
|
|
print $FH "org.omg.CORBA.portable.IDLEntity\n"; |
|
374
|
|
|
|
|
|
|
} |
|
375
|
|
|
|
|
|
|
else { |
|
376
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractInterface')) { |
|
|
|
0
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name}," extends org.omg.CORBA.portable.IDLEntity\n"; |
|
378
|
|
|
|
|
|
|
} |
|
379
|
|
|
|
|
|
|
elsif ($node->isa('LocalInterface')) { |
|
380
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name}," extends ",$node->{java_name},"Operations, org.omg.CORBA.LocalInterface, org.omg.CORBA.portable.IDLEntity\n"; |
|
381
|
|
|
|
|
|
|
} |
|
382
|
|
|
|
|
|
|
else { |
|
383
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name}," extends ",$node->{java_name},"Operations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity\n"; |
|
384
|
|
|
|
|
|
|
} |
|
385
|
|
|
|
|
|
|
} |
|
386
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
387
|
0
|
|
|
|
|
|
print $FH $self->{constants}; |
|
388
|
0
|
0
|
|
|
|
|
print $FH $self->{methodes} if ($node->isa('AbstractInterface')); |
|
389
|
0
|
|
|
|
|
|
print $FH "} // interface ",$node->{java_name},"\n"; |
|
390
|
0
|
|
|
|
|
|
close $FH; |
|
391
|
|
|
|
|
|
|
|
|
392
|
0
|
|
|
|
|
|
delete $self->{constants}; |
|
393
|
0
|
|
|
|
|
|
delete $self->{methodes}; |
|
394
|
0
|
|
|
|
|
|
delete $self->{stub}; |
|
395
|
|
|
|
|
|
|
} |
|
396
|
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
sub _interface_operations { |
|
398
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
399
|
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
|
$self->{methodes} = q{}; |
|
401
|
0
|
|
|
|
|
|
$self->{stub} = q{}; |
|
402
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
403
|
0
|
|
|
|
|
|
my $defn = $self->_get_defn($_); |
|
404
|
0
|
0
|
0
|
|
|
|
if ( $defn->isa('Operation') |
|
405
|
|
|
|
|
|
|
or $defn->isa('Attributes') ) { |
|
406
|
0
|
|
|
|
|
|
$defn->visit($self); |
|
407
|
|
|
|
|
|
|
} |
|
408
|
|
|
|
|
|
|
} |
|
409
|
|
|
|
|
|
|
|
|
410
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Operations.java'); |
|
411
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
412
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) { |
|
413
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name},"Operations extends "; |
|
414
|
0
|
|
|
|
|
|
my $first = 1; |
|
415
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_interface}}) { |
|
|
0
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
417
|
0
|
0
|
|
|
|
|
print $FH ", " unless ($first); |
|
418
|
0
|
0
|
|
|
|
|
if ($base->isa('AbstractInterface')) { |
|
419
|
0
|
|
|
|
|
|
print $FH $base->{java_Name}; |
|
420
|
|
|
|
|
|
|
} |
|
421
|
|
|
|
|
|
|
else { |
|
422
|
0
|
|
|
|
|
|
print $FH $base->{java_Name},"Operations"; |
|
423
|
|
|
|
|
|
|
} |
|
424
|
0
|
|
|
|
|
|
$first = 0; |
|
425
|
|
|
|
|
|
|
} |
|
426
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
427
|
|
|
|
|
|
|
} |
|
428
|
|
|
|
|
|
|
else { |
|
429
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name},"Operations\n"; |
|
430
|
|
|
|
|
|
|
} |
|
431
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
432
|
0
|
|
|
|
|
|
print $FH $self->{methodes}; |
|
433
|
0
|
|
|
|
|
|
print $FH "} // interface ",$node->{java_name},"Operations\n"; |
|
434
|
0
|
|
|
|
|
|
close $FH; |
|
435
|
|
|
|
|
|
|
|
|
436
|
0
|
|
|
|
|
|
delete $self->{methodes}; |
|
437
|
0
|
|
|
|
|
|
delete $self->{stub}; |
|
438
|
|
|
|
|
|
|
} |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
sub _interface_stub { |
|
441
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
442
|
|
|
|
|
|
|
|
|
443
|
0
|
|
|
|
|
|
$self->{methodes} = q{}; |
|
444
|
0
|
|
|
|
|
|
$self->{stub} = q{}; |
|
445
|
0
|
|
|
|
|
|
foreach (values %{$node->{hash_attribute_operation}}) { |
|
|
0
|
|
|
|
|
|
|
|
446
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
|
447
|
|
|
|
|
|
|
} |
|
448
|
|
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Stub.java'); |
|
450
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
451
|
0
|
|
|
|
|
|
print $FH "public class _",$node->{java_name},"Stub extends org.omg.CORBA.portable.ObjectImpl implements ",$node->{java_Name},"\n"; |
|
452
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
453
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
454
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
455
|
|
|
|
|
|
|
} |
|
456
|
|
|
|
|
|
|
else { |
|
457
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
458
|
|
|
|
|
|
|
} |
|
459
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
460
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
461
|
0
|
|
|
|
|
|
print $FH $self->{stub}; |
|
462
|
0
|
|
|
|
|
|
print $FH " // Type-specific CORBA::Object operations\n"; |
|
463
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String[] __ids = {\n"; |
|
464
|
0
|
|
|
|
|
|
print $FH " \"",$node->{repos_id},"\""; |
|
465
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) { |
|
466
|
0
|
|
|
|
|
|
foreach (sort keys %{$node->{inheritance}->{hash_interface}}) { |
|
|
0
|
|
|
|
|
|
|
|
467
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
468
|
0
|
|
|
|
|
|
print $FH ",\n"; |
|
469
|
0
|
|
|
|
|
|
print $FH " \"",$base->{repos_id},"\""; |
|
470
|
|
|
|
|
|
|
} |
|
471
|
|
|
|
|
|
|
} |
|
472
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
473
|
0
|
|
|
|
|
|
print $FH " };\n"; |
|
474
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
475
|
0
|
|
|
|
|
|
print $FH " public java.lang.String[] _ids ()\n"; |
|
476
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
477
|
0
|
|
|
|
|
|
print $FH " return (java.lang.String[])__ids.clone ();\n"; |
|
478
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
479
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
480
|
0
|
|
|
|
|
|
print $FH " private void readObject (java.io.ObjectInputStream s) throws java.io.IOException\n"; |
|
481
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
482
|
0
|
|
|
|
|
|
print $FH " java.lang.String str = s.readUTF ();\n"; |
|
483
|
0
|
|
|
|
|
|
print $FH " java.lang.String[] args = null;\n"; |
|
484
|
0
|
|
|
|
|
|
print $FH " java.util.Properties props = null;\n"; |
|
485
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);\n"; |
|
486
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();\n"; |
|
487
|
0
|
|
|
|
|
|
print $FH " _set_delegate (delegate);\n"; |
|
488
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
489
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
490
|
0
|
|
|
|
|
|
print $FH " private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException\n"; |
|
491
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
492
|
0
|
|
|
|
|
|
print $FH " java.lang.String[] args = null;\n"; |
|
493
|
0
|
|
|
|
|
|
print $FH " java.util.Properties props = null;\n"; |
|
494
|
0
|
|
|
|
|
|
print $FH " java.lang.String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);\n"; |
|
495
|
0
|
|
|
|
|
|
print $FH " s.writeUTF (str);\n"; |
|
496
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
497
|
0
|
|
|
|
|
|
print $FH "} // class _",$node->{java_name},"Stub\n"; |
|
498
|
0
|
|
|
|
|
|
close $FH; |
|
499
|
|
|
|
|
|
|
|
|
500
|
0
|
|
|
|
|
|
delete $self->{methodes}; |
|
501
|
0
|
|
|
|
|
|
delete $self->{stub}; |
|
502
|
|
|
|
|
|
|
} |
|
503
|
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
sub visitRegularInterface { |
|
505
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
506
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
507
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
508
|
|
|
|
|
|
|
|
|
509
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
510
|
0
|
|
|
|
|
|
$self->_interface_helper($node); |
|
511
|
0
|
|
|
|
|
|
$self->_interface($node); |
|
512
|
0
|
|
|
|
|
|
$self->_interface_operations($node); |
|
513
|
0
|
|
|
|
|
|
$self->_interface_stub($node); |
|
514
|
0
|
0
|
|
|
|
|
$self->_interface_helperXML($node) if ($self->can('_interface_helperXML')); |
|
515
|
0
|
0
|
|
|
|
|
$self->_interface_stubXML($node) if ($self->can('_interface_stubXML')); |
|
516
|
|
|
|
|
|
|
} |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
sub visitAbstractInterface { |
|
519
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
520
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
521
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
522
|
|
|
|
|
|
|
|
|
523
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
524
|
0
|
|
|
|
|
|
$self->_interface_helper($node); |
|
525
|
0
|
|
|
|
|
|
$self->_interface($node); |
|
526
|
0
|
|
|
|
|
|
$self->_interface_stub($node); |
|
527
|
0
|
0
|
|
|
|
|
$self->_interface_helperXML($node) if ($self->can('_interface_helperXML')); |
|
528
|
0
|
0
|
|
|
|
|
$self->_interface_stubXML($node) if ($self->can('_interface_stubXML')); |
|
529
|
|
|
|
|
|
|
} |
|
530
|
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
sub visitLocalInterface { |
|
532
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
533
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
534
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
535
|
|
|
|
|
|
|
|
|
536
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
537
|
0
|
|
|
|
|
|
$self->_interface_helper($node); |
|
538
|
0
|
|
|
|
|
|
$self->_interface($node); |
|
539
|
0
|
|
|
|
|
|
$self->_interface_operations($node); |
|
540
|
0
|
|
|
|
|
|
$self->_interface_stub($node); |
|
541
|
|
|
|
|
|
|
} |
|
542
|
|
|
|
|
|
|
|
|
543
|
0
|
|
|
0
|
0
|
|
sub visitForwardBaseInterface { |
|
544
|
|
|
|
|
|
|
# empty |
|
545
|
|
|
|
|
|
|
} |
|
546
|
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
# |
|
548
|
|
|
|
|
|
|
# 3.9 Value Declaration |
|
549
|
|
|
|
|
|
|
# |
|
550
|
|
|
|
|
|
|
# 3.9.1 Regular Value Type |
|
551
|
|
|
|
|
|
|
# |
|
552
|
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
sub _value_helper { |
|
554
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
555
|
|
|
|
|
|
|
|
|
556
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
557
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
558
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
559
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
560
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
561
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
562
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
563
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
564
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
565
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
566
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
567
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
568
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
569
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
570
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
571
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
572
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
573
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
574
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
575
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
576
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
577
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
578
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
579
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
580
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
581
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
582
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
583
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
584
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
585
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
586
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
587
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
588
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
589
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
590
|
0
|
0
|
|
|
|
|
if (exists $node->{list_member}) { |
|
591
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.ValueMember[] _members0 = new org.omg.CORBA.ValueMember [",scalar(@{$node->{list_member}}),"];\n"; |
|
|
0
|
|
|
|
|
|
|
|
592
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.TypeCode _tcOf_members0 = null;\n"; |
|
593
|
0
|
|
|
|
|
|
my $i = 0; |
|
594
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { # StateMember |
|
|
0
|
|
|
|
|
|
|
|
595
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
596
|
0
|
|
|
|
|
|
print $FH " // ValueMember instance for ",$member->{java_name},"\n"; |
|
597
|
0
|
|
|
|
|
|
$self->_member_helper_type($member, $node, $i); |
|
598
|
0
|
|
|
|
|
|
$i ++; |
|
599
|
|
|
|
|
|
|
} |
|
600
|
|
|
|
|
|
|
} |
|
601
|
|
|
|
|
|
|
else { |
|
602
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.ValueMember[] _members0 = new org.omg.CORBA.ValueMember [0];\n"; |
|
603
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.TypeCode _tcOf_members0 = null;\n"; |
|
604
|
|
|
|
|
|
|
} |
|
605
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractValue')) { |
|
606
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_value_tc (_id, \"",$node->{java_name},"\", org.omg.CORBA.VM_ABSTRACT.value, null, _members0);\n"; |
|
607
|
|
|
|
|
|
|
} |
|
608
|
|
|
|
|
|
|
else { |
|
609
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_value_tc (_id, \"",$node->{java_name},"\", org.omg.CORBA.VM_NONE.value, null, _members0);\n"; |
|
610
|
|
|
|
|
|
|
} |
|
611
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
612
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
613
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
614
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
615
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
616
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
617
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
618
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
619
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
620
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
621
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
622
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
623
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
624
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
625
|
0
|
|
|
|
|
|
print $FH " return (",$node->{java_Name},")((org.omg.CORBA_2_3.portable.InputStream)\$is).read_value (id ());\n"; |
|
626
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
627
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
628
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
629
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
630
|
0
|
|
|
|
|
|
print $FH " ((org.omg.CORBA_2_3.portable.OutputStream)\$os).write_value (value, id ());\n"; |
|
631
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
632
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
633
|
0
|
|
|
|
|
|
print $FH $self->{factory}; |
|
634
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
635
|
0
|
|
|
|
|
|
close $FH; |
|
636
|
|
|
|
|
|
|
} |
|
637
|
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
sub _value { |
|
639
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
640
|
|
|
|
|
|
|
|
|
641
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
642
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
643
|
|
|
|
|
|
|
|
|
644
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
645
|
0
|
|
|
|
|
|
my $super; |
|
646
|
0
|
0
|
|
|
|
|
if ($node->isa('AbstractValue')) { |
|
647
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name}," extends org.omg.CORBA.portable.ValueBase"; |
|
648
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_value}) { |
|
649
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_value}}) { |
|
|
0
|
|
|
|
|
|
|
|
650
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
651
|
0
|
|
|
|
|
|
print $FH ", ",$base->{java_Name}; |
|
652
|
|
|
|
|
|
|
} |
|
653
|
|
|
|
|
|
|
} |
|
654
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) { |
|
655
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_interface}}) { |
|
|
0
|
|
|
|
|
|
|
|
656
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
657
|
0
|
|
|
|
|
|
print $FH ", ",$base->{java_Name},"Operations"; |
|
658
|
|
|
|
|
|
|
} |
|
659
|
|
|
|
|
|
|
} |
|
660
|
|
|
|
|
|
|
} |
|
661
|
|
|
|
|
|
|
else { |
|
662
|
0
|
|
|
|
|
|
print $FH "public abstract class ",$node->{java_name}; |
|
663
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_value}) { |
|
664
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_value}}) { |
|
|
0
|
|
|
|
|
|
|
|
665
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
666
|
0
|
0
|
|
|
|
|
next unless ($base->isa('RegularValue')); |
|
667
|
0
|
|
|
|
|
|
print $FH " extends ",$base->{java_Name}; |
|
668
|
0
|
|
|
|
|
|
$super = 1; |
|
669
|
0
|
|
|
|
|
|
last; |
|
670
|
|
|
|
|
|
|
} |
|
671
|
|
|
|
|
|
|
} |
|
672
|
0
|
0
|
|
|
|
|
if (exists $node->{modifier}) { # custom |
|
673
|
0
|
|
|
|
|
|
print $FH " implements org.omg.CORBA.portable.CustomValue"; |
|
674
|
|
|
|
|
|
|
} |
|
675
|
|
|
|
|
|
|
else { |
|
676
|
0
|
|
|
|
|
|
print $FH " implements org.omg.CORBA.portable.StreamableValue"; |
|
677
|
|
|
|
|
|
|
} |
|
678
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_value}) { |
|
679
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_value}}) { |
|
|
0
|
|
|
|
|
|
|
|
680
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
681
|
0
|
0
|
|
|
|
|
next unless ($base->isa('AbstractValue')); |
|
682
|
0
|
|
|
|
|
|
print $FH ", ",$base->{java_Name}; |
|
683
|
|
|
|
|
|
|
} |
|
684
|
|
|
|
|
|
|
} |
|
685
|
0
|
0
|
0
|
|
|
|
if (exists $node->{inheritance} and exists $node->{inheritance}->{list_interface}) { |
|
686
|
0
|
|
|
|
|
|
foreach (@{$node->{inheritance}->{list_interface}}) { |
|
|
0
|
|
|
|
|
|
|
|
687
|
0
|
|
|
|
|
|
my $base = $self->_get_defn($_); |
|
688
|
0
|
|
|
|
|
|
print $FH ", ",$base->{java_Name},"Operations"; |
|
689
|
|
|
|
|
|
|
} |
|
690
|
|
|
|
|
|
|
} |
|
691
|
|
|
|
|
|
|
} |
|
692
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
693
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
694
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
695
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
696
|
|
|
|
|
|
|
} |
|
697
|
|
|
|
|
|
|
else { |
|
698
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
699
|
|
|
|
|
|
|
} |
|
700
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
701
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
702
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
703
|
0
|
0
|
|
|
|
|
my $mod = ($member->{modifier} eq "private") ? "protected" : "public"; |
|
704
|
0
|
|
|
|
|
|
print $FH " ",$mod," ",$member->{java_type}," ",$member->{java_name}," = ",$member->{java_init},";\n"; |
|
705
|
|
|
|
|
|
|
} |
|
706
|
0
|
|
|
|
|
|
print $FH $self->{abstract_methodes}; |
|
707
|
0
|
0
|
|
|
|
|
if ($node->isa('RegularValue')) { |
|
708
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
709
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String[] _truncatable_ids = {\n"; |
|
710
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_Name},"Helper.id ()\n"; |
|
711
|
0
|
|
|
|
|
|
print $FH " };\n"; |
|
712
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
713
|
0
|
|
|
|
|
|
print $FH " public java.lang.String[] _truncatable_ids ()\n"; |
|
714
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
715
|
0
|
|
|
|
|
|
print $FH " return _truncatable_ids;\n"; |
|
716
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
717
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
718
|
0
|
0
|
|
|
|
|
unless (exists $node->{modifier}) { # custom |
|
719
|
0
|
|
|
|
|
|
print $FH " public void _read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
720
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
721
|
0
|
0
|
|
|
|
|
print $FH " super._read (\$is);\n" if ($super); |
|
722
|
0
|
|
|
|
|
|
my $idx = 0; |
|
723
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { # StateMember |
|
|
0
|
|
|
|
|
|
|
|
724
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
725
|
0
|
|
|
|
|
|
$self->_member_helper_read($member, $node, \$idx); |
|
726
|
|
|
|
|
|
|
} |
|
727
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
728
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
729
|
0
|
|
|
|
|
|
print $FH " public void _write (org.omg.CORBA.portable.OutputStream \$os)\n"; |
|
730
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
731
|
0
|
0
|
|
|
|
|
print $FH " super._write (\$os);\n" if ($super); |
|
732
|
0
|
|
|
|
|
|
$idx = 0; |
|
733
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { # StateMember |
|
|
0
|
|
|
|
|
|
|
|
734
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
735
|
0
|
|
|
|
|
|
$self->_member_helper_write($member, $node, \$idx); |
|
736
|
|
|
|
|
|
|
} |
|
737
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
738
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
739
|
0
|
|
|
|
|
|
print $FH " public org.omg.CORBA.TypeCode _type ()\n"; |
|
740
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
741
|
0
|
|
|
|
|
|
print $FH " return ",$node->{java_Name},"Helper.type ();\n"; |
|
742
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
743
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
744
|
|
|
|
|
|
|
} |
|
745
|
0
|
0
|
|
|
|
|
if ($self->{toString}) { |
|
746
|
0
|
|
|
|
|
|
print $FH " public java.lang.String toString ()\n"; |
|
747
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
748
|
0
|
|
|
|
|
|
print $FH " java.lang.StringBuffer _ret = new java.lang.StringBuffer (\"valuetype ",$node->{java_name}," {\");\n"; |
|
749
|
0
|
|
|
|
|
|
my $first = 1; |
|
750
|
0
|
|
|
|
|
|
my $idx = 0; |
|
751
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
752
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
753
|
0
|
0
|
|
|
|
|
if ($first) { |
|
754
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"\\n\");\n"; |
|
755
|
0
|
|
|
|
|
|
$first = 0; |
|
756
|
|
|
|
|
|
|
} |
|
757
|
|
|
|
|
|
|
else { |
|
758
|
0
|
|
|
|
|
|
print $FH " _ret.append (\",\\n\");\n"; |
|
759
|
|
|
|
|
|
|
} |
|
760
|
0
|
|
|
|
|
|
$self->_member_toString($member, $node, \$idx); |
|
761
|
|
|
|
|
|
|
} |
|
762
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"\\n\");\n"; |
|
763
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"}\");\n"; |
|
764
|
0
|
|
|
|
|
|
print $FH " return _ret.toString ();\n"; |
|
765
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
766
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
767
|
|
|
|
|
|
|
} |
|
768
|
0
|
0
|
|
|
|
|
if ($self->{equals}) { |
|
769
|
0
|
|
|
|
|
|
print $FH " public boolean equals (java.lang.Object o)\n"; |
|
770
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
771
|
0
|
|
|
|
|
|
print $FH " if (this == o) return true;\n"; |
|
772
|
0
|
|
|
|
|
|
print $FH " if (o == null) return false;\n"; |
|
773
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
774
|
0
|
|
|
|
|
|
print $FH " if (o instanceof ",$node->{java_name},")\n"; |
|
775
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
776
|
0
|
0
|
|
|
|
|
if (scalar (@{$node->{list_member}})) { |
|
|
0
|
|
|
|
|
|
|
|
777
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_name}," obj = (",$node->{java_name},")o;\n"; |
|
778
|
0
|
|
|
|
|
|
print $FH " boolean res;\n"; |
|
779
|
0
|
|
|
|
|
|
my $first = 1; |
|
780
|
0
|
|
|
|
|
|
my $idx = 0; |
|
781
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
782
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
783
|
0
|
0
|
|
|
|
|
if ($first) { |
|
784
|
0
|
|
|
|
|
|
$first = 0; |
|
785
|
|
|
|
|
|
|
} |
|
786
|
|
|
|
|
|
|
else { |
|
787
|
0
|
|
|
|
|
|
print $FH " if (!res) return false;\n"; |
|
788
|
|
|
|
|
|
|
} |
|
789
|
0
|
|
|
|
|
|
$self->_member_equals($member, $node, \$idx); |
|
790
|
|
|
|
|
|
|
} |
|
791
|
0
|
|
|
|
|
|
print $FH " return res;\n"; |
|
792
|
|
|
|
|
|
|
} |
|
793
|
|
|
|
|
|
|
else { |
|
794
|
0
|
|
|
|
|
|
print $FH " return true;\n"; |
|
795
|
|
|
|
|
|
|
} |
|
796
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
797
|
0
|
|
|
|
|
|
print $FH " return false;\n"; |
|
798
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
799
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
800
|
0
|
|
|
|
|
|
print $FH " public int hashCode ()\n"; |
|
801
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
802
|
0
|
|
|
|
|
|
print $FH " // this method returns always the same value, to force equals() to be called.\n"; |
|
803
|
0
|
|
|
|
|
|
print $FH " return 0;\n"; |
|
804
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
805
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
806
|
|
|
|
|
|
|
} |
|
807
|
|
|
|
|
|
|
} |
|
808
|
0
|
|
|
|
|
|
print $FH "} // class ",$node->{java_name},"\n"; |
|
809
|
0
|
|
|
|
|
|
close $FH; |
|
810
|
|
|
|
|
|
|
} |
|
811
|
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
sub _value_factory { # non-abstract |
|
813
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
814
|
|
|
|
|
|
|
|
|
815
|
0
|
|
|
|
|
|
$self->open_stream($node, 'ValueFactory.java'); |
|
816
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
817
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name},"ValueFactory extends org.omg.CORBA.portable.ValueFactory\n"; |
|
818
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
819
|
0
|
|
|
|
|
|
print $FH $self->{value_factory}; |
|
820
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
821
|
0
|
|
|
|
|
|
close $FH; |
|
822
|
|
|
|
|
|
|
} |
|
823
|
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
sub visitRegularValue { |
|
825
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
826
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
827
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
828
|
|
|
|
|
|
|
|
|
829
|
0
|
|
|
|
|
|
$self->{factory} = q{}; |
|
830
|
0
|
|
|
|
|
|
$self->{value_factory} = q{}; |
|
831
|
0
|
|
|
|
|
|
$self->{abstract_methodes} = q{}; |
|
832
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
833
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self, $node); |
|
834
|
|
|
|
|
|
|
} |
|
835
|
|
|
|
|
|
|
|
|
836
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
837
|
0
|
|
|
|
|
|
$self->_value_helper($node); |
|
838
|
0
|
|
|
|
|
|
$self->_value($node); |
|
839
|
0
|
0
|
|
|
|
|
$self->_value_factory($node) if ($self->{factory}); |
|
840
|
0
|
0
|
|
|
|
|
$self->_value_helperXML($node) if ($self->can('_value_helperXML')); |
|
841
|
|
|
|
|
|
|
|
|
842
|
0
|
|
|
|
|
|
delete $self->{abstract_methodes}; |
|
843
|
0
|
|
|
|
|
|
delete $self->{factory}; |
|
844
|
0
|
|
|
|
|
|
delete $self->{value_factory}; |
|
845
|
|
|
|
|
|
|
} |
|
846
|
|
|
|
|
|
|
|
|
847
|
0
|
|
|
0
|
0
|
|
sub visitStateMembers { |
|
848
|
|
|
|
|
|
|
# empty |
|
849
|
|
|
|
|
|
|
} |
|
850
|
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
sub visitInitializer { |
|
852
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
853
|
0
|
|
|
|
|
|
my ($node, $value) = @_; |
|
854
|
|
|
|
|
|
|
|
|
855
|
0
|
|
|
|
|
|
$self->{value_factory} .= $self->_format_javadoc($node); |
|
856
|
0
|
|
|
|
|
|
$self->{value_factory} .= " " . $value->{java_name} . " " . $node->{java_proto} . ";\n"; |
|
857
|
|
|
|
|
|
|
|
|
858
|
0
|
0
|
|
|
|
|
if ($node->{java_params}) { |
|
859
|
0
|
|
|
|
|
|
$self->{factory} .= " public static " . $value->{java_Name} . " " . $node->{java_name} . " (org.omg.CORBA.ORB \$orb, " . $node->{java_params} . ")\n"; |
|
860
|
|
|
|
|
|
|
} |
|
861
|
|
|
|
|
|
|
else { |
|
862
|
0
|
|
|
|
|
|
$self->{factory} .= " public static " . $value->{java_Name} . " " . $node->{java_name} . " (org.omg.CORBA.ORB \$orb)\n"; |
|
863
|
|
|
|
|
|
|
} |
|
864
|
0
|
|
|
|
|
|
$self->{factory} .= " {\n"; |
|
865
|
0
|
|
|
|
|
|
$self->{factory} .= " try {\n"; |
|
866
|
0
|
|
|
|
|
|
$self->{factory} .= " " . $value->{java_Name} . "ValueFactory \$factory = (" . $value->{java_Name} . "ValueFactory)\n"; |
|
867
|
0
|
|
|
|
|
|
$self->{factory} .= " ((org.omg.CORBA_2_3.ORB)\$orb).lookup_value_factory (id ());\n"; |
|
868
|
0
|
|
|
|
|
|
$self->{factory} .= " return \$factory." . $node->{java_call} . ";\n"; |
|
869
|
0
|
|
|
|
|
|
$self->{factory} .= " } catch (ClassCastException \$ex) {\n"; |
|
870
|
0
|
|
|
|
|
|
$self->{factory} .= " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
871
|
0
|
|
|
|
|
|
$self->{factory} .= " }\n"; |
|
872
|
0
|
|
|
|
|
|
$self->{factory} .= " }\n"; |
|
873
|
0
|
|
|
|
|
|
$self->{factory} .= "\n"; |
|
874
|
|
|
|
|
|
|
} |
|
875
|
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
# |
|
877
|
|
|
|
|
|
|
# 3.9.2 Boxed Value Type |
|
878
|
|
|
|
|
|
|
# |
|
879
|
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
sub _boxed_holder { # primitive type |
|
881
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
882
|
0
|
|
|
|
|
|
my ($node, $type) = @_; |
|
883
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Holder.java'); |
|
884
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
885
|
0
|
|
|
|
|
|
print $FH "public final class ",$node->{java_helper},"Holder implements org.omg.CORBA.portable.Streamable\n"; |
|
886
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
887
|
0
|
|
|
|
|
|
print $FH " public ",$type->{java_Name}," value;\n"; |
|
888
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
889
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_helper},"Holder ()\n"; |
|
890
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
891
|
0
|
|
|
|
|
|
print $FH " value = ",$type->{java_init},";\n"; |
|
892
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
893
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
894
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_helper},"Holder (",$type->{java_Name}," initialValue)\n"; |
|
895
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
896
|
0
|
|
|
|
|
|
print $FH " value = initialValue;\n"; |
|
897
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
898
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
899
|
0
|
|
|
|
|
|
print $FH " public void _read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
900
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
901
|
0
|
|
|
|
|
|
print $FH " value = ",$node->{java_read},".value;\n"; |
|
902
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
903
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
904
|
0
|
|
|
|
|
|
print $FH " public void _write (org.omg.CORBA.portable.OutputStream \$os)\n"; |
|
905
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
906
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_helper}," vb = new ",$node->{java_helper}," (value);\n"; |
|
907
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_write},"vb);\n"; |
|
908
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
909
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
910
|
0
|
|
|
|
|
|
print $FH " public org.omg.CORBA.TypeCode _type ()\n"; |
|
911
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
912
|
0
|
|
|
|
|
|
print $FH " return ",$node->{java_Helper},".type ();\n"; |
|
913
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
914
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
915
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
916
|
0
|
|
|
|
|
|
close $FH; |
|
917
|
|
|
|
|
|
|
} |
|
918
|
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
sub _boxed_helper { |
|
920
|
0
|
|
|
0
|
|
|
my ($self, $node, $type, $array, $type2, $array_max) = @_; |
|
921
|
|
|
|
|
|
|
|
|
922
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
923
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
924
|
0
|
|
|
|
|
|
print $FH "public final class ",$node->{java_helper},"Helper implements org.omg.CORBA.portable.BoxedValueHelper\n"; |
|
925
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
926
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
927
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
928
|
0
|
|
|
|
|
|
print $FH " private static ",$node->{java_helper},"Helper _instance = new ",$node->{java_helper},"Helper ();\n"; |
|
929
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
930
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_helper},"Helper()\n"; |
|
931
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
932
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
933
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
934
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
935
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
936
|
|
|
|
|
|
|
} |
|
937
|
|
|
|
|
|
|
else { |
|
938
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$type->{java_Name},@{$array}," that)\n"; |
|
|
0
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
} |
|
940
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
941
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
942
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
943
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
944
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
945
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
946
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
947
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
948
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
949
|
|
|
|
|
|
|
} |
|
950
|
|
|
|
|
|
|
else { |
|
951
|
0
|
|
|
|
|
|
print $FH " public static ",$type->{java_Name},@{$array}," extract (org.omg.CORBA.Any a)\n"; |
|
|
0
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
} |
|
953
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
954
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
955
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
956
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
957
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
958
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
959
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
960
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
961
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
962
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
963
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
964
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
965
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
966
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
967
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
968
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
969
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
970
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
971
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
972
|
0
|
|
|
|
|
|
print $FH " __typeCode = ",$type->{java_type_code},";\n"; |
|
973
|
0
|
|
|
|
|
|
foreach (reverse @{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
974
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
975
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (",$_->{java_literal},", __typeCode);\n"; |
|
976
|
|
|
|
|
|
|
} |
|
977
|
|
|
|
|
|
|
else { |
|
978
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);\n"; |
|
979
|
|
|
|
|
|
|
} |
|
980
|
|
|
|
|
|
|
} |
|
981
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, \"",$node->{java_helper},"\", __typeCode);\n"; |
|
982
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
983
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
984
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
985
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
986
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
987
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
988
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
989
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
990
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
991
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
992
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
993
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
994
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
995
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
996
|
|
|
|
|
|
|
} |
|
997
|
|
|
|
|
|
|
else { |
|
998
|
0
|
|
|
|
|
|
print $FH " public static ",$type->{java_Name},@{$array}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
|
0
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
} |
|
1000
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1001
|
0
|
|
|
|
|
|
print $FH " if (\$is instanceof org.omg.CORBA_2_3.portable.InputStream)\n"; |
|
1002
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
1003
|
0
|
|
|
|
|
|
print $FH " return (",$node->{java_Name},")((org.omg.CORBA_2_3.portable.InputStream)\$is).read_value (_instance);\n"; |
|
1004
|
|
|
|
|
|
|
} |
|
1005
|
|
|
|
|
|
|
else { |
|
1006
|
0
|
|
|
|
|
|
print $FH " return (",$type->{java_Name},@{$array},")((org.omg.CORBA_2_3.portable.InputStream)\$is).read_value (_instance);\n"; |
|
|
0
|
|
|
|
|
|
|
|
1007
|
|
|
|
|
|
|
} |
|
1008
|
0
|
|
|
|
|
|
print $FH " else\n"; |
|
1009
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
1010
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1011
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1012
|
0
|
|
|
|
|
|
print $FH " public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
1013
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1014
|
0
|
|
|
|
|
|
print $FH " ",$type->{java_Name},@{$array}," value;\n"; |
|
|
0
|
|
|
|
|
|
|
|
1015
|
0
|
|
|
|
|
|
my @tab = (q{ } x 4); |
|
1016
|
0
|
|
|
|
|
|
my $i = 0; |
|
1017
|
0
|
|
|
|
|
|
my $idx = q{}; |
|
1018
|
0
|
|
|
|
|
|
my @array1= @{$array}; |
|
|
0
|
|
|
|
|
|
|
|
1019
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1020
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1021
|
0
|
|
|
|
|
|
pop @array1; |
|
1022
|
0
|
|
|
|
|
|
print $FH @tab,"value",$idx," = new ",$type->{java_Name}," [",$_->{java_literal},"]",@array1,";\n"; |
|
1023
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _o",$i," = 0; _o",$i," < (",$_->{java_literal},"); _o",$i,"++)\n"; |
|
1024
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1025
|
0
|
|
|
|
|
|
$idx .= '[_o' . $i . ']'; |
|
1026
|
0
|
|
|
|
|
|
$i ++; |
|
1027
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1028
|
|
|
|
|
|
|
} |
|
1029
|
|
|
|
|
|
|
} |
|
1030
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1031
|
0
|
|
|
|
|
|
pop @array1; |
|
1032
|
0
|
|
|
|
|
|
print $FH @tab,"int _len",$i," = \$is.read_long ();\n"; |
|
1033
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
1034
|
0
|
|
|
|
|
|
print $FH @tab,"if (_len",$i," > (",$_->{java_literal},"))\n"; |
|
1035
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1036
|
|
|
|
|
|
|
} |
|
1037
|
0
|
|
|
|
|
|
print $FH @tab,"value",$idx," = new ",$type->{java_Name}," [_len",$i,"]",@array1,";\n"; |
|
1038
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _o",$i," = 0; _o",$i," < value",$idx,".length; _o",$i,"++)\n"; |
|
1039
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1040
|
0
|
|
|
|
|
|
$idx .= '[_o' . $i . ']'; |
|
1041
|
0
|
|
|
|
|
|
$i ++; |
|
1042
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1043
|
|
|
|
|
|
|
} |
|
1044
|
0
|
|
|
|
|
|
print $FH @tab,"value",$idx," = ",$type2->{java_read},";\n"; |
|
1045
|
0
|
0
|
0
|
|
|
|
if (($type2->isa('StringType') or $type2->isa('WideStringType')) and exists $type2->{max}) { |
|
|
|
|
0
|
|
|
|
|
|
1046
|
0
|
|
|
|
|
|
print $FH @tab,"if (value",$idx,".length () > (",$type2->{max}->{java_literal},"))\n"; |
|
1047
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1048
|
|
|
|
|
|
|
} |
|
1049
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1050
|
0
|
|
|
|
|
|
pop @tab; |
|
1051
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1052
|
|
|
|
|
|
|
} |
|
1053
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1054
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1055
|
0
|
|
|
|
|
|
pop @tab; |
|
1056
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1057
|
|
|
|
|
|
|
} |
|
1058
|
|
|
|
|
|
|
} |
|
1059
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
1060
|
0
|
|
|
|
|
|
print $FH " return new ",$node->{java_Name}," (value);\n"; |
|
1061
|
|
|
|
|
|
|
} |
|
1062
|
|
|
|
|
|
|
else { |
|
1063
|
0
|
|
|
|
|
|
print $FH " return (java.io.Serializable)value;\n"; |
|
1064
|
|
|
|
|
|
|
} |
|
1065
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1066
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1067
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
1068
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
1069
|
|
|
|
|
|
|
} |
|
1070
|
|
|
|
|
|
|
else { |
|
1071
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$type->{java_Name},@{$array}," value)\n"; |
|
|
0
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
} |
|
1073
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1074
|
0
|
|
|
|
|
|
print $FH " if (\$os instanceof org.omg.CORBA_2_3.portable.OutputStream)\n"; |
|
1075
|
0
|
|
|
|
|
|
print $FH " ((org.omg.CORBA_2_3.portable.OutputStream)\$os).write_value (value, _instance);\n"; |
|
1076
|
0
|
|
|
|
|
|
print $FH " else\n"; |
|
1077
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
1078
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1079
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1080
|
0
|
|
|
|
|
|
print $FH " public void write_value (org.omg.CORBA.portable.OutputStream \$os, java.io.Serializable value)\n"; |
|
1081
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1082
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
1083
|
0
|
|
|
|
|
|
print $FH " if (value instanceof ",$node->{java_Name},")\n"; |
|
1084
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1085
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_Name}," valueType = (",$node->{java_Name},")value;\n"; |
|
1086
|
|
|
|
|
|
|
} |
|
1087
|
|
|
|
|
|
|
else { |
|
1088
|
0
|
|
|
|
|
|
print $FH " if (value instanceof ",$type->{java_Name},@{$array},")\n"; |
|
|
0
|
|
|
|
|
|
|
|
1089
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1090
|
0
|
|
|
|
|
|
print $FH " ",$type->{java_Name},@{$array}," valueType = (",$type->{java_Name},@{$array},")value;\n"; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
1091
|
|
|
|
|
|
|
} |
|
1092
|
0
|
|
|
|
|
|
@tab = (q{ } x 6); |
|
1093
|
0
|
|
|
|
|
|
$i = 0; |
|
1094
|
0
|
|
|
|
|
|
$idx = q{}; |
|
1095
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1096
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1097
|
0
|
|
|
|
|
|
print $FH @tab,"if (valueType",$idx,".length != (",$_->{java_literal},"))\n"; |
|
1098
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1099
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _i",$i," = 0; _i",$i," < (",$_->{java_literal},"); _i",$i,"++)\n"; |
|
1100
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1101
|
0
|
|
|
|
|
|
$idx .= '[_i' . $i . ']'; |
|
1102
|
0
|
|
|
|
|
|
$i ++; |
|
1103
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1104
|
|
|
|
|
|
|
} |
|
1105
|
|
|
|
|
|
|
} |
|
1106
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1107
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
1108
|
0
|
|
|
|
|
|
print $FH @tab,"if (valueType",$idx,".length > (",$_->{java_literal},"))\n"; |
|
1109
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1110
|
|
|
|
|
|
|
} |
|
1111
|
0
|
|
|
|
|
|
print $FH @tab,"\$os.write_long (valueType",$idx,".length);\n"; |
|
1112
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _i",$i," = 0; _i",$i," < valueType",$idx,".length; _i",$i,"++)\n"; |
|
1113
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1114
|
0
|
|
|
|
|
|
$idx .= '[_i' . $i . ']'; |
|
1115
|
0
|
|
|
|
|
|
$i ++; |
|
1116
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1117
|
|
|
|
|
|
|
} |
|
1118
|
0
|
0
|
0
|
|
|
|
if (($type2->isa('StringType') or $type2->isa('WideStringType')) and exists $type2->{max}) { |
|
|
|
|
0
|
|
|
|
|
|
1119
|
0
|
|
|
|
|
|
print $FH @tab,"if (valueType",$idx,".length () > (",$type2->{max}->{java_literal},"))\n"; |
|
1120
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1121
|
|
|
|
|
|
|
} |
|
1122
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
1123
|
0
|
|
|
|
|
|
print $FH @tab,$type2->{java_write},"valueType.value);\n"; |
|
1124
|
|
|
|
|
|
|
} |
|
1125
|
|
|
|
|
|
|
else { |
|
1126
|
0
|
|
|
|
|
|
print $FH @tab,$type2->{java_write},"valueType",$idx,");\n"; |
|
1127
|
|
|
|
|
|
|
} |
|
1128
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1129
|
0
|
|
|
|
|
|
pop @tab; |
|
1130
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1131
|
|
|
|
|
|
|
} |
|
1132
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1133
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1134
|
0
|
|
|
|
|
|
pop @tab; |
|
1135
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1136
|
|
|
|
|
|
|
} |
|
1137
|
|
|
|
|
|
|
} |
|
1138
|
0
|
|
|
|
|
|
print $FH " } else\n"; |
|
1139
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.MARSHAL ();\n"; |
|
1140
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1141
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1142
|
0
|
|
|
|
|
|
print $FH " public java.lang.String get_id ()\n"; |
|
1143
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1144
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
1145
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1146
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1147
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
1148
|
0
|
|
|
|
|
|
close $FH; |
|
1149
|
|
|
|
|
|
|
} |
|
1150
|
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
sub _boxed { # primitive type |
|
1152
|
0
|
|
|
0
|
|
|
my ($self, $node, $type) = @_; |
|
1153
|
|
|
|
|
|
|
|
|
1154
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
1155
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1156
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
1157
|
0
|
|
|
|
|
|
print $FH "public class ",$node->{java_name}," implements org.omg.CORBA.portable.ValueBase\n"; |
|
1158
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
1159
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
1160
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
1161
|
|
|
|
|
|
|
} |
|
1162
|
|
|
|
|
|
|
else { |
|
1163
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
1164
|
|
|
|
|
|
|
} |
|
1165
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1166
|
0
|
|
|
|
|
|
print $FH " public ",$type->{java_Name}," value;\n"; |
|
1167
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1168
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_Name}," (",$type->{java_Name}," initial)\n"; |
|
1169
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1170
|
0
|
|
|
|
|
|
print $FH " value = initial;\n"; |
|
1171
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1172
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1173
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String[] _truncatable_ids = {\n"; |
|
1174
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_Name},"Helper.id ()\n"; |
|
1175
|
0
|
|
|
|
|
|
print $FH " };\n"; |
|
1176
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1177
|
0
|
|
|
|
|
|
print $FH " public java.lang.String[] _truncatable_ids()\n"; |
|
1178
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1179
|
0
|
|
|
|
|
|
print $FH " return _truncatable_ids;\n"; |
|
1180
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1181
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1182
|
0
|
0
|
|
|
|
|
if ($self->{toString}) { |
|
1183
|
0
|
|
|
|
|
|
print $FH " public java.lang.String toString ()\n"; |
|
1184
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1185
|
0
|
|
|
|
|
|
print $FH " java.lang.StringBuffer _ret = new java.lang.StringBuffer (\"valuebox ",$node->{java_name}," {\");\n"; |
|
1186
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"",$type->{java_Name}," value=\");\n"; |
|
1187
|
0
|
|
|
|
|
|
print $FH " _ret.append (value);\n"; |
|
1188
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"\\n\");\n"; |
|
1189
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"}\");\n"; |
|
1190
|
0
|
|
|
|
|
|
print $FH " return _ret.toString ();\n"; |
|
1191
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1192
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1193
|
|
|
|
|
|
|
} |
|
1194
|
0
|
0
|
|
|
|
|
if ($self->{equals}) { |
|
1195
|
0
|
|
|
|
|
|
print $FH " public boolean equals (java.lang.Object o)\n"; |
|
1196
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1197
|
0
|
|
|
|
|
|
print $FH " if (this == o) return true;\n"; |
|
1198
|
0
|
|
|
|
|
|
print $FH " if (o == null) return false;\n"; |
|
1199
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1200
|
0
|
|
|
|
|
|
print $FH " if (o instanceof ",$node->{java_name},")\n"; |
|
1201
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1202
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_name}," obj = (",$node->{java_name},")o;\n"; |
|
1203
|
0
|
|
|
|
|
|
print $FH " return (this.value == obj.value);\n"; |
|
1204
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1205
|
0
|
|
|
|
|
|
print $FH " return false;\n"; |
|
1206
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1207
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1208
|
0
|
|
|
|
|
|
print $FH " public int hashCode ()\n"; |
|
1209
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1210
|
0
|
|
|
|
|
|
print $FH " // this method returns always the same value, to force equals() to be called.\n"; |
|
1211
|
0
|
|
|
|
|
|
print $FH " return 0;\n"; |
|
1212
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1213
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1214
|
|
|
|
|
|
|
} |
|
1215
|
0
|
|
|
|
|
|
print $FH "} // class ",$node->{java_name},"\n"; |
|
1216
|
0
|
|
|
|
|
|
close $FH; |
|
1217
|
|
|
|
|
|
|
} |
|
1218
|
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
sub visitBoxedValue { |
|
1220
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1221
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1222
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
1223
|
|
|
|
|
|
|
|
|
1224
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
|
1225
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType') |
|
|
|
|
0
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
or $type->isa('UnionType') |
|
1227
|
|
|
|
|
|
|
or $type->isa('EnumType') ) { |
|
1228
|
0
|
|
|
|
|
|
$type->visit($self); |
|
1229
|
|
|
|
|
|
|
} |
|
1230
|
0
|
0
|
|
|
|
|
if (exists $node->{java_primitive}) { |
|
1231
|
0
|
|
|
|
|
|
$self->_boxed_holder($node, $type); |
|
1232
|
0
|
|
|
|
|
|
$self->_boxed($node, $type); |
|
1233
|
0
|
|
|
|
|
|
$self->_boxed_helper($node, $type, [], $type, []); |
|
1234
|
0
|
0
|
|
|
|
|
$self->_boxed_helperXML($node, $type, [], $type, []) |
|
1235
|
|
|
|
|
|
|
if ($self->can("_boxed_helperXML")); |
|
1236
|
|
|
|
|
|
|
} |
|
1237
|
|
|
|
|
|
|
else { |
|
1238
|
0
|
|
|
|
|
|
my @array = (); |
|
1239
|
0
|
|
|
|
|
|
my @array_max = (); |
|
1240
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1241
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1242
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1243
|
|
|
|
|
|
|
} |
|
1244
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
1245
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1246
|
0
|
0
|
|
|
|
|
if (exists $type->{max}) { |
|
1247
|
0
|
|
|
|
|
|
push @array_max, $type->{max}; |
|
1248
|
|
|
|
|
|
|
} |
|
1249
|
|
|
|
|
|
|
else { |
|
1250
|
0
|
|
|
|
|
|
push @array_max, undef; |
|
1251
|
|
|
|
|
|
|
} |
|
1252
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1253
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1254
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1255
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1256
|
|
|
|
|
|
|
} |
|
1257
|
|
|
|
|
|
|
} |
|
1258
|
0
|
|
|
|
|
|
my $type2 = $type; |
|
1259
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) { |
|
1260
|
0
|
|
|
|
|
|
foreach (@{$type->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1261
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1262
|
|
|
|
|
|
|
} |
|
1263
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1264
|
|
|
|
|
|
|
} |
|
1265
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
1266
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1267
|
0
|
0
|
|
|
|
|
if (exists $type->{max}) { |
|
1268
|
0
|
|
|
|
|
|
push @array_max, $type->{max}; |
|
1269
|
|
|
|
|
|
|
} |
|
1270
|
|
|
|
|
|
|
else { |
|
1271
|
0
|
|
|
|
|
|
push @array_max, undef; |
|
1272
|
|
|
|
|
|
|
} |
|
1273
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1274
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1275
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1276
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1277
|
|
|
|
|
|
|
} |
|
1278
|
|
|
|
|
|
|
} |
|
1279
|
0
|
|
|
|
|
|
$self->_holder($node, $type, @array); |
|
1280
|
0
|
|
|
|
|
|
$self->_boxed_helper($node, $type, \@array, $type2, \@array_max); |
|
1281
|
0
|
0
|
|
|
|
|
$self->_boxed_helperXML($node, $type, \@array, $type2, \@array_max) |
|
1282
|
|
|
|
|
|
|
if ($self->can('_boxed_helperXML')); |
|
1283
|
|
|
|
|
|
|
} |
|
1284
|
|
|
|
|
|
|
} |
|
1285
|
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
# |
|
1287
|
|
|
|
|
|
|
# 3.9.3 Abstract Value Type |
|
1288
|
|
|
|
|
|
|
# |
|
1289
|
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
sub visitAbstractValue { |
|
1291
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1292
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1293
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
1294
|
|
|
|
|
|
|
|
|
1295
|
0
|
|
|
|
|
|
$self->{factory} = q{}; |
|
1296
|
0
|
|
|
|
|
|
$self->{value_factory} = q{}; |
|
1297
|
0
|
|
|
|
|
|
$self->{abstract_methodes} = q{}; |
|
1298
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
1299
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self, $node); |
|
1300
|
|
|
|
|
|
|
} |
|
1301
|
|
|
|
|
|
|
|
|
1302
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
1303
|
0
|
|
|
|
|
|
$self->_value_helper($node); |
|
1304
|
0
|
|
|
|
|
|
$self->_value($node); |
|
1305
|
0
|
0
|
|
|
|
|
$self->_value_helperXML($node) if ($self->can('_value_helperXML')); |
|
1306
|
|
|
|
|
|
|
|
|
1307
|
0
|
|
|
|
|
|
delete $self->{abstract_methodes}; |
|
1308
|
0
|
|
|
|
|
|
delete $self->{factory}; |
|
1309
|
0
|
|
|
|
|
|
delete $self->{value_factory}; |
|
1310
|
|
|
|
|
|
|
} |
|
1311
|
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
# |
|
1313
|
|
|
|
|
|
|
# 3.10 Constant Declaration |
|
1314
|
|
|
|
|
|
|
# |
|
1315
|
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
sub visitConstant { |
|
1317
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1318
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1319
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
1320
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
|
1321
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1322
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1323
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1324
|
|
|
|
|
|
|
} |
|
1325
|
0
|
|
|
|
|
|
my $value = $node->{value}; |
|
1326
|
0
|
|
|
|
|
|
my $defn; |
|
1327
|
0
|
|
|
|
|
|
my $pkg = $node->{full}; |
|
1328
|
0
|
|
|
|
|
|
$pkg =~ s/::[0-9A-Z_a-z]+$//; |
|
1329
|
0
|
0
|
|
|
|
|
$defn = $self->{symbtab}->Lookup($pkg) if ($pkg); |
|
1330
|
0
|
0
|
0
|
|
|
|
if ( defined $defn and $defn->isa('BaseInterface') ) { |
|
1331
|
0
|
|
|
|
|
|
$self->{constants} .= $self->_format_javadoc($node); |
|
1332
|
0
|
|
|
|
|
|
$self->{constants} .= " public static final " . $type->{java_Name} . " " . $node->{java_name} . " = "; |
|
1333
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('FloatingPtType') |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
or $type->isa('IntegerType') |
|
1335
|
|
|
|
|
|
|
or $type->isa('CharType') |
|
1336
|
|
|
|
|
|
|
or $type->isa('WideCharType') |
|
1337
|
|
|
|
|
|
|
or $type->isa('StringType') |
|
1338
|
|
|
|
|
|
|
or $type->isa('WideStringType') |
|
1339
|
|
|
|
|
|
|
or $type->isa('BooleanType') |
|
1340
|
|
|
|
|
|
|
or $type->isa('OctetType') |
|
1341
|
|
|
|
|
|
|
or $type->isa('EnumType') ) { |
|
1342
|
0
|
|
|
|
|
|
$self->{constants} .= $value->{java_literal} . ";\n"; |
|
1343
|
|
|
|
|
|
|
} |
|
1344
|
|
|
|
|
|
|
else { |
|
1345
|
0
|
|
|
|
|
|
$self->{constants} .= "new " . $type->{java_Name} . " (" . $value->{java_literal} . ");\n"; |
|
1346
|
|
|
|
|
|
|
} |
|
1347
|
|
|
|
|
|
|
} |
|
1348
|
|
|
|
|
|
|
else { |
|
1349
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
1350
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1351
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
1352
|
0
|
|
|
|
|
|
print $FH "public interface ",$node->{java_name},"\n"; |
|
1353
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
1354
|
0
|
|
|
|
|
|
print $FH " public static final ",$type->{java_Name}," value = "; |
|
1355
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('FloatingPtType') |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
or $type->isa('IntegerType') |
|
1357
|
|
|
|
|
|
|
or $type->isa('CharType') |
|
1358
|
|
|
|
|
|
|
or $type->isa('WideCharType') |
|
1359
|
|
|
|
|
|
|
or $type->isa('StringType') |
|
1360
|
|
|
|
|
|
|
or $type->isa('WideStringType') |
|
1361
|
|
|
|
|
|
|
or $type->isa('BooleanType') |
|
1362
|
|
|
|
|
|
|
or $type->isa('OctetType') |
|
1363
|
|
|
|
|
|
|
or $type->isa('EnumType') ) { |
|
1364
|
0
|
|
|
|
|
|
print $FH $value->{java_literal},";\n"; |
|
1365
|
|
|
|
|
|
|
} |
|
1366
|
|
|
|
|
|
|
else { |
|
1367
|
0
|
|
|
|
|
|
print $FH "new ",$type->{java_Name}," (",$value->{java_literal},");\n"; |
|
1368
|
|
|
|
|
|
|
} |
|
1369
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
1370
|
0
|
|
|
|
|
|
close $FH; |
|
1371
|
|
|
|
|
|
|
} |
|
1372
|
|
|
|
|
|
|
} |
|
1373
|
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
# |
|
1375
|
|
|
|
|
|
|
# 3.11 Type Declaration |
|
1376
|
|
|
|
|
|
|
# |
|
1377
|
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
sub visitTypeDeclarators { |
|
1379
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1380
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1381
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
1382
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
|
1383
|
|
|
|
|
|
|
} |
|
1384
|
|
|
|
|
|
|
} |
|
1385
|
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
sub _typedeclarator_helper { |
|
1387
|
0
|
|
|
0
|
|
|
my ($self, $node, $type, $array, $type2, $array_max) = @_; |
|
1388
|
|
|
|
|
|
|
|
|
1389
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
1390
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1391
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
1392
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
1393
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
1394
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
1395
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1396
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$type->{java_Name},@{$array}," that)\n"; |
|
|
0
|
|
|
|
|
|
|
|
1397
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1398
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
1399
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
1400
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
1401
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
1402
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1403
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1404
|
0
|
|
|
|
|
|
print $FH " public static ",$type->{java_Name},@{$array}," extract (org.omg.CORBA.Any a)\n"; |
|
|
0
|
|
|
|
|
|
|
|
1405
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1406
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
1407
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1408
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1409
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
1410
|
|
|
|
|
|
|
## print $FH " private static boolean __active = false;\n"; |
|
1411
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
1412
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1413
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
1414
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1415
|
|
|
|
|
|
|
## print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
1416
|
|
|
|
|
|
|
## print $FH " {\n"; |
|
1417
|
|
|
|
|
|
|
## print $FH " if (__typeCode == null)\n"; |
|
1418
|
|
|
|
|
|
|
## print $FH " {\n"; |
|
1419
|
|
|
|
|
|
|
## print $FH " if (__active)\n"; |
|
1420
|
|
|
|
|
|
|
## print $FH " {\n"; |
|
1421
|
|
|
|
|
|
|
## print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
1422
|
|
|
|
|
|
|
## print $FH " }\n"; |
|
1423
|
|
|
|
|
|
|
## print $FH " __active = true;\n"; |
|
1424
|
0
|
|
|
|
|
|
print $FH " __typeCode = ",$type->{java_type_code},";\n"; |
|
1425
|
0
|
|
|
|
|
|
foreach (reverse @{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1426
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
1427
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (",$_->{java_literal},", __typeCode);\n"; |
|
1428
|
|
|
|
|
|
|
} |
|
1429
|
|
|
|
|
|
|
else { |
|
1430
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);\n"; |
|
1431
|
|
|
|
|
|
|
} |
|
1432
|
|
|
|
|
|
|
} |
|
1433
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1434
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1435
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_array_tc (",$_->{java_literal},", __typeCode );\n"; |
|
1436
|
|
|
|
|
|
|
} |
|
1437
|
|
|
|
|
|
|
} |
|
1438
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (",$node->{java_Helper},".id (), \"",$node->{java_helper},"\", __typeCode);\n"; |
|
1439
|
|
|
|
|
|
|
## print $FH " __active = false;\n"; |
|
1440
|
|
|
|
|
|
|
## print $FH " }\n"; |
|
1441
|
|
|
|
|
|
|
## print $FH " }\n"; |
|
1442
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1443
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
1444
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1445
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1446
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
1447
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1448
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
1449
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1450
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1451
|
0
|
|
|
|
|
|
print $FH " public static ",$type->{java_Name},@{$array}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
|
0
|
|
|
|
|
|
|
|
1452
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1453
|
0
|
0
|
|
|
|
|
if (scalar(@{$array})) { |
|
|
0
|
|
|
|
|
|
|
|
1454
|
0
|
|
|
|
|
|
print $FH " ",$type->{java_Name}," value",@{$array}," = null;\n"; |
|
|
0
|
|
|
|
|
|
|
|
1455
|
|
|
|
|
|
|
} |
|
1456
|
|
|
|
|
|
|
else { |
|
1457
|
0
|
|
|
|
|
|
print $FH " ",$type->{java_Name}," value = ",$type->{java_init},";\n"; |
|
1458
|
|
|
|
|
|
|
} |
|
1459
|
0
|
|
|
|
|
|
my @tab = (q{ } x 4); |
|
1460
|
0
|
|
|
|
|
|
my $i = 0; |
|
1461
|
0
|
|
|
|
|
|
my $idx = q{}; |
|
1462
|
0
|
|
|
|
|
|
my @array1= @{$array}; |
|
|
0
|
|
|
|
|
|
|
|
1463
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1464
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1465
|
0
|
|
|
|
|
|
pop @array1; |
|
1466
|
0
|
|
|
|
|
|
print $FH @tab,"value",$idx," = new ",$type->{java_Name}," [",$_->{java_literal},"]",@array1,";\n"; |
|
1467
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _o",$i," = 0; _o",$i," < (",$_->{java_literal},"); _o",$i,"++)\n"; |
|
1468
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1469
|
0
|
|
|
|
|
|
$idx .= '[_o' . $i . ']'; |
|
1470
|
0
|
|
|
|
|
|
$i ++; |
|
1471
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1472
|
|
|
|
|
|
|
} |
|
1473
|
|
|
|
|
|
|
} |
|
1474
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1475
|
0
|
|
|
|
|
|
pop @array1; |
|
1476
|
0
|
|
|
|
|
|
print $FH @tab,"int _len",$i," = \$is.read_long ();\n"; |
|
1477
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
1478
|
0
|
|
|
|
|
|
print $FH @tab,"if (_len",$i," > (",$_->{java_literal},"))\n"; |
|
1479
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1480
|
|
|
|
|
|
|
} |
|
1481
|
0
|
|
|
|
|
|
print $FH @tab,"value",$idx," = new ",$type->{java_Name}," [_len",$i,"]",@array1,";\n"; |
|
1482
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _o",$i," = 0; _o",$i," < value",$idx,".length; _o",$i,"++)\n"; |
|
1483
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1484
|
0
|
|
|
|
|
|
$idx .= '[_o' . $i . ']'; |
|
1485
|
0
|
|
|
|
|
|
$i ++; |
|
1486
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1487
|
|
|
|
|
|
|
} |
|
1488
|
0
|
|
|
|
|
|
print $FH @tab,"value",$idx," = ",$type2->{java_read},";\n"; |
|
1489
|
0
|
0
|
0
|
|
|
|
if (($type2->isa('StringType') or $type2->isa('WideStringType')) and exists $type2->{max}) { |
|
|
|
|
0
|
|
|
|
|
|
1490
|
0
|
|
|
|
|
|
print $FH @tab,"if (value",$idx,".length () > (",$type2->{max}->{java_literal},"))\n"; |
|
1491
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1492
|
|
|
|
|
|
|
} |
|
1493
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1494
|
0
|
|
|
|
|
|
pop @tab; |
|
1495
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1496
|
|
|
|
|
|
|
} |
|
1497
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1498
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1499
|
0
|
|
|
|
|
|
pop @tab; |
|
1500
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1501
|
|
|
|
|
|
|
} |
|
1502
|
|
|
|
|
|
|
} |
|
1503
|
0
|
|
|
|
|
|
print $FH " return value;\n"; |
|
1504
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1505
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1506
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$type->{java_Name},@{$array}," value)\n"; |
|
|
0
|
|
|
|
|
|
|
|
1507
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1508
|
0
|
|
|
|
|
|
@tab = (q{ } x 4); |
|
1509
|
0
|
|
|
|
|
|
$i = 0; |
|
1510
|
0
|
|
|
|
|
|
$idx = q{}; |
|
1511
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1512
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1513
|
0
|
|
|
|
|
|
print $FH @tab,"if (value",$idx,".length != (",$_->{java_literal},"))\n"; |
|
1514
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1515
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _i",$i," = 0; _i",$i," < (",$_->{java_literal},"); _i",$i,"++)\n"; |
|
1516
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1517
|
0
|
|
|
|
|
|
$idx .= '[_i' . $i . ']'; |
|
1518
|
0
|
|
|
|
|
|
$i ++; |
|
1519
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1520
|
|
|
|
|
|
|
} |
|
1521
|
|
|
|
|
|
|
} |
|
1522
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1523
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
1524
|
0
|
|
|
|
|
|
print $FH @tab,"if (value",$idx,".length > (",$_->{java_literal},"))\n"; |
|
1525
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1526
|
|
|
|
|
|
|
} |
|
1527
|
0
|
|
|
|
|
|
print $FH @tab,"\$os.write_long (value",$idx,".length);\n"; |
|
1528
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _i",$i," = 0; _i",$i," < value",$idx,".length; _i",$i,"++)\n"; |
|
1529
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
1530
|
0
|
|
|
|
|
|
$idx .= '[_i' . $i . ']'; |
|
1531
|
0
|
|
|
|
|
|
$i ++; |
|
1532
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
1533
|
|
|
|
|
|
|
} |
|
1534
|
0
|
0
|
0
|
|
|
|
if (($type2->isa('StringType') or $type2->isa('WideStringType')) and exists $type2->{max}) { |
|
|
|
|
0
|
|
|
|
|
|
1535
|
0
|
|
|
|
|
|
print $FH @tab,"if (value",$idx,".length () > (",$type2->{max}->{java_literal},"))\n"; |
|
1536
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
1537
|
|
|
|
|
|
|
} |
|
1538
|
0
|
|
|
|
|
|
print $FH @tab,$type2->{java_write},"value",$idx,");\n"; |
|
1539
|
0
|
|
|
|
|
|
foreach (@{$array_max}) { |
|
|
0
|
|
|
|
|
|
|
|
1540
|
0
|
|
|
|
|
|
pop @tab; |
|
1541
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1542
|
|
|
|
|
|
|
} |
|
1543
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1544
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1545
|
0
|
|
|
|
|
|
pop @tab; |
|
1546
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
1547
|
|
|
|
|
|
|
} |
|
1548
|
|
|
|
|
|
|
} |
|
1549
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1550
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1551
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
1552
|
0
|
|
|
|
|
|
close $FH; |
|
1553
|
|
|
|
|
|
|
} |
|
1554
|
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
sub visitTypeDeclarator { |
|
1556
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1557
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1558
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
1559
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
|
1560
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType') |
|
|
|
|
0
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
or $type->isa('UnionType') |
|
1562
|
|
|
|
|
|
|
or $type->isa('EnumType') ) { |
|
1563
|
0
|
|
|
|
|
|
$type->visit($self); |
|
1564
|
|
|
|
|
|
|
} |
|
1565
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1566
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1567
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1568
|
|
|
|
|
|
|
} |
|
1569
|
0
|
|
|
|
|
|
my @array_max = (); |
|
1570
|
0
|
|
|
|
|
|
my @array = (); |
|
1571
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
1572
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1573
|
0
|
0
|
|
|
|
|
if (exists $type->{max}) { |
|
1574
|
0
|
|
|
|
|
|
push @array_max, $type->{max}; |
|
1575
|
|
|
|
|
|
|
} |
|
1576
|
|
|
|
|
|
|
else { |
|
1577
|
0
|
|
|
|
|
|
push @array_max, undef; |
|
1578
|
|
|
|
|
|
|
} |
|
1579
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1580
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1581
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1582
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1583
|
|
|
|
|
|
|
} |
|
1584
|
|
|
|
|
|
|
} |
|
1585
|
0
|
|
|
|
|
|
my $type2 = $type; |
|
1586
|
|
|
|
|
|
|
|
|
1587
|
0
|
0
|
0
|
|
|
|
if (exists $node->{array_size} or exists $type->{array_size} or scalar(@array)) { |
|
|
|
|
0
|
|
|
|
|
|
1588
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) { |
|
1589
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1590
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1591
|
|
|
|
|
|
|
} |
|
1592
|
|
|
|
|
|
|
} |
|
1593
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) { |
|
1594
|
0
|
|
|
|
|
|
foreach (@{$type->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1595
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1596
|
|
|
|
|
|
|
} |
|
1597
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1598
|
|
|
|
|
|
|
} |
|
1599
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
1600
|
0
|
|
|
|
|
|
push @array, '[]'; |
|
1601
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1602
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1603
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1604
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1605
|
|
|
|
|
|
|
} |
|
1606
|
|
|
|
|
|
|
} |
|
1607
|
0
|
|
|
|
|
|
$self->_holder($node, $type, @array); |
|
1608
|
0
|
|
|
|
|
|
$self->_typedeclarator_helper($node, $type, \@array, $type2, \@array_max); |
|
1609
|
0
|
0
|
|
|
|
|
$self->_typedeclarator_helperXML($node, $type, \@array, $type2, \@array_max) |
|
1610
|
|
|
|
|
|
|
if ($self->can('_typedeclarator_helperXML')); |
|
1611
|
|
|
|
|
|
|
} |
|
1612
|
|
|
|
|
|
|
else { |
|
1613
|
0
|
|
0
|
|
|
|
while ( $type->isa('TypeDeclarator') |
|
1614
|
|
|
|
|
|
|
and ! exists $type->{array_size} ) { |
|
1615
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1616
|
|
|
|
|
|
|
} |
|
1617
|
0
|
|
|
|
|
|
$self->_typedeclarator_helper($node, $type, \@array, $type2, \@array_max); |
|
1618
|
0
|
0
|
|
|
|
|
$self->_typedeclarator_helperXML($node, $type, \@array, $type2, \@array_max) |
|
1619
|
|
|
|
|
|
|
if ($self->can('_typedeclarator_helperXML')); |
|
1620
|
|
|
|
|
|
|
} |
|
1621
|
|
|
|
|
|
|
} |
|
1622
|
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
sub _native_helper { |
|
1624
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
1625
|
|
|
|
|
|
|
|
|
1626
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
1627
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1628
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
1629
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
1630
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
1631
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1632
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
1633
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1634
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.MARSHAL();\n"; |
|
1635
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1636
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1637
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
1638
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1639
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.MARSHAL();\n"; |
|
1640
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1641
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1642
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
1643
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
1644
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1645
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
1646
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1647
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);\n"; |
|
1648
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (",$node->{java_Helper},".id (), \"",$node->{java_helper},"\", __typeCode);\n"; |
|
1649
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1650
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
1651
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1652
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1653
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
1654
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1655
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
1656
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1657
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1658
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
1659
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1660
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.MARSHAL();\n"; |
|
1661
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1662
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1663
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
1664
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1665
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.MARSHAL();\n"; |
|
1666
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1667
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1668
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
1669
|
0
|
|
|
|
|
|
close $FH; |
|
1670
|
|
|
|
|
|
|
} |
|
1671
|
|
|
|
|
|
|
|
|
1672
|
|
|
|
|
|
|
sub visitNativeType { |
|
1673
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1674
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1675
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
1676
|
0
|
|
|
|
|
|
$self->_native_helper($node); |
|
1677
|
|
|
|
|
|
|
} |
|
1678
|
|
|
|
|
|
|
|
|
1679
|
|
|
|
|
|
|
# |
|
1680
|
|
|
|
|
|
|
# 3.11.2 Constructed Types |
|
1681
|
|
|
|
|
|
|
# |
|
1682
|
|
|
|
|
|
|
# 3.11.2.1 Structures |
|
1683
|
|
|
|
|
|
|
# |
|
1684
|
|
|
|
|
|
|
|
|
1685
|
|
|
|
|
|
|
sub _struct_helper { |
|
1686
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
1687
|
|
|
|
|
|
|
|
|
1688
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
1689
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1690
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
1691
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
1692
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
1693
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1694
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
1695
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1696
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
1697
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
1698
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
1699
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
1700
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1701
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1702
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
1703
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1704
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
1705
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1706
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1707
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
1708
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
1709
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
1710
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1711
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
1712
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1713
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
1714
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1715
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
1716
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1717
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
1718
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1719
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
1720
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1721
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
1722
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [",scalar(@{$node->{list_member}}),"];\n"; |
|
|
0
|
|
|
|
|
|
|
|
1723
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.TypeCode _tcOf_members0 = null;\n"; |
|
1724
|
0
|
|
|
|
|
|
my $i = 0; |
|
1725
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1726
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1727
|
0
|
|
|
|
|
|
$self->_member_helper_type($member, $node, $i); |
|
1728
|
0
|
|
|
|
|
|
$i ++; |
|
1729
|
|
|
|
|
|
|
} |
|
1730
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (_id, \"",$node->{java_name},"\", _members0);\n"; |
|
1731
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
1732
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1733
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1734
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1735
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
1736
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1737
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1738
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
1739
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1740
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
1741
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1742
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1743
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
1744
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1745
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_Name}," value = new ",$node->{java_Name}," ();\n"; |
|
1746
|
0
|
|
|
|
|
|
my $idx = 0; |
|
1747
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1748
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1749
|
0
|
|
|
|
|
|
$self->_member_helper_read($member, $node, \$idx); |
|
1750
|
|
|
|
|
|
|
} |
|
1751
|
0
|
|
|
|
|
|
print $FH " return value;\n"; |
|
1752
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1753
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1754
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
1755
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1756
|
0
|
|
|
|
|
|
$idx = 0; |
|
1757
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1758
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1759
|
0
|
|
|
|
|
|
$self->_member_helper_write($member, $node, \$idx); |
|
1760
|
|
|
|
|
|
|
} |
|
1761
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1762
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1763
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
1764
|
0
|
|
|
|
|
|
close $FH; |
|
1765
|
|
|
|
|
|
|
} |
|
1766
|
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
sub _struct { |
|
1768
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
1769
|
|
|
|
|
|
|
|
|
1770
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
1771
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1772
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
1773
|
0
|
|
|
|
|
|
print $FH "public final class ",$node->{java_name}," implements org.omg.CORBA.portable.IDLEntity\n"; |
|
1774
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
1775
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
1776
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
1777
|
|
|
|
|
|
|
} |
|
1778
|
|
|
|
|
|
|
else { |
|
1779
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
1780
|
|
|
|
|
|
|
} |
|
1781
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1782
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1783
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1784
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($member); |
|
1785
|
0
|
|
|
|
|
|
print $FH " public ",$member->{java_type}," ",$member->{java_name},";\n"; |
|
1786
|
|
|
|
|
|
|
} |
|
1787
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1788
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," ()\n"; |
|
1789
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1790
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1791
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1792
|
0
|
|
|
|
|
|
print $FH " ",$member->{java_name}," = ",$member->{java_init},";\n"; |
|
1793
|
|
|
|
|
|
|
} |
|
1794
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1795
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1796
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," ("; |
|
1797
|
0
|
|
|
|
|
|
my $first = 1; |
|
1798
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1799
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1800
|
0
|
0
|
|
|
|
|
print $FH ", " unless ($first); |
|
1801
|
0
|
|
|
|
|
|
print $FH $member->{java_type}," _",$member->{java_name}; |
|
1802
|
0
|
|
|
|
|
|
$first = 0; |
|
1803
|
|
|
|
|
|
|
} |
|
1804
|
0
|
|
|
|
|
|
print $FH ")\n"; |
|
1805
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1806
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1807
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1808
|
0
|
|
|
|
|
|
print $FH " ",$member->{java_name}," = _",$member->{java_name},";\n"; |
|
1809
|
|
|
|
|
|
|
} |
|
1810
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1811
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1812
|
0
|
0
|
|
|
|
|
if ($self->{toString}) { |
|
1813
|
0
|
|
|
|
|
|
print $FH " public java.lang.String toString ()\n"; |
|
1814
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1815
|
0
|
|
|
|
|
|
print $FH " java.lang.StringBuffer _ret = new java.lang.StringBuffer (\"struct ",$node->{java_name}," {\");\n"; |
|
1816
|
0
|
|
|
|
|
|
$first = 1; |
|
1817
|
0
|
|
|
|
|
|
my $idx = 0; |
|
1818
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1819
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1820
|
0
|
0
|
|
|
|
|
if ($first) { |
|
1821
|
0
|
|
|
|
|
|
$first = 0; |
|
1822
|
|
|
|
|
|
|
} |
|
1823
|
|
|
|
|
|
|
else { |
|
1824
|
0
|
|
|
|
|
|
print $FH " _ret.append (\",\");\n"; |
|
1825
|
|
|
|
|
|
|
} |
|
1826
|
0
|
|
|
|
|
|
$self->_member_toString($member, $node, \$idx); |
|
1827
|
|
|
|
|
|
|
} |
|
1828
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"\\n}\");\n"; |
|
1829
|
0
|
|
|
|
|
|
print $FH " return _ret.toString ();\n"; |
|
1830
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1831
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1832
|
|
|
|
|
|
|
} |
|
1833
|
0
|
0
|
|
|
|
|
if ($self->{equals}) { |
|
1834
|
0
|
|
|
|
|
|
print $FH " public boolean equals (java.lang.Object o)\n"; |
|
1835
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1836
|
0
|
|
|
|
|
|
print $FH " if (this == o) return true;\n"; |
|
1837
|
0
|
|
|
|
|
|
print $FH " if (o == null) return false;\n"; |
|
1838
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1839
|
0
|
|
|
|
|
|
print $FH " if (o instanceof ",$node->{java_name},")\n"; |
|
1840
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1841
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_name}," obj = (",$node->{java_name},")o;\n"; |
|
1842
|
0
|
|
|
|
|
|
print $FH " boolean res;\n"; |
|
1843
|
0
|
|
|
|
|
|
$first = 1; |
|
1844
|
0
|
|
|
|
|
|
my $idx = 0; |
|
1845
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
1846
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
1847
|
0
|
0
|
|
|
|
|
if ($first) { |
|
1848
|
0
|
|
|
|
|
|
$first = 0; |
|
1849
|
|
|
|
|
|
|
} |
|
1850
|
|
|
|
|
|
|
else { |
|
1851
|
0
|
|
|
|
|
|
print $FH " if (!res) return false;\n"; |
|
1852
|
|
|
|
|
|
|
} |
|
1853
|
0
|
|
|
|
|
|
$self->_member_equals($member, $node, \$idx); |
|
1854
|
|
|
|
|
|
|
} |
|
1855
|
0
|
|
|
|
|
|
print $FH " return res;\n"; |
|
1856
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1857
|
0
|
|
|
|
|
|
print $FH " return false;\n"; |
|
1858
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1859
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1860
|
0
|
|
|
|
|
|
print $FH " public int hashCode ()\n"; |
|
1861
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
1862
|
0
|
|
|
|
|
|
print $FH " // this method returns always the same value, to force equals() to be called.\n"; |
|
1863
|
0
|
|
|
|
|
|
print $FH " return 0;\n"; |
|
1864
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
1865
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
1866
|
|
|
|
|
|
|
} |
|
1867
|
0
|
|
|
|
|
|
print $FH "} // class ",$node->{java_name},"\n"; |
|
1868
|
0
|
|
|
|
|
|
close $FH; |
|
1869
|
|
|
|
|
|
|
} |
|
1870
|
|
|
|
|
|
|
|
|
1871
|
|
|
|
|
|
|
sub visitStructType { |
|
1872
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
1873
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
1874
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
1875
|
0
|
0
|
|
|
|
|
return if (exists $self->{done_hash}->{$node->{java_Name}}); |
|
1876
|
0
|
|
|
|
|
|
$self->{done_hash}->{$node->{java_Name}} = 1; |
|
1877
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
1878
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{type}); |
|
1879
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType') |
|
1880
|
|
|
|
|
|
|
or $type->isa('UnionType') ) { |
|
1881
|
0
|
|
|
|
|
|
$type->visit($self); |
|
1882
|
|
|
|
|
|
|
} |
|
1883
|
|
|
|
|
|
|
} |
|
1884
|
|
|
|
|
|
|
|
|
1885
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
1886
|
0
|
|
|
|
|
|
$self->_struct_helper($node); |
|
1887
|
0
|
|
|
|
|
|
$self->_struct($node); |
|
1888
|
0
|
0
|
|
|
|
|
$self->_struct_helperXML($node) if ($self->can('_struct_helperXML')); |
|
1889
|
|
|
|
|
|
|
} |
|
1890
|
|
|
|
|
|
|
|
|
1891
|
|
|
|
|
|
|
sub _member_helper_type { |
|
1892
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
1893
|
0
|
|
|
|
|
|
my ($member, $parent, $i) = @_; |
|
1894
|
|
|
|
|
|
|
|
|
1895
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1896
|
0
|
|
|
|
|
|
my $tab = ' '; |
|
1897
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($member->{type}); |
|
1898
|
0
|
|
|
|
|
|
my @array_max = (); |
|
1899
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
1900
|
0
|
0
|
|
|
|
|
if (exists $type->{max}) { |
|
1901
|
0
|
|
|
|
|
|
push @array_max, $type->{max}; |
|
1902
|
|
|
|
|
|
|
} |
|
1903
|
|
|
|
|
|
|
else { |
|
1904
|
0
|
|
|
|
|
|
push @array_max, undef; |
|
1905
|
|
|
|
|
|
|
} |
|
1906
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1907
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) { |
|
1908
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1909
|
|
|
|
|
|
|
} |
|
1910
|
|
|
|
|
|
|
} |
|
1911
|
0
|
|
|
|
|
|
print $FH $tab,"_tcOf_members0 = ",$type->{java_type_code},";\n"; |
|
1912
|
0
|
|
|
|
|
|
foreach (reverse @array_max) { |
|
1913
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
1914
|
0
|
|
|
|
|
|
print $FH $tab,"_tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (",$_->{java_literal},", _tcOf_members0);\n"; |
|
1915
|
|
|
|
|
|
|
} |
|
1916
|
|
|
|
|
|
|
else { |
|
1917
|
0
|
|
|
|
|
|
print $FH $tab,"_tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);\n"; |
|
1918
|
|
|
|
|
|
|
} |
|
1919
|
|
|
|
|
|
|
} |
|
1920
|
0
|
0
|
|
|
|
|
if (exists $member->{array_size}) { |
|
1921
|
0
|
|
|
|
|
|
foreach (@{$member->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1922
|
0
|
|
|
|
|
|
print $FH $tab,"_tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (",$_->{java_literal},", _tcOf_members0 );\n"; |
|
1923
|
|
|
|
|
|
|
} |
|
1924
|
|
|
|
|
|
|
} |
|
1925
|
0
|
0
|
|
|
|
|
if ($parent->isa('Value')) { |
|
|
|
0
|
|
|
|
|
|
|
1926
|
0
|
|
|
|
|
|
print $FH $tab,"_members0[",$i,"] = new org.omg.CORBA.ValueMember (\n"; |
|
1927
|
|
|
|
|
|
|
} |
|
1928
|
|
|
|
|
|
|
elsif ($parent->isa('UnionType')) { |
|
1929
|
0
|
|
|
|
|
|
print $FH $tab,"_members0[",$i,"] = new org.omg.CORBA.UnionMember (\n"; |
|
1930
|
|
|
|
|
|
|
} |
|
1931
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
1932
|
0
|
|
|
|
|
|
print $FH $tab,"_members0[",$i,"] = new org.omg.CORBA.StructMember (\n"; |
|
1933
|
|
|
|
|
|
|
} |
|
1934
|
0
|
|
|
|
|
|
print $FH $tab," \"",$member->{java_name},"\",\n"; |
|
1935
|
0
|
0
|
|
|
|
|
if ($parent->isa('Value')) { |
|
|
|
0
|
|
|
|
|
|
|
1936
|
0
|
|
|
|
|
|
print $FH $tab," \"\",\n"; |
|
1937
|
0
|
|
|
|
|
|
print $FH $tab," _id,\n"; |
|
1938
|
0
|
|
|
|
|
|
print $FH $tab," \"\",\n"; |
|
1939
|
|
|
|
|
|
|
} |
|
1940
|
|
|
|
|
|
|
elsif ($parent->isa('UnionType')) { |
|
1941
|
0
|
|
|
|
|
|
print $FH $tab," _anyOf_members0,\n"; |
|
1942
|
|
|
|
|
|
|
} |
|
1943
|
0
|
|
|
|
|
|
print $FH $tab," _tcOf_members0,\n"; |
|
1944
|
0
|
0
|
|
|
|
|
if ($parent->isa('Value')) { |
|
1945
|
0
|
0
|
|
|
|
|
my $mod = ($member->{modifier} eq "private") ? "PRIVATE_MEMBER" : "PUBLIC_MEMBER"; |
|
1946
|
0
|
|
|
|
|
|
print $FH $tab," null,\n"; |
|
1947
|
0
|
|
|
|
|
|
print $FH $tab," org.omg.CORBA.",$mod,".value);\n"; |
|
1948
|
|
|
|
|
|
|
} |
|
1949
|
|
|
|
|
|
|
else { |
|
1950
|
0
|
|
|
|
|
|
print $FH $tab," null);\n"; |
|
1951
|
|
|
|
|
|
|
} |
|
1952
|
|
|
|
|
|
|
} |
|
1953
|
|
|
|
|
|
|
|
|
1954
|
|
|
|
|
|
|
sub _member_helper_read { |
|
1955
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
1956
|
0
|
|
|
|
|
|
my ($member, $parent, $r_idx) = @_; |
|
1957
|
|
|
|
|
|
|
|
|
1958
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
1959
|
0
|
|
|
|
|
|
my $label = q{}; |
|
1960
|
0
|
0
|
|
|
|
|
unless ($member->isa('StateMember')) { |
|
1961
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
1962
|
0
|
|
|
|
|
|
$label = '_'; |
|
1963
|
|
|
|
|
|
|
} |
|
1964
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
1965
|
0
|
|
|
|
|
|
$label = 'value.'; |
|
1966
|
|
|
|
|
|
|
} |
|
1967
|
|
|
|
|
|
|
} |
|
1968
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($member->{type}); |
|
1969
|
0
|
|
|
|
|
|
my $typeh = $type; |
|
1970
|
0
|
|
|
|
|
|
my $name = $member->{java_name}; |
|
1971
|
0
|
|
|
|
|
|
my @tab = (q{ } x 4); |
|
1972
|
0
|
0
|
|
|
|
|
push @tab, q{ } x 4 if ($parent->isa('UnionType')); |
|
1973
|
0
|
|
|
|
|
|
my $idx = q{}; |
|
1974
|
0
|
|
|
|
|
|
my @array1 = (); |
|
1975
|
0
|
0
|
|
|
|
|
if (exists $member->{array_size}) { |
|
1976
|
0
|
|
|
|
|
|
foreach (@{$member->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1977
|
0
|
|
|
|
|
|
push @array1, '[]'; |
|
1978
|
|
|
|
|
|
|
} |
|
1979
|
|
|
|
|
|
|
} |
|
1980
|
0
|
|
|
|
|
|
my @array_max = (); |
|
1981
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
1982
|
0
|
|
|
|
|
|
push @array1, '[]'; |
|
1983
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1984
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) { |
|
1985
|
0
|
0
|
|
|
|
|
if (exists $type->{array_size}) { |
|
1986
|
0
|
|
|
|
|
|
foreach (@{$type->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
1987
|
0
|
|
|
|
|
|
push @array1, '[]'; |
|
1988
|
|
|
|
|
|
|
} |
|
1989
|
|
|
|
|
|
|
} |
|
1990
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
1991
|
|
|
|
|
|
|
} |
|
1992
|
|
|
|
|
|
|
} |
|
1993
|
0
|
|
|
|
|
|
while ($typeh->isa('SequenceType')) { |
|
1994
|
0
|
0
|
|
|
|
|
if (exists $typeh->{max}) { |
|
1995
|
0
|
|
|
|
|
|
push @array_max, $typeh->{max}; |
|
1996
|
|
|
|
|
|
|
} |
|
1997
|
|
|
|
|
|
|
else { |
|
1998
|
0
|
|
|
|
|
|
push @array_max, undef; |
|
1999
|
|
|
|
|
|
|
} |
|
2000
|
0
|
|
|
|
|
|
$typeh = $self->_get_defn($typeh->{type}); |
|
2001
|
|
|
|
|
|
|
} |
|
2002
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
2003
|
0
|
|
|
|
|
|
print $FH @tab,$member->{java_type}," _",$member->{java_name}," = ",$member->{java_init},";\n"; |
|
2004
|
|
|
|
|
|
|
} |
|
2005
|
0
|
0
|
|
|
|
|
if (exists $member->{array_size}) { |
|
2006
|
0
|
|
|
|
|
|
my $java_array = $member->{java_array}; |
|
2007
|
0
|
|
|
|
|
|
foreach (@{$member->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
2008
|
0
|
|
|
|
|
|
$java_array =~ s/^\[\]/\[$_->{java_literal}\]/; |
|
2009
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
2010
|
0
|
|
|
|
|
|
print $FH @tab,"_",$name,$idx," = new ",$member->{type_java}->{java_Name}," ",$java_array,";\n"; |
|
2011
|
|
|
|
|
|
|
} |
|
2012
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
2013
|
0
|
|
|
|
|
|
print $FH @tab,$label,$name,$idx," = new ",$member->{type_java}->{java_Name}," ",$java_array,";\n"; |
|
2014
|
|
|
|
|
|
|
} |
|
2015
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _o",$$r_idx," = 0; _o",$$r_idx," < (",$_->{java_literal},"); _o",$$r_idx,"++)\n"; |
|
2016
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2017
|
0
|
|
|
|
|
|
$java_array =~ s/^\[[^\]]+\]//; |
|
2018
|
0
|
|
|
|
|
|
pop @array1; |
|
2019
|
0
|
|
|
|
|
|
$idx .= '[_o' . $$r_idx . ']'; |
|
2020
|
0
|
|
|
|
|
|
$$r_idx ++; |
|
2021
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
2022
|
|
|
|
|
|
|
} |
|
2023
|
|
|
|
|
|
|
} |
|
2024
|
0
|
|
|
|
|
|
foreach (@array_max) { |
|
2025
|
0
|
|
|
|
|
|
pop @array1; |
|
2026
|
0
|
|
|
|
|
|
print $FH @tab,"int _len",$$r_idx," = \$is.read_long ();\n"; |
|
2027
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
2028
|
0
|
|
|
|
|
|
print $FH @tab,"if (_len",$$r_idx," > (",$_->{java_literal},"))\n"; |
|
2029
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
2030
|
|
|
|
|
|
|
} |
|
2031
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
2032
|
0
|
|
|
|
|
|
print $FH @tab,"_",$name,$idx," = new ",$type->{java_Name}," [_len",$$r_idx,"]",@array1,";\n"; |
|
2033
|
|
|
|
|
|
|
} |
|
2034
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
2035
|
0
|
|
|
|
|
|
print $FH @tab,$label,$name,$idx," = new ",$type->{java_Name}," [_len",$$r_idx,"]",@array1,";\n"; |
|
2036
|
|
|
|
|
|
|
} |
|
2037
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _o",$$r_idx," = 0; _o",$$r_idx," < ",$label,$name,$idx,".length; _o",$$r_idx,"++)\n"; |
|
2038
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2039
|
0
|
|
|
|
|
|
$idx .= '[_o' . $$r_idx . ']'; |
|
2040
|
0
|
|
|
|
|
|
$$r_idx ++; |
|
2041
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
2042
|
|
|
|
|
|
|
} |
|
2043
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
2044
|
0
|
|
|
|
|
|
print $FH @tab,"_",$name,$idx," = ",$typeh->{java_read},";\n"; |
|
2045
|
|
|
|
|
|
|
} |
|
2046
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
2047
|
0
|
|
|
|
|
|
print $FH @tab,$label,$name,$idx," = ",$typeh->{java_read},";\n"; |
|
2048
|
|
|
|
|
|
|
} |
|
2049
|
0
|
0
|
0
|
|
|
|
if (($type->isa('StringType') or $type->isa('WideStringType')) and exists $type->{max}) { |
|
|
|
|
0
|
|
|
|
|
|
2050
|
0
|
|
|
|
|
|
print $FH @tab,"if (",$label,$name,$idx,".length () > (",$type->{max}->{java_literal},"))\n"; |
|
2051
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
2052
|
|
|
|
|
|
|
} |
|
2053
|
0
|
|
|
|
|
|
foreach (@array_max) { |
|
2054
|
0
|
|
|
|
|
|
pop @tab; |
|
2055
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2056
|
|
|
|
|
|
|
} |
|
2057
|
0
|
0
|
|
|
|
|
if (exists $member->{array_size}) { |
|
2058
|
0
|
|
|
|
|
|
foreach (@{$member->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
2059
|
0
|
|
|
|
|
|
pop @tab; |
|
2060
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2061
|
|
|
|
|
|
|
} |
|
2062
|
|
|
|
|
|
|
} |
|
2063
|
|
|
|
|
|
|
} |
|
2064
|
|
|
|
|
|
|
|
|
2065
|
|
|
|
|
|
|
sub _member_helper_write { |
|
2066
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
2067
|
0
|
|
|
|
|
|
my ($member, $parent, $r_idx) = @_; |
|
2068
|
|
|
|
|
|
|
|
|
2069
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2070
|
0
|
0
|
|
|
|
|
my $label = ($member->isa('StateMember')) ? q{} : 'value.'; |
|
2071
|
0
|
0
|
|
|
|
|
my $len = ($parent->isa('UnionType')) ? ' ()' : q{}; |
|
2072
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($member->{type}); |
|
2073
|
0
|
|
|
|
|
|
my $typeh = $type; |
|
2074
|
0
|
|
|
|
|
|
my $name = $member->{java_name}; |
|
2075
|
0
|
|
|
|
|
|
my @tab = (q{ } x 4); |
|
2076
|
0
|
0
|
|
|
|
|
push @tab, q{ } x 4 if ($parent->isa('UnionType')); |
|
2077
|
0
|
|
|
|
|
|
my $idx = q{}; |
|
2078
|
0
|
0
|
|
|
|
|
if (exists $member->{array_size}) { |
|
2079
|
0
|
|
|
|
|
|
foreach (@{$member->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
2080
|
0
|
|
|
|
|
|
print $FH @tab,"if (",$label,$name,$len,$idx,".length != (",$_->{java_literal},"))\n"; |
|
2081
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
2082
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _i",$$r_idx," = 0; _i",$$r_idx," < (",$_->{java_literal},"); _i",$$r_idx,"++)\n"; |
|
2083
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2084
|
0
|
|
|
|
|
|
$idx .= '[_i' . $$r_idx . ']'; |
|
2085
|
0
|
|
|
|
|
|
$$r_idx ++; |
|
2086
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
2087
|
|
|
|
|
|
|
} |
|
2088
|
|
|
|
|
|
|
} |
|
2089
|
0
|
|
|
|
|
|
my @array_max = (); |
|
2090
|
0
|
|
|
|
|
|
while ($type->isa('SequenceType')) { |
|
2091
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
2092
|
0
|
|
|
|
|
|
while ($type->isa('TypeDeclarator')) { |
|
2093
|
0
|
|
|
|
|
|
$type = $self->_get_defn($type->{type}); |
|
2094
|
|
|
|
|
|
|
} |
|
2095
|
|
|
|
|
|
|
} |
|
2096
|
0
|
|
|
|
|
|
while ($typeh->isa('SequenceType')) { |
|
2097
|
0
|
0
|
|
|
|
|
if (exists $typeh->{max}) { |
|
2098
|
0
|
|
|
|
|
|
push @array_max, $typeh->{max}; |
|
2099
|
|
|
|
|
|
|
} |
|
2100
|
|
|
|
|
|
|
else { |
|
2101
|
0
|
|
|
|
|
|
push @array_max, undef; |
|
2102
|
|
|
|
|
|
|
} |
|
2103
|
0
|
|
|
|
|
|
$typeh = $self->_get_defn($typeh->{type}); |
|
2104
|
|
|
|
|
|
|
} |
|
2105
|
0
|
|
|
|
|
|
foreach (@array_max) { |
|
2106
|
0
|
0
|
|
|
|
|
if (defined $_) { |
|
2107
|
0
|
|
|
|
|
|
print $FH @tab,"if (",$label,$name,$len,$idx,".length > (",$_->{java_literal},"))\n"; |
|
2108
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
2109
|
|
|
|
|
|
|
} |
|
2110
|
0
|
|
|
|
|
|
print $FH @tab,"\$os.write_long (",$label,$name,$len,$idx,".length);\n"; |
|
2111
|
0
|
|
|
|
|
|
print $FH @tab,"for (int _i",$$r_idx," = 0; _i",$$r_idx," < ",$label,$name,$len,$idx,".length; _i",$$r_idx,"++)\n"; |
|
2112
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2113
|
0
|
|
|
|
|
|
$idx .= '[_i' . $$r_idx . ']'; |
|
2114
|
0
|
|
|
|
|
|
$$r_idx ++; |
|
2115
|
0
|
|
|
|
|
|
push @tab, q{ } x 2; |
|
2116
|
|
|
|
|
|
|
} |
|
2117
|
0
|
0
|
0
|
|
|
|
if (($type->isa('StringType') or $type->isa('WideStringType')) and exists $type->{max}) { |
|
|
|
|
0
|
|
|
|
|
|
2118
|
0
|
|
|
|
|
|
print $FH @tab,"if (",$label,$name,$len,$idx,".length () > (",$type->{max}->{java_literal},"))\n"; |
|
2119
|
0
|
|
|
|
|
|
print $FH @tab," throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);\n"; |
|
2120
|
|
|
|
|
|
|
} |
|
2121
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
2122
|
0
|
|
|
|
|
|
print $FH @tab,$typeh->{java_write},$label,$name," ()",$idx,");\n"; |
|
2123
|
|
|
|
|
|
|
} |
|
2124
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
2125
|
0
|
|
|
|
|
|
print $FH @tab,$typeh->{java_write},$label,$name,$idx,");\n"; |
|
2126
|
|
|
|
|
|
|
} |
|
2127
|
0
|
|
|
|
|
|
foreach (@array_max) { |
|
2128
|
0
|
|
|
|
|
|
pop @tab; |
|
2129
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2130
|
|
|
|
|
|
|
} |
|
2131
|
0
|
0
|
|
|
|
|
if (exists $member->{array_size}) { |
|
2132
|
0
|
|
|
|
|
|
foreach (@{$member->{array_size}}) { |
|
|
0
|
|
|
|
|
|
|
|
2133
|
0
|
|
|
|
|
|
pop @tab; |
|
2134
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2135
|
|
|
|
|
|
|
} |
|
2136
|
|
|
|
|
|
|
} |
|
2137
|
|
|
|
|
|
|
} |
|
2138
|
|
|
|
|
|
|
|
|
2139
|
|
|
|
|
|
|
sub _member_toString { |
|
2140
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
2141
|
0
|
|
|
|
|
|
my ($member, $parent, $r_idx) = @_; |
|
2142
|
|
|
|
|
|
|
|
|
2143
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2144
|
0
|
|
|
|
|
|
my $name = $member->{java_name}; |
|
2145
|
0
|
|
|
|
|
|
my $label = q{}; |
|
2146
|
0
|
0
|
|
|
|
|
my $len = ($parent->isa('UnionType')) ? ' ()' : q{}; |
|
2147
|
0
|
|
|
|
|
|
my @tab = (q{ } x 4); |
|
2148
|
0
|
0
|
|
|
|
|
push @tab, q{ } x 4 if ($parent->isa('UnionType')); |
|
2149
|
0
|
|
|
|
|
|
print $FH @tab,"_ret.append (\"\\n",$member->{java_type}," ",$member->{java_name},"=\");\n"; |
|
2150
|
0
|
|
|
|
|
|
my $idx = q{}; |
|
2151
|
0
|
|
|
|
|
|
foreach (my $a = 0; $a < length($member->{java_array})/2; $a ++) { |
|
2152
|
0
|
|
|
|
|
|
print $FH @tab,"_ret.append (\"{\");\n"; |
|
2153
|
0
|
|
|
|
|
|
print $FH @tab,"if (",$label,$name,$len,$idx," == null)\n"; |
|
2154
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2155
|
0
|
|
|
|
|
|
print $FH @tab," _ret.append (",$label,$name,$len,$idx,");\n"; |
|
2156
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2157
|
0
|
|
|
|
|
|
print $FH @tab,"else\n"; |
|
2158
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2159
|
0
|
|
|
|
|
|
print $FH @tab," for (int _i",$$r_idx," = 0; _i",$$r_idx," < ",$label,$name,$len,$idx,".length; _i",$$r_idx,"++)\n"; |
|
2160
|
0
|
|
|
|
|
|
print $FH @tab," {\n"; |
|
2161
|
0
|
0
|
|
|
|
|
unless ($member->{type_java}->isa("BasicType")) { |
|
2162
|
0
|
|
|
|
|
|
print $FH @tab," _ret.append (\"\\n\");\n"; |
|
2163
|
|
|
|
|
|
|
} |
|
2164
|
0
|
|
|
|
|
|
$idx .= '[_i' . $$r_idx . ']'; |
|
2165
|
0
|
|
|
|
|
|
$$r_idx ++; |
|
2166
|
0
|
|
|
|
|
|
push @tab, q{ } x 4; |
|
2167
|
|
|
|
|
|
|
} |
|
2168
|
0
|
0
|
|
|
|
|
if ($parent->isa('UnionType')) { |
|
2169
|
0
|
0
|
0
|
|
|
|
if ( $member->{type_java}->isa('StringType') |
|
2170
|
|
|
|
|
|
|
or $member->{type_java}->isa('WideStringType') ) { |
|
2171
|
0
|
|
|
|
|
|
print $FH @tab,"_ret.append (",$label,$name," ()",$idx," != null ? '\\\"' + ",$label,$name," ()",$idx," + '\\\"' : null);\n"; |
|
2172
|
|
|
|
|
|
|
} |
|
2173
|
|
|
|
|
|
|
else { |
|
2174
|
0
|
|
|
|
|
|
print $FH @tab,"_ret.append (",$label,$name," ()",$idx,");\n"; |
|
2175
|
|
|
|
|
|
|
} |
|
2176
|
|
|
|
|
|
|
} |
|
2177
|
|
|
|
|
|
|
else { # StructType or ExceptionType |
|
2178
|
0
|
0
|
0
|
|
|
|
if ( $member->{type_java}->isa('StringType') |
|
2179
|
|
|
|
|
|
|
or $member->{type_java}->isa('WideStringType') ) { |
|
2180
|
0
|
|
|
|
|
|
print $FH @tab,"_ret.append (",$label,$name,$idx," != null ? '\\\"' + ",$label,$name,$idx," + '\\\"' : null);\n"; |
|
2181
|
|
|
|
|
|
|
} |
|
2182
|
|
|
|
|
|
|
else { |
|
2183
|
0
|
|
|
|
|
|
print $FH @tab,"_ret.append (",$label,$name,$idx,");\n"; |
|
2184
|
|
|
|
|
|
|
} |
|
2185
|
|
|
|
|
|
|
} |
|
2186
|
0
|
|
|
|
|
|
foreach (my $a = 0; $a < length($member->{java_array})/2; $a ++) { |
|
2187
|
0
|
|
|
|
|
|
pop @tab; |
|
2188
|
0
|
|
|
|
|
|
$idx =~ s/\[[^\]]+\]$//; |
|
2189
|
0
|
|
|
|
|
|
print $FH @tab," if (_i",$$r_idx-$a-1," < ",$label,$name,$len,$idx,".length - 1)\n"; |
|
2190
|
0
|
|
|
|
|
|
print $FH @tab," {\n"; |
|
2191
|
0
|
|
|
|
|
|
print $FH @tab," _ret.append (\",\");\n"; |
|
2192
|
0
|
|
|
|
|
|
print $FH @tab," }\n"; |
|
2193
|
0
|
|
|
|
|
|
print $FH @tab," }\n"; |
|
2194
|
0
|
0
|
|
|
|
|
unless ($member->{type_java}->isa("BasicType")) { |
|
2195
|
0
|
|
|
|
|
|
print $FH @tab," _ret.append (\"\\n\");\n"; |
|
2196
|
|
|
|
|
|
|
} |
|
2197
|
0
|
|
|
|
|
|
print $FH @tab," _ret.append (\"}\");\n"; |
|
2198
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2199
|
|
|
|
|
|
|
} |
|
2200
|
|
|
|
|
|
|
} |
|
2201
|
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
sub _member_equals { |
|
2203
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
2204
|
0
|
|
|
|
|
|
my ($member, $parent, $r_idx) = @_; |
|
2205
|
|
|
|
|
|
|
|
|
2206
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2207
|
0
|
|
|
|
|
|
my $name = $member->{java_name}; |
|
2208
|
0
|
|
|
|
|
|
my $label = q{}; |
|
2209
|
0
|
|
|
|
|
|
my @tab = (q{ } x 6); |
|
2210
|
0
|
|
|
|
|
|
my $idx = q{}; |
|
2211
|
0
|
|
|
|
|
|
foreach (my $a = 0; $a < length($member->{java_array})/2; $a ++) { |
|
2212
|
0
|
|
|
|
|
|
print $FH @tab,"if (res = (this.",$label,$name,$idx,".length == obj.",$label,$name,$idx,".length))\n"; |
|
2213
|
0
|
|
|
|
|
|
print $FH @tab,"{\n"; |
|
2214
|
0
|
|
|
|
|
|
print $FH @tab," for (int _i",$$r_idx," = 0; res && _i",$$r_idx," < this.",$label,$name,$idx,".length; _i",$$r_idx,"++)\n"; |
|
2215
|
0
|
|
|
|
|
|
print $FH @tab," {\n"; |
|
2216
|
0
|
|
|
|
|
|
$idx .= '[_i' . $$r_idx . ']'; |
|
2217
|
0
|
|
|
|
|
|
$$r_idx ++; |
|
2218
|
0
|
|
|
|
|
|
push @tab, q{ } x 4; |
|
2219
|
|
|
|
|
|
|
} |
|
2220
|
0
|
0
|
0
|
|
|
|
if ( $member->{type_java}->isa('StringType') |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
or $member->{type_java}->isa('WideStringType') |
|
2222
|
|
|
|
|
|
|
or $member->{type_java}->isa('StructType') |
|
2223
|
|
|
|
|
|
|
or $member->{type_java}->isa('UnionType') |
|
2224
|
|
|
|
|
|
|
or $member->{type_java}->isa('Interface') |
|
2225
|
|
|
|
|
|
|
or $member->{type_java}->isa('Value') ) { |
|
2226
|
0
|
|
|
|
|
|
print $FH @tab,"res = (this.",$label,$name,$idx," == null && obj.",$label,$name,$idx," == null) || (this.",$label,$name,$idx," != null && this.",$member->{java_name},".equals(obj.",$label,$name,$idx,"));\n"; |
|
2227
|
|
|
|
|
|
|
} |
|
2228
|
|
|
|
|
|
|
else { |
|
2229
|
0
|
|
|
|
|
|
print $FH @tab,"res = (this.",$label,$name,$idx," == obj.",$label,$name,$idx,");\n"; |
|
2230
|
|
|
|
|
|
|
} |
|
2231
|
0
|
|
|
|
|
|
foreach (my $a = 0; $a < length($member->{java_array})/2; $a ++) { |
|
2232
|
0
|
|
|
|
|
|
pop @tab; |
|
2233
|
0
|
|
|
|
|
|
print $FH @tab," }\n"; |
|
2234
|
0
|
|
|
|
|
|
print $FH @tab,"}\n"; |
|
2235
|
|
|
|
|
|
|
} |
|
2236
|
|
|
|
|
|
|
} |
|
2237
|
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions |
|
2239
|
|
|
|
|
|
|
# |
|
2240
|
|
|
|
|
|
|
|
|
2241
|
|
|
|
|
|
|
sub _union_helper { |
|
2242
|
0
|
|
|
0
|
|
|
my ($self, $node, $dis, $effective_dis) = @_; |
|
2243
|
|
|
|
|
|
|
|
|
2244
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
2245
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2246
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
2247
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
2248
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
2249
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2250
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
2251
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2252
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
2253
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
2254
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
2255
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
2256
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2257
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2258
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
2259
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2260
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
2261
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2262
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2263
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
2264
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
2265
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
2266
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2267
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
2268
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2269
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
2270
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2271
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
2272
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2273
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
2274
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2275
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
2276
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2277
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
2278
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.TypeCode _disTypeCode0;\n"; |
|
2279
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2280
|
0
|
|
|
|
|
|
print $FH " _disTypeCode0 = ",$dis->{java_Name},"Helper.type ();\n"; |
|
2281
|
|
|
|
|
|
|
} |
|
2282
|
|
|
|
|
|
|
else { |
|
2283
|
0
|
|
|
|
|
|
print $FH " _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_",$dis->{java_tk},");\n"; |
|
2284
|
|
|
|
|
|
|
} |
|
2285
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [",scalar(keys %{$node->{hash_member}}),"];\n"; |
|
|
0
|
|
|
|
|
|
|
|
2286
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.TypeCode _tcOf_members0;\n"; |
|
2287
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.Any _anyOf_members0;\n"; |
|
2288
|
0
|
|
|
|
|
|
my $i = 0; |
|
2289
|
0
|
|
|
|
|
|
foreach my $case (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2290
|
0
|
|
|
|
|
|
my $elt = $case->{element}; |
|
2291
|
0
|
|
|
|
|
|
my $value = $self->_get_defn($elt->{value}); |
|
2292
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { # default or expression |
|
|
0
|
|
|
|
|
|
|
|
2293
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2294
|
0
|
0
|
|
|
|
|
if ($_->isa('Default')) { |
|
2295
|
0
|
|
|
|
|
|
print $FH " // Branch for ",$value->{java_name}," (Default case)\n"; |
|
2296
|
0
|
|
|
|
|
|
print $FH " _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();\n"; |
|
2297
|
0
|
|
|
|
|
|
print $FH " _anyOf_members0.insert_octet ((byte)0); // default member label\n"; |
|
2298
|
|
|
|
|
|
|
} |
|
2299
|
|
|
|
|
|
|
else { |
|
2300
|
0
|
|
|
|
|
|
print $FH " // Branch for ",$value->{java_name}," (case label ",$_->{java_literal},")\n"; |
|
2301
|
0
|
|
|
|
|
|
print $FH " _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();\n"; |
|
2302
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2303
|
0
|
|
|
|
|
|
print $FH " ",$dis->{java_Name},"Helper.insert (_anyOf_members0, ",$_->{value}->{java_literal},");\n"; |
|
2304
|
|
|
|
|
|
|
} |
|
2305
|
|
|
|
|
|
|
else { |
|
2306
|
0
|
|
|
|
|
|
print $FH " _anyOf_members0.insert_",$dis->{java_tk}," (",$_->{java_literal},");\n"; |
|
2307
|
|
|
|
|
|
|
# TODO |
|
2308
|
|
|
|
|
|
|
} |
|
2309
|
|
|
|
|
|
|
} |
|
2310
|
0
|
|
|
|
|
|
$self->_member_helper_type($value, $node, $i); |
|
2311
|
0
|
|
|
|
|
|
$i ++; |
|
2312
|
|
|
|
|
|
|
} |
|
2313
|
|
|
|
|
|
|
} |
|
2314
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (_id, \"",$node->{java_name},"\", _disTypeCode0, _members0);\n"; |
|
2315
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
2316
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2317
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2318
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2319
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
2320
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2321
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2322
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
2323
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2324
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
2325
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2326
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2327
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
2328
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2329
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_Name}," value = new ",$node->{java_Name}," ();\n"; |
|
2330
|
0
|
|
|
|
|
|
print $FH " ",$effective_dis->{java_Name}," _dis0 = ",$effective_dis->{java_init},";\n"; |
|
2331
|
0
|
|
|
|
|
|
print $FH " _dis0 = ",$dis->{java_read},";\n"; |
|
2332
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
|
|
0
|
|
|
|
|
|
|
2333
|
0
|
|
|
|
|
|
print $FH " switch (_dis0.value ())\n"; |
|
2334
|
|
|
|
|
|
|
} |
|
2335
|
|
|
|
|
|
|
elsif ($effective_dis->isa('BooleanType')) { |
|
2336
|
0
|
|
|
|
|
|
print $FH " int __dis0 = (_dis0) ? 1 : 0;\n"; |
|
2337
|
0
|
|
|
|
|
|
print $FH " switch (__dis0)\n"; |
|
2338
|
|
|
|
|
|
|
} |
|
2339
|
|
|
|
|
|
|
else { |
|
2340
|
0
|
|
|
|
|
|
print $FH " switch (_dis0)\n"; |
|
2341
|
|
|
|
|
|
|
} |
|
2342
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2343
|
0
|
|
|
|
|
|
my $idx = 0; |
|
2344
|
0
|
|
|
|
|
|
foreach my $case (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2345
|
0
|
|
|
|
|
|
my $flag_default = 0; |
|
2346
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { # default or expression |
|
|
0
|
|
|
|
|
|
|
|
2347
|
0
|
0
|
|
|
|
|
if ($_->isa('Default')) { |
|
2348
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2349
|
0
|
|
|
|
|
|
$flag_default = 1; |
|
2350
|
|
|
|
|
|
|
} |
|
2351
|
|
|
|
|
|
|
else { |
|
2352
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('BooleanType')) { |
|
2353
|
0
|
0
|
|
|
|
|
my $value = ($_->{value} eq 'TRUE') ? '1' : '0'; |
|
2354
|
0
|
|
|
|
|
|
print $FH " case ",$value,":\n"; |
|
2355
|
|
|
|
|
|
|
} |
|
2356
|
|
|
|
|
|
|
else { |
|
2357
|
0
|
|
|
|
|
|
print $FH " case ",$_->{java_literal},":\n"; |
|
2358
|
|
|
|
|
|
|
} |
|
2359
|
|
|
|
|
|
|
} |
|
2360
|
|
|
|
|
|
|
} |
|
2361
|
0
|
|
|
|
|
|
my $elt = $case->{element}; |
|
2362
|
0
|
|
|
|
|
|
my $value = $self->_get_defn($elt->{value}); |
|
2363
|
0
|
|
|
|
|
|
$self->_member_helper_read($value, $node, \$idx); |
|
2364
|
0
|
0
|
0
|
|
|
|
if (scalar(@{$case->{list_label}}) > 1 || $flag_default) { |
|
|
0
|
|
|
|
|
|
|
|
2365
|
0
|
|
|
|
|
|
print $FH " value.",$value->{java_name}," (_dis0, _",$value->{java_name},");\n"; |
|
2366
|
|
|
|
|
|
|
} |
|
2367
|
|
|
|
|
|
|
else { |
|
2368
|
0
|
|
|
|
|
|
print $FH " value.",$value->{java_name}," (_",$value->{java_name},");\n"; |
|
2369
|
|
|
|
|
|
|
} |
|
2370
|
0
|
|
|
|
|
|
print $FH " break;\n"; |
|
2371
|
|
|
|
|
|
|
} |
|
2372
|
0
|
0
|
|
|
|
|
if (exists $node->{need_default}) { |
|
2373
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2374
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2375
|
|
|
|
|
|
|
} |
|
2376
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2377
|
0
|
|
|
|
|
|
print $FH " return value;\n"; |
|
2378
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2379
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2380
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
2381
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2382
|
0
|
|
|
|
|
|
print $FH " ",$dis->{java_write},"value.discriminator ());\n"; |
|
2383
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
|
|
0
|
|
|
|
|
|
|
2384
|
0
|
|
|
|
|
|
print $FH " switch (value.discriminator ().value ())\n"; |
|
2385
|
|
|
|
|
|
|
} |
|
2386
|
|
|
|
|
|
|
elsif ($effective_dis->isa('BooleanType')) { |
|
2387
|
0
|
|
|
|
|
|
print $FH " int _dis = (value.discriminator ()) ? 1 : 0;\n"; |
|
2388
|
0
|
|
|
|
|
|
print $FH " switch (_dis)\n"; |
|
2389
|
|
|
|
|
|
|
} |
|
2390
|
|
|
|
|
|
|
else { |
|
2391
|
0
|
|
|
|
|
|
print $FH " switch (value.discriminator ())\n"; |
|
2392
|
|
|
|
|
|
|
} |
|
2393
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2394
|
0
|
|
|
|
|
|
$idx = 0; |
|
2395
|
0
|
|
|
|
|
|
foreach my $case (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2396
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { # default or expression |
|
|
0
|
|
|
|
|
|
|
|
2397
|
0
|
0
|
|
|
|
|
if ($_->isa('Default')) { |
|
2398
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2399
|
|
|
|
|
|
|
} |
|
2400
|
|
|
|
|
|
|
else { |
|
2401
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('BooleanType')) { |
|
2402
|
0
|
0
|
|
|
|
|
my $value = ($_->{value} eq 'TRUE') ? '1' : '0'; |
|
2403
|
0
|
|
|
|
|
|
print $FH " case ",$value,":\n"; |
|
2404
|
|
|
|
|
|
|
} |
|
2405
|
|
|
|
|
|
|
else { |
|
2406
|
0
|
|
|
|
|
|
print $FH " case ",$_->{java_literal},":\n"; |
|
2407
|
|
|
|
|
|
|
} |
|
2408
|
|
|
|
|
|
|
} |
|
2409
|
|
|
|
|
|
|
} |
|
2410
|
0
|
|
|
|
|
|
my $elt = $case->{element}; |
|
2411
|
0
|
|
|
|
|
|
my $value = $self->_get_defn($elt->{value}); |
|
2412
|
0
|
|
|
|
|
|
$self->_member_helper_write($value, $node, \$idx); |
|
2413
|
0
|
|
|
|
|
|
print $FH " break;\n"; |
|
2414
|
|
|
|
|
|
|
} |
|
2415
|
0
|
0
|
|
|
|
|
if (exists $node->{need_default}) { |
|
2416
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2417
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2418
|
|
|
|
|
|
|
} |
|
2419
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2420
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2421
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2422
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
2423
|
0
|
|
|
|
|
|
close $FH; |
|
2424
|
|
|
|
|
|
|
} |
|
2425
|
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
sub _union { |
|
2427
|
0
|
|
|
0
|
|
|
my ($self, $node, $dis, $effective_dis) = @_; |
|
2428
|
|
|
|
|
|
|
|
|
2429
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
2430
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2431
|
0
|
|
|
|
|
|
my $first; |
|
2432
|
|
|
|
|
|
|
my $find; |
|
2433
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
2434
|
0
|
|
|
|
|
|
print $FH "public final class ",$node->{java_name}," implements org.omg.CORBA.portable.IDLEntity\n"; |
|
2435
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
2436
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
2437
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
2438
|
|
|
|
|
|
|
} |
|
2439
|
|
|
|
|
|
|
else { |
|
2440
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
2441
|
|
|
|
|
|
|
} |
|
2442
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2443
|
0
|
|
|
|
|
|
print $FH " private java.lang.Object __object;\n"; |
|
2444
|
0
|
|
|
|
|
|
print $FH " private ",$effective_dis->{java_Name}," __discriminator;\n"; |
|
2445
|
0
|
|
|
|
|
|
print $FH " private boolean __uninitialized;\n"; |
|
2446
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2447
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," ()\n"; |
|
2448
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2449
|
0
|
|
|
|
|
|
print $FH " __object = null;\n"; |
|
2450
|
0
|
|
|
|
|
|
print $FH " __uninitialized = true;\n"; |
|
2451
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2452
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2453
|
0
|
|
|
|
|
|
print $FH " public ",$effective_dis->{java_Name}," discriminator ()\n"; |
|
2454
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2455
|
0
|
|
|
|
|
|
print $FH " if (__uninitialized)\n"; |
|
2456
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2457
|
0
|
|
|
|
|
|
print $FH " return __discriminator;\n"; |
|
2458
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2459
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2460
|
0
|
|
|
|
|
|
foreach my $case (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2461
|
0
|
|
|
|
|
|
my $elt = $case->{element}; |
|
2462
|
0
|
|
|
|
|
|
my $value = $self->_get_defn($elt->{value}); |
|
2463
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($elt->{type}); |
|
2464
|
0
|
|
|
|
|
|
my $flag_default = 0; |
|
2465
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { # default or expression |
|
|
0
|
|
|
|
|
|
|
|
2466
|
0
|
0
|
|
|
|
|
if ($_->isa('Default')) { |
|
2467
|
0
|
|
|
|
|
|
$flag_default = 1; |
|
2468
|
0
|
|
|
|
|
|
last; |
|
2469
|
|
|
|
|
|
|
} |
|
2470
|
|
|
|
|
|
|
} |
|
2471
|
0
|
|
|
|
|
|
my $label; |
|
2472
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($value); |
|
2473
|
0
|
|
|
|
|
|
print $FH " public ",$value->{java_type}," ",$value->{java_name}," ()\n"; |
|
2474
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2475
|
0
|
|
|
|
|
|
print $FH " if (__uninitialized)\n"; |
|
2476
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2477
|
0
|
|
|
|
|
|
my $cond = q{}; |
|
2478
|
0
|
0
|
|
|
|
|
if ($flag_default) { |
|
2479
|
0
|
|
|
|
|
|
$first = 1; |
|
2480
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
2481
|
0
|
|
|
|
|
|
$find = 0; |
|
2482
|
0
|
|
|
|
|
|
foreach my $label (@{$case->{list_label}}) { |
|
|
0
|
|
|
|
|
|
|
|
2483
|
0
|
0
|
|
|
|
|
$find = 1 if ($_ == $label); |
|
2484
|
|
|
|
|
|
|
} |
|
2485
|
0
|
0
|
|
|
|
|
next if ($find); |
|
2486
|
0
|
0
|
|
|
|
|
$cond .= "\n || " unless ($first); |
|
2487
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2488
|
0
|
|
|
|
|
|
$cond .= "__discriminator == " . $_->{value}->{java_literal}; |
|
2489
|
|
|
|
|
|
|
} |
|
2490
|
|
|
|
|
|
|
else { |
|
2491
|
0
|
|
|
|
|
|
$cond .= "__discriminator == " . $_->{java_literal}; |
|
2492
|
|
|
|
|
|
|
} |
|
2493
|
0
|
|
|
|
|
|
$first = 0; |
|
2494
|
|
|
|
|
|
|
} |
|
2495
|
|
|
|
|
|
|
} |
|
2496
|
|
|
|
|
|
|
else { |
|
2497
|
0
|
|
|
|
|
|
$first = 1; |
|
2498
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { |
|
|
0
|
|
|
|
|
|
|
|
2499
|
0
|
0
|
|
|
|
|
$cond .= "\n && " unless ($first); |
|
2500
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2501
|
0
|
|
|
|
|
|
$cond .= "__discriminator != " . $_->{value}->{java_literal}; |
|
2502
|
|
|
|
|
|
|
} |
|
2503
|
|
|
|
|
|
|
else { |
|
2504
|
0
|
|
|
|
|
|
$cond .= "__discriminator != " . $_->{java_literal}; |
|
2505
|
|
|
|
|
|
|
} |
|
2506
|
0
|
|
|
|
|
|
$first = 0; |
|
2507
|
|
|
|
|
|
|
} |
|
2508
|
|
|
|
|
|
|
} |
|
2509
|
0
|
0
|
|
|
|
|
if ($cond) { |
|
2510
|
0
|
|
|
|
|
|
print $FH " if (",$cond,")\n"; |
|
2511
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2512
|
|
|
|
|
|
|
} |
|
2513
|
0
|
0
|
|
|
|
|
if (exists $value->{java_object}) { |
|
2514
|
0
|
|
|
|
|
|
print $FH " return ((",$value->{java_object},")__object).",$value->{java_type},"Value ();\n"; |
|
2515
|
|
|
|
|
|
|
} |
|
2516
|
|
|
|
|
|
|
else { |
|
2517
|
0
|
|
|
|
|
|
print $FH " return (",$value->{java_type},")__object;\n"; |
|
2518
|
|
|
|
|
|
|
} |
|
2519
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2520
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2521
|
0
|
|
|
|
|
|
print $FH " public void ",$value->{java_name}," (",$value->{java_type}," value)\n"; |
|
2522
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2523
|
0
|
0
|
0
|
|
|
|
if (defined $node->{default} and $case eq $node->{default}) { |
|
2524
|
0
|
|
|
|
|
|
print $FH " __discriminator = ",$dis->{java_init},";\n"; |
|
2525
|
|
|
|
|
|
|
} |
|
2526
|
|
|
|
|
|
|
else { |
|
2527
|
0
|
|
|
|
|
|
$label = ${$case->{list_label}}[0]; |
|
|
0
|
|
|
|
|
|
|
|
2528
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2529
|
0
|
|
|
|
|
|
print $FH " __discriminator = ",$label->{value}->{java_literal},";\n"; |
|
2530
|
|
|
|
|
|
|
} |
|
2531
|
|
|
|
|
|
|
else { |
|
2532
|
0
|
|
|
|
|
|
print $FH " __discriminator = ",$label->{java_literal},";\n"; |
|
2533
|
|
|
|
|
|
|
} |
|
2534
|
|
|
|
|
|
|
} |
|
2535
|
0
|
0
|
|
|
|
|
if (exists $value->{java_object}) { |
|
2536
|
0
|
|
|
|
|
|
print $FH " __object = new ",$value->{java_object}," (value);\n"; |
|
2537
|
|
|
|
|
|
|
} |
|
2538
|
|
|
|
|
|
|
else { |
|
2539
|
0
|
|
|
|
|
|
print $FH " __object = value;\n"; |
|
2540
|
|
|
|
|
|
|
} |
|
2541
|
0
|
|
|
|
|
|
print $FH " __uninitialized = false;\n"; |
|
2542
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2543
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2544
|
0
|
0
|
0
|
|
|
|
if (scalar(@{$case->{list_label}}) > 1 || $flag_default) { |
|
|
0
|
|
|
|
|
|
|
|
2545
|
0
|
|
|
|
|
|
print $FH " public void ",$value->{java_name}," (",$effective_dis->{java_Name}," discriminator, ",$value->{java_type}," value)\n"; |
|
2546
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2547
|
0
|
|
|
|
|
|
$cond = q{}; |
|
2548
|
0
|
0
|
0
|
|
|
|
if (defined $node->{default} and $case eq $node->{default}) { |
|
2549
|
0
|
|
|
|
|
|
$first = 1; |
|
2550
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
2551
|
0
|
|
|
|
|
|
$find = 0; |
|
2552
|
0
|
|
|
|
|
|
foreach my $label (@{$case->{list_label}}) { |
|
|
0
|
|
|
|
|
|
|
|
2553
|
0
|
0
|
|
|
|
|
$find = 1 if ($_ == $label); |
|
2554
|
|
|
|
|
|
|
} |
|
2555
|
0
|
0
|
|
|
|
|
next if ($find); |
|
2556
|
0
|
0
|
|
|
|
|
$cond .= "\n || " unless ($first); |
|
2557
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2558
|
0
|
|
|
|
|
|
$cond .= "discriminator == " . $_->{value}->{java_literal}; |
|
2559
|
|
|
|
|
|
|
} |
|
2560
|
|
|
|
|
|
|
else { |
|
2561
|
0
|
|
|
|
|
|
$cond .= "discriminator == " . $_->{java_literal}; |
|
2562
|
|
|
|
|
|
|
} |
|
2563
|
0
|
|
|
|
|
|
$first = 0; |
|
2564
|
|
|
|
|
|
|
} |
|
2565
|
|
|
|
|
|
|
} |
|
2566
|
|
|
|
|
|
|
else { |
|
2567
|
0
|
|
|
|
|
|
$first = 1; |
|
2568
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { |
|
|
0
|
|
|
|
|
|
|
|
2569
|
0
|
0
|
|
|
|
|
$cond .= "\n && " unless ($first); |
|
2570
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
2571
|
0
|
|
|
|
|
|
$cond .= "discriminator != " . $_->{value}->{java_literal}; |
|
2572
|
|
|
|
|
|
|
} |
|
2573
|
|
|
|
|
|
|
else { |
|
2574
|
0
|
|
|
|
|
|
$cond .= "discriminator != " . $_->{java_literal}; |
|
2575
|
|
|
|
|
|
|
} |
|
2576
|
0
|
|
|
|
|
|
$first = 0; |
|
2577
|
|
|
|
|
|
|
} |
|
2578
|
|
|
|
|
|
|
} |
|
2579
|
0
|
0
|
|
|
|
|
if ($cond) { |
|
2580
|
0
|
|
|
|
|
|
print $FH " if (",$cond,")\n"; |
|
2581
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2582
|
|
|
|
|
|
|
} |
|
2583
|
0
|
|
|
|
|
|
print $FH " __discriminator = discriminator;\n"; |
|
2584
|
0
|
0
|
|
|
|
|
if (exists $value->{java_object}) { |
|
2585
|
0
|
|
|
|
|
|
print $FH " __object = new ",$value->{java_object}," (value);\n"; |
|
2586
|
|
|
|
|
|
|
} |
|
2587
|
|
|
|
|
|
|
else { |
|
2588
|
0
|
|
|
|
|
|
print $FH " __object = value;\n"; |
|
2589
|
|
|
|
|
|
|
} |
|
2590
|
0
|
|
|
|
|
|
print $FH " __uninitialized = false;\n"; |
|
2591
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2592
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2593
|
|
|
|
|
|
|
} |
|
2594
|
|
|
|
|
|
|
} |
|
2595
|
0
|
0
|
|
|
|
|
if (exists $node->{need_default}) { |
|
2596
|
0
|
|
|
|
|
|
print $FH " public void _default ()\n"; |
|
2597
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2598
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
|
|
0
|
|
|
|
|
|
|
2599
|
0
|
|
|
|
|
|
foreach (@{$dis->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2600
|
0
|
0
|
|
|
|
|
unless (exists $node->{hash_member}->{$_}) { |
|
2601
|
0
|
|
|
|
|
|
print $FH " __discriminator = ",$_->{java_literal},";\n"; |
|
2602
|
0
|
|
|
|
|
|
last; |
|
2603
|
|
|
|
|
|
|
} |
|
2604
|
|
|
|
|
|
|
} |
|
2605
|
|
|
|
|
|
|
} |
|
2606
|
|
|
|
|
|
|
elsif ($effective_dis->isa('BooleanType')) { |
|
2607
|
0
|
0
|
|
|
|
|
if (exists $node->{hash_member}->{0}) { |
|
2608
|
0
|
|
|
|
|
|
print $FH " __discriminator = true;\n"; |
|
2609
|
|
|
|
|
|
|
} |
|
2610
|
|
|
|
|
|
|
else { |
|
2611
|
0
|
|
|
|
|
|
print $FH " __discriminator = false;\n"; |
|
2612
|
|
|
|
|
|
|
} |
|
2613
|
|
|
|
|
|
|
} |
|
2614
|
|
|
|
|
|
|
else { |
|
2615
|
0
|
|
|
|
|
|
my $v = new Math::BigInt(0); |
|
2616
|
0
|
|
|
|
|
|
while (1) { |
|
2617
|
0
|
0
|
|
|
|
|
unless (exists $node->{hash_member}->{$v}) { |
|
2618
|
0
|
|
|
|
|
|
print $FH " __discriminator = ",$v,";\n"; |
|
2619
|
0
|
|
|
|
|
|
last; |
|
2620
|
|
|
|
|
|
|
} |
|
2621
|
0
|
|
|
|
|
|
$v ++; |
|
2622
|
|
|
|
|
|
|
} |
|
2623
|
|
|
|
|
|
|
} |
|
2624
|
0
|
|
|
|
|
|
print $FH " __uninitialized = false;\n"; |
|
2625
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2626
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2627
|
0
|
|
|
|
|
|
print $FH " public void _default (",$dis->{java_Name}," discriminator)\n"; |
|
2628
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2629
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
|
|
0
|
|
|
|
|
|
|
2630
|
0
|
|
|
|
|
|
print $FH " switch (discriminator.value ())\n"; |
|
2631
|
|
|
|
|
|
|
} |
|
2632
|
|
|
|
|
|
|
elsif ($effective_dis->isa('BooleanType')) { |
|
2633
|
0
|
|
|
|
|
|
print $FH " int _dis = (discriminator) ? 1 : 0;\n"; |
|
2634
|
0
|
|
|
|
|
|
print $FH " switch (_dis)\n"; |
|
2635
|
|
|
|
|
|
|
} |
|
2636
|
|
|
|
|
|
|
else { |
|
2637
|
0
|
|
|
|
|
|
print $FH " switch (discriminator)\n"; |
|
2638
|
|
|
|
|
|
|
} |
|
2639
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2640
|
0
|
|
|
|
|
|
foreach my $case (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2641
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { # expression |
|
|
0
|
|
|
|
|
|
|
|
2642
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('BooleanType')) { |
|
2643
|
0
|
0
|
|
|
|
|
my $value = ($_->{value} eq 'TRUE') ? '1' : '0'; |
|
2644
|
0
|
|
|
|
|
|
print $FH " case ",$value,":\n"; |
|
2645
|
|
|
|
|
|
|
} |
|
2646
|
|
|
|
|
|
|
else { |
|
2647
|
0
|
|
|
|
|
|
print $FH " case ",$_->{java_literal},":\n"; |
|
2648
|
|
|
|
|
|
|
} |
|
2649
|
|
|
|
|
|
|
} |
|
2650
|
|
|
|
|
|
|
} |
|
2651
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_OPERATION ();\n"; |
|
2652
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2653
|
0
|
|
|
|
|
|
print $FH " __discriminator = discriminator;\n"; |
|
2654
|
0
|
|
|
|
|
|
print $FH " __uninitialized = false;\n"; |
|
2655
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2656
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2657
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2658
|
|
|
|
|
|
|
} |
|
2659
|
0
|
0
|
|
|
|
|
if ($self->{toString}) { |
|
2660
|
0
|
|
|
|
|
|
print $FH " public java.lang.String toString ()\n"; |
|
2661
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2662
|
0
|
|
|
|
|
|
print $FH " java.lang.StringBuffer _ret = new java.lang.StringBuffer (\"union ",$node->{java_name}," {\");\n"; |
|
2663
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('EnumType')) { |
|
|
|
0
|
|
|
|
|
|
|
2664
|
0
|
|
|
|
|
|
print $FH " switch (discriminator ().value ())\n"; |
|
2665
|
|
|
|
|
|
|
} |
|
2666
|
|
|
|
|
|
|
elsif ($effective_dis->isa('BooleanType')) { |
|
2667
|
0
|
|
|
|
|
|
print $FH " int _dis = (discriminator ()) ? 1 : 0;\n"; |
|
2668
|
0
|
|
|
|
|
|
print $FH " switch (_dis)\n"; |
|
2669
|
|
|
|
|
|
|
} |
|
2670
|
|
|
|
|
|
|
else { |
|
2671
|
0
|
|
|
|
|
|
print $FH " switch (discriminator ())\n"; |
|
2672
|
|
|
|
|
|
|
} |
|
2673
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2674
|
0
|
|
|
|
|
|
my $idx = 0; |
|
2675
|
0
|
|
|
|
|
|
foreach my $case (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2676
|
0
|
|
|
|
|
|
my $elt = $case->{element}; |
|
2677
|
0
|
|
|
|
|
|
my $value = $self->_get_defn($elt->{value}); |
|
2678
|
0
|
|
|
|
|
|
foreach (@{$case->{list_label}}) { # default or expression |
|
|
0
|
|
|
|
|
|
|
|
2679
|
0
|
0
|
|
|
|
|
if ($_->isa('Default')) { |
|
2680
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2681
|
|
|
|
|
|
|
} |
|
2682
|
|
|
|
|
|
|
else { |
|
2683
|
0
|
0
|
|
|
|
|
if ($effective_dis->isa('BooleanType')) { |
|
2684
|
0
|
0
|
|
|
|
|
my $value = ($_->{value} eq 'TRUE') ? '1' : '0'; |
|
2685
|
0
|
|
|
|
|
|
print $FH " case ",$value,":\n"; |
|
2686
|
|
|
|
|
|
|
} |
|
2687
|
|
|
|
|
|
|
else { |
|
2688
|
0
|
|
|
|
|
|
print $FH " case ",$_->{java_literal},":\n"; |
|
2689
|
|
|
|
|
|
|
} |
|
2690
|
|
|
|
|
|
|
} |
|
2691
|
|
|
|
|
|
|
} |
|
2692
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2693
|
0
|
|
|
|
|
|
$self->_member_toString($value, $node, \$idx); |
|
2694
|
0
|
|
|
|
|
|
print $FH " break;\n"; |
|
2695
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2696
|
|
|
|
|
|
|
} |
|
2697
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2698
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"\\n}\");\n"; |
|
2699
|
0
|
|
|
|
|
|
print $FH " return _ret.toString ();\n"; |
|
2700
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2701
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2702
|
|
|
|
|
|
|
} |
|
2703
|
0
|
0
|
|
|
|
|
if ($self->{equals}) { |
|
2704
|
0
|
|
|
|
|
|
print $FH " public boolean equals (java.lang.Object o)\n"; |
|
2705
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2706
|
0
|
|
|
|
|
|
print $FH " if (this == o) return true;\n"; |
|
2707
|
0
|
|
|
|
|
|
print $FH " if (o == null) return false;\n"; |
|
2708
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2709
|
0
|
|
|
|
|
|
print $FH " if (o instanceof ",$node->{java_name},")\n"; |
|
2710
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2711
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_name}," obj = (",$node->{java_name},")o;\n"; |
|
2712
|
0
|
|
|
|
|
|
print $FH " boolean res;\n"; |
|
2713
|
0
|
|
|
|
|
|
print $FH " res = (this.__discriminator == obj.__discriminator);\n"; |
|
2714
|
0
|
|
|
|
|
|
print $FH " if (!res) return false;\n"; |
|
2715
|
0
|
|
|
|
|
|
print $FH " res = (this.__object == obj.__object) ||\n"; |
|
2716
|
0
|
|
|
|
|
|
print $FH " (this.__object != null && obj.__object != null && this.__object.equals(obj.__object));\n"; |
|
2717
|
0
|
|
|
|
|
|
print $FH " return res;\n"; |
|
2718
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2719
|
0
|
|
|
|
|
|
print $FH " return false;\n"; |
|
2720
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2721
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2722
|
0
|
|
|
|
|
|
print $FH " public int hashCode ()\n"; |
|
2723
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2724
|
0
|
|
|
|
|
|
print $FH " // this method returns always the same value, to force equals() to be called.\n"; |
|
2725
|
0
|
|
|
|
|
|
print $FH " return 0;\n"; |
|
2726
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2727
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2728
|
|
|
|
|
|
|
} |
|
2729
|
0
|
|
|
|
|
|
print $FH "} // class ",$node->{java_name},"\n"; |
|
2730
|
0
|
|
|
|
|
|
close $FH; |
|
2731
|
|
|
|
|
|
|
} |
|
2732
|
|
|
|
|
|
|
|
|
2733
|
|
|
|
|
|
|
sub visitUnionType { |
|
2734
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
2735
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
2736
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
2737
|
0
|
0
|
|
|
|
|
return if (exists $self->{done_hash}->{$node->{java_Name}}); |
|
2738
|
0
|
|
|
|
|
|
$self->{done_hash}->{$node->{java_Name}} = 1; |
|
2739
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2740
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{element}->{type}); |
|
2741
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType') |
|
|
|
|
0
|
|
|
|
|
|
2742
|
|
|
|
|
|
|
or $type->isa('UnionType') |
|
2743
|
|
|
|
|
|
|
or $type->isa('EnumType') ) { |
|
2744
|
0
|
|
|
|
|
|
$type->visit($self); |
|
2745
|
|
|
|
|
|
|
} |
|
2746
|
|
|
|
|
|
|
} |
|
2747
|
0
|
|
|
|
|
|
my $dis = $self->_get_defn($node->{type}); |
|
2748
|
0
|
|
|
|
|
|
my $effective_dis = $dis; |
|
2749
|
0
|
|
0
|
|
|
|
while ( $effective_dis->isa('TypeDeclarator') |
|
2750
|
|
|
|
|
|
|
and ! exists $effective_dis->{array_size} ) { |
|
2751
|
0
|
|
|
|
|
|
$effective_dis = $self->_get_defn($effective_dis->{type}); |
|
2752
|
|
|
|
|
|
|
} |
|
2753
|
|
|
|
|
|
|
|
|
2754
|
0
|
0
|
|
|
|
|
$dis->visit($self) if ($effective_dis->isa('EnumType')); |
|
2755
|
|
|
|
|
|
|
|
|
2756
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
2757
|
0
|
|
|
|
|
|
$self->_union_helper($node, $dis, $effective_dis); |
|
2758
|
0
|
|
|
|
|
|
$self->_union($node, $dis, $effective_dis); |
|
2759
|
0
|
0
|
|
|
|
|
$self->_union_helperXML($node, $dis, $effective_dis) if ($self->can('_union_helperXML')); |
|
2760
|
|
|
|
|
|
|
} |
|
2761
|
|
|
|
|
|
|
|
|
2762
|
|
|
|
|
|
|
# 3.11.2.3 Constructed Recursive Types and Forward Declarations |
|
2763
|
|
|
|
|
|
|
# |
|
2764
|
|
|
|
|
|
|
|
|
2765
|
0
|
|
|
0
|
0
|
|
sub visitForwardStructType { |
|
2766
|
|
|
|
|
|
|
# empty |
|
2767
|
|
|
|
|
|
|
} |
|
2768
|
|
|
|
|
|
|
|
|
2769
|
0
|
|
|
0
|
0
|
|
sub visitForwardUnionType { |
|
2770
|
|
|
|
|
|
|
# empty |
|
2771
|
|
|
|
|
|
|
} |
|
2772
|
|
|
|
|
|
|
|
|
2773
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations |
|
2774
|
|
|
|
|
|
|
# |
|
2775
|
|
|
|
|
|
|
|
|
2776
|
|
|
|
|
|
|
sub _enum_helper { |
|
2777
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
2778
|
|
|
|
|
|
|
|
|
2779
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
2780
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2781
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
2782
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
2783
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
2784
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2785
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
2786
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2787
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
2788
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
2789
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
2790
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
2791
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2792
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2793
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
2794
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2795
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
2796
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2797
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2798
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
2799
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
2800
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
2801
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2802
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
2803
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2804
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
2805
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2806
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
2807
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2808
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
2809
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2810
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
2811
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2812
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
2813
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (_id, \"",$node->{java_name},"\", new java.lang.String [] { "; |
|
2814
|
0
|
|
|
|
|
|
my $first = 1; |
|
2815
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2816
|
0
|
0
|
|
|
|
|
print $FH ", " unless ($first); |
|
2817
|
0
|
|
|
|
|
|
print $FH "\"",$_->{java_name},"\""; |
|
2818
|
0
|
|
|
|
|
|
$first = 0; |
|
2819
|
|
|
|
|
|
|
} |
|
2820
|
0
|
|
|
|
|
|
print $FH "} );\n"; |
|
2821
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
2822
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2823
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2824
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2825
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
2826
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2827
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2828
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
2829
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2830
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
2831
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2832
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2833
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
2834
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2835
|
0
|
|
|
|
|
|
print $FH " return ",$node->{java_Name},".from_int (\$is.read_long ());\n"; |
|
2836
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2837
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2838
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
2839
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2840
|
0
|
|
|
|
|
|
print $FH " \$os.write_long (value.value ());\n"; |
|
2841
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2842
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2843
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
2844
|
0
|
|
|
|
|
|
close $FH; |
|
2845
|
|
|
|
|
|
|
} |
|
2846
|
|
|
|
|
|
|
|
|
2847
|
|
|
|
|
|
|
sub _enum { |
|
2848
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
2849
|
|
|
|
|
|
|
|
|
2850
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
2851
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2852
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
2853
|
0
|
|
|
|
|
|
print $FH "public class ",$node->{java_name}," implements org.omg.CORBA.portable.IDLEntity\n"; |
|
2854
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
2855
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
2856
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
2857
|
|
|
|
|
|
|
} |
|
2858
|
|
|
|
|
|
|
else { |
|
2859
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
2860
|
|
|
|
|
|
|
} |
|
2861
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2862
|
0
|
|
|
|
|
|
print $FH " private int __value;\n"; |
|
2863
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2864
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2865
|
0
|
|
|
|
|
|
print $FH " public static final int _",$_->{java_name}," = ",$_->{value},";\n"; |
|
2866
|
0
|
|
|
|
|
|
print $FH " public static final ",$node->{java_Name}," ",$_->{java_name}," = new ",$node->{java_Name}," (_",$_->{java_name},");\n"; |
|
2867
|
|
|
|
|
|
|
} |
|
2868
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2869
|
0
|
|
|
|
|
|
print $FH " protected ",$node->{java_name}," (int value)\n"; |
|
2870
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2871
|
0
|
|
|
|
|
|
print $FH " __value = value;\n"; |
|
2872
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2873
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2874
|
0
|
|
|
|
|
|
print $FH " public int value ()\n"; |
|
2875
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2876
|
0
|
|
|
|
|
|
print $FH " return __value;\n"; |
|
2877
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2878
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2879
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," from_int (int value)\n"; |
|
2880
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2881
|
0
|
|
|
|
|
|
print $FH " switch (value)\n"; |
|
2882
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2883
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2884
|
0
|
|
|
|
|
|
print $FH " case ",$_->{value},":\n"; |
|
2885
|
0
|
|
|
|
|
|
print $FH " return ",$_->{java_name},";\n"; |
|
2886
|
|
|
|
|
|
|
} |
|
2887
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2888
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
2889
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2890
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2891
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2892
|
0
|
|
|
|
|
|
print $FH " public java.lang.Object readResolve() throws java.io.ObjectStreamException\n"; |
|
2893
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2894
|
0
|
|
|
|
|
|
print $FH " return from_int (value ());\n"; |
|
2895
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2896
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2897
|
0
|
0
|
0
|
|
|
|
if ($self->{toString} or $self->can("_enum_helperXML")) { |
|
2898
|
0
|
|
|
|
|
|
print $FH " public java.lang.String toString ()\n"; |
|
2899
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2900
|
0
|
|
|
|
|
|
print $FH " switch (this.__value)\n"; |
|
2901
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2902
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
2903
|
0
|
|
|
|
|
|
print $FH " case ",$_->{value},":\n"; |
|
2904
|
0
|
|
|
|
|
|
print $FH " return \"",$_->{java_name},"\";\n"; |
|
2905
|
|
|
|
|
|
|
} |
|
2906
|
0
|
|
|
|
|
|
print $FH " default:\n"; |
|
2907
|
0
|
|
|
|
|
|
print $FH " throw new org.omg.CORBA.BAD_PARAM ();\n"; |
|
2908
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2909
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2910
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2911
|
|
|
|
|
|
|
} |
|
2912
|
0
|
0
|
|
|
|
|
if ($self->{equals}) { |
|
2913
|
0
|
|
|
|
|
|
print $FH " public boolean equals (java.lang.Object o)\n"; |
|
2914
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2915
|
0
|
|
|
|
|
|
print $FH " if (this == o) return true;\n"; |
|
2916
|
0
|
|
|
|
|
|
print $FH " if (o == null) return false;\n"; |
|
2917
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2918
|
0
|
|
|
|
|
|
print $FH " if (o instanceof ",$node->{java_name},")\n"; |
|
2919
|
0
|
|
|
|
|
|
print $FH " return (this.__value == ((",$node->{java_name},")o).__value);\n"; |
|
2920
|
0
|
|
|
|
|
|
print $FH " return false;\n"; |
|
2921
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2922
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2923
|
0
|
|
|
|
|
|
print $FH " public int hashCode ()\n"; |
|
2924
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2925
|
0
|
|
|
|
|
|
print $FH " // this method returns always the same value, to force equals() to be called.\n"; |
|
2926
|
0
|
|
|
|
|
|
print $FH " return 0;\n"; |
|
2927
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2928
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2929
|
|
|
|
|
|
|
} |
|
2930
|
0
|
|
|
|
|
|
print $FH "} // class ",$node->{java_name},"\n"; |
|
2931
|
0
|
|
|
|
|
|
close $FH; |
|
2932
|
|
|
|
|
|
|
} |
|
2933
|
|
|
|
|
|
|
|
|
2934
|
|
|
|
|
|
|
sub visitEnumType { |
|
2935
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
2936
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
2937
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
2938
|
|
|
|
|
|
|
|
|
2939
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
2940
|
0
|
|
|
|
|
|
$self->_enum_helper($node); |
|
2941
|
0
|
|
|
|
|
|
$self->_enum($node); |
|
2942
|
0
|
0
|
|
|
|
|
$self->_enum_helperXML($node) if ($self->can('_enum_helperXML')); |
|
2943
|
|
|
|
|
|
|
} |
|
2944
|
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
# |
|
2946
|
|
|
|
|
|
|
# 3.12 Exception Declaration |
|
2947
|
|
|
|
|
|
|
# |
|
2948
|
|
|
|
|
|
|
|
|
2949
|
|
|
|
|
|
|
sub _exception_helper { |
|
2950
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
2951
|
|
|
|
|
|
|
|
|
2952
|
0
|
|
|
|
|
|
$self->open_stream($node, 'Helper.java'); |
|
2953
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
2954
|
0
|
|
|
|
|
|
print $FH "abstract public class ",$node->{java_helper},"Helper\n"; |
|
2955
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
2956
|
0
|
|
|
|
|
|
print $FH " private static java.lang.String _id = \"",$node->{repos_id},"\";\n"; |
|
2957
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2958
|
0
|
|
|
|
|
|
print $FH " public static void insert (org.omg.CORBA.Any a, ",$node->{java_Name}," that)\n"; |
|
2959
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2960
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();\n"; |
|
2961
|
0
|
|
|
|
|
|
print $FH " a.type (type ());\n"; |
|
2962
|
0
|
|
|
|
|
|
print $FH " write (out, that);\n"; |
|
2963
|
0
|
|
|
|
|
|
print $FH " a.read_value (out.create_input_stream (), type ());\n"; |
|
2964
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2965
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2966
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," extract (org.omg.CORBA.Any a)\n"; |
|
2967
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2968
|
0
|
|
|
|
|
|
print $FH " return read (a.create_input_stream ());\n"; |
|
2969
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2970
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
2971
|
0
|
|
|
|
|
|
print $FH " private static org.omg.CORBA.TypeCode __typeCode = null;\n"; |
|
2972
|
0
|
|
|
|
|
|
print $FH " private static boolean __active = false;\n"; |
|
2973
|
0
|
|
|
|
|
|
print $FH " synchronized public static org.omg.CORBA.TypeCode type ()\n"; |
|
2974
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2975
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
2976
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2977
|
0
|
|
|
|
|
|
print $FH " synchronized (org.omg.CORBA.TypeCode.class)\n"; |
|
2978
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2979
|
0
|
|
|
|
|
|
print $FH " if (__typeCode == null)\n"; |
|
2980
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2981
|
0
|
|
|
|
|
|
print $FH " if (__active)\n"; |
|
2982
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
2983
|
0
|
|
|
|
|
|
print $FH " return org.omg.CORBA.ORB.init().create_recursive_tc ( ",$node->{java_Helper},".id () );\n"; |
|
2984
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2985
|
0
|
|
|
|
|
|
print $FH " __active = true;\n"; |
|
2986
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [",scalar(@{$node->{list_member}}),"];\n"; |
|
|
0
|
|
|
|
|
|
|
|
2987
|
0
|
|
|
|
|
|
print $FH " org.omg.CORBA.TypeCode _tcOf_members0 = null;\n"; |
|
2988
|
0
|
|
|
|
|
|
my $i = 0; |
|
2989
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
2990
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
2991
|
0
|
|
|
|
|
|
$self->_member_helper_type($member, $node, $i); |
|
2992
|
0
|
|
|
|
|
|
$i ++; |
|
2993
|
|
|
|
|
|
|
} |
|
2994
|
0
|
|
|
|
|
|
print $FH " __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (_id, \"",$node->{java_name},"\", _members0);\n"; |
|
2995
|
0
|
|
|
|
|
|
print $FH " __active = false;\n"; |
|
2996
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2997
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2998
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
2999
|
0
|
|
|
|
|
|
print $FH " return __typeCode;\n"; |
|
3000
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3001
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3002
|
0
|
|
|
|
|
|
print $FH " public static java.lang.String id ()\n"; |
|
3003
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3004
|
0
|
|
|
|
|
|
print $FH " return _id;\n"; |
|
3005
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3006
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3007
|
0
|
|
|
|
|
|
print $FH " public static ",$node->{java_Name}," read (org.omg.CORBA.portable.InputStream \$is)\n"; |
|
3008
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3009
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_Name}," value = new ",$node->{java_Name}," ();\n"; |
|
3010
|
0
|
|
|
|
|
|
print $FH " // read and discard the repository ID\n"; |
|
3011
|
0
|
|
|
|
|
|
print $FH " \$is.read_string ();\n"; |
|
3012
|
0
|
|
|
|
|
|
my $idx = 0; |
|
3013
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3014
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3015
|
0
|
|
|
|
|
|
$self->_member_helper_read($member, $node, \$idx); |
|
3016
|
|
|
|
|
|
|
} |
|
3017
|
0
|
|
|
|
|
|
print $FH " return value;\n"; |
|
3018
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3019
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3020
|
0
|
|
|
|
|
|
print $FH " public static void write (org.omg.CORBA.portable.OutputStream \$os, ",$node->{java_Name}," value)\n"; |
|
3021
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3022
|
0
|
|
|
|
|
|
print $FH " // write the repository ID\n"; |
|
3023
|
0
|
|
|
|
|
|
print $FH " \$os.write_string (id ());\n"; |
|
3024
|
0
|
|
|
|
|
|
$idx = 0; |
|
3025
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3026
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3027
|
0
|
|
|
|
|
|
$self->_member_helper_write($member, $node, \$idx); |
|
3028
|
|
|
|
|
|
|
} |
|
3029
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3030
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3031
|
0
|
|
|
|
|
|
print $FH "}\n"; |
|
3032
|
0
|
|
|
|
|
|
close $FH; |
|
3033
|
|
|
|
|
|
|
} |
|
3034
|
|
|
|
|
|
|
|
|
3035
|
|
|
|
|
|
|
sub _exception { |
|
3036
|
0
|
|
|
0
|
|
|
my ($self, $node) = @_; |
|
3037
|
|
|
|
|
|
|
|
|
3038
|
0
|
|
|
|
|
|
$self->open_stream($node, '.java'); |
|
3039
|
0
|
|
|
|
|
|
my $FH = $self->{out}; |
|
3040
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($node); |
|
3041
|
0
|
|
|
|
|
|
print $FH "public final class ",$node->{java_name}," extends org.omg.CORBA.UserException\n"; |
|
3042
|
0
|
|
|
|
|
|
print $FH "{\n"; |
|
3043
|
0
|
0
|
|
|
|
|
if (exists $node->{serial_uid}) { |
|
3044
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{serial_uid},"L;\n"; |
|
3045
|
|
|
|
|
|
|
} |
|
3046
|
|
|
|
|
|
|
else { |
|
3047
|
0
|
|
|
|
|
|
print $FH " private static final long serialVersionUID = 0x",$node->{java_uid},"L;\n"; |
|
3048
|
|
|
|
|
|
|
} |
|
3049
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3050
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3051
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3052
|
0
|
|
|
|
|
|
print $FH $self->_format_javadoc($member); |
|
3053
|
0
|
|
|
|
|
|
print $FH " public ",$member->{java_type}," ",$member->{java_name},";\n"; |
|
3054
|
|
|
|
|
|
|
} |
|
3055
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3056
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," ()\n"; |
|
3057
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3058
|
0
|
|
|
|
|
|
print $FH " super (",$node->{java_name},"Helper.id ());\n"; |
|
3059
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3060
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3061
|
0
|
|
|
|
|
|
print $FH " ",$member->{java_name}," = ",$member->{java_init},";\n"; |
|
3062
|
|
|
|
|
|
|
} |
|
3063
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3064
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3065
|
0
|
0
|
|
|
|
|
if (scalar(@{$node->{list_member}})) { |
|
|
0
|
|
|
|
|
|
|
|
3066
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," ("; |
|
3067
|
0
|
|
|
|
|
|
my $first = 1; |
|
3068
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3069
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3070
|
0
|
0
|
|
|
|
|
print $FH ", " unless ($first); |
|
3071
|
0
|
|
|
|
|
|
print $FH $member->{java_type}," _",$member->{java_name}; |
|
3072
|
0
|
|
|
|
|
|
$first = 0; |
|
3073
|
|
|
|
|
|
|
} |
|
3074
|
0
|
|
|
|
|
|
print $FH ")\n"; |
|
3075
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3076
|
0
|
|
|
|
|
|
print $FH " super (",$node->{java_name},"Helper.id ());\n"; |
|
3077
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3078
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3079
|
0
|
|
|
|
|
|
print $FH " ",$member->{java_name}," = _",$member->{java_name},";\n"; |
|
3080
|
|
|
|
|
|
|
} |
|
3081
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3082
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3083
|
|
|
|
|
|
|
} |
|
3084
|
0
|
0
|
|
|
|
|
if (scalar(@{$node->{list_member}})) { |
|
|
0
|
|
|
|
|
|
|
|
3085
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," (java.lang.String \$reason"; |
|
3086
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3087
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3088
|
0
|
|
|
|
|
|
print $FH ", ",$member->{java_type}," _",$member->{java_name}; |
|
3089
|
|
|
|
|
|
|
} |
|
3090
|
0
|
|
|
|
|
|
print $FH ")\n"; |
|
3091
|
|
|
|
|
|
|
} |
|
3092
|
|
|
|
|
|
|
else { |
|
3093
|
0
|
|
|
|
|
|
print $FH " public ",$node->{java_name}," (java.lang.String \$reason)\n"; |
|
3094
|
|
|
|
|
|
|
} |
|
3095
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3096
|
0
|
|
|
|
|
|
print $FH " super(new StringBuffer (",$node->{java_name},"Helper.id ()).append (\" \").append (\$reason).toString ());\n"; |
|
3097
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3098
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3099
|
0
|
|
|
|
|
|
print $FH " ",$member->{java_name}," = _",$member->{java_name},";\n"; |
|
3100
|
|
|
|
|
|
|
} |
|
3101
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3102
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3103
|
0
|
0
|
|
|
|
|
if ($self->{toString}) { |
|
3104
|
0
|
|
|
|
|
|
print $FH " public java.lang.String toString ()\n"; |
|
3105
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3106
|
0
|
|
|
|
|
|
print $FH " java.lang.StringBuffer _ret = new java.lang.StringBuffer (\"exception ",$node->{java_Name}," {\");\n"; |
|
3107
|
0
|
0
|
|
|
|
|
if (scalar(@{$node->{list_member}})) { |
|
|
0
|
|
|
|
|
|
|
|
3108
|
0
|
|
|
|
|
|
my $first = 1; |
|
3109
|
0
|
|
|
|
|
|
my $idx = 0; |
|
3110
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3111
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3112
|
0
|
0
|
|
|
|
|
if ($first) { |
|
3113
|
0
|
|
|
|
|
|
$first = 0; |
|
3114
|
|
|
|
|
|
|
} |
|
3115
|
|
|
|
|
|
|
else { |
|
3116
|
0
|
|
|
|
|
|
print $FH " _ret.append (\",\");\n"; |
|
3117
|
|
|
|
|
|
|
} |
|
3118
|
0
|
|
|
|
|
|
$self->_member_toString($member, $node, \$idx); |
|
3119
|
|
|
|
|
|
|
} |
|
3120
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"\\n\");\n"; |
|
3121
|
|
|
|
|
|
|
} |
|
3122
|
0
|
|
|
|
|
|
print $FH " _ret.append (\"}\");\n"; |
|
3123
|
0
|
|
|
|
|
|
print $FH " return _ret.toString ();\n"; |
|
3124
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3125
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3126
|
|
|
|
|
|
|
} |
|
3127
|
0
|
0
|
0
|
|
|
|
if ($self->{equals} and scalar(@{$node->{list_member}})) { |
|
|
0
|
|
|
|
|
|
|
|
3128
|
0
|
|
|
|
|
|
print $FH " public boolean equals (java.lang.Object o)\n"; |
|
3129
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3130
|
0
|
|
|
|
|
|
print $FH " if (this == o) return true;\n"; |
|
3131
|
0
|
|
|
|
|
|
print $FH " if (o == null) return false;\n"; |
|
3132
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3133
|
0
|
|
|
|
|
|
print $FH " if (o instanceof ",$node->{java_name},")\n"; |
|
3134
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3135
|
0
|
|
|
|
|
|
print $FH " ",$node->{java_name}," obj = (",$node->{java_name},")o;\n"; |
|
3136
|
0
|
|
|
|
|
|
print $FH " boolean res;\n"; |
|
3137
|
0
|
|
|
|
|
|
my $first = 1; |
|
3138
|
0
|
|
|
|
|
|
my $idx = 0; |
|
3139
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) { |
|
|
0
|
|
|
|
|
|
|
|
3140
|
0
|
|
|
|
|
|
my $member = $self->_get_defn($_); |
|
3141
|
0
|
0
|
|
|
|
|
if ($first) { |
|
3142
|
0
|
|
|
|
|
|
$first = 0; |
|
3143
|
|
|
|
|
|
|
} |
|
3144
|
|
|
|
|
|
|
else { |
|
3145
|
0
|
|
|
|
|
|
print $FH " if (!res) return false;\n"; |
|
3146
|
|
|
|
|
|
|
} |
|
3147
|
0
|
|
|
|
|
|
$self->_member_equals($member, $node, \$idx); |
|
3148
|
|
|
|
|
|
|
} |
|
3149
|
0
|
|
|
|
|
|
print $FH " return res;\n"; |
|
3150
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3151
|
0
|
|
|
|
|
|
print $FH " return false;\n"; |
|
3152
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3153
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3154
|
0
|
|
|
|
|
|
print $FH " public int hashCode ()\n"; |
|
3155
|
0
|
|
|
|
|
|
print $FH " {\n"; |
|
3156
|
0
|
|
|
|
|
|
print $FH " // this method returns always the same value, to force equals() to be called.\n"; |
|
3157
|
0
|
|
|
|
|
|
print $FH " return 0;\n"; |
|
3158
|
0
|
|
|
|
|
|
print $FH " }\n"; |
|
3159
|
0
|
|
|
|
|
|
print $FH "\n"; |
|
3160
|
|
|
|
|
|
|
} |
|
3161
|
0
|
|
|
|
|
|
print $FH "} // class ",$node->{java_name},"\n"; |
|
3162
|
0
|
|
|
|
|
|
close $FH; |
|
3163
|
|
|
|
|
|
|
} |
|
3164
|
|
|
|
|
|
|
|
|
3165
|
|
|
|
|
|
|
sub visitException { |
|
3166
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3167
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
3168
|
0
|
0
|
|
|
|
|
return unless ($self->{srcname} eq $node->{filename}); |
|
3169
|
0
|
0
|
|
|
|
|
return if (exists $self->{done_hash}->{$node->{java_Name}}); |
|
3170
|
0
|
|
|
|
|
|
$self->{done_hash}->{$node->{java_Name}} = 1; |
|
3171
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) { |
|
|
0
|
|
|
|
|
|
|
|
3172
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{type}); |
|
3173
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType') |
|
3174
|
|
|
|
|
|
|
or $type->isa('UnionType') ) { |
|
3175
|
0
|
|
|
|
|
|
$type->visit($self); |
|
3176
|
|
|
|
|
|
|
} |
|
3177
|
|
|
|
|
|
|
} |
|
3178
|
|
|
|
|
|
|
|
|
3179
|
0
|
|
|
|
|
|
$self->_holder($node); |
|
3180
|
0
|
|
|
|
|
|
$self->_exception_helper($node); |
|
3181
|
0
|
|
|
|
|
|
$self->_exception($node); |
|
3182
|
0
|
0
|
|
|
|
|
$self->_exception_helperXML($node) if ($self->can('_exception_helperXML')); |
|
3183
|
|
|
|
|
|
|
} |
|
3184
|
|
|
|
|
|
|
|
|
3185
|
|
|
|
|
|
|
# |
|
3186
|
|
|
|
|
|
|
# 3.13 Operation Declaration |
|
3187
|
|
|
|
|
|
|
# |
|
3188
|
|
|
|
|
|
|
|
|
3189
|
|
|
|
|
|
|
sub visitOperation { |
|
3190
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3191
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
3192
|
|
|
|
|
|
|
|
|
3193
|
0
|
|
|
|
|
|
$self->{methodes} .= $self->_format_javadoc($node); |
|
3194
|
0
|
|
|
|
|
|
$self->{methodes} .= " " . $node->{java_proto} . ";\n"; # Interface |
|
3195
|
|
|
|
|
|
|
|
|
3196
|
0
|
|
|
|
|
|
$self->{abstract_methodes} .= $self->_format_javadoc($node); |
|
3197
|
0
|
|
|
|
|
|
$self->{abstract_methodes} .= " public abstract " . $node->{java_proto} . ";\n"; # Value |
|
3198
|
|
|
|
|
|
|
|
|
3199
|
0
|
|
|
|
|
|
$self->{stub} .= " public " . $node->{java_proto} . "\n"; |
|
3200
|
0
|
|
|
|
|
|
$self->{stub} .= " {\n"; |
|
3201
|
0
|
|
|
|
|
|
$self->{stub} .= " org.omg.CORBA.portable.InputStream \$is = null;\n"; |
|
3202
|
0
|
|
|
|
|
|
$self->{stub} .= " try {\n"; |
|
3203
|
0
|
0
|
|
|
|
|
if (exists $node->{modifier}) { # oneway |
|
3204
|
0
|
|
|
|
|
|
$self->{stub} .= " org.omg.CORBA.portable.OutputStream \$os = _request (\"" . $node->{idf} . "\", false);\n"; |
|
3205
|
|
|
|
|
|
|
} |
|
3206
|
|
|
|
|
|
|
else { |
|
3207
|
0
|
|
|
|
|
|
$self->{stub} .= " org.omg.CORBA.portable.OutputStream \$os = _request (\"" . $node->{idf} . "\", true);\n"; |
|
3208
|
|
|
|
|
|
|
} |
|
3209
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) { |
|
|
0
|
|
|
|
|
|
|
|
3210
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{type}); |
|
3211
|
0
|
0
|
|
|
|
|
if ($_->{attr} eq 'in') { |
|
|
|
0
|
|
|
|
|
|
|
3212
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $type->{java_write} . $_->{java_name} . ");\n"; |
|
3213
|
|
|
|
|
|
|
} |
|
3214
|
|
|
|
|
|
|
elsif ($_->{attr} eq 'inout') { |
|
3215
|
0
|
0
|
0
|
|
|
|
if ($type->isa('BoxedValue') and exists $type->{java_primitive}) { |
|
3216
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $type->{java_Helper} . ".write (\$os, new " . $type->{java_Name} . " (" . $_->{java_name} . ".value));\n"; |
|
3217
|
|
|
|
|
|
|
} |
|
3218
|
|
|
|
|
|
|
else { |
|
3219
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $type->{java_write} . $_->{java_name} . ".value);\n"; |
|
3220
|
|
|
|
|
|
|
} |
|
3221
|
|
|
|
|
|
|
} |
|
3222
|
|
|
|
|
|
|
} |
|
3223
|
0
|
0
|
|
|
|
|
if (exists $node->{list_context}) { |
|
3224
|
0
|
|
|
|
|
|
$self->{stub} .= " \$os.write_Context (context);\n"; |
|
3225
|
|
|
|
|
|
|
} |
|
3226
|
0
|
|
|
|
|
|
$self->{stub} .= " \$is = _invoke (\$os);\n"; |
|
3227
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type}); |
|
3228
|
0
|
0
|
|
|
|
|
unless ($type->isa('VoidType')) { |
|
3229
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $type->{java_Name} . " \$result = " . $type->{java_read} . ";\n"; |
|
3230
|
|
|
|
|
|
|
} |
|
3231
|
0
|
|
|
|
|
|
foreach (@{$node->{list_param}}) { |
|
|
0
|
|
|
|
|
|
|
|
3232
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{type}); |
|
3233
|
0
|
0
|
|
|
|
|
next if ($_->{attr} eq 'in'); |
|
3234
|
0
|
0
|
0
|
|
|
|
if ($type->isa('BoxedValue') and exists $type->{java_primitive}) { |
|
3235
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $_->{java_name} . ".value = (" . $type->{java_Helper} . ".read (\$is)).value;\n"; |
|
3236
|
|
|
|
|
|
|
} |
|
3237
|
|
|
|
|
|
|
else { |
|
3238
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $_->{java_name} . ".value = " . $type->{java_read} . ";\n"; |
|
3239
|
|
|
|
|
|
|
} |
|
3240
|
|
|
|
|
|
|
} |
|
3241
|
0
|
|
|
|
|
|
$type = $self->_get_defn($node->{type}); |
|
3242
|
0
|
0
|
|
|
|
|
if ($type->isa('VoidType')) { |
|
3243
|
0
|
|
|
|
|
|
$self->{stub} .= " return;\n"; |
|
3244
|
|
|
|
|
|
|
} |
|
3245
|
|
|
|
|
|
|
else { |
|
3246
|
0
|
|
|
|
|
|
$self->{stub} .= " return \$result;\n"; |
|
3247
|
|
|
|
|
|
|
} |
|
3248
|
0
|
|
|
|
|
|
$self->{stub} .= " } catch (org.omg.CORBA.portable.ApplicationException \$ex) {\n"; |
|
3249
|
0
|
|
|
|
|
|
$self->{stub} .= " \$is = \$ex.getInputStream ();\n"; |
|
3250
|
0
|
|
|
|
|
|
$self->{stub} .= " java.lang.String _id = \$ex.getId ();\n"; |
|
3251
|
0
|
0
|
|
|
|
|
if (exists $node->{list_raise}) { |
|
3252
|
0
|
|
|
|
|
|
my $first = 1; |
|
3253
|
0
|
|
|
|
|
|
foreach (@{$node->{list_raise}}) { # exception |
|
|
0
|
|
|
|
|
|
|
|
3254
|
0
|
|
|
|
|
|
my $defn = $self->_get_defn($_); |
|
3255
|
0
|
|
|
|
|
|
$self->{stub} .= " "; |
|
3256
|
0
|
0
|
|
|
|
|
$self->{stub} .= "else " unless ($first); |
|
3257
|
0
|
|
|
|
|
|
$self->{stub} .= "if (_id.equals (\"" . $defn->{repos_id} . "\"))\n"; |
|
3258
|
0
|
|
|
|
|
|
$self->{stub} .= " throw " . $defn->{java_Helper} . ".read (\$is);\n"; |
|
3259
|
0
|
|
|
|
|
|
$first = 0; |
|
3260
|
|
|
|
|
|
|
} |
|
3261
|
0
|
|
|
|
|
|
$self->{stub} .= " else\n"; |
|
3262
|
0
|
|
|
|
|
|
$self->{stub} .= " throw new org.omg.CORBA.MARSHAL (_id);\n"; |
|
3263
|
|
|
|
|
|
|
} |
|
3264
|
|
|
|
|
|
|
else { |
|
3265
|
0
|
|
|
|
|
|
$self->{stub} .= " throw new org.omg.CORBA.MARSHAL (_id);\n"; |
|
3266
|
|
|
|
|
|
|
} |
|
3267
|
0
|
|
|
|
|
|
$self->{stub} .= " } catch (org.omg.CORBA.portable.RemarshalException \$rm) {\n"; |
|
3268
|
0
|
0
|
|
|
|
|
if ($type->isa('VoidType')) { |
|
3269
|
0
|
|
|
|
|
|
$self->{stub} .= " " . $node->{java_call} . ";\n"; |
|
3270
|
|
|
|
|
|
|
} |
|
3271
|
|
|
|
|
|
|
else { |
|
3272
|
0
|
|
|
|
|
|
$self->{stub} .= " return " . $node->{java_call} . ";\n"; |
|
3273
|
|
|
|
|
|
|
} |
|
3274
|
0
|
|
|
|
|
|
$self->{stub} .= " } finally {\n"; |
|
3275
|
0
|
|
|
|
|
|
$self->{stub} .= " _releaseReply (\$is);\n"; |
|
3276
|
0
|
|
|
|
|
|
$self->{stub} .= " }\n"; |
|
3277
|
0
|
|
|
|
|
|
$self->{stub} .= " } // " . $node->{java_name} . "\n"; |
|
3278
|
0
|
|
|
|
|
|
$self->{stub} .= "\n"; |
|
3279
|
|
|
|
|
|
|
} |
|
3280
|
|
|
|
|
|
|
|
|
3281
|
|
|
|
|
|
|
# |
|
3282
|
|
|
|
|
|
|
# 3.14 Attribute Declaration |
|
3283
|
|
|
|
|
|
|
# |
|
3284
|
|
|
|
|
|
|
|
|
3285
|
|
|
|
|
|
|
sub visitAttributes { |
|
3286
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3287
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
3288
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) { |
|
|
0
|
|
|
|
|
|
|
|
3289
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); |
|
3290
|
|
|
|
|
|
|
} |
|
3291
|
|
|
|
|
|
|
} |
|
3292
|
|
|
|
|
|
|
|
|
3293
|
|
|
|
|
|
|
sub visitAttribute { |
|
3294
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
3295
|
0
|
|
|
|
|
|
my ($node) = @_; |
|
3296
|
0
|
|
|
|
|
|
$node->{_get}->visit($self); |
|
3297
|
0
|
0
|
|
|
|
|
$node->{_set}->visit($self) if (exists $node->{_set}); |
|
3298
|
|
|
|
|
|
|
} |
|
3299
|
|
|
|
|
|
|
|
|
3300
|
|
|
|
|
|
|
# |
|
3301
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations |
|
3302
|
|
|
|
|
|
|
# |
|
3303
|
|
|
|
|
|
|
|
|
3304
|
0
|
|
|
0
|
0
|
|
sub visitTypeId { |
|
3305
|
|
|
|
|
|
|
# empty |
|
3306
|
|
|
|
|
|
|
} |
|
3307
|
|
|
|
|
|
|
|
|
3308
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix { |
|
3309
|
|
|
|
|
|
|
# empty |
|
3310
|
|
|
|
|
|
|
} |
|
3311
|
|
|
|
|
|
|
|
|
3312
|
|
|
|
|
|
|
# |
|
3313
|
|
|
|
|
|
|
# 3.16 Event Declaration |
|
3314
|
|
|
|
|
|
|
# |
|
3315
|
|
|
|
|
|
|
|
|
3316
|
|
|
|
|
|
|
sub visitRegularEvent { |
|
3317
|
0
|
|
|
0
|
0
|
|
shift->_no_mapping(@_); |
|
3318
|
|
|
|
|
|
|
} |
|
3319
|
|
|
|
|
|
|
|
|
3320
|
|
|
|
|
|
|
sub visitAbstractEvent { |
|
3321
|
0
|
|
|
0
|
0
|
|
shift->_no_mapping(@_); |
|
3322
|
|
|
|
|
|
|
} |
|
3323
|
|
|
|
|
|
|
|
|
3324
|
|
|
|
|
|
|
# |
|
3325
|
|
|
|
|
|
|
# 3.17 Component Declaration |
|
3326
|
|
|
|
|
|
|
# |
|
3327
|
|
|
|
|
|
|
|
|
3328
|
|
|
|
|
|
|
sub visitComponent { |
|
3329
|
0
|
|
|
0
|
0
|
|
shift->_no_mapping(@_); |
|
3330
|
|
|
|
|
|
|
} |
|
3331
|
|
|
|
|
|
|
|
|
3332
|
|
|
|
|
|
|
sub visitForwardComponent { |
|
3333
|
0
|
|
|
0
|
0
|
|
shift->_no_mapping(@_); |
|
3334
|
|
|
|
|
|
|
} |
|
3335
|
|
|
|
|
|
|
|
|
3336
|
|
|
|
|
|
|
# |
|
3337
|
|
|
|
|
|
|
# 3.18 Home Declaration |
|
3338
|
|
|
|
|
|
|
# |
|
3339
|
|
|
|
|
|
|
|
|
3340
|
|
|
|
|
|
|
sub visitHome { |
|
3341
|
0
|
|
|
0
|
0
|
|
shift->_no_mapping(@_); |
|
3342
|
|
|
|
|
|
|
} |
|
3343
|
|
|
|
|
|
|
|
|
3344
|
|
|
|
|
|
|
1; |
|
3345
|
|
|
|
|
|
|
|