Name
SPVM::Resource::RE2 - The Resource of Google/RE2
Description
SPVM::Resource::RE2 class in SPVM is a resource class for the Google/RE2.
Usage
MyClass.config:
my
$config
= SPVM::Builder::Config->new_cpp17(
file
=> __FILE__);
my
$resource
=
$config
->use_resource(
'Resource::RE2'
);
if
($^O eq
'MSWin32'
) {
$config
->add_static_lib(
'stdc++'
,
'winpthread'
,
'gcc'
);
}
else
{
$config
->add_lib(
'stdc++'
);
}
$config
->add_ldflag(
'-pthread'
);
$config
;
MyClass.cpp:
#include "re2/re2.h"
extern
"C"
{
int32_t SPVM__MyClass__test(SPVM_ENV* env, SPVM_VALUE* stack) {
int32_t match = RE2::PartialMatch(
"abcde"
,
"bcd"
);
return
0;
}
}
Original Product
Original Product Version
Language
C++
Language Specification
C++17
Required Libraries
Windows:
stdc++ (The static link is preffered)
winpthread (The static link is preffered)
gcc (The static link is preffered)
Unix/Linux/Mac:
stdc++
Required Linker Flags
-pthread
Header Files
util/logging.h
util/test.h
util/mix.h
util/util.h
util/mutex.h
util/strutil.h
util/malloc_counter.h
util/pcre.h
util/flags.h
util/utf.h
util/benchmark.h
re2/prefilter.h
re2/re2.h
re2/sparse_set.h
re2/unicode_casefold.h
re2/filtered_re2.h
re2/pod_array.h
re2/stringpiece.h
re2/prefilter_tree.h
re2/bitmap256.h
re2/sparse_array.h
re2/set.h
re2/regexp.h
re2/testing/regexp_generator.h
re2/testing/tester.h
re2/testing/exhaustive_tester.h
re2/testing/string_generator.h
re2/walker-inl.h
re2/fuzzing/compiler-rt/include/fuzzer/FuzzedDataProvider.h
re2/unicode_groups.h
re2/prog.h
Source Files
re2/dfa.cc
re2/prefilter_tree.cc
re2/stringpiece.cc
re2/bitstate.cc
re2/unicode_casefold.cc
re2/simplify.cc
re2/filtered_re2.cc
re2/onepass.cc
re2/bitmap256.cc
re2/re2.cc
re2/parse.cc
re2/set.cc
re2/prog.cc
re2/prefilter.cc
re2/mimics_pcre.cc
re2/regexp.cc
re2/nfa.cc
re2/tostring.cc
re2/perl_groups.cc
re2/unicode_groups.cc
re2/compile.cc
util/strutil.cc
util/rune.cc
util/pcre.cc
Compiler Flags
-pthread
-Wno-unused-parameter
-Wno-missing-field-initializers
How to Create Resource
Download
mkdir
-p .tmp
git clone https://github.com/google/re2.git .tmp/re2
git -C .tmp/re2 checkout tags/2023-02-01 -b branch_2023-02-01
git -C .tmp/re2 branch
Extracting Source Files
All files of Google/RE2
is copied by the following steps into the src
directory.
rsync -av --exclude=
'*.h'
.tmp/re2/ lib/SPVM/Resource/RE2.native/src/
The source files that is used in the config are extracted by the following command.
find lib/SPVM/Resource/RE2.native/src/* | perl -p -e
's|^\Qlib/SPVM/Resource/RE2.native/src/||'
|
grep
-P
'(util|re2)/\w+\.cc$'
|
grep
-v -P
'util/(test|benchmark|fuzz)\.cc$'
Extracting Header Files
Header files of Google/RE2
is copied into the include
directory by the following way.
rsync -av --include=
'*/'
--include=
'*.h'
--exclude=
'*'
.tmp/re2/ lib/SPVM/Resource/RE2.native/include/
Repository
Author
YuKi Kimoto kimoto.yuki@gmail.com
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License