C/IncludeVisitor.pm

filter: Statementstmt 5.2% 26 / 499 Branchbran 0.0% 0 / 136 Conditioncond 0.0% 0 / 91 MC/DCmcdc 0.0% 0 / 41 Subroutinesub 16.3% 8 / 49 Podpod 0.0% 0 / 37 totaltotal 3.9% 34 / 853 CC 120 SCAR 47.7
CC
120
Cov
4%
visitTypeDeclarator
306.0
visitUnionType
272.0
visitException
272.0
CRAP 118.1
« C/TypeVisitor.pm ↑ Summary C/LiteralVisitor.pm »
1
2 #
3 # Interface Definition Language (OMG IDL CORBA v3.0)
4 #
5 # C Language Mapping Specification, New Edition June 1999
6 #
7
8 package CORBA::C::IncludeVisitor;
9
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12
13 1 our $VERSION = '2.62';
14
15 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use POSIX qw(ctime);
Subroutine BEGIN: called CC=1 SCAR=0.0
17
18 # needs $node->{repos_id} (repositoryIdVisitor), $node->{c_name} (CnameVisitor)
19 # $node->{c_arg} (CtypeVisitor) and $node->{c_literal} (CliteralVisitor)
20
21 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
22 0 my $proto = shift;
23 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
24 0 my $self = {};
25 0 bless $self, $class;
26 0 my ($parser, $incpath) = @_;
27 0 ▶ $self->{incpath} = $incpath || q{};
Condition0%0/2
$incpath || ''
l!l
00
MC/DC0%0/1
$incpath || ''
$incpath
Truth table0%0/2
A
A= $incpath
Aresult
11
00
28 0 $self->{prefix} = q{}; # provision for incskel
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->{inc} = {};
34 0 my $filename = basename($self->{srcname}, '.idl') . '.h';
35 0 $self->open_stream($filename);
36 0 $self->{done_hash} = {};
37 0 $self->{num_key} = 'num_inc_c';
38 0 return $self;
39 }
40
41 0 ▶sub open_stream {
Subroutine open_stream: not called CC=2 SCAR=17.9
Pod undocumented
42 0 my $self = shift;
43 0 my ($filename) = @_;
44 0 ▶ open $self->{out}, '>', $filename
Branch: 1 branch
BranchTrueFalseTotal
open $self->{"out"}, ">", $filename or die "can't open $filename ($!).\n" 0 0 0
45 or die "can't open $filename ($!).\n";
46 0 $self->{filename} = $filename;
47 }
48
49 0 ▶sub _insert_inc {
Subroutine _insert_inc: not called CC=2 SCAR=17.9
50 0 my $self = shift;
51 0 my ($filename) = @_;
52 0 my $FH = $self->{out};
53 0 ▶ unless (exists $self->{inc}->{$filename}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"inc"}{$filename}) 0 0 0
54 0 $self->{inc}->{$filename} = 1;
55 0 $filename = basename($filename, '.idl') . '.h';
56 0 print $FH "#include \"",$self->{prefix},$filename,"\"\n";
57 }
58 }
59
60 0 ▶sub _no_mapping {
Subroutine _no_mapping: not called CC=3 SCAR=24.8
61 0 my $self = shift;
62 0 my ($node) = @_;
63 0 my $FH = $self->{out};
64 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
65 0 my $class = ref $node;
66 0 $class = substr $class, rindex($class, ':') + 1;
67 0 ▶ if ($class =~ /^Forward/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class =~ /^Forward/) 0 0 0
68 0 $node = $self->{symbtab}->Lookup($node->{full});
69 }
70 0 print $FH "\n";
71 0 print $FH "/* no mapping for ",$node->{c_name}," */\n";
72 0 print $FH "\n";
73 }
74 else {
75 0 $self->_insert_inc($node->{filename});
76 }
77 }
78
79 0 ▶sub _get_defn {
Subroutine _get_defn: not called CC=2 SCAR=17.9
80 0 my $self = shift;
81 0 my ($defn) = @_;
82 0 ▶ if (ref $defn) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $defn) { } 0 0 0
83 0 return $defn;
84 }
85 else {
86 0 return $self->{symbtab}->Lookup($defn);
87 }
88 }
89
90 #
91 # 3.5 OMG IDL Specification
92 #
93
94 0 ▶sub visitSpecification {
Subroutine visitSpecification: not called CC=4 SCAR=30.0
Pod undocumented
95 0 my $self = shift;
96 0 my ($node) = @_;
97 0 my $FH = $self->{out};
98 0 print $FH "/* ex: set ro: */\n";
99 0 print $FH "/* This file was generated (by ",basename($0),"). DO NOT modify it */\n";
100 0 print $FH "/* From file : ",$self->{srcname},", ",$self->{srcname_size}," octets, ",POSIX::ctime($self->{srcname_mtime});
101 0 print $FH " */\n";
102 0 print $FH "\n";
103 0 print $FH "#include <",$self->{incpath},"corba.h>\n";
104 # print $FH "#include \"corba.h\"\n";
105 0 print $FH "\n";
106 0 ▶ if (exists $node->{list_import}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $node->{"list_import"}) 0 0 0
107 0 foreach (@{$node->{list_import}}) {
108 0 my $basename = $_->{value};
109 0 $basename =~ s/^:://;
110 0 $basename =~ s/::/_/g;
111 0 print $FH "#include \"",$basename,".h\"\n";
112 }
113 0 print $FH "\n";
114 }
115 0 foreach (@{$node->{list_decl}}) {
116 0 $self->_get_defn($_)->visit($self);
117 }
118 0 print $FH "\n";
119 0 print $FH "/* end of file : ",$self->{filename}," */\n";
120 0 print $FH "\n";
121 0 print $FH "/*\n";
122 0 print $FH " * Local variables:\n";
123 0 print $FH " * buffer-read-only: t\n";
124 0 print $FH " * End:\n";
125 0 print $FH " */\n";
126 0 close $FH;
127 }
128
129 #
130 # 3.7 Module Declaration
131 #
132
133 0 ▶sub visitModules {
Subroutine visitModules: not called CC=2 SCAR=17.9
Pod undocumented
134 0 my $self = shift;
135 0 my ($node) = @_;
136 0 ▶ unless (exists $node->{$self->{num_key}}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $$node{$self->{"num_key"}}) 0 0 0
137 0 $node->{$self->{num_key}} = 0;
138 }
139 0 my $module = ${$node->{list_decl}}[$node->{$self->{num_key}}];
140 0 $module->visit($self);
141 0 $node->{$self->{num_key}} ++;
142 }
143
144 0 ▶sub visitModule {
Subroutine visitModule: not called CC=3 SCAR=24.8
Pod undocumented
145 0 my $self = shift;
146 0 my ($node) = @_;
147 0 my $FH = $self->{out};
148 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
149 0 my $filename = basename($self->{srcname}, '.idl') . '.h';
150 0 $filename =~ s/\./_/g;
151 0 my $defn = $self->{symbtab}->Lookup($node->{full});
152 0 print $FH "/*\n";
153 0 print $FH " * begin of module ",$defn->{c_name},"\n";
154 0 print $FH " */\n";
155 0 print $FH "#ifndef _",$self->{prefix},$defn->{c_name},"_",$filename,"_defined\n";
156 0 print $FH "#define _",$self->{prefix},$defn->{c_name},"_",$filename,"_defined\n";
157 0 print $FH "\n";
158 0 foreach (@{$node->{list_decl}}) {
159 0 $self->_get_defn($_)->visit($self);
160 }
161 0 print $FH "#endif\n";
162 0 print $FH "/*\n";
163 0 print $FH " * end of module ",$defn->{c_name},"\n";
164 0 print $FH " */\n";
165 }
166 else {
167 0 $self->_insert_inc($node->{filename});
168 }
169 }
170
171 #
172 # 3.8 Interface Declaration
173 #
174 # See 1.3 Mapping for Interfaces
175 #
176
177 0 ▶sub visitRegularInterface {
Subroutine visitRegularInterface: not called CC=8 SCAR=42.8
Pod undocumented
178 0 my $self = shift;
179 0 my ($node) = @_;
180 0 my $FH = $self->{out};
181 0 $self->{itf} = $node->{c_name};
182 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
183 0 print $FH "/*\n";
184 0 print $FH " * begin of interface ",$node->{c_name},"\n";
185 0 print $FH " */\n";
186 0 print $FH "#ifndef _",$self->{prefix},$node->{c_name},"_defined\n";
187 0 print $FH "#define _",$self->{prefix},$node->{c_name},"_defined\n";
188 0 print $FH "\n";
189 0 ▶ if (exists $self->{reposit}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"reposit"}) 0 0 0
190 0 print $FH "#define id_",$node->{c_name}," \"",$node->{repos_id},"\"\n";
191 }
192 0 print $FH "typedef CORBA_Object ",$node->{c_name},";\n";
193 0 print $FH "\n";
194 0 foreach (@{$node->{list_decl}}) {
195 0 my $defn = $self->_get_defn($_);
196 0 ▶ if ( $defn->isa('Operation')
Branch: 1 branch
BranchTrueFalseTotal
if ($defn->isa("Operation") or $defn->isa("Attributes")) 0 0 0
Condition0%0/3
$defn->isa("Operation") or $defn->isa("Attributes")
l!l&&r!l&&!r
000
MC/DC0%0/2
$defn->isa("Operation") or $defn->isa("Attributes")
$defn->isa("Operation") $defn->isa("Attributes")
Truth table0%0/3
A or B
A= $defn->isa("Operation")B= $defn->isa("Attributes")
ABresult
1X1
011
000
197 or $defn->isa('Attributes') ) {
198 0 next;
199 }
200 0 $defn->visit($self);
201 }
202 0 print $FH "#endif\n";
203 0 print $FH "\n";
204 0 ▶ if (keys %{$node->{hash_attribute_operation}}) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %{$$node{"hash_attribute_operation"};}) 0 0 0
205 0 print $FH "#ifndef _proto_",$self->{prefix},$node->{c_name},"_defined\n";
206 0 print $FH "#define _proto_",$self->{prefix},$node->{c_name},"_defined\n";
207 0 print $FH "\n";
208 0 $self->{itf} = $node->{c_name};
209 0 foreach (values %{$node->{hash_attribute_operation}}) {
210 0 $self->_get_defn($_)->visit($self);
211 }
212 0 delete $self->{itf};
213 0 print $FH "#endif\n";
214 }
215 0 print $FH "/*\n";
216 0 print $FH " * end of interface ",$node->{c_name},"\n";
217 0 print $FH " */\n";
218 }
219 else {
220 0 $self->_insert_inc($node->{filename});
221 }
222 }
223
224 0 ▶sub visitAbstractInterface {
Subroutine visitAbstractInterface: not called CC=5 SCAR=34.0
Pod undocumented
225 # C mapping is aligned with CORBA 2.1
226 0 my $self = shift;
227 0 my ($node) = @_;
228 0 my $FH = $self->{out};
229 0 $self->{itf} = $node->{c_name};
230 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
231 0 print $FH "/*\n";
232 0 print $FH " * begin of abstract interface ",$node->{c_name},"\n";
233 0 print $FH " */\n";
234 0 print $FH "#ifndef _",$self->{prefix},$node->{c_name},"_defined\n";
235 0 print $FH "#define _",$self->{prefix},$node->{c_name},"_defined\n";
236 0 print $FH "\n";
237 0 print $FH "typedef CORBA_Object ",$node->{c_name},";\n";
238 0 print $FH "\n";
239 0 foreach (@{$node->{list_decl}}) {
240 0 my $defn = $self->_get_defn($_);
241 0 ▶ if ( $defn->isa('Operation')
Branch: 1 branch
BranchTrueFalseTotal
if ($defn->isa("Operation") or $defn->isa("Attributes")) 0 0 0
Condition0%0/3
$defn->isa("Operation") or $defn->isa("Attributes")
l!l&&r!l&&!r
000
MC/DC0%0/2
$defn->isa("Operation") or $defn->isa("Attributes")
$defn->isa("Operation") $defn->isa("Attributes")
Truth table0%0/3
A or B
A= $defn->isa("Operation")B= $defn->isa("Attributes")
ABresult
1X1
011
000
242 or $defn->isa('Attributes') ) {
243 0 next;
244 }
245 0 $defn->visit($self);
246 }
247 0 print $FH "#endif\n";
248 0 print $FH "\n";
249 0 print $FH "/*\n";
250 0 print $FH " * end of abstract interface ",$node->{c_name},"\n";
251 0 print $FH " */\n";
252 }
253 else {
254 0 $self->_insert_inc($node->{filename});
255 }
256 }
257
258 0 ▶sub visitForwardRegularInterface {
Subroutine visitForwardRegularInterface: not called CC=2 SCAR=17.9
Pod undocumented
259 0 my $self = shift;
260 0 my ($node) = @_;
261 0 my $FH = $self->{out};
262 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
263 0 my $defn = $self->{symbtab}->Lookup($node->{full});
264 0 print $FH "\n";
265 0 print $FH "typedef ",$defn->{c_name},";\n";
266 0 print $FH "\n";
267 }
268 else {
269 0 $self->_insert_inc($node->{filename});
270 }
271 }
272
273 0 ▶sub visitForwardAbstractInterface {
Subroutine visitForwardAbstractInterface: not called CC=2 SCAR=17.9
Pod undocumented
274 # C mapping is aligned with CORBA 2.1
275 0 my $self = shift;
276 0 my ($node) = @_;
277 0 my $FH = $self->{out};
278 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
279 0 my $defn = $self->{symbtab}->Lookup($node->{full});
280 0 print $FH "\n";
281 0 print $FH "typedef ",$defn->{c_name},";\n";
282 0 print $FH "\n";
283 }
284 else {
285 0 $self->_insert_inc($node->{filename});
286 }
287 }
288
289 0 ▶sub visitBaseInterface {
Subroutine visitBaseInterface: not called CC=1 SCAR=6.9
Pod undocumented
290 # C mapping is aligned with CORBA 2.1
291 0 shift->_no_mapping(@_);
292 }
293
294 0 ▶sub visitForwardBaseInterface {
Subroutine visitForwardBaseInterface: not called CC=1 SCAR=6.9
Pod undocumented
295 # C mapping is aligned with CORBA 2.1
296 0 shift->_no_mapping(@_);
297 }
298
299 #
300 # 3.10 Constant Declaration
301 #
302 # See 1.6 Mapping for Constants
303 #
304
305 0 ▶sub visitConstant {
Subroutine visitConstant: not called CC=2 SCAR=17.9
Pod undocumented
306 0 my $self = shift;
307 0 my ($node) = @_;
308 0 my $FH = $self->{out};
309 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
310 0 print $FH "#define ",$node->{c_name},"\t",$node->{value}->{c_literal},"\n";
311 }
312 else {
313 0 $self->_insert_inc($node->{filename});
314 }
315 }
316
317 #
318 # 3.11 Type Declaration
319 #
320
321 0 ▶sub visitTypeDeclarators {
Subroutine visitTypeDeclarators: not called CC=2 SCAR=17.9
Pod undocumented
322 0 my $self = shift;
323 0 my ($node) = @_;
324 0 foreach (@{$node->{list_decl}}) {
325 0 $self->_get_defn($_)->visit($self);
326 }
327 }
328
329 0 ▶sub visitTypeDeclarator {
Subroutine visitTypeDeclarator: not called CC=17 SCAR=57.2
Pod undocumented
330 0 my $self = shift;
331 0 my ($node) = @_;
332 0 my $type = $self->_get_defn($node->{type});
333 0 ▶ if ( $type->isa('StructType')
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")) 0 0 0
Condition0%0/18
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType") or $type->isa("SequenceType") or $type->isa("StringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType") or $type->isa("SequenceType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType")
l!l&&r!l&&!r
000
MC/DC0%0/7
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("EnumType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
$type->isa("StructType") $type->isa("UnionType") $type->isa("EnumType") $type->isa("SequenceType") $type->isa("StringType") $type->isa("WideStringType") $type->isa("FixedPtType")
Truth table0%0/8
A or B or C or D or E or F or G
A= $type->isa("StructType")B= $type->isa("UnionType")C= $type->isa("EnumType")D= $type->isa("SequenceType")E= $type->isa("StringType")F= $type->isa("WideStringType")G= $type->isa("FixedPtType")
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
00001XX1
000001X1
00000011
00000000
334 or $type->isa('UnionType')
335 or $type->isa('EnumType')
336 or $type->isa('SequenceType')
337 or $type->isa('StringType')
338 or $type->isa('WideStringType')
339 or $type->isa('FixedPtType') ) {
340 0 $type->visit($self);
341 }
342 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"srcname"} eq $node->{"filename"}) 0 0 0
343 0 my $FH = $self->{out};
344 0 ▶ if (exists $self->{reposit}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"reposit"}) 0 0 0
345 0 print $FH "#define id_",$node->{c_name}," \"",$node->{repos_id},"\"\n";
346 print $FH "#define uid_",$node->{c_name}," 0x",$node->{serial_uid},"ULL\n"
347 0 ▶ if (exists $node->{serial_uid});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"serial_uid"} 0 0 0
348 }
349 0 ▶ if (exists $node->{array_size}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $node->{'array_size'}) { } 0 0 0
350 #
351 # See 1.15 Mapping for Array
352 #
353 warn __PACKAGE__,"::visitTypeDecalarator $node->{idf} : empty array_size.\n"
354 0 ▶ unless (@{$node->{array_size}});
Branch: 1 branch
BranchTrueFalseTotal
unless @{$node->{"array_size"};} 0 0 0
355 print $FH "typedef ",
356 $type->{c_name},
357 0 " ",$node->{c_name};
358 0 foreach (@{$node->{array_size}}) {
359 0 print $FH "[",$_->{c_literal},"]";
360 }
361 0 print $FH ";\n";
362 0 my @list = @{$node->{array_size}};
363 0 shift @list;
364 print $FH "typedef ",
365 $type->{c_name},
366 0 " ",$node->{c_name},"_slice";
367 0 foreach (@list) {
368 0 print $FH "[",$_->{c_literal},"]";
369 }
370 0 print $FH ";\n";
371 0 ▶ if (defined $type->{length}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $type->{"length"}) 0 0 0
372 0 ▶ if (exists $self->{use_define}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'use_define'}) { } 0 0 0
373 0 print $FH "#define ",$node->{c_name},"__alloc(nb)\t(",$node->{c_name},"_slice *)CORBA_alloc((nb) * sizeof(",$node->{c_name},"_slice))\n";
374 }
375 else {
376 0 print $FH "extern ",$node->{c_name},"_slice * ",$node->{c_name},"__alloc(CORBA_unsigned_long nb);\n";
377 }
378 }
379 }
380 else {
381 print $FH "typedef ",
382 $type->{c_name},
383 0 " ",$node->{c_name},";\n";
384 }
385 }
386 }
387
388 0 ▶sub visitNativeType {
Subroutine visitNativeType: not called CC=1 SCAR=0.0
Pod undocumented
389 # empty
390 }
391
392 #
393 # 3.11.2 Constructed Types
394 #
395 # 3.11.2.1 Structures
396 #
397 # See 1.9 Mapping for Structure Types
398 #
399
400 0 ▶sub visitStructType {
Subroutine visitStructType: not called CC=15 SCAR=54.8
Pod undocumented
401 0 my $self = shift;
402 0 my ($node) = @_;
403 0 ▶ return if (exists $self->{done_hash}->{$node->{c_name}});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"done_hash"}{$node->{"c_name"}} 0 0 0
404 0 $self->{done_hash}->{$node->{c_name}} = 1;
405 0 foreach (@{$node->{list_expr}}) {
406 0 my $type = $self->_get_defn($_->{type});
407 0 ▶ if ( $type->isa('StructType')
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")) 0 0 0
Condition0%0/15
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType")
l!l&&r!l&&!r
000
MC/DC0%0/6
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
$type->isa("StructType") $type->isa("UnionType") $type->isa("SequenceType") $type->isa("StringType") $type->isa("WideStringType") $type->isa("FixedPtType")
Truth table0%0/7
A or B or C or D or E or F
A= $type->isa("StructType")B= $type->isa("UnionType")C= $type->isa("SequenceType")D= $type->isa("StringType")E= $type->isa("WideStringType")F= $type->isa("FixedPtType")
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
408 or $type->isa('UnionType')
409 or $type->isa('SequenceType')
410 or $type->isa('StringType')
411 or $type->isa('WideStringType')
412 or $type->isa('FixedPtType') ) {
413 0 $type->visit($self);
414 }
415 }
416 0 my $FH = $self->{out};
417 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
418 0 ▶ if (exists $self->{reposit}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"reposit"}) 0 0 0
419 0 print $FH "#define id_",$node->{c_name}," \"",$node->{repos_id},"\"\n";
420 print $FH "#define uid_",$node->{c_name}," 0x",$node->{serial_uid},"ULL\n"
421 0 ▶ if (exists $node->{serial_uid});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"serial_uid"} 0 0 0
422 }
423 0 print $FH "typedef struct {\n";
424 0 foreach (@{$node->{list_expr}}) {
425 0 $_->visit($self); # members
426 }
427 0 print $FH "} ",$node->{c_name},";\n";
428 0 ▶ if (defined $node->{length}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node->{"length"}) 0 0 0
429 0 ▶ if (exists $self->{use_define}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'use_define'}) { } 0 0 0
430 0 print $FH "#define ",$node->{c_name},"__alloc(nb)\t(",$node->{c_name}," *)CORBA_alloc((nb) * sizeof(",$node->{c_name},"))\n"
431 }
432 else {
433 0 print $FH "extern ",$node->{c_name}," * ",$node->{c_name},"__alloc(CORBA_unsigned_long nb);\n";
434 }
435 }
436 }
437 else {
438 0 $self->_insert_inc($node->{filename});
439 }
440 }
441
442 0 ▶sub visitMembers {
Subroutine visitMembers: not called CC=3 SCAR=24.8
Pod undocumented
443 0 my $self = shift;
444 0 my ($node) = @_;
445 0 my $FH = $self->{out};
446 0 my $type = $self->_get_defn($node->{type});
447 0 print $FH "\t",$type->{c_name};
448 0 my $first = 1;
449 0 foreach (@{$node->{list_member}}) {
450 0 ▶ if ($first) {
Branch: 1 branch
BranchTrueFalseTotal
if ($first) { } 0 0 0
451 0 $first = 0;
452 }
453 else {
454 0 print $FH ",";
455 }
456 0 $self->_get_defn($_)->visit($self); # member
457 }
458 0 print $FH ";\n";
459 }
460
461 0 ▶sub visitMember {
Subroutine visitMember: not called CC=3 SCAR=24.8
Pod undocumented
462 0 my $self = shift;
463 0 my ($node) = @_;
464 0 my $FH = $self->{out};
465 0 print $FH " ",$node->{c_name};
466 0 ▶ if (exists $node->{array_size}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $node->{"array_size"}) 0 0 0
467 0 foreach (@{$node->{array_size}}) {
468 0 print $FH "[",$_->{c_literal},"]";
469 }
470 }
471 }
472
473 # 3.11.2.2 Discriminated Unions
474 #
475 # See 1.10 Mapping for Union Types
476 #
477
478 0 ▶sub visitUnionType {
Subroutine visitUnionType: not called CC=16 SCAR=56.1
Pod undocumented
479 0 my $self = shift;
480 0 my ($node) = @_;
481 0 ▶ return if (exists $self->{done_hash}->{$node->{c_name}});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"done_hash"}{$node->{"c_name"}} 0 0 0
482 0 $self->{done_hash}->{$node->{c_name}} = 1;
483 0 foreach (@{$node->{list_expr}}) {
484 0 my $type = $self->_get_defn($_->{element}->{type});
485 0 ▶ if ( $type->isa('StructType')
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")) 0 0 0
Condition0%0/15
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType")
l!l&&r!l&&!r
000
MC/DC0%0/6
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
$type->isa("StructType") $type->isa("UnionType") $type->isa("SequenceType") $type->isa("StringType") $type->isa("WideStringType") $type->isa("FixedPtType")
Truth table0%0/7
A or B or C or D or E or F
A= $type->isa("StructType")B= $type->isa("UnionType")C= $type->isa("SequenceType")D= $type->isa("StringType")E= $type->isa("WideStringType")F= $type->isa("FixedPtType")
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
486 or $type->isa('UnionType')
487 or $type->isa('SequenceType')
488 or $type->isa('StringType')
489 or $type->isa('WideStringType')
490 or $type->isa('FixedPtType') ) {
491 0 $type->visit($self);
492 }
493 }
494 0 my $type = $self->_get_defn($node->{type});
495 0 ▶ if ($type->isa('EnumType')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("EnumType")) 0 0 0
496 0 $type->visit($self);
497 }
498 0 my $FH = $self->{out};
499 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
500 0 ▶ if (exists $self->{reposit}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"reposit"}) 0 0 0
501 0 print $FH "#define id_",$node->{c_name}," \"",$node->{repos_id},"\"\n";
502 print $FH "#define uid_",$node->{c_name}," 0x",$node->{serial_uid},"ULL\n"
503 0 ▶ if (exists $node->{serial_uid});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"serial_uid"} 0 0 0
504 }
505 0 print $FH "typedef struct {\n";
506 0 print $FH "\t",$type->{c_name}," _d; /* discriminator */\n";
507 0 print $FH "\tunion {\n";
508 0 foreach (@{$node->{list_expr}}) {
509 0 $_->visit($self); # case
510 }
511 0 print $FH "\t} _u;\n";
512 0 print $FH "} ",$node->{c_name},";\n";
513 0 ▶ if (defined $type->{length}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $type->{"length"}) 0 0 0
514 0 ▶ if (exists $self->{use_define}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'use_define'}) { } 0 0 0
515 0 print $FH "#define ",$node->{c_name},"__alloc(nb)\t(",$node->{c_name}," *)CORBA_alloc((nb) * sizeof(",$node->{c_name},"))\n"
516 }
517 else {
518 0 print $FH "extern ",$node->{c_name}," * ",$node->{c_name},"__alloc(CORBA_unsigned_long nb);\n";
519 }
520 }
521 }
522 else {
523 0 $self->_insert_inc($node->{filename});
524 }
525 }
526
527 0 ▶sub visitCase {
Subroutine visitCase: not called CC=1 SCAR=6.9
Pod undocumented
528 0 my $self = shift;
529 0 my ($node) = @_;
530 0 $node->{element}->visit($self);
531 }
532
533 0 ▶sub visitElement {
Subroutine visitElement: not called CC=1 SCAR=6.9
Pod undocumented
534 0 my $self = shift;
535 0 my ($node) = @_;
536 0 my $FH = $self->{out};
537 0 my $type = $self->_get_defn($node->{type});
538 0 print $FH "\t\t",$type->{c_name};
539 0 $self->_get_defn($node->{value})->visit($self); # member
540 0 print $FH ";\n";
541 }
542
543 # 3.11.2.3 Constructed Recursive Types and Forward Declarations
544 #
545
546 0 ▶sub visitForwardStructType {
Subroutine visitForwardStructType: not called CC=2 SCAR=17.9
Pod undocumented
547 0 my $self = shift;
548 0 my ($node) = @_;
549 0 my $FH = $self->{out};
550 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
551 0 my $defn = $self->{symbtab}->Lookup($node->{full});
552 0 print $FH "typedef ",$defn->{c_name},";\n";
553 }
554 else {
555 0 $self->_insert_inc($node->{filename});
556 }
557 }
558
559 0 ▶sub visitForwardUnionType {
Subroutine visitForwardUnionType: not called CC=2 SCAR=17.9
Pod undocumented
560 0 my $self = shift;
561 0 my ($node) = @_;
562 0 my $FH = $self->{out};
563 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
564 0 my $defn = $self->{symbtab}->Lookup($node->{full});
565 0 print $FH "typedef ",$defn->{c_name},";\n";
566 }
567 else {
568 0 $self->_insert_inc($node->{filename});
569 }
570 }
571
572 # 3.11.2.4 Enumerations
573 #
574
575 0 ▶sub visitEnumType {
Subroutine visitEnumType: not called CC=6 SCAR=37.4
Pod undocumented
576 0 my $self = shift;
577 0 my ($node) = @_;
578 0 ▶ return if (exists $self->{done_hash}->{$node->{c_name}});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"done_hash"}{$node->{"c_name"}} 0 0 0
579 0 $self->{done_hash}->{$node->{c_name}} = 1;
580 0 my $FH = $self->{out};
581 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
582 0 print $FH "/* enum ",$node->{c_name}," */\n";
583 0 print $FH "#define ",$node->{c_name}," CORBA_unsigned_long\n";
584 0 ▶ if (exists $self->{reposit}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"reposit"}) 0 0 0
585 0 print $FH "#define id_",$node->{c_name}," \"",$node->{repos_id},"\"\n";
586 print $FH "#define uid_",$node->{c_name}," 0x",$node->{serial_uid},"ULL\n"
587 0 ▶ if (exists $node->{serial_uid});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"serial_uid"} 0 0 0
588 }
589 0 foreach (@{$node->{list_expr}}) {
590 0 $_->visit($self); # enum
591 }
592 0 print $FH "\n";
593 }
594 else {
595 0 $self->_insert_inc($node->{filename});
596 }
597 }
598
599 0 ▶sub visitEnum {
Subroutine visitEnum: not called CC=1 SCAR=6.9
Pod undocumented
600 0 my $self = shift;
601 0 my ($node) = @_;
602 0 my $FH = $self->{out};
603 0 print $FH "#define ",$node->{c_name},"\t",$node->{c_literal},"\n";
604 }
605
606 #
607 # 3.11.3 Template Types
608 #
609 # See 1.11 Mapping for Sequence Types
610 #
611
612 0 ▶sub visitSequenceType {
Subroutine visitSequenceType: not called CC=8 SCAR=42.8
Pod undocumented
613 0 my $self = shift;
614 0 my ($node) = @_;
615 0 ▶ return if (exists $self->{done_hash}->{$node->{c_name}});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"done_hash"}{$node->{"c_name"}} 0 0 0
616 0 $self->{done_hash}->{$node->{c_name}} = 1;
617 0 my $FH = $self->{out};
618 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"srcname"} eq $node->{"filename"}) 0 0 0
619 0 my $type = $self->_get_defn($node->{type});
620 0 ▶ if ( $type->isa('SequenceType')
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")) 0 0 0
Condition0%0/9
$type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
l!l&&r!l&&!r
000
$type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType")
l!l&&r!l&&!r
000
$type->isa("SequenceType") or $type->isa("StringType")
l!l&&r!l&&!r
000
MC/DC0%0/4
$type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
$type->isa("SequenceType") $type->isa("StringType") $type->isa("WideStringType") $type->isa("FixedPtType")
Truth table0%0/5
A or B or C or D
A= $type->isa("SequenceType")B= $type->isa("StringType")C= $type->isa("WideStringType")D= $type->isa("FixedPtType")
ABCDresult
1XXX1
01XX1
001X1
00011
00000
621 or $type->isa('StringType')
622 or $type->isa('WideStringType')
623 or $type->isa('FixedPtType') ) {
624 0 $type->visit($self);
625 }
626 0 print $FH "#ifndef _",$node->{c_name},"_defined\n";
627 0 print $FH "#define _",$node->{c_name},"_defined\n";
628 0 print $FH "typedef struct {\n";
629 0 print $FH "\tCORBA_unsigned_long _maximum;\n";
630 0 print $FH "\tCORBA_unsigned_long _length;\n";
631 0 print $FH "\t",$type->{c_name}," * _buffer;\n";
632 0 print $FH "} ",$node->{c_name},";\n";
633 0 ▶ if (exists $self->{use_define}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'use_define'}) { } 0 0 0
634 0 print $FH "#define ",$node->{c_name},"__alloc(nb)\t(",$node->{c_name}," *)CORBA_alloc((nb) * sizeof(",$node->{c_name},"))\n";
635 0 print $FH "#define ",$node->{c_name},"__allocbuf(len)\t(",$type->{c_name}," *)CORBA_alloc((len) * sizeof(",$type->{c_name},"))\n";
636 }
637 else {
638 0 print $FH "extern ",$node->{c_name}," * ",$node->{c_name},"__alloc(CORBA_unsigned_long nb);\n";
639 0 print $FH "extern ",$type->{c_name}," * ",$node->{c_name},"__allocbuf(CORBA_unsigned_long len);\n";
640 }
641 0 print $FH "#endif\n";
642 }
643 }
644
645 #
646 # See 1.12 Mapping for Strings
647 #
648
649 0 ▶sub visitStringType {
Subroutine visitStringType: not called CC=2 SCAR=17.9
Pod undocumented
650 0 my $self = shift;
651 0 my ($node) = @_;
652 0 ▶ return if (exists $self->{done_hash}->{$node->{c_name}});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"done_hash"}{$node->{"c_name"}} 0 0 0
653 0 $self->{done_hash}->{$node->{c_name}} = 1;
654 0 my $FH = $self->{out};
655 0 print $FH "#ifndef _",$node->{c_name},"_defined\n";
656 0 print $FH "#define _",$node->{c_name},"_defined\n";
657 0 print $FH "typedef CORBA_char * ",$node->{c_name},";\n";
658 0 print $FH "#endif\n";
659 }
660
661 #
662 # See 1.13 Mapping for Wide Strings
663 #
664
665 0 ▶sub visitWideStringType {
Subroutine visitWideStringType: not called CC=2 SCAR=17.9
Pod undocumented
666 0 my $self = shift;
667 0 my ($node) = @_;
668 0 ▶ return if (exists $self->{done_hash}->{$node->{c_name}});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"done_hash"}{$node->{"c_name"}} 0 0 0
669 0 $self->{done_hash}->{$node->{c_name}} = 1;
670 0 my $FH = $self->{out};
671 0 print $FH "#ifndef _",$node->{c_name},"_defined\n";
672 0 print $FH "#define _",$node->{c_name},"_defined\n";
673 0 print $FH "typedef CORBA_wchar * ",$node->{c_name},";\n";
674 0 print $FH "#endif\n";
675 }
676
677 #
678 # See 1.14 Mapping for Fixed
679 #
680
681 0 ▶sub visitFixedPtType {
Subroutine visitFixedPtType: not called CC=2 SCAR=17.9
Pod undocumented
682 0 my $self = shift;
683 0 my ($node) = @_;
684 0 my $FH = $self->{out};
685 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"srcname"} eq $node->{"filename"}) 0 0 0
686 0 print $FH "#ifndef _",$node->{c_name},"_defined\n";
687 0 print $FH "#define _",$node->{c_name},"_defined\n";
688 0 print $FH "typedef struct {\n";
689 0 print $FH "\tCORBA_unsigned_short _digits;\n";
690 0 print $FH "\tCORBA_short _scale;\n";
691 print $FH "\tCORBA_char _value [(",
692 $node->{d}->{value}, "+",
693 0 $node->{s}->{value}, ")/2];\n";
694 0 print $FH "} ",$node->{c_name},";\n";
695 # alloc : TODO
696 0 print $FH "#endif\n";
697 }
698 }
699
700 0 ▶sub visitFixedPtConstType {
Subroutine visitFixedPtConstType: not called CC=1 SCAR=0.0
Pod undocumented
701 # empty
702 }
703
704 #
705 # 3.12 Exception Declaration
706 #
707 # See 1.16 Mapping for Exception Types
708 #
709
710 0 ▶sub visitException {
Subroutine visitException: not called CC=16 SCAR=56.1
Pod undocumented
711 0 my $self = shift;
712 0 my ($node) = @_;
713 0 ▶ if (exists $node->{list_expr}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $node->{"list_expr"}) 0 0 0
714 warn __PACKAGE__,"::visitException $node->{idf} : empty list_expr.\n"
715 0 ▶ unless (@{$node->{list_expr}});
Branch: 1 branch
BranchTrueFalseTotal
unless @{$node->{"list_expr"};} 0 0 0
716 0 foreach (@{$node->{list_expr}}) {
717 0 my $type = $self->_get_defn($_->{type});
718 0 ▶ if ( $type->isa('StructType')
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")) 0 0 0
Condition0%0/15
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType")
l!l&&r!l&&!r
000
$type->isa("StructType") or $type->isa("UnionType")
l!l&&r!l&&!r
000
MC/DC0%0/6
$type->isa("StructType") or $type->isa("UnionType") or $type->isa("SequenceType") or $type->isa("StringType") or $type->isa("WideStringType") or $type->isa("FixedPtType")
$type->isa("StructType") $type->isa("UnionType") $type->isa("SequenceType") $type->isa("StringType") $type->isa("WideStringType") $type->isa("FixedPtType")
Truth table0%0/7
A or B or C or D or E or F
A= $type->isa("StructType")B= $type->isa("UnionType")C= $type->isa("SequenceType")D= $type->isa("StringType")E= $type->isa("WideStringType")F= $type->isa("FixedPtType")
ABCDEFresult
1XXXXX1
01XXXX1
001XXX1
0001XX1
00001X1
0000011
0000000
719 or $type->isa('UnionType')
720 or $type->isa('SequenceType')
721 or $type->isa('StringType')
722 or $type->isa('WideStringType')
723 or $type->isa('FixedPtType') ) {
724 0 $type->visit($self);
725 }
726 }
727 }
728 0 my $FH = $self->{out};
729 0 ▶ if ($self->{srcname} eq $node->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'srcname'} eq $node->{'filename'}) { } 0 0 0
730 0 print $FH "/* exception ",$node->{c_name}," */\n";
731 0 print $FH "typedef struct ",$node->{c_name}," {\n";
732 0 ▶ if (exists $node->{list_expr}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $node->{'list_expr'}) { } 0 0 0
733 0 foreach (@{$node->{list_expr}}) {
734 0 $_->visit($self); # members
735 }
736 }
737 else {
738 0 print $FH "\tCORBA_long _dummy;\n";
739 }
740 0 print $FH "} ",$node->{c_name},";\n";
741 0 print $FH "#define ex_",$node->{c_name}," \"",$node->{repos_id},"\"\n";
742 0 ▶ if (exists $self->{reposit}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"reposit"}) 0 0 0
743 print $FH "#define uid_",$node->{c_name}," 0x",$node->{serial_uid},"ULL\n"
744 0 ▶ if (exists $node->{serial_uid});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"serial_uid"} 0 0 0
745 }
746 0 ▶ if (exists $self->{use_define}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'use_define'}) { } 0 0 0
747 0 print $FH "#define ",$node->{c_name},"__alloc(nb)\t(",$node->{c_name}," *)CORBA_alloc((nb) * sizeof(",$node->{c_name},"))\n";
748 }
749 else {
750 0 print $FH "extern ",$node->{c_name}," * ",$node->{c_name},"__alloc(CORBA_unsigned_long nb);\n";
751 }
752 0 print $FH "\n";
753 }
754 else {
755 0 $self->_insert_inc($node->{filename});
756 }
757 }
758
759 #
760 # 3.13 Operation Declaration
761 #
762
763 0 ▶sub visitOperation {
Subroutine visitOperation: not called CC=6 SCAR=37.4
Pod undocumented
764 0 my $self = shift;
765 0 my ($node) = @_;
766 0 foreach (@{$node->{list_param}}) {
767 0 my $type = $self->_get_defn($_->{type});
768 0 ▶ if ( $type->isa('StringType')
Branch: 1 branch
BranchTrueFalseTotal
if ($type->isa("StringType") or $type->isa("WideStringType")) 0 0 0
Condition0%0/3
$type->isa("StringType") or $type->isa("WideStringType")
l!l&&r!l&&!r
000
MC/DC0%0/2
$type->isa("StringType") or $type->isa("WideStringType")
$type->isa("StringType") $type->isa("WideStringType")
Truth table0%0/3
A or B
A= $type->isa("StringType")B= $type->isa("WideStringType")
ABresult
1X1
011
000
769 or $type->isa('WideStringType') ) {
770 0 $type->visit($self);
771 }
772 }
773 0 my $FH = $self->{out};
774 0 print $FH "extern ",$node->{c_arg}," ",$self->{prefix},$self->{itf},"_",$node->{c_name},"(\n";
775 0 print $FH "\t",$self->{itf}," _o,\n";
776 0 foreach (@{$node->{list_param}}) {
777 0 $_->visit($self); # parameter
778 }
779 print $FH "\tCORBA_Context _ctx,\n"
780 0 ▶ if (exists $node->{list_context});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"list_context"} 0 0 0
781 0 print $FH "\tCORBA_Environment * _ev\n";
782 0 print $FH ");\n";
783 }
784
785 0 ▶sub visitParameter {
Subroutine visitParameter: not called CC=3 SCAR=24.8
Pod undocumented
786 0 my $self = shift;
787 0 my ($node) = @_;
788 0 my $FH = $self->{out};
789 0 my $type = $self->_get_defn($node->{type});
790 0 print $FH "\t",$node->{c_arg},", /* ",$node->{attr};
791 0 ▶ print $FH " (variable length) */\n" if (defined $type->{length});
Branch: 1 branch
BranchTrueFalseTotal
if defined $type->{"length"} 0 0 0
792 0 ▶ print $FH " (fixed length) */\n" unless (defined $type->{length});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type->{"length"} 0 0 0
793 }
794
795 #
796 # 3.14 Attribute Declaration
797 #
798
799 0 ▶sub visitAttribute {
Subroutine visitAttribute: not called CC=2 SCAR=17.9
Pod undocumented
800 0 my $self = shift;
801 0 my ($node) = @_;
802 0 $node->{_get}->visit($self);
803 0 ▶ $node->{_set}->visit($self) if (exists $node->{_set});
Branch: 1 branch
BranchTrueFalseTotal
if exists $node->{"_set"} 0 0 0
804 }
805
806 #
807 # 3.15 Repository Identity Related Declarations
808 #
809
810 0 ▶sub visitTypeId {
Subroutine visitTypeId: not called CC=1 SCAR=0.0
Pod undocumented
811 # empty
812 }
813
814 0 ▶sub visitTypePrefix {
Subroutine visitTypePrefix: not called CC=1 SCAR=0.0
Pod undocumented
815 # empty
816 }
817
818 #
819 # XPIDL
820 #
821
822 0 ▶sub visitCodeFragment {
Subroutine visitCodeFragment: not called CC=1 SCAR=0.0
Pod undocumented
823 # empty
824 }
825
826 ##############################################################################
827
828 package CORBA::C::IncDefVisitor;
829
830 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
831 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
832
833 1 ▶use base qw(CORBA::C::IncludeVisitor);
Subroutine BEGIN: called CC=1 SCAR=0.0
834
835 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
836
837 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
838 0 my $proto = shift;
839 0 ▶ my $class = ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
840 0 my $self = {};
841 0 bless $self, $class;
842 0 my ($parser, $incpath) = @_;
843 0 ▶ $self->{incpath} = $incpath || q{};
Condition0%0/2
$incpath || ''
l!l
00
MC/DC0%0/1
$incpath || ''
$incpath
Truth table0%0/2
A
A= $incpath
Aresult
11
00
844 0 $self->{prefix} = q{};
845 0 $self->{srcname} = $parser->YYData->{srcname};
846 0 $self->{srcname_size} = $parser->YYData->{srcname_size};
847 0 $self->{srcname_mtime} = $parser->YYData->{srcname_mtime};
848 0 $self->{symbtab} = $parser->YYData->{symbtab};
849 0 $self->{inc} = {};
850 0 $self->{use_define} = 1;
851 0 $self->{reposit} = 1;
852 0 my $filename = basename($self->{srcname}, '.idl') . '.h';
853 0 $self->open_stream($filename);
854 0 $self->{done_hash} = {};
855 0 $self->{num_key} = 'num_inc_c';
856 0 return $self;
857 }
858
859 1 1;
860
« C/TypeVisitor.pm ↑ Summary C/LiteralVisitor.pm »