line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Interface Definition Language (OMG IDL CORBA v3.0)
|
4
|
|
|
|
|
|
|
#
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package CORBA::XS::CdrCVisitor;
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
11
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
9
|
1
|
|
|
1
|
|
7
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9475
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.60';
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# needs $node->{c_name} (CnameVisitor), $node->{c_literal} (CliteralVisitor)
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub open_stream {
|
16
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
17
|
0
|
|
|
|
|
|
my ($filename) = @_;
|
18
|
0
|
0
|
|
|
|
|
open $self->{out}, '>', $filename
|
19
|
|
|
|
|
|
|
or die "can't open $filename ($!).\n";
|
20
|
0
|
|
|
|
|
|
$self->{filename} = $filename;
|
21
|
|
|
|
|
|
|
}
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _get_defn {
|
24
|
0
|
|
|
0
|
|
|
my $self = shift;
|
25
|
0
|
|
|
|
|
|
my ($defn) = @_;
|
26
|
0
|
0
|
|
|
|
|
if (ref $defn) {
|
27
|
0
|
|
|
|
|
|
return $defn;
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
else {
|
30
|
0
|
|
|
|
|
|
return $self->{symbtab}->Lookup($defn);
|
31
|
|
|
|
|
|
|
}
|
32
|
|
|
|
|
|
|
}
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#
|
35
|
|
|
|
|
|
|
# 3.5 OMG IDL Specification (specialized)
|
36
|
|
|
|
|
|
|
#
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#
|
39
|
|
|
|
|
|
|
# 3.7 Module Declaration
|
40
|
|
|
|
|
|
|
#
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub visitModules {
|
43
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
44
|
0
|
|
|
|
|
|
my ($node) = @_;
|
45
|
0
|
0
|
|
|
|
|
unless (exists $node->{$self->{num_key}}) {
|
46
|
0
|
|
|
|
|
|
$node->{$self->{num_key}} = 0;
|
47
|
|
|
|
|
|
|
}
|
48
|
0
|
|
|
|
|
|
my $module = ${$node->{list_decl}}[$node->{$self->{num_key}}];
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$module->visit($self);
|
50
|
0
|
|
|
|
|
|
$node->{$self->{num_key}} ++;
|
51
|
|
|
|
|
|
|
}
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub visitModule {
|
54
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
55
|
0
|
|
|
|
|
|
my ($node) = @_;
|
56
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
57
|
0
|
|
|
|
|
|
my $defn = $self->{symbtab}->Lookup($node->{full});
|
58
|
0
|
|
|
|
|
|
print $FH "/*\n";
|
59
|
0
|
|
|
|
|
|
print $FH " * begin of module ",$defn->{c_name},"\n";
|
60
|
0
|
|
|
|
|
|
print $FH " */\n";
|
61
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) {
|
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self);
|
63
|
|
|
|
|
|
|
}
|
64
|
0
|
|
|
|
|
|
print $FH "\n";
|
65
|
0
|
|
|
|
|
|
print $FH "/*\n";
|
66
|
0
|
|
|
|
|
|
print $FH " * end of module ",$defn->{c_name},"\n";
|
67
|
0
|
|
|
|
|
|
print $FH " */\n";
|
68
|
0
|
|
|
|
|
|
print $FH "\n";
|
69
|
|
|
|
|
|
|
}
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#
|
72
|
|
|
|
|
|
|
# 3.8 Interface Declaration (specialized)
|
73
|
|
|
|
|
|
|
#
|
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
0
|
|
sub visitForwardRegularInterface {
|
76
|
|
|
|
|
|
|
# empty
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
0
|
|
sub visitBaseInterface {
|
80
|
|
|
|
|
|
|
# C mapping is aligned with CORBA 2.1
|
81
|
|
|
|
|
|
|
}
|
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
0
|
0
|
|
sub visitForwardBaseInterface {
|
84
|
|
|
|
|
|
|
# C mapping is aligned with CORBA 2.1
|
85
|
|
|
|
|
|
|
}
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#
|
88
|
|
|
|
|
|
|
# 3.10 Constant Declaration
|
89
|
|
|
|
|
|
|
#
|
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
0
|
0
|
|
sub visitConstant {
|
92
|
|
|
|
|
|
|
# empty
|
93
|
|
|
|
|
|
|
}
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#
|
96
|
|
|
|
|
|
|
# 3.11 Type Declaration
|
97
|
|
|
|
|
|
|
#
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub visitTypeDeclarators {
|
100
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
101
|
0
|
|
|
|
|
|
my ($node) = @_;
|
102
|
0
|
|
|
|
|
|
foreach (@{$node->{list_decl}}) {
|
|
0
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self);
|
104
|
|
|
|
|
|
|
}
|
105
|
|
|
|
|
|
|
}
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub visitTypeDeclarator {
|
108
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
109
|
0
|
|
|
|
|
|
my ($node) = @_;
|
110
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
111
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType')
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
112
|
|
|
|
|
|
|
or $type->isa('UnionType')
|
113
|
|
|
|
|
|
|
or $type->isa('EnumType')
|
114
|
|
|
|
|
|
|
or $type->isa('SequenceType')
|
115
|
|
|
|
|
|
|
or $type->isa('FixedPtType') ) {
|
116
|
0
|
|
|
|
|
|
$type->visit($self);
|
117
|
|
|
|
|
|
|
}
|
118
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
119
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) {
|
120
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitTypeDecalarator $node->{idf} : empty array_size.\n"
|
121
|
0
|
0
|
|
|
|
|
unless (@{$node->{array_size}});
|
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
my $start = q{};
|
124
|
0
|
|
|
|
|
|
my $nb;
|
125
|
0
|
|
|
|
|
|
my $first = 1;
|
126
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) {
|
|
0
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$start .= '[0]';
|
128
|
0
|
0
|
|
|
|
|
$nb .= ' * ' unless ($first);
|
129
|
0
|
|
|
|
|
|
$nb .= $_->{c_literal};
|
130
|
0
|
|
|
|
|
|
$first = 0;
|
131
|
|
|
|
|
|
|
}
|
132
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name},"(size,v) {\\\n";
|
133
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
134
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(v)" . $start . ";\\\n";
|
135
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(v)" . $start . " + (",$nb,");\\\n";
|
136
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
137
|
0
|
|
|
|
|
|
print $FH "\t\t\tADD_SIZE_",$type->{c_name},"(size,*",$node->{c_name},"_ptr);\\\n";
|
138
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
139
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
140
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name},"(ptr,v) {\\\n";
|
141
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
142
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(v)" . $start . ";\\\n";
|
143
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(v)" . $start . " + (",$nb,");\\\n";
|
144
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
145
|
0
|
|
|
|
|
|
print $FH "\t\t\tPUT_",$type->{c_name},"(ptr,*",$node->{c_name},"_ptr);\\\n";
|
146
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
147
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
148
|
0
|
0
|
|
|
|
|
if (defined $node->{length}) {
|
149
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
150
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name},"(ptr,v) {\\\n";
|
151
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
152
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
153
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
154
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
155
|
0
|
|
|
|
|
|
print $FH "\t\t\tGET_inout_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
156
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
157
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
158
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
159
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
160
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
161
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
162
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
163
|
0
|
|
|
|
|
|
print $FH "\t\t\tGET_out_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
164
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
165
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
166
|
0
|
|
|
|
|
|
print $FH "#define ALLOC_GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
167
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
168
|
0
|
|
|
|
|
|
print $FH "\t\tptr = ",$type->{c_name},"__alloc(",$nb,");\\\n";
|
169
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL == ptr) goto err;\\\n";
|
170
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
171
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
172
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
173
|
0
|
|
|
|
|
|
print $FH "\t\t\tGET_out_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
174
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
175
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
176
|
|
|
|
|
|
|
}
|
177
|
|
|
|
|
|
|
else {
|
178
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
179
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
180
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
181
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
182
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
183
|
0
|
|
|
|
|
|
print $FH "\t\t\tGET_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
184
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
185
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
186
|
0
|
|
|
|
|
|
print $FH "#define FREE_in_",$node->{c_name},"(v) {\\\n";
|
187
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
188
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
189
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
190
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
191
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_in_",$type->{c_name},"(",$node->{c_name},"_ptr);\\\n";
|
192
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
193
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
194
|
0
|
|
|
|
|
|
print $FH "#define FREE_inout_",$node->{c_name},"(v) {\\\n";
|
195
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
196
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
197
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
198
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
199
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_inout_",$type->{c_name},"(",$node->{c_name},"_ptr);\\\n";
|
200
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
201
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
202
|
|
|
|
|
|
|
}
|
203
|
0
|
|
|
|
|
|
print $FH "#define FREE_out_",$node->{c_name},"(v) {\\\n";
|
204
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
205
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
206
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
207
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
208
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_out_",$type->{c_name},"(",$node->{c_name},"_ptr);\\\n";
|
209
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
210
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
211
|
0
|
|
|
|
|
|
print $FH "#define FREE_",$node->{c_name},"(v) {\\\n";
|
212
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
213
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
214
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
215
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
216
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_",$type->{c_name},"(",$node->{c_name},"_ptr);\\\n";
|
217
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
218
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
219
|
|
|
|
|
|
|
}
|
220
|
|
|
|
|
|
|
else {
|
221
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
222
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
223
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = &(*(v))" . $start . ";\\\n";
|
224
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < &(*(v))" . $start . " + (",$nb,");\\\n";
|
225
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
226
|
0
|
|
|
|
|
|
print $FH "\t\t\tGET_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
227
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
228
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
229
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
230
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
231
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
232
|
|
|
|
|
|
|
}
|
233
|
|
|
|
|
|
|
}
|
234
|
|
|
|
|
|
|
}
|
235
|
|
|
|
|
|
|
else {
|
236
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name}," ADD_SIZE_",$type->{c_name},"\n";
|
237
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name}," PUT_",$type->{c_name},"\n";
|
238
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name}," GET_",$type->{c_name},"\n";
|
239
|
0
|
0
|
|
|
|
|
if (defined $node->{length}) {
|
240
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
241
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name}," GET_inout_",$type->{c_name},"\n";
|
242
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name}," GET_out_",$type->{c_name},"\n";
|
243
|
0
|
|
|
|
|
|
print $FH "#define ALLOC_GET_out_",$node->{c_name}," ALLOC_GET_out_",$type->{c_name},"\n";
|
244
|
|
|
|
|
|
|
}
|
245
|
|
|
|
|
|
|
else {
|
246
|
0
|
|
|
|
|
|
print $FH "#define FREE_in_",$node->{c_name}," FREE_in_",$type->{c_name},"\n";
|
247
|
0
|
|
|
|
|
|
print $FH "#define FREE_inout_",$node->{c_name}," FREE_inout_",$type->{c_name},"\n";
|
248
|
|
|
|
|
|
|
}
|
249
|
0
|
|
|
|
|
|
print $FH "#define FREE_out_",$node->{c_name}," FREE_out_",$type->{c_name},"\n";
|
250
|
0
|
|
|
|
|
|
print $FH "#define FREE_",$node->{c_name}," FREE_",$type->{c_name},"\n";
|
251
|
|
|
|
|
|
|
}
|
252
|
|
|
|
|
|
|
else {
|
253
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
254
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
255
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
256
|
|
|
|
|
|
|
}
|
257
|
|
|
|
|
|
|
}
|
258
|
|
|
|
|
|
|
}
|
259
|
0
|
|
|
|
|
|
print $FH "\n";
|
260
|
|
|
|
|
|
|
}
|
261
|
|
|
|
|
|
|
|
262
|
0
|
|
|
0
|
0
|
|
sub visitNativeType {
|
263
|
|
|
|
|
|
|
# empty
|
264
|
|
|
|
|
|
|
}
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
#
|
267
|
|
|
|
|
|
|
# 3.11.2 Constructed Types
|
268
|
|
|
|
|
|
|
#
|
269
|
|
|
|
|
|
|
# 3.11.2.1 Structures
|
270
|
|
|
|
|
|
|
#
|
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
sub visitStructType {
|
273
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
274
|
0
|
|
|
|
|
|
my ($node) = @_;
|
275
|
0
|
0
|
|
|
|
|
return if (exists $self->{done_hash}->{$node->{c_name}});
|
276
|
0
|
|
|
|
|
|
$self->{done_hash}->{$node->{c_name}} = 1;
|
277
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{type});
|
279
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType')
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
280
|
|
|
|
|
|
|
or $type->isa('UnionType')
|
281
|
|
|
|
|
|
|
or $type->isa('SequenceType')
|
282
|
|
|
|
|
|
|
or $type->isa('FixedPtType') ) {
|
283
|
0
|
|
|
|
|
|
$type->visit($self);
|
284
|
|
|
|
|
|
|
}
|
285
|
|
|
|
|
|
|
}
|
286
|
0
|
|
|
|
|
|
$self->{add_size} = q{};
|
287
|
0
|
|
|
|
|
|
$self->{put} = q{};
|
288
|
0
|
|
|
|
|
|
$self->{get} = q{};
|
289
|
0
|
|
|
|
|
|
$self->{get_in} = q{};
|
290
|
0
|
|
|
|
|
|
$self->{get_inout} = q{};
|
291
|
0
|
|
|
|
|
|
$self->{get_out} = q{};
|
292
|
0
|
|
|
|
|
|
$self->{free} = q{};
|
293
|
0
|
|
|
|
|
|
$self->{union} = q{};
|
294
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) {
|
|
0
|
|
|
|
|
|
|
295
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # member
|
296
|
|
|
|
|
|
|
}
|
297
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
298
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name},"(size,v) {\\\n";
|
299
|
0
|
|
|
|
|
|
print $FH $self->{add_size};
|
300
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
301
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name},"(ptr,v) {\\\n";
|
302
|
0
|
|
|
|
|
|
print $FH $self->{put};
|
303
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
304
|
0
|
0
|
|
|
|
|
if (defined $node->{length}) {
|
305
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
306
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name},"(ptr,v) {\\\n";
|
307
|
0
|
|
|
|
|
|
print $FH $self->{get_inout};
|
308
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
309
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
310
|
0
|
|
|
|
|
|
print $FH $self->{get_out};
|
311
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
312
|
0
|
|
|
|
|
|
print $FH "#define ALLOC_GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
313
|
0
|
|
|
|
|
|
print $FH "\t\tv = ",$node->{c_name},"__alloc(1);\\\n";
|
314
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL == (v)) goto err;\\\n";
|
315
|
0
|
|
|
|
|
|
print $FH $self->{get_out};
|
316
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
317
|
|
|
|
|
|
|
}
|
318
|
|
|
|
|
|
|
else {
|
319
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
320
|
0
|
|
|
|
|
|
print $FH $self->{get};
|
321
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
322
|
0
|
|
|
|
|
|
print $FH "#define FREE_in_",$node->{c_name}," FREE_",$node->{c_name},"\n";
|
323
|
0
|
|
|
|
|
|
print $FH "#define FREE_inout_",$node->{c_name}," FREE_",$node->{c_name},"\n";
|
324
|
|
|
|
|
|
|
}
|
325
|
0
|
|
|
|
|
|
print $FH "#define FREE_out_",$node->{c_name},"(v) {\\\n";
|
326
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL != (v)) {\\\n";
|
327
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_",$node->{c_name},"(v);\\\n";
|
328
|
0
|
|
|
|
|
|
print $FH "\t\t\tCORBA_free(v);\\\n";
|
329
|
0
|
|
|
|
|
|
print $FH "\t}\\\n";
|
330
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
331
|
0
|
|
|
|
|
|
print $FH "#define FREE_",$node->{c_name},"(v) {\\\n";
|
332
|
0
|
|
|
|
|
|
print $FH $self->{free};
|
333
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
334
|
|
|
|
|
|
|
}
|
335
|
|
|
|
|
|
|
else {
|
336
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
337
|
0
|
|
|
|
|
|
print $FH $self->{get};
|
338
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
339
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
340
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
341
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
342
|
|
|
|
|
|
|
}
|
343
|
|
|
|
|
|
|
}
|
344
|
0
|
|
|
|
|
|
print $FH "\n";
|
345
|
0
|
|
|
|
|
|
delete $self->{add_size};
|
346
|
0
|
|
|
|
|
|
delete $self->{put};
|
347
|
0
|
|
|
|
|
|
delete $self->{get};
|
348
|
0
|
|
|
|
|
|
delete $self->{get_in};
|
349
|
0
|
|
|
|
|
|
delete $self->{get_inout};
|
350
|
0
|
|
|
|
|
|
delete $self->{get_out};
|
351
|
0
|
|
|
|
|
|
delete $self->{free};
|
352
|
0
|
|
|
|
|
|
delete $self->{union};
|
353
|
|
|
|
|
|
|
}
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub visitMember {
|
356
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
357
|
0
|
|
|
|
|
|
my ($node) = @_;
|
358
|
0
|
0
|
|
|
|
|
if (exists $node->{array_size}) {
|
359
|
0
|
|
|
|
|
|
$self->_visitArray($node);
|
360
|
|
|
|
|
|
|
}
|
361
|
|
|
|
|
|
|
else {
|
362
|
0
|
|
|
|
|
|
$self->_visitSingle($node);
|
363
|
|
|
|
|
|
|
}
|
364
|
|
|
|
|
|
|
}
|
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub _visitArray {
|
367
|
0
|
|
|
0
|
|
|
my $self = shift;
|
368
|
0
|
|
|
|
|
|
my ($node) = @_;
|
369
|
|
|
|
|
|
|
|
370
|
0
|
|
|
|
|
|
my $start = q{};
|
371
|
0
|
|
|
|
|
|
my $nb;
|
372
|
0
|
|
|
|
|
|
my $first = 1;
|
373
|
0
|
|
|
|
|
|
foreach (@{$node->{array_size}}) {
|
|
0
|
|
|
|
|
|
|
374
|
0
|
|
|
|
|
|
$start .= '[0]';
|
375
|
0
|
0
|
|
|
|
|
$nb .= ' * ' unless ($first);
|
376
|
0
|
|
|
|
|
|
$nb .= $_->{c_literal};
|
377
|
0
|
|
|
|
|
|
$first = 0;
|
378
|
|
|
|
|
|
|
}
|
379
|
|
|
|
|
|
|
|
380
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
381
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t{\\\n";
|
382
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
383
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)." . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
384
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)." . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
385
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
386
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t\t\tADD_SIZE_" . $type->{c_name} . "(size,*" . $node->{c_name} . "_ptr);\\\n";
|
387
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t\t}\\\n";
|
388
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\t}\\\n";
|
389
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t{\\\n";
|
390
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
391
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)." . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
392
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)." . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
393
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
394
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t\t\tPUT_" . $type->{c_name} . "(ptr,*" . $node->{c_name} . "_ptr);\\\n";
|
395
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t\t}\\\n";
|
396
|
0
|
|
|
|
|
|
$self->{put} .= "\t\t}\\\n";
|
397
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t{\\\n";
|
398
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
399
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
400
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
401
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
402
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t\t\tGET_" . $type->{c_name} . "(ptr," . $node->{c_name} . "_ptr);\\\n";
|
403
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t\t}\\\n";
|
404
|
0
|
|
|
|
|
|
$self->{get} .= "\t\t}\\\n";
|
405
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t{\\\n";
|
406
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
407
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
408
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
409
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
410
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t\t\tGET_in_" . $type->{c_name} . "(ptr," . $node->{c_name} . "_ptr);\\\n";
|
411
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t\t}\\\n";
|
412
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\t}\\\n";
|
413
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t{\\\n";
|
414
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
415
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
416
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
417
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
418
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t\t\tGET_inout_" . $type->{c_name} . "(ptr," . $node->{c_name} . "_ptr);\\\n";
|
419
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t\t}\\\n";
|
420
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\t}\\\n";
|
421
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t{\\\n";
|
422
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
423
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
424
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
425
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
426
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t\t\tGET_" . $type->{c_name} . "(ptr," . $node->{c_name} . "_ptr);\\\n";
|
427
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t\t}\\\n";
|
428
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\t}\\\n";
|
429
|
0
|
0
|
|
|
|
|
if (defined $type->{length}) {
|
430
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t{\\\n";
|
431
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t\t" . $type->{c_name} . " * " . $node->{c_name} . "_ptr;\\\n";
|
432
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t\tfor (" . $node->{c_name} . "_ptr = &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . ";\\\n";
|
433
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t\t " . $node->{c_name} . "_ptr < &((v)->" . $self->{union} . $node->{c_name} . ")" . $start . " + (" . $nb . ");\\\n";
|
434
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t\t " . $node->{c_name} . "_ptr++) {\\\n";
|
435
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t\t\tFREE_" . $type->{c_name} . "(" . $node->{c_name} . "_ptr);\\\n";
|
436
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t\t}\\\n";
|
437
|
0
|
|
|
|
|
|
$self->{free} .= "\t\t}\\\n";
|
438
|
|
|
|
|
|
|
}
|
439
|
|
|
|
|
|
|
}
|
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
sub _visitSingle {
|
442
|
0
|
|
|
0
|
|
|
my $self = shift;
|
443
|
0
|
|
|
|
|
|
my ($node) = @_;
|
444
|
0
|
|
|
|
|
|
my $tab = q{};
|
445
|
0
|
0
|
|
|
|
|
$tab = "\t" if ($self->{union});
|
446
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
447
|
0
|
|
|
|
|
|
$self->{add_size} .= $tab . "\t\tADD_SIZE_" . $type->{c_name};
|
448
|
0
|
|
|
|
|
|
$self->{add_size} .= "(size,(v)." . $self->{union} . $node->{c_name} . ");\\\n";
|
449
|
0
|
|
|
|
|
|
$self->{put} .= $tab . "\t\tPUT_" . $type->{c_name};
|
450
|
0
|
|
|
|
|
|
$self->{put} .= "(ptr,(v)." . $self->{union} . $node->{c_name} . ");\\\n";
|
451
|
0
|
|
|
|
|
|
$self->{get} .= $tab . "\t\tGET_" . $type->{c_name};
|
452
|
0
|
|
|
|
|
|
$self->{get} .= "(ptr,&((v)->" . $self->{union} . $node->{c_name} . "));\\\n";
|
453
|
0
|
|
|
|
|
|
$self->{get_in} .= $tab . "\t\tGET_in_" . $type->{c_name};
|
454
|
0
|
|
|
|
|
|
$self->{get_in} .= "(ptr,&((v)->" . $self->{union} . $node->{c_name} . "));\\\n";
|
455
|
0
|
|
|
|
|
|
$self->{get_inout} .= $tab . "\t\tGET_inout_" . $type->{c_name};
|
456
|
0
|
|
|
|
|
|
$self->{get_inout} .= "(ptr,&((v)->" . $self->{union} . $node->{c_name} . "));\\\n";
|
457
|
0
|
|
|
|
|
|
$self->{get_out} .= $tab . "\t\tGET_out_" . $type->{c_name};
|
458
|
0
|
|
|
|
|
|
$self->{get_out} .= "(ptr,&((v)->" . $self->{union} . $node->{c_name} . "));\\\n";
|
459
|
0
|
0
|
|
|
|
|
if (defined $type->{length}) {
|
460
|
0
|
|
|
|
|
|
$self->{free} .= $tab . "\t\tFREE_" . $type->{c_name};
|
461
|
0
|
|
|
|
|
|
$self->{free} .= "(&((v)->" . $self->{union} . $node->{c_name} . "));\\\n";
|
462
|
|
|
|
|
|
|
}
|
463
|
|
|
|
|
|
|
}
|
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
# 3.11.2.2 Discriminated Unions
|
466
|
|
|
|
|
|
|
#
|
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
sub visitUnionType {
|
469
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
470
|
0
|
|
|
|
|
|
my ($node) = @_;
|
471
|
0
|
0
|
|
|
|
|
return if (exists $self->{done_hash}->{$node->{c_name}});
|
472
|
0
|
|
|
|
|
|
$self->{done_hash}->{$node->{c_name}} = 1;
|
473
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
474
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{element}->{type});
|
475
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType')
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
476
|
|
|
|
|
|
|
or $type->isa('UnionType')
|
477
|
|
|
|
|
|
|
or $type->isa('SequenceType')
|
478
|
|
|
|
|
|
|
or $type->isa('FixedPtType') ) {
|
479
|
0
|
|
|
|
|
|
$type->visit($self);
|
480
|
|
|
|
|
|
|
}
|
481
|
|
|
|
|
|
|
}
|
482
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
483
|
0
|
|
|
|
|
|
$self->{add_size} = q{};
|
484
|
0
|
|
|
|
|
|
$self->{put} = q{};
|
485
|
0
|
|
|
|
|
|
$self->{get} = q{};
|
486
|
0
|
|
|
|
|
|
$self->{get_in} = q{};
|
487
|
0
|
|
|
|
|
|
$self->{get_inout} = q{};
|
488
|
0
|
|
|
|
|
|
$self->{get_out} = q{};
|
489
|
0
|
|
|
|
|
|
$self->{free} = q{};
|
490
|
0
|
|
|
|
|
|
$self->{union} = '_u.';
|
491
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
492
|
0
|
|
|
|
|
|
$_->visit($self); # case
|
493
|
|
|
|
|
|
|
}
|
494
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
495
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name},"(size,v) {\\\n";
|
496
|
0
|
|
|
|
|
|
print $FH "\t\tADD_SIZE_",$type->{c_name},"(size,(v)._d);\\\n";
|
497
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)._d) {\\\n";
|
498
|
0
|
|
|
|
|
|
print $FH $self->{add_size};
|
499
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
500
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
501
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name},"(ptr,v) {\\\n";
|
502
|
0
|
|
|
|
|
|
print $FH "\t\tPUT_",$type->{c_name},"(ptr,(v)._d);\\\n";
|
503
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)._d) {\\\n";
|
504
|
0
|
|
|
|
|
|
print $FH $self->{put};
|
505
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
506
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
507
|
0
|
0
|
|
|
|
|
if (defined $node->{length}) {
|
508
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
509
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name},"(ptr,v) {\\\n";
|
510
|
0
|
|
|
|
|
|
print $FH "\t\tGET_inout_",$type->{c_name},"(ptr,&((v)->_d));\\\n";
|
511
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)->_d) {\\\n";
|
512
|
0
|
|
|
|
|
|
print $FH $self->{get_inout};
|
513
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
514
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
515
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
516
|
0
|
|
|
|
|
|
print $FH "\t\tGET_out_",$type->{c_name},"(ptr,&((v)->_d));\\\n";
|
517
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)->_d) {\\\n";
|
518
|
0
|
|
|
|
|
|
print $FH $self->{get_out};
|
519
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
520
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
521
|
0
|
|
|
|
|
|
print $FH "#define ALLOC_GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
522
|
0
|
|
|
|
|
|
print $FH "\t\tv = ",$node->{c_name},"__alloc(1);\\\n";
|
523
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL == (v)) goto err;\\\n";
|
524
|
0
|
|
|
|
|
|
print $FH "\t\tGET_out_",$type->{c_name},"(ptr,&((v)->_d));\\\n";
|
525
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)->_d) {\\\n";
|
526
|
0
|
|
|
|
|
|
print $FH $self->{get_out};
|
527
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
528
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
529
|
|
|
|
|
|
|
}
|
530
|
|
|
|
|
|
|
else {
|
531
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
532
|
0
|
|
|
|
|
|
print $FH "\t\tGET_",$type->{c_name},"(ptr,&((v)->_d));\\\n";
|
533
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)->_d) {\\\n";
|
534
|
0
|
|
|
|
|
|
print $FH $self->{get};
|
535
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
536
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
537
|
0
|
|
|
|
|
|
print $FH "#define FREE_in_",$node->{c_name}," FREE_",$node->{c_name},"\n";
|
538
|
0
|
|
|
|
|
|
print $FH "#define FREE_inout_",$node->{c_name}," FREE_",$node->{c_name},"\n";
|
539
|
|
|
|
|
|
|
}
|
540
|
0
|
|
|
|
|
|
print $FH "#define FREE_out_",$node->{c_name},"(v) {\\\n";
|
541
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL != (v)) {\\\n";
|
542
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_",$node->{c_name},"(v);\\\n";
|
543
|
0
|
|
|
|
|
|
print $FH "\t\t\tCORBA_free(v);\\\n";
|
544
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
545
|
0
|
|
|
|
|
|
print $FH "#define FREE_",$node->{c_name},"(v) {\\\n";
|
546
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)->_d) {\\\n";
|
547
|
0
|
|
|
|
|
|
print $FH $self->{free};
|
548
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
549
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
550
|
|
|
|
|
|
|
}
|
551
|
|
|
|
|
|
|
else {
|
552
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
553
|
0
|
|
|
|
|
|
print $FH "\t\tGET_",$type->{c_name},"(ptr,&((v)->_d));\\\n";
|
554
|
0
|
|
|
|
|
|
print $FH "\t\tswitch ((v)->_d) {\\\n";
|
555
|
0
|
|
|
|
|
|
print $FH $self->{get};
|
556
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
557
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
558
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
559
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
560
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
561
|
|
|
|
|
|
|
}
|
562
|
|
|
|
|
|
|
}
|
563
|
0
|
|
|
|
|
|
print $FH "\n";
|
564
|
0
|
|
|
|
|
|
delete $self->{add_size};
|
565
|
0
|
|
|
|
|
|
delete $self->{put};
|
566
|
0
|
|
|
|
|
|
delete $self->{get};
|
567
|
0
|
|
|
|
|
|
delete $self->{get_in};
|
568
|
0
|
|
|
|
|
|
delete $self->{get_inout};
|
569
|
0
|
|
|
|
|
|
delete $self->{get_out};
|
570
|
0
|
|
|
|
|
|
delete $self->{free};
|
571
|
0
|
|
|
|
|
|
delete $self->{union};
|
572
|
|
|
|
|
|
|
}
|
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
sub visitCase {
|
575
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
576
|
0
|
|
|
|
|
|
my ($node) = @_;
|
577
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
578
|
0
|
|
|
|
|
|
foreach (@{$node->{list_label}}) { # default or expression
|
|
0
|
|
|
|
|
|
|
579
|
0
|
0
|
|
|
|
|
if ($_->isa('Default')) {
|
580
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\tdefault:\\\n";
|
581
|
0
|
|
|
|
|
|
$self->{put} .= "\t\tdefault:\\\n";
|
582
|
0
|
|
|
|
|
|
$self->{get} .= "\t\tdefault:\\\n";
|
583
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\tdefault:\\\n";
|
584
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\tdefault:\\\n";
|
585
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\tdefault:\\\n";
|
586
|
0
|
|
|
|
|
|
$self->{free} .= "\t\tdefault:\\\n";
|
587
|
|
|
|
|
|
|
}
|
588
|
|
|
|
|
|
|
else {
|
589
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
590
|
0
|
|
|
|
|
|
$self->{put} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
591
|
0
|
|
|
|
|
|
$self->{get} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
592
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
593
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
594
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
595
|
0
|
|
|
|
|
|
$self->{free} .= "\t\tcase " . $_->{c_literal} . ":\\\n";
|
596
|
|
|
|
|
|
|
}
|
597
|
|
|
|
|
|
|
}
|
598
|
0
|
|
|
|
|
|
$self->_get_defn($node->{element}->{value})->visit($self); # member
|
599
|
0
|
|
|
|
|
|
$self->{add_size} .= "\t\tbreak;\\\n";
|
600
|
0
|
|
|
|
|
|
$self->{put} .= "\t\tbreak;\\\n";
|
601
|
0
|
|
|
|
|
|
$self->{get} .= "\t\tbreak;\\\n";
|
602
|
0
|
|
|
|
|
|
$self->{get_in} .= "\t\tbreak;\\\n";
|
603
|
0
|
|
|
|
|
|
$self->{get_inout} .= "\t\tbreak;\\\n";
|
604
|
0
|
|
|
|
|
|
$self->{get_out} .= "\t\tbreak;\\\n";
|
605
|
0
|
|
|
|
|
|
$self->{free} .= "\t\tbreak;\\\n";
|
606
|
|
|
|
|
|
|
}
|
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
# 3.11.2.3 Constructed Recursive Types and Forward Declarations
|
609
|
|
|
|
|
|
|
#
|
610
|
|
|
|
|
|
|
|
611
|
0
|
|
|
0
|
0
|
|
sub visitForwardStructType {
|
612
|
|
|
|
|
|
|
# empty
|
613
|
|
|
|
|
|
|
}
|
614
|
|
|
|
|
|
|
|
615
|
0
|
|
|
0
|
0
|
|
sub visitForwardUnionType {
|
616
|
|
|
|
|
|
|
# empty
|
617
|
|
|
|
|
|
|
}
|
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
# 3.11.2.4 Enumerations
|
620
|
|
|
|
|
|
|
#
|
621
|
|
|
|
|
|
|
|
622
|
|
|
|
|
|
|
sub visitEnumType {
|
623
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
624
|
0
|
|
|
|
|
|
my ($node) = @_;
|
625
|
0
|
0
|
|
|
|
|
return if (exists $self->{done_hash}->{$node->{c_name}});
|
626
|
0
|
|
|
|
|
|
$self->{done_hash}->{$node->{c_name}} = 1;
|
627
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
628
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name}," ADD_SIZE_CORBA_unsigned_long\n";
|
629
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name}," PUT_CORBA_unsigned_long\n";
|
630
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name}," GET_CORBA_unsigned_long\n";
|
631
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
632
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
633
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name}," GET_",$node->{c_name},"\n";
|
634
|
|
|
|
|
|
|
}
|
635
|
0
|
|
|
|
|
|
print $FH "\n";
|
636
|
|
|
|
|
|
|
}
|
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
#
|
639
|
|
|
|
|
|
|
# 3.11.3 Template Types
|
640
|
|
|
|
|
|
|
#
|
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
sub visitSequenceType {
|
643
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
644
|
0
|
|
|
|
|
|
my ($node) = @_;
|
645
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($node->{type});
|
646
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('SequenceType')
|
647
|
|
|
|
|
|
|
or $type->isa('FixedPtType') ) {
|
648
|
0
|
|
|
|
|
|
$type->visit($self);
|
649
|
|
|
|
|
|
|
}
|
650
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
651
|
0
|
|
|
|
|
|
print $FH "#ifndef _ALIGN_",$node->{c_name},"_defined\n";
|
652
|
0
|
|
|
|
|
|
print $FH "#define _ALIGN_",$node->{c_name},"_defined\n";
|
653
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name},"(size,v) {\\\n";
|
654
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
655
|
0
|
|
|
|
|
|
print $FH "\t\tADD_SIZE_CORBA_unsigned_long(size,(v)._length);\\\n";
|
656
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = (v)._buffer;\\\n";
|
657
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < (v)._buffer + (v)._length;\\\n";
|
658
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
659
|
0
|
|
|
|
|
|
print $FH "\t\t\tADD_SIZE_",$type->{c_name},"(size,*",$node->{c_name},"_ptr);\\\n";
|
660
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
661
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
662
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name},"(ptr,v) {\\\n";
|
663
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
664
|
0
|
|
|
|
|
|
print $FH "\t\tPUT_CORBA_unsigned_long(ptr,(v)._length);\\\n";
|
665
|
0
|
|
|
|
|
|
print $FH "\t\tfor (",$node->{c_name},"_ptr = (v)._buffer;\\\n";
|
666
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr < (v)._buffer + (v)._length;\\\n";
|
667
|
0
|
|
|
|
|
|
print $FH "\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
668
|
0
|
|
|
|
|
|
print $FH "\t\t\tPUT_",$type->{c_name},"(ptr,*",$node->{c_name},"_ptr);\\\n";
|
669
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
670
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
671
|
0
|
|
|
|
|
|
my $nb = "(v)->_length";
|
672
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
673
|
0
|
0
|
|
|
|
|
$nb = $node->{max}->{c_literal} if (exists $node->{max});
|
674
|
0
|
|
|
|
|
|
print $FH "#define GET_inout_",$node->{c_name},"(ptr,v) {\\\n";
|
675
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
676
|
0
|
|
|
|
|
|
print $FH "\t\tGET_CORBA_unsigned_long(ptr,&((v)->_length));\\\n";
|
677
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL != (v)->_buffer) CORBA_free((v)->_buffer);\\\n";
|
678
|
0
|
|
|
|
|
|
print $FH "\t\tif (0 != ",$nb,") {\\\n";
|
679
|
0
|
|
|
|
|
|
print $FH "\t\t\t(v)->_buffer = ",$node->{c_name},"__allocbuf(",$nb,");\\\n";
|
680
|
0
|
|
|
|
|
|
print $FH "\t\t\tif (NULL == (v)->_buffer) goto err;\\\n";
|
681
|
0
|
|
|
|
|
|
print $FH "\t\t\tfor (",$node->{c_name},"_ptr = (v)->_buffer;\\\n";
|
682
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr < (v)->_buffer + (v)->_length;\\\n";
|
683
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
684
|
0
|
|
|
|
|
|
print $FH "\t\t\t\tGET_inout_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
685
|
0
|
|
|
|
|
|
print $FH "\t\t\t}\\\n";
|
686
|
0
|
|
|
|
|
|
print $FH "\t\t} else {\\\n";
|
687
|
0
|
|
|
|
|
|
print $FH "\t\t\t(v)->_buffer = NULL;\\\n";
|
688
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
689
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
690
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
691
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
692
|
0
|
|
|
|
|
|
print $FH "\t\tGET_CORBA_unsigned_long(ptr,&((v)->_length));\\\n";
|
693
|
0
|
|
|
|
|
|
print $FH "\t\tif (0 != ",$nb,") {\\\n";
|
694
|
0
|
|
|
|
|
|
print $FH "\t\t\t(v)->_buffer = ",$node->{c_name},"__allocbuf(",$nb,");\\\n";
|
695
|
0
|
|
|
|
|
|
print $FH "\t\t\tif (NULL == (v)->_buffer) goto err;\\\n";
|
696
|
0
|
|
|
|
|
|
print $FH "\t\t\tfor (",$node->{c_name},"_ptr = (v)->_buffer;\\\n";
|
697
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr < (v)->_buffer + (v)->_length;\\\n";
|
698
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
699
|
0
|
|
|
|
|
|
print $FH "\t\t\t\tGET_out_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
700
|
0
|
|
|
|
|
|
print $FH "\t\t\t}\\\n";
|
701
|
0
|
|
|
|
|
|
print $FH "\t\t} else {\\\n";
|
702
|
0
|
|
|
|
|
|
print $FH "\t\t\t(v)->_buffer = NULL;\\\n";
|
703
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
704
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
705
|
0
|
|
|
|
|
|
print $FH "#define ALLOC_GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
706
|
0
|
|
|
|
|
|
print $FH "\t\tv = ",$node->{c_name},"__alloc(1);\\\n";
|
707
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL == (v)) goto err;\\\n";
|
708
|
0
|
|
|
|
|
|
print $FH "\t\tGET_out_",$node->{c_name},"(ptr, v);\\\n";
|
709
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
710
|
|
|
|
|
|
|
}
|
711
|
|
|
|
|
|
|
else {
|
712
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
713
|
0
|
|
|
|
|
|
print $FH "\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
714
|
0
|
|
|
|
|
|
print $FH "\t\tGET_CORBA_unsigned_long(ptr,&((v)->_length));\\\n";
|
715
|
0
|
|
|
|
|
|
print $FH "\t\tif (0 != (v)->_length) {\\\n";
|
716
|
0
|
|
|
|
|
|
print $FH "\t\t\t(v)->_buffer = ",$node->{c_name},"__allocbuf(",$nb,");\\\n";
|
717
|
0
|
|
|
|
|
|
print $FH "\t\t\tif (NULL == (v)->_buffer) goto err;\\\n";
|
718
|
0
|
|
|
|
|
|
print $FH "\t\t\tfor (",$node->{c_name},"_ptr = (v)->_buffer;\\\n";
|
719
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr < (v)->_buffer + (v)->_length;\\\n";
|
720
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
721
|
0
|
|
|
|
|
|
print $FH "\t\t\t\tGET_",$type->{c_name},"(ptr,",$node->{c_name},"_ptr);\\\n";
|
722
|
0
|
|
|
|
|
|
print $FH "\t\t\t}\\\n";
|
723
|
0
|
|
|
|
|
|
print $FH "\t\t} else {\\\n";
|
724
|
0
|
|
|
|
|
|
print $FH "\t\t\t(v)->_buffer = NULL;\\\n";
|
725
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
726
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
727
|
0
|
|
|
|
|
|
print $FH "#define FREE_in_",$node->{c_name}," FREE_",$node->{c_name},"\n";
|
728
|
0
|
|
|
|
|
|
print $FH "#define FREE_inout_",$node->{c_name}," FREE_",$node->{c_name},"\n";
|
729
|
|
|
|
|
|
|
}
|
730
|
0
|
|
|
|
|
|
print $FH "#define FREE_out_",$node->{c_name},"(v) {\\\n";
|
731
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL != (v)) {\\\n";
|
732
|
0
|
|
|
|
|
|
print $FH "\t\t\tFREE_",$node->{c_name},"(v);\\\n";
|
733
|
0
|
|
|
|
|
|
print $FH "\t\t\tCORBA_free(v);\\\n";
|
734
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
735
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
736
|
0
|
|
|
|
|
|
print $FH "#define FREE_",$node->{c_name},"(v) {\\\n";
|
737
|
0
|
|
|
|
|
|
print $FH "\t\tif (NULL != (v)->_buffer) {\\\n";
|
738
|
0
|
0
|
|
|
|
|
if (defined $type->{length}) {
|
739
|
0
|
|
|
|
|
|
print $FH "\t\t\t",$type->{c_name}," * ",$node->{c_name},"_ptr;\\\n";
|
740
|
0
|
|
|
|
|
|
print $FH "\t\t\tfor (",$node->{c_name},"_ptr = (v)->_buffer;\\\n";
|
741
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr < (v)->_buffer + (v)->_length;\\\n";
|
742
|
0
|
|
|
|
|
|
print $FH "\t\t\t ",$node->{c_name},"_ptr++) {\\\n";
|
743
|
0
|
|
|
|
|
|
print $FH "\t\t\t\tFREE_",$type->{c_name},"(",$node->{c_name},"_ptr);\\\n";
|
744
|
0
|
|
|
|
|
|
print $FH "\t\t\t}\\\n";
|
745
|
|
|
|
|
|
|
}
|
746
|
0
|
|
|
|
|
|
print $FH "\t\t\tCORBA_free((v)->_buffer);\\\n";
|
747
|
0
|
|
|
|
|
|
print $FH "\t\t}\\\n";
|
748
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
749
|
0
|
|
|
|
|
|
print $FH "\t\tCORBA_free(v);\\\n";
|
750
|
|
|
|
|
|
|
}
|
751
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
752
|
0
|
|
|
|
|
|
print $FH "#endif\n";
|
753
|
0
|
|
|
|
|
|
print $FH "\n";
|
754
|
|
|
|
|
|
|
}
|
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
sub visitFixedPtType {
|
757
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
758
|
0
|
|
|
|
|
|
my ($node) = @_;
|
759
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitFixedPtType : TODO.\n";
|
760
|
|
|
|
|
|
|
}
|
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
sub visitFixedPtConstType {
|
763
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
764
|
0
|
|
|
|
|
|
my ($node) = @_;
|
765
|
0
|
|
|
|
|
|
warn __PACKAGE__,"::visitFixedPtConstType : TODO.\n";
|
766
|
|
|
|
|
|
|
}
|
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
#
|
769
|
|
|
|
|
|
|
# 3.12 Exception Declaration
|
770
|
|
|
|
|
|
|
#
|
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
sub visitException {
|
773
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
774
|
0
|
|
|
|
|
|
my ($node) = @_;
|
775
|
0
|
0
|
|
|
|
|
return unless (exists $node->{list_expr});
|
776
|
0
|
|
|
|
|
|
foreach (@{$node->{list_expr}}) {
|
|
0
|
|
|
|
|
|
|
777
|
0
|
|
|
|
|
|
my $type = $self->_get_defn($_->{type});
|
778
|
0
|
0
|
0
|
|
|
|
if ( $type->isa('StructType')
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
779
|
|
|
|
|
|
|
or $type->isa('UnionType')
|
780
|
|
|
|
|
|
|
or $type->isa('SequenceType')
|
781
|
|
|
|
|
|
|
or $type->isa('FixedPtType') ) {
|
782
|
0
|
|
|
|
|
|
$type->visit($self);
|
783
|
|
|
|
|
|
|
}
|
784
|
|
|
|
|
|
|
}
|
785
|
0
|
|
|
|
|
|
$self->{add_size} = q{};
|
786
|
0
|
|
|
|
|
|
$self->{put} = q{};
|
787
|
0
|
|
|
|
|
|
$self->{get} = q{};
|
788
|
0
|
|
|
|
|
|
$self->{get_in} = q{};
|
789
|
0
|
|
|
|
|
|
$self->{get_inout} = q{};
|
790
|
0
|
|
|
|
|
|
$self->{get_out} = q{};
|
791
|
0
|
|
|
|
|
|
$self->{free} = q{};
|
792
|
0
|
|
|
|
|
|
$self->{union} = q{};
|
793
|
0
|
|
|
|
|
|
foreach (@{$node->{list_member}}) {
|
|
0
|
|
|
|
|
|
|
794
|
0
|
|
|
|
|
|
$self->_get_defn($_)->visit($self); # member
|
795
|
|
|
|
|
|
|
}
|
796
|
0
|
|
|
|
|
|
my $FH = $self->{out};
|
797
|
0
|
0
|
|
|
|
|
if (exists $self->{client}) {
|
798
|
0
|
0
|
|
|
|
|
if (defined $node->{length}) {
|
799
|
0
|
|
|
|
|
|
print $FH "#define GET_out_",$node->{c_name},"(ptr,v) {\\\n";
|
800
|
0
|
|
|
|
|
|
print $FH $self->{get_out};
|
801
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
802
|
0
|
|
|
|
|
|
print $FH "#define FREE_",$node->{c_name},"(v) {\\\n";
|
803
|
0
|
|
|
|
|
|
print $FH $self->{free};
|
804
|
0
|
|
|
|
|
|
print $FH "\t\tCORBA_free(v);\\\n";
|
805
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
806
|
|
|
|
|
|
|
}
|
807
|
|
|
|
|
|
|
else {
|
808
|
0
|
|
|
|
|
|
print $FH "#define GET_",$node->{c_name},"(ptr,v) {\\\n";
|
809
|
0
|
|
|
|
|
|
print $FH $self->{get};
|
810
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
811
|
|
|
|
|
|
|
}
|
812
|
|
|
|
|
|
|
}
|
813
|
|
|
|
|
|
|
else {
|
814
|
0
|
|
|
|
|
|
print $FH "#define ADD_SIZE_",$node->{c_name},"(size,v) {\\\n";
|
815
|
0
|
|
|
|
|
|
print $FH $self->{add_size};
|
816
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
817
|
0
|
|
|
|
|
|
print $FH "#define PUT_",$node->{c_name},"(ptr,v) {\\\n";
|
818
|
0
|
|
|
|
|
|
print $FH $self->{put};
|
819
|
0
|
|
|
|
|
|
print $FH "\t}\n";
|
820
|
|
|
|
|
|
|
}
|
821
|
0
|
|
|
|
|
|
print $FH "\n";
|
822
|
0
|
|
|
|
|
|
delete $self->{add_size};
|
823
|
0
|
|
|
|
|
|
delete $self->{put};
|
824
|
0
|
|
|
|
|
|
delete $self->{get};
|
825
|
0
|
|
|
|
|
|
delete $self->{get_in};
|
826
|
0
|
|
|
|
|
|
delete $self->{get_inout};
|
827
|
0
|
|
|
|
|
|
delete $self->{get_out};
|
828
|
0
|
|
|
|
|
|
delete $self->{free};
|
829
|
0
|
|
|
|
|
|
delete $self->{union};
|
830
|
|
|
|
|
|
|
}
|
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
#
|
833
|
|
|
|
|
|
|
# 3.13 Operation Declaration (specialized)
|
834
|
|
|
|
|
|
|
#
|
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
#
|
837
|
|
|
|
|
|
|
# 3.14 Attribute Declaration
|
838
|
|
|
|
|
|
|
#
|
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
sub visitAttribute {
|
841
|
0
|
|
|
0
|
0
|
|
my $self = shift;
|
842
|
0
|
|
|
|
|
|
my ($node) = @_;
|
843
|
0
|
|
|
|
|
|
$node->{_get}->visit($self);
|
844
|
0
|
0
|
|
|
|
|
$node->{_set}->visit($self) if (exists $node->{_set});
|
845
|
|
|
|
|
|
|
}
|
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
#
|
848
|
|
|
|
|
|
|
# 3.15 Repository Identity Related Declarations
|
849
|
|
|
|
|
|
|
#
|
850
|
|
|
|
|
|
|
|
851
|
0
|
|
|
0
|
0
|
|
sub visitTypeId {
|
852
|
|
|
|
|
|
|
# empty
|
853
|
|
|
|
|
|
|
}
|
854
|
|
|
|
|
|
|
|
855
|
0
|
|
|
0
|
0
|
|
sub visitTypePrefix {
|
856
|
|
|
|
|
|
|
# empty
|
857
|
|
|
|
|
|
|
}
|
858
|
|
|
|
|
|
|
|
859
|
|
|
|
|
|
|
1;
|
860
|
|
|
|
|
|
|
|