File Coverage

blib/lib/RPerl/DataType/Number_cpp.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 36 36 100.0


line stmt bran cond sub pod time code
1             # [[[ HEADER ]]]
2             package RPerl::DataType::Number_cpp;
3 1     1   1004 use strict;
  1         2  
  1         24  
4 1     1   5 use warnings;
  1         2  
  1         19  
5 1     1   5 use RPerl::AfterSubclass;
  1         2  
  1         122  
6             our $VERSION = 0.002_000;
7              
8             # [[[ CRITICS ]]]
9             ## no critic qw(ProhibitStringyEval) # SYSTEM DEFAULT 1: allow eval()
10              
11             # [[[ INCLUDES ]]]
12 1     1   7 use RPerl::Inline;
  1         2  
  1         186  
13              
14             # [[[ SUBROUTINES ]]]
15             our void::method $cpp_load = sub {
16             my $need_load_cpp = 0;
17             if ( ( exists $main::{'RPerl__DataType__Number__MODE_ID'} )
18             and ( defined &{ $main::{'RPerl__DataType__Number__MODE_ID'} } ) )
19             {
20             # RPerl::diag("in Number_cpp::cpp_load, RPerl__DataType__Number__MODE_ID() exists & defined\n");
21             # RPerl::diag(q{in Number_cpp::cpp_load, have RPerl__DataType__Number__MODE_ID() retval = '} . main::RPerl__DataType__Number__MODE_ID() . "'\n");
22             if ( $RPerl::MODES->{main::RPerl__DataType__Number__MODE_ID()}->{ops} ne 'CPP' ) {
23             $need_load_cpp = 1;
24             }
25             }
26             else {
27             # RPerl::diag("in Number_cpp::cpp_load, RPerl__DataType__Number__MODE_ID() does not exist or undefined\n");
28             $need_load_cpp = 1;
29             }
30              
31             if ($need_load_cpp) {
32              
33             # RPerl::diag("in Number_cpp::cpp_load, need load CPP code\n");
34              
35             my $eval_string = <<"EOF";
36             package main;
37             use RPerl::Inline;
38             BEGIN { RPerl::diag("[[[ BEGIN 'use Inline' STAGE for 'RPerl/DataType/Number.cpp' ]]]\n" x 0); }
39             use Inline (CPP => '$RPerl::INCLUDE_PATH' . '/RPerl/DataType/Number.cpp', \%RPerl::Inline::ARGS);
40             RPerl::diag("[[[ END 'use Inline' STAGE for 'RPerl/DataType/Number.cpp' ]]]\n" x 0);
41             1;
42             EOF
43              
44             $RPerl::Inline::ARGS{ccflagsex} = $RPerl::Inline::CCFLAGSEX . $RPerl::TYPES_CCFLAG . rperltypessizes::type_integer_native_ccflag() . rperltypessizes::type_number_native_ccflag();
45             $RPerl::Inline::ARGS{cppflags} = $RPerl::TYPES_CCFLAG . rperltypessizes::type_integer_native_ccflag() . rperltypessizes::type_number_native_ccflag();
46             # RPerl::diag("in Number_cpp::cpp_load(), CPP not yet loaded, about to call eval() on \$eval_string =\n<<< BEGIN EVAL STRING>>>\n" . $eval_string . "<<< END EVAL STRING >>>\n");
47              
48 1     1   11 eval $eval_string or croak( $OS_ERROR . "\n" . $EVAL_ERROR );
  1     1   3  
  1     1   39  
  1     1   9  
  1     1   9  
  1     1   2  
  1         9  
  1         13  
  1         3  
  1         39  
  1         8  
  1         6  
  1         3  
  1         11  
49             if ($EVAL_ERROR) { croak($EVAL_ERROR); }
50             }
51             # else { RPerl::diag("in Number_cpp::cpp_load(), CPP already loaded, DOING NOTHING\n"); }
52             };
53              
54             1; # end of package