line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# [[[ HEADER ]]] |
2
|
|
|
|
|
|
|
package RPerl::Inline; |
3
|
7
|
|
|
7
|
|
38
|
use strict; |
|
7
|
|
|
|
|
9
|
|
|
7
|
|
|
|
|
159
|
|
4
|
7
|
|
|
7
|
|
28
|
use warnings; |
|
7
|
|
|
|
|
11
|
|
|
7
|
|
|
|
|
230
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.006_000; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
#use RPerl; # ERROR: Too late to run INIT block at ... |
8
|
|
|
|
|
|
|
#use Config; |
9
|
7
|
|
|
7
|
|
34
|
use RPerl::Config; # for $RPerl::DEBUG |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
717
|
|
10
|
7
|
|
|
7
|
|
1544
|
use Alien::PCRE2; # for regex support |
|
7
|
|
|
|
|
163297
|
|
|
7
|
|
|
|
|
64
|
|
11
|
7
|
|
|
7
|
|
131090
|
use Alien::JPCRE2; # for regex support |
|
7
|
|
|
|
|
1827
|
|
|
7
|
|
|
|
|
53
|
|
12
|
7
|
|
|
7
|
|
52349
|
use File::Spec; # for splitpath() and catpath() |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
2644
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# for regex support, look up include & lib dirs |
15
|
|
|
|
|
|
|
my $pcre2_dir = Alien::PCRE2->dist_dir(); |
16
|
|
|
|
|
|
|
my $jpcre2_dir = Alien::JPCRE2->dist_dir(); |
17
|
|
|
|
|
|
|
#print {*STDERR} "\n\n", q{<<< DEBUG >>> in RPerl::Inline, have $pcre2_dir = '}, $pcre2_dir, q{'}, "\n\n"; |
18
|
|
|
|
|
|
|
#print {*STDERR} "\n\n", q{<<< DEBUG >>> in RPerl::Inline, have $jpcre2_dir = '}, $jpcre2_dir, q{'}, "\n\n"; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# two 'our' vars below utilized from Compiler.pm |
21
|
|
|
|
|
|
|
our $pcre2_include_dir = File::Spec->catpath(q{}, $pcre2_dir, q{include}); |
22
|
|
|
|
|
|
|
our $jpcre2_include_dir = File::Spec->catpath(q{}, $jpcre2_dir, q{include}); |
23
|
|
|
|
|
|
|
my $pcre2_lib_dir = File::Spec->catpath(q{}, $pcre2_dir, q{lib}); |
24
|
|
|
|
|
|
|
#my $jpcre2_lib_dir = File::Spec->catpath(q{}, $jpcre2_dir, q{lib}); # NOT USED |
25
|
|
|
|
|
|
|
#print {*STDERR} "\n\n", q{<<< DEBUG >>> in RPerl::Inline, have $pcre2_include_dir = '}, $pcre2_include_dir, q{'}, "\n\n"; |
26
|
|
|
|
|
|
|
#print {*STDERR} "\n\n", q{<<< DEBUG >>> in RPerl::Inline, have $jpcre2_include_dir = '}, $jpcre2_include_dir, q{'}, "\n\n"; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# NEED REMOVE HARD-CODED VALUE! implement Alien::GSL and use Alien::GSL->dist_dir() as w/ PCRE2 in RPerl/Inline.pm |
29
|
|
|
|
|
|
|
# 'our' var below utilized from generated *.pmc files |
30
|
|
|
|
|
|
|
our $gsl_include_dir = '/usr/include/gsl'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# long form |
33
|
|
|
|
|
|
|
#use Inline CPP => config => classes => |
34
|
|
|
|
|
|
|
#sub { |
35
|
|
|
|
|
|
|
# my $class = shift; |
36
|
|
|
|
|
|
|
# my @class_split = split('__', $class); |
37
|
|
|
|
|
|
|
# my $class_join = join('::', @class_split); |
38
|
|
|
|
|
|
|
# return($class_join); |
39
|
|
|
|
|
|
|
#}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# short form |
42
|
|
|
|
|
|
|
#use Inline CPP => config => classes => sub { join('::', split('__', shift)); }; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# DEV NOTE, CORRELATION #rp011: replace -std=c++0x w/ -std=c++11 for std::string::pop_back() |
45
|
|
|
|
|
|
|
# DEV NOTE: move ccflags outside %ARGS, make individual modules compose ccflags with possible cppflags right before calling Inline |
46
|
|
|
|
|
|
|
#our $CCFLAGSEX = '-DNO_XSLOCKS -Wno-deprecated -std=c++0x -Wno-reserved-user-defined-literal -Wno-literal-suffix'; |
47
|
|
|
|
|
|
|
#our $CCFLAGSEX = '-DNO_XSLOCKS -Wno-deprecated -std=c++11 -Wno-reserved-user-defined-literal -Wno-literal-suffix'; |
48
|
|
|
|
|
|
|
# DEV NOTE: add -Wno-unused-variable to suppress warnings in GCC v4.9 |
49
|
|
|
|
|
|
|
my $is_msvc_compiler = ($Config::Config{cc} =~ /cl/); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
our $CCFLAGSEX = $is_msvc_compiler ? '-DNO_XSLOCKS' |
52
|
|
|
|
|
|
|
: '-Wno-unused-variable -DNO_XSLOCKS -Wno-deprecated -std=c++11 -Wno-reserved-user-defined-literal -Wno-literal-suffix'; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# for regex support |
55
|
|
|
|
|
|
|
$CCFLAGSEX .= ' -L"' . $pcre2_lib_dir . '"'; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
our %ARGS = ( |
58
|
|
|
|
|
|
|
typemaps => "$RPerl::INCLUDE_PATH/typemap.rperl", |
59
|
|
|
|
|
|
|
# disable default '-O2 -g' (or similar) from Perl core & Makemaker |
60
|
|
|
|
|
|
|
($is_msvc_compiler |
61
|
|
|
|
|
|
|
? () |
62
|
|
|
|
|
|
|
: (optimize => '-O3 -fomit-frame-pointer -march=native -g') |
63
|
|
|
|
|
|
|
), |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# NEED UPGRADE: strip C++ incompat CFLAGS |
66
|
|
|
|
|
|
|
# ccflags => $Config{ccflags} . ' -DNO_XSLOCKS -Wno-deprecated -std=c++0x -Wno-reserved-user-defined-literal -Wno-literal-suffix', |
67
|
|
|
|
|
|
|
# force_build => 1, # debug use only |
68
|
|
|
|
|
|
|
inc => '-I' . $RPerl::INCLUDE_PATH . ' -Ilib -I' . $pcre2_include_dir . ' -I' . $jpcre2_include_dir, |
69
|
|
|
|
|
|
|
build_noisy => ( $ENV{RPERL_DEBUG} or $RPerl::DEBUG ), # suppress or display actual g++ compiler commands |
70
|
|
|
|
|
|
|
clean_after_build => 0, # used by Inline::C(PP) to cache build, also used by Inline::Filters to save Filters*.c files for use in gdb debugging |
71
|
|
|
|
|
|
|
warnings => (((not defined $ENV{RPERL_WARNINGS}) or $ENV{RPERL_WARNINGS}) and $RPerl::WARNINGS), # suppress or display Inline warnings |
72
|
|
|
|
|
|
|
filters => 'Preprocess', |
73
|
|
|
|
|
|
|
auto_include => # DEV NOTE: include non-RPerl files using AUTO_INCLUDE so they are not parsed by the 'Preprocess' filter |
74
|
|
|
|
|
|
|
[ |
75
|
|
|
|
|
|
|
# DEV NOTE, CORRELATION #rp024: sync include files & other preprocessor directives in both RPerl/Inline.pm and rperlstandalone.h |
76
|
|
|
|
|
|
|
'#include <memory>', # smart pointers for memory management |
77
|
|
|
|
|
|
|
'#include <iostream>', |
78
|
|
|
|
|
|
|
'#include <string>', |
79
|
|
|
|
|
|
|
'#include <sstream>', |
80
|
|
|
|
|
|
|
'#include <limits>', |
81
|
|
|
|
|
|
|
'#undef seed', # fix conflict between Perl's source/internal.h & libstdc++-dev's algorithm.h; 'error: macro "seed" passed 1 arguments, but takes just 0' |
82
|
|
|
|
|
|
|
'#include <algorithm>', |
83
|
|
|
|
|
|
|
'#include <vector>', |
84
|
|
|
|
|
|
|
'#include <math.h>', |
85
|
|
|
|
|
|
|
'#include <unordered_map>', # DEV NOTE: unordered_map may require '-std=c++0x' in CCFLAGS above |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# for regex support |
88
|
|
|
|
|
|
|
# DEV NOTE, CORRELATION #rp024: sync include files & other preprocessor directives in both RPerl/Inline.pm and rperlstandalone.h |
89
|
|
|
|
|
|
|
'#undef do_open', # fix conflict between jpcre2.hpp subdep locale_facets_nonio.h & other uknown file, 'error: macro "do_open" requires 7 arguments, but only 2 given' |
90
|
|
|
|
|
|
|
'#undef do_close', # fix conflict between jpcre2.hpp subdep locale_facets_nonio.h & other uknown file, 'error: macro "do_close" requires 2 arguments, but only 1 given' |
91
|
|
|
|
|
|
|
'#include "jpcre2.hpp"', |
92
|
|
|
|
|
|
|
# DEV NOTE, CORRELATION #rp300: must link against all bit width libs to allow automatic selection |
93
|
|
|
|
|
|
|
'typedef jpcre2::select<char>::Regex regex;', # automatically selects correct character bit width based on system, 8 or 16 or 32 |
94
|
|
|
|
|
|
|
'typedef jpcre2::SIZE_T regexsize;', # used by substitution (replace) count type |
95
|
|
|
|
|
|
|
], |
96
|
|
|
|
|
|
|
classes => sub { join('::', split('__', shift)); } |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |