C/SkelCppVisitor.pm untested

filter: Statementstmt 0.0% 0 / 60 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 77 CC 2 SCAR 10.6
CC
2
Cov
0%
new
6.0
visitSpecification
2.0
BEGIN
2.0
CRAP 2.9
1
2 package CORBA::C::SkelCppVisitor;
3
4 use strict;
5 use warnings;
6
7 our $VERSION = '2.60';
8
9 use CORBA::C::SkeletonVisitor;
10 use base qw(CORBA::C::SkeletonVisitor);
11
12 use File::Basename;
13 use POSIX qw(ctime);
14
15 sub new {
16 my $proto = shift;
17 my $class = ref($proto) || $proto;
18 my $self = {};
19 bless $self, $class;
20 my ($parser, $prefix) = @_;
21 $prefix = 'skel_' if (!defined $prefix);
22 $self->{prefix} = $prefix;
23 $self->{srcname} = $parser->YYData->{srcname};
24 $self->{srcname_size} = $parser->YYData->{srcname_size};
25 $self->{srcname_mtime} = $parser->YYData->{srcname_mtime};
26 $self->{symbtab} = $parser->YYData->{symbtab};
27 my $filename = $prefix . basename($self->{srcname}, '.idl') . '.cpp';
28 $self->parse($filename);
29 $self->open_stream($filename);
30 $self->{done_hash} = {};
31 $self->{num_key} = 'num_skel_c';
32 return $self;
33 }
34
35 #
36 # 3.5 OMG IDL Specification
37 #
38
39 sub visitSpecification {
40 my $self = shift;
41 my ($node) = @_;
42 my $filename = $self->{prefix} . basename($self->{srcname}, '.idl') . '.h';
43 my $FH = $self->{out};
44 print $FH "/* This file was partialy generated (by ",basename($0),").*/\n";
45 print $FH "/* From file : ",$self->{srcname},", ",$self->{srcname_size}," octets, ",POSIX::ctime($self->{srcname_mtime});
46 print $FH " */\n";
47 print $FH "\n";
48 print $FH "/* START_EDIT */\n";
49 print $FH $self->merge();
50 print $FH "/* STOP_EDIT */\n";
51 print $FH "\n";
52 print $FH "extern \"C\" {\n";
53 print $FH "\n";
54 print $FH "#include \"",$filename,"\"\n";
55 print $FH "\n";
56 foreach (@{$node->{list_decl}}) {
57 $self->_get_defn($_)->visit($self);
58 }
59 print $FH "\n";
60 print $FH "}\n";
61 print $FH "\n";
62 print $FH "/* end of file : ",$self->{filename}," */\n";
63 close $FH;
64 }
65
66 1;
67