| 1 | # [[[ HEADER ]]] | ||
| 2 | package Perl::Type::Character_cpp; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Perl::Types; | ||
| 6 | our $VERSION = 0.002_000; | ||
| 7 | |||
| 8 | # [[[ CRITICS ]]] | ||
| 9 | ## no critic qw(ProhibitStringyEval) # SYSTEM DEFAULT 1: allow eval() | ||
| 10 | |||
| 11 | # [[[ INCLUDES ]]] | ||
| 12 | use Perl::Inline; | ||
| 13 | |||
| 14 | # [[[ SUBROUTINES ]]] | ||
| 15 | sub cpp_load { | ||
| 16 | { my void $RETURN_TYPE }; | ||
| 17 | my $need_load_cpp = 0; | ||
| 18 | if ( ( exists $main::{'Perl__Type__Character__MODE_ID'} ) | ||
| 19 | and ( defined &{ $main::{'Perl__Type__Character__MODE_ID'} } ) ) | ||
| 20 | { | ||
| 21 | # Perl::diag("in Character_cpp::cpp_load, Perl__Type__Character__MODE_ID() exists & defined\n"); | ||
| 22 | # Perl::diag(q{in Character_cpp::cpp_load, have Perl__Type__Character__MODE_ID() retval = '} . main::Perl__Type__Character__MODE_ID() . "'\n"); | ||
| 23 | if ( $Perl::MODES->{main::Perl__Type__Character__MODE_ID()}->{ops} ne 'CPP' ) { | ||
| 24 | $need_load_cpp = 1; | ||
| 25 | } | ||
| 26 | } | ||
| 27 | else { | ||
| 28 | # Perl::diag("in Character_cpp::cpp_load, Perl__Type__Character__MODE_ID() does not exist or undefined\n"); | ||
| 29 | $need_load_cpp = 1; | ||
| 30 | } | ||
| 31 | |||
| 32 | if ($need_load_cpp) { | ||
| 33 | |||
| 34 | # Perl::diag("in Character_cpp::cpp_load, need load CPP code\n"); | ||
| 35 | |||
| 36 | my $eval_string = <<"EOF"; | ||
| 37 | package main; | ||
| 38 | use Perl::Inline; | ||
| 39 | BEGIN { Perl::diag("[[[ BEGIN 'use Inline' STAGE for 'Perl/Type/Character.cpp' ]]]\n" x 0); } | ||
| 40 | use Inline (CPP => '$Perl::INCLUDE_PATH' . '/Perl/Type/Character.cpp', \%Perl::Inline::ARGS); | ||
| 41 | Perl::diag("[[[ END 'use Inline' STAGE for 'Perl/Type/Character.cpp' ]]]\n" x 0); | ||
| 42 | 1; | ||
| 43 | EOF | ||
| 44 | |||
| 45 | $Perl::Inline::ARGS{ccflagsex} = $Perl::Inline::CCFLAGSEX . $Perl::TYPES_CCFLAG . perltypessizes::type_integer_native_ccflag() . perltypessizes::type_number_native_ccflag(); | ||
| 46 | $Perl::Inline::ARGS{cppflags} = $Perl::TYPES_CCFLAG . perltypessizes::type_integer_native_ccflag() . perltypessizes::type_number_native_ccflag(); | ||
| 47 | # Perl::diag("in Character_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"); | ||
| 48 | # Perl::diag("in Character_cpp::cpp_load(), CPP not yet loaded, have \%Perl::Inline::ARGS =\n" . Dumper(\%Perl::Inline::ARGS) . "\n"); | ||
| 49 | # Perl::diag("in Character_cpp::cpp_load(), CPP not yet loaded, have \$Perl::TYPES_CCFLAG = '" . $Perl::TYPES_CCFLAG . "'\n"); | ||
| 50 | |||
| 51 | eval $eval_string or croak( $OS_ERROR . "\n" . $EVAL_ERROR ); | ||
| 52 | if ($EVAL_ERROR) { croak($EVAL_ERROR); } | ||
| 53 | } | ||
| 54 | |||
| 55 | # else { Perl::diag("in Character_cpp::cpp_load(), CPP already loaded, DOING NOTHING\n"); } | ||
| 56 | return; | ||
| 57 | } | ||
| 58 | |||
| 59 | 1; # end of package |