summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am603
-rw-r--r--configure.ac43
-rw-r--r--m4/pcre2_visibility.m4 (renamed from m4/pcre_visibility.m4)11
-rw-r--r--pcre2.h.in0
-rw-r--r--src/config.h316
-rw-r--r--src/config.h.generic322
-rw-r--r--src/config.h.in315
-rw-r--r--src/pcre2.h594
-rw-r--r--src/pcre2.h.generic594
-rw-r--r--src/pcre2.h.in594
l---------src/pcre2_chartables.c1
-rw-r--r--src/pcre2_chartables.c.dist198
-rw-r--r--src/pcre2_internal.h14
-rw-r--r--src/pcre2_version.c103
14 files changed, 3344 insertions, 364 deletions
diff --git a/Makefile.am b/Makefile.am
index a0a4802..254d013 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,75 +1,76 @@
## Process this file with automake to produce Makefile.in.
+AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4
-dist_doc_DATA = \
- doc/pcre.txt \
- doc/pcre-config.txt \
- doc/pcregrep.txt \
- doc/pcretest.txt \
- AUTHORS \
- COPYING \
- ChangeLog \
- LICENCE \
- NEWS \
- README
-
# FIXME
+#dist_doc_DATA = \
+# doc/pcre.txt \
+# doc/pcre-config.txt \
+# doc/pcregrep.txt \
+# doc/pcretest.txt \
+# AUTHORS \
+# COPYING \
+# ChangeLog \
+# LICENCE \
+# NEWS \
+# README
-dist_html_DATA = \
- doc/html/NON-AUTOTOOLS-BUILD.txt \
- doc/html/README.txt \
- doc/html/index.html \
- doc/html/pcre-config.html \
- doc/html/pcre.html \
- doc/html/pcre16.html \
- doc/html/pcre32.html \
- doc/html/pcre_assign_jit_stack.html \
- doc/html/pcre_compile.html \
- doc/html/pcre_compile2.html \
- doc/html/pcre_config.html \
- doc/html/pcre_copy_named_substring.html \
- doc/html/pcre_copy_substring.html \
- doc/html/pcre_dfa_exec.html \
- doc/html/pcre_exec.html \
- doc/html/pcre_free_study.html \
- doc/html/pcre_free_substring.html \
- doc/html/pcre_free_substring_list.html \
- doc/html/pcre_fullinfo.html \
- doc/html/pcre_get_named_substring.html \
- doc/html/pcre_get_stringnumber.html \
- doc/html/pcre_get_stringtable_entries.html \
- doc/html/pcre_get_substring.html \
- doc/html/pcre_get_substring_list.html \
- doc/html/pcre_jit_exec.html \
- doc/html/pcre_jit_stack_alloc.html \
- doc/html/pcre_jit_stack_free.html \
- doc/html/pcre_maketables.html \
- doc/html/pcre_pattern_to_host_byte_order.html \
- doc/html/pcre_refcount.html \
- doc/html/pcre_study.html \
- doc/html/pcre_utf16_to_host_byte_order.html \
- doc/html/pcre_utf32_to_host_byte_order.html \
- doc/html/pcre_version.html \
- doc/html/pcreapi.html \
- doc/html/pcrebuild.html \
- doc/html/pcrecallout.html \
- doc/html/pcrecompat.html \
- doc/html/pcredemo.html \
- doc/html/pcregrep.html \
- doc/html/pcrejit.html \
- doc/html/pcrelimits.html \
- doc/html/pcrematching.html \
- doc/html/pcrepartial.html \
- doc/html/pcrepattern.html \
- doc/html/pcreperform.html \
- doc/html/pcreposix.html \
- doc/html/pcreprecompile.html \
- doc/html/pcresample.html \
- doc/html/pcrestack.html \
- doc/html/pcresyntax.html \
- doc/html/pcretest.html \
- doc/html/pcreunicode.html
+# FIXME
+#dist_html_DATA = \
+# doc/html/NON-AUTOTOOLS-BUILD.txt \
+# doc/html/README.txt \
+# doc/html/index.html \
+# doc/html/pcre-config.html \
+# doc/html/pcre.html \
+# doc/html/pcre16.html \
+# doc/html/pcre32.html \
+# doc/html/pcre_assign_jit_stack.html \
+# doc/html/pcre_compile.html \
+# doc/html/pcre_compile2.html \
+# doc/html/pcre_config.html \
+# doc/html/pcre_copy_named_substring.html \
+# doc/html/pcre_copy_substring.html \
+# doc/html/pcre_dfa_exec.html \
+# doc/html/pcre_exec.html \
+# doc/html/pcre_free_study.html \
+# doc/html/pcre_free_substring.html \
+# doc/html/pcre_free_substring_list.html \
+# doc/html/pcre_fullinfo.html \
+# doc/html/pcre_get_named_substring.html \
+# doc/html/pcre_get_stringnumber.html \
+# doc/html/pcre_get_stringtable_entries.html \
+# doc/html/pcre_get_substring.html \
+# doc/html/pcre_get_substring_list.html \
+# doc/html/pcre_jit_exec.html \
+# doc/html/pcre_jit_stack_alloc.html \
+# doc/html/pcre_jit_stack_free.html \
+# doc/html/pcre_maketables.html \
+# doc/html/pcre_pattern_to_host_byte_order.html \
+# doc/html/pcre_refcount.html \
+# doc/html/pcre_study.html \
+# doc/html/pcre_utf16_to_host_byte_order.html \
+# doc/html/pcre_utf32_to_host_byte_order.html \
+# doc/html/pcre_version.html \
+# doc/html/pcreapi.html \
+# doc/html/pcrebuild.html \
+# doc/html/pcrecallout.html \
+# doc/html/pcrecompat.html \
+# doc/html/pcredemo.html \
+# doc/html/pcregrep.html \
+# doc/html/pcrejit.html \
+# doc/html/pcrelimits.html \
+# doc/html/pcrematching.html \
+# doc/html/pcrepartial.html \
+# doc/html/pcrepattern.html \
+# doc/html/pcreperform.html \
+# doc/html/pcreposix.html \
+# doc/html/pcreprecompile.html \
+# doc/html/pcresample.html \
+# doc/html/pcrestack.html \
+# doc/html/pcresyntax.html \
+# doc/html/pcretest.html \
+# doc/html/pcreunicode.html
# The Libtool libraries to install. We'll add to this later.
@@ -126,15 +127,15 @@ EXTRA_DIST += \
# Autotools support.
EXTRA_DIST += \
- pcre2.h.generic \
- config.h.generic
+ src/pcre2.h.generic \
+ src/config.h.generic
# The only difference between pcre2.h.in and pcre2.h is the setting of the PCRE
# version number. Therefore, we can create the generic version just by copying.
-pcre2.h.generic: pcre2.h.in configure.ac
+src/pcre2.h.generic: src/pcre2.h.in configure.ac
rm -f $@
- cp -p pcre2.h $@
+ cp -p src/pcre2.h $@
# It is more complicated for config.h.generic. We need the version that results
# from a default configuration so as to get all the default values for PCRE
@@ -148,13 +149,13 @@ pcre2.h.generic: pcre2.h.in configure.ac
# SUPPORT_xxx. We also get rid of any gcc-specific visibility settings. Make
# sure that PCRE_EXP_DEFN is unset (in case it has visibility settings).
-config.h.generic: configure.ac
+src/config.h.generic: configure.ac
rm -rf $@ _generic
mkdir _generic
cs=$(srcdir)/config.status; test ! -f $$cs || mv -f $$cs $$cs.aside
cd _generic && $(abs_top_srcdir)/configure || :
cs=$(srcdir)/config.status; test ! -f $$cs.aside || mv -f $$cs.aside $$cs
- test -f _generic/config.h
+ test -f _generic/src/config.h
perl -n \
-e 'BEGIN{$$blank=0;}' \
-e 'if(/PCRE2_EXP_DEFN/){print"/* #undef PCRE2_EXP_DEFN */\n";$$blank=0;next;}' \
@@ -164,20 +165,21 @@ config.h.generic: configure.ac
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
- _generic/config.h >$@
+ _generic/src/config.h >$@
rm -rf _generic
-MAINTAINERCLEANFILES += pcre2.h.generic config.h.generic
+MAINTAINERCLEANFILES += src/pcre2.h.generic src/config.h.generic
# These are the header files we'll install. We do not distribute pcre2.h
# because it is generated from pcre2.h.in.
nodist_include_HEADERS = \
- pcre2.h
-include_HEADERS = \
- pcre2posix.h
-
-# This is the "config" script.
+ src/pcre2.h
+#FIXME
+#include_HEADERS = \
+# src/pcre2posix.h
+
+# This is the "config" script.
bin_SCRIPTS = pcre2-config
@@ -191,141 +193,89 @@ bin_SCRIPTS = pcre2-config
if WITH_REBUILD_CHARTABLES
noinst_PROGRAMS += dftables
dftables_SOURCES = dftables.c
-pcre2_chartables.c: dftables$(EXEEXT)
+src/pcre2_chartables.c: dftables$(EXEEXT)
./dftables$(EXEEXT) $@
else
-pcre2_chartables.c: $(srcdir)/pcre2_chartables.c.dist
+src/pcre2_chartables.c: $(srcdir)/src/pcre2_chartables.c.dist
rm -f $@
$(LN_S) $(srcdir)/pcre2_chartables.c.dist $@
endif # WITH_REBUILD_CHARTABLES
-BUILT_SOURCES = pcre2_chartables.c
+BUILT_SOURCES = src/pcre2_chartables.c
+NODIST_SOURCES = src/pcre2_chartables.c
+
+## Define the list of common sources, then build whichever of the 8-, 16-, or
+## 32-bit libraries are configured.
+
+COMMON_SOURCES = \
+ src/pcre2_internal.h \
+ src/pcre2_version.c
+
+# pcre2_byte_order.c \
+# pcre2_compile.c \
+# pcre2_config.c \
+# pcre2_dfa_exec.c \
+# pcre2_exec.c \
+# pcre2_fullinfo.c \
+# pcre2_get.c \
+# pcre2_globals.c \
+# pcre2_jit_compile.c \
+# pcre2_maketables.c \
+# pcre2_newline.c \
+# pcre2_ord2utf8.c \
+# pcre2_refcount.c \
+# pcre2_string_utils.c \
+# pcre2_study.c \
+# pcre2_tables.c \
+# pcre2_ucd.c \
+# pcre2_valid_utf8.c \
+# pcre2_xclass.c \
+# ucp.h
-# Build the 8 bit library if it is enabled.
if WITH_PCRE8
lib_LTLIBRARIES += libpcre2-8.la
-
libpcre2_8_la_SOURCES = \
- pcre2_byte_order.c \
- pcre2_compile.c \
- pcre2_config.c \
- pcre2_dfa_exec.c \
- pcre2_exec.c \
- pcre2_fullinfo.c \
- pcre2_get.c \
- pcre2_globals.c \
- pcre2_internal.h \
- pcre2_jit_compile.c \
- pcre2_maketables.c \
- pcre2_newline.c \
- pcre2_ord2utf8.c \
- pcre2_refcount.c \
- pcre2_string_utils.c \
- pcre2_study.c \
- pcre2_tables.c \
- pcre2_ucd.c \
- pcre2_valid_utf8.c \
- pcre2_version.c \
- pcre2_xclass.c \
- ucp.h
-
+ $(COMMON_SOURCES)
+nodist_libpcre2_8_la_SOURCES = \
+ $(NODIST_SOURCES)
libpcre2_8_la_CFLAGS = \
+ -DPCRE2_DATA_WIDTH=8 \
$(VISIBILITY_CFLAGS) \
$(AM_CFLAGS)
-
libpcre2_8_la_LIBADD =
-
-## This file is generated as part of the building process, so don't distribute.
-
-nodist_libpcre2_8_la_SOURCES = \
- pcre2_chartables.c
-
endif # WITH_PCRE8
-# FIXME
-# Build the 16 bit library if it is enabled.
-#if WITH_PCRE16
-#lib_LTLIBRARIES += libpcre2-16.la
-#libpcre2_16_la_SOURCES = \
-# pcre16_byte_order.c \
-# pcre16_chartables.c \
-# pcre16_compile.c \
-# pcre16_config.c \
-# pcre16_dfa_exec.c \
-# pcre16_exec.c \
-# pcre16_fullinfo.c \
-# pcre16_get.c \
-# pcre16_globals.c \
-# pcre16_jit_compile.c \
-# pcre16_maketables.c \
-# pcre16_newline.c \
-# pcre16_ord2utf16.c \
-# pcre16_refcount.c \
-# pcre16_string_utils.c \
-# pcre16_study.c \
-# pcre16_tables.c \
-# pcre16_ucd.c \
-# pcre16_utf16_utils.c \
-# pcre16_valid_utf16.c \
-# pcre16_version.c \
-# pcre16_xclass.c
-#
-#libpcre2_16_la_CFLAGS = \
-# $(VISIBILITY_CFLAGS) \
-# $(AM_CFLAGS)
-#
-#libpcre2_16_la_LIBADD =
-#
-### This file is generated as part of the building process, so don't distribute.
-#nodist_libpcre2_16_la_SOURCES = \
-# pcre_chartables.c
-#
-#endif # WITH_PCRE16
-#
-## Build the 32 bit library if it is enabled.
-#if WITH_PCRE32
-#lib_LTLIBRARIES += libpcre2-32.la
-#libpcre2_32_la_SOURCES = \
-# pcre32_byte_order.c \
-# pcre32_chartables.c \
-# pcre32_compile.c \
-# pcre32_config.c \
-# pcre32_dfa_exec.c \
-# pcre32_exec.c \
-# pcre32_fullinfo.c \
-# pcre32_get.c \
-# pcre32_globals.c \
-# pcre32_jit_compile.c \
-# pcre32_maketables.c \
-# pcre32_newline.c \
-# pcre32_ord2utf32.c \
-# pcre32_refcount.c \
-# pcre32_string_utils.c \
-# pcre32_study.c \
-# pcre32_tables.c \
-# pcre32_ucd.c \
-# pcre32_utf32_utils.c \
-# pcre32_valid_utf32.c \
-# pcre32_version.c \
-# pcre32_xclass.c
-#
-#libpcre2_32_la_CFLAGS = \
-# $(VISIBILITY_CFLAGS) \
-# $(AM_CFLAGS)
-#
-#libpcre2_32_la_LIBADD =
-#
-### This file is generated as part of the building process, so don't distribute.
-#nodist_libpcre2_32_la_SOURCES = \
-# pcre_chartables.c
-#
-#endif # WITH_PCRE32
+if WITH_PCRE16
+lib_LTLIBRARIES += libpcre2-16.la
+libpcre2_16_la_SOURCES = \
+ $(COMMON_SOURCES)
+nodist_libpcre2_16_la_SOURCES = \
+ $(NODIST_SOURCES)
+libpcre2_16_la_CFLAGS = \
+ -DPCRE2_DATA_WIDTH=16 \
+ $(VISIBILITY_CFLAGS) \
+ $(AM_CFLAGS)
+libpcre2_16_la_LIBADD =
+endif # WITH_PCRE16
-# The pcre2_chartables.c.dist file is the default version of pcre2_chartables.c,
-# used unless --enable-rebuild-chartables is specified.
+if WITH_PCRE32
+lib_LTLIBRARIES += libpcre2-32.la
+libpcre2_32_la_SOURCES = \
+ $(COMMON_SOURCES)
+nodist_libpcre2_32_la_SOURCES = \
+ $(NODIST_SOURCES)
+libpcre2_32_la_CFLAGS = \
+ -DPCRE2_DATA_WIDTH=32 \
+ $(VISIBILITY_CFLAGS) \
+ $(AM_CFLAGS)
+libpcre2_32_la_LIBADD =
+endif # WITH_PCRE32
+
+# The pcre2_chartables.c.dist file is the default version of
+# pcre2_chartables.c, used unless --enable-rebuild-chartables is specified.
-EXTRA_DIST += pcre2_chartables.c.dist
+EXTRA_DIST += src/pcre2_chartables.c.dist
# The JIT compiler lives in a separate directory, but its files are #included
# when pcre2_jit_compile.c is processed, so they must be distributed.
@@ -356,38 +306,38 @@ EXTRA_DIST += \
if WITH_PCRE8
libpcre2_8_la_LDFLAGS = $(EXTRA_LIBPCRE2_8_LDFLAGS)
endif # WITH_PCRE8
-#if WITH_PCRE16
-#libpcre2_16_la_LDFLAGS = $(EXTRA_LIBPCRE2_16_LDFLAGS)
-#endif # WITH_PCRE16
-#if WITH_PCRE32
-#libpcre2_32_la_LDFLAGS = $(EXTRA_LIBPCRE2_32_LDFLAGS)
-#endif # WITH_PCRE32
+if WITH_PCRE16
+libpcre2_16_la_LDFLAGS = $(EXTRA_LIBPCRE2_16_LDFLAGS)
+endif # WITH_PCRE16
+if WITH_PCRE32
+libpcre2_32_la_LDFLAGS = $(EXTRA_LIBPCRE2_32_LDFLAGS)
+endif # WITH_PCRE32
if WITH_VALGRIND
if WITH_PCRE8
libpcre2_8_la_CFLAGS += $(VALGRIND_CFLAGS)
endif # WITH_PCRE8
-#if WITH_PCRE16
-#libpcre2_16_la_CFLAGS += $(VALGRIND_CFLAGS)
-#endif # WITH_PCRE16
-#if WITH_PCRE32
-#libpcre2_32_la_CFLAGS += $(VALGRIND_CFLAGS)
-#endif # WITH_PCRE32
+if WITH_PCRE16
+libpcre2_16_la_CFLAGS += $(VALGRIND_CFLAGS)
+endif # WITH_PCRE16
+if WITH_PCRE32
+libpcre2_32_la_CFLAGS += $(VALGRIND_CFLAGS)
+endif # WITH_PCRE32
endif # WITH_VALGRIND
if WITH_GCOV
if WITH_PCRE8
libpcre2_8_la_CFLAGS += $(GCOV_CFLAGS)
endif # WITH_PCRE8
-#if WITH_PCRE16
-#libpcre2_16_la_CFLAGS += $(GCOV_CFLAGS)
-#endif # WITH_PCRE16
-#if WITH_PCRE32
-#libpcre2_32_la_CFLAGS += $(GCOV_CFLAGS)
-#endif # WITH_PCRE32
+if WITH_PCRE16
+libpcre2_16_la_CFLAGS += $(GCOV_CFLAGS)
+endif # WITH_PCRE16
+if WITH_PCRE32
+libpcre2_32_la_CFLAGS += $(GCOV_CFLAGS)
+endif # WITH_PCRE32
endif # WITH_GCOV
-CLEANFILES += pcre2_chartables.c
+CLEANFILES += src/pcre2_chartables.c
## If JIT support is enabled, arrange for the JIT test program to run.
@@ -412,68 +362,69 @@ pcre2_jit_test_LDADD += $(GCOV_LIBS)
endif # WITH_GCOV
endif # WITH_JIT
-## A version of the main pcre library that has a posix re API.
+## A version of the 8-bit library that has a POSIX API.
-if WITH_PCRE8
-lib_LTLIBRARIES += libpcre2posix.la
-libpcre2posix_la_SOURCES = \
- pcre2posix.c
-libpcre2posix_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS)
-libpcre2posix_la_LDFLAGS = $(EXTRA_LIBPCREPOSIX_LDFLAGS)
-libpcre2posix_la_LIBADD = libpcre2-8.la
-if WITH_GCOV
-libpcre2posix_la_CFLAGS += $(GCOV_CFLAGS)
-endif # WITH_GCOV
-endif # WITH_PCRE8
+# FIXME
+#if WITH_PCRE8
+#lib_LTLIBRARIES += libpcre2posix.la
+#libpcre2posix_la_SOURCES = pcre2posix.c
+#libpcre2posix_la_CFLAGS = $(VISIBILITY_CFLAGS) $(AM_CFLAGS)
+#libpcre2posix_la_LDFLAGS = $(EXTRA_LIBPCREPOSIX_LDFLAGS)
+#libpcre2posix_la_LIBADD = libpcre2-8.la
+#if WITH_GCOV
+#libpcre2posix_la_CFLAGS += $(GCOV_CFLAGS)
+#endif # WITH_GCOV
+#endif # WITH_PCRE8
## The main unit tests
# Each unit test is a binary plus a script that runs that binary in various
# ways. We install these test binaries in case folks find it helpful.
-TESTS += RunTest
-dist_noinst_SCRIPTS += RunTest
-EXTRA_DIST += RunTest.bat
-bin_PROGRAMS += pcretest
-pcretest_SOURCES = pcretest.c
-pcretest_CFLAGS = $(AM_CFLAGS)
-pcretest_LDADD = $(LIBREADLINE)
-if WITH_PCRE8
-pcretest_SOURCES += pcre2_printint.c
-pcretest_LDADD += libpcre2-8.la libpcre2posix.la
-endif # WITH_PCRE8
-
# FIXME
-#if WITH_PCRE16
-#pcretest_SOURCES += pcre16_printint.c
-#pcretest_LDADD += libpcre2-16.la
-#endif # WITH_PCRE16
-#if WITH_PCRE32
-#pcretest_SOURCES += pcre32_printint.c
-#pcretest_LDADD += libpcre2-32.la
-#endif # WITH_PCRE32
-
-if WITH_VALGRIND
-pcretest_CFLAGS += $(VALGRIND_CFLAGS)
-endif # WITH_VALGRIND
-if WITH_GCOV
-pcretest_CFLAGS += $(GCOV_CFLAGS)
-pcretest_LDADD += $(GCOV_LIBS)
-endif # WITH_GCOV
-
-if WITH_PCRE8
-TESTS += RunGrepTest
-dist_noinst_SCRIPTS += RunGrepTest
-bin_PROGRAMS += pcregrep
-pcregrep_SOURCES = pcregrep.c
-pcregrep_CFLAGS = $(AM_CFLAGS)
-pcregrep_LDADD = $(LIBZ) $(LIBBZ2)
-pcregrep_LDADD += libpcre2-8.la
-if WITH_GCOV
-pcregrep_CFLAGS += $(GCOV_CFLAGS)
-pcregrep_LDADD += $(GCOV_LIBS)
-endif # WITH_GCOV
-endif # WITH_PCRE8
+#TESTS += RunTest
+#dist_noinst_SCRIPTS += RunTest
+#EXTRA_DIST += RunTest.bat
+#bin_PROGRAMS += pcretest
+#pcretest_SOURCES = pcretest.c
+#pcretest_CFLAGS = $(AM_CFLAGS)
+#pcretest_LDADD = $(LIBREADLINE)
+#if WITH_PCRE8
+#pcretest_SOURCES += pcre2_printint.c
+#pcretest_LDADD += libpcre2-8.la libpcre2posix.la
+#endif # WITH_PCRE8
+#
+## FIXME
+##if WITH_PCRE16
+##pcretest_SOURCES += pcre16_printint.c
+##pcretest_LDADD += libpcre2-16.la
+##endif # WITH_PCRE16
+##if WITH_PCRE32
+##pcretest_SOURCES += pcre32_printint.c
+##pcretest_LDADD += libpcre2-32.la
+##endif # WITH_PCRE32
+#
+#if WITH_VALGRIND
+#pcretest_CFLAGS += $(VALGRIND_CFLAGS)
+#endif # WITH_VALGRIND
+#if WITH_GCOV
+#pcretest_CFLAGS += $(GCOV_CFLAGS)
+#pcretest_LDADD += $(GCOV_LIBS)
+#endif # WITH_GCOV
+#
+#if WITH_PCRE8
+#TESTS += RunGrepTest
+#dist_noinst_SCRIPTS += RunGrepTest
+#bin_PROGRAMS += pcregrep
+#pcregrep_SOURCES = pcregrep.c
+#pcregrep_CFLAGS = $(AM_CFLAGS)
+#pcregrep_LDADD = $(LIBZ) $(LIBBZ2)
+#pcregrep_LDADD += libpcre2-8.la
+#if WITH_GCOV
+#pcregrep_CFLAGS += $(GCOV_CFLAGS)
+#pcregrep_LDADD += $(GCOV_LIBS)
+#endif # WITH_GCOV
+#endif # WITH_PCRE8
EXTRA_DIST += \
testdata/grepbinary \
@@ -575,7 +526,7 @@ CLEANFILES += \
# PCRE demonstration program. No longer built automatcally. The point is that
# the users should build it themselves. So just distribute the source.
-EXTRA_DIST += pcre2demo.c
+EXTRA_DIST += src/pcre2demo.c
## Utility rules, documentation, etc.
@@ -588,65 +539,65 @@ pkgconfig_DATA =
if WITH_PCRE8
pkgconfig_DATA += libpcre2-8.pc libpcre2posix.pc
endif
-#if WITH_PCRE16
-#pkgconfig_DATA += libpcre2-16.pc
-#endif
-#if WITH_PCRE32
-#pkgconfig_DATA += libpcre2-32.pc
-#endif
+if WITH_PCRE16
+pkgconfig_DATA += libpcre2-16.pc
+endif
+if WITH_PCRE32
+pkgconfig_DATA += libpcre2-32.pc
+endif
# FIXME
-dist_man_MANS = \
- doc/pcre2-config.1 \
- doc/pcre2.3 \
- doc/pcre2-16.3 \
- doc/pcre2-32.3 \
- doc/pcre2_assign_jit_stack.3 \
- doc/pcre2_compile.3 \
- doc/pcre2_compile2.3 \
- doc/pcre2_config.3 \
- doc/pcre2_copy_named_substring.3 \
- doc/pcre2_copy_substring.3 \
- doc/pcre2_dfa_exec.3 \
- doc/pcre2_exec.3 \
- doc/pcre2_free_study.3 \
- doc/pcre2_free_substring.3 \
- doc/pcre2_free_substring_list.3 \
- doc/pcre2_fullinfo.3 \
- doc/pcre2_get_named_substring.3 \
- doc/pcre2_get_stringnumber.3 \
- doc/pcre2_get_stringtable_entries.3 \
- doc/pcre2_get_substring.3 \
- doc/pcre2_get_substring_list.3 \
- doc/pcre2_jit_exec.3 \
- doc/pcre2_jit_stack_alloc.3 \
- doc/pcre2_jit_stack_free.3 \
- doc/pcre2_maketables.3 \
- doc/pcre2_pattern_to_host_byte_order.3 \
- doc/pcre2_refcount.3 \
- doc/pcre2_study.3 \
- doc/pcre2_utf16_to_host_byte_order.3 \
- doc/pcre2_utf32_to_host_byte_order.3 \
- doc/pcre2_version.3 \
- doc/pcre2api.3 \
- doc/pcre2build.3 \
- doc/pcre2callout.3 \
- doc/pcre2compat.3 \
- doc/pcre2demo.3 \
- doc/pcre2grep.1 \
- doc/pcre2jit.3 \
- doc/pcre2limits.3 \
- doc/pcre2matching.3 \
- doc/pcre2partial.3 \
- doc/pcre2pattern.3 \
- doc/pcre2perform.3 \
- doc/pcre2posix.3 \
- doc/pcre2precompile.3 \
- doc/pcre2sample.3 \
- doc/pcre2stack.3 \
- doc/pcre2syntax.3 \
- doc/pcre2test.1 \
- doc/pcre2unicode.3
+#dist_man_MANS = \
+# doc/pcre2-config.1 \
+# doc/pcre2.3 \
+# doc/pcre2-16.3 \
+# doc/pcre2-32.3 \
+# doc/pcre2_assign_jit_stack.3 \
+# doc/pcre2_compile.3 \
+# doc/pcre2_compile2.3 \
+# doc/pcre2_config.3 \
+# doc/pcre2_copy_named_substring.3 \
+# doc/pcre2_copy_substring.3 \
+# doc/pcre2_dfa_exec.3 \
+# doc/pcre2_exec.3 \
+# doc/pcre2_free_study.3 \
+# doc/pcre2_free_substring.3 \
+# doc/pcre2_free_substring_list.3 \
+# doc/pcre2_fullinfo.3 \
+# doc/pcre2_get_named_substring.3 \
+# doc/pcre2_get_stringnumber.3 \
+# doc/pcre2_get_stringtable_entries.3 \
+# doc/pcre2_get_substring.3 \
+# doc/pcre2_get_substring_list.3 \
+# doc/pcre2_jit_exec.3 \
+# doc/pcre2_jit_stack_alloc.3 \
+# doc/pcre2_jit_stack_free.3 \
+# doc/pcre2_maketables.3 \
+# doc/pcre2_pattern_to_host_byte_order.3 \
+# doc/pcre2_refcount.3 \
+# doc/pcre2_study.3 \
+# doc/pcre2_utf16_to_host_byte_order.3 \
+# doc/pcre2_utf32_to_host_byte_order.3 \
+# doc/pcre2_version.3 \
+# doc/pcre2api.3 \
+# doc/pcre2build.3 \
+# doc/pcre2callout.3 \
+# doc/pcre2compat.3 \
+# doc/pcre2demo.3 \
+# doc/pcre2grep.1 \
+# doc/pcre2jit.3 \
+# doc/pcre2limits.3 \
+# doc/pcre2matching.3 \
+# doc/pcre2partial.3 \
+# doc/pcre2pattern.3 \
+# doc/pcre2perform.3 \
+# doc/pcre2posix.3 \
+# doc/pcre2precompile.3 \
+# doc/pcre2sample.3 \
+# doc/pcre2stack.3 \
+# doc/pcre2syntax.3 \
+# doc/pcre2test.1 \
+# doc/pcre2unicode.3
# FIXME
# Arrange for the per-function man pages to have 16- and 32-bit names as well.
diff --git a/configure.ac b/configure.ac
index f1e32a0..5b396c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,10 +24,10 @@ m4_define(libpcre2posix_version, [0:0:0])
AC_PREREQ(2.57)
AC_INIT(PCRE2, pcre2_major.pcre2_minor[]pcre2_prerelease, , pcre2)
-AC_CONFIG_SRCDIR([pcre2.h.in])
+AC_CONFIG_SRCDIR([src/pcre2.h.in])
AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_HEADERS(src/config.h)
# This is a new thing required to stop a warning from automake 1.12
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
@@ -35,21 +35,17 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# This was added at the suggestion of libtoolize (03-Jan-10)
AC_CONFIG_MACRO_DIR([m4])
-# The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
-# "-g" for any other compiler. There doesn't seem to be a standard way of
-# getting rid of the -g (which I don't think is needed for a production
-# library). This fudge seems to achieve the necessary. First, we remember the
-# externally set values of CFLAGS and CXXFLAGS. Then call the AC_PROG_CC and
-# AC_PROG_CXX macros to find the compilers - if CFLAGS and CXXFLAGS are not
-# set, they will be set to Autoconf's defaults. Afterwards, if the original
+# The default CFLAGS in Autoconf are "-g -O2" for gcc and just "-g" for any
+# other compiler. There doesn't seem to be a standard way of getting rid of the
+# -g (which I don't think is needed for a production library). This fudge seems
+# to achieve the necessary. First, we remember the externally set values of
+# CFLAGS. Then call the AC_PROG_CC macro to find the compiler - if CFLAGS is
+# not set, it will be set to Autoconf's defaults. Afterwards, if the original
# values were not set, remove the -g from the Autoconf defaults.
-# (PH 02-May-07)
remember_set_CFLAGS="$CFLAGS"
-remember_set_CXXFLAGS="$CXXFLAGS"
AC_PROG_CC
-AC_PROG_CXX
AM_PROG_CC_C_O
if test "x$remember_set_CFLAGS" = "x"
@@ -63,23 +59,6 @@ then
fi
fi
-if test "x$remember_set_CXXFLAGS" = "x"
-then
- if test "$CXXFLAGS" = "-g -O2"
- then
- CXXFLAGS="-O2"
- elif test "$CXXFLAGS" = "-g"
- then
- CXXFLAGS=""
- fi
-fi
-
-# AC_PROG_CXX will return "g++" even if no c++ compiler is installed.
-# Check for that case, and just disable c++ code if g++ doesn't run.
-AC_LANG_PUSH(C++)
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],, CXX=""; CXXCP=""; CXXFLAGS="")
-AC_LANG_POP
-
# Check for a 64-bit integer type
AC_TYPE_INT64_T
@@ -90,7 +69,7 @@ AC_PROG_LN_S
# Check for GCC visibility feature
-PCRE_VISIBILITY
+PCRE2_VISIBILITY
# Versioning
@@ -103,7 +82,7 @@ if test "$PCRE2_MINOR" = "08" -o "$PCRE2_MINOR" = "09"
then
echo "***"
echo "*** Minor version number $PCRE2_MINOR must not be used. ***"
- echo "*** Use only 01 to 07 or 10 onwards, to avoid octal issues. ***"
+ echo "*** Use only 00 to 07 or 10 onwards, to avoid octal issues. ***"
echo "***"
exit 1
fi
@@ -875,7 +854,7 @@ AC_CONFIG_FILES(
libpcre2-32.pc
libpcre2posix.pc
pcre2-config
- pcre2.h
+ src/pcre2.h
)
# Make the generated script files executable.
diff --git a/m4/pcre_visibility.m4 b/m4/pcre2_visibility.m4
index 30aff87..de82ca8 100644
--- a/m4/pcre_visibility.m4
+++ b/m4/pcre2_visibility.m4
@@ -21,8 +21,9 @@ dnl Set the variable CFLAG_VISIBILITY.
dnl Defines and sets the variable HAVE_VISIBILITY.
dnl Modified to fit with PCRE build environment by Cristian Rodríguez.
+dnl Adjusted for PCRE2 by PH
-AC_DEFUN([PCRE_VISIBILITY],
+AC_DEFUN([PCRE2_VISIBILITY],
[
AC_REQUIRE([AC_PROG_CC])
VISIBILITY_CFLAGS=
@@ -72,13 +73,11 @@ AC_DEFUN([PCRE_VISIBILITY],
VISIBILITY_CFLAGS="-fvisibility=hidden"
VISIBILITY_CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden"
HAVE_VISIBILITY=1
- AC_DEFINE(PCRE_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
- AC_DEFINE(PCRE_EXP_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
- AC_DEFINE(PCRE_EXP_DATA_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRE2_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRE2_EXP_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
+ AC_DEFINE(PCRE2_EXP_DATA_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
AC_DEFINE(PCREPOSIX_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
AC_DEFINE(PCREPOSIX_EXP_DEFN, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
- AC_DEFINE(PCRECPP_EXP_DECL, [extern __attribute__ ((visibility ("default")))], [to make a symbol visible])
- AC_DEFINE(PCRECPP_EXP_DEFN, [__attribute__ ((visibility ("default")))], [to make a symbol visible])
fi
fi
AC_SUBST([VISIBILITY_CFLAGS])
diff --git a/pcre2.h.in b/pcre2.h.in
deleted file mode 100644
index e69de29..0000000
--- a/pcre2.h.in
+++ /dev/null
diff --git a/src/config.h b/src/config.h
new file mode 100644
index 0000000..e5915da
--- /dev/null
+++ b/src/config.h
@@ -0,0 +1,316 @@
+/* src/config.h. Generated from config.h.in by configure. */
+/* src/config.h.in. Generated from configure.ac by autoheader. */
+
+
+/* PCRE is written in Standard C, but there are a few non-standard things it
+can cope with, allowing it to run on SunOS4 and other "close to standard"
+systems.
+
+In environments that support the GNU autotools, config.h.in is converted into
+config.h by the "configure" script. In environments that use CMake,
+config-cmake.in is converted into config.h. If you are going to build PCRE "by
+hand" without using "configure" or CMake, you should copy the distributed
+config.h.generic to config.h, and edit the macro definitions to be the way you
+need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
+so that config.h is included at the start of every source.
+
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
+but if you do, default values will be taken from config.h for non-boolean
+macros that are not defined on the command line.
+
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
+(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
+macros are listed as a commented #undef in config.h.generic. Macros such as
+MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
+
+PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
+HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
+sure both macros are undefined; an emulation function will then be used. */
+
+/* By default, the \R escape sequence matches any Unicode line ending
+ character or sequence of characters. If BSR_ANYCRLF is defined (to any
+ value), this is changed so that backslash-R matches only CR, LF, or CRLF.
+ The build-time default can be overridden by the user of PCRE at runtime. */
+/* #undef BSR_ANYCRLF */
+
+/* If you are compiling for a system that uses EBCDIC instead of ASCII
+ character codes, define this macro to any value. You must also edit the
+ NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
+ On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
+ automatically adjusted. When EBCDIC is set, PCRE assumes that all input
+ strings are in EBCDIC. If you do not define this macro, PCRE will assume
+ input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
+ a version of PCRE that supports both EBCDIC and UTF-8/16/32. */
+/* #undef EBCDIC */
+
+/* In an EBCDIC environment, define this macro to any value to arrange for the
+ NL character to be 0x25 instead of the default 0x15. NL plays the role that
+ LF does in an ASCII/Unicode environment. The value must also be set in the
+ NEWLINE macro below. On systems that can use "configure" or CMake to set
+ EBCDIC_NL25, the adjustment of NEWLINE is automatic. */
+/* #undef EBCDIC_NL25 */
+
+/* Define to 1 if you have the `bcopy' function. */
+#define HAVE_BCOPY 1
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+#define HAVE_BZLIB_H 1
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <editline/readline.h> header file. */
+/* #undef HAVE_EDITLINE_READLINE_H */
+
+/* Define to 1 if you have the <edit/readline/readline.h> header file. */
+/* #undef HAVE_EDIT_READLINE_READLINE_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if you have POSIX threads libraries and header files. */
+/* #undef HAVE_PTHREAD */
+
+/* Have PTHREAD_PRIO_INHERIT. */
+/* #undef HAVE_PTHREAD_PRIO_INHERIT */
+
+/* Define to 1 if you have the <readline/history.h> header file. */
+#define HAVE_READLINE_HISTORY_H 1
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#define HAVE_READLINE_READLINE_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if the compiler supports simple visibility declarations. */
+#define HAVE_VISIBILITY 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#define HAVE_ZLIB_H 1
+
+/* The value of LINK_SIZE determines the number of bytes used to store links
+ as offsets within the compiled regex. The default is 2, which allows for
+ compiled patterns up to 64K long. This covers the vast majority of cases.
+ However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
+ for longer patterns in extreme cases. */
+#define LINK_SIZE 2
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* The value of MATCH_LIMIT determines the default number of times the
+ internal match() function can be called during a single execution of
+ pcre_exec(). There is a runtime interface for setting a different limit.
+ The limit exists in order to catch runaway regular expressions that take
+ for ever to determine that they do not match. The default is set very large
+ so that it does not accidentally catch legitimate cases. */
+#define MATCH_LIMIT 10000000
+
+/* The above limit applies to all calls of match(), whether or not they
+ increase the recursion depth. In some environments it is desirable to limit
+ the depth of recursive calls of match() more strictly, in order to restrict
+ the maximum amount of stack (or heap, if NO_RECURSE is defined) that is
+ used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of
+ match(). To have any useful effect, it must be less than the value of
+ MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is
+ a runtime method for setting a different limit. */
+#define MATCH_LIMIT_RECURSION MATCH_LIMIT
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+ Care must be taken if it is increased, because it guards against integer
+ overflow caused by enormously large patterns. */
+#define MAX_NAME_COUNT 10000
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+ Care must be taken if it is increased, because it guards against integer
+ overflow caused by enormously large patterns. */
+#define MAX_NAME_SIZE 32
+
+/* The value of NEWLINE determines the default newline character sequence.
+ PCRE client programs can override this by selecting other values at run
+ time. In ASCII environments, the value can be 10 (LF), 13 (CR), or 3338
+ (CRLF); in EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or
+ 3349 or 3365 (CRLF) because there are two alternative codepoints (0x15 and
+ 0x25) that are used as the NL line terminator that is equivalent to ASCII
+ LF. In both ASCII and EBCDIC environments the value can also be -1 (ANY),
+ or -2 (ANYCRLF). */
+#define NEWLINE 10
+
+/* PCRE uses recursive function calls to handle backtracking while matching.
+ This can sometimes be a problem on systems that have stacks of limited
+ size. Define NO_RECURSE to any value to get a version that doesn't use
+ recursion in the match() function; instead it creates its own stack by
+ steam using pcre_recurse_malloc() to obtain memory from the heap. For more
+ detail, see the comments and other stuff just above the match() function.
+ */
+/* #undef NO_RECURSE */
+
+/* Name of package */
+#define PACKAGE "pcre2"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "PCRE2"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "PCRE2 9.00-DEV"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "pcre2"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "9.00-DEV"
+
+/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
+ parentheses (of any kind) in a pattern. This limits the amount of system
+ stack that is used while compiling a pattern. */
+#define PARENS_NEST_LIMIT 250
+
+/* to make a symbol visible */
+#define PCRE2_EXP_DATA_DEFN __attribute__ ((visibility ("default")))
+
+/* to make a symbol visible */
+#define PCRE2_EXP_DECL extern __attribute__ ((visibility ("default")))
+
+/* to make a symbol visible */
+#define PCRE2_EXP_DEFN __attribute__ ((visibility ("default")))
+
+/* The value of PCREGREP_BUFSIZE determines the size of buffer used by
+ pcregrep to hold parts of the file it is searching. This is also the
+ minimum value. The actual amount of memory used by pcregrep is three times
+ this number, because it allows for the buffering of "before" and "after"
+ lines. */
+#define PCREGREP_BUFSIZE 20480
+
+/* to make a symbol visible */
+#define PCREPOSIX_EXP_DECL extern __attribute__ ((visibility ("default")))
+
+/* to make a symbol visible */
+#define PCREPOSIX_EXP_DEFN extern __attribute__ ((visibility ("default")))
+
+
+/* If you are compiling for a system other than a Unix-like system or
+ Win32, and it needs some magic to be inserted before the definition
+ of a function that is exported by the library, define this macro to
+ contain the relevant magic. If you do not define this macro, a suitable
+ __declspec value is used for Windows systems; in other environments
+ "extern" is used for a C compiler and "extern C" for a C++ compiler.
+ This macro apears at the start of every exported function that is part
+ of the external API. It does not appear on functions that are "external"
+ in the C sense, but which are internal to the library. */
+/* #undef PCRE_EXP_DEFN */
+
+/* Define to any value if linking statically (TODO: make nice with Libtool) */
+#define PCRE_STATIC 1
+
+/* When calling PCRE via the POSIX interface, additional working storage is
+ required for holding the pointers to capturing substrings because PCRE
+ requires three integers per substring, whereas the POSIX interface provides
+ only two. If the number of expected substrings is small, the wrapper
+ function uses space on the stack, because this is faster than using
+ malloc() for each call. The threshold above which the stack is no longer
+ used is defined by POSIX_MALLOC_THRESHOLD. */
+#define POSIX_MALLOC_THRESHOLD 10
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to any value to enable support for Just-In-Time compiling. */
+/* #undef SUPPORT_JIT */
+
+/* Define to any value to allow pcregrep to be linked with libbz2, so that it
+ is able to handle .bz2 files. */
+#define SUPPORT_LIBBZ2 /**/
+
+/* Define to any value to allow pcretest to be linked with libedit. */
+/* #undef SUPPORT_LIBEDIT */
+
+/* Define to any value to allow pcretest to be linked with libreadline. */
+#define SUPPORT_LIBREADLINE /**/
+
+/* Define to any value to allow pcregrep to be linked with libz, so that it is
+ able to handle .gz files. */
+#define SUPPORT_LIBZ /**/
+
+/* Define to any value to enable the 16 bit PCRE library. */
+#define SUPPORT_PCRE16 /**/
+
+/* Define to any value to enable the 32 bit PCRE library. */
+#define SUPPORT_PCRE32 /**/
+
+/* Define to any value to enable the 8 bit PCRE library. */
+#define SUPPORT_PCRE8 /**/
+
+/* Define to any value to enable JIT support in pcregrep. */
+/* #undef SUPPORT_PCREGREP_JIT */
+
+/* Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
+ This will work even in an EBCDIC environment, but it is incompatible with
+ the EBCDIC macro. That is, PCRE can support *either* EBCDIC code *or*
+ ASCII/UTF-8/16/32, but not both at once. */
+#define SUPPORT_UTF /**/
+
+/* Define to any value for valgrind support to find invalid memory reads. */
+#define SUPPORT_VALGRIND /**/
+
+/* Version number of package */
+#define VERSION "9.00-DEV"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef int64_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/config.h.generic b/src/config.h.generic
new file mode 100644
index 0000000..58bbe20
--- /dev/null
+++ b/src/config.h.generic
@@ -0,0 +1,322 @@
+/* src/config.h. Generated from config.h.in by configure. */
+/* src/config.h.in. Generated from configure.ac by autoheader. */
+
+/* PCRE is written in Standard C, but there are a few non-standard things it
+can cope with, allowing it to run on SunOS4 and other "close to standard"
+systems.
+
+In environments that support the GNU autotools, config.h.in is converted into
+config.h by the "configure" script. In environments that use CMake,
+config-cmake.in is converted into config.h. If you are going to build PCRE "by
+hand" without using "configure" or CMake, you should copy the distributed
+config.h.generic to config.h, and edit the macro definitions to be the way you
+need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
+so that config.h is included at the start of every source.
+
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
+but if you do, default values will be taken from config.h for non-boolean
+macros that are not defined on the command line.
+
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
+(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
+macros are listed as a commented #undef in config.h.generic. Macros such as
+MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
+
+PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
+HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
+sure both macros are undefined; an emulation function will then be used. */
+
+/* By default, the \R escape sequence matches any Unicode line ending
+ character or sequence of characters. If BSR_ANYCRLF is defined (to any
+ value), this is changed so that backslash-R matches only CR, LF, or CRLF.
+ The build-time default can be overridden by the user of PCRE at runtime. */
+/* #undef BSR_ANYCRLF */
+
+/* If you are compiling for a system that uses EBCDIC instead of ASCII
+ character codes, define this macro to any value. You must also edit the
+ NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
+ On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
+ automatically adjusted. When EBCDIC is set, PCRE assumes that all input
+ strings are in EBCDIC. If you do not define this macro, PCRE will assume
+ input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
+ a version of PCRE that supports both EBCDIC and UTF-8/16/32. */
+/* #undef EBCDIC */
+
+/* In an EBCDIC environment, define this macro to any value to arrange for the
+ NL character to be 0x25 instead of the default 0x15. NL plays the role that
+ LF does in an ASCII/Unicode environment. The value must also be set in the
+ NEWLINE macro below. On systems that can use "configure" or CMake to set
+ EBCDIC_NL25, the adjustment of NEWLINE is automatic. */
+/* #undef EBCDIC_NL25 */
+
+/* Define to 1 if you have the `bcopy' function. */
+/* #undef HAVE_BCOPY */
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+/* #undef HAVE_BZLIB_H */
+
+/* Define to 1 if you have the <dirent.h> header file. */
+/* #undef HAVE_DIRENT_H */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the <editline/readline.h> header file. */
+/* #undef HAVE_EDITLINE_READLINE_H */
+
+/* Define to 1 if you have the <edit/readline/readline.h> header file. */
+/* #undef HAVE_EDIT_READLINE_READLINE_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define to 1 if you have the <limits.h> header file. */
+/* #undef HAVE_LIMITS_H */
+
+/* Define to 1 if you have the `memmove' function. */
+/* #undef HAVE_MEMMOVE */
+
+/* Define to 1 if you have the <memory.h> header file. */
+/* #undef HAVE_MEMORY_H */
+
+/* Define if you have POSIX threads libraries and header files. */
+/* #undef HAVE_PTHREAD */
+
+/* Have PTHREAD_PRIO_INHERIT. */
+/* #undef HAVE_PTHREAD_PRIO_INHERIT */
+
+/* Define to 1 if you have the <readline/history.h> header file. */
+/* #undef HAVE_READLINE_HISTORY_H */
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+/* #undef HAVE_READLINE_READLINE_H */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+/* #undef HAVE_STDLIB_H */
+
+/* Define to 1 if you have the `strerror' function. */
+/* #undef HAVE_STRERROR */
+
+/* Define to 1 if you have the <strings.h> header file. */
+/* #undef HAVE_STRINGS_H */
+
+/* Define to 1 if you have the <string.h> header file. */
+/* #undef HAVE_STRING_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+/* #undef HAVE_SYS_STAT_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+/* #undef HAVE_SYS_TYPES_H */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define to 1 if the compiler supports simple visibility declarations. */
+/* #undef HAVE_VISIBILITY */
+
+/* Define to 1 if you have the <windows.h> header file. */
+/* #undef HAVE_WINDOWS_H */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+/* #undef HAVE_ZLIB_H */
+
+/* The value of LINK_SIZE determines the number of bytes used to store links
+ as offsets within the compiled regex. The default is 2, which allows for
+ compiled patterns up to 64K long. This covers the vast majority of cases.
+ However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
+ for longer patterns in extreme cases. */
+#ifndef LINK_SIZE
+#define LINK_SIZE 2
+#endif
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+/* This is ignored unless you are using libtool. */
+#ifndef LT_OBJDIR
+#define LT_OBJDIR ".libs/"
+#endif
+
+/* The value of MATCH_LIMIT determines the default number of times the
+ internal match() function can be called during a single execution of
+ pcre_exec(). There is a runtime interface for setting a different limit.
+ The limit exists in order to catch runaway regular expressions that take
+ for ever to determine that they do not match. The default is set very large
+ so that it does not accidentally catch legitimate cases. */
+#ifndef MATCH_LIMIT
+#define MATCH_LIMIT 10000000
+#endif
+
+/* The above limit applies to all calls of match(), whether or not they
+ increase the recursion depth. In some environments it is desirable to limit
+ the depth of recursive calls of match() more strictly, in order to restrict
+ the maximum amount of stack (or heap, if NO_RECURSE is defined) that is
+ used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of
+ match(). To have any useful effect, it must be less than the value of
+ MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is
+ a runtime method for setting a different limit. */
+#ifndef MATCH_LIMIT_RECURSION
+#define MATCH_LIMIT_RECURSION MATCH_LIMIT
+#endif
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+ Care must be taken if it is increased, because it guards against integer
+ overflow caused by enormously large patterns. */
+#ifndef MAX_NAME_COUNT
+#define MAX_NAME_COUNT 10000
+#endif
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+ Care must be taken if it is increased, because it guards against integer
+ overflow caused by enormously large patterns. */
+#ifndef MAX_NAME_SIZE
+#define MAX_NAME_SIZE 32
+#endif
+
+/* The value of NEWLINE determines the default newline character sequence.
+ PCRE client programs can override this by selecting other values at run
+ time. In ASCII environments, the value can be 10 (LF), 13 (CR), or 3338
+ (CRLF); in EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or
+ 3349 or 3365 (CRLF) because there are two alternative codepoints (0x15 and
+ 0x25) that are used as the NL line terminator that is equivalent to ASCII
+ LF. In both ASCII and EBCDIC environments the value can also be -1 (ANY),
+ or -2 (ANYCRLF). */
+#ifndef NEWLINE
+#define NEWLINE 10
+#endif
+
+/* PCRE uses recursive function calls to handle backtracking while matching.
+ This can sometimes be a problem on systems that have stacks of limited
+ size. Define NO_RECURSE to any value to get a version that doesn't use
+ recursion in the match() function; instead it creates its own stack by
+ steam using pcre_recurse_malloc() to obtain memory from the heap. For more
+ detail, see the comments and other stuff just above the match() function.
+ */
+/* #undef NO_RECURSE */
+
+/* Name of package */
+#define PACKAGE "pcre2"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "PCRE2"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "PCRE2 9.00-DEV"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "pcre2"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "9.00-DEV"
+
+/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
+ parentheses (of any kind) in a pattern. This limits the amount of system
+ stack that is used while compiling a pattern. */
+#ifndef PARENS_NEST_LIMIT
+#define PARENS_NEST_LIMIT 250
+#endif
+
+/* #undef PCRE2_EXP_DEFN */
+
+/* The value of PCREGREP_BUFSIZE determines the size of buffer used by
+ pcregrep to hold parts of the file it is searching. This is also the
+ minimum value. The actual amount of memory used by pcregrep is three times
+ this number, because it allows for the buffering of "before" and "after"
+ lines. */
+#ifndef PCREGREP_BUFSIZE
+#define PCREGREP_BUFSIZE 20480
+#endif
+
+/* If you are compiling for a system other than a Unix-like system or
+ Win32, and it needs some magic to be inserted before the definition
+ of a function that is exported by the library, define this macro to
+ contain the relevant magic. If you do not define this macro, a suitable
+ __declspec value is used for Windows systems; in other environments
+ "extern" is used for a C compiler and "extern C" for a C++ compiler.
+ This macro apears at the start of every exported function that is part
+ of the external API. It does not appear on functions that are "external"
+ in the C sense, but which are internal to the library. */
+/* #undef PCRE_EXP_DEFN */
+
+/* Define to any value if linking statically (TODO: make nice with Libtool) */
+/* #undef PCRE_STATIC */
+
+/* When calling PCRE via the POSIX interface, additional working storage is
+ required for holding the pointers to capturing substrings because PCRE
+ requires three integers per substring, whereas the POSIX interface provides
+ only two. If the number of expected substrings is small, the wrapper
+ function uses space on the stack, because this is faster than using
+ malloc() for each call. The threshold above which the stack is no longer
+ used is defined by POSIX_MALLOC_THRESHOLD. */
+#ifndef POSIX_MALLOC_THRESHOLD
+#define POSIX_MALLOC_THRESHOLD 10
+#endif
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* Define to 1 if you have the ANSI C header files. */
+/* #undef STDC_HEADERS */
+
+/* Define to any value to enable support for Just-In-Time compiling. */
+/* #undef SUPPORT_JIT */
+
+/* Define to any value to allow pcregrep to be linked with libbz2, so that it
+ is able to handle .bz2 files. */
+/* #undef SUPPORT_LIBBZ2 */
+
+/* Define to any value to allow pcretest to be linked with libedit. */
+/* #undef SUPPORT_LIBEDIT */
+
+/* Define to any value to allow pcretest to be linked with libreadline. */
+/* #undef SUPPORT_LIBREADLINE */
+
+/* Define to any value to allow pcregrep to be linked with libz, so that it is
+ able to handle .gz files. */
+/* #undef SUPPORT_LIBZ */
+
+/* Define to any value to enable the 16 bit PCRE library. */
+/* #undef SUPPORT_PCRE16 */
+
+/* Define to any value to enable the 32 bit PCRE library. */
+/* #undef SUPPORT_PCRE32 */
+
+/* Define to any value to enable the 8 bit PCRE library. */
+/* #undef SUPPORT_PCRE8 */
+
+/* Define to any value to enable JIT support in pcregrep. */
+/* #undef SUPPORT_PCREGREP_JIT */
+
+/* Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
+ This will work even in an EBCDIC environment, but it is incompatible with
+ the EBCDIC macro. That is, PCRE can support *either* EBCDIC code *or*
+ ASCII/UTF-8/16/32, but not both at once. */
+/* #undef SUPPORT_UTF */
+
+/* Define to any value for valgrind support to find invalid memory reads. */
+/* #undef SUPPORT_VALGRIND */
+
+/* Version number of package */
+#define VERSION "9.00-DEV"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+/* #undef int64_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
diff --git a/src/config.h.in b/src/config.h.in
new file mode 100644
index 0000000..df605db
--- /dev/null
+++ b/src/config.h.in
@@ -0,0 +1,315 @@
+/* src/config.h.in. Generated from configure.ac by autoheader. */
+
+
+/* PCRE is written in Standard C, but there are a few non-standard things it
+can cope with, allowing it to run on SunOS4 and other "close to standard"
+systems.
+
+In environments that support the GNU autotools, config.h.in is converted into
+config.h by the "configure" script. In environments that use CMake,
+config-cmake.in is converted into config.h. If you are going to build PCRE "by
+hand" without using "configure" or CMake, you should copy the distributed
+config.h.generic to config.h, and edit the macro definitions to be the way you
+need them. You must then add -DHAVE_CONFIG_H to all of your compile commands,
+so that config.h is included at the start of every source.
+
+Alternatively, you can avoid editing by using -D on the compiler command line
+to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H,
+but if you do, default values will be taken from config.h for non-boolean
+macros that are not defined on the command line.
+
+Boolean macros such as HAVE_STDLIB_H and SUPPORT_PCRE8 should either be defined
+(conventionally to 1) for TRUE, and not defined at all for FALSE. All such
+macros are listed as a commented #undef in config.h.generic. Macros such as
+MATCH_LIMIT, whose actual value is relevant, have defaults defined, but are
+surrounded by #ifndef/#endif lines so that the value can be overridden by -D.
+
+PCRE uses memmove() if HAVE_MEMMOVE is defined; otherwise it uses bcopy() if
+HAVE_BCOPY is defined. If your system has neither bcopy() nor memmove(), make
+sure both macros are undefined; an emulation function will then be used. */
+
+/* By default, the \R escape sequence matches any Unicode line ending
+ character or sequence of characters. If BSR_ANYCRLF is defined (to any
+ value), this is changed so that backslash-R matches only CR, LF, or CRLF.
+ The build-time default can be overridden by the user of PCRE at runtime. */
+#undef BSR_ANYCRLF
+
+/* If you are compiling for a system that uses EBCDIC instead of ASCII
+ character codes, define this macro to any value. You must also edit the
+ NEWLINE macro below to set a suitable EBCDIC newline, commonly 21 (0x15).
+ On systems that can use "configure" or CMake to set EBCDIC, NEWLINE is
+ automatically adjusted. When EBCDIC is set, PCRE assumes that all input
+ strings are in EBCDIC. If you do not define this macro, PCRE will assume
+ input strings are ASCII or UTF-8/16/32 Unicode. It is not possible to build
+ a version of PCRE that supports both EBCDIC and UTF-8/16/32. */
+#undef EBCDIC
+
+/* In an EBCDIC environment, define this macro to any value to arrange for the
+ NL character to be 0x25 instead of the default 0x15. NL plays the role that
+ LF does in an ASCII/Unicode environment. The value must also be set in the
+ NEWLINE macro below. On systems that can use "configure" or CMake to set
+ EBCDIC_NL25, the adjustment of NEWLINE is automatic. */
+#undef EBCDIC_NL25
+
+/* Define to 1 if you have the `bcopy' function. */
+#undef HAVE_BCOPY
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+#undef HAVE_BZLIB_H
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <editline/readline.h> header file. */
+#undef HAVE_EDITLINE_READLINE_H
+
+/* Define to 1 if you have the <edit/readline/readline.h> header file. */
+#undef HAVE_EDIT_READLINE_READLINE_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define if you have POSIX threads libraries and header files. */
+#undef HAVE_PTHREAD
+
+/* Have PTHREAD_PRIO_INHERIT. */
+#undef HAVE_PTHREAD_PRIO_INHERIT
+
+/* Define to 1 if you have the <readline/history.h> header file. */
+#undef HAVE_READLINE_HISTORY_H
+
+/* Define to 1 if you have the <readline/readline.h> header file. */
+#undef HAVE_READLINE_READLINE_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the compiler supports simple visibility declarations. */
+#undef HAVE_VISIBILITY
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* The value of LINK_SIZE determines the number of bytes used to store links
+ as offsets within the compiled regex. The default is 2, which allows for
+ compiled patterns up to 64K long. This covers the vast majority of cases.
+ However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
+ for longer patterns in extreme cases. */
+#undef LINK_SIZE
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* The value of MATCH_LIMIT determines the default number of times the
+ internal match() function can be called during a single execution of
+ pcre_exec(). There is a runtime interface for setting a different limit.
+ The limit exists in order to catch runaway regular expressions that take
+ for ever to determine that they do not match. The default is set very large
+ so that it does not accidentally catch legitimate cases. */
+#undef MATCH_LIMIT
+
+/* The above limit applies to all calls of match(), whether or not they
+ increase the recursion depth. In some environments it is desirable to limit
+ the depth of recursive calls of match() more strictly, in order to restrict
+ the maximum amount of stack (or heap, if NO_RECURSE is defined) that is
+ used. The value of MATCH_LIMIT_RECURSION applies only to recursive calls of
+ match(). To have any useful effect, it must be less than the value of
+ MATCH_LIMIT. The default is to use the same value as MATCH_LIMIT. There is
+ a runtime method for setting a different limit. */
+#undef MATCH_LIMIT_RECURSION
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+ Care must be taken if it is increased, because it guards against integer
+ overflow caused by enormously large patterns. */
+#undef MAX_NAME_COUNT
+
+/* This limit is parameterized just in case anybody ever wants to change it.
+ Care must be taken if it is increased, because it guards against integer
+ overflow caused by enormously large patterns. */
+#undef MAX_NAME_SIZE
+
+/* The value of NEWLINE determines the default newline character sequence.
+ PCRE client programs can override this by selecting other values at run
+ time. In ASCII environments, the value can be 10 (LF), 13 (CR), or 3338
+ (CRLF); in EBCDIC environments the value can be 21 or 37 (LF), 13 (CR), or
+ 3349 or 3365 (CRLF) because there are two alternative codepoints (0x15 and
+ 0x25) that are used as the NL line terminator that is equivalent to ASCII
+ LF. In both ASCII and EBCDIC environments the value can also be -1 (ANY),
+ or -2 (ANYCRLF). */
+#undef NEWLINE
+
+/* PCRE uses recursive function calls to handle backtracking while matching.
+ This can sometimes be a problem on systems that have stacks of limited
+ size. Define NO_RECURSE to any value to get a version that doesn't use
+ recursion in the match() function; instead it creates its own stack by
+ steam using pcre_recurse_malloc() to obtain memory from the heap. For more
+ detail, see the comments and other stuff just above the match() function.
+ */
+#undef NO_RECURSE
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The value of PARENS_NEST_LIMIT specifies the maximum depth of nested
+ parentheses (of any kind) in a pattern. This limits the amount of system
+ stack that is used while compiling a pattern. */
+#undef PARENS_NEST_LIMIT
+
+/* to make a symbol visible */
+#undef PCRE2_EXP_DATA_DEFN
+
+/* to make a symbol visible */
+#undef PCRE2_EXP_DECL
+
+/* to make a symbol visible */
+#undef PCRE2_EXP_DEFN
+
+/* The value of PCREGREP_BUFSIZE determines the size of buffer used by
+ pcregrep to hold parts of the file it is searching. This is also the
+ minimum value. The actual amount of memory used by pcregrep is three times
+ this number, because it allows for the buffering of "before" and "after"
+ lines. */
+#undef PCREGREP_BUFSIZE
+
+/* to make a symbol visible */
+#undef PCREPOSIX_EXP_DECL
+
+/* to make a symbol visible */
+#undef PCREPOSIX_EXP_DEFN
+
+
+/* If you are compiling for a system other than a Unix-like system or
+ Win32, and it needs some magic to be inserted before the definition
+ of a function that is exported by the library, define this macro to
+ contain the relevant magic. If you do not define this macro, a suitable
+ __declspec value is used for Windows systems; in other environments
+ "extern" is used for a C compiler and "extern C" for a C++ compiler.
+ This macro apears at the start of every exported function that is part
+ of the external API. It does not appear on functions that are "external"
+ in the C sense, but which are internal to the library. */
+#undef PCRE_EXP_DEFN
+
+/* Define to any value if linking statically (TODO: make nice with Libtool) */
+#undef PCRE_STATIC
+
+/* When calling PCRE via the POSIX interface, additional working storage is
+ required for holding the pointers to capturing substrings because PCRE
+ requires three integers per substring, whereas the POSIX interface provides
+ only two. If the number of expected substrings is small, the wrapper
+ function uses space on the stack, because this is faster than using
+ malloc() for each call. The threshold above which the stack is no longer
+ used is defined by POSIX_MALLOC_THRESHOLD. */
+#undef POSIX_MALLOC_THRESHOLD
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+ your system. */
+#undef PTHREAD_CREATE_JOINABLE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to any value to enable support for Just-In-Time compiling. */
+#undef SUPPORT_JIT
+
+/* Define to any value to allow pcregrep to be linked with libbz2, so that it
+ is able to handle .bz2 files. */
+#undef SUPPORT_LIBBZ2
+
+/* Define to any value to allow pcretest to be linked with libedit. */
+#undef SUPPORT_LIBEDIT
+
+/* Define to any value to allow pcretest to be linked with libreadline. */
+#undef SUPPORT_LIBREADLINE
+
+/* Define to any value to allow pcregrep to be linked with libz, so that it is
+ able to handle .gz files. */
+#undef SUPPORT_LIBZ
+
+/* Define to any value to enable the 16 bit PCRE library. */
+#undef SUPPORT_PCRE16
+
+/* Define to any value to enable the 32 bit PCRE library. */
+#undef SUPPORT_PCRE32
+
+/* Define to any value to enable the 8 bit PCRE library. */
+#undef SUPPORT_PCRE8
+
+/* Define to any value to enable JIT support in pcregrep. */
+#undef SUPPORT_PCREGREP_JIT
+
+/* Define to any value to enable support for the UTF-8/16/32 Unicode encoding.
+ This will work even in an EBCDIC environment, but it is incompatible with
+ the EBCDIC macro. That is, PCRE can support *either* EBCDIC code *or*
+ ASCII/UTF-8/16/32, but not both at once. */
+#undef SUPPORT_UTF
+
+/* Define to any value for valgrind support to find invalid memory reads. */
+#undef SUPPORT_VALGRIND
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
diff --git a/src/pcre2.h b/src/pcre2.h
new file mode 100644
index 0000000..4576775
--- /dev/null
+++ b/src/pcre2.h
@@ -0,0 +1,594 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* This is the public header file for the PCRE library, second API, to be
+#included by applications that call PCRE2 functions.
+
+ Copyright (c) 2014 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _PCRE2_H
+#define _PCRE2_H
+
+/* The current PCRE version information. */
+
+#define PCRE2_MAJOR 9
+#define PCRE2_MINOR 00
+#define PCRE2_PRERELEASE -DEV
+#define PCRE2_DATE 2014-99-99
+
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre2_internal.h, which includes this file. So we
+don't change existing definitions of PCRE2_EXP_DECL. */
+
+#if defined(_WIN32) && !defined(PCRE2_STATIC)
+# ifndef PCRE2_EXP_DECL
+# define PCRE2_EXP_DECL extern __declspec(dllimport)
+# endif
+#endif
+
+/* By default, we use the standard "extern" declarations. */
+
+#ifndef PCRE2_EXP_DECL
+# ifdef __cplusplus
+# define PCRE2_EXP_DECL extern "C"
+# else
+# define PCRE2_EXP_DECL extern
+# endif
+#endif
+
+/* Have to include stdlib.h and stdint.h to ensure that size_t and uint8_t etc
+are defined. */
+
+#include <stdlib.h>
+#include <stdint.h>
+
+/* Allow for C++ users compiling this directly. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Public options. Those in the context may affect compilation, JIT
+compilation, and/or interpretive execution. The following tags indicate which:
+
+C alters what is compiled
+J alters what JIT compiles
+E affects pcre_exec() execution
+D affects pcre_dfa_exec() execution
+*/
+
+/* The first group of options are those that are set in the context. */
+
+#define PCRE2_ALT_BSUX 0x00000001 /* C */
+#define PCRE2_DOLLAR_ENDONLY 0x00000002 /* J E D */
+#define PCRE2_DUPNAMES 0x00000004 /* C */
+#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
+#define PCRE2_MATCH_UNSET_BACKREF 0x00000010 /* C J E */
+#define PCRE2_NEVER_UTF 0x00000020 /* C */
+#define PCRE2_NEVER_UCP 0x00000040 /* C */
+#define PCRE2_UTF 0x00000080 /* C J E D */
+#define PCRE2_UCP 0x00000100 /* C J E D */
+
+/* The following can be passed to pcre2_compile(), pcre2_exec(), or
+pcre2_dfa_exec(). PCRE2_NO_UTF_CHECK affects only the function to which it is
+passed. */
+
+#define PCRE2_ANCHORED 0x00000001
+#define PCRE2_NO_START_OPTIMIZE 0x00000002
+#define PCRE2_NO_UTF_CHECK 0x00000004
+
+/* These are for pcre2_compile() only, affecting what is compiled, but not
+otherwise affecting execution. */
+
+#define PCRE2_AUTO_CALLOUT 0x00000100
+#define PCRE2_CASELESS 0x00000200
+#define PCRE2_DOTALL 0x00000400
+#define PCRE2_EXTENDED 0x00000800
+#define PCRE2_MULTILINE 0x00001000
+#define PCRE2_NO_AUTO_CAPTURE 0x00002000
+#define PCRE2_NO_AUTO_POSSESS 0x00004000
+#define PCRE2_UNGREEDY 0x00008000
+
+/* This pcre2_compile() option affects JIT compilation and interpretive
+execution. */
+
+#define PCRE2_FIRSTLINE 0x00010000
+
+/* These are for pcre2_jit_compile(). */
+
+#define PCRE2_JIT 0x00020000
+#define PCRE2_JIT_PARTIAL_SOFT 0x00040000
+#define PCRE2_JIT_PARTIAL_HARD 0x00080000
+
+/* These are for pcre2_exec() and pcre2_dfa_exec(). */
+
+#define PCRE2_NOTBOL 0x00000100
+#define PCRE2_NOTEOL 0x00000200
+#define PCRE2_NOTEMPTY 0x00000400
+#define PCRE2_NOTEMPTY_ATSTART 0x00000800
+#define PCRE2_PARTIAL_SOFT 0x00001000
+#define PCRE2_PARTIAL_HARD 0x00002000
+
+/* These are additional options for pcre2_dfa_exec(). */
+
+#define PCRE2_DFA_RESTART 0x00010000
+#define PCRE2_DFA_SHORTEST 0x00020000
+
+/* Newline and \R settings, for use in the context. */
+
+#define PCRE2_NEWLINE_CR 0x00000001
+#define PCRE2_NEWLINE_LF 0x00000002
+#define PCRE2_NEWLINE_CRLF 0x00000004
+#define PCRE2_NEWLINE_ANY 0x00000008
+#define PCRE2_NEWLINE_ANYCRLF 0x00000010
+
+#define PCRE2_BSR_ANYCRLF 0x00000020
+#define PCRE2_BSR_UNICODE 0x00000040
+
+/* Exec-time and get/set-time error codes */
+
+#define PCRE2_ERROR_NOMATCH (-1)
+#define PCRE2_ERROR_NULL (-2)
+#define PCRE2_ERROR_BADOPTION (-3)
+#define PCRE2_ERROR_BADMAGIC (-4)
+#define PCRE2_ERROR_UNKNOWN_OPCODE (-5)
+#define PCRE2_ERROR_NOMEMORY (-6)
+#define PCRE2_ERROR_NOSUBSTRING (-7)
+#define PCRE2_ERROR_MATCHLIMIT (-8)
+#define PCRE2_ERROR_CALLOUT (-9) /* Never used by PCRE2 itself */
+#define PCRE2_ERROR_BADUTF (-10)
+#define PCRE2_ERROR_BADUTF_OFFSET (-11)
+#define PCRE2_ERROR_PARTIAL (-12)
+#define PCRE2_ERROR_BADPARTIAL (-13)
+#define PCRE2_ERROR_INTERNAL (-14)
+#define PCRE2_ERROR_BADCOUNT (-15)
+#define PCRE2_ERROR_DFA_UITEM (-16)
+#define PCRE2_ERROR_DFA_UCOND (-17)
+#define PCRE2_ERROR_DFA_UMLIMIT (-18)
+#define PCRE2_ERROR_DFA_WSSIZE (-19)
+#define PCRE2_ERROR_DFA_RECURSE (-20)
+#define PCRE2_ERROR_RECURSIONLIMIT (-21)
+#define PCRE2_ERROR_BADNEWLINE (-22)
+#define PCRE2_ERROR_BADOFFSET (-23)
+#define PCRE2_ERROR_SHORTUTF (-24)
+#define PCRE2_ERROR_RECURSELOOP (-25)
+#define PCRE2_ERROR_JIT_STACKLIMIT (-26)
+#define PCRE2_ERROR_BADMODE (-27)
+#define PCRE2_ERROR_BADENDIANNESS (-28)
+#define PCRE2_ERROR_DFA_BADRESTART (-29)
+#define PCRE2_ERROR_JIT_BADOPTION (-30)
+#define PCRE2_ERROR_BADLENGTH (-31)
+#define PCRE2_ERROR_UNSET (-32)
+
+/* Specific error codes for UTF-8 validity checks */
+
+#define PCRE2_UTF8_ERR0 0
+#define PCRE2_UTF8_ERR1 1
+#define PCRE2_UTF8_ERR2 2
+#define PCRE2_UTF8_ERR3 3
+#define PCRE2_UTF8_ERR4 4
+#define PCRE2_UTF8_ERR5 5
+#define PCRE2_UTF8_ERR6 6
+#define PCRE2_UTF8_ERR7 7
+#define PCRE2_UTF8_ERR8 8
+#define PCRE2_UTF8_ERR9 9
+#define PCRE2_UTF8_ERR10 10
+#define PCRE2_UTF8_ERR11 11
+#define PCRE2_UTF8_ERR12 12
+#define PCRE2_UTF8_ERR13 13
+#define PCRE2_UTF8_ERR14 14
+#define PCRE2_UTF8_ERR15 15
+#define PCRE2_UTF8_ERR16 16
+#define PCRE2_UTF8_ERR17 17
+#define PCRE2_UTF8_ERR18 18
+#define PCRE2_UTF8_ERR19 19
+#define PCRE2_UTF8_ERR20 20
+#define PCRE2_UTF8_ERR21 21
+
+/* Specific error codes for UTF-16 validity checks */
+
+#define PCRE2_UTF16_ERR0 0
+#define PCRE2_UTF16_ERR1 1
+#define PCRE2_UTF16_ERR2 2
+#define PCRE2_UTF16_ERR3 3
+
+/* Specific error codes for UTF-32 validity checks */
+
+#define PCRE2_UTF32_ERR0 0
+#define PCRE2_UTF32_ERR1 1
+#define PCRE2_UTF32_ERR3 2
+
+/* Request types for pcre2_get_info() */
+
+#define PCRE2_INFO_BACKREFMAX 0
+#define PCRE2_INFO_CAPTURECOUNT 1
+#define PCRE2_INFO_COMPILE_OPTIONS 2
+#define PCRE2_INFO_FIRSTCODEUNIT 3
+#define PCRE2_INFO_FIRSTCODETYPE 4
+#define PCRE2_INFO_FIRSTTABLE 5
+#define PCRE2_INFO_HASCRORLF 6
+#define PCRE2_INFO_JCHANGED 7
+#define PCRE2_INFO_JIT 8
+#define PCRE2_INFO_JITSIZE 9
+#define PCRE2_INFO_LASTCODEUNIT 10
+#define PCRE2_INFO_LASTCODETYPE 11
+#define PCRE2_INFO_MATCH_EMPTY 12
+#define PCRE2_INFO_MATCHLIMIT 13
+#define PCRE2_INFO_MAXLOOKBEHIND 14
+#define PCRE2_INFO_MINLENGTH 15
+#define PCRE2_INFO_NAMECOUNT 16
+#define PCRE2_INFO_NAMEENTRYSIZE 17
+#define PCRE2_INFO_NAMETABLE 18
+#define PCRE2_INFO_PATTERN_OPTIONS 19
+#define PCRE2_INFO_RECURSIONLIMIT 20
+#define PCRE2_INFO_SIZE 21
+
+/* Request types for pcre2_config(). */
+
+#define PCRE2_CONFIG_BSR 0
+#define PCRE2_CONFIG_JIT 1
+#define PCRE2_CONFIG_JITTARGET 2
+#define PCRE2_CONFIG_LINK_SIZE 3
+#define PCRE2_CONFIG_MATCH_LIMIT 4
+#define PCRE2_CONFIG_MATCH_LIMIT_RECURSION 5
+#define PCRE2_CONFIG_NEWLINE 6
+#define PCRE2_CONFIG_PARENS_LIMIT 7
+#define PCRE2_CONFIG_POSIX_MALLOC_THRESHOLD 8
+#define PCRE2_CONFIG_STACKRECURSE 9
+#define PCRE2_CONFIG_UTF 10
+
+/* Types for patterns and subject strings. */
+
+typedef uint8_t PCRE2_UCHAR8;
+typedef uint16_t PCRE2_UCHAR16;
+typedef uint32_t PCRE2_UCHAR32;
+
+typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
+typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
+typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
+
+/* Generic types for opaque structures and JIT callback functions. These
+declarations are defined in a macro that is expanded for each width later. */
+
+#define PCRE2_TYPES_LIST \
+struct pcre2_real_context; \
+typedef struct pcre2_real_context pcre2_context; \
+\
+struct pcre2_real; \
+typedef struct pcre2_real pcre2; \
+\
+struct pcre2_real_match_data; \
+typedef struct pcre2_real_match_data pcre2_match_data; \
+\
+struct pcre2_real_jit_stack; \
+typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
+\
+typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
+
+/* The structure for passing out data via the pcre_callout_function. We use a
+structure so that new fields can be added on the end in future versions,
+without changing the API of the function, thereby allowing old clients to work
+without modification. Define the generic version in a macro; the width-specific
+versions are generated from this macro below. */
+
+#define PCRE2_STRUCTURE_LIST \
+typedef struct pcre2_callout_block { \
+ int version; /* Identifies version of block */ \
+ /* ------------------------ Version 0 ------------------------------- */ \
+ int callout_number; /* Number compiled into pattern */ \
+ int *offset_vector; /* The offset vector */ \
+ PCRE2_SPTR subject; /* The subject being matched */ \
+ int subject_length; /* The length of the subject */ \
+ int start_match; /* Offset to start of this match attempt */ \
+ int current_position; /* Where we currently are in the subject */ \
+ int capture_top; /* Max current capture */ \
+ int capture_last; /* Most recently closed capture */ \
+ void *callout_data; /* Data passed in with the call */ \
+ /* ------------------- Added for Version 1 -------------------------- */ \
+ int pattern_position; /* Offset to next item in the pattern */ \
+ int next_item_length; /* Length of next item in the pattern */ \
+ /* ------------------- Added for Version 2 -------------------------- */ \
+ PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
+ /* ------------------------------------------------------------------ */ \
+} pcre2_callout_block;
+
+/* Utility functions for byte order swaps. These are not generic functions;
+each appears only its own library. */
+
+PCRE2_EXP_DECL int pcre2_utf16_to_host_byte_order(PCRE2_UCHAR16 *,
+ PCRE2_SPTR16, int, int *, int);
+PCRE2_EXP_DECL int pcre2_utf32_to_host_byte_order(PCRE2_UCHAR32 *,
+ PCRE2_SPTR32, int, int *, int);
+
+/* List the generic forms of all other functions in a macro. */
+
+#define PCRE2_FUNCTION_LIST \
+PCRE2_EXP_DECL pcre2 *pcre2_compile(pcre2_context *, PCRE2_SPTR, int, \
+ uint32_t, int *, size_t *); \
+PCRE2_EXP_DECL int pcre2_config(int, void *); \
+PCRE2_EXP_DECL size_t pcre2_context_size(void); \
+PCRE2_EXP_DECL \
+ pcre2_context *pcre2_copy_context(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_copy_named_substring(pcre2_match_data *, \
+ PCRE2_SPTR, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL int pcre2_copy_substring(pcre2_match_data *, int, \
+ PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL \
+ pcre2_match_data *pcre2_create_match_data(pcre2_context *, size_t); \
+PCRE2_EXP_DECL int pcre2_dfa_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *, int *, size_t); \
+PCRE2_EXP_DECL int pcre2_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *); \
+PCRE2_EXP_DECL void pcre2_free_compiled_code(pcre2_context *, pcre2 *); \
+PCRE2_EXP_DECL void pcre2_free_context(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_free_match_data(pcre2_context *, \
+ pcre2_match_data *); \
+PCRE2_EXP_DECL void pcre2_free_substring(pcre2_context *, PCRE2_SPTR); \
+PCRE2_EXP_DECL void pcre2_free_substring_list(pcre2_context *, \
+ PCRE2_SPTR *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_bsr_convention(pcre2_context *); \
+PCRE2_EXP_DECL int (*pcre2_get_callout(pcre2_context *)) \
+ (pcre2_callout_block *, void *); \
+PCRE2_EXP_DECL \
+ unsigned char *pcre2_get_character_tables(pcre2_context *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_context_options(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL size_t pcre2_get_error_offset(pcre2_match_data *); \
+PCRE2_EXP_DECL int pcre2_get_error_reason(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t pcre2_get_exec_frame_size(void); \
+PCRE2_EXP_DECL int pcre2_get_info(const pcre2 *, uint32_t, void *); \
+PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
+PCRE2_EXP_DECL \
+ PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_match_limit(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_get_memory_management(pcre2_context *, \
+ void *(**)(size_t, void *), \
+ void (**)(void *, void *)); \
+PCRE2_EXP_DECL int pcre2_get_named_substring(pcre2_context *, \
+ pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_named_substring_length(pcre2_match_data *, \
+ PCRE2_SPTR); \
+PCRE2_EXP_DECL uint32_t pcre2_get_newline_convention(pcre2_context *); \
+PCRE2_EXP_DECL size_t *pcre2_get_ovector(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t *pcre2_get_ovector_slots(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_parens_nest_limit(pcre2_context *); \
+PCRE2_EXP_DECL int (*pcre2_get_recursion_guard(pcre2_context *)) \
+ (int, void *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_recursion_limit(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_get_recursion_memory_management(\
+ pcre2_context *, \
+ void *(**)(size_t, void *), \
+ void (**)(void *, void *)); \
+PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *); \
+PCRE2_EXP_DECL int pcre2_get_stringtable_entries(const pcre2 *, \
+ PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_substring(pcre2_context *, \
+ pcre2_match_data *, int, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_substring_length(pcre2_match_data *, int); \
+PCRE2_EXP_DECL int pcre2_get_substring_list(pcre2_context *, \
+ pcre2_match_data *, PCRE2_UCHAR ***); \
+PCRE2_EXP_DECL int pcre2_get_substring_number(const pcre2 *, \
+ PCRE2_SPTR); \
+PCRE2_EXP_DECL void *pcre2_get_user_data(pcre2_context *); \
+PCRE2_EXP_DECL \
+ pcre2_context *pcre2_init_context(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_context *, pcre2 *, \
+ uint32_t); \
+PCRE2_EXP_DECL int pcre2_jit_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *, pcre2_jit_stack *); \
+PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_context *); \
+PCRE2_EXP_DECL \
+ pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_context *, size_t, \
+ size_t); \
+PCRE2_EXP_DECL void pcre2_jit_stack_assign(pcre2_context *, \
+ const pcre2 *, pcre2_jit_callback, void *); \
+PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_context *, \
+ pcre2_jit_stack *); \
+PCRE2_EXP_DECL \
+ const unsigned char *pcre2_maketables(void); \
+PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2 *); \
+PCRE2_EXP_DECL void pcre2_set_bsr_convention(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_callout(pcre2_context *, \
+ int (*)(pcre2_callout_block *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_character_tables(pcre2_context *, \
+ unsigned char *); \
+PCRE2_EXP_DECL void pcre2_set_context_options(pcre2_context *, uint32_t, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_match_limit(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_memory_management(pcre2_context *, \
+ void * (*)(size_t, void *), \
+ void (*)(void *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_newline_convention(pcre2_context *, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_parens_nest_limit(pcre2_context *, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_recursion_guard(pcre2_context *, \
+ int (*)(uint32_t, void *)); \
+PCRE2_EXP_DECL void pcre2_set_recursion_limit(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_recursion_memory_management(\
+ pcre2_context *, void * (*)(size_t, void *), \
+ void (*)(void *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_user_data(pcre2_context *, void *); \
+PCRE2_EXP_DECL int pcre2_version(PCRE2_UCHAR *, size_t);
+
+
+/* Define macros that generate width-specific names from generic versions. The
+three-level macro scheme is necessary to get the macros expanded when we want
+them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
+generating three versions of each external function below. After that,
+PCRE2_ADDWIDTH will be re-defined to use PCRE2_DATA_WIDTH, for use when macros
+such as pcre2_compile are called by application code. */
+
+#define PCRE2_JOIN(a,b) a ## b
+#define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
+#define PCRE2_ADDWIDTH(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
+
+/* Data types */
+
+#define PCRE2_UCHAR PCRE2_ADDWIDTH(PCRE2_UCHAR)
+#define PCRE2_SPTR PCRE2_ADDWIDTH(PCRE2_SPTR)
+
+#define pcre2 PCRE2_ADDWIDTH(pcre2_)
+#define pcre2_jit_callback PCRE2_ADDWIDTH(pcre2_jit_callback_)
+#define pcre2_jit_stack PCRE2_ADDWIDTH(pcre2_jit_stack_)
+
+#define pcre2_real PCRE2_ADDWIDTH(pcre2_real_)
+#define pcre2_real_context PCRE2_ADDWIDTH(pcre2_real_context_)
+#define pcre2_real_jit_stack PCRE2_ADDWIDTH(pcre2_real_jit_stack_)
+#define pcre2_real_match_data PCRE2_ADDWIDTH(pcre2_real_match_data_)
+
+/* Data blocks */
+
+#define pcre2_callout_block PCRE2_ADDWIDTH(pcre2_callout_block_)
+#define pcre2_context PCRE2_ADDWIDTH(pcre2_context_)
+#define pcre2_match_data PCRE2_ADDWIDTH(pcre2_match_data_)
+
+/* Functions */
+
+#define pcre2_compile PCRE2_ADDWIDTH(pcre2_compile_)
+#define pcre2_config PCRE2_ADDWIDTH(pcre2_config_)
+#define pcre2_context_size PCRE2_ADDWIDTH(pcre2_context_size_)
+#define pcre2_copy_context PCRE2_ADDWIDTH(pcre2_copy_context_)
+#define pcre2_copy_named_substring PCRE2_ADDWIDTH(pcre2_copy_named_substring_)
+#define pcre2_copy_substring PCRE2_ADDWIDTH(pcre2_copy_substring_)
+#define pcre2_create_match_data PCRE2_ADDWIDTH(pcre2_create_match_data_)
+#define pcre2_dfa_exec PCRE2_ADDWIDTH(pcre2_dfa_exec_)
+#define pcre2_exec PCRE2_ADDWIDTH(pcre2_exec_)
+#define pcre2_free_compiled_code PCRE2_ADDWIDTH(pcre2_free_compiled_code_)
+#define pcre2_free_context PCRE2_ADDWIDTH(pcre2_free_context_)
+#define pcre2_free_match_data PCRE2_ADDWIDTH(pcre2_free_match_data_)
+#define pcre2_free_substring PCRE2_ADDWIDTH(pcre2_free_substring_)
+#define pcre2_free_substring_list PCRE2_ADDWIDTH(pcre2_free_substring_list_)
+#define pcre2_get_bsr_convention PCRE2_ADDWIDTH(pcre2_get_bsr_convention_)
+#define pcre2_get_callout PCRE2_ADDWIDTH(pcre2_get_callout_)
+#define pcre2_get_character_tables PCRE2_ADDWIDTH(pcre2_get_character_tables_)
+#define pcre2_get_context_options PCRE2_ADDWIDTH(pcre2_get_context_options_)
+#define pcre2_get_error_message PCRE2_ADDWIDTH(pcre2_get_error_message_)
+#define pcre2_get_error_offset PCRE2_ADDWIDTH(pcre2_get_error_offset_)
+#define pcre2_get_error_reason PCRE2_ADDWIDTH(pcre2_get_error_reason_)
+#define pcre2_get_info PCRE2_ADDWIDTH(pcre2_get_info_)
+#define pcre2_get_leftchar PCRE2_ADDWIDTH(pcre2_get_leftchar_)
+#define pcre2_get_mark PCRE2_ADDWIDTH(pcre2_get_mark_)
+#define pcre2_get_match_limit PCRE2_ADDWIDTH(pcre2_get_match_limit_)
+#define pcre2_get_memory_management PCRE2_ADDWIDTH(pcre2_get_memory_management_)
+#define pcre2_get_named_substring PCRE2_ADDWIDTH(pcre2_get_named_substring_)
+#define pcre2_get_named_substring_length PCRE2_ADDWIDTH(pcre2_get_named_substring_length_)
+#define pcre2_get_newline_convention PCRE2_ADDWIDTH(pcre2_get_newline_convention_)
+#define pcre2_get_ovector PCRE2_ADDWIDTH(pcre2_get_ovector_)
+#define pcre2_get_ovector_slots PCRE2_ADDWIDTH(pcre2_get_ovector_slots_)
+#define pcre2_get_parens_nest_limit PCRE2_ADDWIDTH(pcre2_get_parens_nest_limit_)
+#define pcre2_get_recursion_guard PCRE2_ADDWIDTH(pcre2_get_recursion_guard_)
+#define pcre2_get_recursion_limit PCRE2_ADDWIDTH(pcre2_get_recursion_limit_)
+#define pcre2_get_recursion_memory_management PCRE2_ADDWIDTH(pcre2_get_recursion_memory_management_)
+#define pcre2_get_rightchar PCRE2_ADDWIDTH(pcre2_get_rightchar_)
+#define pcre2_get_startchar PCRE2_ADDWIDTH(pcre2_get_startchar_)
+#define pcre2_get_stringtable_entries PCRE2_ADDWIDTH(pcre2_get_stringtable_entries_)
+#define pcre2_get_substring PCRE2_ADDWIDTH(pcre2_get_substring_)
+#define pcre2_get_substring_length PCRE2_ADDWIDTH(pcre2_get_substring_length_)
+#define pcre2_get_substring_list PCRE2_ADDWIDTH(pcre2_get_substring_list_)
+#define pcre2_get_substring_number PCRE2_ADDWIDTH(pcre2_get_substring_number_)
+#define pcre2_get_user_data PCRE2_ADDWIDTH(pcre2_get_user_data_)
+#define pcre2_init_context PCRE2_ADDWIDTH(pcre2_init_context_)
+#define pcre2_jit_compile PCRE2_ADDWIDTH(pcre2_jit_compile_)
+#define pcre2_jit_exec PCRE2_ADDWIDTH(pcre2_jit_exec_)
+#define pcre2_jit_free_unused_memory PCRE2_ADDWIDTH(pcre2_jit_free_unused_memory_)
+#define pcre2_jit_stack_alloc PCRE2_ADDWIDTH(pcre2_jit_stack_alloc_)
+#define pcre2_jit_stack_assign PCRE2_ADDWIDTH(pcre2_jit_stack_assign_)
+#define pcre2_jit_stack_free PCRE2_ADDWIDTH(pcre2_jit_stack_free_)
+#define pcre2_maketables PCRE2_ADDWIDTH(pcre2_maketables_)
+#define pcre2_pattern_to_host_byte_order PCRE2_ADDWIDTH(pcre2_pattern_to_host_byte_order_)
+#define pcre2_set_bsr_convention PCRE2_ADDWIDTH(pcre2_set_bsr_convention_)
+#define pcre2_set_callout PCRE2_ADDWIDTH(pcre2_set_callout_)
+#define pcre2_set_character_tables PCRE2_ADDWIDTH(pcre2_set_character_tables_)
+#define pcre2_set_context_options PCRE2_ADDWIDTH(pcre2_set_context_options_)
+#define pcre2_set_match_limit PCRE2_ADDWIDTH(pcre2_set_match_limit_)
+#define pcre2_set_memory_management PCRE2_ADDWIDTH(pcre2_set_memory_management_)
+#define pcre2_set_newline_convention PCRE2_ADDWIDTH(pcre2_set_newline_convention_)
+#define pcre2_set_recursion_guard PCRE2_ADDWIDTH(pcre2_set_recursion_guard_)
+#define pcre2_set_parens_nest_limit PCRE2_ADDWIDTH(pcre2_set_parens_nest_limit_)
+#define pcre2_set_recursion_limit PCRE2_ADDWIDTH(pcre2_set_recursion_limit_)
+#define pcre2_set_recursion_memory_management PCRE2_ADDWIDTH(pcre2_set_recursion_memory_management_)
+#define pcre2_set_user_data PCRE2_ADDWIDTH(pcre2_set_user_data_)
+#define pcre2_version PCRE2_ADDWIDTH(pcre2_version_)
+
+/* Now generate all three sets of width-specific structures and function
+prototypes. */
+
+#define PCRE2_LOCAL_WIDTH 8
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#define PCRE2_LOCAL_WIDTH 16
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#define PCRE2_LOCAL_WIDTH 32
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#undef PCRE2_TYPES_LIST
+#undef PCRE2_STRUCTURE_LIST
+#undef PCRE2_FUNCTION_LIST
+#undef PCRE2_ADDWIDTH
+
+/* Re-define PCRE2_ADDWIDTH to use the external width value, if defined.
+Otherwise, undefine the other macros and make PCRE2_ADDWIDTH a no-op, to reduce
+confusion. */
+
+#ifdef PCRE2_DATA_WIDTH
+#if PCRE2_DATA_WIDTH != 8 && PCRE2_DATA_WIDTH != 16 && PCRE2_DATA_WIDTH != 32
+#error PCRE2_DATA_WIDTH must be 8, 16, or 32
+#endif
+#define PCRE2_ADDWIDTH(a) PCRE2_GLUE(a,PCRE2_DATA_WIDTH)
+#else
+#undef PCRE2_JOIN
+#undef PCRE2_GLUE
+#define PCRE2_ADDWIDTH(a) a
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* End of pcre2.h */
diff --git a/src/pcre2.h.generic b/src/pcre2.h.generic
new file mode 100644
index 0000000..4576775
--- /dev/null
+++ b/src/pcre2.h.generic
@@ -0,0 +1,594 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* This is the public header file for the PCRE library, second API, to be
+#included by applications that call PCRE2 functions.
+
+ Copyright (c) 2014 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _PCRE2_H
+#define _PCRE2_H
+
+/* The current PCRE version information. */
+
+#define PCRE2_MAJOR 9
+#define PCRE2_MINOR 00
+#define PCRE2_PRERELEASE -DEV
+#define PCRE2_DATE 2014-99-99
+
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre2_internal.h, which includes this file. So we
+don't change existing definitions of PCRE2_EXP_DECL. */
+
+#if defined(_WIN32) && !defined(PCRE2_STATIC)
+# ifndef PCRE2_EXP_DECL
+# define PCRE2_EXP_DECL extern __declspec(dllimport)
+# endif
+#endif
+
+/* By default, we use the standard "extern" declarations. */
+
+#ifndef PCRE2_EXP_DECL
+# ifdef __cplusplus
+# define PCRE2_EXP_DECL extern "C"
+# else
+# define PCRE2_EXP_DECL extern
+# endif
+#endif
+
+/* Have to include stdlib.h and stdint.h to ensure that size_t and uint8_t etc
+are defined. */
+
+#include <stdlib.h>
+#include <stdint.h>
+
+/* Allow for C++ users compiling this directly. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Public options. Those in the context may affect compilation, JIT
+compilation, and/or interpretive execution. The following tags indicate which:
+
+C alters what is compiled
+J alters what JIT compiles
+E affects pcre_exec() execution
+D affects pcre_dfa_exec() execution
+*/
+
+/* The first group of options are those that are set in the context. */
+
+#define PCRE2_ALT_BSUX 0x00000001 /* C */
+#define PCRE2_DOLLAR_ENDONLY 0x00000002 /* J E D */
+#define PCRE2_DUPNAMES 0x00000004 /* C */
+#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
+#define PCRE2_MATCH_UNSET_BACKREF 0x00000010 /* C J E */
+#define PCRE2_NEVER_UTF 0x00000020 /* C */
+#define PCRE2_NEVER_UCP 0x00000040 /* C */
+#define PCRE2_UTF 0x00000080 /* C J E D */
+#define PCRE2_UCP 0x00000100 /* C J E D */
+
+/* The following can be passed to pcre2_compile(), pcre2_exec(), or
+pcre2_dfa_exec(). PCRE2_NO_UTF_CHECK affects only the function to which it is
+passed. */
+
+#define PCRE2_ANCHORED 0x00000001
+#define PCRE2_NO_START_OPTIMIZE 0x00000002
+#define PCRE2_NO_UTF_CHECK 0x00000004
+
+/* These are for pcre2_compile() only, affecting what is compiled, but not
+otherwise affecting execution. */
+
+#define PCRE2_AUTO_CALLOUT 0x00000100
+#define PCRE2_CASELESS 0x00000200
+#define PCRE2_DOTALL 0x00000400
+#define PCRE2_EXTENDED 0x00000800
+#define PCRE2_MULTILINE 0x00001000
+#define PCRE2_NO_AUTO_CAPTURE 0x00002000
+#define PCRE2_NO_AUTO_POSSESS 0x00004000
+#define PCRE2_UNGREEDY 0x00008000
+
+/* This pcre2_compile() option affects JIT compilation and interpretive
+execution. */
+
+#define PCRE2_FIRSTLINE 0x00010000
+
+/* These are for pcre2_jit_compile(). */
+
+#define PCRE2_JIT 0x00020000
+#define PCRE2_JIT_PARTIAL_SOFT 0x00040000
+#define PCRE2_JIT_PARTIAL_HARD 0x00080000
+
+/* These are for pcre2_exec() and pcre2_dfa_exec(). */
+
+#define PCRE2_NOTBOL 0x00000100
+#define PCRE2_NOTEOL 0x00000200
+#define PCRE2_NOTEMPTY 0x00000400
+#define PCRE2_NOTEMPTY_ATSTART 0x00000800
+#define PCRE2_PARTIAL_SOFT 0x00001000
+#define PCRE2_PARTIAL_HARD 0x00002000
+
+/* These are additional options for pcre2_dfa_exec(). */
+
+#define PCRE2_DFA_RESTART 0x00010000
+#define PCRE2_DFA_SHORTEST 0x00020000
+
+/* Newline and \R settings, for use in the context. */
+
+#define PCRE2_NEWLINE_CR 0x00000001
+#define PCRE2_NEWLINE_LF 0x00000002
+#define PCRE2_NEWLINE_CRLF 0x00000004
+#define PCRE2_NEWLINE_ANY 0x00000008
+#define PCRE2_NEWLINE_ANYCRLF 0x00000010
+
+#define PCRE2_BSR_ANYCRLF 0x00000020
+#define PCRE2_BSR_UNICODE 0x00000040
+
+/* Exec-time and get/set-time error codes */
+
+#define PCRE2_ERROR_NOMATCH (-1)
+#define PCRE2_ERROR_NULL (-2)
+#define PCRE2_ERROR_BADOPTION (-3)
+#define PCRE2_ERROR_BADMAGIC (-4)
+#define PCRE2_ERROR_UNKNOWN_OPCODE (-5)
+#define PCRE2_ERROR_NOMEMORY (-6)
+#define PCRE2_ERROR_NOSUBSTRING (-7)
+#define PCRE2_ERROR_MATCHLIMIT (-8)
+#define PCRE2_ERROR_CALLOUT (-9) /* Never used by PCRE2 itself */
+#define PCRE2_ERROR_BADUTF (-10)
+#define PCRE2_ERROR_BADUTF_OFFSET (-11)
+#define PCRE2_ERROR_PARTIAL (-12)
+#define PCRE2_ERROR_BADPARTIAL (-13)
+#define PCRE2_ERROR_INTERNAL (-14)
+#define PCRE2_ERROR_BADCOUNT (-15)
+#define PCRE2_ERROR_DFA_UITEM (-16)
+#define PCRE2_ERROR_DFA_UCOND (-17)
+#define PCRE2_ERROR_DFA_UMLIMIT (-18)
+#define PCRE2_ERROR_DFA_WSSIZE (-19)
+#define PCRE2_ERROR_DFA_RECURSE (-20)
+#define PCRE2_ERROR_RECURSIONLIMIT (-21)
+#define PCRE2_ERROR_BADNEWLINE (-22)
+#define PCRE2_ERROR_BADOFFSET (-23)
+#define PCRE2_ERROR_SHORTUTF (-24)
+#define PCRE2_ERROR_RECURSELOOP (-25)
+#define PCRE2_ERROR_JIT_STACKLIMIT (-26)
+#define PCRE2_ERROR_BADMODE (-27)
+#define PCRE2_ERROR_BADENDIANNESS (-28)
+#define PCRE2_ERROR_DFA_BADRESTART (-29)
+#define PCRE2_ERROR_JIT_BADOPTION (-30)
+#define PCRE2_ERROR_BADLENGTH (-31)
+#define PCRE2_ERROR_UNSET (-32)
+
+/* Specific error codes for UTF-8 validity checks */
+
+#define PCRE2_UTF8_ERR0 0
+#define PCRE2_UTF8_ERR1 1
+#define PCRE2_UTF8_ERR2 2
+#define PCRE2_UTF8_ERR3 3
+#define PCRE2_UTF8_ERR4 4
+#define PCRE2_UTF8_ERR5 5
+#define PCRE2_UTF8_ERR6 6
+#define PCRE2_UTF8_ERR7 7
+#define PCRE2_UTF8_ERR8 8
+#define PCRE2_UTF8_ERR9 9
+#define PCRE2_UTF8_ERR10 10
+#define PCRE2_UTF8_ERR11 11
+#define PCRE2_UTF8_ERR12 12
+#define PCRE2_UTF8_ERR13 13
+#define PCRE2_UTF8_ERR14 14
+#define PCRE2_UTF8_ERR15 15
+#define PCRE2_UTF8_ERR16 16
+#define PCRE2_UTF8_ERR17 17
+#define PCRE2_UTF8_ERR18 18
+#define PCRE2_UTF8_ERR19 19
+#define PCRE2_UTF8_ERR20 20
+#define PCRE2_UTF8_ERR21 21
+
+/* Specific error codes for UTF-16 validity checks */
+
+#define PCRE2_UTF16_ERR0 0
+#define PCRE2_UTF16_ERR1 1
+#define PCRE2_UTF16_ERR2 2
+#define PCRE2_UTF16_ERR3 3
+
+/* Specific error codes for UTF-32 validity checks */
+
+#define PCRE2_UTF32_ERR0 0
+#define PCRE2_UTF32_ERR1 1
+#define PCRE2_UTF32_ERR3 2
+
+/* Request types for pcre2_get_info() */
+
+#define PCRE2_INFO_BACKREFMAX 0
+#define PCRE2_INFO_CAPTURECOUNT 1
+#define PCRE2_INFO_COMPILE_OPTIONS 2
+#define PCRE2_INFO_FIRSTCODEUNIT 3
+#define PCRE2_INFO_FIRSTCODETYPE 4
+#define PCRE2_INFO_FIRSTTABLE 5
+#define PCRE2_INFO_HASCRORLF 6
+#define PCRE2_INFO_JCHANGED 7
+#define PCRE2_INFO_JIT 8
+#define PCRE2_INFO_JITSIZE 9
+#define PCRE2_INFO_LASTCODEUNIT 10
+#define PCRE2_INFO_LASTCODETYPE 11
+#define PCRE2_INFO_MATCH_EMPTY 12
+#define PCRE2_INFO_MATCHLIMIT 13
+#define PCRE2_INFO_MAXLOOKBEHIND 14
+#define PCRE2_INFO_MINLENGTH 15
+#define PCRE2_INFO_NAMECOUNT 16
+#define PCRE2_INFO_NAMEENTRYSIZE 17
+#define PCRE2_INFO_NAMETABLE 18
+#define PCRE2_INFO_PATTERN_OPTIONS 19
+#define PCRE2_INFO_RECURSIONLIMIT 20
+#define PCRE2_INFO_SIZE 21
+
+/* Request types for pcre2_config(). */
+
+#define PCRE2_CONFIG_BSR 0
+#define PCRE2_CONFIG_JIT 1
+#define PCRE2_CONFIG_JITTARGET 2
+#define PCRE2_CONFIG_LINK_SIZE 3
+#define PCRE2_CONFIG_MATCH_LIMIT 4
+#define PCRE2_CONFIG_MATCH_LIMIT_RECURSION 5
+#define PCRE2_CONFIG_NEWLINE 6
+#define PCRE2_CONFIG_PARENS_LIMIT 7
+#define PCRE2_CONFIG_POSIX_MALLOC_THRESHOLD 8
+#define PCRE2_CONFIG_STACKRECURSE 9
+#define PCRE2_CONFIG_UTF 10
+
+/* Types for patterns and subject strings. */
+
+typedef uint8_t PCRE2_UCHAR8;
+typedef uint16_t PCRE2_UCHAR16;
+typedef uint32_t PCRE2_UCHAR32;
+
+typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
+typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
+typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
+
+/* Generic types for opaque structures and JIT callback functions. These
+declarations are defined in a macro that is expanded for each width later. */
+
+#define PCRE2_TYPES_LIST \
+struct pcre2_real_context; \
+typedef struct pcre2_real_context pcre2_context; \
+\
+struct pcre2_real; \
+typedef struct pcre2_real pcre2; \
+\
+struct pcre2_real_match_data; \
+typedef struct pcre2_real_match_data pcre2_match_data; \
+\
+struct pcre2_real_jit_stack; \
+typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
+\
+typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
+
+/* The structure for passing out data via the pcre_callout_function. We use a
+structure so that new fields can be added on the end in future versions,
+without changing the API of the function, thereby allowing old clients to work
+without modification. Define the generic version in a macro; the width-specific
+versions are generated from this macro below. */
+
+#define PCRE2_STRUCTURE_LIST \
+typedef struct pcre2_callout_block { \
+ int version; /* Identifies version of block */ \
+ /* ------------------------ Version 0 ------------------------------- */ \
+ int callout_number; /* Number compiled into pattern */ \
+ int *offset_vector; /* The offset vector */ \
+ PCRE2_SPTR subject; /* The subject being matched */ \
+ int subject_length; /* The length of the subject */ \
+ int start_match; /* Offset to start of this match attempt */ \
+ int current_position; /* Where we currently are in the subject */ \
+ int capture_top; /* Max current capture */ \
+ int capture_last; /* Most recently closed capture */ \
+ void *callout_data; /* Data passed in with the call */ \
+ /* ------------------- Added for Version 1 -------------------------- */ \
+ int pattern_position; /* Offset to next item in the pattern */ \
+ int next_item_length; /* Length of next item in the pattern */ \
+ /* ------------------- Added for Version 2 -------------------------- */ \
+ PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
+ /* ------------------------------------------------------------------ */ \
+} pcre2_callout_block;
+
+/* Utility functions for byte order swaps. These are not generic functions;
+each appears only its own library. */
+
+PCRE2_EXP_DECL int pcre2_utf16_to_host_byte_order(PCRE2_UCHAR16 *,
+ PCRE2_SPTR16, int, int *, int);
+PCRE2_EXP_DECL int pcre2_utf32_to_host_byte_order(PCRE2_UCHAR32 *,
+ PCRE2_SPTR32, int, int *, int);
+
+/* List the generic forms of all other functions in a macro. */
+
+#define PCRE2_FUNCTION_LIST \
+PCRE2_EXP_DECL pcre2 *pcre2_compile(pcre2_context *, PCRE2_SPTR, int, \
+ uint32_t, int *, size_t *); \
+PCRE2_EXP_DECL int pcre2_config(int, void *); \
+PCRE2_EXP_DECL size_t pcre2_context_size(void); \
+PCRE2_EXP_DECL \
+ pcre2_context *pcre2_copy_context(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_copy_named_substring(pcre2_match_data *, \
+ PCRE2_SPTR, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL int pcre2_copy_substring(pcre2_match_data *, int, \
+ PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL \
+ pcre2_match_data *pcre2_create_match_data(pcre2_context *, size_t); \
+PCRE2_EXP_DECL int pcre2_dfa_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *, int *, size_t); \
+PCRE2_EXP_DECL int pcre2_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *); \
+PCRE2_EXP_DECL void pcre2_free_compiled_code(pcre2_context *, pcre2 *); \
+PCRE2_EXP_DECL void pcre2_free_context(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_free_match_data(pcre2_context *, \
+ pcre2_match_data *); \
+PCRE2_EXP_DECL void pcre2_free_substring(pcre2_context *, PCRE2_SPTR); \
+PCRE2_EXP_DECL void pcre2_free_substring_list(pcre2_context *, \
+ PCRE2_SPTR *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_bsr_convention(pcre2_context *); \
+PCRE2_EXP_DECL int (*pcre2_get_callout(pcre2_context *)) \
+ (pcre2_callout_block *, void *); \
+PCRE2_EXP_DECL \
+ unsigned char *pcre2_get_character_tables(pcre2_context *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_context_options(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL size_t pcre2_get_error_offset(pcre2_match_data *); \
+PCRE2_EXP_DECL int pcre2_get_error_reason(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t pcre2_get_exec_frame_size(void); \
+PCRE2_EXP_DECL int pcre2_get_info(const pcre2 *, uint32_t, void *); \
+PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
+PCRE2_EXP_DECL \
+ PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_match_limit(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_get_memory_management(pcre2_context *, \
+ void *(**)(size_t, void *), \
+ void (**)(void *, void *)); \
+PCRE2_EXP_DECL int pcre2_get_named_substring(pcre2_context *, \
+ pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_named_substring_length(pcre2_match_data *, \
+ PCRE2_SPTR); \
+PCRE2_EXP_DECL uint32_t pcre2_get_newline_convention(pcre2_context *); \
+PCRE2_EXP_DECL size_t *pcre2_get_ovector(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t *pcre2_get_ovector_slots(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_parens_nest_limit(pcre2_context *); \
+PCRE2_EXP_DECL int (*pcre2_get_recursion_guard(pcre2_context *)) \
+ (int, void *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_recursion_limit(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_get_recursion_memory_management(\
+ pcre2_context *, \
+ void *(**)(size_t, void *), \
+ void (**)(void *, void *)); \
+PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *); \
+PCRE2_EXP_DECL int pcre2_get_stringtable_entries(const pcre2 *, \
+ PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_substring(pcre2_context *, \
+ pcre2_match_data *, int, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_substring_length(pcre2_match_data *, int); \
+PCRE2_EXP_DECL int pcre2_get_substring_list(pcre2_context *, \
+ pcre2_match_data *, PCRE2_UCHAR ***); \
+PCRE2_EXP_DECL int pcre2_get_substring_number(const pcre2 *, \
+ PCRE2_SPTR); \
+PCRE2_EXP_DECL void *pcre2_get_user_data(pcre2_context *); \
+PCRE2_EXP_DECL \
+ pcre2_context *pcre2_init_context(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_context *, pcre2 *, \
+ uint32_t); \
+PCRE2_EXP_DECL int pcre2_jit_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *, pcre2_jit_stack *); \
+PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_context *); \
+PCRE2_EXP_DECL \
+ pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_context *, size_t, \
+ size_t); \
+PCRE2_EXP_DECL void pcre2_jit_stack_assign(pcre2_context *, \
+ const pcre2 *, pcre2_jit_callback, void *); \
+PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_context *, \
+ pcre2_jit_stack *); \
+PCRE2_EXP_DECL \
+ const unsigned char *pcre2_maketables(void); \
+PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2 *); \
+PCRE2_EXP_DECL void pcre2_set_bsr_convention(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_callout(pcre2_context *, \
+ int (*)(pcre2_callout_block *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_character_tables(pcre2_context *, \
+ unsigned char *); \
+PCRE2_EXP_DECL void pcre2_set_context_options(pcre2_context *, uint32_t, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_match_limit(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_memory_management(pcre2_context *, \
+ void * (*)(size_t, void *), \
+ void (*)(void *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_newline_convention(pcre2_context *, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_parens_nest_limit(pcre2_context *, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_recursion_guard(pcre2_context *, \
+ int (*)(uint32_t, void *)); \
+PCRE2_EXP_DECL void pcre2_set_recursion_limit(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_recursion_memory_management(\
+ pcre2_context *, void * (*)(size_t, void *), \
+ void (*)(void *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_user_data(pcre2_context *, void *); \
+PCRE2_EXP_DECL int pcre2_version(PCRE2_UCHAR *, size_t);
+
+
+/* Define macros that generate width-specific names from generic versions. The
+three-level macro scheme is necessary to get the macros expanded when we want
+them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
+generating three versions of each external function below. After that,
+PCRE2_ADDWIDTH will be re-defined to use PCRE2_DATA_WIDTH, for use when macros
+such as pcre2_compile are called by application code. */
+
+#define PCRE2_JOIN(a,b) a ## b
+#define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
+#define PCRE2_ADDWIDTH(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
+
+/* Data types */
+
+#define PCRE2_UCHAR PCRE2_ADDWIDTH(PCRE2_UCHAR)
+#define PCRE2_SPTR PCRE2_ADDWIDTH(PCRE2_SPTR)
+
+#define pcre2 PCRE2_ADDWIDTH(pcre2_)
+#define pcre2_jit_callback PCRE2_ADDWIDTH(pcre2_jit_callback_)
+#define pcre2_jit_stack PCRE2_ADDWIDTH(pcre2_jit_stack_)
+
+#define pcre2_real PCRE2_ADDWIDTH(pcre2_real_)
+#define pcre2_real_context PCRE2_ADDWIDTH(pcre2_real_context_)
+#define pcre2_real_jit_stack PCRE2_ADDWIDTH(pcre2_real_jit_stack_)
+#define pcre2_real_match_data PCRE2_ADDWIDTH(pcre2_real_match_data_)
+
+/* Data blocks */
+
+#define pcre2_callout_block PCRE2_ADDWIDTH(pcre2_callout_block_)
+#define pcre2_context PCRE2_ADDWIDTH(pcre2_context_)
+#define pcre2_match_data PCRE2_ADDWIDTH(pcre2_match_data_)
+
+/* Functions */
+
+#define pcre2_compile PCRE2_ADDWIDTH(pcre2_compile_)
+#define pcre2_config PCRE2_ADDWIDTH(pcre2_config_)
+#define pcre2_context_size PCRE2_ADDWIDTH(pcre2_context_size_)
+#define pcre2_copy_context PCRE2_ADDWIDTH(pcre2_copy_context_)
+#define pcre2_copy_named_substring PCRE2_ADDWIDTH(pcre2_copy_named_substring_)
+#define pcre2_copy_substring PCRE2_ADDWIDTH(pcre2_copy_substring_)
+#define pcre2_create_match_data PCRE2_ADDWIDTH(pcre2_create_match_data_)
+#define pcre2_dfa_exec PCRE2_ADDWIDTH(pcre2_dfa_exec_)
+#define pcre2_exec PCRE2_ADDWIDTH(pcre2_exec_)
+#define pcre2_free_compiled_code PCRE2_ADDWIDTH(pcre2_free_compiled_code_)
+#define pcre2_free_context PCRE2_ADDWIDTH(pcre2_free_context_)
+#define pcre2_free_match_data PCRE2_ADDWIDTH(pcre2_free_match_data_)
+#define pcre2_free_substring PCRE2_ADDWIDTH(pcre2_free_substring_)
+#define pcre2_free_substring_list PCRE2_ADDWIDTH(pcre2_free_substring_list_)
+#define pcre2_get_bsr_convention PCRE2_ADDWIDTH(pcre2_get_bsr_convention_)
+#define pcre2_get_callout PCRE2_ADDWIDTH(pcre2_get_callout_)
+#define pcre2_get_character_tables PCRE2_ADDWIDTH(pcre2_get_character_tables_)
+#define pcre2_get_context_options PCRE2_ADDWIDTH(pcre2_get_context_options_)
+#define pcre2_get_error_message PCRE2_ADDWIDTH(pcre2_get_error_message_)
+#define pcre2_get_error_offset PCRE2_ADDWIDTH(pcre2_get_error_offset_)
+#define pcre2_get_error_reason PCRE2_ADDWIDTH(pcre2_get_error_reason_)
+#define pcre2_get_info PCRE2_ADDWIDTH(pcre2_get_info_)
+#define pcre2_get_leftchar PCRE2_ADDWIDTH(pcre2_get_leftchar_)
+#define pcre2_get_mark PCRE2_ADDWIDTH(pcre2_get_mark_)
+#define pcre2_get_match_limit PCRE2_ADDWIDTH(pcre2_get_match_limit_)
+#define pcre2_get_memory_management PCRE2_ADDWIDTH(pcre2_get_memory_management_)
+#define pcre2_get_named_substring PCRE2_ADDWIDTH(pcre2_get_named_substring_)
+#define pcre2_get_named_substring_length PCRE2_ADDWIDTH(pcre2_get_named_substring_length_)
+#define pcre2_get_newline_convention PCRE2_ADDWIDTH(pcre2_get_newline_convention_)
+#define pcre2_get_ovector PCRE2_ADDWIDTH(pcre2_get_ovector_)
+#define pcre2_get_ovector_slots PCRE2_ADDWIDTH(pcre2_get_ovector_slots_)
+#define pcre2_get_parens_nest_limit PCRE2_ADDWIDTH(pcre2_get_parens_nest_limit_)
+#define pcre2_get_recursion_guard PCRE2_ADDWIDTH(pcre2_get_recursion_guard_)
+#define pcre2_get_recursion_limit PCRE2_ADDWIDTH(pcre2_get_recursion_limit_)
+#define pcre2_get_recursion_memory_management PCRE2_ADDWIDTH(pcre2_get_recursion_memory_management_)
+#define pcre2_get_rightchar PCRE2_ADDWIDTH(pcre2_get_rightchar_)
+#define pcre2_get_startchar PCRE2_ADDWIDTH(pcre2_get_startchar_)
+#define pcre2_get_stringtable_entries PCRE2_ADDWIDTH(pcre2_get_stringtable_entries_)
+#define pcre2_get_substring PCRE2_ADDWIDTH(pcre2_get_substring_)
+#define pcre2_get_substring_length PCRE2_ADDWIDTH(pcre2_get_substring_length_)
+#define pcre2_get_substring_list PCRE2_ADDWIDTH(pcre2_get_substring_list_)
+#define pcre2_get_substring_number PCRE2_ADDWIDTH(pcre2_get_substring_number_)
+#define pcre2_get_user_data PCRE2_ADDWIDTH(pcre2_get_user_data_)
+#define pcre2_init_context PCRE2_ADDWIDTH(pcre2_init_context_)
+#define pcre2_jit_compile PCRE2_ADDWIDTH(pcre2_jit_compile_)
+#define pcre2_jit_exec PCRE2_ADDWIDTH(pcre2_jit_exec_)
+#define pcre2_jit_free_unused_memory PCRE2_ADDWIDTH(pcre2_jit_free_unused_memory_)
+#define pcre2_jit_stack_alloc PCRE2_ADDWIDTH(pcre2_jit_stack_alloc_)
+#define pcre2_jit_stack_assign PCRE2_ADDWIDTH(pcre2_jit_stack_assign_)
+#define pcre2_jit_stack_free PCRE2_ADDWIDTH(pcre2_jit_stack_free_)
+#define pcre2_maketables PCRE2_ADDWIDTH(pcre2_maketables_)
+#define pcre2_pattern_to_host_byte_order PCRE2_ADDWIDTH(pcre2_pattern_to_host_byte_order_)
+#define pcre2_set_bsr_convention PCRE2_ADDWIDTH(pcre2_set_bsr_convention_)
+#define pcre2_set_callout PCRE2_ADDWIDTH(pcre2_set_callout_)
+#define pcre2_set_character_tables PCRE2_ADDWIDTH(pcre2_set_character_tables_)
+#define pcre2_set_context_options PCRE2_ADDWIDTH(pcre2_set_context_options_)
+#define pcre2_set_match_limit PCRE2_ADDWIDTH(pcre2_set_match_limit_)
+#define pcre2_set_memory_management PCRE2_ADDWIDTH(pcre2_set_memory_management_)
+#define pcre2_set_newline_convention PCRE2_ADDWIDTH(pcre2_set_newline_convention_)
+#define pcre2_set_recursion_guard PCRE2_ADDWIDTH(pcre2_set_recursion_guard_)
+#define pcre2_set_parens_nest_limit PCRE2_ADDWIDTH(pcre2_set_parens_nest_limit_)
+#define pcre2_set_recursion_limit PCRE2_ADDWIDTH(pcre2_set_recursion_limit_)
+#define pcre2_set_recursion_memory_management PCRE2_ADDWIDTH(pcre2_set_recursion_memory_management_)
+#define pcre2_set_user_data PCRE2_ADDWIDTH(pcre2_set_user_data_)
+#define pcre2_version PCRE2_ADDWIDTH(pcre2_version_)
+
+/* Now generate all three sets of width-specific structures and function
+prototypes. */
+
+#define PCRE2_LOCAL_WIDTH 8
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#define PCRE2_LOCAL_WIDTH 16
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#define PCRE2_LOCAL_WIDTH 32
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#undef PCRE2_TYPES_LIST
+#undef PCRE2_STRUCTURE_LIST
+#undef PCRE2_FUNCTION_LIST
+#undef PCRE2_ADDWIDTH
+
+/* Re-define PCRE2_ADDWIDTH to use the external width value, if defined.
+Otherwise, undefine the other macros and make PCRE2_ADDWIDTH a no-op, to reduce
+confusion. */
+
+#ifdef PCRE2_DATA_WIDTH
+#if PCRE2_DATA_WIDTH != 8 && PCRE2_DATA_WIDTH != 16 && PCRE2_DATA_WIDTH != 32
+#error PCRE2_DATA_WIDTH must be 8, 16, or 32
+#endif
+#define PCRE2_ADDWIDTH(a) PCRE2_GLUE(a,PCRE2_DATA_WIDTH)
+#else
+#undef PCRE2_JOIN
+#undef PCRE2_GLUE
+#define PCRE2_ADDWIDTH(a) a
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* End of pcre2.h */
diff --git a/src/pcre2.h.in b/src/pcre2.h.in
new file mode 100644
index 0000000..c2d35ab
--- /dev/null
+++ b/src/pcre2.h.in
@@ -0,0 +1,594 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* This is the public header file for the PCRE library, second API, to be
+#included by applications that call PCRE2 functions.
+
+ Copyright (c) 2014 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _PCRE2_H
+#define _PCRE2_H
+
+/* The current PCRE version information. */
+
+#define PCRE2_MAJOR @PCRE2_MAJOR@
+#define PCRE2_MINOR @PCRE2_MINOR@
+#define PCRE2_PRERELEASE @PCRE2_PRERELEASE@
+#define PCRE2_DATE @PCRE2_DATE@
+
+/* When an application links to a PCRE DLL in Windows, the symbols that are
+imported have to be identified as such. When building PCRE, the appropriate
+export setting is defined in pcre2_internal.h, which includes this file. So we
+don't change existing definitions of PCRE2_EXP_DECL. */
+
+#if defined(_WIN32) && !defined(PCRE2_STATIC)
+# ifndef PCRE2_EXP_DECL
+# define PCRE2_EXP_DECL extern __declspec(dllimport)
+# endif
+#endif
+
+/* By default, we use the standard "extern" declarations. */
+
+#ifndef PCRE2_EXP_DECL
+# ifdef __cplusplus
+# define PCRE2_EXP_DECL extern "C"
+# else
+# define PCRE2_EXP_DECL extern
+# endif
+#endif
+
+/* Have to include stdlib.h and stdint.h to ensure that size_t and uint8_t etc
+are defined. */
+
+#include <stdlib.h>
+#include <stdint.h>
+
+/* Allow for C++ users compiling this directly. */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Public options. Those in the context may affect compilation, JIT
+compilation, and/or interpretive execution. The following tags indicate which:
+
+C alters what is compiled
+J alters what JIT compiles
+E affects pcre_exec() execution
+D affects pcre_dfa_exec() execution
+*/
+
+/* The first group of options are those that are set in the context. */
+
+#define PCRE2_ALT_BSUX 0x00000001 /* C */
+#define PCRE2_DOLLAR_ENDONLY 0x00000002 /* J E D */
+#define PCRE2_DUPNAMES 0x00000004 /* C */
+#define PCRE2_ALLOW_EMPTY_CLASS 0x00000008 /* C */
+#define PCRE2_MATCH_UNSET_BACKREF 0x00000010 /* C J E */
+#define PCRE2_NEVER_UTF 0x00000020 /* C */
+#define PCRE2_NEVER_UCP 0x00000040 /* C */
+#define PCRE2_UTF 0x00000080 /* C J E D */
+#define PCRE2_UCP 0x00000100 /* C J E D */
+
+/* The following can be passed to pcre2_compile(), pcre2_exec(), or
+pcre2_dfa_exec(). PCRE2_NO_UTF_CHECK affects only the function to which it is
+passed. */
+
+#define PCRE2_ANCHORED 0x00000001
+#define PCRE2_NO_START_OPTIMIZE 0x00000002
+#define PCRE2_NO_UTF_CHECK 0x00000004
+
+/* These are for pcre2_compile() only, affecting what is compiled, but not
+otherwise affecting execution. */
+
+#define PCRE2_AUTO_CALLOUT 0x00000100
+#define PCRE2_CASELESS 0x00000200
+#define PCRE2_DOTALL 0x00000400
+#define PCRE2_EXTENDED 0x00000800
+#define PCRE2_MULTILINE 0x00001000
+#define PCRE2_NO_AUTO_CAPTURE 0x00002000
+#define PCRE2_NO_AUTO_POSSESS 0x00004000
+#define PCRE2_UNGREEDY 0x00008000
+
+/* This pcre2_compile() option affects JIT compilation and interpretive
+execution. */
+
+#define PCRE2_FIRSTLINE 0x00010000
+
+/* These are for pcre2_jit_compile(). */
+
+#define PCRE2_JIT 0x00020000
+#define PCRE2_JIT_PARTIAL_SOFT 0x00040000
+#define PCRE2_JIT_PARTIAL_HARD 0x00080000
+
+/* These are for pcre2_exec() and pcre2_dfa_exec(). */
+
+#define PCRE2_NOTBOL 0x00000100
+#define PCRE2_NOTEOL 0x00000200
+#define PCRE2_NOTEMPTY 0x00000400
+#define PCRE2_NOTEMPTY_ATSTART 0x00000800
+#define PCRE2_PARTIAL_SOFT 0x00001000
+#define PCRE2_PARTIAL_HARD 0x00002000
+
+/* These are additional options for pcre2_dfa_exec(). */
+
+#define PCRE2_DFA_RESTART 0x00010000
+#define PCRE2_DFA_SHORTEST 0x00020000
+
+/* Newline and \R settings, for use in the context. */
+
+#define PCRE2_NEWLINE_CR 0x00000001
+#define PCRE2_NEWLINE_LF 0x00000002
+#define PCRE2_NEWLINE_CRLF 0x00000004
+#define PCRE2_NEWLINE_ANY 0x00000008
+#define PCRE2_NEWLINE_ANYCRLF 0x00000010
+
+#define PCRE2_BSR_ANYCRLF 0x00000020
+#define PCRE2_BSR_UNICODE 0x00000040
+
+/* Exec-time and get/set-time error codes */
+
+#define PCRE2_ERROR_NOMATCH (-1)
+#define PCRE2_ERROR_NULL (-2)
+#define PCRE2_ERROR_BADOPTION (-3)
+#define PCRE2_ERROR_BADMAGIC (-4)
+#define PCRE2_ERROR_UNKNOWN_OPCODE (-5)
+#define PCRE2_ERROR_NOMEMORY (-6)
+#define PCRE2_ERROR_NOSUBSTRING (-7)
+#define PCRE2_ERROR_MATCHLIMIT (-8)
+#define PCRE2_ERROR_CALLOUT (-9) /* Never used by PCRE2 itself */
+#define PCRE2_ERROR_BADUTF (-10)
+#define PCRE2_ERROR_BADUTF_OFFSET (-11)
+#define PCRE2_ERROR_PARTIAL (-12)
+#define PCRE2_ERROR_BADPARTIAL (-13)
+#define PCRE2_ERROR_INTERNAL (-14)
+#define PCRE2_ERROR_BADCOUNT (-15)
+#define PCRE2_ERROR_DFA_UITEM (-16)
+#define PCRE2_ERROR_DFA_UCOND (-17)
+#define PCRE2_ERROR_DFA_UMLIMIT (-18)
+#define PCRE2_ERROR_DFA_WSSIZE (-19)
+#define PCRE2_ERROR_DFA_RECURSE (-20)
+#define PCRE2_ERROR_RECURSIONLIMIT (-21)
+#define PCRE2_ERROR_BADNEWLINE (-22)
+#define PCRE2_ERROR_BADOFFSET (-23)
+#define PCRE2_ERROR_SHORTUTF (-24)
+#define PCRE2_ERROR_RECURSELOOP (-25)
+#define PCRE2_ERROR_JIT_STACKLIMIT (-26)
+#define PCRE2_ERROR_BADMODE (-27)
+#define PCRE2_ERROR_BADENDIANNESS (-28)
+#define PCRE2_ERROR_DFA_BADRESTART (-29)
+#define PCRE2_ERROR_JIT_BADOPTION (-30)
+#define PCRE2_ERROR_BADLENGTH (-31)
+#define PCRE2_ERROR_UNSET (-32)
+
+/* Specific error codes for UTF-8 validity checks */
+
+#define PCRE2_UTF8_ERR0 0
+#define PCRE2_UTF8_ERR1 1
+#define PCRE2_UTF8_ERR2 2
+#define PCRE2_UTF8_ERR3 3
+#define PCRE2_UTF8_ERR4 4
+#define PCRE2_UTF8_ERR5 5
+#define PCRE2_UTF8_ERR6 6
+#define PCRE2_UTF8_ERR7 7
+#define PCRE2_UTF8_ERR8 8
+#define PCRE2_UTF8_ERR9 9
+#define PCRE2_UTF8_ERR10 10
+#define PCRE2_UTF8_ERR11 11
+#define PCRE2_UTF8_ERR12 12
+#define PCRE2_UTF8_ERR13 13
+#define PCRE2_UTF8_ERR14 14
+#define PCRE2_UTF8_ERR15 15
+#define PCRE2_UTF8_ERR16 16
+#define PCRE2_UTF8_ERR17 17
+#define PCRE2_UTF8_ERR18 18
+#define PCRE2_UTF8_ERR19 19
+#define PCRE2_UTF8_ERR20 20
+#define PCRE2_UTF8_ERR21 21
+
+/* Specific error codes for UTF-16 validity checks */
+
+#define PCRE2_UTF16_ERR0 0
+#define PCRE2_UTF16_ERR1 1
+#define PCRE2_UTF16_ERR2 2
+#define PCRE2_UTF16_ERR3 3
+
+/* Specific error codes for UTF-32 validity checks */
+
+#define PCRE2_UTF32_ERR0 0
+#define PCRE2_UTF32_ERR1 1
+#define PCRE2_UTF32_ERR3 2
+
+/* Request types for pcre2_get_info() */
+
+#define PCRE2_INFO_BACKREFMAX 0
+#define PCRE2_INFO_CAPTURECOUNT 1
+#define PCRE2_INFO_COMPILE_OPTIONS 2
+#define PCRE2_INFO_FIRSTCODEUNIT 3
+#define PCRE2_INFO_FIRSTCODETYPE 4
+#define PCRE2_INFO_FIRSTTABLE 5
+#define PCRE2_INFO_HASCRORLF 6
+#define PCRE2_INFO_JCHANGED 7
+#define PCRE2_INFO_JIT 8
+#define PCRE2_INFO_JITSIZE 9
+#define PCRE2_INFO_LASTCODEUNIT 10
+#define PCRE2_INFO_LASTCODETYPE 11
+#define PCRE2_INFO_MATCH_EMPTY 12
+#define PCRE2_INFO_MATCHLIMIT 13
+#define PCRE2_INFO_MAXLOOKBEHIND 14
+#define PCRE2_INFO_MINLENGTH 15
+#define PCRE2_INFO_NAMECOUNT 16
+#define PCRE2_INFO_NAMEENTRYSIZE 17
+#define PCRE2_INFO_NAMETABLE 18
+#define PCRE2_INFO_PATTERN_OPTIONS 19
+#define PCRE2_INFO_RECURSIONLIMIT 20
+#define PCRE2_INFO_SIZE 21
+
+/* Request types for pcre2_config(). */
+
+#define PCRE2_CONFIG_BSR 0
+#define PCRE2_CONFIG_JIT 1
+#define PCRE2_CONFIG_JITTARGET 2
+#define PCRE2_CONFIG_LINK_SIZE 3
+#define PCRE2_CONFIG_MATCH_LIMIT 4
+#define PCRE2_CONFIG_MATCH_LIMIT_RECURSION 5
+#define PCRE2_CONFIG_NEWLINE 6
+#define PCRE2_CONFIG_PARENS_LIMIT 7
+#define PCRE2_CONFIG_POSIX_MALLOC_THRESHOLD 8
+#define PCRE2_CONFIG_STACKRECURSE 9
+#define PCRE2_CONFIG_UTF 10
+
+/* Types for patterns and subject strings. */
+
+typedef uint8_t PCRE2_UCHAR8;
+typedef uint16_t PCRE2_UCHAR16;
+typedef uint32_t PCRE2_UCHAR32;
+
+typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
+typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
+typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
+
+/* Generic types for opaque structures and JIT callback functions. These
+declarations are defined in a macro that is expanded for each width later. */
+
+#define PCRE2_TYPES_LIST \
+struct pcre2_real_context; \
+typedef struct pcre2_real_context pcre2_context; \
+\
+struct pcre2_real; \
+typedef struct pcre2_real pcre2; \
+\
+struct pcre2_real_match_data; \
+typedef struct pcre2_real_match_data pcre2_match_data; \
+\
+struct pcre2_real_jit_stack; \
+typedef struct pcre2_real_jit_stack pcre2_jit_stack; \
+\
+typedef pcre2_jit_stack *(*pcre2_jit_callback)(void *);
+
+/* The structure for passing out data via the pcre_callout_function. We use a
+structure so that new fields can be added on the end in future versions,
+without changing the API of the function, thereby allowing old clients to work
+without modification. Define the generic version in a macro; the width-specific
+versions are generated from this macro below. */
+
+#define PCRE2_STRUCTURE_LIST \
+typedef struct pcre2_callout_block { \
+ int version; /* Identifies version of block */ \
+ /* ------------------------ Version 0 ------------------------------- */ \
+ int callout_number; /* Number compiled into pattern */ \
+ int *offset_vector; /* The offset vector */ \
+ PCRE2_SPTR subject; /* The subject being matched */ \
+ int subject_length; /* The length of the subject */ \
+ int start_match; /* Offset to start of this match attempt */ \
+ int current_position; /* Where we currently are in the subject */ \
+ int capture_top; /* Max current capture */ \
+ int capture_last; /* Most recently closed capture */ \
+ void *callout_data; /* Data passed in with the call */ \
+ /* ------------------- Added for Version 1 -------------------------- */ \
+ int pattern_position; /* Offset to next item in the pattern */ \
+ int next_item_length; /* Length of next item in the pattern */ \
+ /* ------------------- Added for Version 2 -------------------------- */ \
+ PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
+ /* ------------------------------------------------------------------ */ \
+} pcre2_callout_block;
+
+/* Utility functions for byte order swaps. These are not generic functions;
+each appears only its own library. */
+
+PCRE2_EXP_DECL int pcre2_utf16_to_host_byte_order(PCRE2_UCHAR16 *,
+ PCRE2_SPTR16, int, int *, int);
+PCRE2_EXP_DECL int pcre2_utf32_to_host_byte_order(PCRE2_UCHAR32 *,
+ PCRE2_SPTR32, int, int *, int);
+
+/* List the generic forms of all other functions in a macro. */
+
+#define PCRE2_FUNCTION_LIST \
+PCRE2_EXP_DECL pcre2 *pcre2_compile(pcre2_context *, PCRE2_SPTR, int, \
+ uint32_t, int *, size_t *); \
+PCRE2_EXP_DECL int pcre2_config(int, void *); \
+PCRE2_EXP_DECL size_t pcre2_context_size(void); \
+PCRE2_EXP_DECL \
+ pcre2_context *pcre2_copy_context(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_copy_named_substring(pcre2_match_data *, \
+ PCRE2_SPTR, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL int pcre2_copy_substring(pcre2_match_data *, int, \
+ PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL \
+ pcre2_match_data *pcre2_create_match_data(pcre2_context *, size_t); \
+PCRE2_EXP_DECL int pcre2_dfa_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *, int *, size_t); \
+PCRE2_EXP_DECL int pcre2_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *); \
+PCRE2_EXP_DECL void pcre2_free_compiled_code(pcre2_context *, pcre2 *); \
+PCRE2_EXP_DECL void pcre2_free_context(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_free_match_data(pcre2_context *, \
+ pcre2_match_data *); \
+PCRE2_EXP_DECL void pcre2_free_substring(pcre2_context *, PCRE2_SPTR); \
+PCRE2_EXP_DECL void pcre2_free_substring_list(pcre2_context *, \
+ PCRE2_SPTR *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_bsr_convention(pcre2_context *); \
+PCRE2_EXP_DECL int (*pcre2_get_callout(pcre2_context *)) \
+ (pcre2_callout_block *, void *); \
+PCRE2_EXP_DECL \
+ unsigned char *pcre2_get_character_tables(pcre2_context *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_context_options(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL size_t pcre2_get_error_offset(pcre2_match_data *); \
+PCRE2_EXP_DECL int pcre2_get_error_reason(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t pcre2_get_exec_frame_size(void); \
+PCRE2_EXP_DECL int pcre2_get_info(const pcre2 *, uint32_t, void *); \
+PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
+PCRE2_EXP_DECL \
+ PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_match_limit(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_get_memory_management(pcre2_context *, \
+ void *(**)(size_t, void *), \
+ void (**)(void *, void *)); \
+PCRE2_EXP_DECL int pcre2_get_named_substring(pcre2_context *, \
+ pcre2_match_data *, PCRE2_SPTR, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_named_substring_length(pcre2_match_data *, \
+ PCRE2_SPTR); \
+PCRE2_EXP_DECL uint32_t pcre2_get_newline_convention(pcre2_context *); \
+PCRE2_EXP_DECL size_t *pcre2_get_ovector(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t *pcre2_get_ovector_slots(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_parens_nest_limit(pcre2_context *); \
+PCRE2_EXP_DECL int (*pcre2_get_recursion_guard(pcre2_context *)) \
+ (int, void *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_recursion_limit(pcre2_context *); \
+PCRE2_EXP_DECL void pcre2_get_recursion_memory_management(\
+ pcre2_context *, \
+ void *(**)(size_t, void *), \
+ void (**)(void *, void *)); \
+PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
+PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *); \
+PCRE2_EXP_DECL int pcre2_get_stringtable_entries(const pcre2 *, \
+ PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_substring(pcre2_context *, \
+ pcre2_match_data *, int, PCRE2_UCHAR **); \
+PCRE2_EXP_DECL int pcre2_get_substring_length(pcre2_match_data *, int); \
+PCRE2_EXP_DECL int pcre2_get_substring_list(pcre2_context *, \
+ pcre2_match_data *, PCRE2_UCHAR ***); \
+PCRE2_EXP_DECL int pcre2_get_substring_number(const pcre2 *, \
+ PCRE2_SPTR); \
+PCRE2_EXP_DECL void *pcre2_get_user_data(pcre2_context *); \
+PCRE2_EXP_DECL \
+ pcre2_context *pcre2_init_context(pcre2_context *); \
+PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_context *, pcre2 *, \
+ uint32_t); \
+PCRE2_EXP_DECL int pcre2_jit_exec(pcre2_context *, const pcre2 *, \
+ PCRE2_SPTR, int, size_t, uint32_t, \
+ pcre2_match_data *, pcre2_jit_stack *); \
+PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_context *); \
+PCRE2_EXP_DECL \
+ pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_context *, size_t, \
+ size_t); \
+PCRE2_EXP_DECL void pcre2_jit_stack_assign(pcre2_context *, \
+ const pcre2 *, pcre2_jit_callback, void *); \
+PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_context *, \
+ pcre2_jit_stack *); \
+PCRE2_EXP_DECL \
+ const unsigned char *pcre2_maketables(void); \
+PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2 *); \
+PCRE2_EXP_DECL void pcre2_set_bsr_convention(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_callout(pcre2_context *, \
+ int (*)(pcre2_callout_block *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_character_tables(pcre2_context *, \
+ unsigned char *); \
+PCRE2_EXP_DECL void pcre2_set_context_options(pcre2_context *, uint32_t, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_match_limit(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_memory_management(pcre2_context *, \
+ void * (*)(size_t, void *), \
+ void (*)(void *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_newline_convention(pcre2_context *, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_parens_nest_limit(pcre2_context *, \
+ uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_recursion_guard(pcre2_context *, \
+ int (*)(uint32_t, void *)); \
+PCRE2_EXP_DECL void pcre2_set_recursion_limit(pcre2_context *, uint32_t); \
+PCRE2_EXP_DECL void pcre2_set_recursion_memory_management(\
+ pcre2_context *, void * (*)(size_t, void *), \
+ void (*)(void *, void *)); \
+PCRE2_EXP_DECL void pcre2_set_user_data(pcre2_context *, void *); \
+PCRE2_EXP_DECL int pcre2_version(PCRE2_UCHAR *, size_t);
+
+
+/* Define macros that generate width-specific names from generic versions. The
+three-level macro scheme is necessary to get the macros expanded when we want
+them to be. First we get the width from PCRE2_LOCAL_WIDTH, which is used for
+generating three versions of each external function below. After that,
+PCRE2_ADDWIDTH will be re-defined to use PCRE2_DATA_WIDTH, for use when macros
+such as pcre2_compile are called by application code. */
+
+#define PCRE2_JOIN(a,b) a ## b
+#define PCRE2_GLUE(a,b) PCRE2_JOIN(a,b)
+#define PCRE2_ADDWIDTH(a) PCRE2_GLUE(a,PCRE2_LOCAL_WIDTH)
+
+/* Data types */
+
+#define PCRE2_UCHAR PCRE2_ADDWIDTH(PCRE2_UCHAR)
+#define PCRE2_SPTR PCRE2_ADDWIDTH(PCRE2_SPTR)
+
+#define pcre2 PCRE2_ADDWIDTH(pcre2_)
+#define pcre2_jit_callback PCRE2_ADDWIDTH(pcre2_jit_callback_)
+#define pcre2_jit_stack PCRE2_ADDWIDTH(pcre2_jit_stack_)
+
+#define pcre2_real PCRE2_ADDWIDTH(pcre2_real_)
+#define pcre2_real_context PCRE2_ADDWIDTH(pcre2_real_context_)
+#define pcre2_real_jit_stack PCRE2_ADDWIDTH(pcre2_real_jit_stack_)
+#define pcre2_real_match_data PCRE2_ADDWIDTH(pcre2_real_match_data_)
+
+/* Data blocks */
+
+#define pcre2_callout_block PCRE2_ADDWIDTH(pcre2_callout_block_)
+#define pcre2_context PCRE2_ADDWIDTH(pcre2_context_)
+#define pcre2_match_data PCRE2_ADDWIDTH(pcre2_match_data_)
+
+/* Functions */
+
+#define pcre2_compile PCRE2_ADDWIDTH(pcre2_compile_)
+#define pcre2_config PCRE2_ADDWIDTH(pcre2_config_)
+#define pcre2_context_size PCRE2_ADDWIDTH(pcre2_context_size_)
+#define pcre2_copy_context PCRE2_ADDWIDTH(pcre2_copy_context_)
+#define pcre2_copy_named_substring PCRE2_ADDWIDTH(pcre2_copy_named_substring_)
+#define pcre2_copy_substring PCRE2_ADDWIDTH(pcre2_copy_substring_)
+#define pcre2_create_match_data PCRE2_ADDWIDTH(pcre2_create_match_data_)
+#define pcre2_dfa_exec PCRE2_ADDWIDTH(pcre2_dfa_exec_)
+#define pcre2_exec PCRE2_ADDWIDTH(pcre2_exec_)
+#define pcre2_free_compiled_code PCRE2_ADDWIDTH(pcre2_free_compiled_code_)
+#define pcre2_free_context PCRE2_ADDWIDTH(pcre2_free_context_)
+#define pcre2_free_match_data PCRE2_ADDWIDTH(pcre2_free_match_data_)
+#define pcre2_free_substring PCRE2_ADDWIDTH(pcre2_free_substring_)
+#define pcre2_free_substring_list PCRE2_ADDWIDTH(pcre2_free_substring_list_)
+#define pcre2_get_bsr_convention PCRE2_ADDWIDTH(pcre2_get_bsr_convention_)
+#define pcre2_get_callout PCRE2_ADDWIDTH(pcre2_get_callout_)
+#define pcre2_get_character_tables PCRE2_ADDWIDTH(pcre2_get_character_tables_)
+#define pcre2_get_context_options PCRE2_ADDWIDTH(pcre2_get_context_options_)
+#define pcre2_get_error_message PCRE2_ADDWIDTH(pcre2_get_error_message_)
+#define pcre2_get_error_offset PCRE2_ADDWIDTH(pcre2_get_error_offset_)
+#define pcre2_get_error_reason PCRE2_ADDWIDTH(pcre2_get_error_reason_)
+#define pcre2_get_info PCRE2_ADDWIDTH(pcre2_get_info_)
+#define pcre2_get_leftchar PCRE2_ADDWIDTH(pcre2_get_leftchar_)
+#define pcre2_get_mark PCRE2_ADDWIDTH(pcre2_get_mark_)
+#define pcre2_get_match_limit PCRE2_ADDWIDTH(pcre2_get_match_limit_)
+#define pcre2_get_memory_management PCRE2_ADDWIDTH(pcre2_get_memory_management_)
+#define pcre2_get_named_substring PCRE2_ADDWIDTH(pcre2_get_named_substring_)
+#define pcre2_get_named_substring_length PCRE2_ADDWIDTH(pcre2_get_named_substring_length_)
+#define pcre2_get_newline_convention PCRE2_ADDWIDTH(pcre2_get_newline_convention_)
+#define pcre2_get_ovector PCRE2_ADDWIDTH(pcre2_get_ovector_)
+#define pcre2_get_ovector_slots PCRE2_ADDWIDTH(pcre2_get_ovector_slots_)
+#define pcre2_get_parens_nest_limit PCRE2_ADDWIDTH(pcre2_get_parens_nest_limit_)
+#define pcre2_get_recursion_guard PCRE2_ADDWIDTH(pcre2_get_recursion_guard_)
+#define pcre2_get_recursion_limit PCRE2_ADDWIDTH(pcre2_get_recursion_limit_)
+#define pcre2_get_recursion_memory_management PCRE2_ADDWIDTH(pcre2_get_recursion_memory_management_)
+#define pcre2_get_rightchar PCRE2_ADDWIDTH(pcre2_get_rightchar_)
+#define pcre2_get_startchar PCRE2_ADDWIDTH(pcre2_get_startchar_)
+#define pcre2_get_stringtable_entries PCRE2_ADDWIDTH(pcre2_get_stringtable_entries_)
+#define pcre2_get_substring PCRE2_ADDWIDTH(pcre2_get_substring_)
+#define pcre2_get_substring_length PCRE2_ADDWIDTH(pcre2_get_substring_length_)
+#define pcre2_get_substring_list PCRE2_ADDWIDTH(pcre2_get_substring_list_)
+#define pcre2_get_substring_number PCRE2_ADDWIDTH(pcre2_get_substring_number_)
+#define pcre2_get_user_data PCRE2_ADDWIDTH(pcre2_get_user_data_)
+#define pcre2_init_context PCRE2_ADDWIDTH(pcre2_init_context_)
+#define pcre2_jit_compile PCRE2_ADDWIDTH(pcre2_jit_compile_)
+#define pcre2_jit_exec PCRE2_ADDWIDTH(pcre2_jit_exec_)
+#define pcre2_jit_free_unused_memory PCRE2_ADDWIDTH(pcre2_jit_free_unused_memory_)
+#define pcre2_jit_stack_alloc PCRE2_ADDWIDTH(pcre2_jit_stack_alloc_)
+#define pcre2_jit_stack_assign PCRE2_ADDWIDTH(pcre2_jit_stack_assign_)
+#define pcre2_jit_stack_free PCRE2_ADDWIDTH(pcre2_jit_stack_free_)
+#define pcre2_maketables PCRE2_ADDWIDTH(pcre2_maketables_)
+#define pcre2_pattern_to_host_byte_order PCRE2_ADDWIDTH(pcre2_pattern_to_host_byte_order_)
+#define pcre2_set_bsr_convention PCRE2_ADDWIDTH(pcre2_set_bsr_convention_)
+#define pcre2_set_callout PCRE2_ADDWIDTH(pcre2_set_callout_)
+#define pcre2_set_character_tables PCRE2_ADDWIDTH(pcre2_set_character_tables_)
+#define pcre2_set_context_options PCRE2_ADDWIDTH(pcre2_set_context_options_)
+#define pcre2_set_match_limit PCRE2_ADDWIDTH(pcre2_set_match_limit_)
+#define pcre2_set_memory_management PCRE2_ADDWIDTH(pcre2_set_memory_management_)
+#define pcre2_set_newline_convention PCRE2_ADDWIDTH(pcre2_set_newline_convention_)
+#define pcre2_set_recursion_guard PCRE2_ADDWIDTH(pcre2_set_recursion_guard_)
+#define pcre2_set_parens_nest_limit PCRE2_ADDWIDTH(pcre2_set_parens_nest_limit_)
+#define pcre2_set_recursion_limit PCRE2_ADDWIDTH(pcre2_set_recursion_limit_)
+#define pcre2_set_recursion_memory_management PCRE2_ADDWIDTH(pcre2_set_recursion_memory_management_)
+#define pcre2_set_user_data PCRE2_ADDWIDTH(pcre2_set_user_data_)
+#define pcre2_version PCRE2_ADDWIDTH(pcre2_version_)
+
+/* Now generate all three sets of width-specific structures and function
+prototypes. */
+
+#define PCRE2_LOCAL_WIDTH 8
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#define PCRE2_LOCAL_WIDTH 16
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#define PCRE2_LOCAL_WIDTH 32
+PCRE2_TYPES_LIST
+PCRE2_STRUCTURE_LIST
+PCRE2_FUNCTION_LIST
+#undef PCRE2_LOCAL_WIDTH
+
+#undef PCRE2_TYPES_LIST
+#undef PCRE2_STRUCTURE_LIST
+#undef PCRE2_FUNCTION_LIST
+#undef PCRE2_ADDWIDTH
+
+/* Re-define PCRE2_ADDWIDTH to use the external width value, if defined.
+Otherwise, undefine the other macros and make PCRE2_ADDWIDTH a no-op, to reduce
+confusion. */
+
+#ifdef PCRE2_DATA_WIDTH
+#if PCRE2_DATA_WIDTH != 8 && PCRE2_DATA_WIDTH != 16 && PCRE2_DATA_WIDTH != 32
+#error PCRE2_DATA_WIDTH must be 8, 16, or 32
+#endif
+#define PCRE2_ADDWIDTH(a) PCRE2_GLUE(a,PCRE2_DATA_WIDTH)
+#else
+#undef PCRE2_JOIN
+#undef PCRE2_GLUE
+#define PCRE2_ADDWIDTH(a) a
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* End of pcre2.h */
diff --git a/src/pcre2_chartables.c b/src/pcre2_chartables.c
new file mode 120000
index 0000000..ed9b54c
--- /dev/null
+++ b/src/pcre2_chartables.c
@@ -0,0 +1 @@
+./pcre2_chartables.c.dist \ No newline at end of file
diff --git a/src/pcre2_chartables.c.dist b/src/pcre2_chartables.c.dist
new file mode 100644
index 0000000..0ffa098
--- /dev/null
+++ b/src/pcre2_chartables.c.dist
@@ -0,0 +1,198 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* This file contains character tables that are used when no external tables
+are passed to PCRE by the application that calls it. The tables are used only
+for characters whose code values are less than 256.
+
+This is a default version of the tables that assumes ASCII encoding. A program
+called dftables (which is distributed with PCRE) can be used to build
+alternative versions of this file. This is necessary if you are running in an
+EBCDIC environment, or if you want to default to a different encoding, for
+example ISO-8859-1. When dftables is run, it creates these tables in the
+current locale. If PCRE is configured with --enable-rebuild-chartables, this
+happens automatically.
+
+The following #includes are present because without them gcc 4.x may remove the
+array definition from the final binary if PCRE is built into a static library
+and dead code stripping is activated. This leads to link errors. Pulling in the
+header ensures that the array gets flagged as "someone outside this compilation
+unit might reference this" and so it will always be supplied to the linker. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pcre2_internal.h"
+
+const uint8_t PRIV(default_tables)[] = {
+
+/* This table is a lower casing table. */
+
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 97, 98, 99,100,101,102,103,
+ 104,105,106,107,108,109,110,111,
+ 112,113,114,115,116,117,118,119,
+ 120,121,122, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99,100,101,102,103,
+ 104,105,106,107,108,109,110,111,
+ 112,113,114,115,116,117,118,119,
+ 120,121,122,123,124,125,126,127,
+ 128,129,130,131,132,133,134,135,
+ 136,137,138,139,140,141,142,143,
+ 144,145,146,147,148,149,150,151,
+ 152,153,154,155,156,157,158,159,
+ 160,161,162,163,164,165,166,167,
+ 168,169,170,171,172,173,174,175,
+ 176,177,178,179,180,181,182,183,
+ 184,185,186,187,188,189,190,191,
+ 192,193,194,195,196,197,198,199,
+ 200,201,202,203,204,205,206,207,
+ 208,209,210,211,212,213,214,215,
+ 216,217,218,219,220,221,222,223,
+ 224,225,226,227,228,229,230,231,
+ 232,233,234,235,236,237,238,239,
+ 240,241,242,243,244,245,246,247,
+ 248,249,250,251,252,253,254,255,
+
+/* This table is a case flipping table. */
+
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 97, 98, 99,100,101,102,103,
+ 104,105,106,107,108,109,110,111,
+ 112,113,114,115,116,117,118,119,
+ 120,121,122, 91, 92, 93, 94, 95,
+ 96, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79,
+ 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90,123,124,125,126,127,
+ 128,129,130,131,132,133,134,135,
+ 136,137,138,139,140,141,142,143,
+ 144,145,146,147,148,149,150,151,
+ 152,153,154,155,156,157,158,159,
+ 160,161,162,163,164,165,166,167,
+ 168,169,170,171,172,173,174,175,
+ 176,177,178,179,180,181,182,183,
+ 184,185,186,187,188,189,190,191,
+ 192,193,194,195,196,197,198,199,
+ 200,201,202,203,204,205,206,207,
+ 208,209,210,211,212,213,214,215,
+ 216,217,218,219,220,221,222,223,
+ 224,225,226,227,228,229,230,231,
+ 232,233,234,235,236,237,238,239,
+ 240,241,242,243,244,245,246,247,
+ 248,249,250,251,252,253,254,255,
+
+/* This table contains bit maps for various character classes. Each map is 32
+bytes long and the bits run from the least significant end of each byte. The
+classes that have their own maps are: space, xdigit, digit, upper, lower, word,
+graph, print, punct, and cntrl. Other classes are built from combinations. */
+
+ 0x00,0x3e,0x00,0x00,0x01,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+ 0x7e,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xfe,0xff,0xff,0x07,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x03,
+ 0xfe,0xff,0xff,0x87,0xfe,0xff,0xff,0x07,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0x00,0x00,0x00,0x00,0xfe,0xff,0x00,0xfc,
+ 0x01,0x00,0x00,0xf8,0x01,0x00,0x00,0x78,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+ 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+
+/* This table identifies various classes of character by individual bits:
+ 0x01 white space character
+ 0x02 letter
+ 0x04 decimal digit
+ 0x08 hexadecimal digit
+ 0x10 alphanumeric or '_'
+ 0x80 regular expression metacharacter or binary zero
+*/
+
+ 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0- 7 */
+ 0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00, /* 8- 15 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 16- 23 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 24- 31 */
+ 0x01,0x00,0x00,0x00,0x80,0x00,0x00,0x00, /* - ' */
+ 0x80,0x80,0x80,0x80,0x00,0x00,0x80,0x00, /* ( - / */
+ 0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c,0x1c, /* 0 - 7 */
+ 0x1c,0x1c,0x00,0x00,0x00,0x00,0x00,0x80, /* 8 - ? */
+ 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* @ - G */
+ 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* H - O */
+ 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* P - W */
+ 0x12,0x12,0x12,0x80,0x80,0x00,0x80,0x10, /* X - _ */
+ 0x00,0x1a,0x1a,0x1a,0x1a,0x1a,0x1a,0x12, /* ` - g */
+ 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* h - o */
+ 0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12, /* p - w */
+ 0x12,0x12,0x12,0x80,0x80,0x00,0x00,0x00, /* x -127 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 128-135 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 136-143 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 144-151 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 152-159 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 160-167 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 168-175 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 176-183 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 184-191 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 192-199 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 200-207 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 208-215 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 216-223 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 224-231 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 232-239 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 240-247 */
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};/* 248-255 */
+
+/* End of pcre2_chartables.c */
diff --git a/src/pcre2_internal.h b/src/pcre2_internal.h
new file mode 100644
index 0000000..08dd360
--- /dev/null
+++ b/src/pcre2_internal.h
@@ -0,0 +1,14 @@
+/* This is a placeholder, just enough to allow dummy functions to compile */
+#include <ctype.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pcre2.h"
+
+#define PUBL(name) pcre_##name
+#define PRIV(name) _pcre_##name
+
diff --git a/src/pcre2_version.c b/src/pcre2_version.c
new file mode 100644
index 0000000..94168b9
--- /dev/null
+++ b/src/pcre2_version.c
@@ -0,0 +1,103 @@
+/*************************************************
+* Perl-Compatible Regular Expressions *
+*************************************************/
+
+/* PCRE is a library of functions to support regular expressions whose syntax
+and semantics are as close as possible to those of the Perl 5 language.
+
+ Written by Philip Hazel
+ Original API code Copyright (c) 1997-2012 University of Cambridge
+ New API code Copyright (c) 2014 University of Cambridge
+
+-----------------------------------------------------------------------------
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the University of Cambridge nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+-----------------------------------------------------------------------------
+*/
+
+
+/* This module contains the external function pcre2_version(), which returns a
+string that identifies the PCRE version that is in use. */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "pcre2_internal.h"
+
+
+/*************************************************
+* Return version string *
+*************************************************/
+
+/* These macros are the standard way of turning unquoted text into C strings.
+They allow macros like PCRE_MAJOR to be defined without quotes, which is
+convenient for user programs that want to test its value. */
+
+#define STRING(a) # a
+#define XSTRING(s) STRING(s)
+
+/* A problem turned up with PCRE_PRERELEASE, which is defined empty for
+production releases. Originally, it was used naively in this code:
+
+ return XSTRING(PCRE_MAJOR)
+ "." XSTRING(PCRE_MINOR)
+ XSTRING(PCRE_PRERELEASE)
+ " " XSTRING(PCRE_DATE);
+
+However, when PCRE_PRERELEASE is empty, this leads to an attempted expansion of
+STRING(). The C standard states: "If (before argument substitution) any
+argument consists of no preprocessing tokens, the behavior is undefined." It
+turns out the gcc treats this case as a single empty string - which is what we
+really want - but Visual C grumbles about the lack of an argument for the
+macro. Unfortunately, both are within their rights. To cope with both ways of
+handling this, I had resort to some messy hackery that does a test at run time.
+I could find no way of detecting that a macro is defined as an empty string at
+pre-processor time. This hack uses a standard trick for avoiding calling
+the STRING macro with an empty argument when doing the test.
+
+Arguments:
+ buffer where to return the version string
+ size size of buffer
+
+Returns: number of characters, excluding trailing zero
+ or PCRE_ERROR_BADLENGTH if buffer too small
+*/
+
+PCRE2_EXP_DEFN int pcre2_version(PCRE2_UCHAR *buffer, size_t size)
+{
+PCRE2_UCHAR *t = buffer;
+const char *v = (XSTRING(Z PCRE2_PRERELEASE)[1] == 0)?
+ XSTRING(PCRE2_MAJOR.PCRE2_MINOR PCRE2_DATE) :
+ XSTRING(PCRE2_MAJOR.PCRE2_MINOR) XSTRING(PCRE2_PRERELEASE PCRE2_DATE);
+if (strlen(v) >= size) return PCRE2_ERROR_BADLENGTH;
+while (*v != 0) *t++ = *v++;
+*t = 0;
+return t - buffer;
+}
+
+/* End of pcre2_version.c */