| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # [[[ HEADER ]]] | 
| 2 |  |  |  |  |  |  | package RPerl::DataType::GMPInteger_cpp; | 
| 3 | 1 |  |  | 1 |  | 857 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 22 |  | 
| 5 | 1 |  |  | 1 |  | 5 | use RPerl::AfterSubclass; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 144 |  | 
| 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 |  |  |  |  | 214 |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | # [[[ SUBROUTINES ]]] | 
| 15 |  |  |  |  |  |  | sub cpp_load { | 
| 16 | 1 |  |  | 1 |  | 2 | { my void::method $RETURN_TYPE }; | 
|  | 1 |  |  |  |  | 3 |  | 
| 17 | 1 |  |  |  |  | 2 | my $need_load_cpp = 0; | 
| 18 | 1 | 50 | 33 |  |  | 6 | if (    ( exists $main::{'RPerl__DataType__GMPInteger__MODE_ID'} ) | 
| 19 | 0 |  |  |  |  | 0 | and ( defined &{ $main::{'RPerl__DataType__GMPInteger__MODE_ID'} } ) ) | 
| 20 |  |  |  |  |  |  | { | 
| 21 |  |  |  |  |  |  | #        RPerl::diag("in GMPInteger_cpp::cpp_load, RPerl__DataType__GMPInteger__MODE_ID() exists & defined\n"); | 
| 22 |  |  |  |  |  |  | #        RPerl::diag(q{in GMPInteger_cpp::cpp_load, have RPerl__DataType__GMPInteger__MODE_ID() retval = '} . main::RPerl__DataType__GMPInteger__MODE_ID() . "'\n"); | 
| 23 | 0 | 0 |  |  |  | 0 | if ( $RPerl::MODES->{main::RPerl__DataType__GMPInteger__MODE_ID()}->{ops} ne 'CPP' ) { | 
| 24 | 0 |  |  |  |  | 0 | $need_load_cpp = 1; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  | else { | 
| 28 |  |  |  |  |  |  | #        RPerl::diag("in GMPInteger_cpp::cpp_load, RPerl__DataType__GMPInteger__MODE_ID() does not exist or undefined\n"); | 
| 29 | 1 |  |  |  |  | 2 | $need_load_cpp = 1; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 1 | 50 |  |  |  | 3 | if ($need_load_cpp) { | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | #        RPerl::diag("in GMPInteger_cpp::cpp_load, need load CPP code\n"); | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 1 |  |  |  |  | 4 | my $eval_string = <<"EOF"; | 
| 37 |  |  |  |  |  |  | package main; | 
| 38 |  |  |  |  |  |  | use RPerl::Inline; | 
| 39 |  |  |  |  |  |  | BEGIN { RPerl::diag("[[[ BEGIN 'use Inline' STAGE for 'RPerl/DataType/GMPInteger.cpp' ]]]\n" x 0); } | 
| 40 |  |  |  |  |  |  | use Inline (CPP => '$RPerl::INCLUDE_PATH' . '/RPerl/DataType/GMPInteger.cpp', \%RPerl::Inline::ARGS); | 
| 41 |  |  |  |  |  |  | RPerl::diag("[[[ END   'use Inline' STAGE for 'RPerl/DataType/GMPInteger.cpp' ]]]\n" x 0); | 
| 42 |  |  |  |  |  |  | 1; | 
| 43 |  |  |  |  |  |  | EOF | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 1 |  |  |  |  | 7 | $RPerl::Inline::ARGS{ccflagsex} = $RPerl::Inline::CCFLAGSEX . $RPerl::TYPES_CCFLAG . rperltypessizes::type_integer_native_ccflag() . rperltypessizes::type_number_native_ccflag(); | 
| 46 | 1 |  |  |  |  | 5 | $RPerl::Inline::ARGS{cppflags} = $RPerl::TYPES_CCFLAG . rperltypessizes::type_integer_native_ccflag() . rperltypessizes::type_number_native_ccflag(); | 
| 47 | 1 |  |  |  |  | 3 | $RPerl::Inline::ARGS{libs}         = '-lgmpxx -lgmp';                                                                                     # enable GMP support | 
| 48 | 1 |  |  |  |  | 2 | $RPerl::Inline::ARGS{auto_include} = [ @{ $RPerl::Inline::ARGS{auto_include} }, '#include <gmpxx.h>', '#include <gmp.h>' ];    # enable GMP support | 
|  | 1 |  |  |  |  | 9 |  | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | #        RPerl::diag("in GMPInteger_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"); | 
| 51 |  |  |  |  |  |  | #        RPerl::diag("in GMPInteger_cpp::cpp_load(), CPP not yet loaded, have \%RPerl::Inline::ARGS =\n" . Dumper(\%RPerl::Inline::ARGS) . "\n"); | 
| 52 |  |  |  |  |  |  | #        RPerl::diag("in GMPInteger_cpp::cpp_load(), CPP not yet loaded, have \$RPerl::TYPES_CCFLAG = '" . $RPerl::TYPES_CCFLAG . "'\n"); | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 1 | 50 |  | 1 |  | 7 | eval $eval_string or croak( $OS_ERROR . "\n" . $EVAL_ERROR ); | 
|  | 1 |  |  | 1 |  | 2 |  | 
|  | 1 |  |  | 1 |  | 42 |  | 
|  | 1 |  |  |  |  | 7 |  | 
|  | 1 |  |  |  |  | 6 |  | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 13 |  | 
|  | 1 |  |  |  |  | 68 |  | 
| 55 | 0 | 0 |  |  |  |  | if ($EVAL_ERROR) { croak($EVAL_ERROR); } | 
|  | 0 |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | #    else { RPerl::diag("in GMPInteger_cpp::cpp_load(), CPP already loaded, DOING NOTHING\n"); } | 
| 59 | 0 |  |  |  |  |  | return; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | 1;  # end of package |