Migrate to PCRE2 (Miriam Ruiz)

This commit is contained in:
Zane U. Ji 2022-10-04 19:04:08 +08:00
parent 2ed467221a
commit 3d17bca419
14 changed files with 193 additions and 85 deletions

View File

@ -1,5 +1,8 @@
# Version number followed by the release date # Version number followed by the release date
1.3.1.0
* Migrate to PCRE2 (Miriam Ruiz)
1.3.0.0 2020/08/15 1.3.0.0 2020/08/15
* Link against wxWidgets 3.0 * Link against wxWidgets 3.0
* SSE2 compatible CPUs are required (xerces-c++) * SSE2 compatible CPUs are required (xerces-c++)

View File

@ -286,6 +286,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCRE2_CFLAGS = @PCRE2_CFLAGS@
PCRE2_LIBS = @PCRE2_LIBS@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@

100
configure vendored
View File

@ -666,6 +666,8 @@ GTK_CFLAGS
ASPELL_LIBS ASPELL_LIBS
ENCHANT_LIBS ENCHANT_LIBS
ENCHANT_CFLAGS ENCHANT_CFLAGS
PCRE2_LIBS
PCRE2_CFLAGS
XSLT_LIBS XSLT_LIBS
XSLT_CFLAGS XSLT_CFLAGS
XML2_LIBS XML2_LIBS
@ -872,6 +874,8 @@ XML2_CFLAGS
XML2_LIBS XML2_LIBS
XSLT_CFLAGS XSLT_CFLAGS
XSLT_LIBS XSLT_LIBS
PCRE2_CFLAGS
PCRE2_LIBS
ENCHANT_CFLAGS ENCHANT_CFLAGS
ENCHANT_LIBS ENCHANT_LIBS
GTK_CFLAGS GTK_CFLAGS
@ -1556,6 +1560,9 @@ Some influential environment variables:
XML2_LIBS linker flags for XML2, overriding pkg-config XML2_LIBS linker flags for XML2, overriding pkg-config
XSLT_CFLAGS C compiler flags for XSLT, overriding pkg-config XSLT_CFLAGS C compiler flags for XSLT, overriding pkg-config
XSLT_LIBS linker 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 ENCHANT_CFLAGS
C compiler flags for ENCHANT, overriding pkg-config C compiler flags for ENCHANT, overriding pkg-config
ENCHANT_LIBS ENCHANT_LIBS
@ -17801,15 +17808,98 @@ fi
# Check pcre is available # 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 pkg_failed=no
as_fn_error $? "PCRE headers not found" "$LINENO" 5 { 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 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 # Check boost::shared_ptr is available
ac_ext=cpp ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS' ac_cpp='$CXXCPP $CPPFLAGS'

View File

@ -72,8 +72,7 @@ AC_ARG_ENABLE(debug,
]) ])
# Check pcre is available # Check pcre is available
AC_CHECK_HEADER(pcre.h, , PKG_CHECK_MODULES([PCRE2], [libpcre2-8])
AC_MSG_ERROR([PCRE headers not found]))
# Check boost::shared_ptr is available # Check boost::shared_ptr is available
AC_LANG(C++) AC_LANG(C++)

View File

@ -239,6 +239,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCRE2_CFLAGS = @PCRE2_CFLAGS@
PCRE2_LIBS = @PCRE2_LIBS@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@

View File

@ -205,6 +205,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCRE2_CFLAGS = @PCRE2_CFLAGS@
PCRE2_LIBS = @PCRE2_LIBS@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@

View File

@ -34,7 +34,7 @@
<listOptionValue builtIn="false" value="${BOOSTINC}"/> <listOptionValue builtIn="false" value="${BOOSTINC}"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/> <listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/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>
<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 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"> <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="wxregexud"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -184,7 +184,7 @@
<listOptionValue builtIn="false" value="wxregexu"/> <listOptionValue builtIn="false" value="wxregexu"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -268,7 +268,7 @@
<listOptionValue builtIn="false" value="__WXMSW__"/> <listOptionValue builtIn="false" value="__WXMSW__"/>
<listOptionValue builtIn="false" value="__WXDEBUG__"/> <listOptionValue builtIn="false" value="__WXDEBUG__"/>
<listOptionValue builtIn="false" value="_UNICODE"/> <listOptionValue builtIn="false" value="_UNICODE"/>
<listOptionValue builtIn="false" value="PCRE_STATIC"/> <listOptionValue builtIn="false" value="PCRE2_STATIC"/>
</option> </option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.292438275" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/> <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.292438275" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool> </tool>
@ -297,7 +297,7 @@
<listOptionValue builtIn="false" value="wxregexud"/> <listOptionValue builtIn="false" value="wxregexud"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -412,7 +412,7 @@
<listOptionValue builtIn="false" value="wxregexud"/> <listOptionValue builtIn="false" value="wxregexud"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -526,7 +526,7 @@
<listOptionValue builtIn="false" value="wxregexu-${WXVER}"/> <listOptionValue builtIn="false" value="wxregexu-${WXVER}"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <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 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"> <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="${BOOSTINC}"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}"/> <listOptionValue builtIn="false" value="${WXWIDGETS}"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/include"/> <listOptionValue builtIn="false" value="${WXWIDGETS}/contrib/include"/>
<listOptionValue builtIn="false" value="${WXWIDGETS}/lib/gcc_dll64/mswud"/>
<listOptionValue builtIn="false" value="${WX_SETUP}"/> <listOptionValue builtIn="false" value="${WX_SETUP}"/>
</option> </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"/> <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="wxregexud"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -759,7 +758,7 @@
<listOptionValue builtIn="false" value="wxregexu"/> <listOptionValue builtIn="false" value="wxregexu"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -869,7 +868,7 @@
<listOptionValue builtIn="false" value="wxregexud"/> <listOptionValue builtIn="false" value="wxregexud"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>
@ -983,7 +982,7 @@
<listOptionValue builtIn="false" value="wxregexu-${WXVER}"/> <listOptionValue builtIn="false" value="wxregexu-${WXVER}"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <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"> <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"> <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="${WXWIDGETS}"/>
<listOptionValue builtIn="false" value="${WX_SETUP}"/>
<listOptionValue builtIn="false" value="/usr/include/libxml2"/> <listOptionValue builtIn="false" value="/usr/include/libxml2"/>
<listOptionValue builtIn="false" value="/usr/include/gtk-3.0"/> <listOptionValue builtIn="false" value="/usr/include/gtk-3.0"/>
<listOptionValue builtIn="false" value="/usr/include/glib-2.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="wx_baseu-3.0"/>
<listOptionValue builtIn="false" value="xslt"/> <listOptionValue builtIn="false" value="xslt"/>
<listOptionValue builtIn="false" value="xml2"/> <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="xerces-c"/>
<listOptionValue builtIn="false" value="curl"/> <listOptionValue builtIn="false" value="curl"/>
<listOptionValue builtIn="false" value="aspell"/> <listOptionValue builtIn="false" value="aspell"/>

View File

@ -83,7 +83,8 @@ xmlcopyeditor_LDADD = $(WX_LIBS) \
$(ENCHANT_LIBS) \ $(ENCHANT_LIBS) \
$(GTK_LIBS) \ $(GTK_LIBS) \
$(XSLT_LIBS) \ $(XSLT_LIBS) \
-lexpat -lpcre -lxerces-c $(PCRE2_LIBS) \
-lexpat -lxerces-c
nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \ nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \
$(srcdir)/dtd/*.* \ $(srcdir)/dtd/*.* \
@ -133,5 +134,5 @@ EXTRA_DIST = \
$(srcdir)/xmlcopyeditor.rc \ $(srcdir)/xmlcopyeditor.rc \
$(srcdir)/xmlschemaparser.cpp $(srcdir)/xmlschemaparser.cpp
AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS) AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS) $(PCRE2_CFLAGS)

View File

@ -141,7 +141,8 @@ xmlcopyeditor_OBJECTS = $(am_xmlcopyeditor_OBJECTS)
am__DEPENDENCIES_1 = am__DEPENDENCIES_1 =
xmlcopyeditor_DEPENDENCIES = $(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__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
AM_V_lt = $(am__v_lt_@AM_V@) AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent am__v_lt_0 = --silent
@ -352,6 +353,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCRE2_CFLAGS = @PCRE2_CFLAGS@
PCRE2_LIBS = @PCRE2_LIBS@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
@ -502,7 +505,8 @@ xmlcopyeditor_LDADD = $(WX_LIBS) \
$(ENCHANT_LIBS) \ $(ENCHANT_LIBS) \
$(GTK_LIBS) \ $(GTK_LIBS) \
$(XSLT_LIBS) \ $(XSLT_LIBS) \
-lexpat -lpcre -lxerces-c $(PCRE2_LIBS) \
-lexpat -lxerces-c
nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \ nobase_dist_xmlcopyeditor_DATA = $(srcdir)/catalog/catalog \
$(srcdir)/dtd/*.* \ $(srcdir)/dtd/*.* \
@ -551,7 +555,7 @@ EXTRA_DIST = \
$(srcdir)/xmlcopyeditor.rc \ $(srcdir)/xmlcopyeditor.rc \
$(srcdir)/xmlschemaparser.cpp $(srcdir)/xmlschemaparser.cpp
AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS) AM_CPPFLAGS = $(XML2_CFLAGS) $(ENCHANT_CFLAGS) $(GTK_CFLAGS) $(PCRE2_CFLAGS)
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:

View File

@ -26,12 +26,11 @@ using namespace std;
Rule::Rule ( Rule::Rule (
const string& pattern, const string& pattern,
bool matchCase, bool matchCase,
const string& replace, const string& replace
const int arrayLength ) : WrapRegex ( ) : WrapRegex (
pattern, pattern,
matchCase, matchCase,
replace, replace )
arrayLength )
{ {
adjustCaseAttribute = tentativeAttribute = false; adjustCaseAttribute = tentativeAttribute = false;
} }

View File

@ -32,8 +32,7 @@ class Rule : public WrapRegex
Rule ( Rule (
const string& pattern, const string& pattern,
bool matchCase, bool matchCase,
const string& replace = "", const string& replace = "");
const int arrayLength = 60 );
bool getAdjustCaseAttribute(); bool getAdjustCaseAttribute();
bool getTentativeAttribute(); bool getTentativeAttribute();
string getReport(); string getReport();

View File

@ -31,40 +31,39 @@ using namespace std;
WrapRegex::WrapRegex ( WrapRegex::WrapRegex (
const string& pattern, const string& pattern,
bool matchCase, bool matchCase,
const string& replaceParameter, const string& replaceParameter ) :
const int arrayLengthParameter ) :
replace ( replaceParameter ), replace ( replaceParameter ),
arrayLength ( arrayLengthParameter ),
returnValue ( 0 ) returnValue ( 0 )
{ {
if ( pattern.empty() || pattern == ".*" ) if ( pattern.empty() || pattern == ".*" )
{ {
disabled = true; disabled = true;
matchArray = NULL; patternCode = NULL;
patternStructure = NULL; patternMatchData = NULL;
patternExtraStructure = NULL; patternMatchContext = NULL;
return; return;
} }
disabled = false; disabled = false;
matchArray = new int[arrayLength];
// compile // compile
int optionsFlag = ( matchCase ) ? PCRE_UTF8 : PCRE_CASELESS | PCRE_UTF8; uint32_t optionsFlag = ( matchCase ? 0 : PCRE2_CASELESS ) | PCRE2_UTF | PCRE2_NO_UTF_CHECK;
const char *errorPointer; int errorCode;
int errorOffset; PCRE2_SIZE errorOffset;
if ( ( patternStructure = pcre_compile ( if ( ( patternCode = pcre2_compile (
pattern.c_str(), (PCRE2_SPTR)pattern.c_str(), // pattern
optionsFlag, PCRE2_ZERO_TERMINATED, // pattern is zero-terminated
&errorPointer, optionsFlag, // options
&errorOffset, &errorCode, // error number
NULL ) ) == NULL ) &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) );
} }
patternMatchData = pcre2_match_data_create_from_pattern ( patternCode, NULL );
patternExtraStructure = pcre_study ( patternStructure, 0, &errorPointer ); patternMatchContext = pcre2_match_context_create ( NULL );
} }
WrapRegex::~WrapRegex() WrapRegex::~WrapRegex()
@ -72,9 +71,9 @@ WrapRegex::~WrapRegex()
if ( disabled ) if ( disabled )
return; return;
pcre_free ( patternStructure ); pcre2_match_data_free ( patternMatchData );
pcre_free ( patternExtraStructure ); pcre2_code_free ( patternCode );
delete[] matchArray; pcre2_match_context_free ( patternMatchContext );
} }
int WrapRegex::matchPatternGlobal ( int WrapRegex::matchPatternGlobal (
@ -108,18 +107,18 @@ string WrapRegex::replaceGlobal (
string output, match; string output, match;
output.reserve ( buffer.size() ); output.reserve ( buffer.size() );
while ( ( returnValue = pcre_exec ( while ( ( returnValue = pcre2_match (
patternStructure, patternCode, // compiled pattern
patternExtraStructure, (PCRE2_SPTR)s, // subject string
s, strlen ( s ), // length of the subject
strlen ( s ), 0, // start at offset 0 in the subject
0, 0, // default options
0, patternMatchData, // block where results will be stored
matchArray, patternMatchContext ) ) >= 0 ) // match context
arrayLength ) ) >= 0 )
{ {
++ ( *matchCount ); ++ ( *matchCount );
PCRE2_SIZE *matchArray = pcre2_get_ovector_pointer ( patternMatchData );
output.append ( s, matchArray[0] ); output.append ( s, matchArray[0] );
match.clear(); match.clear();
@ -150,18 +149,18 @@ int WrapRegex::matchPatternGlobal_ (
matchcount = 0; matchcount = 0;
offset = 0; offset = 0;
while ( ( returnValue = pcre_exec ( while ( ( returnValue = pcre2_match (
patternStructure, patternCode, // compiled pattern
patternExtraStructure, (PCRE2_SPTR)s, // subject string
s, buflen, // length of the subject
buflen, offset, // start at this offset in the subject
offset, 0, // default options
0, patternMatchData, // block where results will be stored
matchArray, patternMatchContext ) ) >= 0 ) // match context
arrayLength ) ) >= 0 )
{ {
++matchcount; ++matchcount;
PCRE2_SIZE *matchArray = pcre2_get_ovector_pointer ( patternMatchData );
if ( context ) if ( context )
{ {
match = ContextHandler::getContext ( match = ContextHandler::getContext (
@ -255,11 +254,17 @@ string WrapRegex::getSubpattern_ ( const char *s, unsigned subpattern )
if ( disabled ) if ( disabled )
return ""; return "";
const char *sub; char *sub = NULL;
int ret = pcre_get_substring ( s, matchArray, returnValue, subpattern, &sub ); size_t sublen;
if ( ret == PCRE_ERROR_NOSUBSTRING || ret == PCRE_ERROR_NOMEMORY ) int ret = pcre2_substring_get_bynumber (
patternMatchData,
subpattern,
(PCRE2_UCHAR **)sub,
&sublen
);
if ( ret == PCRE2_ERROR_NOMATCH || ret == PCRE2_ERROR_BADDATA )
return ""; return "";
string subString ( sub ); string subString ( sub );
pcre_free_substring ( sub ); pcre2_substring_free ( (PCRE2_UCHAR *)sub );
return subString; return subString;
} }

View File

@ -21,10 +21,14 @@
#ifndef WRAPREGEX_H #ifndef WRAPREGEX_H
#define WRAPREGEX_H #define WRAPREGEX_H
#ifndef PCRE2_CODE_UNIT_WIDTH
#define PCRE2_CODE_UNIT_WIDTH 8
#endif
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <pcre.h> #include <pcre2.h>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include "contexthandler.h" #include "contexthandler.h"
@ -36,8 +40,7 @@ class WrapRegex : private boost::noncopyable
WrapRegex ( WrapRegex (
const string& pattern, const string& pattern,
bool matchCase, bool matchCase,
const string& replaceParameter = "", const string& replaceParameter = "" );
const int arrayLengthParameter = 60 );
virtual ~WrapRegex(); virtual ~WrapRegex();
string replaceGlobal ( string replaceGlobal (
const string& buffer, const string& buffer,
@ -49,13 +52,12 @@ class WrapRegex : private boost::noncopyable
int context = 0 ); int context = 0 );
private: private:
string replace; string replace;
const int arrayLength;
int returnValue; int returnValue;
bool disabled; bool disabled;
pcre *patternStructure; pcre2_code *patternCode;
pcre_extra *patternExtraStructure; pcre2_match_data *patternMatchData;
int *matchArray; pcre2_match_context *patternMatchContext;
string getInterpolatedString_ ( const char *buffer, string getInterpolatedString_ ( const char *buffer,
const char *source ); const char *source );

View File

@ -129,7 +129,7 @@ Source: "{#MinGW}\bin\libidn2-0.dll"; DestDir: "{app}"
Source: "{#MinGW}\bin\libintl-8.dll"; DestDir: "{app}" Source: "{#MinGW}\bin\libintl-8.dll"; DestDir: "{app}"
Source: "{#MinGW}\bin\liblzma-5.dll"; DestDir: "{app}" Source: "{#MinGW}\bin\liblzma-5.dll"; DestDir: "{app}"
Source: "{#MinGW}\bin\libnghttp2-14.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\libpsl-5.dll"; DestDir: "{app}"
Source: "{#MinGW}\bin\libssh2-1.dll"; DestDir: "{app}" Source: "{#MinGW}\bin\libssh2-1.dll"; DestDir: "{app}"
Source: "{#MinGW}\bin\libssl-1_1{#DllNameSuffix}.dll"; DestDir: "{app}" Source: "{#MinGW}\bin\libssl-1_1{#DllNameSuffix}.dll"; DestDir: "{app}"