Migrate to PCRE2 (Miriam Ruiz)
This commit is contained in:
parent
2ed467221a
commit
3d17bca419
|
@ -1,5 +1,8 @@
|
|||
# Version number followed by the release date
|
||||
|
||||
1.3.1.0
|
||||
* Migrate to PCRE2 (Miriam Ruiz)
|
||||
|
||||
1.3.0.0 2020/08/15
|
||||
* Link against wxWidgets 3.0
|
||||
* SSE2 compatible CPUs are required (xerces-c++)
|
||||
|
|
|
@ -286,6 +286,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCRE2_CFLAGS = @PCRE2_CFLAGS@
|
||||
PCRE2_LIBS = @PCRE2_LIBS@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
|
|
|
@ -666,6 +666,8 @@ GTK_CFLAGS
|
|||
ASPELL_LIBS
|
||||
ENCHANT_LIBS
|
||||
ENCHANT_CFLAGS
|
||||
PCRE2_LIBS
|
||||
PCRE2_CFLAGS
|
||||
XSLT_LIBS
|
||||
XSLT_CFLAGS
|
||||
XML2_LIBS
|
||||
|
@ -872,6 +874,8 @@ XML2_CFLAGS
|
|||
XML2_LIBS
|
||||
XSLT_CFLAGS
|
||||
XSLT_LIBS
|
||||
PCRE2_CFLAGS
|
||||
PCRE2_LIBS
|
||||
ENCHANT_CFLAGS
|
||||
ENCHANT_LIBS
|
||||
GTK_CFLAGS
|
||||
|
@ -1556,6 +1560,9 @@ Some influential environment variables:
|
|||
XML2_LIBS linker flags for XML2, overriding pkg-config
|
||||
XSLT_CFLAGS C compiler flags for XSLT, overriding pkg-config
|
||||
XSLT_LIBS linker flags for XSLT, overriding pkg-config
|
||||
PCRE2_CFLAGS
|
||||
C compiler flags for PCRE2, overriding pkg-config
|
||||
PCRE2_LIBS linker flags for PCRE2, overriding pkg-config
|
||||
ENCHANT_CFLAGS
|
||||
C compiler flags for ENCHANT, overriding pkg-config
|
||||
ENCHANT_LIBS
|
||||
|
@ -17801,15 +17808,98 @@ fi
|
|||
|
||||
|
||||
# Check pcre is available
|
||||
ac_fn_c_check_header_compile "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_pcre_h" = xyes
|
||||
then :
|
||||
|
||||
else $as_nop
|
||||
as_fn_error $? "PCRE headers not found" "$LINENO" 5
|
||||
pkg_failed=no
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpcre2-8" >&5
|
||||
printf %s "checking for libpcre2-8... " >&6; }
|
||||
|
||||
if test -n "$PCRE2_CFLAGS"; then
|
||||
pkg_cv_PCRE2_CFLAGS="$PCRE2_CFLAGS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libpcre2-8") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_PCRE2_CFLAGS=`$PKG_CONFIG --cflags "libpcre2-8" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$PCRE2_LIBS"; then
|
||||
pkg_cv_PCRE2_LIBS="$PCRE2_LIBS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libpcre2-8") 2>&5
|
||||
ac_status=$?
|
||||
printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_PCRE2_LIBS=`$PKG_CONFIG --libs "libpcre2-8" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8" 2>&1`
|
||||
else
|
||||
PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$PCRE2_PKG_ERRORS" >&5
|
||||
|
||||
as_fn_error $? "Package requirements (libpcre2-8) were not met:
|
||||
|
||||
$PCRE2_PKG_ERRORS
|
||||
|
||||
Consider adjusting the PKG_CONFIG_PATH environment variable if you
|
||||
installed software in a non-standard prefix.
|
||||
|
||||
Alternatively, you may set the environment variables PCRE2_CFLAGS
|
||||
and PCRE2_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details." "$LINENO" 5
|
||||
elif test $pkg_failed = untried; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
|
||||
is in your PATH or set the PKG_CONFIG environment variable to the full
|
||||
path to pkg-config.
|
||||
|
||||
Alternatively, you may set the environment variables PCRE2_CFLAGS
|
||||
and PCRE2_LIBS to avoid the need to call pkg-config.
|
||||
See the pkg-config man page for more details.
|
||||
|
||||
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
|
||||
See \`config.log' for more details" "$LINENO" 5; }
|
||||
else
|
||||
PCRE2_CFLAGS=$pkg_cv_PCRE2_CFLAGS
|
||||
PCRE2_LIBS=$pkg_cv_PCRE2_LIBS
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
fi
|
||||
|
||||
# Check boost::shared_ptr is available
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
|
|
|
@ -72,8 +72,7 @@ AC_ARG_ENABLE(debug,
|
|||
])
|
||||
|
||||
# Check pcre is available
|
||||
AC_CHECK_HEADER(pcre.h, ,
|
||||
AC_MSG_ERROR([PCRE headers not found]))
|
||||
PKG_CHECK_MODULES([PCRE2], [libpcre2-8])
|
||||
|
||||
# Check boost::shared_ptr is available
|
||||
AC_LANG(C++)
|
||||
|
|
|
@ -239,6 +239,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCRE2_CFLAGS = @PCRE2_CFLAGS@
|
||||
PCRE2_LIBS = @PCRE2_LIBS@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
|
|
|
@ -205,6 +205,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCRE2_CFLAGS = @PCRE2_CFLAGS@
|
||||
PCRE2_LIBS = @PCRE2_LIBS@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<listOptionValue builtIn="false" value="${BOOSTINC}"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/include"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_dll32/mswud"/>
|
||||
<listOptionValue builtIn="false" value="${WX_SETUP}"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.other.other.1952331323" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="-c -fmessage-length=0" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.1236209686" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
|
@ -69,7 +69,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexud"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -184,7 +184,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexu"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -268,7 +268,7 @@
|
|||
<listOptionValue builtIn="false" value="__WXMSW__"/>
|
||||
<listOptionValue builtIn="false" value="__WXDEBUG__"/>
|
||||
<listOptionValue builtIn="false" value="_UNICODE"/>
|
||||
<listOptionValue builtIn="false" value="PCRE_STATIC"/>
|
||||
<listOptionValue builtIn="false" value="PCRE2_STATIC"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.292438275" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
|
@ -297,7 +297,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexud"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -412,7 +412,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexud"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -526,7 +526,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexu-${WXVER}"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -605,10 +605,9 @@
|
|||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.1661238691" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.1436489844" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${BOOSTINC}"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/include"/>
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_dll64/mswud"/>
|
||||
<listOptionValue builtIn="false" value="${WX_SETUP}"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.other.other.10300771" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" useByScannerDiscovery="false" value="-c -fmessage-length=0" valueType="string"/>
|
||||
|
@ -644,7 +643,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexud"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -759,7 +758,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexu"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -869,7 +868,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexud"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -983,7 +982,7 @@
|
|||
<listOptionValue builtIn="false" value="wxregexu-${WXVER}"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
@ -1059,6 +1058,7 @@
|
|||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.2032888647" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.167497499" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${WXWIDGETS}"/>
|
||||
<listOptionValue builtIn="false" value="${WX_SETUP}"/>
|
||||
<listOptionValue builtIn="false" value="/usr/include/libxml2"/>
|
||||
<listOptionValue builtIn="false" value="/usr/include/gtk-3.0"/>
|
||||
<listOptionValue builtIn="false" value="/usr/include/glib-2.0"/>
|
||||
|
@ -1106,7 +1106,7 @@
|
|||
<listOptionValue builtIn="false" value="wx_baseu-3.0"/>
|
||||
<listOptionValue builtIn="false" value="xslt"/>
|
||||
<listOptionValue builtIn="false" value="xml2"/>
|
||||
<listOptionValue builtIn="false" value="pcre"/>
|
||||
<listOptionValue builtIn="false" value="pcre2-8"/>
|
||||
<listOptionValue builtIn="false" value="xerces-c"/>
|
||||
<listOptionValue builtIn="false" value="curl"/>
|
||||
<listOptionValue builtIn="false" value="aspell"/>
|
||||
|
|
|
@ -83,7 +83,8 @@ xmlcopyeditor_LDADD = $(WX_LIBS) \
|
|||
$(ENCHANT_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(XSLT_LIBS) \
|
||||
-lexpat -lpcre -lxerces-c
|
||||
$(PCRE2_LIBS) \
|
||||
-lexpat -lxerces-c
|
||||
|
||||
nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \
|
||||
$(srcdir)/dtd/*.* \
|
||||
|
@ -133,5 +134,5 @@ EXTRA_DIST = \
|
|||
$(srcdir)/xmlcopyeditor.rc \
|
||||
$(srcdir)/xmlschemaparser.cpp
|
||||
|
||||
AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS)
|
||||
AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS) $(PCRE2_CFLAGS)
|
||||
|
||||
|
|
|
@ -141,7 +141,8 @@ xmlcopyeditor_OBJECTS = $(am_xmlcopyeditor_OBJECTS)
|
|||
am__DEPENDENCIES_1 =
|
||||
xmlcopyeditor_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
|
@ -352,6 +353,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PCRE2_CFLAGS = @PCRE2_CFLAGS@
|
||||
PCRE2_LIBS = @PCRE2_LIBS@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
|
@ -502,7 +505,8 @@ xmlcopyeditor_LDADD = $(WX_LIBS) \
|
|||
$(ENCHANT_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(XSLT_LIBS) \
|
||||
-lexpat -lpcre -lxerces-c
|
||||
$(PCRE2_LIBS) \
|
||||
-lexpat -lxerces-c
|
||||
|
||||
nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \
|
||||
$(srcdir)/dtd/*.* \
|
||||
|
@ -551,7 +555,7 @@ EXTRA_DIST = \
|
|||
$(srcdir)/xmlcopyeditor.rc \
|
||||
$(srcdir)/xmlschemaparser.cpp
|
||||
|
||||
AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS)
|
||||
AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS) $(PCRE2_CFLAGS)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
|
|
|
@ -26,12 +26,11 @@ using namespace std;
|
|||
Rule::Rule (
|
||||
const string& pattern,
|
||||
bool matchCase,
|
||||
const string& replace,
|
||||
const int arrayLength ) : WrapRegex (
|
||||
const string& replace
|
||||
) : WrapRegex (
|
||||
pattern,
|
||||
matchCase,
|
||||
replace,
|
||||
arrayLength )
|
||||
replace )
|
||||
{
|
||||
adjustCaseAttribute = tentativeAttribute = false;
|
||||
}
|
||||
|
|
|
@ -32,8 +32,7 @@ class Rule : public WrapRegex
|
|||
Rule (
|
||||
const string& pattern,
|
||||
bool matchCase,
|
||||
const string& replace = "",
|
||||
const int arrayLength = 60 );
|
||||
const string& replace = "");
|
||||
bool getAdjustCaseAttribute();
|
||||
bool getTentativeAttribute();
|
||||
string getReport();
|
||||
|
|
|
@ -31,40 +31,39 @@ using namespace std;
|
|||
WrapRegex::WrapRegex (
|
||||
const string& pattern,
|
||||
bool matchCase,
|
||||
const string& replaceParameter,
|
||||
const int arrayLengthParameter ) :
|
||||
const string& replaceParameter ) :
|
||||
replace ( replaceParameter ),
|
||||
arrayLength ( arrayLengthParameter ),
|
||||
returnValue ( 0 )
|
||||
{
|
||||
if ( pattern.empty() || pattern == ".*" )
|
||||
{
|
||||
disabled = true;
|
||||
matchArray = NULL;
|
||||
patternStructure = NULL;
|
||||
patternExtraStructure = NULL;
|
||||
patternCode = NULL;
|
||||
patternMatchData = NULL;
|
||||
patternMatchContext = NULL;
|
||||
return;
|
||||
}
|
||||
disabled = false;
|
||||
|
||||
matchArray = new int[arrayLength];
|
||||
|
||||
// compile
|
||||
int optionsFlag = ( matchCase ) ? PCRE_UTF8 : PCRE_CASELESS | PCRE_UTF8;
|
||||
const char *errorPointer;
|
||||
int errorOffset;
|
||||
uint32_t optionsFlag = ( matchCase ? 0 : PCRE2_CASELESS ) | PCRE2_UTF | PCRE2_NO_UTF_CHECK;
|
||||
int errorCode;
|
||||
PCRE2_SIZE errorOffset;
|
||||
|
||||
if ( ( patternStructure = pcre_compile (
|
||||
pattern.c_str(),
|
||||
optionsFlag,
|
||||
&errorPointer,
|
||||
&errorOffset,
|
||||
NULL ) ) == NULL )
|
||||
if ( ( patternCode = pcre2_compile (
|
||||
(PCRE2_SPTR)pattern.c_str(), // pattern
|
||||
PCRE2_ZERO_TERMINATED, // pattern is zero-terminated
|
||||
optionsFlag, // options
|
||||
&errorCode, // error number
|
||||
&errorOffset, // error offset
|
||||
NULL ) ) == NULL ) // default compile context
|
||||
{
|
||||
throw runtime_error ( errorPointer );
|
||||
char buf[256];
|
||||
pcre2_get_error_message ( errorCode, (PCRE2_UCHAR *)buf, sizeof(buf) );
|
||||
throw runtime_error ( string(buf) );
|
||||
}
|
||||
|
||||
patternExtraStructure = pcre_study ( patternStructure, 0, &errorPointer );
|
||||
patternMatchData = pcre2_match_data_create_from_pattern ( patternCode, NULL );
|
||||
patternMatchContext = pcre2_match_context_create ( NULL );
|
||||
}
|
||||
|
||||
WrapRegex::~WrapRegex()
|
||||
|
@ -72,9 +71,9 @@ WrapRegex::~WrapRegex()
|
|||
if ( disabled )
|
||||
return;
|
||||
|
||||
pcre_free ( patternStructure );
|
||||
pcre_free ( patternExtraStructure );
|
||||
delete[] matchArray;
|
||||
pcre2_match_data_free ( patternMatchData );
|
||||
pcre2_code_free ( patternCode );
|
||||
pcre2_match_context_free ( patternMatchContext );
|
||||
}
|
||||
|
||||
int WrapRegex::matchPatternGlobal (
|
||||
|
@ -108,18 +107,18 @@ string WrapRegex::replaceGlobal (
|
|||
string output, match;
|
||||
|
||||
output.reserve ( buffer.size() );
|
||||
while ( ( returnValue = pcre_exec (
|
||||
patternStructure,
|
||||
patternExtraStructure,
|
||||
s,
|
||||
strlen ( s ),
|
||||
0,
|
||||
0,
|
||||
matchArray,
|
||||
arrayLength ) ) >= 0 )
|
||||
while ( ( returnValue = pcre2_match (
|
||||
patternCode, // compiled pattern
|
||||
(PCRE2_SPTR)s, // subject string
|
||||
strlen ( s ), // length of the subject
|
||||
0, // start at offset 0 in the subject
|
||||
0, // default options
|
||||
patternMatchData, // block where results will be stored
|
||||
patternMatchContext ) ) >= 0 ) // match context
|
||||
{
|
||||
++ ( *matchCount );
|
||||
|
||||
PCRE2_SIZE *matchArray = pcre2_get_ovector_pointer ( patternMatchData );
|
||||
output.append ( s, matchArray[0] );
|
||||
|
||||
match.clear();
|
||||
|
@ -150,18 +149,18 @@ int WrapRegex::matchPatternGlobal_ (
|
|||
matchcount = 0;
|
||||
offset = 0;
|
||||
|
||||
while ( ( returnValue = pcre_exec (
|
||||
patternStructure,
|
||||
patternExtraStructure,
|
||||
s,
|
||||
buflen,
|
||||
offset,
|
||||
0,
|
||||
matchArray,
|
||||
arrayLength ) ) >= 0 )
|
||||
while ( ( returnValue = pcre2_match (
|
||||
patternCode, // compiled pattern
|
||||
(PCRE2_SPTR)s, // subject string
|
||||
buflen, // length of the subject
|
||||
offset, // start at this offset in the subject
|
||||
0, // default options
|
||||
patternMatchData, // block where results will be stored
|
||||
patternMatchContext ) ) >= 0 ) // match context
|
||||
{
|
||||
++matchcount;
|
||||
|
||||
PCRE2_SIZE *matchArray = pcre2_get_ovector_pointer ( patternMatchData );
|
||||
if ( context )
|
||||
{
|
||||
match = ContextHandler::getContext (
|
||||
|
@ -255,11 +254,17 @@ string WrapRegex::getSubpattern_ ( const char *s, unsigned subpattern )
|
|||
if ( disabled )
|
||||
return "";
|
||||
|
||||
const char *sub;
|
||||
int ret = pcre_get_substring ( s, matchArray, returnValue, subpattern, &sub );
|
||||
if ( ret == PCRE_ERROR_NOSUBSTRING || ret == PCRE_ERROR_NOMEMORY )
|
||||
char *sub = NULL;
|
||||
size_t sublen;
|
||||
int ret = pcre2_substring_get_bynumber (
|
||||
patternMatchData,
|
||||
subpattern,
|
||||
(PCRE2_UCHAR **)sub,
|
||||
&sublen
|
||||
);
|
||||
if ( ret == PCRE2_ERROR_NOMATCH || ret == PCRE2_ERROR_BADDATA )
|
||||
return "";
|
||||
string subString ( sub );
|
||||
pcre_free_substring ( sub );
|
||||
pcre2_substring_free ( (PCRE2_UCHAR *)sub );
|
||||
return subString;
|
||||
}
|
||||
|
|
|
@ -21,10 +21,14 @@
|
|||
#ifndef WRAPREGEX_H
|
||||
#define WRAPREGEX_H
|
||||
|
||||
#ifndef PCRE2_CODE_UNIT_WIDTH
|
||||
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <pcre.h>
|
||||
#include <pcre2.h>
|
||||
#include <boost/utility.hpp>
|
||||
#include "contexthandler.h"
|
||||
|
||||
|
@ -36,8 +40,7 @@ class WrapRegex : private boost::noncopyable
|
|||
WrapRegex (
|
||||
const string& pattern,
|
||||
bool matchCase,
|
||||
const string& replaceParameter = "",
|
||||
const int arrayLengthParameter = 60 );
|
||||
const string& replaceParameter = "" );
|
||||
virtual ~WrapRegex();
|
||||
string replaceGlobal (
|
||||
const string& buffer,
|
||||
|
@ -49,13 +52,12 @@ class WrapRegex : private boost::noncopyable
|
|||
int context = 0 );
|
||||
private:
|
||||
string replace;
|
||||
const int arrayLength;
|
||||
int returnValue;
|
||||
bool disabled;
|
||||
|
||||
pcre *patternStructure;
|
||||
pcre_extra *patternExtraStructure;
|
||||
int *matchArray;
|
||||
pcre2_code *patternCode;
|
||||
pcre2_match_data *patternMatchData;
|
||||
pcre2_match_context *patternMatchContext;
|
||||
|
||||
string getInterpolatedString_ ( const char *buffer,
|
||||
const char *source );
|
||||
|
|
|
@ -129,7 +129,7 @@ Source: "{#MinGW}\bin\libidn2-0.dll"; DestDir: "{app}"
|
|||
Source: "{#MinGW}\bin\libintl-8.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\liblzma-5.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\libnghttp2-14.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\libpcre-1.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\libpcre2-8-0.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\libpsl-5.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\libssh2-1.dll"; DestDir: "{app}"
|
||||
Source: "{#MinGW}\bin\libssl-1_1{#DllNameSuffix}.dll"; DestDir: "{app}"
|
||||
|
|
Loading…
Reference in New Issue