Merge "Upgrade pcre to pcre2-10.38" am: 20935b73fe

Original change: https://android-review.googlesource.com/c/platform/external/pcre/+/1843561

Change-Id: Ie1839c4d8bc294a480d6310ef75a03bfc2795d05
diff --git a/dist2/132html b/132html
similarity index 100%
rename from dist2/132html
rename to 132html
diff --git a/dist2/AUTHORS b/AUTHORS
similarity index 92%
rename from dist2/AUTHORS
rename to AUTHORS
index c61b5f3..bec8a1e 100644
--- a/dist2/AUTHORS
+++ b/AUTHORS
@@ -5,7 +5,7 @@
 Email local part: Philip.Hazel
 Email domain:     gmail.com
 
-University of Cambridge Computing Service,
+Retired from University of Cambridge Computing Service,
 Cambridge, England.
 
 Copyright (c) 1997-2021 University of Cambridge
diff --git a/Android.bp b/Android.bp
index 742996b..e093177 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,5 +1,3 @@
-
-
 package {
     default_applicable_licenses: ["external_pcre_license"],
 }
@@ -33,51 +31,19 @@
     ],
 }
 
-libpcre2_dist_prefix = "dist2"
-
-libpcre2_src_files = [
-    libpcre2_dist_prefix + "/src/pcre2_auto_possess.c",
-    libpcre2_dist_prefix + "/src/pcre2_compile.c",
-    libpcre2_dist_prefix + "/src/pcre2_config.c",
-    libpcre2_dist_prefix + "/src/pcre2_context.c",
-    libpcre2_dist_prefix + "/src/pcre2_convert.c",
-    libpcre2_dist_prefix + "/src/pcre2_dfa_match.c",
-    libpcre2_dist_prefix + "/src/pcre2_error.c",
-    libpcre2_dist_prefix + "/src/pcre2_extuni.c",
-    libpcre2_dist_prefix + "/src/pcre2_find_bracket.c",
-    libpcre2_dist_prefix + "/src/pcre2_maketables.c",
-    libpcre2_dist_prefix + "/src/pcre2_match.c",
-    libpcre2_dist_prefix + "/src/pcre2_match_data.c",
-    libpcre2_dist_prefix + "/src/pcre2_jit_compile.c",
-    libpcre2_dist_prefix + "/src/pcre2_newline.c",
-    libpcre2_dist_prefix + "/src/pcre2_ord2utf.c",
-    libpcre2_dist_prefix + "/src/pcre2_pattern_info.c",
-    libpcre2_dist_prefix + "/src/pcre2_script_run.c",
-    libpcre2_dist_prefix + "/src/pcre2_serialize.c",
-    libpcre2_dist_prefix + "/src/pcre2_string_utils.c",
-    libpcre2_dist_prefix + "/src/pcre2_study.c",
-    libpcre2_dist_prefix + "/src/pcre2_substitute.c",
-    libpcre2_dist_prefix + "/src/pcre2_substring.c",
-    libpcre2_dist_prefix + "/src/pcre2_tables.c",
-    libpcre2_dist_prefix + "/src/pcre2_ucd.c",
-    libpcre2_dist_prefix + "/src/pcre2_valid_utf.c",
-    libpcre2_dist_prefix + "/src/pcre2_xclass.c",
-    libpcre2_dist_prefix + "/src/pcre2_chartables.c",
-]
-
 cc_defaults {
     name: "pcre_defaults",
     cflags: [
         "-DHAVE_CONFIG_H",
         "-Wall",
         "-Werror",
+        "-DPCRE2_CODE_UNIT_WIDTH=8",
     ],
     tidy_checks: [
         "-google-build-using-namespace",
         "-google-global-names-in-headers",
     ],
     local_include_dirs: [
-        "include_internal",
         "include",
     ],
     export_include_dirs: ["include"],
@@ -100,7 +66,35 @@
     ramdisk_available: true,
     vendor_ramdisk_available: true,
     recovery_available: true,
-    srcs: libpcre2_src_files,
+    srcs: [
+        "src/pcre2_auto_possess.c",
+        "src/pcre2_compile.c",
+        "src/pcre2_config.c",
+        "src/pcre2_context.c",
+        "src/pcre2_convert.c",
+        "src/pcre2_dfa_match.c",
+        "src/pcre2_error.c",
+        "src/pcre2_extuni.c",
+        "src/pcre2_find_bracket.c",
+        "src/pcre2_maketables.c",
+        "src/pcre2_match.c",
+        "src/pcre2_match_data.c",
+        "src/pcre2_jit_compile.c",
+        "src/pcre2_newline.c",
+        "src/pcre2_ord2utf.c",
+        "src/pcre2_pattern_info.c",
+        "src/pcre2_script_run.c",
+        "src/pcre2_serialize.c",
+        "src/pcre2_string_utils.c",
+        "src/pcre2_study.c",
+        "src/pcre2_substitute.c",
+        "src/pcre2_substring.c",
+        "src/pcre2_tables.c",
+        "src/pcre2_ucd.c",
+        "src/pcre2_valid_utf.c",
+        "src/pcre2_xclass.c",
+        "src/pcre2_chartables.c",
+    ],
     stl: "none",
     target: {
         bionic: {
diff --git a/dist2/CMakeLists.txt b/CMakeLists.txt
similarity index 76%
rename from dist2/CMakeLists.txt
rename to CMakeLists.txt
index 71ba693..f715aa5 100644
--- a/dist2/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,11 +94,17 @@
 # 2020-04-28 PH added function check for memfd_create based on Carlo's patch
 # 2020-05-25 PH added a check for Intel CET
 # 2020-12-03 PH altered the definition of pcre2test as suggested by Daniel
+# 2021-06-29 JWSB added the option to build static library with PIC.
+# 2021-07-05 JWSB modified such both the static and shared library can be
+#            build in one go.
+# 2021-08-28 PH increased minimum version
+# 2021-08-28 PH added test for realpath()
 
 PROJECT(PCRE2 C)
 
 # Increased minimum to 2.8.5 to support GNUInstallDirs.
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
+# Increased minimum to 3.0.0 because older than 2.8.12 is deprecated.
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
 
 # Set policy CMP0026 to avoid warnings for the use of LOCATION in
 # GET_TARGET_PROPERTY. This should no longer be required.
@@ -138,6 +144,7 @@
 CHECK_SYMBOL_EXISTS(bcopy         "strings.h"  HAVE_BCOPY)
 CHECK_SYMBOL_EXISTS(memfd_create  "sys/mman.h" HAVE_MEMFD_CREATE)
 CHECK_SYMBOL_EXISTS(memmove       "string.h"   HAVE_MEMMOVE)
+CHECK_SYMBOL_EXISTS(realpath      "stdlib.h"   HAVE_REALPATH)
 CHECK_SYMBOL_EXISTS(secure_getenv "stdlib.h"   HAVE_SECURE_GETENV)
 CHECK_SYMBOL_EXISTS(strerror      "string.h"   HAVE_STRERROR)
 
@@ -172,8 +179,9 @@
 # Note: CMakeSetup displays these in alphabetical order, regardless of
 # the order we use here.
 
-SET(BUILD_SHARED_LIBS OFF CACHE BOOL
-    "Build shared libraries instead of static ones.")
+SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries.")
+
+OPTION(BUILD_STATIC_LIBS "Build static libraries." ON)
 
 OPTION(PCRE2_BUILD_PCRE2_8 "Build 8 bit PCRE2 library" ON)
 
@@ -181,6 +189,8 @@
 
 OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF)
 
+OPTION(PCRE2_STATIC_PIC "Build the static library with the option position independent code enabled." OFF)
+
 OPTION(PCRE2_DEBUG "Include debugging code" OFF)
 
 OPTION(PCRE2_DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF)
@@ -306,9 +316,9 @@
 
 # Prepare build configuration
 
-IF(NOT BUILD_SHARED_LIBS)
-        SET(PCRE2_STATIC 1)
-ENDIF(NOT BUILD_SHARED_LIBS)
+IF(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
+        MESSAGE(FATAL_ERROR "At least one of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS must be enabled.")
+ENDIF(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
 
 IF(NOT PCRE2_BUILD_PCRE2_8 AND NOT PCRE2_BUILD_PCRE2_16 AND NOT PCRE2_BUILD_PCRE2_32)
         MESSAGE(FATAL_ERROR "At least one of PCRE2_BUILD_PCRE2_8, PCRE2_BUILD_PCRE2_16 or PCRE2_BUILD_PCRE2_32 must be enabled")
@@ -597,39 +607,35 @@
 SET(PCRE2POSIX_HEADERS src/pcre2posix.h)
 SET(PCRE2POSIX_SOURCES src/pcre2posix.c)
 
-IF(MINGW AND NOT PCRE2_STATIC)
-IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre2.o
-PRE-LINK
-COMMAND windres ARGS pcre2.rc pcre2.o
-WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-COMMENT Using pcre2 coff info in mingw build)
-SET(PCRE2_SOURCES
-  ${PCRE2_SOURCES} ${PROJECT_SOURCE_DIR}/pcre2.o
-)
-ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
-IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
-ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre2posix.o
-PRE-LINK
-COMMAND windres ARGS pcre2posix.rc pcre2posix.o
-WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
-COMMENT Using pcre2posix coff info in mingw build)
-SET(PCRE2POSIX_SOURCES
-  ${PCRE2POSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcre2posix.o
-)
-ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
-ENDIF(MINGW AND NOT PCRE2_STATIC)
+IF(MINGW AND BUILD_SHARED_LIBS)
+  IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
+    ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre2.o
+      PRE-LINK
+      COMMAND windres ARGS pcre2.rc pcre2.o
+      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+      COMMENT Using pcre2 coff info in mingw build)
+    SET(PCRE2_SOURCES ${PCRE2_SOURCES} ${PROJECT_SOURCE_DIR}/pcre2.o)
+  ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
 
-IF(MSVC AND NOT PCRE2_STATIC)
-IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
-SET(PCRE2_SOURCES
-  ${PCRE2_SOURCES} pcre2.rc)
-ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
-IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
-SET(PCRE2POSIX_SOURCES
-  ${PCRE2POSIX_SOURCES} pcre2posix.rc)
-ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
-ENDIF(MSVC AND NOT PCRE2_STATIC)
+  IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
+    ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_SOURCE_DIR}/pcre2posix.o
+      PRE-LINK
+      COMMAND windres ARGS pcre2posix.rc pcre2posix.o
+      WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+      COMMENT Using pcre2posix coff info in mingw build)
+    SET(PCRE2POSIX_SOURCES ${PCRE2POSIX_SOURCES} ${PROJECT_SOURCE_DIR}/pcre2posix.o)
+  ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
+ENDIF(MINGW AND BUILD_SHARED_LIBS)
+
+IF(MSVC AND BUILD_SHARED_LIBS)
+  IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
+    SET(PCRE2_SOURCES ${PCRE2_SOURCES} pcre2.rc)
+  ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
+
+  IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
+    SET(PCRE2POSIX_SOURCES ${PCRE2POSIX_SOURCES} pcre2posix.rc)
+  ENDIF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
+ENDIF(MSVC AND BUILD_SHARED_LIBS)
 
 # Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681
 # This code was taken from the CMake wiki, not from WebM.
@@ -658,76 +664,181 @@
 # 8-bit library
 
 IF(PCRE2_BUILD_PCRE2_8)
-ADD_LIBRARY(pcre2-8 ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
-SET_TARGET_PROPERTIES(pcre2-8 PROPERTIES
-  COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
-  MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_8_MACHO_COMPATIBILITY_VERSION}"
-  MACHO_CURRENT_VERSION "${LIBPCRE2_8_MACHO_CURRENT_VERSION}"
-  VERSION ${LIBPCRE2_8_VERSION}
-  SOVERSION ${LIBPCRE2_8_SOVERSION})
-SET(targets ${targets} pcre2-8)
-ADD_LIBRARY(pcre2-posix ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
-SET_TARGET_PROPERTIES(pcre2-posix PROPERTIES
-  COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
-  MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_POSIX_MACHO_COMPATIBILITY_VERSION}"
-  MACHO_CURRENT_VERSION "${LIBPCRE2_POSIX_MACHO_CURRENT_VERSION}"
-  VERSION ${LIBPCRE2_POSIX_VERSION}
-  SOVERSION ${LIBPCRE2_POSIX_SOVERSION})
-SET(targets ${targets} pcre2-posix)
-TARGET_LINK_LIBRARIES(pcre2-posix pcre2-8)
+  IF(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-8-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+    SET_TARGET_PROPERTIES(pcre2-8-static PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_8_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_8_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_8_VERSION}
+      SOVERSION ${LIBPCRE2_8_SOVERSION})
+    TARGET_COMPILE_DEFINITIONS(pcre2-8-static PUBLIC PCRE2_STATIC)
+    SET(targets ${targets} pcre2-8-static)
+    ADD_LIBRARY(pcre2-posix-static STATIC ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
+    SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_POSIX_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_POSIX_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_POSIX_VERSION}
+      SOVERSION ${LIBPCRE2_POSIX_SOVERSION})
+    TARGET_LINK_LIBRARIES(pcre2-posix-static pcre2-8-static)
+    TARGET_COMPILE_DEFINITIONS(pcre2-posix-static PUBLIC PCRE2_STATIC)
+    SET(targets ${targets} pcre2-posix-static)
 
-IF(MINGW AND NOT PCRE2_STATIC)
-  IF(NON_STANDARD_LIB_PREFIX)
-    SET_TARGET_PROPERTIES(pcre2-8 pcre2-posix PROPERTIES PREFIX "")
-  ENDIF(NON_STANDARD_LIB_PREFIX)
-  IF(NON_STANDARD_LIB_SUFFIX)
-    SET_TARGET_PROPERTIES(pcre2-8 pcre2-posix PROPERTIES SUFFIX "-0.dll")
-  ENDIF(NON_STANDARD_LIB_SUFFIX)
-ENDIF(MINGW AND NOT PCRE2_STATIC)
+    IF(MSVC)
+      SET_TARGET_PROPERTIES(pcre2-8-static PROPERTIES OUTPUT_NAME pcre2-8-static)
+      SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES OUTPUT_NAME pcre2-posix-static)
+    ELSE(MSVC)
+      SET_TARGET_PROPERTIES(pcre2-8-static PROPERTIES OUTPUT_NAME pcre2-8)
+      SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES OUTPUT_NAME pcre2-posix)
+    ENDIF(MSVC)
+    IF(PCRE2_STATIC_PIC)
+      SET_TARGET_PROPERTIES(pcre2-8-static pcre2-posix-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
+    ENDIF(PCRE2_STATIC_PIC)
+  ENDIF(BUILD_STATIC_LIBS)
+
+  IF(BUILD_SHARED_LIBS)
+    ADD_LIBRARY(pcre2-8-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+    SET_TARGET_PROPERTIES(pcre2-8-shared PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_8_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_8_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_8_VERSION}
+      SOVERSION ${LIBPCRE2_8_SOVERSION}
+      OUTPUT_NAME pcre2-8)
+    SET(targets ${targets} pcre2-8-shared)
+    ADD_LIBRARY(pcre2-posix-shared SHARED ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
+    SET_TARGET_PROPERTIES(pcre2-posix-shared PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_POSIX_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_POSIX_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_POSIX_VERSION}
+      SOVERSION ${LIBPCRE2_POSIX_SOVERSION}
+      OUTPUT_NAME pcre2-posix)
+    TARGET_LINK_LIBRARIES(pcre2-posix-shared pcre2-8-shared)
+    SET(targets ${targets} pcre2-posix-shared)
+
+    IF(MINGW)
+      IF(NON_STANDARD_LIB_PREFIX)
+        SET_TARGET_PROPERTIES(pcre2-8-shared pcre2-posix-shared PROPERTIES PREFIX "")
+      ENDIF(NON_STANDARD_LIB_PREFIX)
+      IF(NON_STANDARD_LIB_SUFFIX)
+        SET_TARGET_PROPERTIES(pcre2-8-shared pcre2-posix-shared PROPERTIES SUFFIX "-0.dll")
+      ENDIF(NON_STANDARD_LIB_SUFFIX)
+    ENDIF(MINGW)
+  ENDIF(BUILD_SHARED_LIBS)
+
+  IF(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-8 ALIAS pcre2-8-static)
+    ADD_LIBRARY(pcre2-posix ALIAS pcre2-posix-static)
+  ELSE(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-8 ALIAS pcre2-8-shared)
+    ADD_LIBRARY(pcre2-posix ALIAS pcre2-posix-shared)
+  ENDIF(BUILD_STATIC_LIBS)
 ENDIF(PCRE2_BUILD_PCRE2_8)
 
 # 16-bit library
 
 IF(PCRE2_BUILD_PCRE2_16)
-ADD_LIBRARY(pcre2-16 ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
-SET_TARGET_PROPERTIES(pcre2-16 PROPERTIES
-  COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
-  MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
-  MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
-  VERSION ${LIBPCRE2_16_VERSION}
-  SOVERSION ${LIBPCRE2_16_SOVERSION})
-SET(targets ${targets} pcre2-16)
+  IF(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-16-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+    SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_16_VERSION}
+      SOVERSION ${LIBPCRE2_16_SOVERSION})
+    TARGET_COMPILE_DEFINITIONS(pcre2-16-static PUBLIC PCRE2_STATIC)
+    SET(targets ${targets} pcre2-16-static)
 
-IF(MINGW AND NOT PCRE2_STATIC)
-  IF(NON_STANDARD_LIB_PREFIX)
-    SET_TARGET_PROPERTIES(pcre2-16 PROPERTIES PREFIX "")
-  ENDIF(NON_STANDARD_LIB_PREFIX)
-  IF(NON_STANDARD_LIB_SUFFIX)
-    SET_TARGET_PROPERTIES(pcre2-16 PROPERTIES SUFFIX "-0.dll")
-  ENDIF(NON_STANDARD_LIB_SUFFIX)
-ENDIF(MINGW AND NOT PCRE2_STATIC)
+    IF(MSVC)
+      SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES OUTPUT_NAME pcre2-16-static)
+    ELSE(MSVC)
+      SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES OUTPUT_NAME pcre2-16)
+    ENDIF(MSVC)
+    IF(PCRE2_STATIC_PIC)
+      SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
+    ENDIF(PCRE2_STATIC_PIC)
+  ENDIF(BUILD_STATIC_LIBS)
+
+  IF(BUILD_SHARED_LIBS)
+    ADD_LIBRARY(pcre2-16-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+    SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_16_VERSION}
+      SOVERSION ${LIBPCRE2_16_SOVERSION}
+      OUTPUT_NAME pcre2-16)
+    SET(targets ${targets} pcre2-16-shared)
+
+    IF(MINGW)
+      IF(NON_STANDARD_LIB_PREFIX)
+        SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES PREFIX "")
+      ENDIF(NON_STANDARD_LIB_PREFIX)
+      IF(NON_STANDARD_LIB_SUFFIX)
+        SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES SUFFIX "-0.dll")
+      ENDIF(NON_STANDARD_LIB_SUFFIX)
+    ENDIF(MINGW)
+  ENDIF(BUILD_SHARED_LIBS)
+
+  IF(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-16 ALIAS pcre2-16-static)
+  ELSE(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-16 ALIAS pcre2-16-shared)
+  ENDIF(BUILD_STATIC_LIBS)
 ENDIF(PCRE2_BUILD_PCRE2_16)
 
 # 32-bit library
 
 IF(PCRE2_BUILD_PCRE2_32)
-ADD_LIBRARY(pcre2-32 ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
-SET_TARGET_PROPERTIES(pcre2-32 PROPERTIES
-  COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
-  MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
-  MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
-  VERSION ${LIBPCRE2_32_VERSION}
-  SOVERSION ${LIBPCRE2_32_SOVERSION})
-SET(targets ${targets} pcre2-32)
+  IF(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-32-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+    SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_32_VERSION}
+      SOVERSION ${LIBPCRE2_32_SOVERSION})
+    TARGET_COMPILE_DEFINITIONS(pcre2-32-static PUBLIC PCRE2_STATIC)
+    SET(targets ${targets} pcre2-32-static)
 
-IF(MINGW AND NOT PCRE2_STATIC)
-  IF(NON_STANDARD_LIB_PREFIX)
-    SET_TARGET_PROPERTIES(pcre2-32 PROPERTIES PREFIX "")
-  ENDIF(NON_STANDARD_LIB_PREFIX)
-  IF(NON_STANDARD_LIB_SUFFIX)
-    SET_TARGET_PROPERTIES(pcre2-32 PROPERTIES SUFFIX "-0.dll")
-  ENDIF(NON_STANDARD_LIB_SUFFIX)
-ENDIF(MINGW AND NOT PCRE2_STATIC)
+    IF(MSVC)
+      SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES OUTPUT_NAME pcre2-32-static)
+    ELSE(MSVC)
+      SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES OUTPUT_NAME pcre2-32)
+    ENDIF(MSVC)
+    IF(PCRE2_STATIC_PIC)
+      SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
+    ENDIF(PCRE2_STATIC_PIC)
+  ENDIF(BUILD_STATIC_LIBS)
+
+  IF(BUILD_SHARED_LIBS)
+    ADD_LIBRARY(pcre2-32-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
+    SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES
+      COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
+      MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
+      MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
+      VERSION ${LIBPCRE2_32_VERSION}
+      SOVERSION ${LIBPCRE2_32_SOVERSION}
+      OUTPUT_NAME pcre2-32)
+    SET(targets ${targets} pcre2-32-shared)
+
+    IF(MINGW)
+      IF(NON_STANDARD_LIB_PREFIX)
+        SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES PREFIX "")
+      ENDIF(NON_STANDARD_LIB_PREFIX)
+      IF(NON_STANDARD_LIB_SUFFIX)
+        SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES SUFFIX "-0.dll")
+      ENDIF(NON_STANDARD_LIB_SUFFIX)
+    ENDIF(MINGW)
+  ENDIF(BUILD_SHARED_LIBS)
+
+  IF(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-32 ALIAS pcre2-32-static)
+  ELSE(BUILD_STATIC_LIBS)
+    ADD_LIBRARY(pcre2-32 ALIAS pcre2-32-shared)
+  ENDIF(BUILD_STATIC_LIBS)
 ENDIF(PCRE2_BUILD_PCRE2_32)
 
 # Executables
@@ -900,6 +1011,15 @@
 
 INSTALL(FILES ${PCRE2_HEADERS} ${PCRE2POSIX_HEADERS} DESTINATION include)
 
+# CMake config files.
+set(PCRE2_CONFIG_IN  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/pcre2-config.cmake.in)
+set(PCRE2_CONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/pcre2-config.cmake)
+configure_file(${PCRE2_CONFIG_IN} ${PCRE2_CONFIG_OUT} @ONLY)
+set(PCRE2_CONFIG_VERSION_IN  ${CMAKE_CURRENT_SOURCE_DIR}/cmake/pcre2-config-version.cmake.in)
+set(PCRE2_CONFIG_VERSION_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/pcre2-config-version.cmake)
+configure_file(${PCRE2_CONFIG_VERSION_IN} ${PCRE2_CONFIG_VERSION_OUT} @ONLY)
+install(FILES ${PCRE2_CONFIG_OUT} ${PCRE2_CONFIG_VERSION_OUT} DESTINATION cmake)
+
 FILE(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html)
 FILE(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
 FILE(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)
@@ -926,11 +1046,11 @@
 ENDIF(MSVC AND INSTALL_MSVC_PDB)
 
 # Help, only for nice output
-IF(BUILD_SHARED_LIBS)
-  SET(BUILD_STATIC_LIBS OFF)
-ELSE(BUILD_SHARED_LIBS)
+IF(BUILD_STATIC_LIBS)
   SET(BUILD_STATIC_LIBS ON)
-ENDIF(BUILD_SHARED_LIBS)
+ELSE(BUILD_STATIC_LIBS)
+  SET(BUILD_STATIC_LIBS OFF)
+ENDIF(BUILD_STATIC_LIBS)
 
 IF(PCRE2_HEAP_MATCH_RECURSE)
   MESSAGE(WARNING "HEAP_MATCH_RECURSE is obsolete and does nothing.")
@@ -968,6 +1088,7 @@
   MESSAGE(STATUS "  Match depth limit ............... : ${PCRE2_MATCH_LIMIT_DEPTH}")
   MESSAGE(STATUS "  Build shared libs ............... : ${BUILD_SHARED_LIBS}")
   MESSAGE(STATUS "  Build static libs ............... : ${BUILD_STATIC_LIBS}")
+  MESSAGE(STATUS "     with PIC enabled ............. : ${PCRE2_STATIC_PIC}")
   MESSAGE(STATUS "  Build pcre2grep ................. : ${PCRE2_BUILD_PCRE2GREP}")
   MESSAGE(STATUS "  Enable JIT in pcre2grep ......... : ${PCRE2GREP_SUPPORT_JIT}")
   MESSAGE(STATUS "  Enable callouts in pcre2grep .... : ${PCRE2GREP_SUPPORT_CALLOUT}")
@@ -1002,10 +1123,10 @@
     MESSAGE(STATUS "  Use %zu and %td ..................: AUTO" )
   ENDIF(PCRE2_DISABLE_PERCENT_ZT)
 
-  IF(MINGW AND NOT PCRE2_STATIC)
+  IF(MINGW AND BUILD_SHARED_LIBS)
     MESSAGE(STATUS "  Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}")
     MESSAGE(STATUS "  Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}")
-  ENDIF(MINGW AND NOT PCRE2_STATIC)
+  ENDIF(MINGW AND BUILD_SHARED_LIBS)
 
   IF(MSVC)
     MESSAGE(STATUS "  Install MSVC .pdb files ..........: ${INSTALL_MSVC_PDB}")
diff --git a/dist2/COPYING b/COPYING
similarity index 100%
rename from dist2/COPYING
rename to COPYING
diff --git a/dist2/ChangeLog b/ChangeLog
similarity index 97%
rename from dist2/ChangeLog
rename to ChangeLog
index 22f3afe..e0ac9b3 100644
--- a/dist2/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,65 @@
 Change Log for PCRE2
 --------------------
 
+Version 10.38 01-October-2021
+-----------------------------
+
+1. Fix invalid single character repetition issues in JIT when the repetition
+is inside a capturing bracket and the bracket is preceeded by character
+literals.
+
+2. Installed revised CMake configuration files provided by Jan-Willem Blokland.
+This extends the CMake build system to build both static and shared libraries
+in one go, builds the static library with PIC, and exposes PCRE2 libraries
+using the CMake config files. JWB provided these notes:
+
+- Introduced CMake variable BUILD_STATIC_LIBS to build the static library.
+
+- Make a small modification to config-cmake.h.in by removing the PCRE2_STATIC
+  variable. Added PCRE2_STATIC variable to the static build using the
+  target_compile_definitions() function.
+
+- Extended the CMake config files.
+
+  - Introduced CMake variable PCRE2_USE_STATIC_LIBS to easily switch between
+    the static and shared libraries.
+
+  - Added the PCRE_STATIC variable to the target compile definitions for the
+    import of the static library.
+
+Building static and shared libraries using MSVC results in a name clash of
+the libraries. Both static and shared library builds create, for example, the
+file pcre2-8.lib. Therefore, I decided to change the static library names by
+adding "-static". For example, pcre2-8.lib has become pcre2-8-static.lib.
+[Comment by PH: this is MSVC-specific. It doesn't happen on Linux.]
+
+3. Increased the minimum release number for CMake to 3.0.0 because older than
+2.8.12 is deprecated (it was set to 2.8.5) and causes warnings. Even 3.0.0 is
+quite old; it was released in 2014.
+
+4. Implemented a modified version of Thomas Tempelmann's pcre2grep patch for
+detecting symlink loops. This is dependent on the availability of realpath(),
+which is now tested for in ./configure and CMakeLists.txt.
+
+5. Implemented a modified version of Thomas Tempelmann's patch for faster
+case-independent "first code unit" searches for unanchored patterns in 8-bit
+mode in the interpreters. Instead of just remembering whether one case matched
+or not, it remembers the position of a previous match so as to avoid
+unnecessary repeated searching.
+
+6. Perl now locks out \K in lookarounds, so PCRE2 now does the same by default.
+However, just in case anybody was relying on the old behaviour, there is an
+option called PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK that enables the old behaviour.
+An option has also been added to pcre2grep to enable this.
+
+7. Re-enable a JIT optimization which was unintentionally disabled in 10.35.
+
+8. There is a loop counter to catch excessively crazy patterns when checking
+the lengths of lookbehinds at compile time. This was incorrectly getting reset
+whenever a lookahead was processed, leading to some fuzzer-generated patterns
+taking a very long time to compile when (?|) was present in the pattern,
+because (?|) disables caching of group lengths.
+
 
 Version 10.37 26-May-2021
 -------------------------
diff --git a/dist2/CheckMan b/CheckMan
similarity index 100%
rename from dist2/CheckMan
rename to CheckMan
diff --git a/dist2/CleanTxt b/CleanTxt
similarity index 100%
rename from dist2/CleanTxt
rename to CleanTxt
diff --git a/dist2/Detrail b/Detrail
similarity index 100%
rename from dist2/Detrail
rename to Detrail
diff --git a/dist2/HACKING b/HACKING
similarity index 100%
rename from dist2/HACKING
rename to HACKING
diff --git a/dist2/INSTALL b/INSTALL
similarity index 98%
rename from dist2/INSTALL
rename to INSTALL
index 8865734..e82fd21 100644
--- a/dist2/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-   Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
-Foundation, Inc.
+   Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
+Software Foundation, Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -225,7 +225,7 @@
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
-   HP-UX 'make' updates targets which have the same time stamps as their
+   HP-UX 'make' updates targets which have the same timestamps as their
 prerequisites, which makes it generally unusable when shipped generated
 files such as 'configure' are involved.  Use GNU 'make' instead.
 
diff --git a/dist2/LICENCE b/LICENCE
similarity index 97%
rename from dist2/LICENCE
rename to LICENCE
index 18684ce..b1ec61b 100644
--- a/dist2/LICENCE
+++ b/LICENCE
@@ -23,7 +23,7 @@
 Email local part: Philip.Hazel
 Email domain:     gmail.com
 
-University of Cambridge Computing Service,
+Retired from University of Cambridge Computing Service,
 Cambridge, England.
 
 Copyright (c) 1997-2021 University of Cambridge
diff --git a/METADATA b/METADATA
index 5211419..bf046c5 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://ftp.pcre.org/pub/pcre/pcre2-10.37.tar.gz"
+    value: "https://github.com/PhilipHazel/pcre2/releases/download/pcre2-10.38/pcre2-10.38.tar.gz"
   }
-  version: "10.37"
+  version: "pcre2-10.38"
   license_type: NOTICE
   last_upgrade_date {
     year: 2021
-    month: 6
-    day: 8
+    month: 10
+    day: 1
   }
 }
diff --git a/dist2/Makefile.am b/Makefile.am
similarity index 99%
rename from dist2/Makefile.am
rename to Makefile.am
index bd8e6f0..9a23465 100644
--- a/dist2/Makefile.am
+++ b/Makefile.am
@@ -859,9 +859,11 @@
 
 EXTRA_DIST += \
   cmake/COPYING-CMAKE-SCRIPTS \
+  cmake/FindEditline.cmake \
   cmake/FindPackageHandleStandardArgs.cmake \
   cmake/FindReadline.cmake \
-  cmake/FindEditline.cmake \
+  cmake/pcre2-config-version.cmake.in \
+  cmake/pcre2-config.cmake.in \
   CMakeLists.txt \
   config-cmake.h.in
 
diff --git a/dist2/Makefile.in b/Makefile.in
similarity index 99%
rename from dist2/Makefile.in
rename to Makefile.in
index 1da0cfc..fbaaf59 100644
--- a/dist2/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.16.3 from Makefile.am.
+# Makefile.in generated by automake 1.16.4 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2020 Free Software Foundation, Inc.
+# Copyright (C) 1994-2021 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -591,9 +591,6 @@
   unique=`for i in $$list; do \
     if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
   done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-CSCOPE = cscope
 AM_RECURSIVE_TARGETS = cscope check recheck
 am__tty_colors_dummy = \
   mgn= red= grn= lgn= blu= brg= std=; \
@@ -812,6 +809,8 @@
 CET_CFLAGS = @CET_CFLAGS@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
+CSCOPE = @CSCOPE@
+CTAGS = @CTAGS@
 CYGPATH_W = @CYGPATH_W@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
@@ -823,6 +822,7 @@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
+ETAGS = @ETAGS@
 EXEEXT = @EXEEXT@
 EXTRA_LIBPCRE2_16_LDFLAGS = @EXTRA_LIBPCRE2_16_LDFLAGS@
 EXTRA_LIBPCRE2_32_LDFLAGS = @EXTRA_LIBPCRE2_32_LDFLAGS@
@@ -1258,10 +1258,10 @@
 	testdata/testoutput25 testdata/testoutputEBC \
 	testdata/valgrind-jit.supp testdata/wintestinput3 \
 	testdata/wintestoutput3 perltest.sh src/pcre2demo.c \
-	cmake/COPYING-CMAKE-SCRIPTS \
+	cmake/COPYING-CMAKE-SCRIPTS cmake/FindEditline.cmake \
 	cmake/FindPackageHandleStandardArgs.cmake \
-	cmake/FindReadline.cmake cmake/FindEditline.cmake \
-	CMakeLists.txt config-cmake.h.in
+	cmake/FindReadline.cmake cmake/pcre2-config-version.cmake.in \
+	cmake/pcre2-config.cmake.in CMakeLists.txt config-cmake.h.in
 
 # These are the header files we'll install. We do not distribute pcre2.h
 # because it is generated from pcre2.h.in.
@@ -3030,7 +3030,6 @@
 @am__EXEEXT_TRUE@	--log-file $$b.log --trs-file $$b.trs \
 @am__EXEEXT_TRUE@	$(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
 @am__EXEEXT_TRUE@	"$$tst" $(AM_TESTS_FD_REDIRECT)
-
 distdir: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) distdir-am
 
diff --git a/dist2/NEWS b/NEWS
similarity index 95%
rename from dist2/NEWS
rename to NEWS
index 8e3cf7e..34f3ee3 100644
--- a/dist2/NEWS
+++ b/NEWS
@@ -2,6 +2,20 @@
 -------------------------
 
 
+Version 10.38 01-October-2021
+-----------------------------
+
+As well as some bug fixes and tidies (as always, see ChangeLog for details),
+the documentation is updated to list the new URLs, following the move of the
+source repository to GitHub and the mailing list to Google Groups.
+
+* The CMake build system can now build both static and shared libraries in one
+go.
+
+* Following Perl's lead, \K is now locked out in lookaround assertions by
+default, but an option is provided to re-enable the previous behaviour.
+
+
 Version 10.37 26-May-2021
 -------------------------
 
diff --git a/dist2/NON-AUTOTOOLS-BUILD b/NON-AUTOTOOLS-BUILD
similarity index 100%
rename from dist2/NON-AUTOTOOLS-BUILD
rename to NON-AUTOTOOLS-BUILD
diff --git a/dist2/PrepareRelease b/PrepareRelease
similarity index 100%
rename from dist2/PrepareRelease
rename to PrepareRelease
diff --git a/dist2/README b/README
similarity index 97%
rename from dist2/README
rename to README
index d1a3120..e07d3c0 100644
--- a/dist2/README
+++ b/README
@@ -6,17 +6,19 @@
 the code and it now differs from PCRE1 in more than just the API. There are new
 features, and the internals have been improved. The original PCRE1 library is
 now obsolete and should not be used in new projects. The latest release of
-PCRE2 is available in three alternative formats from:
+PCRE2 is available in .tar.gz, tar.bz2, or .zip form from this GitHub
+repository:
 
-https://ftp.pcre.org/pub/pcre/pcre2-10.xx.tar.gz
-https://ftp.pcre.org/pub/pcre/pcre2-10.xx.tar.bz2
-https://ftp.pcre.org/pub/pcre/pcre2-10.xx.tar.zip
+https://github.com/PhilipHazel/pcre2/releases
 
-There is a mailing list for discussion about the development of PCRE at
-pcre-dev@exim.org. You can access the archives and subscribe or manage your
-subscription here:
+There is a mailing list for discussion about the development of PCRE2 at
+pcre2-dev@googlegroups.com. You can subscribe by sending an email to
+pcre2-dev+subscribe@googlegroups.com.
 
-   https://lists.exim.org/mailman/listinfo/pcre-dev
+You can access the archives and also subscribe or manage your subscription
+here:
+
+https://groups.google.com/pcre2-dev
 
 Please read the NEWS file if you are upgrading from a previous release. The
 contents of this README file are:
@@ -379,7 +381,7 @@
   defined and has a value greater than or equal to 199901L (indicating C99).
   However, there is at least one environment that claims to be C99 but does not
   support these modifiers. If --disable-percent-zt is specified, no use is made
-  of the z or t modifiers. Instead or %td or %zu, %lu is used, with a cast for
+  of the z or t modifiers. Instead of %td or %zu, %lu is used, with a cast for
   size_t values.
 
 . There is a special option called --enable-fuzz-support for use by people who
@@ -570,9 +572,9 @@
 Making new tarballs
 -------------------
 
-The command "make dist" creates three PCRE2 tarballs, in tar.gz, tar.bz2, and
-zip formats. The command "make distcheck" does the same, but then does a trial
-build of the new distribution to ensure that it works.
+The command "make dist" creates two PCRE2 tarballs, in tar.gz and zip formats.
+The command "make distcheck" does the same, but then does a trial build of the
+new distribution to ensure that it works.
 
 If you have modified any of the man page sources in the doc directory, you
 should first run the PrepareRelease script before making a distribution. This
@@ -904,4 +906,4 @@
 Philip Hazel
 Email local part: Philip.Hazel
 Email domain: gmail.com
-Last updated: 28 April 2021
+Last updated: 27 August 2021
diff --git a/dist2/RunGrepTest b/RunGrepTest
similarity index 97%
rename from dist2/RunGrepTest
rename to RunGrepTest
index 78206ba..25f69bd 100755
--- a/dist2/RunGrepTest
+++ b/RunGrepTest
@@ -558,7 +558,7 @@
 echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
 echo "a" >testtemp1grep
 echo "aaaaa" >>testtemp1grep
-(cd $srcdir; $valgrind $vjs $pcre2grep  --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
+(cd $srcdir; $valgrind $vjs $pcre2grep  --line-offsets --allow-lookaround-bsk '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
@@ -638,13 +638,13 @@
 
 echo "---------------------------- Test 125 -----------------------------" >>testtrygrep
 printf 'abcd\n' >testNinputgrep
-$valgrind $vjs $pcre2grep --colour=always '(?<=\K.)' testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep --colour=always --allow-lookaround-bsk '(?<=\K.)' testNinputgrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
-$valgrind $vjs $pcre2grep --colour=always '(?=.\K)' testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep --colour=always --allow-lookaround-bsk '(?=.\K)' testNinputgrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
-$valgrind $vjs $pcre2grep --colour=always '(?<=\K[ac])' testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep --colour=always --allow-lookaround-bsk '(?<=\K[ac])' testNinputgrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
-$valgrind $vjs $pcre2grep --colour=always '(?=[ac]\K)' testNinputgrep >>testtrygrep
+$valgrind $vjs $pcre2grep --colour=always --allow-lookaround-bsk '(?=[ac]\K)' testNinputgrep >>testtrygrep
 echo "RC=$?" >>testtrygrep
 
 echo "---------------------------- Test 126 -----------------------------" >>testtrygrep
@@ -701,7 +701,7 @@
   echo "RC=$?" >>testtrygrep
 
   echo "---------------------------- Test U3 ------------------------------" >>testtrygrep
-  (cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -u --newline=any '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
+  (cd $srcdir; $valgrind $vjs $pcre2grep --line-offsets -u --newline=any --allow-lookaround-bsk '(?<=\K\x{17f})' ./testdata/grepinput8) >>testtrygrep
   echo "RC=$?" >>testtrygrep
 
   echo "---------------------------- Test U4 ------------------------------" >>testtrygrep
diff --git a/dist2/RunGrepTest.bat b/RunGrepTest.bat
similarity index 100%
rename from dist2/RunGrepTest.bat
rename to RunGrepTest.bat
diff --git a/dist2/RunTest b/RunTest
similarity index 100%
rename from dist2/RunTest
rename to RunTest
diff --git a/dist2/RunTest.bat b/RunTest.bat
similarity index 100%
rename from dist2/RunTest.bat
rename to RunTest.bat
Binary files differ
diff --git a/dist2/aclocal.m4 b/aclocal.m4
similarity index 96%
rename from dist2/aclocal.m4
rename to aclocal.m4
index 7161115..72f4048 100644
--- a/dist2/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.4 -*- Autoconf -*-
 
-# Copyright (C) 1996-2020 Free Software Foundation, Inc.
+# Copyright (C) 1996-2021 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -364,7 +364,7 @@
         [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
 ])dnl PKG_HAVE_DEFINE_WITH_MODULES
 
-# Copyright (C) 2002-2020 Free Software Foundation, Inc.
+# Copyright (C) 2002-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -379,7 +379,7 @@
 [am__api_version='1.16'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.16.3], [],
+m4_if([$1], [1.16.4], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -395,12 +395,12 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.16.3])dnl
+[AM_AUTOMAKE_VERSION([1.16.4])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
-# Copyright (C) 2011-2020 Free Software Foundation, Inc.
+# Copyright (C) 2011-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -462,7 +462,7 @@
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
-# Copyright (C) 2001-2020 Free Software Foundation, Inc.
+# Copyright (C) 2001-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -514,7 +514,7 @@
 
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997-2020 Free Software Foundation, Inc.
+# Copyright (C) 1997-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -545,7 +545,7 @@
 Usually this means the macro was only invoked conditionally.]])
 fi])])
 
-# Copyright (C) 1999-2020 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -736,7 +736,7 @@
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999-2020 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -804,7 +804,7 @@
 
 # Do all the work for Automake.                             -*- Autoconf -*-
 
-# Copyright (C) 1996-2020 Free Software Foundation, Inc.
+# Copyright (C) 1996-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -868,7 +868,7 @@
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
 m4_if(
-  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
   [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
@@ -920,6 +920,20 @@
 		  [m4_define([AC_PROG_OBJCXX],
 			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
+# Variables for tags utilities; see am/tags.am
+if test -z "$CTAGS"; then
+  CTAGS=ctags
+fi
+AC_SUBST([CTAGS])
+if test -z "$ETAGS"; then
+  ETAGS=etags
+fi
+AC_SUBST([ETAGS])
+if test -z "$CSCOPE"; then
+  CSCOPE=cscope
+fi
+AC_SUBST([CSCOPE])
+
 AC_REQUIRE([AM_SILENT_RULES])dnl
 dnl The testsuite driver may need to know about EXEEXT, so add the
 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
@@ -1001,7 +1015,7 @@
 done
 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
-# Copyright (C) 2001-2020 Free Software Foundation, Inc.
+# Copyright (C) 2001-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1022,7 +1036,7 @@
 fi
 AC_SUBST([install_sh])])
 
-# Copyright (C) 2003-2020 Free Software Foundation, Inc.
+# Copyright (C) 2003-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1043,7 +1057,7 @@
 
 # Check to see how 'make' treats includes.	            -*- Autoconf -*-
 
-# Copyright (C) 2001-2020 Free Software Foundation, Inc.
+# Copyright (C) 2001-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1086,7 +1100,7 @@
 
 # Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
 
-# Copyright (C) 1997-2020 Free Software Foundation, Inc.
+# Copyright (C) 1997-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1120,7 +1134,7 @@
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001-2020 Free Software Foundation, Inc.
+# Copyright (C) 2001-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1149,7 +1163,7 @@
 AC_DEFUN([_AM_IF_OPTION],
 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
 
-# Copyright (C) 1999-2020 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1196,7 +1210,7 @@
 # For backward compatibility.
 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
 
-# Copyright (C) 2001-2020 Free Software Foundation, Inc.
+# Copyright (C) 2001-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1215,7 +1229,7 @@
 
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996-2020 Free Software Foundation, Inc.
+# Copyright (C) 1996-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1296,7 +1310,7 @@
 rm -f conftest.file
 ])
 
-# Copyright (C) 2009-2020 Free Software Foundation, Inc.
+# Copyright (C) 2009-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1356,7 +1370,7 @@
 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
 ])
 
-# Copyright (C) 2001-2020 Free Software Foundation, Inc.
+# Copyright (C) 2001-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1384,7 +1398,7 @@
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
-# Copyright (C) 2006-2020 Free Software Foundation, Inc.
+# Copyright (C) 2006-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -1403,7 +1417,7 @@
 
 # Check how to create a tarball.                            -*- Autoconf -*-
 
-# Copyright (C) 2004-2020 Free Software Foundation, Inc.
+# Copyright (C) 2004-2021 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/dist2/ar-lib b/ar-lib
similarity index 98%
rename from dist2/ar-lib
rename to ar-lib
index 1e9388e..c349042 100755
--- a/dist2/ar-lib
+++ b/ar-lib
@@ -4,7 +4,7 @@
 me=ar-lib
 scriptversion=2019-07-04.01; # UTC
 
-# Copyright (C) 2010-2020 Free Software Foundation, Inc.
+# Copyright (C) 2010-2021 Free Software Foundation, Inc.
 # Written by Peter Rosin <peda@lysator.liu.se>.
 #
 # This program is free software; you can redistribute it and/or modify
diff --git a/dist2/cmake/COPYING-CMAKE-SCRIPTS b/cmake/COPYING-CMAKE-SCRIPTS
similarity index 100%
rename from dist2/cmake/COPYING-CMAKE-SCRIPTS
rename to cmake/COPYING-CMAKE-SCRIPTS
diff --git a/dist2/cmake/FindEditline.cmake b/cmake/FindEditline.cmake
similarity index 100%
rename from dist2/cmake/FindEditline.cmake
rename to cmake/FindEditline.cmake
diff --git a/dist2/cmake/FindPackageHandleStandardArgs.cmake b/cmake/FindPackageHandleStandardArgs.cmake
similarity index 100%
rename from dist2/cmake/FindPackageHandleStandardArgs.cmake
rename to cmake/FindPackageHandleStandardArgs.cmake
diff --git a/dist2/cmake/FindReadline.cmake b/cmake/FindReadline.cmake
similarity index 100%
rename from dist2/cmake/FindReadline.cmake
rename to cmake/FindReadline.cmake
diff --git a/cmake/pcre2-config-version.cmake.in b/cmake/pcre2-config-version.cmake.in
new file mode 100644
index 0000000..dac149e
--- /dev/null
+++ b/cmake/pcre2-config-version.cmake.in
@@ -0,0 +1,15 @@
+set(PACKAGE_VERSION_MAJOR @PCRE2_MAJOR@)
+set(PACKAGE_VERSION_MINOR @PCRE2_MINOR@)
+set(PACKAGE_VERSION_PATCH 0)
+set(PACKAGE_VERSION @PCRE2_MAJOR@.@PCRE2_MINOR@.0)
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
+   PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()
diff --git a/cmake/pcre2-config.cmake.in b/cmake/pcre2-config.cmake.in
new file mode 100644
index 0000000..b313d6d
--- /dev/null
+++ b/cmake/pcre2-config.cmake.in
@@ -0,0 +1,145 @@
+# pcre2-config.cmake
+# ----------------
+#
+# Finds the PCRE2 library, specify the starting search path in PCRE2_ROOT.
+#
+# Static vs. shared
+# -----------------
+# To make use of the static library instead of the shared one, one needs
+# to set the variable PCRE2_USE_STATIC_LIBS to ON before calling find_package.
+# Example:
+#   set(PCRE2_USE_STATIC_LIBS ON)
+#   find_package(PCRE2 CONFIG COMPONENTS 8BIT)
+#
+# This will define the following variables:
+#
+#   PCRE2_FOUND   - True if the system has the PCRE2 library.
+#   PCRE2_VERSION - The version of the PCRE2 library which was found.
+#
+# and the following imported targets:
+#
+#   PCRE2::8BIT  - The 8 bit PCRE2 library.
+#   PCRE2::16BIT - The 16 bit PCRE2 library.
+#   PCRE2::32BIT - The 32 bit PCRE2 library.
+#   PCRE2::POSIX - The POSIX PCRE2 library.
+
+set(PCRE2_NON_STANDARD_LIB_PREFIX @NON_STANDARD_LIB_PREFIX@)
+set(PCRE2_NON_STANDARD_LIB_SUFFIX @NON_STANDARD_LIB_SUFFIX@)
+set(PCRE2_8BIT_NAME pcre2-8)
+set(PCRE2_16BIT_NAME pcre2-16)
+set(PCRE2_32BIT_NAME pcre2-32)
+set(PCRE2_POSIX_NAME pcre2-posix)
+find_path(PCRE2_INCLUDE_DIR NAMES pcre2.h DOC "PCRE2 include directory")
+if (PCRE2_USE_STATIC_LIBS)
+  if (MSVC)
+    set(PCRE2_8BIT_NAME pcre2-8-static)
+    set(PCRE2_16BIT_NAME pcre2-16-static)
+    set(PCRE2_32BIT_NAME pcre2-32-static)
+    set(PCRE2_POSIX_NAME pcre2-posix-static)
+  endif ()
+
+  set(PCRE2_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
+  set(PCRE2_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
+else ()
+  set(PCRE2_PREFIX ${CMAKE_SHARED_LIBRARY_PREFIX})
+  if (MINGW AND PCRE2_NON_STANDARD_LIB_PREFIX)
+    set(PCRE2_PREFIX "")
+  endif ()
+
+  set(PCRE2_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
+  if (MINGW AND PCRE2_NON_STANDARD_LIB_SUFFIX)
+    set(PCRE2_SUFFIX "-0.dll")
+  endif ()
+endif ()
+find_library(PCRE2_8BIT_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX} DOC "8 bit PCRE2 library")
+find_library(PCRE2_16BIT_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_16BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX} DOC "16 bit PCRE2 library")
+find_library(PCRE2_32BIT_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_32BIT_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX} DOC "32 bit PCRE2 library")
+find_library(PCRE2_POSIX_LIBRARY NAMES ${PCRE2_PREFIX}${PCRE2_POSIX_NAME}${PCRE2_SUFFIX} ${PCRE2_PREFIX}${PCRE2_8BIT_NAME}d${PCRE2_SUFFIX} DOC "8 bit POSIX PCRE2 library")
+unset(PCRE2_NON_STANDARD_LIB_PREFIX)
+unset(PCRE2_NON_STANDARD_LIB_SUFFIX)
+unset(PCRE2_8BIT_NAME)
+unset(PCRE2_16BIT_NAME)
+unset(PCRE2_32BIT_NAME)
+unset(PCRE2_POSIX_NAME)
+
+# Set version
+if (PCRE2_INCLUDE_DIR)
+  set(PCRE2_VERSION "@PCRE2_MAJOR@.@PCRE2_MINOR@.0")
+endif ()
+
+# Which components have been found.
+if (PCRE2_8BIT_LIBRARY)
+  set(PCRE2_8BIT_FOUND TRUE)
+endif ()
+if (PCRE2_16BIT_LIBRARY)
+  set(PCRE2_16BIT_FOUND TRUE)
+endif ()
+if (PCRE2_32BIT_LIBRARY)
+  set(PCRE2_32BIT_FOUND TRUE)
+endif ()
+if (PCRE2_POSIX_LIBRARY)
+  set(PCRE2_POSIX_FOUND TRUE)
+endif ()
+
+# Check if at least one component has been specified.
+list(LENGTH PCRE2_FIND_COMPONENTS PCRE2_NCOMPONENTS)
+if (PCRE2_NCOMPONENTS LESS 1)
+  message(FATAL_ERROR "No components have been specified. This is not allowed. Please, specify at least one component.")
+endif ()
+unset(PCRE2_NCOMPONENTS)
+
+# When POSIX component has been specified make sure that also 8BIT component is specified.
+set(PCRE2_8BIT_COMPONENT FALSE)
+set(PCRE2_POSIX_COMPONENT FALSE)
+foreach(component ${PCRE2_FIND_COMPONENTS})
+  if (component STREQUAL "8BIT")
+    set(PCRE2_8BIT_COMPONENT TRUE)
+  elseif (component STREQUAL "POSIX")
+    set(PCRE2_POSIX_COMPONENT TRUE)
+  endif ()
+endforeach()
+
+if (PCRE2_POSIX_COMPONENT AND NOT PCRE2_8BIT_COMPONENT)
+  message(FATAL_ERROR "The component POSIX is specified while the 8BIT one is not. This is not allowed. Please, also specify the 8BIT component.")
+endif()
+unset(PCRE2_8BIT_COMPONENT)
+unset(PCRE2_POSIX_COMPONENT)
+
+include(FindPackageHandleStandardArgs)
+set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
+find_package_handle_standard_args(PCRE2
+  FOUND_VAR PCRE2_FOUND
+  REQUIRED_VARS PCRE2_INCLUDE_DIR
+  HANDLE_COMPONENTS
+  VERSION_VAR PCRE2_VERSION
+  CONFIG_MODE
+)
+
+set(PCRE2_LIBRARIES)
+if (PCRE2_FOUND)
+  foreach(component ${PCRE2_FIND_COMPONENTS})
+    if (PCRE2_USE_STATIC_LIBS)
+      add_library(PCRE2::${component} STATIC IMPORTED)
+      target_compile_definitions(PCRE2::${component} INTERFACE PCRE2_STATIC)
+    else ()
+      add_library(PCRE2::${component} SHARED IMPORTED)
+    endif ()
+    set_target_properties(PCRE2::${component} PROPERTIES
+      IMPORTED_LOCATION "${PCRE2_${component}_LIBRARY}"
+      INTERFACE_INCLUDE_DIRECTORIES "${PCRE2_INCLUDE_DIR}"
+    )
+    if (component STREQUAL "POSIX")
+      set_target_properties(PCRE2::${component} PROPERTIES
+        INTERFACE_LINK_LIBRARIES "PCRE2::8BIT"
+        LINK_LIBRARIES "PCRE2::8BIT"
+      )
+    endif ()
+
+    set(PCRE2_LIBRARIES ${PCRE2_LIBRARIES} ${PCRE2_${component}_LIBRARY})
+    mark_as_advanced(PCRE2_${component}_LIBRARY)
+  endforeach()
+endif ()
+
+mark_as_advanced(
+  PCRE2_INCLUDE_DIR
+)
diff --git a/dist2/compile b/compile
similarity index 98%
rename from dist2/compile
rename to compile
index 23fcba0..df363c8 100755
--- a/dist2/compile
+++ b/compile
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2020 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
diff --git a/dist2/config-cmake.h.in b/config-cmake.h.in
similarity index 97%
rename from dist2/config-cmake.h.in
rename to config-cmake.h.in
index 7766dd7..3adf756 100644
--- a/dist2/config-cmake.h.in
+++ b/config-cmake.h.in
@@ -16,8 +16,6 @@
 #cmakedefine HAVE_SECURE_GETENV 1
 #cmakedefine HAVE_STRERROR 1
 
-#cmakedefine PCRE2_STATIC 1
-
 #cmakedefine SUPPORT_PCRE2_8 1
 #cmakedefine SUPPORT_PCRE2_16 1
 #cmakedefine SUPPORT_PCRE2_32 1
diff --git a/dist2/config.guess b/config.guess
similarity index 62%
rename from dist2/config.guess
rename to config.guess
index 0fc11ed..e81d3ae 100755
--- a/dist2/config.guess
+++ b/config.guess
@@ -1,8 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2020 Free Software Foundation, Inc.
+#   Copyright 1992-2021 Free Software Foundation, Inc.
 
-timestamp='2020-11-07'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-06-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,12 +29,20 @@
 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 #
 # Please send patches to <config-patches@gnu.org>.
 
 
-me=$(echo "$0" | sed -e 's,.*/,,')
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
 Usage: $0 [OPTION]
@@ -50,7 +60,7 @@
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2020 Free Software Foundation, Inc.
+Copyright 1992-2021 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,6 +94,9 @@
   exit 1
 fi
 
+# Just in case it came from the environment.
+GUESS=
+
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
 # compiler to aid in system detection is discouraged as it requires
 # temporary files to be created and, as you can see below, it is a
@@ -102,8 +115,8 @@
     # prevent multiple calls if $tmp is already set
     test "$tmp" && return 0
     : "${TMPDIR=/tmp}"
-    # shellcheck disable=SC2039
-    { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
+    # shellcheck disable=SC2039,SC3028
+    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
 	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
 	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
 	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
@@ -112,7 +125,7 @@
 	,,)    echo "int x;" > "$dummy.c"
 	       for driver in cc gcc c89 c99 ; do
 		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
-		       CC_FOR_BUILD="$driver"
+		       CC_FOR_BUILD=$driver
 		       break
 		   fi
 	       done
@@ -131,16 +144,14 @@
 	PATH=$PATH:/.attbin ; export PATH
 fi
 
-UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
-UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
-UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
-UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-case "$UNAME_SYSTEM" in
+case $UNAME_SYSTEM in
 Linux|GNU|GNU/*)
-	# If the system lacks a compiler, then just pick glibc.
-	# We could probably try harder.
-	LIBC=gnu
+	LIBC=unknown
 
 	set_cc_for_build
 	cat <<-EOF > "$dummy.c"
@@ -149,22 +160,37 @@
 	LIBC=uclibc
 	#elif defined(__dietlibc__)
 	LIBC=dietlibc
+	#elif defined(__GLIBC__)
+	LIBC=gnu
 	#else
 	#include <stdarg.h>
+	/* First heuristic to detect musl libc.  */
 	#ifdef __DEFINED_va_list
 	LIBC=musl
-	#else
-	LIBC=gnu
 	#endif
 	#endif
 	EOF
-	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
+	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+	eval "$cc_set_libc"
+
+	# Second heuristic to detect musl libc.
+	if [ "$LIBC" = unknown ] &&
+	   command -v ldd >/dev/null &&
+	   ldd --version 2>&1 | grep -q ^musl; then
+		LIBC=musl
+	fi
+
+	# If the system lacks a compiler, then just pick glibc.
+	# We could probably try harder.
+	if [ "$LIBC" = unknown ]; then
+		LIBC=gnu
+	fi
 	;;
 esac
 
 # Note: order is significant - the case branches are not exclusive.
 
-case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
+case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
     *:NetBSD:*:*)
 	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -176,12 +202,11 @@
 	#
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
-	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
-	    "/sbin/$sysctl" 2>/dev/null || \
-	    "/usr/sbin/$sysctl" 2>/dev/null || \
-	    echo unknown))
-	case "$UNAME_MACHINE_ARCH" in
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
+	    echo unknown)`
+	case $UNAME_MACHINE_ARCH in
 	    aarch64eb) machine=aarch64_be-unknown ;;
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
@@ -189,15 +214,15 @@
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
 	    earmv*)
-		arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')
-		endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')
-		machine="${arch}${endian}"-unknown
+		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
 		;;
-	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
+	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently (or will in the future) and ABI.
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
 	    earm*)
 		os=netbsdelf
 		;;
@@ -218,10 +243,10 @@
 		;;
 	esac
 	# Determine ABI tags.
-	case "$UNAME_MACHINE_ARCH" in
+	case $UNAME_MACHINE_ARCH in
 	    earm*)
 		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
-		abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
+		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
 		;;
 	esac
 	# The OS release
@@ -229,76 +254,82 @@
 	# thus, need a distinct triplet. However, they do not need
 	# kernel version information, so it can be replaced with a
 	# suitable tag, in the style of linux-gnu.
-	case "$UNAME_VERSION" in
+	case $UNAME_VERSION in
 	    Debian*)
 		release='-gnu'
 		;;
 	    *)
-		release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)
+		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "$machine-${os}${release}${abi-}"
-	exit ;;
+	GUESS=$machine-${os}${release}${abi-}
+	;;
     *:Bitrig:*:*)
-	UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
-	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
-	exit ;;
+	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
+	;;
     *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
-	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
-	exit ;;
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
+	;;
+    *:SecBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
+	;;
     *:LibertyBSD:*:*)
-	UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
-	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
-	exit ;;
+	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
+	;;
     *:MidnightBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
+	;;
     *:ekkoBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
+	;;
     *:SolidBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
+	;;
     *:OS108:*:*)
-	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
+	;;
     macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
+	;;
     *:MirBSD:*:*)
-	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
+	;;
     *:Sortix:*:*)
-	echo "$UNAME_MACHINE"-unknown-sortix
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-sortix
+	;;
     *:Twizzler:*:*)
-	echo "$UNAME_MACHINE"-unknown-twizzler
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-twizzler
+	;;
     *:Redox:*:*)
-	echo "$UNAME_MACHINE"-unknown-redox
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-redox
+	;;
     mips:OSF1:*.*)
-	echo mips-dec-osf1
-	exit ;;
+	GUESS=mips-dec-osf1
+	;;
     alpha:OSF1:*:*)
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	trap '' 0
 	case $UNAME_RELEASE in
 	*4.0)
-		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
 		;;
 	*5.*)
-		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
 		;;
 	esac
 	# According to Compaq, /usr/sbin/psrinfo has been available on
 	# OSF/1 and Tru64 systems produced since 1995.  I hope that
 	# covers most systems running today.  This code pipes the CPU
 	# types through head -n 1, so we only detect the type of CPU 0.
-	ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1)
-	case "$ALPHA_CPU_TYPE" in
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case $ALPHA_CPU_TYPE in
 	    "EV4 (21064)")
 		UNAME_MACHINE=alpha ;;
 	    "EV4.5 (21064)")
@@ -335,68 +366,69 @@
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
-	echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
-	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
-	exitcode=$?
-	trap '' 0
-	exit $exitcode ;;
+	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
+	;;
     Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit ;;
+	GUESS=m68k-unknown-sysv4
+	;;
     *:[Aa]miga[Oo][Ss]:*:*)
-	echo "$UNAME_MACHINE"-unknown-amigaos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-amigaos
+	;;
     *:[Mm]orph[Oo][Ss]:*:*)
-	echo "$UNAME_MACHINE"-unknown-morphos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-morphos
+	;;
     *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit ;;
+	GUESS=i370-ibm-openedition
+	;;
     *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
+	GUESS=s390-ibm-zvmoe
+	;;
     *:OS400:*:*)
-	echo powerpc-ibm-os400
-	exit ;;
+	GUESS=powerpc-ibm-os400
+	;;
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=arm-acorn-riscix$UNAME_RELEASE
+	;;
     arm*:riscos:*:*|arm*:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
+	GUESS=arm-unknown-riscos
+	;;
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
+	GUESS=hppa1.1-hitachi-hiuxmpp
+	;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "$( (/bin/universe) 2>/dev/null)" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit ;;
+	case `(/bin/universe) 2>/dev/null` in
+	    att) GUESS=pyramid-pyramid-sysv3 ;;
+	    *)   GUESS=pyramid-pyramid-bsd   ;;
+	esac
+	;;
     NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit ;;
+	GUESS=pyramid-pyramid-svr4
+	;;
     DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
+	GUESS=sparc-icl-nx6
+	;;
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-	case $(/usr/bin/uname -p) in
-	    sparc) echo sparc-icl-nx7; exit ;;
-	esac ;;
+	case `/usr/bin/uname -p` in
+	    sparc) GUESS=sparc-icl-nx7 ;;
+	esac
+	;;
     s390x:SunOS:*:*)
-	echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
+	;;
     sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-hal-solaris2$SUN_REL
+	;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-sun-solaris2$SUN_REL
+	;;
     i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-	echo i386-pc-auroraux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=i386-pc-auroraux$UNAME_RELEASE
+	;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
 	set_cc_for_build
 	SUN_ARCH=i386
@@ -411,41 +443,44 @@
 		SUN_ARCH=x86_64
 	    fi
 	fi
-	echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
+	;;
     sun4*:SunOS:6*:*)
 	# According to config.sub, this is the proper way to canonicalize
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
 	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=sparc-sun-solaris3$SUN_REL
+	;;
     sun4*:SunOS:*:*)
-	case "$(/usr/bin/arch -k)" in
+	case `/usr/bin/arch -k` in
 	    Series*|S4*)
-		UNAME_RELEASE=$(uname -v)
+		UNAME_RELEASE=`uname -v`
 		;;
 	esac
 	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
+	GUESS=sparc-sun-sunos$SUN_REL
+	;;
     sun3*:SunOS:*:*)
-	echo m68k-sun-sunos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-sun-sunos$UNAME_RELEASE
+	;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
-	case "$(/bin/arch)" in
+	case `/bin/arch` in
 	    sun3)
-		echo m68k-sun-sunos"$UNAME_RELEASE"
+		GUESS=m68k-sun-sunos$UNAME_RELEASE
 		;;
 	    sun4)
-		echo sparc-sun-sunos"$UNAME_RELEASE"
+		GUESS=sparc-sun-sunos$UNAME_RELEASE
 		;;
 	esac
-	exit ;;
+	;;
     aushp:SunOS:*:*)
-	echo sparc-auspex-sunos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-auspex-sunos$UNAME_RELEASE
+	;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -455,41 +490,41 @@
     # MiNT.  But MiNT is downward compatible to TOS, so this should
     # be no problem.
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-	echo m68k-atari-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-atari-mint$UNAME_RELEASE
+	;;
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-	echo m68k-milan-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-milan-mint$UNAME_RELEASE
+	;;
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-	echo m68k-hades-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-hades-mint$UNAME_RELEASE
+	;;
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-	echo m68k-unknown-mint"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-unknown-mint$UNAME_RELEASE
+	;;
     m68k:machten:*:*)
-	echo m68k-apple-machten"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-apple-machten$UNAME_RELEASE
+	;;
     powerpc:machten:*:*)
-	echo powerpc-apple-machten"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-apple-machten$UNAME_RELEASE
+	;;
     RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit ;;
+	GUESS=mips-dec-mach_bsd4.3
+	;;
     RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-dec-ultrix$UNAME_RELEASE
+	;;
     VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=vax-dec-ultrix$UNAME_RELEASE
+	;;
     2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix"$UNAME_RELEASE"
-	exit ;;
+	GUESS=clipper-intergraph-clix$UNAME_RELEASE
+	;;
     mips:*:*:UMIPS | mips:*:*:RISCos)
 	set_cc_for_build
 	sed 's/^	//' << EOF > "$dummy.c"
@@ -514,78 +549,79 @@
 	}
 EOF
 	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
-	  dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
-	  SYSTEM_NAME=$("$dummy" "$dummyarg") &&
+	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
 	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-mips-riscos$UNAME_RELEASE
+	;;
     Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit ;;
+	GUESS=powerpc-motorola-powermax
+	;;
     Motorola:*:4.3:PL8-*)
-	echo powerpc-harris-powermax
-	exit ;;
+	GUESS=powerpc-harris-powermax
+	;;
     Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-	echo powerpc-harris-powermax
-	exit ;;
+	GUESS=powerpc-harris-powermax
+	;;
     Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit ;;
+	GUESS=powerpc-harris-powerunix
+	;;
     m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit ;;
+	GUESS=m88k-harris-cxux7
+	;;
     m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit ;;
+	GUESS=m88k-motorola-sysv4
+	;;
     m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit ;;
+	GUESS=m88k-motorola-sysv3
+	;;
     AViiON:dgux:*:*)
 	# DG/UX returns AViiON for all architectures
-	UNAME_PROCESSOR=$(/usr/bin/uname -p)
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
 	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
 	then
 	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
 	       test "$TARGET_BINARY_INTERFACE"x = x
 	    then
-		echo m88k-dg-dgux"$UNAME_RELEASE"
+		GUESS=m88k-dg-dgux$UNAME_RELEASE
 	    else
-		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
+		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
 	    fi
 	else
-	    echo i586-dg-dgux"$UNAME_RELEASE"
+	    GUESS=i586-dg-dgux$UNAME_RELEASE
 	fi
-	exit ;;
+	;;
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit ;;
+	GUESS=m88k-dolphin-sysv3
+	;;
     M88*:*:R3*:*)
 	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit ;;
+	GUESS=m88k-motorola-sysv3
+	;;
     XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit ;;
+	GUESS=m88k-tektronix-sysv3
+	;;
     Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit ;;
+	GUESS=m68k-tektronix-bsd
+	;;
     *:IRIX*:*:*)
-	echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
-	exit ;;
+	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
+	GUESS=mips-sgi-irix$IRIX_REL
+	;;
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'$(uname -s)'" gives 'AIX '
+	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
+	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
     i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit ;;
+	GUESS=i386-ibm-aix
+	;;
     ia64:AIX:*:*)
 	if test -x /usr/bin/oslevel ; then
-		IBM_REV=$(/usr/bin/oslevel)
+		IBM_REV=`/usr/bin/oslevel`
 	else
-		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
 	fi
-	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
-	exit ;;
+	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
+	;;
     *:AIX:2:3)
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
 		set_cc_for_build
@@ -600,68 +636,68 @@
 			exit(0);
 			}
 EOF
-		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
 		then
-			echo "$SYSTEM_NAME"
+			GUESS=$SYSTEM_NAME
 		else
-			echo rs6000-ibm-aix3.2.5
+			GUESS=rs6000-ibm-aix3.2.5
 		fi
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
+		GUESS=rs6000-ibm-aix3.2.4
 	else
-		echo rs6000-ibm-aix3.2
+		GUESS=rs6000-ibm-aix3.2
 	fi
-	exit ;;
+	;;
     *:AIX:*:[4567])
-	IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }')
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
 		IBM_ARCH=powerpc
 	fi
 	if test -x /usr/bin/lslpp ; then
-		IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
-			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
-		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
+		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
 	fi
-	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
-	exit ;;
+	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
+	;;
     *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit ;;
+	GUESS=rs6000-ibm-aix
+	;;
     ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
-	echo romp-ibm-bsd4.4
-	exit ;;
+	GUESS=romp-ibm-bsd4.4
+	;;
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
+	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
+	;;                                  # report: romp-ibm BSD 4.3
     *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit ;;
+	GUESS=rs6000-bull-bosx
+	;;
     DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit ;;
+	GUESS=m68k-bull-sysv3
+	;;
     9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit ;;
+	GUESS=m68k-hp-bsd
+	;;
     hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit ;;
+	GUESS=m68k-hp-bsd4.4
+	;;
     9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
-	case "$UNAME_MACHINE" in
+	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+	case $UNAME_MACHINE in
 	    9000/31?)            HP_ARCH=m68000 ;;
 	    9000/[34]??)         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
 		if test -x /usr/bin/getconf; then
-		    sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)
-		    sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)
-		    case "$sc_cpu_version" in
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case $sc_cpu_version in
 		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
 		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
 		      532)                      # CPU_PA_RISC2_0
-			case "$sc_kernel_bits" in
+			case $sc_kernel_bits in
 			  32) HP_ARCH=hppa2.0n ;;
 			  64) HP_ARCH=hppa2.0w ;;
 			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
@@ -703,7 +739,7 @@
 		    exit (0);
 		}
 EOF
-		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
 		fi ;;
 	esac
@@ -728,12 +764,12 @@
 		HP_ARCH=hppa64
 	    fi
 	fi
-	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
-	exit ;;
+	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
+	;;
     ia64:HP-UX:*:*)
-	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
-	echo ia64-hp-hpux"$HPUX_REV"
-	exit ;;
+	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
+	GUESS=ia64-hp-hpux$HPUX_REV
+	;;
     3050*:HI-UX:*:*)
 	set_cc_for_build
 	sed 's/^	//' << EOF > "$dummy.c"
@@ -761,38 +797,38 @@
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
 		{ echo "$SYSTEM_NAME"; exit; }
-	echo unknown-hitachi-hiuxwe2
-	exit ;;
+	GUESS=unknown-hitachi-hiuxwe2
+	;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
-	echo hppa1.1-hp-bsd
-	exit ;;
+	GUESS=hppa1.1-hp-bsd
+	;;
     9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit ;;
+	GUESS=hppa1.0-hp-bsd
+	;;
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit ;;
+	GUESS=hppa1.0-hp-mpeix
+	;;
     hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
-	echo hppa1.1-hp-osf
-	exit ;;
+	GUESS=hppa1.1-hp-osf
+	;;
     hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit ;;
+	GUESS=hppa1.0-hp-osf
+	;;
     i*86:OSF1:*:*)
 	if test -x /usr/sbin/sysversion ; then
-	    echo "$UNAME_MACHINE"-unknown-osf1mk
+	    GUESS=$UNAME_MACHINE-unknown-osf1mk
 	else
-	    echo "$UNAME_MACHINE"-unknown-osf1
+	    GUESS=$UNAME_MACHINE-unknown-osf1
 	fi
-	exit ;;
+	;;
     parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit ;;
+	GUESS=hppa1.1-hp-lites
+	;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-	exit ;;
+	GUESS=c1-convex-bsd
+	;;
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
 	if getsysinfo -f scalar_acc
 	then echo c32-convex-bsd
@@ -800,17 +836,18 @@
 	fi
 	exit ;;
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-	exit ;;
+	GUESS=c34-convex-bsd
+	;;
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-	exit ;;
+	GUESS=c38-convex-bsd
+	;;
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-	exit ;;
+	GUESS=c4-convex-bsd
+	;;
     CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=ymp-cray-unicos$CRAY_REL
+	;;
     CRAY*[A-Z]90:*:*:*)
 	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
@@ -818,114 +855,126 @@
 	      -e 's/\.[^.]*$/.X/'
 	exit ;;
     CRAY*TS:*:*:*)
-	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=t90-cray-unicos$CRAY_REL
+	;;
     CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=alphaev5-cray-unicosmk$CRAY_REL
+	;;
     CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=sv1-cray-unicos$CRAY_REL
+	;;
     *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
+	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
+	GUESS=craynv-cray-unicosmp$CRAY_REL
+	;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
-	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
-	FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
-	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
+	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+	;;
     5000:UNIX_System_V:4.*:*)
-	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
-	FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
-	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
+	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
+	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
+	;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
+	;;
     sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
+	;;
     *:BSD/OS:*:*)
-	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
+	;;
     arm:FreeBSD:*:*)
-	UNAME_PROCESSOR=$(uname -p)
+	UNAME_PROCESSOR=`uname -p`
 	set_cc_for_build
 	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_PCS_VFP
 	then
-	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
+	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
 	else
-	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
+	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
 	fi
-	exit ;;
+	;;
     *:FreeBSD:*:*)
-	UNAME_PROCESSOR=$(/usr/bin/uname -p)
-	case "$UNAME_PROCESSOR" in
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	case $UNAME_PROCESSOR in
 	    amd64)
 		UNAME_PROCESSOR=x86_64 ;;
 	    i386)
 		UNAME_PROCESSOR=i586 ;;
 	esac
-	echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
-	exit ;;
+	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
+	;;
     i*:CYGWIN*:*)
-	echo "$UNAME_MACHINE"-pc-cygwin
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-cygwin
+	;;
     *:MINGW64*:*)
-	echo "$UNAME_MACHINE"-pc-mingw64
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-mingw64
+	;;
     *:MINGW*:*)
-	echo "$UNAME_MACHINE"-pc-mingw32
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-mingw32
+	;;
     *:MSYS*:*)
-	echo "$UNAME_MACHINE"-pc-msys
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-msys
+	;;
     i*:PW*:*)
-	echo "$UNAME_MACHINE"-pc-pw32
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-pw32
+	;;
     *:Interix*:*)
-	case "$UNAME_MACHINE" in
+	case $UNAME_MACHINE in
 	    x86)
-		echo i586-pc-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=i586-pc-interix$UNAME_RELEASE
+		;;
 	    authenticamd | genuineintel | EM64T)
-		echo x86_64-unknown-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=x86_64-unknown-interix$UNAME_RELEASE
+		;;
 	    IA64)
-		echo ia64-unknown-interix"$UNAME_RELEASE"
-		exit ;;
+		GUESS=ia64-unknown-interix$UNAME_RELEASE
+		;;
 	esac ;;
     i*:UWIN*:*)
-	echo "$UNAME_MACHINE"-pc-uwin
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-uwin
+	;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-pc-cygwin
-	exit ;;
+	GUESS=x86_64-pc-cygwin
+	;;
     prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
-	exit ;;
+	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
+	GUESS=powerpcle-unknown-solaris2$SUN_REL
+	;;
     *:GNU:*:*)
 	# the GNU system
-	echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"
-	exit ;;
+	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
+	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
+	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
+	;;
     *:GNU/*:*:*)
 	# other systems with GNU libc and userland
-	echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
-	exit ;;
+	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
+	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
+	;;
     *:Minix:*:*)
-	echo "$UNAME_MACHINE"-unknown-minix
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-minix
+	;;
     aarch64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     aarch64_be:Linux:*:*)
 	UNAME_MACHINE=aarch64_be
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     alpha:Linux:*:*)
-	case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
 	  EV5)   UNAME_MACHINE=alphaev5 ;;
 	  EV56)  UNAME_MACHINE=alphaev56 ;;
 	  PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -936,60 +985,63 @@
 	esac
 	objdump --private-headers /bin/sh | grep -q ld.so.1
 	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
-    arc:Linux:*:* | arceb:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
+    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     arm*:Linux:*:*)
 	set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
 	    | grep -q __ARM_EABI__
 	then
-	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
+	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
 	else
 	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
 		| grep -q __ARM_PCS_VFP
 	    then
-		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
+		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
 	    else
-		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
+		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
 	    fi
 	fi
-	exit ;;
+	;;
     avr32*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     cris:Linux:*:*)
-	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+	;;
     crisv32:Linux:*:*)
-	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
+	;;
     e2k:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     frv:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     hexagon:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     i*86:Linux:*:*)
-	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
+	;;
     ia64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     k1om:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
+    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     m32r*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     m68*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     mips:Linux:*:* | mips64:Linux:*:*)
 	set_cc_for_build
 	IS_GLIBC=0
@@ -1034,65 +1086,66 @@
 	#endif
 	#endif
 EOF
-	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
+	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
+	eval "$cc_set_vars"
 	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
 	;;
     mips64el:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     openrisc*:Linux:*:*)
-	echo or1k-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=or1k-unknown-linux-$LIBC
+	;;
     or32:Linux:*:* | or1k*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     padre:Linux:*:*)
-	echo sparc-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=sparc-unknown-linux-$LIBC
+	;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=hppa64-unknown-linux-$LIBC
+	;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
-	case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
-	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
-	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
-	  *)    echo hppa-unknown-linux-"$LIBC" ;;
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
+	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
+	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
 	esac
-	exit ;;
+	;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc64-unknown-linux-$LIBC
+	;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc-unknown-linux-$LIBC
+	;;
     ppc64le:Linux:*:*)
-	echo powerpc64le-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpc64le-unknown-linux-$LIBC
+	;;
     ppcle:Linux:*:*)
-	echo powerpcle-unknown-linux-"$LIBC"
-	exit ;;
-    riscv32:Linux:*:* | riscv64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=powerpcle-unknown-linux-$LIBC
+	;;
+    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     s390:Linux:*:* | s390x:Linux:*:*)
-	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
+	;;
     sh64*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     sh*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     tile*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     vax:Linux:*:*)
-	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
+	;;
     x86_64:Linux:*:*)
 	set_cc_for_build
 	LIBCABI=$LIBC
@@ -1101,71 +1154,71 @@
 		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
 		grep IS_X32 >/dev/null
 	    then
-		LIBCABI="$LIBC"x32
+		LIBCABI=${LIBC}x32
 	    fi
 	fi
-	echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
+	;;
     xtensa*:Linux:*:*)
-	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
+	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
 	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit ;;
+	GUESS=i386-sequent-sysv4
+	;;
     i*86:UNIX_SV:4.2MP:2.*)
 	# Unixware is an offshoot of SVR4, but it has its own version
 	# number series starting with 2...
 	# I am not positive that other SVR4 systems won't match this,
 	# I just have to hope.  -- rms.
 	# Use sysv4.2uw... so that sysv4* matches it.
-	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
+	;;
     i*86:OS/2:*:*)
 	# If we were able to find `uname', then EMX Unix compatibility
 	# is probably installed.
-	echo "$UNAME_MACHINE"-pc-os2-emx
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-os2-emx
+	;;
     i*86:XTS-300:*:STOP)
-	echo "$UNAME_MACHINE"-unknown-stop
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-stop
+	;;
     i*86:atheos:*:*)
-	echo "$UNAME_MACHINE"-unknown-atheos
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-atheos
+	;;
     i*86:syllable:*:*)
-	echo "$UNAME_MACHINE"-pc-syllable
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-syllable
+	;;
     i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
-	echo i386-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=i386-unknown-lynxos$UNAME_RELEASE
+	;;
     i*86:*DOS:*:*)
-	echo "$UNAME_MACHINE"-pc-msdosdjgpp
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
+	;;
     i*86:*:4.*:*)
-	UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//')
+	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
 	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
 	else
-		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
 	fi
-	exit ;;
+	;;
     i*86:*:5:[678]*)
 	# UnixWare 7.x, OpenUNIX and OpenServer 6.
-	case $(/bin/uname -X | grep "^Machine") in
+	case `/bin/uname -X | grep "^Machine"` in
 	    *486*)	     UNAME_MACHINE=i486 ;;
 	    *Pentium)	     UNAME_MACHINE=i586 ;;
 	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
 	esac
-	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	;;
     i*86:*:3.2:*)
 	if test -f /usr/options/cb.name; then
-		UNAME_REL=$(sed -n 's/.*Version //p' </usr/options/cb.name)
-		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //'))
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
 		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
 		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
@@ -1173,11 +1226,11 @@
 			&& UNAME_MACHINE=i686
 		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
+		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
 	else
-		echo "$UNAME_MACHINE"-pc-sysv32
+		GUESS=$UNAME_MACHINE-pc-sysv32
 	fi
-	exit ;;
+	;;
     pc:*:*:*)
 	# Left here for compatibility:
 	# uname -m prints for DJGPP always 'pc', but it prints nothing about
@@ -1185,37 +1238,37 @@
 	# Note: whatever this is, it MUST be the same as what config.sub
 	# prints for the "djgpp" host, or else GDB configure will decide that
 	# this is a cross-build.
-	echo i586-pc-msdosdjgpp
-	exit ;;
+	GUESS=i586-pc-msdosdjgpp
+	;;
     Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit ;;
+	GUESS=i386-pc-mach3
+	;;
     paragon:*:*:*)
-	echo i860-intel-osf1
-	exit ;;
+	GUESS=i860-intel-osf1
+	;;
     i860:*:4.*:*) # i860-SVR4
 	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
+	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
 	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
+	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
 	fi
-	exit ;;
+	;;
     mini*:CTIX:SYS*5:*)
 	# "miniframe"
-	echo m68010-convergent-sysv
-	exit ;;
+	GUESS=m68010-convergent-sysv
+	;;
     mc68k:UNIX:SYSTEM5:3.51m)
-	echo m68k-convergent-sysv
-	exit ;;
+	GUESS=m68k-convergent-sysv
+	;;
     M680?0:D-NIX:5.3:*)
-	echo m68k-diab-dnix
-	exit ;;
+	GUESS=m68k-diab-dnix
+	;;
     M68*:*:R3V[5678]*:*)
 	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
     3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
-	&& OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1226,7 +1279,7 @@
     NCR*:*:4.2:* | MPRAS*:*:4.2:*)
 	OS_REL='.3'
 	test -r /etc/.relid \
-	    && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid)
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
 	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
 	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
 	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
@@ -1234,118 +1287,118 @@
 	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
 	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
+	;;
     mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit ;;
+	GUESS=m68k-atari-sysv4
+	;;
     TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
+	;;
     rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
+	;;
     PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
-	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
+	;;
     SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-dde-sysv$UNAME_RELEASE
+	;;
     RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
+	GUESS=mips-sni-sysv4
+	;;
     RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
+	GUESS=mips-sni-sysv4
+	;;
     *:SINIX-*:*:*)
 	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=$( (uname -p) 2>/dev/null)
-		echo "$UNAME_MACHINE"-sni-sysv4
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		GUESS=$UNAME_MACHINE-sni-sysv4
 	else
-		echo ns32k-sni-sysv
+		GUESS=ns32k-sni-sysv
 	fi
-	exit ;;
+	;;
     PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
 			# says <Richard.M.Bartel@ccMail.Census.GOV>
-	echo i586-unisys-sysv4
-	exit ;;
+	GUESS=i586-unisys-sysv4
+	;;
     *:UNIX_System_V:4*:FTX*)
 	# From Gerald Hewes <hewes@openmarket.com>.
 	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
+	GUESS=hppa1.1-stratus-sysv4
+	;;
     *:*:*:FTX*)
 	# From seanf@swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
+	GUESS=i860-stratus-sysv4
+	;;
     i*86:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo "$UNAME_MACHINE"-stratus-vos
-	exit ;;
+	GUESS=$UNAME_MACHINE-stratus-vos
+	;;
     *:VOS:*:*)
 	# From Paul.Green@stratus.com.
-	echo hppa1.1-stratus-vos
-	exit ;;
+	GUESS=hppa1.1-stratus-vos
+	;;
     mc68*:A/UX:*:*)
-	echo m68k-apple-aux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=m68k-apple-aux$UNAME_RELEASE
+	;;
     news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit ;;
+	GUESS=mips-sony-newsos6
+	;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
 	if test -d /usr/nec; then
-		echo mips-nec-sysv"$UNAME_RELEASE"
+		GUESS=mips-nec-sysv$UNAME_RELEASE
 	else
-		echo mips-unknown-sysv"$UNAME_RELEASE"
+		GUESS=mips-unknown-sysv$UNAME_RELEASE
 	fi
-	exit ;;
+	;;
     BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit ;;
+	GUESS=powerpc-be-beos
+	;;
     BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit ;;
+	GUESS=powerpc-apple-beos
+	;;
     BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit ;;
+	GUESS=i586-pc-beos
+	;;
     BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
-	echo i586-pc-haiku
-	exit ;;
+	GUESS=i586-pc-haiku
+	;;
     x86_64:Haiku:*:*)
-	echo x86_64-unknown-haiku
-	exit ;;
+	GUESS=x86_64-unknown-haiku
+	;;
     SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx4-nec-superux$UNAME_RELEASE
+	;;
     SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx5-nec-superux$UNAME_RELEASE
+	;;
     SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx6-nec-superux$UNAME_RELEASE
+	;;
     SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx7-nec-superux$UNAME_RELEASE
+	;;
     SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx8-nec-superux$UNAME_RELEASE
+	;;
     SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sx8r-nec-superux$UNAME_RELEASE
+	;;
     SX-ACE:SUPER-UX:*:*)
-	echo sxace-nec-superux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=sxace-nec-superux$UNAME_RELEASE
+	;;
     Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
-	exit ;;
+	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
+	;;
     *:Rhapsody:*:*)
-	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
+	;;
     arm64:Darwin:*:*)
-	echo aarch64-apple-darwin"$UNAME_RELEASE"
-	exit ;;
+	GUESS=aarch64-apple-darwin$UNAME_RELEASE
+	;;
     *:Darwin:*:*)
-	UNAME_PROCESSOR=$(uname -p)
+	UNAME_PROCESSOR=`uname -p`
 	case $UNAME_PROCESSOR in
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
@@ -1379,109 +1432,116 @@
 	    # uname -m returns i386 or x86_64
 	    UNAME_PROCESSOR=$UNAME_MACHINE
 	fi
-	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
+	;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	UNAME_PROCESSOR=$(uname -p)
+	UNAME_PROCESSOR=`uname -p`
 	if test "$UNAME_PROCESSOR" = x86; then
 		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
+	;;
     *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit ;;
+	GUESS=i386-pc-qnx
+	;;
     NEO-*:NONSTOP_KERNEL:*:*)
-	echo neo-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=neo-tandem-nsk$UNAME_RELEASE
+	;;
     NSE-*:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nse-tandem-nsk$UNAME_RELEASE
+	;;
     NSR-*:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsr-tandem-nsk$UNAME_RELEASE
+	;;
     NSV-*:NONSTOP_KERNEL:*:*)
-	echo nsv-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsv-tandem-nsk$UNAME_RELEASE
+	;;
     NSX-*:NONSTOP_KERNEL:*:*)
-	echo nsx-tandem-nsk"$UNAME_RELEASE"
-	exit ;;
+	GUESS=nsx-tandem-nsk$UNAME_RELEASE
+	;;
     *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit ;;
+	GUESS=mips-compaq-nonstopux
+	;;
     BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit ;;
+	GUESS=bs2000-siemens-sysv
+	;;
     DS/*:UNIX_System_V:*:*)
-	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
+	;;
     *:Plan9:*:*)
 	# "uname -m" is not consistent, so use $cputype instead. 386
 	# is converted to i386 for consistency with other x86
 	# operating systems.
-	# shellcheck disable=SC2154
-	if test "$cputype" = 386; then
+	if test "${cputype-}" = 386; then
 	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
+	elif test "x${cputype-}" != x; then
+	    UNAME_MACHINE=$cputype
 	fi
-	echo "$UNAME_MACHINE"-unknown-plan9
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-plan9
+	;;
     *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit ;;
+	GUESS=pdp10-unknown-tops10
+	;;
     *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit ;;
+	GUESS=pdp10-unknown-tenex
+	;;
     KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit ;;
+	GUESS=pdp10-dec-tops20
+	;;
     XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit ;;
+	GUESS=pdp10-xkl-tops20
+	;;
     *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit ;;
+	GUESS=pdp10-unknown-tops20
+	;;
     *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit ;;
+	GUESS=pdp10-unknown-its
+	;;
     SEI:*:*:SEIUX)
-	echo mips-sei-seiux"$UNAME_RELEASE"
-	exit ;;
+	GUESS=mips-sei-seiux$UNAME_RELEASE
+	;;
     *:DragonFly:*:*)
-	echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
-	exit ;;
+	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
+	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
+	;;
     *:*VMS:*:*)
-	UNAME_MACHINE=$( (uname -p) 2>/dev/null)
-	case "$UNAME_MACHINE" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case $UNAME_MACHINE in
+	    A*) GUESS=alpha-dec-vms ;;
+	    I*) GUESS=ia64-dec-vms ;;
+	    V*) GUESS=vax-dec-vms ;;
 	esac ;;
     *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
+	GUESS=i386-pc-xenix
+	;;
     i*86:skyos:*:*)
-	echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')"
-	exit ;;
+	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
+	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
+	;;
     i*86:rdos:*:*)
-	echo "$UNAME_MACHINE"-pc-rdos
-	exit ;;
-    i*86:AROS:*:*)
-	echo "$UNAME_MACHINE"-pc-aros
-	exit ;;
+	GUESS=$UNAME_MACHINE-pc-rdos
+	;;
+    *:AROS:*:*)
+	GUESS=$UNAME_MACHINE-unknown-aros
+	;;
     x86_64:VMkernel:*:*)
-	echo "$UNAME_MACHINE"-unknown-esx
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-esx
+	;;
     amd64:Isilon\ OneFS:*:*)
-	echo x86_64-unknown-onefs
-	exit ;;
+	GUESS=x86_64-unknown-onefs
+	;;
     *:Unleashed:*:*)
-	echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
-	exit ;;
+	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
+	;;
 esac
 
+# Do we have a guess based on uname results?
+if test "x$GUESS" != x; then
+    echo "$GUESS"
+    exit
+fi
+
 # No uname command or uname output not recognized.
 set_cc_for_build
 cat > "$dummy.c" <<EOF
@@ -1521,7 +1581,7 @@
 #define __ARCHITECTURE__ "m68k"
 #endif
   int version;
-  version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null);
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
   if (version < 4)
     printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
   else
@@ -1613,7 +1673,7 @@
 }
 EOF
 
-$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) &&
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
 	{ echo "$SYSTEM_NAME"; exit; }
 
 # Apollos put the system type in the environment.
@@ -1621,7 +1681,7 @@
 
 echo "$0: unable to guess system type" >&2
 
-case "$UNAME_MACHINE:$UNAME_SYSTEM" in
+case $UNAME_MACHINE:$UNAME_SYSTEM in
     mips:Linux | mips64:Linux)
 	# If we got here on MIPS GNU/Linux, output extra information.
 	cat >&2 <<EOF
@@ -1638,14 +1698,16 @@
 operating system you are using. If your script is old, overwrite *all*
 copies of config.guess and config.sub with the latest versions from:
 
-  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
 and
-  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 EOF
 
-year=$(echo $timestamp | sed 's,-.*,,')
+our_year=`echo $timestamp | sed 's,-.*,,'`
+thisyear=`date +%Y`
 # shellcheck disable=SC2003
-if test "$(expr "$(date +%Y)" - "$year")" -lt 3 ; then
+script_age=`expr "$thisyear" - "$our_year"`
+if test "$script_age" -lt 3 ; then
    cat >&2 <<EOF
 
 If $0 has already been updated, send the following data and any
@@ -1654,20 +1716,20 @@
 
 config.guess timestamp = $timestamp
 
-uname -m = $( (uname -m) 2>/dev/null || echo unknown)
-uname -r = $( (uname -r) 2>/dev/null || echo unknown)
-uname -s = $( (uname -s) 2>/dev/null || echo unknown)
-uname -v = $( (uname -v) 2>/dev/null || echo unknown)
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
-/usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null)
-/bin/uname -X     = $( (/bin/uname -X) 2>/dev/null)
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
 
-hostinfo               = $( (hostinfo) 2>/dev/null)
-/bin/universe          = $( (/bin/universe) 2>/dev/null)
-/usr/bin/arch -k       = $( (/usr/bin/arch -k) 2>/dev/null)
-/bin/arch              = $( (/bin/arch) 2>/dev/null)
-/usr/bin/oslevel       = $( (/usr/bin/oslevel) 2>/dev/null)
-/usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null)
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
 
 UNAME_MACHINE = "$UNAME_MACHINE"
 UNAME_RELEASE = "$UNAME_RELEASE"
diff --git a/dist2/config.sub b/config.sub
similarity index 93%
rename from dist2/config.sub
rename to config.sub
index c874b7a..d80c5d7 100755
--- a/dist2/config.sub
+++ b/config.sub
@@ -1,8 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2020 Free Software Foundation, Inc.
+#   Copyright 1992-2021 Free Software Foundation, Inc.
 
-timestamp='2020-11-07'
+# shellcheck disable=SC2006,SC2268 # see below for rationale
+
+timestamp='2021-07-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -33,7 +35,7 @@
 # Otherwise, we print the canonical config type on stdout and succeed.
 
 # You can get the latest version of this script from:
-# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
 
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
@@ -50,7 +52,14 @@
 #	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 # It is wrong to echo any other type of specification.
 
-me=$(echo "$0" | sed -e 's,.*/,,')
+# The "shellcheck disable" line above the timestamp inhibits complaints
+# about features and limitations of the classic Bourne shell that were
+# superseded or lifted in POSIX.  However, this script identifies a wide
+# variety of pre-POSIX systems that do not have POSIX shells at all, and
+# even some reasonably current systems (Solaris 10 as case-in-point) still
+# have a pre-POSIX /bin/sh.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
 
 usage="\
 Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
@@ -67,7 +76,7 @@
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2020 Free Software Foundation, Inc.
+Copyright 1992-2021 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -769,22 +778,22 @@
 		vendor=hp
 		;;
 	i*86v32)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=sysv32
 		;;
 	i*86v4*)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=sysv4
 		;;
 	i*86v)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=sysv
 		;;
 	i*86sol2)
-		cpu=$(echo "$1" | sed -e 's/86.*/86/')
+		cpu=`echo "$1" | sed -e 's/86.*/86/'`
 		vendor=pc
 		basic_os=solaris2
 		;;
@@ -917,7 +926,7 @@
 		;;
 	leon-*|leon[3-9]-*)
 		cpu=sparc
-		vendor=$(echo "$basic_machine" | sed 's/-.*//')
+		vendor=`echo "$basic_machine" | sed 's/-.*//'`
 		;;
 
 	*-*)
@@ -1084,7 +1093,7 @@
 		cpu=mipsisa64sb1el
 		;;
 	sh5e[lb]-*)
-		cpu=$(echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/')
+		cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'`
 		;;
 	spur-*)
 		cpu=spur
@@ -1102,7 +1111,7 @@
 		cpu=x86_64
 		;;
 	xscale-* | xscalee[bl]-*)
-		cpu=$(echo "$cpu" | sed 's/^xscale/arm/')
+		cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
 		;;
 	arm64-*)
 		cpu=aarch64
@@ -1165,7 +1174,7 @@
 			| alphapca5[67] | alpha64pca5[67] \
 			| am33_2.0 \
 			| amdgcn \
-			| arc | arceb \
+			| arc | arceb | arc32 | arc64 \
 			| arm | arm[lb]e | arme[lb] | armv* \
 			| avr | avr32 \
 			| asmjs \
@@ -1185,6 +1194,7 @@
 			| k1om \
 			| le32 | le64 \
 			| lm32 \
+			| loongarch32 | loongarch64 | loongarchx32 \
 			| m32c | m32r | m32rle \
 			| m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \
 			| m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
@@ -1203,9 +1213,13 @@
 			| mips64vr5900 | mips64vr5900el \
 			| mipsisa32 | mipsisa32el \
 			| mipsisa32r2 | mipsisa32r2el \
+			| mipsisa32r3 | mipsisa32r3el \
+			| mipsisa32r5 | mipsisa32r5el \
 			| mipsisa32r6 | mipsisa32r6el \
 			| mipsisa64 | mipsisa64el \
 			| mipsisa64r2 | mipsisa64r2el \
+			| mipsisa64r3 | mipsisa64r3el \
+			| mipsisa64r5 | mipsisa64r5el \
 			| mipsisa64r6 | mipsisa64r6el \
 			| mipsisa64sb1 | mipsisa64sb1el \
 			| mipsisa64sr71k | mipsisa64sr71kel \
@@ -1229,7 +1243,7 @@
 			| powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \
 			| pru \
 			| pyramid \
-			| riscv | riscv32 | riscv64 \
+			| riscv | riscv32 | riscv32be | riscv64 | riscv64be \
 			| rl78 | romp | rs6000 | rx \
 			| s390 | s390x \
 			| score \
@@ -1241,6 +1255,7 @@
 			| sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \
 			| spu \
 			| tahoe \
+			| thumbv7* \
 			| tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
 			| tron \
 			| ubicom32 \
@@ -1286,15 +1301,15 @@
 case $basic_os in
 	gnu/linux*)
 		kernel=linux
-		os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|')
+		os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'`
 		;;
 	os2-emx)
 		kernel=os2
-		os=$(echo $basic_os | sed -e 's|os2-emx|emx|')
+		os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'`
 		;;
 	nto-qnx*)
 		kernel=nto
-		os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|')
+		os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'`
 		;;
 	*-*)
 		# shellcheck disable=SC2162
@@ -1305,11 +1320,11 @@
 	# Default OS when just kernel was specified
 	nto*)
 		kernel=nto
-		os=$(echo $basic_os | sed -e 's|nto|qnx|')
+		os=`echo "$basic_os" | sed -e 's|nto|qnx|'`
 		;;
 	linux*)
 		kernel=linux
-		os=$(echo $basic_os | sed -e 's|linux|gnu|')
+		os=`echo "$basic_os" | sed -e 's|linux|gnu|'`
 		;;
 	*)
 		kernel=
@@ -1330,7 +1345,7 @@
 		os=cnk
 		;;
 	solaris1 | solaris1.*)
-		os=$(echo $os | sed -e 's|solaris1|sunos4|')
+		os=`echo "$os" | sed -e 's|solaris1|sunos4|'`
 		;;
 	solaris)
 		os=solaris2
@@ -1359,7 +1374,7 @@
 		os=sco3.2v4
 		;;
 	sco3.2.[4-9]*)
-		os=$(echo $os | sed -e 's/sco3.2./sco3.2v/')
+		os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'`
 		;;
 	sco*v* | scout)
 		# Don't match below
@@ -1389,7 +1404,7 @@
 		os=lynxos
 		;;
 	mac[0-9]*)
-		os=$(echo "$os" | sed -e 's|mac|macos|')
+		os=`echo "$os" | sed -e 's|mac|macos|'`
 		;;
 	opened*)
 		os=openedition
@@ -1398,10 +1413,10 @@
 		os=os400
 		;;
 	sunos5*)
-		os=$(echo "$os" | sed -e 's|sunos5|solaris2|')
+		os=`echo "$os" | sed -e 's|sunos5|solaris2|'`
 		;;
 	sunos6*)
-		os=$(echo "$os" | sed -e 's|sunos6|solaris3|')
+		os=`echo "$os" | sed -e 's|sunos6|solaris3|'`
 		;;
 	wince*)
 		os=wince
@@ -1435,7 +1450,7 @@
 		;;
 	# Preserve the version number of sinix5.
 	sinix5.*)
-		os=$(echo $os | sed -e 's|sinix|sysv|')
+		os=`echo "$os" | sed -e 's|sinix|sysv|'`
 		;;
 	sinix*)
 		os=sysv4
@@ -1681,11 +1696,14 @@
 
 # Now, validate our (potentially fixed-up) OS.
 case $os in
-	# Sometimes we do "kernel-abi", so those need to count as OSes.
+	# Sometimes we do "kernel-libc", so those need to count as OSes.
 	musl* | newlib* | uclibc*)
 		;;
-	# Likewise for "kernel-libc"
-	eabi | eabihf | gnueabi | gnueabihf)
+	# Likewise for "kernel-abi"
+	eabi* | gnueabi*)
+		;;
+	# VxWorks passes extra cpu info in the 4th filed.
+	simlinux | simwindows | spe)
 		;;
 	# Now accept the basic system types.
 	# The portable systems comes first.
@@ -1702,12 +1720,12 @@
 	     | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \
 	     | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \
 	     | mirbsd* | netbsd* | dicos* | openedition* | ose* \
-	     | bitrig* | openbsd* | solidbsd* | libertybsd* | os108* \
+	     | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \
 	     | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \
 	     | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \
 	     | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \
 	     | udi* | lites* | ieee* | go32* | aux* | hcos* \
-	     | chorusrdb* | cegcc* | glidix* \
+	     | chorusrdb* | cegcc* | glidix* | serenity* \
 	     | cygwin* | msys* | pe* | moss* | proelf* | rtems* \
 	     | midipix* | mingw32* | mingw64* | mint* \
 	     | uxpv* | beos* | mpeix* | udk* | moxiebox* \
@@ -1749,6 +1767,8 @@
 		;;
 	kfreebsd*-gnu* | kopensolaris*-gnu*)
 		;;
+	vxworks-simlinux | vxworks-simwindows | vxworks-spe)
+		;;
 	nto-qnx*)
 		;;
 	os2-emx)
diff --git a/dist2/configure b/configure
similarity index 99%
rename from dist2/configure
rename to configure
index 319d8fb..9f55f6d 100755
--- a/dist2/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for PCRE2 10.37.
+# Generated by GNU Autoconf 2.71 for PCRE2 10.38.
 #
 #
 # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
@@ -618,8 +618,8 @@
 # Identity of this package.
 PACKAGE_NAME='PCRE2'
 PACKAGE_TARNAME='pcre2'
-PACKAGE_VERSION='10.37'
-PACKAGE_STRING='PCRE2 10.37'
+PACKAGE_VERSION='10.38'
+PACKAGE_STRING='PCRE2 10.38'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -767,6 +767,9 @@
 AM_DEFAULT_VERBOSITY
 AM_DEFAULT_V
 AM_V
+CSCOPE
+ETAGS
+CTAGS
 am__untar
 am__tar
 AMTAR
@@ -1449,7 +1452,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures PCRE2 10.37 to adapt to many kinds of systems.
+\`configure' configures PCRE2 10.38 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1520,7 +1523,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of PCRE2 10.37:";;
+     short | recursive ) echo "Configuration of PCRE2 10.38:";;
    esac
   cat <<\_ACEOF
 
@@ -1700,7 +1703,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-PCRE2 configure 10.37
+PCRE2 configure 10.38
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2055,7 +2058,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by PCRE2 $as_me 10.37, which was
+It was created by PCRE2 $as_me 10.38, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3327,7 +3330,7 @@
 
 # Define the identity of the package.
  PACKAGE='pcre2'
- VERSION='10.37'
+ VERSION='10.38'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -3373,6 +3376,20 @@
 
 
 
+# Variables for tags utilities; see am/tags.am
+if test -z "$CTAGS"; then
+  CTAGS=ctags
+fi
+
+if test -z "$ETAGS"; then
+  ETAGS=etags
+fi
+
+if test -z "$CSCOPE"; then
+  CSCOPE=cscope
+fi
+
+
 
 # POSIX will say in a future version that running "rm -f" with no argument
 # is OK; and we want to be able to make that assumption in our Makefile
@@ -13624,9 +13641,9 @@
 # Versioning
 
 PCRE2_MAJOR="10"
-PCRE2_MINOR="37"
+PCRE2_MINOR="38"
 PCRE2_PRERELEASE=""
-PCRE2_DATE="2021-05-26"
+PCRE2_DATE="2021-10-01"
 
 if test "$PCRE2_MINOR" = "08" -o "$PCRE2_MINOR" = "09"
 then
@@ -14426,6 +14443,12 @@
   printf "%s\n" "#define HAVE_MKOSTEMP 1" >>confdefs.h
 
 fi
+ac_fn_c_check_func "$LINENO" "realpath" "ac_cv_func_realpath"
+if test "x$ac_cv_func_realpath" = xyes
+then :
+  printf "%s\n" "#define HAVE_REALPATH 1" >>confdefs.h
+
+fi
 ac_fn_c_check_func "$LINENO" "secure_getenv" "ac_cv_func_secure_getenv"
 if test "x$ac_cv_func_secure_getenv" = xyes
 then :
@@ -15562,16 +15585,16 @@
 # are m4 variables, assigned above.
 
 EXTRA_LIBPCRE2_8_LDFLAGS="$EXTRA_LIBPCRE2_8_LDFLAGS \
-  $NO_UNDEFINED -version-info 10:2:10"
+  $NO_UNDEFINED -version-info 10:3:10"
 
 EXTRA_LIBPCRE2_16_LDFLAGS="$EXTRA_LIBPCRE2_16_LDFLAGS \
-  $NO_UNDEFINED -version-info 10:2:10"
+  $NO_UNDEFINED -version-info 10:3:10"
 
 EXTRA_LIBPCRE2_32_LDFLAGS="$EXTRA_LIBPCRE2_32_LDFLAGS \
-  $NO_UNDEFINED -version-info 10:2:10"
+  $NO_UNDEFINED -version-info 10:3:10"
 
 EXTRA_LIBPCRE2_POSIX_LDFLAGS="$EXTRA_LIBPCRE2_POSIX_LDFLAGS \
-  $NO_UNDEFINED -version-info 3:0:0"
+  $NO_UNDEFINED -version-info 3:1:0"
 
 
 
@@ -16678,7 +16701,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by PCRE2 $as_me 10.37, which was
+This file was extended by PCRE2 $as_me 10.38, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16746,7 +16769,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-PCRE2 config.status 10.37
+PCRE2 config.status 10.38
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/dist2/configure.ac b/configure.ac
similarity index 98%
rename from dist2/configure.ac
rename to configure.ac
index 69d940b..44bb50d 100644
--- a/dist2/configure.ac
+++ b/configure.ac
@@ -9,15 +9,15 @@
 dnl be defined as -RC2, for example. For real releases, it should be empty.
 
 m4_define(pcre2_major, [10])
-m4_define(pcre2_minor, [37])
+m4_define(pcre2_minor, [38])
 m4_define(pcre2_prerelease, [])
-m4_define(pcre2_date, [2021-05-26])
+m4_define(pcre2_date, [2021-10-01])
 
 # Libtool shared library interface versions (current:revision:age)
-m4_define(libpcre2_8_version,     [10:2:10])
-m4_define(libpcre2_16_version,    [10:2:10])
-m4_define(libpcre2_32_version,    [10:2:10])
-m4_define(libpcre2_posix_version, [3:0:0])
+m4_define(libpcre2_8_version,     [10:3:10])
+m4_define(libpcre2_16_version,    [10:3:10])
+m4_define(libpcre2_32_version,    [10:3:10])
+m4_define(libpcre2_posix_version, [3:1:0])
 
 # NOTE: The CMakeLists.txt file searches for the above variables in the first
 # 50 lines of this file. Please update that if the variables above are moved.
@@ -512,7 +512,7 @@
 
 # Checks for library functions.
 
-AC_CHECK_FUNCS(bcopy memfd_create memmove mkostemp secure_getenv strerror)
+AC_CHECK_FUNCS(bcopy memfd_create memmove mkostemp realpath secure_getenv strerror)
 
 # Check for the availability of libz (aka zlib)
 
diff --git a/dist2/depcomp b/depcomp
similarity index 99%
rename from dist2/depcomp
rename to depcomp
index 6b39162..715e343 100755
--- a/dist2/depcomp
+++ b/depcomp
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1999-2020 Free Software Foundation, Inc.
+# Copyright (C) 1999-2021 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/dist2/doc/pcre2_match_data_create_from_pattern.3 b/dist2/doc/pcre2_match_data_create_from_pattern.3
deleted file mode 100644
index 60bf77c..0000000
--- a/dist2/doc/pcre2_match_data_create_from_pattern.3
+++ /dev/null
@@ -1,37 +0,0 @@
-.TH PCRE2_MATCH_DATA_CREATE_FROM_PATTERN 3 "29 July 2015" "PCRE2 10.21"
-.SH NAME
-PCRE2 - Perl-compatible regular expressions (revised API)
-.SH SYNOPSIS
-.rs
-.sp
-.B #include <pcre2.h>
-.PP
-.nf
-.B pcre2_match_data *pcre2_match_data_create_from_pattern(
-.B "  const pcre2_code *\fIcode\fP, pcre2_general_context *\fIgcontext\fP);"
-.fi
-.
-.SH DESCRIPTION
-.rs
-.sp
-This function creates a new match data block, which is used for holding the
-result of a match. The first argument points to a compiled pattern. The number
-of capturing parentheses within the pattern is used to compute the number of
-pairs of offsets that are required in the match data block. These form the
-"output vector" (ovector) within the match data block, and are used to identify
-the matched string and any captured substrings.
-.P
-The second argument points to a general context, for custom memory management,
-or is NULL to use the same memory allocator as was used for the compiled
-pattern. The result of the function is NULL if the memory for the block could
-not be obtained.
-.P
-There is a complete description of the PCRE2 native API in the
-.\" HREF
-\fBpcre2api\fP
-.\"
-page and a description of the POSIX API in the
-.\" HREF
-\fBpcre2posix\fP
-.\"
-page.
diff --git a/dist2/doc/pcre2grep.txt b/dist2/doc/pcre2grep.txt
deleted file mode 100644
index 0e839c7..0000000
--- a/dist2/doc/pcre2grep.txt
+++ /dev/null
@@ -1,1020 +0,0 @@
-PCRE2GREP(1)                General Commands Manual               PCRE2GREP(1)
-
-
-
-NAME
-       pcre2grep - a grep with Perl-compatible regular expressions.
-
-SYNOPSIS
-       pcre2grep [options] [long options] [pattern] [path1 path2 ...]
-
-
-DESCRIPTION
-
-       pcre2grep  searches  files  for  character patterns, in the same way as
-       other grep commands do, but it uses the PCRE2  regular  expression  li-
-       brary  to support patterns that are compatible with the regular expres-
-       sions of Perl 5. See pcre2syntax(3) for a  quick-reference  summary  of
-       pattern syntax, or pcre2pattern(3) for a full description of the syntax
-       and semantics of the regular expressions that PCRE2 supports.
-
-       Patterns, whether supplied on the command line or in a  separate  file,
-       are given without delimiters. For example:
-
-         pcre2grep Thursday /etc/motd
-
-       If you attempt to use delimiters (for example, by surrounding a pattern
-       with slashes, as is common in Perl scripts), they  are  interpreted  as
-       part  of  the pattern. Quotes can of course be used to delimit patterns
-       on the command line because they are interpreted by the shell, and  in-
-       deed  quotes  are  required  if a pattern contains white space or shell
-       metacharacters.
-
-       The first argument that follows any option settings is treated  as  the
-       single  pattern  to be matched when neither -e nor -f is present.  Con-
-       versely, when one or both of these options are  used  to  specify  pat-
-       terns, all arguments are treated as path names. At least one of -e, -f,
-       or an argument pattern must be provided.
-
-       If no files are specified, pcre2grep  reads  the  standard  input.  The
-       standard  input can also be referenced by a name consisting of a single
-       hyphen.  For example:
-
-         pcre2grep some-pattern file1 - file3
-
-       Input files are searched line by  line.  By  default,  each  line  that
-       matches  a  pattern  is  copied to the standard output, and if there is
-       more than one file, the file name is output at the start of each  line,
-       followed  by  a  colon.  However, there are options that can change how
-       pcre2grep behaves. In particular, the -M option makes  it  possible  to
-       search  for  strings  that  span  line  boundaries. What defines a line
-       boundary is controlled by the -N (--newline) option.
-
-       The amount of memory used for buffering files that are being scanned is
-       controlled  by  parameters  that  can  be  set by the --buffer-size and
-       --max-buffer-size options. The first of these sets the size  of  buffer
-       that  is obtained at the start of processing. If an input file contains
-       very long lines, a larger buffer may be needed; this is handled by  au-
-       tomatically  extending  the buffer, up to the limit specified by --max-
-       buffer-size. The default values for these parameters can  be  set  when
-       pcre2grep  is  built;  if nothing is specified, the defaults are set to
-       20KiB and 1MiB respectively. An error occurs if a line is too long  and
-       the buffer can no longer be expanded.
-
-       The  block  of  memory that is actually used is three times the "buffer
-       size", to allow for buffering "before" and "after" lines. If the buffer
-       size  is too small, fewer than requested "before" and "after" lines may
-       be output.
-
-       Patterns can be no longer than 8KiB or BUFSIZ bytes, whichever  is  the
-       greater.   BUFSIZ  is defined in <stdio.h>. When there is more than one
-       pattern (specified by the use of -e and/or -f), each pattern is applied
-       to  each  line  in the order in which they are defined, except that all
-       the -e patterns are tried before the -f patterns.
-
-       By default, as soon as one pattern matches a line, no further  patterns
-       are considered. However, if --colour (or --color) is used to colour the
-       matching substrings, or if --only-matching, --file-offsets, or  --line-
-       offsets  is  used to output only the part of the line that matched (ei-
-       ther shown literally, or as an offset),  scanning  resumes  immediately
-       following  the  match,  so that further matches on the same line can be
-       found. If there are multiple patterns, they are all tried  on  the  re-
-       mainder  of the line, but patterns that follow the one that matched are
-       not tried on the earlier matched part of the line.
-
-       This behaviour means that the order  in  which  multiple  patterns  are
-       specified  can affect the output when one of the above options is used.
-       This is no longer the same behaviour as GNU grep, which now manages  to
-       display  earlier  matches  for  later  patterns (as long as there is no
-       overlap).
-
-       Patterns that can match an empty string are accepted, but empty  string
-       matches   are  never  recognized.  An  example  is  the  pattern  "(su-
-       per)?(man)?", in which all components are optional. This pattern  finds
-       all  occurrences  of  both  "super"  and "man"; the output differs from
-       matching with "super|man" when only the matching substrings  are  being
-       shown.
-
-       If  the  LC_ALL or LC_CTYPE environment variable is set, pcre2grep uses
-       the value to set a locale when calling the PCRE2 library.  The --locale
-       option can be used to override this.
-
-
-SUPPORT FOR COMPRESSED FILES
-
-       It  is  possible to compile pcre2grep so that it uses libz or libbz2 to
-       read compressed files whose names end in .gz or .bz2, respectively. You
-       can  find out whether your pcre2grep binary has support for one or both
-       of these file types by running it with the --help option. If the appro-
-       priate support is not present, all files are treated as plain text. The
-       standard input is always so treated. When input is  from  a  compressed
-       .gz or .bz2 file, the --line-buffered option is ignored.
-
-
-BINARY FILES
-
-       By  default,  a  file that contains a binary zero byte within the first
-       1024 bytes is identified as a binary file, and is processed  specially.
-       However,  if  the  newline  type is specified as NUL, that is, the line
-       terminator is a binary zero, the test for a binary file is not applied.
-       See  the  --binary-files  option for a means of changing the way binary
-       files are handled.
-
-
-BINARY ZEROS IN PATTERNS
-
-       Patterns passed from the command line are strings that  are  terminated
-       by  a  binary zero, so cannot contain internal zeros. However, patterns
-       that are read from a file via the -f option may contain binary zeros.
-
-
-OPTIONS
-
-       The order in which some of the options appear can  affect  the  output.
-       For  example,  both  the  -H and -l options affect the printing of file
-       names. Whichever comes later in the command line will be the  one  that
-       takes  effect.  Similarly,  except  where  noted below, if an option is
-       given twice, the later setting is used. Numerical  values  for  options
-       may  be  followed  by  K  or  M,  to  signify multiplication by 1024 or
-       1024*1024 respectively.
-
-       --        This terminates the list of options. It is useful if the next
-                 item  on  the command line starts with a hyphen but is not an
-                 option. This allows for the processing of patterns  and  file
-                 names that start with hyphens.
-
-       -A number, --after-context=number
-                 Output  up  to  number  lines  of context after each matching
-                 line. Fewer lines are output if the next match or the end  of
-                 the  file  is  reached,  or if the processing buffer size has
-                 been set too small. If file names and/or line numbers are be-
-                 ing output, a hyphen separator is used instead of a colon for
-                 the context lines. A line containing "--" is  output  between
-                 each  group  of  lines, unless they are in fact contiguous in
-                 the input file. The value of number is expected to  be  rela-
-                 tively small. When -c is used, -A is ignored.
-
-       -a, --text
-                 Treat  binary  files as text. This is equivalent to --binary-
-                 files=text.
-
-       -B number, --before-context=number
-                 Output up to number lines of  context  before  each  matching
-                 line.  Fewer  lines  are  output if the previous match or the
-                 start of the file is within number lines, or if the  process-
-                 ing  buffer size has been set too small. If file names and/or
-                 line numbers are being output, a hyphen separator is used in-
-                 stead  of  a  colon  for the context lines. A line containing
-                 "--" is output between each group of lines, unless  they  are
-                 in  fact contiguous in the input file. The value of number is
-                 expected to be relatively small. When -c is used, -B  is  ig-
-                 nored.
-
-       --binary-files=word
-                 Specify  how binary files are to be processed. If the word is
-                 "binary" (the default), pattern matching is performed on  bi-
-                 nary  files,  but  the  only  output  is  "Binary file <name>
-                 matches" when a match succeeds. If the word is "text",  which
-                 is  equivalent  to  the -a or --text option, binary files are
-                 processed in the same way as any other file.  In  this  case,
-                 when  a  match  succeeds,  the  output may be binary garbage,
-                 which can have nasty effects if sent to a  terminal.  If  the
-                 word  is  "without-match",  which is equivalent to the -I op-
-                 tion, binary files are not processed at all; they are assumed
-                 not  to  be  of  interest and are skipped without causing any
-                 output or affecting the return code.
-
-       --buffer-size=number
-                 Set the parameter that controls how much memory  is  obtained
-                 at the start of processing for buffering files that are being
-                 scanned. See also --max-buffer-size below.
-
-       -C number, --context=number
-                 Output number lines of context both  before  and  after  each
-                 matching  line.  This is equivalent to setting both -A and -B
-                 to the same value.
-
-       -c, --count
-                 Do not output lines from the files that  are  being  scanned;
-                 instead  output  the  number  of  lines  that would have been
-                 shown, either because they matched, or, if -v is set, because
-                 they  failed  to match. By default, this count is exactly the
-                 same as the number of lines that would have been output,  but
-                 if  the -M (multiline) option is used (without -v), there may
-                 be more suppressed lines than the count (that is, the  number
-                 of matches).
-
-                 If  no lines are selected, the number zero is output. If sev-
-                 eral files are are being scanned, a count is output for  each
-                 of  them and the -t option can be used to cause a total to be
-                 output at the end. However, if the  --files-with-matches  op-
-                 tion  is also used, only those files whose counts are greater
-                 than zero are listed. When -c is used, the -A, -B, and -C op-
-                 tions are ignored.
-
-       --colour, --color
-                 If this option is given without any data, it is equivalent to
-                 "--colour=auto".  If data is required, it must  be  given  in
-                 the same shell item, separated by an equals sign.
-
-       --colour=value, --color=value
-                 This option specifies under what circumstances the parts of a
-                 line that matched a pattern should be coloured in the output.
-                 By  default,  the output is not coloured. The value (which is
-                 optional, see above) may be "never", "always", or "auto".  In
-                 the  latter case, colouring happens only if the standard out-
-                 put is connected to a terminal. More resources are used  when
-                 colouring is enabled, because pcre2grep has to search for all
-                 possible matches in a line, not just one, in order to  colour
-                 them all.
-
-                 The  colour  that  is used can be specified by setting one of
-                 the environment variables PCRE2GREP_COLOUR,  PCRE2GREP_COLOR,
-                 PCREGREP_COLOUR, or PCREGREP_COLOR, which are checked in that
-                 order.  If  none  of  these  are  set,  pcre2grep  looks  for
-                 GREP_COLORS  or  GREP_COLOR (in that order). The value of the
-                 variable should be a string of two numbers,  separated  by  a
-                 semicolon,  except  in  the  case  of GREP_COLORS, which must
-                 start with "ms=" or "mt=" followed by two semicolon-separated
-                 colours,  terminated  by the end of the string or by a colon.
-                 If GREP_COLORS does not start with "ms=" or "mt=" it  is  ig-
-                 nored, and GREP_COLOR is checked.
-
-                 If  the  string obtained from one of the above variables con-
-                 tains any characters other than semicolon or digits, the set-
-                 ting is ignored and the default colour is used. The string is
-                 copied directly into the control string for setting colour on
-                 a  terminal,  so it is your responsibility to ensure that the
-                 values make sense. If no  relevant  environment  variable  is
-                 set, the default is "1;31", which gives red.
-
-       -D action, --devices=action
-                 If  an  input path is not a regular file or a directory, "ac-
-                 tion" specifies how it is to be processed. Valid  values  are
-                 "read" (the default) or "skip" (silently skip the path).
-
-       -d action, --directories=action
-                 If an input path is a directory, "action" specifies how it is
-                 to be processed.  Valid values are  "read"  (the  default  in
-                 non-Windows  environments,  for compatibility with GNU grep),
-                 "recurse" (equivalent to the -r option), or "skip"  (silently
-                 skip  the  path, the default in Windows environments). In the
-                 "read" case, directories are read as if  they  were  ordinary
-                 files.  In some operating systems the effect of reading a di-
-                 rectory like this is an immediate end-of-file; in  others  it
-                 may provoke an error.
-
-       --depth-limit=number
-                 See --match-limit below.
-
-       -e pattern, --regex=pattern, --regexp=pattern
-                 Specify a pattern to be matched. This option can be used mul-
-                 tiple times in order to specify several patterns. It can also
-                 be  used  as a way of specifying a single pattern that starts
-                 with a hyphen. When -e is used, no argument pattern is  taken
-                 from  the  command  line;  all  arguments are treated as file
-                 names. There is no limit to the number of patterns. They  are
-                 applied  to  each line in the order in which they are defined
-                 until one matches.
-
-                 If -f is used with -e, the command line patterns are  matched
-                 first, followed by the patterns from the file(s), independent
-                 of the order in which these options are specified. Note  that
-                 multiple  use  of -e is not the same as a single pattern with
-                 alternatives. For example, X|Y finds the first character in a
-                 line  that  is  X or Y, whereas if the two patterns are given
-                 separately, with X first, pcre2grep finds X if it is present,
-                 even if it follows Y in the line. It finds Y only if there is
-                 no X in the line. This matters only if you are  using  -o  or
-                 --colo(u)r to show the part(s) of the line that matched.
-
-       --exclude=pattern
-                 Files (but not directories) whose names match the pattern are
-                 skipped without being processed. This applies to  all  files,
-                 whether  listed  on  the  command line, obtained from --file-
-                 list, or by scanning a directory. The pattern is a PCRE2 reg-
-                 ular  expression,  and is matched against the final component
-                 of the file name, not the entire path. The -F, -w, and -x op-
-                 tions  do  not apply to this pattern. The option may be given
-                 any number of times in order to specify multiple patterns. If
-                 a  file  name matches both an --include and an --exclude pat-
-                 tern, it is excluded. There is no short form for this option.
-
-       --exclude-from=filename
-                 Treat each non-empty line of the file  as  the  data  for  an
-                 --exclude option. What constitutes a newline when reading the
-                 file is the operating system's default. The --newline  option
-                 has  no  effect on this option. This option may be given more
-                 than once in order to specify a number of files to read.
-
-       --exclude-dir=pattern
-                 Directories whose names match the pattern are skipped without
-                 being  processed, whatever the setting of the --recursive op-
-                 tion. This applies to all directories, whether listed on  the
-                 command  line,  obtained  from  --file-list, or by scanning a
-                 parent directory. The pattern is a PCRE2 regular  expression,
-                 and  is  matched against the final component of the directory
-                 name, not the entire path. The -F, -w, and -x options do  not
-                 apply  to this pattern. The option may be given any number of
-                 times in order to specify more than one pattern. If a  direc-
-                 tory  matches both --include-dir and --exclude-dir, it is ex-
-                 cluded. There is no short form for this option.
-
-       -F, --fixed-strings
-                 Interpret each data-matching  pattern  as  a  list  of  fixed
-                 strings,  separated  by newlines, instead of as a regular ex-
-                 pression. What constitutes a newline for this purpose is con-
-                 trolled by the --newline option. The -w (match as a word) and
-                 -x (match whole line) options can be used with -F.  They  ap-
-                 ply  to  each of the fixed strings. A line is selected if any
-                 of the fixed strings are found in it (subject to -w or -x, if
-                 present).  This  option applies only to the patterns that are
-                 matched against the contents of files; it does not  apply  to
-                 patterns  specified  by any of the --include or --exclude op-
-                 tions.
-
-       -f filename, --file=filename
-                 Read patterns from the file, one per  line,  and  match  them
-                 against  each  line of input. As is the case with patterns on
-                 the command line, no delimiters should be used. What  consti-
-                 tutes  a  newline when reading the file is the operating sys-
-                 tem's default interpretation of \n. The --newline option  has
-                 no  effect  on  this  option. Trailing white space is removed
-                 from each line, and blank lines are ignored.  An  empty  file
-                 contains  no patterns and therefore matches nothing. Patterns
-                 read from a file in this way may contain binary zeros,  which
-                 are  treated  as  ordinary data characters. See also the com-
-                 ments about multiple patterns versus a  single  pattern  with
-                 alternatives in the description of -e above.
-
-                 If  this  option  is  given more than once, all the specified
-                 files are read. A data line is output if any of the  patterns
-                 match  it.  A  file  name can be given as "-" to refer to the
-                 standard input. When -f is used, patterns  specified  on  the
-                 command  line  using  -e may also be present; they are tested
-                 before the file's patterns.  However,  no  other  pattern  is
-                 taken from the command line; all arguments are treated as the
-                 names of paths to be searched.
-
-       --file-list=filename
-                 Read a list of  files  and/or  directories  that  are  to  be
-                 scanned from the given file, one per line. What constitutes a
-                 newline when reading the file is the operating  system's  de-
-                 fault.  Trailing  white  space is removed from each line, and
-                 blank lines are ignored. These paths are processed before any
-                 that  are  listed  on  the command line. The file name can be
-                 given as "-" to refer to the standard input.  If  --file  and
-                 --file-list  are  both  specified  as  "-", patterns are read
-                 first. This is useful only when the standard input is a  ter-
-                 minal,  from  which  further lines (the list of files) can be
-                 read after an end-of-file indication. If this option is given
-                 more than once, all the specified files are read.
-
-       --file-offsets
-                 Instead  of  showing lines or parts of lines that match, show
-                 each match as an offset from the start  of  the  file  and  a
-                 length,  separated  by  a  comma. In this mode, no context is
-                 shown. That is, the -A, -B, and -C options  are  ignored.  If
-                 there is more than one match in a line, each of them is shown
-                 separately. This option is mutually exclusive with  --output,
-                 --line-offsets, and --only-matching.
-
-       -H, --with-filename
-                 Force  the  inclusion of the file name at the start of output
-                 lines when searching a single file. By default, the file name
-                 is not shown in this case.  For matching lines, the file name
-                 is followed by a colon; for context lines, a hyphen separator
-                 is  used.  If  a line number is also being output, it follows
-                 the file name. When the -M option causes a pattern  to  match
-                 more  than  one  line, only the first is preceded by the file
-                 name. This option overrides any previous -h, -l,  or  -L  op-
-                 tions.
-
-       -h, --no-filename
-                 Suppress the output file names when searching multiple files.
-                 By default, file names are  shown  when  multiple  files  are
-                 searched.  For matching lines, the file name is followed by a
-                 colon; for context lines, a hyphen separator is used.   If  a
-                 line  number  is also being output, it follows the file name.
-                 This option overrides any previous -H, -L, or -l options.
-
-       --heap-limit=number
-                 See --match-limit below.
-
-       --help    Output a help message, giving brief details  of  the  command
-                 options  and  file type support, and then exit. Anything else
-                 on the command line is ignored.
-
-       -I        Ignore  binary  files.  This  is  equivalent   to   --binary-
-                 files=without-match.
-
-       -i, --ignore-case
-                 Ignore upper/lower case distinctions during comparisons.
-
-       --include=pattern
-                 If  any --include patterns are specified, the only files that
-                 are processed are those whose names match one of the patterns
-                 and  do  not match an --exclude pattern. This option does not
-                 affect directories, but it  applies  to  all  files,  whether
-                 listed  on the command line, obtained from --file-list, or by
-                 scanning a directory. The pattern is a PCRE2 regular  expres-
-                 sion,  and is matched against the final component of the file
-                 name, not the entire path. The -F, -w, and -x options do  not
-                 apply  to this pattern. The option may be given any number of
-                 times. If a file name matches both an --include and an  --ex-
-                 clude  pattern,  it  is excluded.  There is no short form for
-                 this option.
-
-       --include-from=filename
-                 Treat each non-empty line of the file  as  the  data  for  an
-                 --include option. What constitutes a newline for this purpose
-                 is the operating system's default. The --newline  option  has
-                 no effect on this option. This option may be given any number
-                 of times; all the files are read.
-
-       --include-dir=pattern
-                 If any --include-dir patterns are specified, the only  direc-
-                 tories  that are processed are those whose names match one of
-                 the patterns and do not match an --exclude-dir pattern.  This
-                 applies  to  all  directories,  whether listed on the command
-                 line, obtained from --file-list, or by scanning a parent  di-
-                 rectory.  The  pattern  is a PCRE2 regular expression, and is
-                 matched against the final component of  the  directory  name,
-                 not  the entire path. The -F, -w, and -x options do not apply
-                 to this pattern. The option may be given any number of times.
-                 If  a directory matches both --include-dir and --exclude-dir,
-                 it is excluded. There is no short form for this option.
-
-       -L, --files-without-match
-                 Instead of outputting lines from the files, just  output  the
-                 names  of  the files that do not contain any lines that would
-                 have been output. Each file name is output once, on  a  sepa-
-                 rate  line.  This option overrides any previous -H, -h, or -l
-                 options.
-
-       -l, --files-with-matches
-                 Instead of outputting lines from the files, just  output  the
-                 names of the files containing lines that would have been out-
-                 put. Each file name is  output  once,  on  a  separate  line.
-                 Searching  normally stops as soon as a matching line is found
-                 in a file. However, if the -c (count) option  is  also  used,
-                 matching  continues in order to obtain the correct count, and
-                 those files that have at least one  match  are  listed  along
-                 with their counts. Using this option with -c is a way of sup-
-                 pressing the listing of files with  no  matches  that  occurs
-                 with  -c  on  its own. This option overrides any previous -H,
-                 -h, or -L options.
-
-       --label=name
-                 This option supplies a name to be used for the standard input
-                 when file names are being output. If not supplied, "(standard
-                 input)" is used. There is no short form for this option.
-
-       --line-buffered
-                 When this option is given, non-compressed input is  read  and
-                 processed  line by line, and the output is flushed after each
-                 write. By default, input is  read  in  large  chunks,  unless
-                 pcre2grep  can  determine that it is reading from a terminal,
-                 which is currently possible only in Unix-like environments or
-                 Windows. Output to terminal is normally automatically flushed
-                 by the operating system. This option can be useful  when  the
-                 input  or  output  is  attached to a pipe and you do not want
-                 pcre2grep to buffer up large amounts of data.   However,  its
-                 use  will  affect  performance, and the -M (multiline) option
-                 ceases to work. When input is from a compressed .gz  or  .bz2
-                 file, --line-buffered is ignored.
-
-       --line-offsets
-                 Instead  of  showing lines or parts of lines that match, show
-                 each match as a line number, the offset from the start of the
-                 line,  and a length. The line number is terminated by a colon
-                 (as usual; see the -n option), and the offset and length  are
-                 separated  by  a  comma.  In  this mode, no context is shown.
-                 That is, the -A, -B, and -C options are ignored. If there  is
-                 more  than  one  match in a line, each of them is shown sepa-
-                 rately. This option  is  mutually  exclusive  with  --output,
-                 --file-offsets, and --only-matching.
-
-       --locale=locale-name
-                 This  option specifies a locale to be used for pattern match-
-                 ing. It overrides the value in the LC_ALL or  LC_CTYPE  envi-
-                 ronment  variables.  If no locale is specified, the PCRE2 li-
-                 brary's default (usually the "C" locale) is used. There is no
-                 short form for this option.
-
-       -M, --multiline
-                 Allow  patterns to match more than one line. When this option
-                 is set, the PCRE2 library is called in "multiline" mode. This
-                 allows  a matched string to extend past the end of a line and
-                 continue on one or more subsequent lines. Patterns used  with
-                 -M may usefully contain literal newline characters and inter-
-                 nal occurrences of ^ and $ characters. The output for a  suc-
-                 cessful  match  may  consist of more than one line. The first
-                 line is the line in which the match  started,  and  the  last
-                 line  is  the  line  in which the match ended. If the matched
-                 string ends with a newline sequence, the output ends  at  the
-                 end  of  that  line.   If  -v  is set, none of the lines in a
-                 multi-line match are output. Once a match has  been  handled,
-                 scanning  restarts at the beginning of the line after the one
-                 in which the match ended.
-
-                 The newline sequence that separates multiple  lines  must  be
-                 matched  as  part  of  the  pattern. For example, to find the
-                 phrase "regular expression" in a file where  "regular"  might
-                 be  at the end of a line and "expression" at the start of the
-                 next line, you could use this command:
-
-                   pcre2grep -M 'regular\s+expression' <file>
-
-                 The \s escape sequence matches any white space character, in-
-                 cluding  newlines, and is followed by + so as to match trail-
-                 ing white space on the first line as well  as  possibly  han-
-                 dling a two-character newline sequence.
-
-                 There  is a limit to the number of lines that can be matched,
-                 imposed by the way that pcre2grep buffers the input  file  as
-                 it  scans  it.  With  a sufficiently large processing buffer,
-                 this should not be a problem, but the -M option does not work
-                 when input is read line by line (see --line-buffered.)
-
-       -m number, --max-count=number
-                 Stop  processing after finding number matching lines, or non-
-                 matching lines if -v is also set. Any trailing context  lines
-                 are  output  after  the  final match. In multiline mode, each
-                 multiline match counts as just one line for this purpose.  If
-                 this  limit is reached when reading the standard input from a
-                 regular file, the file is left positioned just after the last
-                 matching  line.   If -c is also set, the count that is output
-                 is never greater than number. This option has  no  effect  if
-                 used with -L, -l, or -q, or when just checking for a match in
-                 a binary file.
-
-       --match-limit=number
-                 Processing some regular expression patterns may take  a  very
-                 long time to search for all possible matching strings. Others
-                 may require a very large amount of memory.  There  are  three
-                 options that set resource limits for matching.
-
-                 The --match-limit option provides a means of limiting comput-
-                 ing resource usage when processing patterns that are not  go-
-                 ing to match, but which have a very large number of possibil-
-                 ities in their search trees. The classic example is a pattern
-                 that  uses  nested unlimited repeats. Internally, PCRE2 has a
-                 counter that is incremented each time around  its  main  pro-
-                 cessing  loop.  If the value set by --match-limit is reached,
-                 an error occurs.
-
-                 The --heap-limit option specifies, as a number  of  kibibytes
-                 (units  of 1024 bytes), the amount of heap memory that may be
-                 used for matching. Heap memory is needed only if matching the
-                 pattern  requires a significant number of nested backtracking
-                 points to be remembered. This parameter can be set to zero to
-                 forbid the use of heap memory altogether.
-
-                 The  --depth-limit  option  limits  the depth of nested back-
-                 tracking points, which indirectly limits the amount of memory
-                 that is used. The amount of memory needed for each backtrack-
-                 ing point depends on the number of capturing  parentheses  in
-                 the pattern, so the amount of memory that is used before this
-                 limit acts varies from pattern to pattern. This limit  is  of
-                 use only if it is set smaller than --match-limit.
-
-                 There  are no short forms for these options. The default lim-
-                 its can be set when the PCRE2 library is  compiled;  if  they
-                 are  not specified, the defaults are very large and so effec-
-                 tively unlimited.
-
-       --max-buffer-size=number
-                 This limits the expansion of  the  processing  buffer,  whose
-                 initial  size can be set by --buffer-size. The maximum buffer
-                 size is silently forced to be no smaller  than  the  starting
-                 buffer size.
-
-       -N newline-type, --newline=newline-type
-                 Six different conventions for indicating the ends of lines in
-                 scanned files are supported. For example:
-
-                   pcre2grep -N CRLF 'some pattern' <file>
-
-                 The newline type may be specified in upper, lower,  or  mixed
-                 case.  If the newline type is NUL, lines are separated by bi-
-                 nary zero characters. The other types are the  single-charac-
-                 ter  sequences  CR  (carriage  return) and LF (linefeed), the
-                 two-character sequence CRLF, an "anycrlf" type, which  recog-
-                 nizes  any  of  the preceding three types, and an "any" type,
-                 for which any Unicode line ending sequence is assumed to  end
-                 a  line.  The Unicode sequences are the three just mentioned,
-                 plus VT (vertical tab, U+000B), FF (form feed,  U+000C),  NEL
-                 (next  line,  U+0085),  LS  (line  separator, U+2028), and PS
-                 (paragraph separator, U+2029).
-
-                 When the PCRE2 library is built, a  default  line-ending  se-
-                 quence  is specified.  This is normally the standard sequence
-                 for the operating system. Unless otherwise specified by  this
-                 option, pcre2grep uses the library's default.
-
-                 This  option makes it possible to use pcre2grep to scan files
-                 that have come from other environments without having to mod-
-                 ify  their  line  endings.  If the data that is being scanned
-                 does not agree  with  the  convention  set  by  this  option,
-                 pcre2grep  may  behave in strange ways. Note that this option
-                 does not apply to files specified by the -f,  --exclude-from,
-                 or  --include-from options, which are expected to use the op-
-                 erating system's standard newline sequence.
-
-       -n, --line-number
-                 Precede each output line by its line number in the file, fol-
-                 lowed  by  a colon for matching lines or a hyphen for context
-                 lines. If the file name is also being output, it precedes the
-                 line  number.  When  the  -M option causes a pattern to match
-                 more than one line, only the first is preceded  by  its  line
-                 number. This option is forced if --line-offsets is used.
-
-       --no-jit  If  the  PCRE2 library is built with support for just-in-time
-                 compiling (which speeds up matching), pcre2grep automatically
-                 makes use of this, unless it was explicitly disabled at build
-                 time. This option can be used to disable the use  of  JIT  at
-                 run  time. It is provided for testing and working round prob-
-                 lems.  It should never be needed in normal use.
-
-       -O text, --output=text
-                 When there is a match, instead of outputting  the  line  that
-                 matched,  output just the text specified in this option, fol-
-                 lowed by an operating-system standard newline. In this  mode,
-                 no  context is shown. That is, the -A, -B, and -C options are
-                 ignored. The --newline option has no effect on  this  option,
-                 which is mutually exclusive with --only-matching, --file-off-
-                 sets, and --line-offsets. However, like  --only-matching,  if
-                 there is more than one match in a line, each of them causes a
-                 line of output.
-
-                 Escape sequences starting with a dollar character may be used
-                 to insert the contents of the matched part of the line and/or
-                 captured substrings into the text.
-
-                 $<digits> or ${<digits>} is replaced  by  the  captured  sub-
-                 string  of  the  given  decimal  number; zero substitutes the
-                 whole match. If the number is greater than the number of cap-
-                 turing  substrings,  or if the capture is unset, the replace-
-                 ment is empty.
-
-                 $a is replaced by bell; $b by backspace; $e by escape; $f  by
-                 form  feed;  $n by newline; $r by carriage return; $t by tab;
-                 $v by vertical tab.
-
-                 $o<digits> or $o{<digits>} is replaced by the character whose
-                 code  point  is the given octal number. In the first form, up
-                 to three octal digits are processed.  When  more  digits  are
-                 needed  in Unicode mode to specify a wide character, the sec-
-                 ond form must be used.
-
-                 $x<digits> or $x{<digits>} is replaced by the character  rep-
-                 resented  by the given hexadecimal number. In the first form,
-                 up to two hexadecimal digits are processed. When more  digits
-                 are  needed  in Unicode mode to specify a wide character, the
-                 second form must be used.
-
-                 Any other character is substituted by itself. In  particular,
-                 $$ is replaced by a single dollar.
-
-       -o, --only-matching
-                 Show only the part of the line that matched a pattern instead
-                 of the whole line. In this mode, no context  is  shown.  That
-                 is,  the -A, -B, and -C options are ignored. If there is more
-                 than one match in a line, each of them is  shown  separately,
-                 on  a separate line of output. If -o is combined with -v (in-
-                 vert the sense of the match to find non-matching  lines),  no
-                 output  is  generated,  but  the return code is set appropri-
-                 ately. If the matched portion of the line is  empty,  nothing
-                 is  output  unless  the  file  name  or line number are being
-                 printed, in which case they are shown on an  otherwise  empty
-                 line.  This  option  is  mutually  exclusive  with  --output,
-                 --file-offsets and --line-offsets.
-
-       -onumber, --only-matching=number
-                 Show only the part of the line  that  matched  the  capturing
-                 parentheses of the given number. Up to 50 capturing parenthe-
-                 ses are supported by default. This limit can be  changed  via
-                 the  --om-capture option. A pattern may contain any number of
-                 capturing parentheses, but only those whose number is  within
-                 the  limit can be accessed by -o. An error occurs if the num-
-                 ber specified by -o is greater than the limit.
-
-                 -o0 is the same as -o without a number. Because these options
-                 can  be given without an argument (see above), if an argument
-                 is present, it must be given in the same shell item, for  ex-
-                 ample,  -o3  or --only-matching=2. The comments given for the
-                 non-argument case above also apply to  this  option.  If  the
-                 specified  capturing parentheses do not exist in the pattern,
-                 or were not set in the match, nothing is  output  unless  the
-                 file name or line number are being output.
-
-                 If  this  option is given multiple times, multiple substrings
-                 are output for each match,  in  the  order  the  options  are
-                 given,  and  all on one line. For example, -o3 -o1 -o3 causes
-                 the substrings matched by capturing parentheses 3 and  1  and
-                 then  3 again to be output. By default, there is no separator
-                 (but see the next but one option).
-
-       --om-capture=number
-                 Set the number of capturing parentheses that can be  accessed
-                 by -o. The default is 50.
-
-       --om-separator=text
-                 Specify  a  separating string for multiple occurrences of -o.
-                 The default is an empty string. Separating strings are  never
-                 coloured.
-
-       -q, --quiet
-                 Work quietly, that is, display nothing except error messages.
-                 The exit status indicates whether or  not  any  matches  were
-                 found.
-
-       -r, --recursive
-                 If  any given path is a directory, recursively scan the files
-                 it contains, taking note of any --include and --exclude  set-
-                 tings.  By  default, a directory is read as a normal file; in
-                 some operating systems this gives an  immediate  end-of-file.
-                 This  option is a shorthand for setting the -d option to "re-
-                 curse".
-
-       --recursion-limit=number
-                 This is an obsolete synonym for --depth-limit.  See  --match-
-                 limit above for details.
-
-       -s, --no-messages
-                 Suppress  error  messages  about  non-existent  or unreadable
-                 files. Such files are quietly skipped.  However,  the  return
-                 code is still 2, even if matches were found in other files.
-
-       -t, --total-count
-                 This  option  is  useful when scanning more than one file. If
-                 used on its own, -t suppresses all output except for a  grand
-                 total  number  of matching lines (or non-matching lines if -v
-                 is used) in all the files. If -t is used with -c, a grand to-
-                 tal  is  output  except  when the previous output is just one
-                 line. In other words, it is not output when just  one  file's
-                 count  is  listed.  If file names are being output, the grand
-                 total is preceded by "TOTAL:". Otherwise, it appears as  just
-                 another  number.  The  -t option is ignored when used with -L
-                 (list files without matches), because the grand  total  would
-                 always be zero.
-
-       -u, --utf Operate in UTF-8 mode. This option is available only if PCRE2
-                 has been compiled with UTF-8 support. All patterns (including
-                 those  for any --exclude and --include options) and all lines
-                 that are scanned must be valid strings of  UTF-8  characters.
-                 If an invalid UTF-8 string is encountered, an error occurs.
-
-       -U, --utf-allow-invalid
-                 As  --utf,  but in addition subject lines may contain invalid
-                 UTF-8 code unit sequences. These can never form part  of  any
-                 pattern  match.  Patterns  themselves, however, must still be
-                 valid UTF-8 strings. This facility allows valid UTF-8 strings
-                 to be sought within arbitrary byte sequences in executable or
-                 other binary files. For more details about matching  in  non-
-                 valid UTF-8 strings, see the pcre2unicode(3) documentation.
-
-       -V, --version
-                 Write  the version numbers of pcre2grep and the PCRE2 library
-                 to the standard output and then exit. Anything  else  on  the
-                 command line is ignored.
-
-       -v, --invert-match
-                 Invert  the  sense  of  the match, so that lines which do not
-                 match any of the patterns are the ones that are  found.  When
-                 this  option  is  set,  options  such  as --only-matching and
-                 --output, which specify parts of a match that are to be  out-
-                 put, are ignored.
-
-       -w, --word-regex, --word-regexp
-                 Force the patterns only to match "words". That is, there must
-                 be a word boundary at the  start  and  end  of  each  matched
-                 string.  This is equivalent to having "\b(?:" at the start of
-                 each pattern, and ")\b" at the end. This option applies  only
-                 to  the  patterns  that  are  matched against the contents of
-                 files; it does not apply to patterns specified by any of  the
-                 --include or --exclude options.
-
-       -x, --line-regex, --line-regexp
-                 Force  the  patterns to start matching only at the beginnings
-                 of lines, and in  addition,  require  them  to  match  entire
-                 lines. In multiline mode the match may be more than one line.
-                 This is equivalent to having "^(?:" at the start of each pat-
-                 tern  and  ")$"  at  the end. This option applies only to the
-                 patterns that are matched against the contents of  files;  it
-                 does  not apply to patterns specified by any of the --include
-                 or --exclude options.
-
-
-ENVIRONMENT VARIABLES
-
-       The environment variables LC_ALL and LC_CTYPE are examined, in that or-
-       der, for a locale. The first one that is set is used. This can be over-
-       ridden by the --locale option. If no locale is set, the PCRE2 library's
-       default (usually the "C" locale) is used.
-
-
-NEWLINES
-
-       The  -N  (--newline) option allows pcre2grep to scan files with newline
-       conventions that differ from the default. This option affects only  the
-       way  scanned files are processed. It does not affect the interpretation
-       of files specified by the -f,  --file-list,  --exclude-from,  or  --in-
-       clude-from options.
-
-       Any  parts  of the scanned input files that are written to the standard
-       output are copied with whatever newline sequences they have in the  in-
-       put.  However,  if  the final line of a file is output, and it does not
-       end with a newline sequence, a newline sequence is added. If  the  new-
-       line  setting  is  CR, LF, CRLF or NUL, that line ending is output; for
-       the other settings (ANYCRLF or ANY) a single NL is used.
-
-       The newline setting does not affect the way in which  pcre2grep  writes
-       newlines  in  informational  messages  to the standard output and error
-       streams.  Under Windows, the standard output is set to  be  binary,  so
-       that  "\r\n" at the ends of output lines that are copied from the input
-       is not converted to "\r\r\n" by the C I/O library. This means that  any
-       messages  written  to the standard output must end with "\r\n". For all
-       other operating systems, and for all messages  to  the  standard  error
-       stream, "\n" is used.
-
-
-OPTIONS COMPATIBILITY
-
-       Many of the short and long forms of pcre2grep's options are the same as
-       in the GNU grep program. Any long option of the form --xxx-regexp  (GNU
-       terminology) is also available as --xxx-regex (PCRE2 terminology). How-
-       ever, the  --depth-limit,  --file-list,  --file-offsets,  --heap-limit,
-       --include-dir,  --line-offsets,  --locale,  --match-limit, -M, --multi-
-       line, -N, --newline,  --om-separator,  --output,  -u,  --utf,  -U,  and
-       --utf-allow-invalid options are specific to pcre2grep, as is the use of
-       the --only-matching option with a capturing parentheses number.
-
-       Although most of the common options work the same way, a few  are  dif-
-       ferent  in pcre2grep. For example, the --include option's argument is a
-       glob for GNU grep, but a regular expression for pcre2grep. If both  the
-       -c  and  -l  options are given, GNU grep lists only file names, without
-       counts, but pcre2grep gives the counts as well.
-
-
-OPTIONS WITH DATA
-
-       There are four different ways in which an option with data can be spec-
-       ified.   If  a  short  form option is used, the data may follow immedi-
-       ately, or (with one exception) in the next command line item. For exam-
-       ple:
-
-         -f/some/file
-         -f /some/file
-
-       The  exception is the -o option, which may appear with or without data.
-       Because of this, if data is present, it must follow immediately in  the
-       same item, for example -o3.
-
-       If  a long form option is used, the data may appear in the same command
-       line item, separated by an equals character, or (with  two  exceptions)
-       it may appear in the next command line item. For example:
-
-         --file=/some/file
-         --file /some/file
-
-       Note,  however, that if you want to supply a file name beginning with ~
-       as data in a shell command, and have the shell expand ~ to a  home  di-
-       rectory,  you  must separate the file name from the option, because the
-       shell does not treat ~ specially unless it is at the start of an item.
-
-       The exceptions to the above are the --colour (or --color)  and  --only-
-       matching  options,  for which the data is optional. If one of these op-
-       tions does have data, it must be given in  the  first  form,  using  an
-       equals character. Otherwise pcre2grep will assume that it has no data.
-
-
-USING PCRE2'S CALLOUT FACILITY
-
-       pcre2grep  has,  by  default,  support for calling external programs or
-       scripts or echoing specific strings during matching by  making  use  of
-       PCRE2's  callout  facility.  However, this support can be completely or
-       partially disabled when pcre2grep is built. You can  find  out  whether
-       your  binary has support for callouts by running it with the --help op-
-       tion. If callout support is completely disabled, all callouts  in  pat-
-       terns are ignored by pcre2grep.  If the facility is partially disabled,
-       calling external programs is not supported, and callouts  that  request
-       it are ignored.
-
-       A  callout  in a PCRE2 pattern is of the form (?C<arg>) where the argu-
-       ment is either a number or a quoted string (see the pcre2callout  docu-
-       mentation  for  details).  Numbered  callouts are ignored by pcre2grep;
-       only callouts with string arguments are useful.
-
-   Echoing a specific string
-
-       Starting the callout string with a pipe character  invokes  an  echoing
-       facility that avoids calling an external program or script. This facil-
-       ity is always available, provided that  callouts  were  not  completely
-       disabled  when  pcre2grep  was built. The rest of the callout string is
-       processed as a zero-terminated string, which means it should  not  con-
-       tain  any  internal  binary  zeros. It is written to the output, having
-       first been passed through the same escape processing as text  from  the
-       --output  (-O) option (see above). However, $0 cannot be used to insert
-       a matched substring because the match is still  in  progress.  Instead,
-       the  single  character '0' is inserted. Any syntax errors in the string
-       (for example, a dollar not followed by another  character)  causes  the
-       callout  to be ignored. No terminator is added to the output string, so
-       if you want a newline, you must include it explicitly using the  escape
-       $n. For example:
-
-         pcre2grep '(.)(..(.))(?C"|[$1] [$2] [$3]$n")' <some file>
-
-       Matching  continues normally after the string is output. If you want to
-       see only the callout output but not any output from  an  actual  match,
-       you should end the pattern with (*FAIL).
-
-   Calling external programs or scripts
-
-       This facility can be independently disabled when pcre2grep is built. It
-       is supported for Windows, where a call to _spawnvp() is used, for  VMS,
-       where  lib$spawn()  is  used,  and  for any Unix-like environment where
-       fork() and execv() are available.
-
-       If the callout string does not start with a pipe (vertical bar) charac-
-       ter,  it  is parsed into a list of substrings separated by pipe charac-
-       ters. The first substring must be an executable name, with the  follow-
-       ing substrings specifying arguments:
-
-         executable_name|arg1|arg2|...
-
-       Any  substring  (including  the executable name) may contain escape se-
-       quences started by a dollar character. These are the same  as  for  the
-       --output (-O) option documented above, except that $0 cannot insert the
-       matched string because the match is still  in  progress.  Instead,  the
-       character '0' is inserted. If you need a literal dollar or pipe charac-
-       ter in any substring, use $$ or $| respectively. Here is an example:
-
-         echo -e "abcde\n12345" | pcre2grep \
-           '(?x)(.)(..(.))
-           (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
-
-         Output:
-
-           Arg1: [a] [bcd] [d] Arg2: |a| ()
-           abcde
-           Arg1: [1] [234] [4] Arg2: |1| ()
-           12345
-
-       The parameters for the system call that is used to run the  program  or
-       script are zero-terminated strings. This means that binary zero charac-
-       ters in the callout argument will cause premature termination of  their
-       substrings,  and  therefore should not be present. Any syntax errors in
-       the string (for example, a dollar not followed  by  another  character)
-       causes the callout to be ignored.  If running the program fails for any
-       reason (including the non-existence of the executable), a local  match-
-       ing failure occurs and the matcher backtracks in the normal way.
-
-
-MATCHING ERRORS
-
-       It  is  possible  to supply a regular expression that takes a very long
-       time to fail to match certain lines.  Such  patterns  normally  involve
-       nested  indefinite repeats, for example: (a+)*\d when matched against a
-       line of a's with no final digit. The PCRE2 matching function has a  re-
-       source  limit  that  causes it to abort in these circumstances. If this
-       happens, pcre2grep outputs an error message and the  line  that  caused
-       the  problem  to  the  standard error stream. If there are more than 20
-       such errors, pcre2grep gives up.
-
-       The --match-limit option of pcre2grep can be used to  set  the  overall
-       resource  limit.  There are also other limits that affect the amount of
-       memory used during matching; see the  discussion  of  --heap-limit  and
-       --depth-limit above.
-
-
-DIAGNOSTICS
-
-       Exit status is 0 if any matches were found, 1 if no matches were found,
-       and 2 for syntax errors, overlong lines, non-existent  or  inaccessible
-       files  (even if matches were found in other files) or too many matching
-       errors. Using the -s option to suppress error messages about inaccessi-
-       ble files does not affect the return code.
-
-       When   run  under  VMS,  the  return  code  is  placed  in  the  symbol
-       PCRE2GREP_RC because VMS  does  not  distinguish  between  exit(0)  and
-       exit(1).
-
-
-SEE ALSO
-
-       pcre2pattern(3), pcre2syntax(3), pcre2callout(3), pcre2unicode(3).
-
-
-AUTHOR
-
-       Philip Hazel
-       University Computing Service
-       Cambridge, England.
-
-
-REVISION
-
-       Last updated: 04 October 2020
-       Copyright (c) 1997-2020 University of Cambridge.
diff --git a/dist2/src/pcre2_chartables.c b/dist2/src/pcre2_chartables.c
deleted file mode 100644
index 861914d..0000000
--- a/dist2/src/pcre2_chartables.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*************************************************
-*      Perl-Compatible Regular Expressions       *
-*************************************************/
-
-/* This file was automatically written by the pcre2_dftables auxiliary
-program. It contains character tables that are used when no external
-tables are passed to PCRE2 by the application that calls it. The tables
-are used only for characters whose code values are less than 256. */
-
-/* This set of tables was written in the C locale. */
-
-/* The pcre2_ftables program (which is distributed with PCRE2) 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 pcre2_dftables is run, it creates
-these tables in the "C" locale by default. This happens automatically if
-PCRE2 is configured with --enable-rebuild-chartables. However, you can run
-pcre2_dftables manually with the -L option to build tables using the LC_ALL
-locale. */
-
-/* The following #include is present because without it gcc 4.x may remove
-the array definition from the final binary if PCRE2 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,  /* space */
-  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,  /* xdigit */
-  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,  /* digit */
-  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,  /* upper */
-  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,  /* lower */
-  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,  /* word */
-  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,  /* graph */
-  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,  /* print */
-  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,  /* punct */
-  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,  /* cntrl */
-  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   lower case letter
-  0x08   decimal digit
-  0x10   alphanumeric or '_'
-*/
-
-  0x00,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,0x00,0x00,0x00,0x00, /*    - '  */
-  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*  ( - /  */
-  0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, /*  0 - 7  */
-  0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, /*  8 - ?  */
-  0x00,0x12,0x12,0x12,0x12,0x12,0x12,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,0x00,0x00,0x00,0x00,0x10, /*  X - _  */
-  0x00,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /*  ` - g  */
-  0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /*  h - o  */
-  0x16,0x16,0x16,0x16,0x16,0x16,0x16,0x16, /*  p - w  */
-  0x16,0x16,0x16,0x00,0x00,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/dist2/doc/html/NON-AUTOTOOLS-BUILD.txt b/doc/html/NON-AUTOTOOLS-BUILD.txt
similarity index 100%
rename from dist2/doc/html/NON-AUTOTOOLS-BUILD.txt
rename to doc/html/NON-AUTOTOOLS-BUILD.txt
diff --git a/dist2/doc/html/README.txt b/doc/html/README.txt
similarity index 98%
rename from dist2/doc/html/README.txt
rename to doc/html/README.txt
index d1a3120..e07d3c0 100644
--- a/dist2/doc/html/README.txt
+++ b/doc/html/README.txt
@@ -6,17 +6,19 @@
 the code and it now differs from PCRE1 in more than just the API. There are new
 features, and the internals have been improved. The original PCRE1 library is
 now obsolete and should not be used in new projects. The latest release of
-PCRE2 is available in three alternative formats from:
+PCRE2 is available in .tar.gz, tar.bz2, or .zip form from this GitHub
+repository:
 
-https://ftp.pcre.org/pub/pcre/pcre2-10.xx.tar.gz
-https://ftp.pcre.org/pub/pcre/pcre2-10.xx.tar.bz2
-https://ftp.pcre.org/pub/pcre/pcre2-10.xx.tar.zip
+https://github.com/PhilipHazel/pcre2/releases
 
-There is a mailing list for discussion about the development of PCRE at
-pcre-dev@exim.org. You can access the archives and subscribe or manage your
-subscription here:
+There is a mailing list for discussion about the development of PCRE2 at
+pcre2-dev@googlegroups.com. You can subscribe by sending an email to
+pcre2-dev+subscribe@googlegroups.com.
 
-   https://lists.exim.org/mailman/listinfo/pcre-dev
+You can access the archives and also subscribe or manage your subscription
+here:
+
+https://groups.google.com/pcre2-dev
 
 Please read the NEWS file if you are upgrading from a previous release. The
 contents of this README file are:
@@ -379,7 +381,7 @@
   defined and has a value greater than or equal to 199901L (indicating C99).
   However, there is at least one environment that claims to be C99 but does not
   support these modifiers. If --disable-percent-zt is specified, no use is made
-  of the z or t modifiers. Instead or %td or %zu, %lu is used, with a cast for
+  of the z or t modifiers. Instead of %td or %zu, %lu is used, with a cast for
   size_t values.
 
 . There is a special option called --enable-fuzz-support for use by people who
@@ -570,9 +572,9 @@
 Making new tarballs
 -------------------
 
-The command "make dist" creates three PCRE2 tarballs, in tar.gz, tar.bz2, and
-zip formats. The command "make distcheck" does the same, but then does a trial
-build of the new distribution to ensure that it works.
+The command "make dist" creates two PCRE2 tarballs, in tar.gz and zip formats.
+The command "make distcheck" does the same, but then does a trial build of the
+new distribution to ensure that it works.
 
 If you have modified any of the man page sources in the doc directory, you
 should first run the PrepareRelease script before making a distribution. This
@@ -904,4 +906,4 @@
 Philip Hazel
 Email local part: Philip.Hazel
 Email domain: gmail.com
-Last updated: 28 April 2021
+Last updated: 27 August 2021
diff --git a/dist2/doc/html/index.html b/doc/html/index.html
similarity index 100%
rename from dist2/doc/html/index.html
rename to doc/html/index.html
diff --git a/dist2/doc/html/pcre2-config.html b/doc/html/pcre2-config.html
similarity index 100%
rename from dist2/doc/html/pcre2-config.html
rename to doc/html/pcre2-config.html
diff --git a/dist2/doc/html/pcre2.html b/doc/html/pcre2.html
similarity index 97%
rename from dist2/doc/html/pcre2.html
rename to doc/html/pcre2.html
index 1e267d0..4cb83dc 100644
--- a/dist2/doc/html/pcre2.html
+++ b/doc/html/pcre2.html
@@ -28,7 +28,8 @@
 increasingly difficult. The new API is more extensible, and it was simplified
 by abolishing the separate "study" optimizing function; in PCRE2, patterns are
 automatically optimized where possible. Since forking from PCRE1, the code has
-been extensively refactored and new features introduced.
+been extensively refactored and new features introduced. The old library is now
+obsolete and is no longer maintained.
 </P>
 <P>
 As well as Perl-style regular expression patterns, some features that appeared
@@ -193,18 +194,18 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <P>
 Putting an actual email address here is a spam magnet. If you want to email me,
-use my two initials, followed by the two digits 10, at the domain cam.ac.uk.
+use my two names separated by a dot at gmail.com.
 </P>
 <br><a name="SEC5" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 28 April 2021
+Last updated: 27 August 2021
 <br>
 Copyright &copy; 1997-2021 University of Cambridge.
 <br>
diff --git a/dist2/doc/html/pcre2_callout_enumerate.html b/doc/html/pcre2_callout_enumerate.html
similarity index 100%
rename from dist2/doc/html/pcre2_callout_enumerate.html
rename to doc/html/pcre2_callout_enumerate.html
diff --git a/dist2/doc/html/pcre2_code_copy.html b/doc/html/pcre2_code_copy.html
similarity index 100%
rename from dist2/doc/html/pcre2_code_copy.html
rename to doc/html/pcre2_code_copy.html
diff --git a/dist2/doc/html/pcre2_code_copy_with_tables.html b/doc/html/pcre2_code_copy_with_tables.html
similarity index 100%
rename from dist2/doc/html/pcre2_code_copy_with_tables.html
rename to doc/html/pcre2_code_copy_with_tables.html
diff --git a/dist2/doc/html/pcre2_code_free.html b/doc/html/pcre2_code_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_code_free.html
rename to doc/html/pcre2_code_free.html
diff --git a/dist2/doc/html/pcre2_compile.html b/doc/html/pcre2_compile.html
similarity index 100%
rename from dist2/doc/html/pcre2_compile.html
rename to doc/html/pcre2_compile.html
diff --git a/dist2/doc/html/pcre2_compile_context_copy.html b/doc/html/pcre2_compile_context_copy.html
similarity index 100%
rename from dist2/doc/html/pcre2_compile_context_copy.html
rename to doc/html/pcre2_compile_context_copy.html
diff --git a/dist2/doc/html/pcre2_compile_context_create.html b/doc/html/pcre2_compile_context_create.html
similarity index 100%
rename from dist2/doc/html/pcre2_compile_context_create.html
rename to doc/html/pcre2_compile_context_create.html
diff --git a/dist2/doc/html/pcre2_compile_context_free.html b/doc/html/pcre2_compile_context_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_compile_context_free.html
rename to doc/html/pcre2_compile_context_free.html
diff --git a/dist2/doc/html/pcre2_config.html b/doc/html/pcre2_config.html
similarity index 100%
rename from dist2/doc/html/pcre2_config.html
rename to doc/html/pcre2_config.html
diff --git a/dist2/doc/html/pcre2_convert_context_copy.html b/doc/html/pcre2_convert_context_copy.html
similarity index 100%
rename from dist2/doc/html/pcre2_convert_context_copy.html
rename to doc/html/pcre2_convert_context_copy.html
diff --git a/dist2/doc/html/pcre2_convert_context_create.html b/doc/html/pcre2_convert_context_create.html
similarity index 100%
rename from dist2/doc/html/pcre2_convert_context_create.html
rename to doc/html/pcre2_convert_context_create.html
diff --git a/dist2/doc/html/pcre2_convert_context_free.html b/doc/html/pcre2_convert_context_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_convert_context_free.html
rename to doc/html/pcre2_convert_context_free.html
diff --git a/dist2/doc/html/pcre2_converted_pattern_free.html b/doc/html/pcre2_converted_pattern_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_converted_pattern_free.html
rename to doc/html/pcre2_converted_pattern_free.html
diff --git a/dist2/doc/html/pcre2_dfa_match.html b/doc/html/pcre2_dfa_match.html
similarity index 85%
rename from dist2/doc/html/pcre2_dfa_match.html
rename to doc/html/pcre2_dfa_match.html
index 232e2bc..0ae428c 100644
--- a/dist2/doc/html/pcre2_dfa_match.html
+++ b/doc/html/pcre2_dfa_match.html
@@ -45,10 +45,16 @@
   <i>workspace</i>    Points to a vector of ints used as working space
   <i>wscount</i>      Number of elements in the vector
 </pre>
-For <b>pcre2_dfa_match()</b>, a match context is needed only if you want to set
-up a callout function or specify the heap limit or the match or the recursion
-depth limits. The <i>length</i> and <i>startoffset</i> values are code units, not
-characters. The options are:
+The size of output vector needed to contain all the results depends on the
+number of simultaneous matches, not on the number of parentheses in the
+pattern. Using <b>pcre2_match_data_create_from_pattern()</b> to create the match
+data block is therefore not advisable when using this function.
+</P>
+<P>
+A match context is needed only if you want to set up a callout function or
+specify the heap limit or the match or the recursion depth limits. The
+<i>length</i> and <i>startoffset</i> values are code units, not characters. The
+options are:
 <pre>
   PCRE2_ANCHORED          Match only at the first position
   PCRE2_COPY_MATCHED_SUBJECT
diff --git a/dist2/doc/html/pcre2_general_context_copy.html b/doc/html/pcre2_general_context_copy.html
similarity index 100%
rename from dist2/doc/html/pcre2_general_context_copy.html
rename to doc/html/pcre2_general_context_copy.html
diff --git a/dist2/doc/html/pcre2_general_context_create.html b/doc/html/pcre2_general_context_create.html
similarity index 100%
rename from dist2/doc/html/pcre2_general_context_create.html
rename to doc/html/pcre2_general_context_create.html
diff --git a/dist2/doc/html/pcre2_general_context_free.html b/doc/html/pcre2_general_context_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_general_context_free.html
rename to doc/html/pcre2_general_context_free.html
diff --git a/dist2/doc/html/pcre2_get_error_message.html b/doc/html/pcre2_get_error_message.html
similarity index 100%
rename from dist2/doc/html/pcre2_get_error_message.html
rename to doc/html/pcre2_get_error_message.html
diff --git a/dist2/doc/html/pcre2_get_mark.html b/doc/html/pcre2_get_mark.html
similarity index 100%
rename from dist2/doc/html/pcre2_get_mark.html
rename to doc/html/pcre2_get_mark.html
diff --git a/dist2/doc/html/pcre2_get_match_data_size.html b/doc/html/pcre2_get_match_data_size.html
similarity index 100%
rename from dist2/doc/html/pcre2_get_match_data_size.html
rename to doc/html/pcre2_get_match_data_size.html
diff --git a/dist2/doc/html/pcre2_get_ovector_count.html b/doc/html/pcre2_get_ovector_count.html
similarity index 100%
rename from dist2/doc/html/pcre2_get_ovector_count.html
rename to doc/html/pcre2_get_ovector_count.html
diff --git a/dist2/doc/html/pcre2_get_ovector_pointer.html b/doc/html/pcre2_get_ovector_pointer.html
similarity index 100%
rename from dist2/doc/html/pcre2_get_ovector_pointer.html
rename to doc/html/pcre2_get_ovector_pointer.html
diff --git a/dist2/doc/html/pcre2_get_startchar.html b/doc/html/pcre2_get_startchar.html
similarity index 100%
rename from dist2/doc/html/pcre2_get_startchar.html
rename to doc/html/pcre2_get_startchar.html
diff --git a/dist2/doc/html/pcre2_jit_compile.html b/doc/html/pcre2_jit_compile.html
similarity index 100%
rename from dist2/doc/html/pcre2_jit_compile.html
rename to doc/html/pcre2_jit_compile.html
diff --git a/dist2/doc/html/pcre2_jit_free_unused_memory.html b/doc/html/pcre2_jit_free_unused_memory.html
similarity index 100%
rename from dist2/doc/html/pcre2_jit_free_unused_memory.html
rename to doc/html/pcre2_jit_free_unused_memory.html
diff --git a/dist2/doc/html/pcre2_jit_match.html b/doc/html/pcre2_jit_match.html
similarity index 100%
rename from dist2/doc/html/pcre2_jit_match.html
rename to doc/html/pcre2_jit_match.html
diff --git a/dist2/doc/html/pcre2_jit_stack_assign.html b/doc/html/pcre2_jit_stack_assign.html
similarity index 100%
rename from dist2/doc/html/pcre2_jit_stack_assign.html
rename to doc/html/pcre2_jit_stack_assign.html
diff --git a/dist2/doc/html/pcre2_jit_stack_create.html b/doc/html/pcre2_jit_stack_create.html
similarity index 100%
rename from dist2/doc/html/pcre2_jit_stack_create.html
rename to doc/html/pcre2_jit_stack_create.html
diff --git a/dist2/doc/html/pcre2_jit_stack_free.html b/doc/html/pcre2_jit_stack_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_jit_stack_free.html
rename to doc/html/pcre2_jit_stack_free.html
diff --git a/dist2/doc/html/pcre2_maketables.html b/doc/html/pcre2_maketables.html
similarity index 100%
rename from dist2/doc/html/pcre2_maketables.html
rename to doc/html/pcre2_maketables.html
diff --git a/dist2/doc/html/pcre2_maketables_free.html b/doc/html/pcre2_maketables_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_maketables_free.html
rename to doc/html/pcre2_maketables_free.html
diff --git a/dist2/doc/html/pcre2_match.html b/doc/html/pcre2_match.html
similarity index 100%
rename from dist2/doc/html/pcre2_match.html
rename to doc/html/pcre2_match.html
diff --git a/dist2/doc/html/pcre2_match_context_copy.html b/doc/html/pcre2_match_context_copy.html
similarity index 100%
rename from dist2/doc/html/pcre2_match_context_copy.html
rename to doc/html/pcre2_match_context_copy.html
diff --git a/dist2/doc/html/pcre2_match_context_create.html b/doc/html/pcre2_match_context_create.html
similarity index 100%
rename from dist2/doc/html/pcre2_match_context_create.html
rename to doc/html/pcre2_match_context_create.html
diff --git a/dist2/doc/html/pcre2_match_context_free.html b/doc/html/pcre2_match_context_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_match_context_free.html
rename to doc/html/pcre2_match_context_free.html
diff --git a/dist2/doc/html/pcre2_match_data_create.html b/doc/html/pcre2_match_data_create.html
similarity index 86%
rename from dist2/doc/html/pcre2_match_data_create.html
rename to doc/html/pcre2_match_data_create.html
index 8d0321b..c26c3b3 100644
--- a/dist2/doc/html/pcre2_match_data_create.html
+++ b/doc/html/pcre2_match_data_create.html
@@ -30,8 +30,9 @@
 result of a match. The first argument specifies the number of pairs of offsets
 that are required. These form the "output vector" (ovector) within the match
 data block, and are used to identify the matched string and any captured
-substrings. There is always one pair of offsets; if <b>ovecsize</b> is zero, it
-is treated as one.
+substrings when matching with <b>pcre2_match()</b>, or a number of different
+matches at the same point when used with <b>pcre2_dfa_match()</b>. There is
+always one pair of offsets; if <b>ovecsize</b> is zero, it is treated as one.
 </P>
 <P>
 The second argument points to a general context, for custom memory management,
diff --git a/dist2/doc/html/pcre2_match_data_create_from_pattern.html b/doc/html/pcre2_match_data_create_from_pattern.html
similarity index 67%
rename from dist2/doc/html/pcre2_match_data_create_from_pattern.html
rename to doc/html/pcre2_match_data_create_from_pattern.html
index f40cf1e..4836474 100644
--- a/dist2/doc/html/pcre2_match_data_create_from_pattern.html
+++ b/doc/html/pcre2_match_data_create_from_pattern.html
@@ -26,12 +26,15 @@
 DESCRIPTION
 </b><br>
 <P>
-This function creates a new match data block, which is used for holding the
-result of a match. The first argument points to a compiled pattern. The number
-of capturing parentheses within the pattern is used to compute the number of
-pairs of offsets that are required in the match data block. These form the
-"output vector" (ovector) within the match data block, and are used to identify
-the matched string and any captured substrings.
+This function creates a new match data block for holding the result of a match.
+The first argument points to a compiled pattern. The number of capturing
+parentheses within the pattern is used to compute the number of pairs of
+offsets that are required in the match data block. These form the "output
+vector" (ovector) within the match data block, and are used to identify the
+matched string and any captured substrings when matching with
+<b>pcre2_match()</b>. If you are using <b>pcre2_dfa_match()</b>, which uses the
+outut vector in a different way, you should use <b>pcre2_match_data_create()</b>
+instead of this function.
 </P>
 <P>
 The second argument points to a general context, for custom memory management,
diff --git a/dist2/doc/html/pcre2_match_data_free.html b/doc/html/pcre2_match_data_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_match_data_free.html
rename to doc/html/pcre2_match_data_free.html
diff --git a/dist2/doc/html/pcre2_pattern_convert.html b/doc/html/pcre2_pattern_convert.html
similarity index 100%
rename from dist2/doc/html/pcre2_pattern_convert.html
rename to doc/html/pcre2_pattern_convert.html
diff --git a/dist2/doc/html/pcre2_pattern_info.html b/doc/html/pcre2_pattern_info.html
similarity index 100%
rename from dist2/doc/html/pcre2_pattern_info.html
rename to doc/html/pcre2_pattern_info.html
diff --git a/dist2/doc/html/pcre2_serialize_decode.html b/doc/html/pcre2_serialize_decode.html
similarity index 100%
rename from dist2/doc/html/pcre2_serialize_decode.html
rename to doc/html/pcre2_serialize_decode.html
diff --git a/dist2/doc/html/pcre2_serialize_encode.html b/doc/html/pcre2_serialize_encode.html
similarity index 100%
rename from dist2/doc/html/pcre2_serialize_encode.html
rename to doc/html/pcre2_serialize_encode.html
diff --git a/dist2/doc/html/pcre2_serialize_free.html b/doc/html/pcre2_serialize_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_serialize_free.html
rename to doc/html/pcre2_serialize_free.html
diff --git a/dist2/doc/html/pcre2_serialize_get_number_of_codes.html b/doc/html/pcre2_serialize_get_number_of_codes.html
similarity index 100%
rename from dist2/doc/html/pcre2_serialize_get_number_of_codes.html
rename to doc/html/pcre2_serialize_get_number_of_codes.html
diff --git a/dist2/doc/html/pcre2_set_bsr.html b/doc/html/pcre2_set_bsr.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_bsr.html
rename to doc/html/pcre2_set_bsr.html
diff --git a/dist2/doc/html/pcre2_set_callout.html b/doc/html/pcre2_set_callout.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_callout.html
rename to doc/html/pcre2_set_callout.html
diff --git a/dist2/doc/html/pcre2_set_character_tables.html b/doc/html/pcre2_set_character_tables.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_character_tables.html
rename to doc/html/pcre2_set_character_tables.html
diff --git a/dist2/doc/html/pcre2_set_compile_extra_options.html b/doc/html/pcre2_set_compile_extra_options.html
similarity index 88%
rename from dist2/doc/html/pcre2_set_compile_extra_options.html
rename to doc/html/pcre2_set_compile_extra_options.html
index c6c11f7..b1c0a11 100644
--- a/dist2/doc/html/pcre2_set_compile_extra_options.html
+++ b/doc/html/pcre2_set_compile_extra_options.html
@@ -30,7 +30,8 @@
 housed in a compile context. It completely replaces all the bits. The extra
 options are:
 <pre>
-  PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES  Allow \x{df800} to \x{dfff} in UTF-8 and UTF-32 modes
+  PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK     Allow \K in lookarounds PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES  Allow \x{df800} to \x{dfff}
+                                         in UTF-8 and UTF-32 modes
   PCRE2_EXTRA_ALT_BSUX                 Extended alternate \u, \U, and \x handling
   PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL    Treat all invalid escapes as a literal following character
   PCRE2_EXTRA_ESCAPED_CR_IS_LF         Interpret \r as \n
diff --git a/dist2/doc/html/pcre2_set_compile_recursion_guard.html b/doc/html/pcre2_set_compile_recursion_guard.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_compile_recursion_guard.html
rename to doc/html/pcre2_set_compile_recursion_guard.html
diff --git a/dist2/doc/html/pcre2_set_depth_limit.html b/doc/html/pcre2_set_depth_limit.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_depth_limit.html
rename to doc/html/pcre2_set_depth_limit.html
diff --git a/dist2/doc/html/pcre2_set_glob_escape.html b/doc/html/pcre2_set_glob_escape.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_glob_escape.html
rename to doc/html/pcre2_set_glob_escape.html
diff --git a/dist2/doc/html/pcre2_set_glob_separator.html b/doc/html/pcre2_set_glob_separator.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_glob_separator.html
rename to doc/html/pcre2_set_glob_separator.html
diff --git a/dist2/doc/html/pcre2_set_heap_limit.html b/doc/html/pcre2_set_heap_limit.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_heap_limit.html
rename to doc/html/pcre2_set_heap_limit.html
diff --git a/dist2/doc/html/pcre2_set_match_limit.html b/doc/html/pcre2_set_match_limit.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_match_limit.html
rename to doc/html/pcre2_set_match_limit.html
diff --git a/dist2/doc/html/pcre2_set_max_pattern_length.html b/doc/html/pcre2_set_max_pattern_length.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_max_pattern_length.html
rename to doc/html/pcre2_set_max_pattern_length.html
diff --git a/dist2/doc/html/pcre2_set_newline.html b/doc/html/pcre2_set_newline.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_newline.html
rename to doc/html/pcre2_set_newline.html
diff --git a/dist2/doc/html/pcre2_set_offset_limit.html b/doc/html/pcre2_set_offset_limit.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_offset_limit.html
rename to doc/html/pcre2_set_offset_limit.html
diff --git a/dist2/doc/html/pcre2_set_parens_nest_limit.html b/doc/html/pcre2_set_parens_nest_limit.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_parens_nest_limit.html
rename to doc/html/pcre2_set_parens_nest_limit.html
diff --git a/dist2/doc/html/pcre2_set_recursion_limit.html b/doc/html/pcre2_set_recursion_limit.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_recursion_limit.html
rename to doc/html/pcre2_set_recursion_limit.html
diff --git a/dist2/doc/html/pcre2_set_recursion_memory_management.html b/doc/html/pcre2_set_recursion_memory_management.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_recursion_memory_management.html
rename to doc/html/pcre2_set_recursion_memory_management.html
diff --git a/dist2/doc/html/pcre2_set_substitute_callout.html b/doc/html/pcre2_set_substitute_callout.html
similarity index 100%
rename from dist2/doc/html/pcre2_set_substitute_callout.html
rename to doc/html/pcre2_set_substitute_callout.html
diff --git a/dist2/doc/html/pcre2_substitute.html b/doc/html/pcre2_substitute.html
similarity index 100%
rename from dist2/doc/html/pcre2_substitute.html
rename to doc/html/pcre2_substitute.html
diff --git a/dist2/doc/html/pcre2_substring_copy_byname.html b/doc/html/pcre2_substring_copy_byname.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_copy_byname.html
rename to doc/html/pcre2_substring_copy_byname.html
diff --git a/dist2/doc/html/pcre2_substring_copy_bynumber.html b/doc/html/pcre2_substring_copy_bynumber.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_copy_bynumber.html
rename to doc/html/pcre2_substring_copy_bynumber.html
diff --git a/dist2/doc/html/pcre2_substring_free.html b/doc/html/pcre2_substring_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_free.html
rename to doc/html/pcre2_substring_free.html
diff --git a/dist2/doc/html/pcre2_substring_get_byname.html b/doc/html/pcre2_substring_get_byname.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_get_byname.html
rename to doc/html/pcre2_substring_get_byname.html
diff --git a/dist2/doc/html/pcre2_substring_get_bynumber.html b/doc/html/pcre2_substring_get_bynumber.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_get_bynumber.html
rename to doc/html/pcre2_substring_get_bynumber.html
diff --git a/dist2/doc/html/pcre2_substring_length_byname.html b/doc/html/pcre2_substring_length_byname.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_length_byname.html
rename to doc/html/pcre2_substring_length_byname.html
diff --git a/dist2/doc/html/pcre2_substring_length_bynumber.html b/doc/html/pcre2_substring_length_bynumber.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_length_bynumber.html
rename to doc/html/pcre2_substring_length_bynumber.html
diff --git a/dist2/doc/html/pcre2_substring_list_free.html b/doc/html/pcre2_substring_list_free.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_list_free.html
rename to doc/html/pcre2_substring_list_free.html
diff --git a/dist2/doc/html/pcre2_substring_list_get.html b/doc/html/pcre2_substring_list_get.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_list_get.html
rename to doc/html/pcre2_substring_list_get.html
diff --git a/dist2/doc/html/pcre2_substring_nametable_scan.html b/doc/html/pcre2_substring_nametable_scan.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_nametable_scan.html
rename to doc/html/pcre2_substring_nametable_scan.html
diff --git a/dist2/doc/html/pcre2_substring_number_from_name.html b/doc/html/pcre2_substring_number_from_name.html
similarity index 100%
rename from dist2/doc/html/pcre2_substring_number_from_name.html
rename to doc/html/pcre2_substring_number_from_name.html
diff --git a/dist2/doc/html/pcre2api.html b/doc/html/pcre2api.html
similarity index 98%
rename from dist2/doc/html/pcre2api.html
rename to doc/html/pcre2api.html
index 4ca0eb0..e2237e7 100644
--- a/dist2/doc/html/pcre2api.html
+++ b/doc/html/pcre2api.html
@@ -1915,6 +1915,13 @@
 The option bits that can be set in a compile context by calling the
 <b>pcre2_set_compile_extra_options()</b> function are as follows:
 <pre>
+  PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+</pre>
+Since release 10.38 PCRE2 has forbidden the use of \K within lookaround
+assertions, following Perl's lead. This option is provided to re-enable the
+previous behaviour (act in positive lookarounds, ignore in negative ones) in
+case anybody is relying on it.
+<pre>
   PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES
 </pre>
 This option applies when compiling a pattern in UTF-8 or UTF-32 mode. It is
@@ -2512,20 +2519,31 @@
 Information about a successful or unsuccessful match is placed in a match
 data block, which is an opaque structure that is accessed by function calls. In
 particular, the match data block contains a vector of offsets into the subject
-string that define the matched part of the subject and any substrings that were
-captured. This is known as the <i>ovector</i>.
+string that define the matched parts of the subject. This is known as the
+<i>ovector</i>.
 </P>
 <P>
 Before calling <b>pcre2_match()</b>, <b>pcre2_dfa_match()</b>, or
 <b>pcre2_jit_match()</b> you must create a match data block by calling one of
 the creation functions above. For <b>pcre2_match_data_create()</b>, the first
-argument is the number of pairs of offsets in the <i>ovector</i>. One pair of
-offsets is required to identify the string that matched the whole pattern, with
-an additional pair for each captured substring. For example, a value of 4
-creates enough space to record the matched portion of the subject plus three
-captured substrings. A minimum of at least 1 pair is imposed by
-<b>pcre2_match_data_create()</b>, so it is always possible to return the overall
-matched string.
+argument is the number of pairs of offsets in the <i>ovector</i>.
+</P>
+<P>
+When using <b>pcre2_match()</b>, one pair of offsets is required to identify the
+string that matched the whole pattern, with an additional pair for each
+captured substring. For example, a value of 4 creates enough space to record
+the matched portion of the subject plus three captured substrings.
+</P>
+<P>
+When using <b>pcre2_dfa_match()</b> there may be multiple matched substrings of
+different lengths at the same point in the subject. The ovector should be made
+large enough to hold as many as are expected.
+</P>
+<P>
+A minimum of at least 1 pair is imposed by <b>pcre2_match_data_create()</b>, so
+it is always possible to return the overall matched string in the case of
+<b>pcre2_match()</b> or the longest match in the case of
+<b>pcre2_dfa_match()</b>.
 </P>
 <P>
 The second argument of <b>pcre2_match_data_create()</b> is a pointer to a
@@ -2536,10 +2554,11 @@
 <P>
 For <b>pcre2_match_data_create_from_pattern()</b>, the first argument is a
 pointer to a compiled pattern. The ovector is created to be exactly the right
-size to hold all the substrings a pattern might capture. The second argument is
-again a pointer to a general context, but in this case if NULL is passed, the
-memory is obtained using the same allocator that was used for the compiled
-pattern (custom or default).
+size to hold all the substrings a pattern might capture when matched using
+<b>pcre2_match()</b>. You should not use this call when matching with
+<b>pcre2_dfa_match()</b>. The second argument is again a pointer to a general
+context, but in this case if NULL is passed, the memory is obtained using the
+same allocator that was used for the compiled pattern (custom or default).
 </P>
 <P>
 A match data block can be used many times, with the same or different compiled
@@ -2643,10 +2662,10 @@
 </pre>
 which finds occurrences of "iss" in the middle of words. (\B matches only if
 the current position in the subject is not a word boundary.) When applied to
-the string "Mississipi" the first call to <b>pcre2_match()</b> finds the first
+the string "Mississippi" the first call to <b>pcre2_match()</b> finds the first
 occurrence. If <b>pcre2_match()</b> is called again with just the remainder of
-the subject, namely "issipi", it does not match, because \B is always false at
-the start of the subject, which is deemed to be a word boundary. However, if
+the subject, namely "issippi", it does not match, because \B is always false
+at the start of the subject, which is deemed to be a word boundary. However, if
 <b>pcre2_match()</b> is passed the entire string again, but with
 <i>startoffset</i> set to 4, it finds the second occurrence of "iss" because it
 is able to look behind the starting point to discover that it is preceded by a
@@ -3982,16 +4001,16 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <br><a name="SEC42" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 04 November 2020
+Last updated: 30 August 2021
 <br>
-Copyright &copy; 1997-2020 University of Cambridge.
+Copyright &copy; 1997-2021 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
diff --git a/dist2/doc/html/pcre2build.html b/doc/html/pcre2build.html
similarity index 100%
rename from dist2/doc/html/pcre2build.html
rename to doc/html/pcre2build.html
diff --git a/dist2/doc/html/pcre2callout.html b/doc/html/pcre2callout.html
similarity index 100%
rename from dist2/doc/html/pcre2callout.html
rename to doc/html/pcre2callout.html
diff --git a/dist2/doc/html/pcre2compat.html b/doc/html/pcre2compat.html
similarity index 96%
rename from dist2/doc/html/pcre2compat.html
rename to doc/html/pcre2compat.html
index 54fb643..eb82694 100644
--- a/dist2/doc/html/pcre2compat.html
+++ b/doc/html/pcre2compat.html
@@ -153,8 +153,10 @@
 </P>
 <P>
 16. From release 5.32.0, Perl locks out the use of \K in lookaround
-assertions. In PCRE2, \K is acted on when it occurs in positive assertions,
-but is ignored in negative assertions.
+assertions. From release 10.38 PCRE2 does the same by default. However, there
+is an option for re-enabling the previous behaviour. When this option is set,
+\K is acted on when it occurs in positive assertions, but is ignored in
+negative assertions.
 </P>
 <P>
 17. PCRE2 provides some extensions to the Perl regular expression facilities.
@@ -237,7 +239,7 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
@@ -246,9 +248,9 @@
 REVISION
 </b><br>
 <P>
-Last updated: 06 October 2020
+Last updated: 30 August 2021
 <br>
-Copyright &copy; 1997-2019 University of Cambridge.
+Copyright &copy; 1997-2021 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
diff --git a/dist2/doc/html/pcre2convert.html b/doc/html/pcre2convert.html
similarity index 100%
rename from dist2/doc/html/pcre2convert.html
rename to doc/html/pcre2convert.html
diff --git a/dist2/doc/html/pcre2demo.html b/doc/html/pcre2demo.html
similarity index 97%
rename from dist2/doc/html/pcre2demo.html
rename to doc/html/pcre2demo.html
index 08b2190..1f84373 100644
--- a/dist2/doc/html/pcre2demo.html
+++ b/doc/html/pcre2demo.html
@@ -215,8 +215,8 @@
   return 1;
   }
 
-/* Match succeded. Get a pointer to the output vector, where string offsets are
-stored. */
+/* Match succeeded. Get a pointer to the output vector, where string offsets
+are stored. */
 
 ovector = pcre2_get_ovector_pointer(match_data);
 printf("Match succeeded at offset %d\n", (int)ovector[0]);
@@ -234,9 +234,12 @@
 if (rc == 0)
   printf("ovector was not big enough for all the captured substrings\n");
 
-/* We must guard against patterns such as /(?=.\K)/ that use \K in an assertion
-to set the start of a match later than its end. In this demonstration program,
-we just detect this case and give up. */
+/* Since release 10.38 PCRE2 has locked out the use of \K in lookaround
+assertions. However, there is an option to re-enable the old behaviour. If that
+is set, it is possible to run patterns such as /(?=.\K)/ that use \K in an
+assertion to set the start of a match later than its end. In this demonstration
+program, we show how to detect this case, but it shouldn't arise because the
+option is never set. */
 
 if (ovector[0] &gt; ovector[1])
   {
@@ -453,7 +456,7 @@
     return 1;
     }
 
-  /* Match succeded */
+  /* Match succeeded */
 
   printf("\nMatch succeeded again at offset %d\n", (int)ovector[0]);
 
diff --git a/dist2/doc/html/pcre2grep.html b/doc/html/pcre2grep.html
similarity index 98%
rename from dist2/doc/html/pcre2grep.html
rename to doc/html/pcre2grep.html
index 995e0ea..b3252d3 100644
--- a/dist2/doc/html/pcre2grep.html
+++ b/doc/html/pcre2grep.html
@@ -188,6 +188,12 @@
 <b>--binary-files</b>=<i>text</i>.
 </P>
 <P>
+<b>--allow-lookaround-bsk</b>
+PCRE2 now forbids the use of \K in lookarounds by default, in line with Perl.
+This option causes <b>pcre2grep</b> to set the PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+option, which enables this somewhat dangerous usage.
+</P>
+<P>
 <b>-B</b> <i>number</i>, <b>--before-context=</b><i>number</i>
 Output up to <i>number</i> lines of context before each matching line. Fewer
 lines are output if the previous match or the start of the file is within
@@ -1040,16 +1046,16 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <br><a name="SEC16" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 04 October 2020
+Last updated: 31 August 2021
 <br>
-Copyright &copy; 1997-2020 University of Cambridge.
+Copyright &copy; 1997-2021 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
diff --git a/dist2/doc/html/pcre2jit.html b/doc/html/pcre2jit.html
similarity index 99%
rename from dist2/doc/html/pcre2jit.html
rename to doc/html/pcre2jit.html
index 423dfd8..e73a229 100644
--- a/dist2/doc/html/pcre2jit.html
+++ b/doc/html/pcre2jit.html
@@ -54,6 +54,7 @@
 <pre>
   ARM 32-bit (v5, v7, and Thumb2)
   ARM 64-bit
+  IBM s390x 64 bit
   Intel x86 32-bit and 64-bit
   MIPS 32-bit and 64-bit
   Power PC 32-bit and 64-bit
@@ -286,7 +287,7 @@
 This is a suggestion for how a multithreaded program that needs to set up
 non-default JIT stacks might operate:
 <pre>
-  During thread initalization
+  During thread initialization
     thread_local_var = pcre2_jit_stack_create(...)
 
   During thread exit
diff --git a/dist2/doc/html/pcre2limits.html b/doc/html/pcre2limits.html
similarity index 100%
rename from dist2/doc/html/pcre2limits.html
rename to doc/html/pcre2limits.html
diff --git a/dist2/doc/html/pcre2matching.html b/doc/html/pcre2matching.html
similarity index 89%
rename from dist2/doc/html/pcre2matching.html
rename to doc/html/pcre2matching.html
index 4b71c8f..ed92caf 100644
--- a/dist2/doc/html/pcre2matching.html
+++ b/doc/html/pcre2matching.html
@@ -78,8 +78,9 @@
 If a leaf node is reached, a matching string has been found, and at that point
 the algorithm stops. Thus, if there is more than one possible match, this
 algorithm returns the first one that it finds. Whether this is the shortest,
-the longest, or some intermediate length depends on the way the greedy and
-ungreedy repetition quantifiers are specified in the pattern.
+the longest, or some intermediate length depends on the way the alternations
+and the greedy or ungreedy repetition quantifiers are specified in the
+pattern.
 </P>
 <P>
 Because it ends up with a single path through the tree, it is relatively
@@ -109,11 +110,17 @@
 different matching possibilities (if there are none, the match has failed).
 Thus, if there is more than one possible match, this algorithm finds all of
 them, and in particular, it finds the longest. The matches are returned in
-decreasing order of length. There is an option to stop the algorithm after the
-first match (which is necessarily the shortest) is found.
+the output vector in decreasing order of length. There is an option to stop the
+algorithm after the first match (which is necessarily the shortest) is found.
 </P>
 <P>
-Note that all the matches that are found start at the same point in the
+Note that the size of vector needed to contain all the results depends on the
+number of simultaneous matches, not on the number of parentheses in the
+pattern. Using <b>pcre2_match_data_create_from_pattern()</b> to create the match
+data block is therefore not advisable when doing DFA matching.
+</P>
+<P>
+Note also that all the matches that are found start at the same point in the
 subject. If the pattern
 <pre>
   cat(er(pillar)?)?
@@ -194,21 +201,14 @@
 </P>
 <br><a name="SEC5" href="#TOC1">ADVANTAGES OF THE ALTERNATIVE ALGORITHM</a><br>
 <P>
-Using the alternative matching algorithm provides the following advantages:
+The main advantage of the alternative algorithm is that all possible matches
+(at a single point in the subject) are automatically found, and in particular,
+the longest match is found. To find more than one match at the same point using
+the standard algorithm, you have to do kludgy things with callouts.
 </P>
 <P>
-1. All possible matches (at a single point in the subject) are automatically
-found, and in particular, the longest match is found. To find more than one
-match using the standard algorithm, you have to do kludgy things with
-callouts.
-</P>
-<P>
-2. Because the alternative algorithm scans the subject string just once, and
-never needs to backtrack (except for lookbehinds), it is possible to pass very
-long subject strings to the matching function in several pieces, checking for
-partial matching each time. Although it is also possible to do multi-segment
-matching using the standard algorithm, by retaining partially matched
-substrings, it is more complicated. The
+Partial matching is possible with this algorithm, though it has some
+limitations. The
 <a href="pcre2partial.html"><b>pcre2partial</b></a>
 documentation gives details of partial matching and discusses multi-segment
 matching.
@@ -230,20 +230,23 @@
 3. Although atomic groups are supported, their use does not provide the
 performance advantage that it does for the standard algorithm.
 </P>
+<P>
+4. JIT optimization is not supported.
+</P>
 <br><a name="SEC7" href="#TOC1">AUTHOR</a><br>
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <br><a name="SEC8" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 23 May 2019
+Last updated: 28 August 2021
 <br>
-Copyright &copy; 1997-2019 University of Cambridge.
+Copyright &copy; 1997-2021 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
diff --git a/dist2/doc/html/pcre2partial.html b/doc/html/pcre2partial.html
similarity index 100%
rename from dist2/doc/html/pcre2partial.html
rename to doc/html/pcre2partial.html
diff --git a/dist2/doc/html/pcre2pattern.html b/doc/html/pcre2pattern.html
similarity index 99%
rename from dist2/doc/html/pcre2pattern.html
rename to doc/html/pcre2pattern.html
index 9db15b9..10726b7 100644
--- a/dist2/doc/html/pcre2pattern.html
+++ b/doc/html/pcre2pattern.html
@@ -745,7 +745,7 @@
 <P>
 It is possible to restrict \R to match only CR, LF, or CRLF (instead of the
 complete set of Unicode line endings) by setting the option PCRE2_BSR_ANYCRLF
-at compile time. (BSR is an abbrevation for "backslash R".) This can be made
+at compile time. (BSR is an abbreviation for "backslash R".) This can be made
 the default when PCRE2 is built; if this is the case, the other behaviour can
 be requested via the PCRE2_BSR_UNICODE option. It is also possible to specify
 these settings by starting a pattern string with one of the following
@@ -1090,7 +1090,7 @@
 3. Do not break Hangul (a Korean script) syllable sequences. Hangul characters
 are of five types: L, V, T, LV, and LVT. An L character may be followed by an
 L, V, LV, or LVT character; an LV or V character may be followed by a V or T
-character; an LVT or T character may be follwed only by a T character.
+character; an LVT or T character may be followed only by a T character.
 </P>
 <P>
 4. Do not end before extending characters or spacing marks or the "zero-width
@@ -1175,9 +1175,11 @@
 matches "foobar", the first substring is still set to "foo".
 </P>
 <P>
-Perl used to document that the use of \K within lookaround assertions is "not
-well defined", but from version 5.32.0 Perl does not support this usage at all.
-In PCRE2, \K is acted upon when it occurs inside positive assertions, but is
+From version 5.32.0 Perl forbids the use of \K in lookaround assertions. From
+release 10.38 PCRE2 also forbids this by default. However, the
+PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK option can be used when calling
+<b>pcre2_compile()</b> to re-enable the previous behaviour. When this option is
+set, \K is acted upon when it occurs inside positive assertions, but is
 ignored in negative assertions. Note that when a pattern such as (?=ab\K)
 matches, the reported start of the match can be greater than the end of the
 match. Using \K in a lookbehind assertion at the start of a pattern can also
@@ -3607,7 +3609,7 @@
 </pre>
 If the subject is "aaaac...", after the first match attempt fails (starting at
 the first character in the string), the starting point skips on to start the
-next attempt at "c". Note that a possessive quantifer does not have the same
+next attempt at "c". Note that a possessive quantifier does not have the same
 effect as this example; although it would suppress backtracking during the
 first match attempt, the second attempt would start at the second character
 instead of skipping on to "c".
@@ -3845,16 +3847,16 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <br><a name="SEC32" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 06 October 2020
+Last updated: 30 August 2021
 <br>
-Copyright &copy; 1997-2020 University of Cambridge.
+Copyright &copy; 1997-2021 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
diff --git a/dist2/doc/html/pcre2perform.html b/doc/html/pcre2perform.html
similarity index 100%
rename from dist2/doc/html/pcre2perform.html
rename to doc/html/pcre2perform.html
diff --git a/dist2/doc/html/pcre2posix.html b/doc/html/pcre2posix.html
similarity index 100%
rename from dist2/doc/html/pcre2posix.html
rename to doc/html/pcre2posix.html
diff --git a/dist2/doc/html/pcre2sample.html b/doc/html/pcre2sample.html
similarity index 100%
rename from dist2/doc/html/pcre2sample.html
rename to doc/html/pcre2sample.html
diff --git a/dist2/doc/html/pcre2serialize.html b/doc/html/pcre2serialize.html
similarity index 100%
rename from dist2/doc/html/pcre2serialize.html
rename to doc/html/pcre2serialize.html
diff --git a/dist2/doc/html/pcre2syntax.html b/doc/html/pcre2syntax.html
similarity index 98%
rename from dist2/doc/html/pcre2syntax.html
rename to doc/html/pcre2syntax.html
index 7383104..4aaa4f0 100644
--- a/dist2/doc/html/pcre2syntax.html
+++ b/doc/html/pcre2syntax.html
@@ -429,6 +429,9 @@
 <pre>
   \K          set reported start of match
 </pre>
+From release 10.38 \K is not permitted by default in lookaround assertions,
+for compatibility with Perl. However, if the PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+option is set, the previous behaviour is re-enabled. When this option is set,
 \K is honoured in positive assertions, but ignored in negative ones.
 </P>
 <br><a name="SEC12" href="#TOC1">ALTERNATION</a><br>
@@ -682,16 +685,16 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <br><a name="SEC29" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 28 December 2019
+Last updated: 30 August 2021
 <br>
-Copyright &copy; 1997-2019 University of Cambridge.
+Copyright &copy; 1997-2021 University of Cambridge.
 <br>
 <p>
 Return to the <a href="index.html">PCRE2 index page</a>.
diff --git a/dist2/doc/html/pcre2test.html b/doc/html/pcre2test.html
similarity index 98%
rename from dist2/doc/html/pcre2test.html
rename to doc/html/pcre2test.html
index 09d3a0e..3ee51cd 100644
--- a/dist2/doc/html/pcre2test.html
+++ b/doc/html/pcre2test.html
@@ -59,12 +59,7 @@
 subject is processed, and what output is produced.
 </P>
 <P>
-As the original fairly simple PCRE library evolved, it acquired many different
-features, and as a result, the original <b>pcretest</b> program ended up with a
-lot of options in a messy, arcane syntax for testing all the features. The
-move to the new PCRE2 API provided an opportunity to re-implement the test
-program as <b>pcre2test</b>, with a cleaner modifier syntax. Nevertheless, there
-are still many obscure modifiers, some of which are specifically designed for
+There are many obscure modifiers, some of which are specifically designed for
 use in conjunction with the test script and data files that are distributed as
 part of PCRE2. All the modifiers are documented here, some without much
 justification, but many of them are unlikely to be of use except when testing
@@ -89,10 +84,10 @@
 <br><a name="SEC3" href="#TOC1">INPUT ENCODING</a><br>
 <P>
 Input to <b>pcre2test</b> is processed line by line, either by calling the C
-library's <b>fgets()</b> function, or via the <b>libreadline</b> library. In some
-Windows environments character 26 (hex 1A) causes an immediate end of file, and
-no further data is read, so this character should be avoided unless you really
-want that action.
+library's <b>fgets()</b> function, or via the <b>libreadline</b> or <b>libedit</b>
+library. In some Windows environments character 26 (hex 1A) causes an immediate
+end of file, and no further data is read, so this character should be avoided
+unless you really want that action.
 </P>
 <P>
 The input is processed using using C's string functions, so must not
@@ -486,15 +481,17 @@
 </pre>
 This is interpreted as the pattern's delimiter. A regular expression may be
 continued over several input lines, in which case the newline characters are
-included within it. It is possible to include the delimiter within the pattern
-by escaping it with a backslash, for example
+included within it. It is possible to include the delimiter as a literal within
+the pattern by escaping it with a backslash, for example
 <pre>
   /abc\/def/
 </pre>
 If you do this, the escape and the delimiter form part of the pattern, but
-since the delimiters are all non-alphanumeric, this does not affect its
-interpretation. If the terminating delimiter is immediately followed by a
-backslash, for example,
+since the delimiters are all non-alphanumeric, the inclusion of the backslash
+does not affect the pattern's interpretation. Note, however, that this trick
+does not work within \Q...\E literal bracketing because the backslash will
+itself be interpreted as a literal. If the terminating delimiter is immediately
+followed by a backslash, for example,
 <pre>
   /abc/\
 </pre>
@@ -512,11 +509,11 @@
 </P>
 <br><a name="SEC9" href="#TOC1">SUBJECT LINE SYNTAX</a><br>
 <P>
-Before each subject line is passed to <b>pcre2_match()</b> or
-<b>pcre2_dfa_match()</b>, leading and trailing white space is removed, and the
-line is scanned for backslash escapes, unless the <b>subject_literal</b>
-modifier was set for the pattern. The following provide a means of encoding
-non-printing characters in a visible way:
+Before each subject line is passed to <b>pcre2_match()</b>,
+<b>pcre2_dfa_match()</b>, or <b>pcre2_jit_match()</b>, leading and trailing white
+space is removed, and the line is scanned for backslash escapes, unless the
+<b>subject_literal</b> modifier was set for the pattern. The following provide a
+means of encoding non-printing characters in a visible way:
 <pre>
   \a         alarm (BEL, \x07)
   \b         backspace (\x08)
@@ -613,6 +610,7 @@
 for a description of the effects of these options.
 <pre>
       allow_empty_class         set PCRE2_ALLOW_EMPTY_CLASS
+      allow_lookaround_bsk      set PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
       allow_surrogate_escapes   set PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES
       alt_bsux                  set PCRE2_ALT_BSUX
       alt_circumflex            set PCRE2_ALT_CIRCUMFLEX
@@ -2117,14 +2115,14 @@
 <P>
 Philip Hazel
 <br>
-University Computing Service
+Retired from University Computing Service
 <br>
 Cambridge, England.
 <br>
 </P>
 <br><a name="SEC21" href="#TOC1">REVISION</a><br>
 <P>
-Last updated: 28 April 2021
+Last updated: 30 August 2021
 <br>
 Copyright &copy; 1997-2021 University of Cambridge.
 <br>
diff --git a/dist2/doc/html/pcre2unicode.html b/doc/html/pcre2unicode.html
similarity index 100%
rename from dist2/doc/html/pcre2unicode.html
rename to doc/html/pcre2unicode.html
diff --git a/dist2/doc/index.html.src b/doc/index.html.src
similarity index 100%
rename from dist2/doc/index.html.src
rename to doc/index.html.src
diff --git a/dist2/doc/pcre2-config.1 b/doc/pcre2-config.1
similarity index 100%
rename from dist2/doc/pcre2-config.1
rename to doc/pcre2-config.1
diff --git a/dist2/doc/pcre2-config.txt b/doc/pcre2-config.txt
similarity index 100%
rename from dist2/doc/pcre2-config.txt
rename to doc/pcre2-config.txt
diff --git a/dist2/doc/pcre2.3 b/doc/pcre2.3
similarity index 96%
rename from dist2/doc/pcre2.3
rename to doc/pcre2.3
index efe41c5..fa91450 100644
--- a/dist2/doc/pcre2.3
+++ b/doc/pcre2.3
@@ -1,4 +1,4 @@
-.TH PCRE2 3 "28 April 2021" "PCRE2 10.37"
+.TH PCRE2 3 "27 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH INTRODUCTION
@@ -11,7 +11,8 @@
 increasingly difficult. The new API is more extensible, and it was simplified
 by abolishing the separate "study" optimizing function; in PCRE2, patterns are
 automatically optimized where possible. Since forking from PCRE1, the code has
-been extensively refactored and new features introduced.
+been extensively refactored and new features introduced. The old library is now
+obsolete and is no longer maintained.
 .P
 As well as Perl-style regular expression patterns, some features that appeared
 in Python and the original PCRE before they appeared in Perl are available
@@ -190,18 +191,18 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .P
 Putting an actual email address here is a spam magnet. If you want to email me,
-use my two initials, followed by the two digits 10, at the domain cam.ac.uk.
+use my two names separated by a dot at gmail.com.
 .
 .
 .SH REVISION
 .rs
 .sp
 .nf
-Last updated: 28 April 2021
+Last updated: 27 August 2021
 Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2.txt b/doc/pcre2.txt
similarity index 87%
rename from dist2/doc/pcre2.txt
rename to doc/pcre2.txt
index 3c3d980..386d1f8 100644
--- a/dist2/doc/pcre2.txt
+++ b/doc/pcre2.txt
@@ -25,121 +25,122 @@
        API is more extensible, and it was simplified by abolishing  the  sepa-
        rate  "study" optimizing function; in PCRE2, patterns are automatically
        optimized where possible. Since forking from PCRE1, the code  has  been
-       extensively refactored and new features introduced.
+       extensively  refactored and new features introduced. The old library is
+       now obsolete and is no longer maintained.
 
-       As  well  as Perl-style regular expression patterns, some features that
-       appeared in Python and the original PCRE before they appeared  in  Perl
-       are  available  using the Python syntax. There is also some support for
-       one or two .NET and Oniguruma syntax items, and there are  options  for
-       requesting  some  minor  changes that give better ECMAScript (aka Java-
+       As well as Perl-style regular expression patterns, some  features  that
+       appeared  in  Python and the original PCRE before they appeared in Perl
+       are available using the Python syntax. There is also some  support  for
+       one  or  two .NET and Oniguruma syntax items, and there are options for
+       requesting some minor changes that give better  ECMAScript  (aka  Java-
        Script) compatibility.
 
-       The source code for PCRE2 can be compiled to support strings of  8-bit,
+       The  source code for PCRE2 can be compiled to support strings of 8-bit,
        16-bit, or 32-bit code units, which means that up to three separate li-
        braries may be installed, one for each code unit size. The size of code
-       unit  is  not  related to the bit size of the underlying hardware. In a
-       64-bit environment that also supports 32-bit applications, versions  of
+       unit is not related to the bit size of the underlying  hardware.  In  a
+       64-bit  environment that also supports 32-bit applications, versions of
        PCRE2 that are compiled in both 64-bit and 32-bit modes may be needed.
 
-       The  original  work  to extend PCRE to 16-bit and 32-bit code units was
+       The original work to extend PCRE to 16-bit and 32-bit  code  units  was
        done by Zoltan Herczeg and Christian Persch, respectively. In all three
-       cases,  strings  can  be  interpreted  either as one character per code
+       cases, strings can be interpreted either  as  one  character  per  code
        unit, or as UTF-encoded Unicode, with support for Unicode general cate-
-       gory  properties. Unicode support is optional at build time (but is the
+       gory properties. Unicode support is optional at build time (but is  the
        default). However, processing strings as UTF code units must be enabled
        explicitly at run time. The version of Unicode in use can be discovered
        by running
 
          pcre2test -C
 
-       The three libraries contain identical sets  of  functions,  with  names
-       ending  in  _8,  _16,  or  _32,  respectively  (for example, pcre2_com-
-       pile_8()). However, by defining PCRE2_CODE_UNIT_WIDTH to be 8,  16,  or
-       32,  a  program that uses just one code unit width can be written using
+       The  three  libraries  contain  identical sets of functions, with names
+       ending in _8,  _16,  or  _32,  respectively  (for  example,  pcre2_com-
+       pile_8()).  However,  by defining PCRE2_CODE_UNIT_WIDTH to be 8, 16, or
+       32, a program that uses just one code unit width can be  written  using
        generic names such as pcre2_compile(), and the documentation is written
        assuming that this is the case.
 
        In addition to the Perl-compatible matching function, PCRE2 contains an
-       alternative function that matches the same compiled patterns in a  dif-
+       alternative  function that matches the same compiled patterns in a dif-
        ferent way. In certain circumstances, the alternative function has some
-       advantages.  For a discussion of the two matching algorithms,  see  the
+       advantages.   For  a discussion of the two matching algorithms, see the
        pcre2matching page.
 
-       Details  of  exactly which Perl regular expression features are and are
-       not supported by  PCRE2  are  given  in  separate  documents.  See  the
-       pcre2pattern  and  pcre2compat  pages. There is a syntax summary in the
+       Details of exactly which Perl regular expression features are  and  are
+       not  supported  by  PCRE2  are  given  in  separate  documents. See the
+       pcre2pattern and pcre2compat pages. There is a syntax  summary  in  the
        pcre2syntax page.
 
-       Some features of PCRE2 can be included, excluded, or changed  when  the
-       library  is  built. The pcre2_config() function makes it possible for a
-       client to discover which features are  available.  The  features  them-
+       Some  features  of PCRE2 can be included, excluded, or changed when the
+       library is built. The pcre2_config() function makes it possible  for  a
+       client  to  discover  which  features are available. The features them-
        selves are described in the pcre2build page. Documentation about build-
-       ing PCRE2 for various operating systems can be found in the README  and
+       ing  PCRE2 for various operating systems can be found in the README and
        NON-AUTOTOOLS_BUILD files in the source distribution.
 
-       The  libraries contains a number of undocumented internal functions and
-       data tables that are used by more than one  of  the  exported  external
-       functions,  but  which  are  not  intended for use by external callers.
-       Their names all begin with "_pcre2", which hopefully will  not  provoke
+       The libraries contains a number of undocumented internal functions  and
+       data  tables  that  are  used by more than one of the exported external
+       functions, but which are not intended  for  use  by  external  callers.
+       Their  names  all begin with "_pcre2", which hopefully will not provoke
        any name clashes. In some environments, it is possible to control which
-       external symbols are exported when a shared library is  built,  and  in
+       external  symbols  are  exported when a shared library is built, and in
        these cases the undocumented symbols are not exported.
 
 
 SECURITY CONSIDERATIONS
 
-       If  you  are using PCRE2 in a non-UTF application that permits users to
-       supply arbitrary patterns for compilation, you should  be  aware  of  a
+       If you are using PCRE2 in a non-UTF application that permits  users  to
+       supply  arbitrary  patterns  for  compilation, you should be aware of a
        feature that allows users to turn on UTF support from within a pattern.
-       For example, an 8-bit pattern that begins with "(*UTF)" turns on  UTF-8
-       mode,  which  interprets patterns and subjects as strings of UTF-8 code
+       For  example, an 8-bit pattern that begins with "(*UTF)" turns on UTF-8
+       mode, which interprets patterns and subjects as strings of  UTF-8  code
        units instead of individual 8-bit characters. This causes both the pat-
-       tern  and  any data against which it is matched to be checked for UTF-8
-       validity. If the data string is very long, such a check might use  suf-
-       ficiently  many  resources as to cause your application to lose perfor-
+       tern and any data against which it is matched to be checked  for  UTF-8
+       validity.  If the data string is very long, such a check might use suf-
+       ficiently many resources as to cause your application to  lose  perfor-
        mance.
 
-       One way of guarding against this possibility is to use  the  pcre2_pat-
-       tern_info()  function  to  check  the  compiled  pattern's  options for
-       PCRE2_UTF. Alternatively, you can set the PCRE2_NEVER_UTF  option  when
-       calling  pcre2_compile().  This causes a compile time error if the pat-
+       One  way  of guarding against this possibility is to use the pcre2_pat-
+       tern_info() function  to  check  the  compiled  pattern's  options  for
+       PCRE2_UTF.  Alternatively,  you can set the PCRE2_NEVER_UTF option when
+       calling pcre2_compile(). This causes a compile time error if  the  pat-
        tern contains a UTF-setting sequence.
 
-       The use of Unicode properties for character types such as \d  can  also
-       be  enabled  from within the pattern, by specifying "(*UCP)". This fea-
+       The  use  of Unicode properties for character types such as \d can also
+       be enabled from within the pattern, by specifying "(*UCP)".  This  fea-
        ture can be disallowed by setting the PCRE2_NEVER_UCP option.
 
-       If your application is one that supports UTF, be  aware  that  validity
-       checking  can  take time. If the same data string is to be matched many
-       times, you can use the PCRE2_NO_UTF_CHECK option  for  the  second  and
+       If  your  application  is one that supports UTF, be aware that validity
+       checking can take time. If the same data string is to be  matched  many
+       times,  you  can  use  the PCRE2_NO_UTF_CHECK option for the second and
        subsequent matches to avoid running redundant checks.
 
        The use of the \C escape sequence in a UTF-8 or UTF-16 pattern can lead
-       to problems, because it may leave the current  matching  point  in  the
-       middle  of a multi-code-unit character. The PCRE2_NEVER_BACKSLASH_C op-
+       to  problems,  because  it  may leave the current matching point in the
+       middle of a multi-code-unit character. The PCRE2_NEVER_BACKSLASH_C  op-
        tion can be used by an application to lock out the use of \C, causing a
-       compile-time  error  if it is encountered. It is also possible to build
+       compile-time error if it is encountered. It is also possible  to  build
        PCRE2 with the use of \C permanently disabled.
 
-       Another way that performance can be hit is by running  a  pattern  that
-       has  a  very  large search tree against a string that will never match.
-       Nested unlimited repeats in a pattern are a common example. PCRE2  pro-
-       vides  some  protection  against  this: see the pcre2_set_match_limit()
-       function in the pcre2api page.  There  is  a  similar  function  called
+       Another  way  that  performance can be hit is by running a pattern that
+       has a very large search tree against a string that  will  never  match.
+       Nested  unlimited repeats in a pattern are a common example. PCRE2 pro-
+       vides some protection against  this:  see  the  pcre2_set_match_limit()
+       function  in  the  pcre2api  page.  There  is a similar function called
        pcre2_set_depth_limit() that can be used to restrict the amount of mem-
        ory that is used.
 
 
 USER DOCUMENTATION
 
-       The user documentation for PCRE2 comprises a number of  different  sec-
-       tions.  In the "man" format, each of these is a separate "man page". In
-       the HTML format, each is a separate page, linked from the  index  page.
-       In  the  plain  text  format,  the  descriptions  of  the pcre2grep and
+       The  user  documentation for PCRE2 comprises a number of different sec-
+       tions. In the "man" format, each of these is a separate "man page".  In
+       the  HTML  format, each is a separate page, linked from the index page.
+       In the plain  text  format,  the  descriptions  of  the  pcre2grep  and
        pcre2test programs are in files called pcre2grep.txt and pcre2test.txt,
-       respectively.  The remaining sections, except for the pcre2demo section
-       (which is a program listing), and the short pages for individual  func-
-       tions,  are  concatenated in pcre2.txt, for ease of searching. The sec-
+       respectively. The remaining sections, except for the pcre2demo  section
+       (which  is a program listing), and the short pages for individual func-
+       tions, are concatenated in pcre2.txt, for ease of searching.  The  sec-
        tions are as follows:
 
          pcre2              this document
@@ -165,24 +166,23 @@
          pcre2test          description of the pcre2test command
          pcre2unicode       discussion of Unicode and UTF support
 
-       In the "man" and HTML formats, there is also a short page  for  each  C
+       In  the  "man"  and HTML formats, there is also a short page for each C
        library function, listing its arguments and results.
 
 
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
-       Putting  an  actual email address here is a spam magnet. If you want to
-       email me, use my two initials, followed by the two digits  10,  at  the
-       domain cam.ac.uk.
+       Putting an actual email address here is a spam magnet. If you  want  to
+       email me, use my two names separated by a dot at gmail.com.
 
 
 REVISION
 
-       Last updated: 28 April 2021
+       Last updated: 27 August 2021
        Copyright (c) 1997-2021 University of Cambridge.
 ------------------------------------------------------------------------------
 
@@ -1877,86 +1877,93 @@
        The option bits that can be set in a compile  context  by  calling  the
        pcre2_set_compile_extra_options() function are as follows:
 
+         PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+
+       Since release 10.38 PCRE2 has forbidden the use of \K within lookaround
+       assertions, following Perl's lead. This option is provided to re-enable
+       the previous behaviour (act in positive lookarounds, ignore in negative
+       ones) in case anybody is relying on it.
+
          PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES
 
-       This  option  applies when compiling a pattern in UTF-8 or UTF-32 mode.
-       It is forbidden in UTF-16 mode, and ignored in non-UTF  modes.  Unicode
+       This option applies when compiling a pattern in UTF-8 or  UTF-32  mode.
+       It  is  forbidden in UTF-16 mode, and ignored in non-UTF modes. Unicode
        "surrogate" code points in the range 0xd800 to 0xdfff are used in pairs
-       in UTF-16 to encode code points with values in  the  range  0x10000  to
-       0x10ffff.  The  surrogates  cannot  therefore be represented in UTF-16.
+       in  UTF-16  to  encode  code points with values in the range 0x10000 to
+       0x10ffff. The surrogates cannot therefore  be  represented  in  UTF-16.
        They can be represented in UTF-8 and UTF-32, but are defined as invalid
-       code  points,  and  cause  errors  if  encountered in a UTF-8 or UTF-32
+       code points, and cause errors if  encountered  in  a  UTF-8  or  UTF-32
        string that is being checked for validity by PCRE2.
 
-       These values also cause errors if encountered in escape sequences  such
+       These  values also cause errors if encountered in escape sequences such
        as \x{d912} within a pattern. However, it seems that some applications,
        when using PCRE2 to check for unwanted characters in UTF-8 strings, ex-
-       plicitly   test   for   the  surrogates  using  escape  sequences.  The
-       PCRE2_NO_UTF_CHECK option does not disable the error that  occurs,  be-
+       plicitly  test  for  the  surrogates  using   escape   sequences.   The
+       PCRE2_NO_UTF_CHECK  option  does not disable the error that occurs, be-
        cause it applies only to the testing of input strings for UTF validity.
 
-       If  the extra option PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is set, surro-
-       gate code point values in UTF-8 and UTF-32 patterns no  longer  provoke
-       errors  and are incorporated in the compiled pattern. However, they can
-       only match subject characters if the matching function is  called  with
+       If the extra option PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES is set,  surro-
+       gate  code  point values in UTF-8 and UTF-32 patterns no longer provoke
+       errors and are incorporated in the compiled pattern. However, they  can
+       only  match  subject characters if the matching function is called with
        PCRE2_NO_UTF_CHECK set.
 
          PCRE2_EXTRA_ALT_BSUX
 
-       The  original option PCRE2_ALT_BSUX causes PCRE2 to process \U, \u, and
-       \x in the way that ECMAscript (aka JavaScript) does.  Additional  func-
+       The original option PCRE2_ALT_BSUX causes PCRE2 to process \U, \u,  and
+       \x  in  the way that ECMAscript (aka JavaScript) does. Additional func-
        tionality was defined by ECMAscript 6; setting PCRE2_EXTRA_ALT_BSUX has
-       the effect of PCRE2_ALT_BSUX, but in addition it  recognizes  \u{hhh..}
+       the  effect  of PCRE2_ALT_BSUX, but in addition it recognizes \u{hhh..}
        as a hexadecimal character code, where hhh.. is any number of hexadeci-
        mal digits.
 
          PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL
 
-       This is a dangerous option. Use with care. By default, an  unrecognized
-       escape  such  as \j or a malformed one such as \x{2z} causes a compile-
+       This  is a dangerous option. Use with care. By default, an unrecognized
+       escape such as \j or a malformed one such as \x{2z} causes  a  compile-
        time error when detected by pcre2_compile(). Perl is somewhat inconsis-
-       tent  in  handling  such items: for example, \j is treated as a literal
-       "j", and non-hexadecimal digits in \x{} are just ignored, though  warn-
-       ings  are given in both cases if Perl's warning switch is enabled. How-
-       ever, a malformed octal number after \o{  always  causes  an  error  in
+       tent in handling such items: for example, \j is treated  as  a  literal
+       "j",  and non-hexadecimal digits in \x{} are just ignored, though warn-
+       ings are given in both cases if Perl's warning switch is enabled.  How-
+       ever,  a  malformed  octal  number  after \o{ always causes an error in
        Perl.
 
-       If  the  PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL  extra  option  is passed to
-       pcre2_compile(), all unrecognized or  malformed  escape  sequences  are
-       treated  as  single-character escapes. For example, \j is a literal "j"
-       and \x{2z} is treated as the literal string "x{2z}". Setting  this  op-
+       If the PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL  extra  option  is  passed  to
+       pcre2_compile(),  all  unrecognized  or  malformed escape sequences are
+       treated as single-character escapes. For example, \j is a  literal  "j"
+       and  \x{2z}  is treated as the literal string "x{2z}". Setting this op-
        tion means that typos in patterns may go undetected and have unexpected
-       results. Also note that a sequence such as [\N{] is  interpreted  as  a
-       malformed  attempt  at [\N{...}] and so is treated as [N{] whereas [\N]
+       results.  Also  note  that a sequence such as [\N{] is interpreted as a
+       malformed attempt at [\N{...}] and so is treated as [N{]  whereas  [\N]
        gives an error because an unqualified \N is a valid escape sequence but
-       is  not supported in a character class. To reiterate: this is a danger-
+       is not supported in a character class. To reiterate: this is a  danger-
        ous option. Use with great care.
 
          PCRE2_EXTRA_ESCAPED_CR_IS_LF
 
-       There are some legacy applications where the escape sequence  \r  in  a
-       pattern  is expected to match a newline. If this option is set, \r in a
-       pattern is converted to \n so that it matches a LF  (linefeed)  instead
-       of  a CR (carriage return) character. The option does not affect a lit-
-       eral CR in the pattern, nor does it affect CR specified as an  explicit
+       There  are  some  legacy applications where the escape sequence \r in a
+       pattern is expected to match a newline. If this option is set, \r in  a
+       pattern  is  converted to \n so that it matches a LF (linefeed) instead
+       of a CR (carriage return) character. The option does not affect a  lit-
+       eral  CR in the pattern, nor does it affect CR specified as an explicit
        code point such as \x{0D}.
 
          PCRE2_EXTRA_MATCH_LINE
 
-       This  option  is  provided  for  use  by the -x option of pcre2grep. It
-       causes the pattern only to match complete lines. This  is  achieved  by
-       automatically  inserting  the  code for "^(?:" at the start of the com-
-       piled pattern and ")$" at the end. Thus, when PCRE2_MULTILINE  is  set,
-       the  matched  line may be in the middle of the subject string. This op-
+       This option is provided for use by  the  -x  option  of  pcre2grep.  It
+       causes  the  pattern  only to match complete lines. This is achieved by
+       automatically inserting the code for "^(?:" at the start  of  the  com-
+       piled  pattern  and ")$" at the end. Thus, when PCRE2_MULTILINE is set,
+       the matched line may be in the middle of the subject string.  This  op-
        tion can be used with PCRE2_LITERAL.
 
          PCRE2_EXTRA_MATCH_WORD
 
-       This option is provided for use by  the  -w  option  of  pcre2grep.  It
-       causes  the  pattern only to match strings that have a word boundary at
-       the start and the end. This is achieved by automatically inserting  the
-       code  for "\b(?:" at the start of the compiled pattern and ")\b" at the
-       end. The option may be used with PCRE2_LITERAL. However, it is  ignored
+       This  option  is  provided  for  use  by the -w option of pcre2grep. It
+       causes the pattern only to match strings that have a word  boundary  at
+       the  start and the end. This is achieved by automatically inserting the
+       code for "\b(?:" at the start of the compiled pattern and ")\b" at  the
+       end.  The option may be used with PCRE2_LITERAL. However, it is ignored
        if PCRE2_EXTRA_MATCH_LINE is also set.
 
 
@@ -1979,16 +1986,16 @@
 
        void pcre2_jit_stack_free(pcre2_jit_stack *jit_stack);
 
-       These  functions  provide  support  for  JIT compilation, which, if the
-       just-in-time compiler is available, further processes a  compiled  pat-
+       These functions provide support for  JIT  compilation,  which,  if  the
+       just-in-time  compiler  is available, further processes a compiled pat-
        tern into machine code that executes much faster than the pcre2_match()
-       interpretive matching function. Full details are given in the  pcre2jit
+       interpretive  matching function. Full details are given in the pcre2jit
        documentation.
 
-       JIT  compilation  is  a heavyweight optimization. It can take some time
-       for patterns to be analyzed, and for one-off matches  and  simple  pat-
-       terns  the benefit of faster execution might be offset by a much slower
-       compilation time.  Most (but not all) patterns can be optimized by  the
+       JIT compilation is a heavyweight optimization. It can  take  some  time
+       for  patterns  to  be analyzed, and for one-off matches and simple pat-
+       terns the benefit of faster execution might be offset by a much  slower
+       compilation  time.  Most (but not all) patterns can be optimized by the
        JIT compiler.
 
 
@@ -1999,46 +2006,46 @@
        void pcre2_maketables_free(pcre2_general_context *gcontext,
          const uint8_t *tables);
 
-       PCRE2  handles caseless matching, and determines whether characters are
-       letters, digits, or whatever, by reference to a set of tables,  indexed
+       PCRE2 handles caseless matching, and determines whether characters  are
+       letters,  digits, or whatever, by reference to a set of tables, indexed
        by character code point. However, this applies only to characters whose
-       code points are less than 256. By default,  higher-valued  code  points
+       code  points  are  less than 256. By default, higher-valued code points
        never match escapes such as \w or \d.
 
-       When  PCRE2  is  built  with Unicode support (the default), the Unicode
+       When PCRE2 is built with Unicode support  (the  default),  the  Unicode
        properties of all characters can be tested with \p and \P, or, alterna-
-       tively,  the  PCRE2_UCP  option  can be set when a pattern is compiled;
-       this causes \w and friends to use Unicode property support  instead  of
-       the  built-in  tables.  PCRE2_UCP also causes upper/lower casing opera-
-       tions on characters with code points greater than 127  to  use  Unicode
+       tively, the PCRE2_UCP option can be set when  a  pattern  is  compiled;
+       this  causes  \w and friends to use Unicode property support instead of
+       the built-in tables.  PCRE2_UCP also causes upper/lower  casing  opera-
+       tions  on  characters  with code points greater than 127 to use Unicode
        properties. These effects apply even when PCRE2_UTF is not set.
 
-       The  use  of  locales  with Unicode is discouraged. If you are handling
-       characters with code points greater than 127,  you  should  either  use
+       The use of locales with Unicode is discouraged.  If  you  are  handling
+       characters  with  code  points  greater than 127, you should either use
        Unicode support, or use locales, but not try to mix the two.
 
-       PCRE2  contains a built-in set of character tables that are used by de-
-       fault.  These are sufficient for many applications. Normally,  the  in-
-       ternal  tables  recognize only ASCII characters. However, when PCRE2 is
+       PCRE2 contains a built-in set of character tables that are used by  de-
+       fault.   These  are sufficient for many applications. Normally, the in-
+       ternal tables recognize only ASCII characters. However, when  PCRE2  is
        built, it is possible to cause the internal tables to be rebuilt in the
        default "C" locale of the local system, which may cause them to be dif-
        ferent.
 
-       The built-in tables can be overridden by tables supplied by the  appli-
-       cation  that  calls  PCRE2.  These may be created in a different locale
-       from the default.  As more and more applications change to  using  Uni-
+       The  built-in tables can be overridden by tables supplied by the appli-
+       cation that calls PCRE2. These may be created  in  a  different  locale
+       from  the  default.  As more and more applications change to using Uni-
        code, the need for this locale support is expected to die away.
 
-       External  tables  are built by calling the pcre2_maketables() function,
+       External tables are built by calling the  pcre2_maketables()  function,
        in the relevant locale. The only argument to this function is a general
-       context,  which  can  be used to pass a custom memory allocator. If the
+       context, which can be used to pass a custom memory  allocator.  If  the
        argument is NULL, the system malloc() is used. The result can be passed
        to pcre2_compile() as often as necessary, by creating a compile context
-       and calling pcre2_set_character_tables()  to  set  the  tables  pointer
+       and  calling  pcre2_set_character_tables()  to  set  the tables pointer
        therein.
 
-       For  example,  to  build  and  use  tables that are appropriate for the
-       French locale (where accented characters with values greater  than  127
+       For example, to build and use  tables  that  are  appropriate  for  the
+       French  locale  (where accented characters with values greater than 127
        are treated as letters), the following code could be used:
 
          setlocale(LC_CTYPE, "fr_FR");
@@ -2047,31 +2054,31 @@
          pcre2_set_character_tables(ccontext, tables);
          re = pcre2_compile(..., ccontext);
 
-       The  locale  name "fr_FR" is used on Linux and other Unix-like systems;
+       The locale name "fr_FR" is used on Linux and other  Unix-like  systems;
        if you are using Windows, the name for the French locale is "french".
 
        The pointer that is passed (via the compile context) to pcre2_compile()
        is saved with the compiled pattern, and the same tables are used by the
-       matching functions. Thus,  for  any  single  pattern,  compilation  and
-       matching  both happen in the same locale, but different patterns can be
+       matching  functions.  Thus,  for  any  single  pattern, compilation and
+       matching both happen in the same locale, but different patterns can  be
        processed in different locales.
 
-       It is the caller's responsibility to ensure that the memory  containing
+       It  is the caller's responsibility to ensure that the memory containing
        the tables remains available while they are still in use. When they are
-       no longer needed, you can discard them  using  pcre2_maketables_free(),
-       which  should  pass as its first parameter the same global context that
+       no  longer  needed, you can discard them using pcre2_maketables_free(),
+       which should pass as its first parameter the same global  context  that
        was used to create the tables.
 
    Saving locale tables
 
-       The tables described above are just a sequence of binary  bytes,  which
-       makes  them  independent of hardware characteristics such as endianness
-       or whether the processor is 32-bit or 64-bit. A copy of the  result  of
-       pcre2_maketables()  can  therefore  be saved in a file or elsewhere and
-       re-used later, even in a different program or on another computer.  The
-       size  of  the  tables  (number  of  bytes)  must be obtained by calling
-       pcre2_config()  with  the  PCRE2_CONFIG_TABLES_LENGTH  option   because
-       pcre2_maketables()   does   not   return  this  value.  Note  that  the
+       The  tables  described above are just a sequence of binary bytes, which
+       makes them independent of hardware characteristics such  as  endianness
+       or  whether  the processor is 32-bit or 64-bit. A copy of the result of
+       pcre2_maketables() can therefore be saved in a file  or  elsewhere  and
+       re-used  later, even in a different program or on another computer. The
+       size of the tables (number  of  bytes)  must  be  obtained  by  calling
+       pcre2_config()   with  the  PCRE2_CONFIG_TABLES_LENGTH  option  because
+       pcre2_maketables()  does  not  return  this  value.   Note   that   the
        pcre2_dftables program, which is part of the PCRE2 build system, can be
        used stand-alone to create a file that contains a set of binary tables.
        See the pcre2build documentation for details.
@@ -2081,13 +2088,13 @@
 
        int pcre2_pattern_info(const pcre2 *code, uint32_t what, void *where);
 
-       The pcre2_pattern_info() function returns general information  about  a
+       The  pcre2_pattern_info()  function returns general information about a
        compiled pattern. For information about callouts, see the next section.
-       The first argument for pcre2_pattern_info() is a pointer  to  the  com-
+       The  first  argument  for pcre2_pattern_info() is a pointer to the com-
        piled pattern. The second argument specifies which piece of information
-       is required, and the third argument is a pointer to a variable  to  re-
-       ceive  the  data.  If the third argument is NULL, the first argument is
-       ignored, and the function returns the size in  bytes  of  the  variable
+       is  required,  and the third argument is a pointer to a variable to re-
+       ceive the data. If the third argument is NULL, the  first  argument  is
+       ignored,  and  the  function  returns the size in bytes of the variable
        that is required for the information requested. Otherwise, the yield of
        the function is zero for success, or one of the following negative num-
        bers:
@@ -2098,8 +2105,8 @@
          PCRE2_ERROR_UNSET          the requested field is not set
 
        The "magic number" is placed at the start of each compiled pattern as a
-       simple check against passing an arbitrary memory  pointer.  Here  is  a
-       typical  call of pcre2_pattern_info(), to obtain the length of the com-
+       simple  check  against  passing  an arbitrary memory pointer. Here is a
+       typical call of pcre2_pattern_info(), to obtain the length of the  com-
        piled pattern:
 
          int rc;
@@ -2117,22 +2124,22 @@
          PCRE2_INFO_EXTRAOPTIONS
 
        Return copies of the pattern's options. The third argument should point
-       to a uint32_t variable. PCRE2_INFO_ARGOPTIONS returns exactly  the  op-
-       tions  that  were  passed to pcre2_compile(), whereas PCRE2_INFO_ALLOP-
-       TIONS returns the compile options as modified by any  top-level  (*XXX)
-       option  settings  such  as  (*UTF)  at the start of the pattern itself.
-       PCRE2_INFO_EXTRAOPTIONS returns the extra options that were set in  the
-       compile  context by calling the pcre2_set_compile_extra_options() func-
+       to  a  uint32_t variable. PCRE2_INFO_ARGOPTIONS returns exactly the op-
+       tions that were passed to  pcre2_compile(),  whereas  PCRE2_INFO_ALLOP-
+       TIONS  returns  the compile options as modified by any top-level (*XXX)
+       option settings such as (*UTF) at the  start  of  the  pattern  itself.
+       PCRE2_INFO_EXTRAOPTIONS  returns the extra options that were set in the
+       compile context by calling the pcre2_set_compile_extra_options()  func-
        tion.
 
-       For example, if the pattern /(*UTF)abc/ is compiled with the  PCRE2_EX-
-       TENDED  option,  the result for PCRE2_INFO_ALLOPTIONS is PCRE2_EXTENDED
-       and PCRE2_UTF.  Option settings such as (?i) that can change  within  a
+       For  example, if the pattern /(*UTF)abc/ is compiled with the PCRE2_EX-
+       TENDED option, the result for PCRE2_INFO_ALLOPTIONS  is  PCRE2_EXTENDED
+       and  PCRE2_UTF.   Option settings such as (?i) that can change within a
        pattern do not affect the result of PCRE2_INFO_ALLOPTIONS, even if they
-       appear right at the start of the pattern. (This was different  in  some
+       appear  right  at the start of the pattern. (This was different in some
        earlier releases.)
 
-       A  pattern compiled without PCRE2_ANCHORED is automatically anchored by
+       A pattern compiled without PCRE2_ANCHORED is automatically anchored  by
        PCRE2 if the first significant item in every top-level branch is one of
        the following:
 
@@ -2141,7 +2148,7 @@
          \G    always
          .*    sometimes - see below
 
-       When  .* is the first significant item, anchoring is possible only when
+       When .* is the first significant item, anchoring is possible only  when
        all the following are true:
 
          .* is not in an atomic group
@@ -2151,94 +2158,94 @@
          Neither (*PRUNE) nor (*SKIP) appears in the pattern
          PCRE2_NO_DOTSTAR_ANCHOR is not set
 
-       For patterns that are auto-anchored, the PCRE2_ANCHORED bit is  set  in
+       For  patterns  that are auto-anchored, the PCRE2_ANCHORED bit is set in
        the options returned for PCRE2_INFO_ALLOPTIONS.
 
          PCRE2_INFO_BACKREFMAX
 
-       Return  the  number  of  the  highest backreference in the pattern. The
-       third argument should point  to  a  uint32_t  variable.  Named  capture
-       groups  acquire  numbers  as well as names, and these count towards the
-       highest backreference. Backreferences such as \4 or  \g{12}  match  the
+       Return the number of the highest  backreference  in  the  pattern.  The
+       third  argument  should  point  to  a  uint32_t variable. Named capture
+       groups acquire numbers as well as names, and these  count  towards  the
+       highest  backreference.  Backreferences  such as \4 or \g{12} match the
        captured characters of the given group, but in addition, the check that
        a capture group is set in a conditional group such as (?(3)a|b) is also
        a backreference.  Zero is returned if there are no backreferences.
 
          PCRE2_INFO_BSR
 
-       The  output  is a uint32_t integer whose value indicates what character
-       sequences the \R escape sequence matches. A value of  PCRE2_BSR_UNICODE
-       means  that  \R  matches  any  Unicode line ending sequence; a value of
+       The output is a uint32_t integer whose value indicates  what  character
+       sequences  the \R escape sequence matches. A value of PCRE2_BSR_UNICODE
+       means that \R matches any Unicode line  ending  sequence;  a  value  of
        PCRE2_BSR_ANYCRLF means that \R matches only CR, LF, or CRLF.
 
          PCRE2_INFO_CAPTURECOUNT
 
-       Return the highest capture group number in  the  pattern.  In  patterns
+       Return  the  highest  capture  group number in the pattern. In patterns
        where (?| is not used, this is also the total number of capture groups.
        The third argument should point to a uint32_t variable.
 
          PCRE2_INFO_DEPTHLIMIT
 
-       If the pattern set a backtracking depth limit by including an  item  of
-       the  form  (*LIMIT_DEPTH=nnnn) at the start, the value is returned. The
+       If  the  pattern set a backtracking depth limit by including an item of
+       the form (*LIMIT_DEPTH=nnnn) at the start, the value is  returned.  The
        third argument should point to a uint32_t integer. If no such value has
-       been  set, the call to pcre2_pattern_info() returns the error PCRE2_ER-
+       been set, the call to pcre2_pattern_info() returns the error  PCRE2_ER-
        ROR_UNSET. Note that this limit will only be used during matching if it
-       is  less  than  the  limit  set or defaulted by the caller of the match
+       is less than the limit set or defaulted by  the  caller  of  the  match
        function.
 
          PCRE2_INFO_FIRSTBITMAP
 
-       In the absence of a single first code unit for a non-anchored  pattern,
-       pcre2_compile()  may construct a 256-bit table that defines a fixed set
-       of values for the first code unit in any match. For example, a  pattern
-       that  starts  with  [abc]  results in a table with three bits set. When
-       code unit values greater than 255 are supported, the flag bit  for  255
-       means  "any  code unit of value 255 or above". If such a table was con-
-       structed, a pointer to it is returned. Otherwise NULL is returned.  The
+       In  the absence of a single first code unit for a non-anchored pattern,
+       pcre2_compile() may construct a 256-bit table that defines a fixed  set
+       of  values for the first code unit in any match. For example, a pattern
+       that starts with [abc] results in a table with  three  bits  set.  When
+       code  unit  values greater than 255 are supported, the flag bit for 255
+       means "any code unit of value 255 or above". If such a table  was  con-
+       structed,  a pointer to it is returned. Otherwise NULL is returned. The
        third argument should point to a const uint8_t * variable.
 
          PCRE2_INFO_FIRSTCODETYPE
 
        Return information about the first code unit of any matched string, for
-       a non-anchored pattern. The third argument should point to  a  uint32_t
-       variable.  If there is a fixed first value, for example, the letter "c"
-       from a pattern such as (cat|cow|coyote), 1 is returned, and  the  value
-       can  be  retrieved using PCRE2_INFO_FIRSTCODEUNIT. If there is no fixed
-       first value, but it is known that a match can occur only at  the  start
-       of  the  subject  or following a newline in the subject, 2 is returned.
+       a  non-anchored  pattern. The third argument should point to a uint32_t
+       variable. If there is a fixed first value, for example, the letter  "c"
+       from  a  pattern such as (cat|cow|coyote), 1 is returned, and the value
+       can be retrieved using PCRE2_INFO_FIRSTCODEUNIT. If there is  no  fixed
+       first  value,  but it is known that a match can occur only at the start
+       of the subject or following a newline in the subject,  2  is  returned.
        Otherwise, and for anchored patterns, 0 is returned.
 
          PCRE2_INFO_FIRSTCODEUNIT
 
-       Return the value of the first code unit of any  matched  string  for  a
-       pattern  where  PCRE2_INFO_FIRSTCODETYPE returns 1; otherwise return 0.
-       The third argument should point to a uint32_t variable.  In  the  8-bit
-       library,  the  value is always less than 256. In the 16-bit library the
-       value can be up to 0xffff. In the 32-bit library  in  UTF-32  mode  the
+       Return  the  value  of  the first code unit of any matched string for a
+       pattern where PCRE2_INFO_FIRSTCODETYPE returns 1; otherwise  return  0.
+       The  third  argument  should point to a uint32_t variable. In the 8-bit
+       library, the value is always less than 256. In the 16-bit  library  the
+       value  can  be  up  to 0xffff. In the 32-bit library in UTF-32 mode the
        value can be up to 0x10ffff, and up to 0xffffffff when not using UTF-32
        mode.
 
          PCRE2_INFO_FRAMESIZE
 
        Return the size (in bytes) of the data frames that are used to remember
-       backtracking  positions  when the pattern is processed by pcre2_match()
-       without the use of JIT. The third argument should  point  to  a  size_t
+       backtracking positions when the pattern is processed  by  pcre2_match()
+       without  the  use  of  JIT. The third argument should point to a size_t
        variable. The frame size depends on the number of capturing parentheses
        in the pattern. Each additional capture group adds two PCRE2_SIZE vari-
        ables.
 
          PCRE2_INFO_HASBACKSLASHC
 
-       Return  1 if the pattern contains any instances of \C, otherwise 0. The
+       Return 1 if the pattern contains any instances of \C, otherwise 0.  The
        third argument should point to a uint32_t variable.
 
          PCRE2_INFO_HASCRORLF
 
-       Return 1 if the pattern contains any explicit  matches  for  CR  or  LF
-       characters,  otherwise 0. The third argument should point to a uint32_t
-       variable. An explicit match is either a literal CR or LF character,  or
-       \r  or  \n  or  one  of  the equivalent hexadecimal or octal escape se-
+       Return  1  if  the  pattern  contains any explicit matches for CR or LF
+       characters, otherwise 0. The third argument should point to a  uint32_t
+       variable.  An explicit match is either a literal CR or LF character, or
+       \r or \n or one of the  equivalent  hexadecimal  or  octal  escape  se-
        quences.
 
          PCRE2_INFO_HEAPLIMIT
@@ -2246,45 +2253,45 @@
        If the pattern set a heap memory limit by including an item of the form
        (*LIMIT_HEAP=nnnn) at the start, the value is returned. The third argu-
        ment should point to a uint32_t integer. If no such value has been set,
-       the  call  to pcre2_pattern_info() returns the error PCRE2_ERROR_UNSET.
-       Note that this limit will only be used during matching if  it  is  less
+       the call to pcre2_pattern_info() returns the  error  PCRE2_ERROR_UNSET.
+       Note  that  this  limit will only be used during matching if it is less
        than the limit set or defaulted by the caller of the match function.
 
          PCRE2_INFO_JCHANGED
 
-       Return  1  if  the (?J) or (?-J) option setting is used in the pattern,
-       otherwise 0. The third argument should point to  a  uint32_t  variable.
-       (?J)  and  (?-J) set and unset the local PCRE2_DUPNAMES option, respec-
+       Return 1 if the (?J) or (?-J) option setting is used  in  the  pattern,
+       otherwise  0.  The  third argument should point to a uint32_t variable.
+       (?J) and (?-J) set and unset the local PCRE2_DUPNAMES  option,  respec-
        tively.
 
          PCRE2_INFO_JITSIZE
 
-       If the compiled pattern was successfully  processed  by  pcre2_jit_com-
-       pile(),  return  the  size  of  the JIT compiled code, otherwise return
+       If  the  compiled  pattern was successfully processed by pcre2_jit_com-
+       pile(), return the size of the  JIT  compiled  code,  otherwise  return
        zero. The third argument should point to a size_t variable.
 
          PCRE2_INFO_LASTCODETYPE
 
-       Returns 1 if there is a rightmost literal code unit that must exist  in
-       any  matched string, other than at its start. The third argument should
+       Returns  1 if there is a rightmost literal code unit that must exist in
+       any matched string, other than at its start. The third argument  should
        point to a uint32_t variable. If there is no such value, 0 is returned.
-       When  1  is returned, the code unit value itself can be retrieved using
+       When 1 is returned, the code unit value itself can be  retrieved  using
        PCRE2_INFO_LASTCODEUNIT. For anchored patterns, a last literal value is
-       recorded  only if it follows something of variable length. For example,
-       for the pattern /^a\d+z\d+/ the returned value is 1 (with "z"  returned
-       from  PCRE2_INFO_LASTCODEUNIT), but for /^a\dz\d/ the returned value is
+       recorded only if it follows something of variable length. For  example,
+       for  the pattern /^a\d+z\d+/ the returned value is 1 (with "z" returned
+       from PCRE2_INFO_LASTCODEUNIT), but for /^a\dz\d/ the returned value  is
        0.
 
          PCRE2_INFO_LASTCODEUNIT
 
-       Return the value of the rightmost literal code unit that must exist  in
-       any  matched  string,  other  than  at  its  start, for a pattern where
+       Return  the value of the rightmost literal code unit that must exist in
+       any matched string, other than  at  its  start,  for  a  pattern  where
        PCRE2_INFO_LASTCODETYPE returns 1. Otherwise, return 0. The third argu-
        ment should point to a uint32_t variable.
 
          PCRE2_INFO_MATCHEMPTY
 
-       Return  1  if the pattern might match an empty string, otherwise 0. The
+       Return 1 if the pattern might match an empty string, otherwise  0.  The
        third argument should point to a uint32_t variable. When a pattern con-
        tains recursive subroutine calls it is not always possible to determine
        whether or not it can match an empty string. PCRE2 takes a cautious ap-
@@ -2292,44 +2299,44 @@
 
          PCRE2_INFO_MATCHLIMIT
 
-       If  the  pattern  set  a  match  limit by including an item of the form
-       (*LIMIT_MATCH=nnnn) at the start, the value is returned. The third  ar-
-       gument  should  point  to a uint32_t integer. If no such value has been
+       If the pattern set a match limit by  including  an  item  of  the  form
+       (*LIMIT_MATCH=nnnn)  at the start, the value is returned. The third ar-
+       gument should point to a uint32_t integer. If no such  value  has  been
        set, the call to pcre2_pattern_info() returns the error PCRE2_ERROR_UN-
-       SET.  Note  that  this limit will only be used during matching if it is
-       less than the limit set or defaulted by the caller of the  match  func-
+       SET. Note that this limit will only be used during matching  if  it  is
+       less  than  the limit set or defaulted by the caller of the match func-
        tion.
 
          PCRE2_INFO_MAXLOOKBEHIND
 
-       A  lookbehind  assertion moves back a certain number of characters (not
-       code units) when it starts to process each of its  branches.  This  re-
-       quest  returns  the largest of these backward moves. The third argument
+       A lookbehind assertion moves back a certain number of  characters  (not
+       code  units)  when  it starts to process each of its branches. This re-
+       quest returns the largest of these backward moves. The  third  argument
        should point to a uint32_t integer. The simple assertions \b and \B re-
-       quire  a one-character lookbehind and cause PCRE2_INFO_MAXLOOKBEHIND to
-       return 1 in the absence of anything longer. \A also  registers  a  one-
-       character  lookbehind, though it does not actually inspect the previous
+       quire a one-character lookbehind and cause PCRE2_INFO_MAXLOOKBEHIND  to
+       return  1  in  the absence of anything longer. \A also registers a one-
+       character lookbehind, though it does not actually inspect the  previous
        character.
 
        Note that this information is useful for multi-segment matching only if
-       the  pattern  contains  no nested lookbehinds. For example, the pattern
-       (?<=a(?<=ba)c) returns a maximum lookbehind of 2, but when it  is  pro-
-       cessed,  the first lookbehind moves back by two characters, matches one
-       character, then the nested lookbehind also moves back  by  two  charac-
+       the pattern contains no nested lookbehinds. For  example,  the  pattern
+       (?<=a(?<=ba)c)  returns  a maximum lookbehind of 2, but when it is pro-
+       cessed, the first lookbehind moves back by two characters, matches  one
+       character,  then  the  nested lookbehind also moves back by two charac-
        ters. This puts the matching point three characters earlier than it was
-       at the start.  PCRE2_INFO_MAXLOOKBEHIND is really only useful as a  de-
-       bugging  tool.  See  the pcre2partial documentation for a discussion of
+       at  the start.  PCRE2_INFO_MAXLOOKBEHIND is really only useful as a de-
+       bugging tool. See the pcre2partial documentation for  a  discussion  of
        multi-segment matching.
 
          PCRE2_INFO_MINLENGTH
 
-       If a minimum length for matching  subject  strings  was  computed,  its
+       If  a  minimum  length  for  matching subject strings was computed, its
        value is returned. Otherwise the returned value is 0. This value is not
-       computed when PCRE2_NO_START_OPTIMIZE is set. The value is a number  of
-       characters,  which in UTF mode may be different from the number of code
-       units. The third argument should point  to  a  uint32_t  variable.  The
-       value  is a lower bound to the length of any matching string. There may
-       not be any strings of that length that do  actually  match,  but  every
+       computed  when PCRE2_NO_START_OPTIMIZE is set. The value is a number of
+       characters, which in UTF mode may be different from the number of  code
+       units.  The  third  argument  should  point to a uint32_t variable. The
+       value is a lower bound to the length of any matching string. There  may
+       not  be  any  strings  of that length that do actually match, but every
        string that does match is at least that long.
 
          PCRE2_INFO_NAMECOUNT
@@ -2337,51 +2344,51 @@
          PCRE2_INFO_NAMETABLE
 
        PCRE2 supports the use of named as well as numbered capturing parenthe-
-       ses. The names are just an additional way of identifying the  parenthe-
+       ses.  The names are just an additional way of identifying the parenthe-
        ses, which still acquire numbers. Several convenience functions such as
-       pcre2_substring_get_byname() are provided for extracting captured  sub-
-       strings  by  name. It is also possible to extract the data directly, by
-       first converting the name to a number in order to  access  the  correct
-       pointers  in the output vector (described with pcre2_match() below). To
+       pcre2_substring_get_byname()  are provided for extracting captured sub-
+       strings by name. It is also possible to extract the data  directly,  by
+       first  converting  the  name to a number in order to access the correct
+       pointers in the output vector (described with pcre2_match() below).  To
        do the conversion, you need to use the name-to-number map, which is de-
        scribed by these three values.
 
-       The  map  consists  of a number of fixed-size entries. PCRE2_INFO_NAME-
-       COUNT gives the number of entries, and  PCRE2_INFO_NAMEENTRYSIZE  gives
-       the  size  of each entry in code units; both of these return a uint32_t
+       The map consists of a number of  fixed-size  entries.  PCRE2_INFO_NAME-
+       COUNT  gives  the number of entries, and PCRE2_INFO_NAMEENTRYSIZE gives
+       the size of each entry in code units; both of these return  a  uint32_t
        value. The entry size depends on the length of the longest name.
 
        PCRE2_INFO_NAMETABLE returns a pointer to the first entry of the table.
        This is a PCRE2_SPTR pointer to a block of code units. In the 8-bit li-
-       brary, the first two bytes of each entry are the number of the  captur-
-       ing  parenthesis,  most  significant byte first. In the 16-bit library,
-       the pointer points to 16-bit code units, the first  of  which  contains
-       the  parenthesis  number.  In the 32-bit library, the pointer points to
-       32-bit code units, the first of which contains the parenthesis  number.
+       brary,  the first two bytes of each entry are the number of the captur-
+       ing parenthesis, most significant byte first. In  the  16-bit  library,
+       the  pointer  points  to 16-bit code units, the first of which contains
+       the parenthesis number. In the 32-bit library, the  pointer  points  to
+       32-bit  code units, the first of which contains the parenthesis number.
        The rest of the entry is the corresponding name, zero terminated.
 
-       The  names are in alphabetical order. If (?| is used to create multiple
+       The names are in alphabetical order. If (?| is used to create  multiple
        capture groups with the same number, as described in the section on du-
        plicate group numbers in the pcre2pattern page, the groups may be given
-       the same name, but there is only one  entry  in  the  table.  Different
+       the  same  name,  but  there  is only one entry in the table. Different
        names for groups of the same number are not permitted.
 
-       Duplicate  names  for capture groups with different numbers are permit-
+       Duplicate names for capture groups with different numbers  are  permit-
        ted, but only if PCRE2_DUPNAMES is set. They appear in the table in the
-       order  in  which  they were found in the pattern. In the absence of (?|
-       this is the order of increasing number; when (?| is used  this  is  not
-       necessarily  the  case because later capture groups may have lower num-
+       order in which they were found in the pattern. In the  absence  of  (?|
+       this  is  the  order of increasing number; when (?| is used this is not
+       necessarily the case because later capture groups may have  lower  num-
        bers.
 
-       As a simple example of the name/number table,  consider  the  following
-       pattern  after  compilation by the 8-bit library (assume PCRE2_EXTENDED
+       As  a  simple  example of the name/number table, consider the following
+       pattern after compilation by the 8-bit library  (assume  PCRE2_EXTENDED
        is set, so white space - including newlines - is ignored):
 
          (?<date> (?<year>(\d\d)?\d\d) -
          (?<month>\d\d) - (?<day>\d\d) )
 
        There are four named capture groups, so the table has four entries, and
-       each  entry  in the table is eight bytes long. The table is as follows,
+       each entry in the table is eight bytes long. The table is  as  follows,
        with non-printing bytes shows in hexadecimal, and undefined bytes shown
        as ??:
 
@@ -2390,8 +2397,8 @@
          00 04 m  o  n  t  h  00
          00 02 y  e  a  r  00 ??
 
-       When  writing  code to extract data from named capture groups using the
-       name-to-number map, remember that the length of the entries  is  likely
+       When writing code to extract data from named capture groups  using  the
+       name-to-number  map,  remember that the length of the entries is likely
        to be different for each compiled pattern.
 
          PCRE2_INFO_NEWLINE
@@ -2410,14 +2417,14 @@
 
          PCRE2_INFO_SIZE
 
-       Return the size of the compiled pattern in bytes  (for  all  three  li-
-       braries).  The  third  argument should point to a size_t variable. This
-       value includes the size of the general data  block  that  precedes  the
-       code  units of the compiled pattern itself. The value that is used when
-       pcre2_compile() is getting memory in which to place the  compiled  pat-
+       Return  the  size  of  the compiled pattern in bytes (for all three li-
+       braries). The third argument should point to a  size_t  variable.  This
+       value  includes  the  size  of the general data block that precedes the
+       code units of the compiled pattern itself. The value that is used  when
+       pcre2_compile()  is  getting memory in which to place the compiled pat-
        tern may be slightly larger than the value returned by this option, be-
-       cause there are cases where the code that calculates the  size  has  to
-       over-estimate.  Processing a pattern with the JIT compiler does not al-
+       cause  there  are  cases where the code that calculates the size has to
+       over-estimate. Processing a pattern with the JIT compiler does not  al-
        ter the value returned by this option.
 
 
@@ -2428,30 +2435,30 @@
          void *user_data);
 
        A script language that supports the use of string arguments in callouts
-       might  like  to  scan  all the callouts in a pattern before running the
+       might like to scan all the callouts in a  pattern  before  running  the
        match. This can be done by calling pcre2_callout_enumerate(). The first
-       argument  is  a  pointer  to a compiled pattern, the second points to a
-       callback function, and the third is arbitrary user data.  The  callback
-       function  is  called  for  every callout in the pattern in the order in
+       argument is a pointer to a compiled pattern, the  second  points  to  a
+       callback  function,  and the third is arbitrary user data. The callback
+       function is called for every callout in the pattern  in  the  order  in
        which they appear. Its first argument is a pointer to a callout enumer-
-       ation  block,  and  its second argument is the user_data value that was
-       passed to pcre2_callout_enumerate(). The contents of the  callout  enu-
-       meration  block  are described in the pcre2callout documentation, which
+       ation block, and its second argument is the user_data  value  that  was
+       passed  to  pcre2_callout_enumerate(). The contents of the callout enu-
+       meration block are described in the pcre2callout  documentation,  which
        also gives further details about callouts.
 
 
 SERIALIZATION AND PRECOMPILING
 
-       It is possible to save compiled patterns  on  disc  or  elsewhere,  and
-       reload  them  later,  subject  to a number of restrictions. The host on
-       which the patterns are reloaded must be running  the  same  version  of
+       It  is  possible  to  save  compiled patterns on disc or elsewhere, and
+       reload them later, subject to a number of  restrictions.  The  host  on
+       which  the  patterns  are  reloaded must be running the same version of
        PCRE2, with the same code unit width, and must also have the same endi-
-       anness, pointer width, and PCRE2_SIZE type.  Before  compiled  patterns
-       can  be  saved, they must be converted to a "serialized" form, which in
-       the case of PCRE2 is really just a bytecode dump.  The functions  whose
-       names  begin  with pcre2_serialize_ are used for converting to and from
-       the serialized form. They are described in the pcre2serialize  documen-
-       tation.  Note  that  PCRE2 serialization does not convert compiled pat-
+       anness,  pointer  width,  and PCRE2_SIZE type. Before compiled patterns
+       can be saved, they must be converted to a "serialized" form,  which  in
+       the  case of PCRE2 is really just a bytecode dump.  The functions whose
+       names begin with pcre2_serialize_ are used for converting to  and  from
+       the  serialized form. They are described in the pcre2serialize documen-
+       tation. Note that PCRE2 serialization does not  convert  compiled  pat-
        terns to an abstract format like Java or .NET serialization.
 
 
@@ -2465,58 +2472,68 @@
 
        void pcre2_match_data_free(pcre2_match_data *match_data);
 
-       Information about a successful or unsuccessful match  is  placed  in  a
-       match  data  block,  which  is  an opaque structure that is accessed by
-       function calls. In particular, the match data block contains  a  vector
-       of  offsets into the subject string that define the matched part of the
-       subject and any substrings that were captured. This  is  known  as  the
-       ovector.
+       Information  about  a  successful  or unsuccessful match is placed in a
+       match data block, which is an opaque  structure  that  is  accessed  by
+       function  calls.  In particular, the match data block contains a vector
+       of offsets into the subject string that define the matched parts of the
+       subject. This is known as the ovector.
 
        Before  calling  pcre2_match(), pcre2_dfa_match(), or pcre2_jit_match()
        you must create a match data block by calling one of the creation func-
        tions  above.  For pcre2_match_data_create(), the first argument is the
-       number of pairs of offsets in the ovector. One pair of offsets  is  re-
-       quired  to  identify the string that matched the whole pattern, with an
-       additional pair for each captured substring. For example, a value of  4
-       creates  enough space to record the matched portion of the subject plus
-       three captured substrings. A minimum of at least 1 pair is  imposed  by
-       pcre2_match_data_create(), so it is always possible to return the over-
-       all matched string.
+       number of pairs of offsets in the ovector.
+
+       When using pcre2_match(), one pair of offsets is required  to  identify
+       the  string that matched the whole pattern, with an additional pair for
+       each captured substring. For example, a value of 4 creates enough space
+       to  record  the matched portion of the subject plus three captured sub-
+       strings.
+
+       When using pcre2_dfa_match() there may be multiple  matched  substrings
+       of  different  lengths  at  the  same point in the subject. The ovector
+       should be made large enough to hold as many as are expected.
+
+       A minimum of at least 1 pair is imposed  by  pcre2_match_data_create(),
+       so  it  is  always possible to return the overall matched string in the
+       case  of  pcre2_match()  or  the  longest  match   in   the   case   of
+       pcre2_dfa_match().
 
        The second argument of pcre2_match_data_create() is a pointer to a gen-
-       eral  context, which can specify custom memory management for obtaining
+       eral context, which can specify custom memory management for  obtaining
        the memory for the match data block. If you are not using custom memory
        management, pass NULL, which causes malloc() to be used.
 
-       For  pcre2_match_data_create_from_pattern(),  the  first  argument is a
+       For pcre2_match_data_create_from_pattern(), the  first  argument  is  a
        pointer to a compiled pattern. The ovector is created to be exactly the
-       right size to hold all the substrings a pattern might capture. The sec-
-       ond argument is again a pointer to a general context, but in this  case
-       if NULL is passed, the memory is obtained using the same allocator that
-       was used for the compiled pattern (custom or default).
+       right size to hold all the substrings  a  pattern  might  capture  when
+       matched using pcre2_match(). You should not use this call when matching
+       with pcre2_dfa_match(). The second argument is again  a  pointer  to  a
+       general  context, but in this case if NULL is passed, the memory is ob-
+       tained using the same allocator that was used for the compiled  pattern
+       (custom or default).
 
-       A match data block can be used many times, with the same  or  different
-       compiled  patterns. You can extract information from a match data block
-       after a match operation has finished,  using  functions  that  are  de-
+       A  match  data block can be used many times, with the same or different
+       compiled patterns. You can extract information from a match data  block
+       after  a  match  operation  has  finished, using functions that are de-
        scribed in the sections on matched strings and other match data below.
 
-       When  a  call  of  pcre2_match()  fails, valid data is available in the
-       match block only  when  the  error  is  PCRE2_ERROR_NOMATCH,  PCRE2_ER-
-       ROR_PARTIAL,  or  one of the error codes for an invalid UTF string. Ex-
+       When a call of pcre2_match() fails, valid  data  is  available  in  the
+       match  block  only  when  the  error  is PCRE2_ERROR_NOMATCH, PCRE2_ER-
+       ROR_PARTIAL, or one of the error codes for an invalid UTF  string.  Ex-
        actly what is available depends on the error, and is detailed below.
 
-       When one of the matching functions is called, pointers to the  compiled
-       pattern  and the subject string are set in the match data block so that
-       they can be referenced by the extraction functions after  a  successful
+       When  one of the matching functions is called, pointers to the compiled
+       pattern and the subject string are set in the match data block so  that
+       they  can  be referenced by the extraction functions after a successful
        match. After running a match, you must not free a compiled pattern or a
-       subject string until after all operations on the match data block  (for
-       that  match)  have  taken  place,  unless,  in  the case of the subject
-       string, you have used the PCRE2_COPY_MATCHED_SUBJECT option,  which  is
-       described  in  the section entitled "Option bits for pcre2_match()" be-
+       subject  string until after all operations on the match data block (for
+       that match) have taken place,  unless,  in  the  case  of  the  subject
+       string,  you  have used the PCRE2_COPY_MATCHED_SUBJECT option, which is
+       described in the section entitled "Option bits for  pcre2_match()"  be-
        low.
 
-       When a match data block itself is no longer needed, it should be  freed
-       by  calling  pcre2_match_data_free(). If this function is called with a
+       When  a match data block itself is no longer needed, it should be freed
+       by calling pcre2_match_data_free(). If this function is called  with  a
        NULL argument, it returns immediately, without doing anything.
 
 
@@ -2527,15 +2544,15 @@
          uint32_t options, pcre2_match_data *match_data,
          pcre2_match_context *mcontext);
 
-       The function pcre2_match() is called to match a subject string  against
-       a  compiled pattern, which is passed in the code argument. You can call
+       The  function pcre2_match() is called to match a subject string against
+       a compiled pattern, which is passed in the code argument. You can  call
        pcre2_match() with the same code argument as many times as you like, in
-       order  to  find multiple matches in the subject string or to match dif-
+       order to find multiple matches in the subject string or to  match  dif-
        ferent subject strings with the same pattern.
 
-       This function is the main matching facility of the library, and it  op-
-       erates  in  a Perl-like manner. For specialist use there is also an al-
-       ternative matching function, which is described below  in  the  section
+       This  function is the main matching facility of the library, and it op-
+       erates in a Perl-like manner. For specialist use there is also  an  al-
+       ternative  matching  function,  which is described below in the section
        about the pcre2_dfa_match() function.
 
        Here is an example of a simple call to pcre2_match():
@@ -2550,215 +2567,215 @@
            md,             /* the match data block */
            NULL);          /* a match context; NULL means use defaults */
 
-       If  the  subject  string is zero-terminated, the length can be given as
+       If the subject string is zero-terminated, the length can  be  given  as
        PCRE2_ZERO_TERMINATED. A match context must be provided if certain less
        common matching parameters are to be changed. For details, see the sec-
        tion on the match context above.
 
    The string to be matched by pcre2_match()
 
-       The subject string is passed to pcre2_match() as a pointer in  subject,
-       a  length  in  length, and a starting offset in startoffset. The length
-       and offset are in code units, not characters.  That  is,  they  are  in
-       bytes  for the 8-bit library, 16-bit code units for the 16-bit library,
-       and 32-bit code units for the 32-bit library, whether or not  UTF  pro-
+       The  subject string is passed to pcre2_match() as a pointer in subject,
+       a length in length, and a starting offset in  startoffset.  The  length
+       and  offset  are  in  code units, not characters.  That is, they are in
+       bytes for the 8-bit library, 16-bit code units for the 16-bit  library,
+       and  32-bit  code units for the 32-bit library, whether or not UTF pro-
        cessing is enabled.
 
        If startoffset is greater than the length of the subject, pcre2_match()
-       returns PCRE2_ERROR_BADOFFSET. When the starting offset  is  zero,  the
-       search  for a match starts at the beginning of the subject, and this is
+       returns  PCRE2_ERROR_BADOFFSET.  When  the starting offset is zero, the
+       search for a match starts at the beginning of the subject, and this  is
        by far the most common case. In UTF-8 or UTF-16 mode, the starting off-
-       set  must  point to the start of a character, or to the end of the sub-
-       ject (in UTF-32 mode, one code unit equals one character, so  all  off-
-       sets  are  valid). Like the pattern string, the subject may contain bi-
+       set must point to the start of a character, or to the end of  the  sub-
+       ject  (in  UTF-32 mode, one code unit equals one character, so all off-
+       sets are valid). Like the pattern string, the subject may  contain  bi-
        nary zeros.
 
-       A non-zero starting offset is useful when searching for  another  match
-       in  the  same  subject  by calling pcre2_match() again after a previous
-       success.  Setting startoffset differs from  passing  over  a  shortened
-       string  and  setting  PCRE2_NOTBOL in the case of a pattern that begins
+       A  non-zero  starting offset is useful when searching for another match
+       in the same subject by calling pcre2_match()  again  after  a  previous
+       success.   Setting  startoffset  differs  from passing over a shortened
+       string and setting PCRE2_NOTBOL in the case of a  pattern  that  begins
        with any kind of lookbehind. For example, consider the pattern
 
          \Biss\B
 
-       which finds occurrences of "iss" in the middle of  words.  (\B  matches
-       only  if  the  current position in the subject is not a word boundary.)
-       When applied to the string "Mississipi" the first call to pcre2_match()
-       finds  the first occurrence. If pcre2_match() is called again with just
-       the remainder of the subject, namely "issipi", it does not  match,  be-
-       cause  \B  is always false at the start of the subject, which is deemed
-       to be a word boundary. However, if pcre2_match() is passed  the  entire
-       string again, but with startoffset set to 4, it finds the second occur-
-       rence of "iss" because it is able to look behind the starting point  to
-       discover that it is preceded by a letter.
+       which  finds  occurrences  of "iss" in the middle of words. (\B matches
+       only if the current position in the subject is not  a  word  boundary.)
+       When   applied   to   the   string  "Mississippi"  the  first  call  to
+       pcre2_match() finds the first occurrence. If  pcre2_match()  is  called
+       again with just the remainder of the subject, namely "issippi", it does
+       not match, because \B is always false at  the  start  of  the  subject,
+       which  is  deemed  to  be a word boundary. However, if pcre2_match() is
+       passed the entire string again, but with startoffset set to 4, it finds
+       the  second  occurrence  of "iss" because it is able to look behind the
+       starting point to discover that it is preceded by a letter.
 
-       Finding  all  the  matches  in a subject is tricky when the pattern can
+       Finding all the matches in a subject is tricky  when  the  pattern  can
        match an empty string. It is possible to emulate Perl's /g behaviour by
-       first   trying   the   match   again  at  the  same  offset,  with  the
-       PCRE2_NOTEMPTY_ATSTART and PCRE2_ANCHORED options,  and  then  if  that
-       fails,  advancing  the  starting  offset  and  trying an ordinary match
-       again. There is some code that demonstrates  how  to  do  this  in  the
-       pcre2demo  sample  program. In the most general case, you have to check
-       to see if the newline convention recognizes CRLF as a newline,  and  if
-       so,  and the current character is CR followed by LF, advance the start-
+       first  trying  the  match  again  at  the   same   offset,   with   the
+       PCRE2_NOTEMPTY_ATSTART  and  PCRE2_ANCHORED  options,  and then if that
+       fails, advancing the starting  offset  and  trying  an  ordinary  match
+       again.  There  is  some  code  that  demonstrates how to do this in the
+       pcre2demo sample program. In the most general case, you have  to  check
+       to  see  if the newline convention recognizes CRLF as a newline, and if
+       so, and the current character is CR followed by LF, advance the  start-
        ing offset by two characters instead of one.
 
        If a non-zero starting offset is passed when the pattern is anchored, a
        single attempt to match at the given offset is made. This can only suc-
-       ceed if the pattern does not require the match to be at  the  start  of
-       the  subject.  In other words, the anchoring must be the result of set-
-       ting the PCRE2_ANCHORED option or the use of .* with PCRE2_DOTALL,  not
+       ceed  if  the  pattern does not require the match to be at the start of
+       the subject. In other words, the anchoring must be the result  of  set-
+       ting  the PCRE2_ANCHORED option or the use of .* with PCRE2_DOTALL, not
        by starting the pattern with ^ or \A.
 
    Option bits for pcre2_match()
 
        The unused bits of the options argument for pcre2_match() must be zero.
-       The   only   bits    that    may    be    set    are    PCRE2_ANCHORED,
-       PCRE2_COPY_MATCHED_SUBJECT,  PCRE2_ENDANCHORED, PCRE2_NOTBOL, PCRE2_NO-
+       The    only    bits    that    may    be    set   are   PCRE2_ANCHORED,
+       PCRE2_COPY_MATCHED_SUBJECT, PCRE2_ENDANCHORED, PCRE2_NOTBOL,  PCRE2_NO-
        TEOL,     PCRE2_NOTEMPTY,     PCRE2_NOTEMPTY_ATSTART,     PCRE2_NO_JIT,
-       PCRE2_NO_UTF_CHECK,  PCRE2_PARTIAL_HARD,  and PCRE2_PARTIAL_SOFT. Their
+       PCRE2_NO_UTF_CHECK, PCRE2_PARTIAL_HARD, and  PCRE2_PARTIAL_SOFT.  Their
        action is described below.
 
-       Setting PCRE2_ANCHORED or PCRE2_ENDANCHORED at match time is  not  sup-
-       ported  by  the just-in-time (JIT) compiler. If it is set, JIT matching
-       is disabled and the interpretive code in pcre2_match()  is  run.  Apart
-       from  PCRE2_NO_JIT (obviously), the remaining options are supported for
+       Setting  PCRE2_ANCHORED  or PCRE2_ENDANCHORED at match time is not sup-
+       ported by the just-in-time (JIT) compiler. If it is set,  JIT  matching
+       is  disabled  and  the interpretive code in pcre2_match() is run. Apart
+       from PCRE2_NO_JIT (obviously), the remaining options are supported  for
        JIT matching.
 
          PCRE2_ANCHORED
 
        The PCRE2_ANCHORED option limits pcre2_match() to matching at the first
-       matching  position.  If  a pattern was compiled with PCRE2_ANCHORED, or
-       turned out to be anchored by virtue of its contents, it cannot be  made
-       unachored  at matching time. Note that setting the option at match time
+       matching position. If a pattern was compiled  with  PCRE2_ANCHORED,  or
+       turned  out to be anchored by virtue of its contents, it cannot be made
+       unachored at matching time. Note that setting the option at match  time
        disables JIT matching.
 
          PCRE2_COPY_MATCHED_SUBJECT
 
-       By default, a pointer to the subject is remembered in  the  match  data
-       block  so  that,  after a successful match, it can be referenced by the
-       substring extraction functions. This means that  the  subject's  memory
-       must  not be freed until all such operations are complete. For some ap-
-       plications where the lifetime of the subject string is not  guaranteed,
-       it  may  be  necessary  to make a copy of the subject string, but it is
-       wasteful to do this unless the match is successful. After a  successful
-       match,  if PCRE2_COPY_MATCHED_SUBJECT is set, the subject is copied and
-       the new pointer is remembered in the match data block  instead  of  the
-       original  subject  pointer.  The memory allocator that was used for the
-       match block itself is  used.  The  copy  is  automatically  freed  when
-       pcre2_match_data_free()  is  called to free the match data block. It is
+       By  default,  a  pointer to the subject is remembered in the match data
+       block so that, after a successful match, it can be  referenced  by  the
+       substring  extraction  functions.  This means that the subject's memory
+       must not be freed until all such operations are complete. For some  ap-
+       plications  where the lifetime of the subject string is not guaranteed,
+       it may be necessary to make a copy of the subject  string,  but  it  is
+       wasteful  to do this unless the match is successful. After a successful
+       match, if PCRE2_COPY_MATCHED_SUBJECT is set, the subject is copied  and
+       the  new  pointer  is remembered in the match data block instead of the
+       original subject pointer. The memory allocator that was  used  for  the
+       match  block  itself  is  used.  The  copy  is automatically freed when
+       pcre2_match_data_free() is called to free the match data block.  It  is
        also automatically freed if the match data block is re-used for another
        match operation.
 
          PCRE2_ENDANCHORED
 
-       If  the  PCRE2_ENDANCHORED option is set, any string that pcre2_match()
-       matches must be right at the end of the subject string. Note that  set-
+       If the PCRE2_ENDANCHORED option is set, any string  that  pcre2_match()
+       matches  must be right at the end of the subject string. Note that set-
        ting the option at match time disables JIT matching.
 
          PCRE2_NOTBOL
 
        This option specifies that first character of the subject string is not
-       the beginning of a line, so the  circumflex  metacharacter  should  not
-       match  before  it.  Setting  this without having set PCRE2_MULTILINE at
+       the  beginning  of  a  line, so the circumflex metacharacter should not
+       match before it. Setting this without  having  set  PCRE2_MULTILINE  at
        compile time causes circumflex never to match. This option affects only
        the behaviour of the circumflex metacharacter. It does not affect \A.
 
          PCRE2_NOTEOL
 
        This option specifies that the end of the subject string is not the end
-       of a line, so the dollar metacharacter should not match it nor  (except
-       in  multiline mode) a newline immediately before it. Setting this with-
-       out having set PCRE2_MULTILINE at compile time causes dollar  never  to
+       of  a line, so the dollar metacharacter should not match it nor (except
+       in multiline mode) a newline immediately before it. Setting this  with-
+       out  having  set PCRE2_MULTILINE at compile time causes dollar never to
        match. This option affects only the behaviour of the dollar metacharac-
        ter. It does not affect \Z or \z.
 
          PCRE2_NOTEMPTY
 
        An empty string is not considered to be a valid match if this option is
-       set.  If  there are alternatives in the pattern, they are tried. If all
-       the alternatives match the empty string, the entire  match  fails.  For
+       set. If there are alternatives in the pattern, they are tried.  If  all
+       the  alternatives  match  the empty string, the entire match fails. For
        example, if the pattern
 
          a?b?
 
-       is  applied  to  a  string not beginning with "a" or "b", it matches an
+       is applied to a string not beginning with "a" or  "b",  it  matches  an
        empty string at the start of the subject. With PCRE2_NOTEMPTY set, this
-       match  is  not valid, so pcre2_match() searches further into the string
+       match is not valid, so pcre2_match() searches further into  the  string
        for occurrences of "a" or "b".
 
          PCRE2_NOTEMPTY_ATSTART
 
-       This is like PCRE2_NOTEMPTY, except that it locks out an  empty  string
+       This  is  like PCRE2_NOTEMPTY, except that it locks out an empty string
        match only at the first matching position, that is, at the start of the
-       subject plus the starting offset. An empty string match  later  in  the
+       subject  plus  the  starting offset. An empty string match later in the
        subject is permitted.  If the pattern is anchored, such a match can oc-
        cur only if the pattern contains \K.
 
          PCRE2_NO_JIT
 
-       By  default,  if  a  pattern  has  been   successfully   processed   by
-       pcre2_jit_compile(),  JIT  is  automatically used when pcre2_match() is
-       called with options that JIT supports.  Setting  PCRE2_NO_JIT  disables
+       By   default,   if   a  pattern  has  been  successfully  processed  by
+       pcre2_jit_compile(), JIT is automatically used  when  pcre2_match()  is
+       called  with  options  that JIT supports. Setting PCRE2_NO_JIT disables
        the use of JIT; it forces matching to be done by the interpreter.
 
          PCRE2_NO_UTF_CHECK
 
        When PCRE2_UTF is set at compile time, the validity of the subject as a
-       UTF  string  is  checked  unless  PCRE2_NO_UTF_CHECK   is   passed   to
+       UTF   string   is   checked  unless  PCRE2_NO_UTF_CHECK  is  passed  to
        pcre2_match() or PCRE2_MATCH_INVALID_UTF was passed to pcre2_compile().
        The latter special case is discussed in detail in the pcre2unicode doc-
        umentation.
 
-       In  the default case, if a non-zero starting offset is given, the check
-       is applied only to that part of the subject  that  could  be  inspected
-       during  matching,  and there is a check that the starting offset points
-       to the first code unit of a character or to the end of the subject.  If
-       there  are no lookbehind assertions in the pattern, the check starts at
+       In the default case, if a non-zero starting offset is given, the  check
+       is  applied  only  to  that part of the subject that could be inspected
+       during matching, and there is a check that the starting  offset  points
+       to  the first code unit of a character or to the end of the subject. If
+       there are no lookbehind assertions in the pattern, the check starts  at
        the starting offset.  Otherwise, it starts at the length of the longest
-       lookbehind  before  the starting offset, or at the start of the subject
-       if there are not that many characters before the starting offset.  Note
+       lookbehind before the starting offset, or at the start of  the  subject
+       if  there are not that many characters before the starting offset. Note
        that the sequences \b and \B are one-character lookbehinds.
 
        The check is carried out before any other processing takes place, and a
-       negative error code is returned if the check fails. There  are  several
-       UTF  error  codes  for each code unit width, corresponding to different
-       problems with the code unit sequence. There are discussions  about  the
-       validity  of  UTF-8  strings, UTF-16 strings, and UTF-32 strings in the
+       negative  error  code is returned if the check fails. There are several
+       UTF error codes for each code unit width,  corresponding  to  different
+       problems  with  the code unit sequence. There are discussions about the
+       validity of UTF-8 strings, UTF-16 strings, and UTF-32  strings  in  the
        pcre2unicode documentation.
 
        If you know that your subject is valid, and you want to skip this check
        for performance reasons, you can set the PCRE2_NO_UTF_CHECK option when
-       calling pcre2_match(). You might want to do this  for  the  second  and
-       subsequent  calls  to pcre2_match() if you are making repeated calls to
+       calling  pcre2_match().  You  might  want to do this for the second and
+       subsequent calls to pcre2_match() if you are making repeated  calls  to
        find multiple matches in the same subject string.
 
-       Warning: Unless PCRE2_MATCH_INVALID_UTF was set at compile  time,  when
-       PCRE2_NO_UTF_CHECK  is  set  at match time the effect of passing an in-
+       Warning:  Unless  PCRE2_MATCH_INVALID_UTF was set at compile time, when
+       PCRE2_NO_UTF_CHECK is set at match time the effect of  passing  an  in-
        valid string as a subject, or an invalid value of startoffset, is unde-
-       fined.   Your  program may crash or loop indefinitely or give wrong re-
+       fined.  Your program may crash or loop indefinitely or give  wrong  re-
        sults.
 
          PCRE2_PARTIAL_HARD
          PCRE2_PARTIAL_SOFT
 
        These options turn on the partial matching feature. A partial match oc-
-       curs  if  the  end  of  the subject string is reached successfully, but
+       curs if the end of the subject  string  is  reached  successfully,  but
        there are not enough subject characters to complete the match. In addi-
-       tion,  either  at  least  one character must have been inspected or the
-       pattern must contain a lookbehind, or the  pattern  must  be  one  that
+       tion, either at least one character must have  been  inspected  or  the
+       pattern  must  contain  a  lookbehind,  or the pattern must be one that
        could match an empty string.
 
-       If  this  situation  arises when PCRE2_PARTIAL_SOFT (but not PCRE2_PAR-
+       If this situation arises when PCRE2_PARTIAL_SOFT  (but  not  PCRE2_PAR-
        TIAL_HARD) is set, matching continues by testing any remaining alterna-
-       tives.  Only  if  no complete match can be found is PCRE2_ERROR_PARTIAL
-       returned instead of PCRE2_ERROR_NOMATCH.  In  other  words,  PCRE2_PAR-
-       TIAL_SOFT  specifies  that  the  caller is prepared to handle a partial
+       tives. Only if no complete match can be  found  is  PCRE2_ERROR_PARTIAL
+       returned  instead  of  PCRE2_ERROR_NOMATCH.  In other words, PCRE2_PAR-
+       TIAL_SOFT specifies that the caller is prepared  to  handle  a  partial
        match, but only if no complete match can be found.
 
-       If PCRE2_PARTIAL_HARD is set, it overrides PCRE2_PARTIAL_SOFT. In  this
-       case,  if  a  partial match is found, pcre2_match() immediately returns
-       PCRE2_ERROR_PARTIAL, without considering  any  other  alternatives.  In
+       If  PCRE2_PARTIAL_HARD is set, it overrides PCRE2_PARTIAL_SOFT. In this
+       case, if a partial match is found,  pcre2_match()  immediately  returns
+       PCRE2_ERROR_PARTIAL,  without  considering  any  other alternatives. In
        other words, when PCRE2_PARTIAL_HARD is set, a partial match is consid-
        ered to be more important that an alternative complete match.
 
@@ -2768,38 +2785,38 @@
 
 NEWLINE HANDLING WHEN MATCHING
 
-       When  PCRE2 is built, a default newline convention is set; this is usu-
-       ally the standard convention for the operating system. The default  can
-       be  overridden  in a compile context by calling pcre2_set_newline(). It
-       can also be overridden by starting a pattern string with, for  example,
-       (*CRLF),  as  described  in  the  section on newline conventions in the
-       pcre2pattern page. During matching, the newline choice affects the  be-
-       haviour  of the dot, circumflex, and dollar metacharacters. It may also
-       alter the way the match starting position is  advanced  after  a  match
+       When PCRE2 is built, a default newline convention is set; this is  usu-
+       ally  the standard convention for the operating system. The default can
+       be overridden in a compile context by calling  pcre2_set_newline().  It
+       can  also be overridden by starting a pattern string with, for example,
+       (*CRLF), as described in the section  on  newline  conventions  in  the
+       pcre2pattern  page. During matching, the newline choice affects the be-
+       haviour of the dot, circumflex, and dollar metacharacters. It may  also
+       alter  the  way  the  match starting position is advanced after a match
        failure for an unanchored pattern.
 
        When PCRE2_NEWLINE_CRLF, PCRE2_NEWLINE_ANYCRLF, or PCRE2_NEWLINE_ANY is
-       set as the newline convention, and a match attempt  for  an  unanchored
+       set  as  the  newline convention, and a match attempt for an unanchored
        pattern fails when the current starting position is at a CRLF sequence,
-       and the pattern contains no explicit matches for CR or  LF  characters,
-       the  match  position  is  advanced by two characters instead of one, in
+       and  the  pattern contains no explicit matches for CR or LF characters,
+       the match position is advanced by two characters  instead  of  one,  in
        other words, to after the CRLF.
 
        The above rule is a compromise that makes the most common cases work as
-       expected.  For example, if the pattern is .+A (and the PCRE2_DOTALL op-
-       tion is not set), it does not match the string "\r\nA"  because,  after
-       failing  at the start, it skips both the CR and the LF before retrying.
-       However, the pattern [\r\n]A does match that string,  because  it  con-
+       expected. For example, if the pattern is .+A (and the PCRE2_DOTALL  op-
+       tion  is  not set), it does not match the string "\r\nA" because, after
+       failing at the start, it skips both the CR and the LF before  retrying.
+       However,  the  pattern  [\r\n]A does match that string, because it con-
        tains an explicit CR or LF reference, and so advances only by one char-
        acter after the first failure.
 
        An explicit match for CR of LF is either a literal appearance of one of
-       those  characters  in the pattern, or one of the \r or \n or equivalent
+       those characters in the pattern, or one of the \r or \n  or  equivalent
        octal or hexadecimal escape sequences. Implicit matches such as [^X] do
-       not  count, nor does \s, even though it includes CR and LF in the char-
+       not count, nor does \s, even though it includes CR and LF in the  char-
        acters that it matches.
 
-       Notwithstanding the above, anomalous effects may still occur when  CRLF
+       Notwithstanding  the above, anomalous effects may still occur when CRLF
        is a valid newline sequence and explicit \r or \n escapes appear in the
        pattern.
 
@@ -2810,82 +2827,82 @@
 
        PCRE2_SIZE *pcre2_get_ovector_pointer(pcre2_match_data *match_data);
 
-       In general, a pattern matches a certain portion of the subject, and  in
-       addition,  further  substrings  from  the  subject may be picked out by
-       parenthesized parts of the pattern.  Following  the  usage  in  Jeffrey
-       Friedl's  book,  this  is  called  "capturing" in what follows, and the
-       phrase "capture group" (Perl terminology) is used for a fragment  of  a
-       pattern  that picks out a substring. PCRE2 supports several other kinds
+       In  general, a pattern matches a certain portion of the subject, and in
+       addition, further substrings from the subject  may  be  picked  out  by
+       parenthesized  parts  of  the  pattern.  Following the usage in Jeffrey
+       Friedl's book, this is called "capturing"  in  what  follows,  and  the
+       phrase  "capture  group" (Perl terminology) is used for a fragment of a
+       pattern that picks out a substring. PCRE2 supports several other  kinds
        of parenthesized group that do not cause substrings to be captured. The
-       pcre2_pattern_info()  function can be used to find out how many capture
+       pcre2_pattern_info() function can be used to find out how many  capture
        groups there are in a compiled pattern.
 
-       You can use auxiliary functions for accessing  captured  substrings  by
+       You  can  use  auxiliary functions for accessing captured substrings by
        number or by name, as described in sections below.
 
        Alternatively, you can make direct use of the vector of PCRE2_SIZE val-
-       ues, called  the  ovector,  which  contains  the  offsets  of  captured
-       strings.   It   is   part  of  the  match  data  block.   The  function
-       pcre2_get_ovector_pointer() returns the address  of  the  ovector,  and
+       ues,  called  the  ovector,  which  contains  the  offsets  of captured
+       strings.  It  is  part  of  the  match  data   block.    The   function
+       pcre2_get_ovector_pointer()  returns  the  address  of the ovector, and
        pcre2_get_ovector_count() returns the number of pairs of values it con-
        tains.
 
        Within the ovector, the first in each pair of values is set to the off-
        set of the first code unit of a substring, and the second is set to the
-       offset of the first code unit after the end of a substring. These  val-
-       ues  are always code unit offsets, not character offsets. That is, they
+       offset  of the first code unit after the end of a substring. These val-
+       ues are always code unit offsets, not character offsets. That is,  they
        are byte offsets in the 8-bit library, 16-bit offsets in the 16-bit li-
        brary, and 32-bit offsets in the 32-bit library.
 
-       After  a  partial  match  (error  return PCRE2_ERROR_PARTIAL), only the
-       first pair of offsets (that is, ovector[0]  and  ovector[1])  are  set.
-       They  identify  the part of the subject that was partially matched. See
+       After a partial match  (error  return  PCRE2_ERROR_PARTIAL),  only  the
+       first  pair  of  offsets  (that is, ovector[0] and ovector[1]) are set.
+       They identify the part of the subject that was partially  matched.  See
        the pcre2partial documentation for details of partial matching.
 
-       After a fully successful match, the first pair  of  offsets  identifies
-       the  portion  of the subject string that was matched by the entire pat-
-       tern. The next pair is used for the first captured  substring,  and  so
-       on.  The  value  returned by pcre2_match() is one more than the highest
-       numbered pair that has been set. For example, if  two  substrings  have
-       been  captured,  the returned value is 3. If there are no captured sub-
+       After  a  fully  successful match, the first pair of offsets identifies
+       the portion of the subject string that was matched by the  entire  pat-
+       tern.  The  next  pair is used for the first captured substring, and so
+       on. The value returned by pcre2_match() is one more  than  the  highest
+       numbered  pair  that  has been set. For example, if two substrings have
+       been captured, the returned value is 3. If there are no  captured  sub-
        strings, the return value from a successful match is 1, indicating that
        just the first pair of offsets has been set.
 
-       If  a  pattern uses the \K escape sequence within a positive assertion,
+       If a pattern uses the \K escape sequence within a  positive  assertion,
        the reported start of a successful match can be greater than the end of
-       the  match.   For  example,  if the pattern (?=ab\K) is matched against
+       the match.  For example, if the pattern  (?=ab\K)  is  matched  against
        "ab", the start and end offset values for the match are 2 and 0.
 
-       If a capture group is matched repeatedly within a single  match  opera-
+       If  a  capture group is matched repeatedly within a single match opera-
        tion, it is the last portion of the subject that it matched that is re-
        turned.
 
        If the ovector is too small to hold all the captured substring offsets,
-       as  much  as possible is filled in, and the function returns a value of
-       zero. If captured substrings are not of interest, pcre2_match() may  be
+       as much as possible is filled in, and the function returns a  value  of
+       zero.  If captured substrings are not of interest, pcre2_match() may be
        called with a match data block whose ovector is of minimum length (that
        is, one pair).
 
-       It is possible for capture group number n+1 to match some part  of  the
-       subject  when  group  n  has  not been used at all. For example, if the
+       It  is  possible for capture group number n+1 to match some part of the
+       subject when group n has not been used at  all.  For  example,  if  the
        string "abc" is matched against the pattern (a|(z))(bc) the return from
-       the  function  is 4, and groups 1 and 3 are matched, but 2 is not. When
-       this happens, both values in the offset pairs corresponding  to  unused
+       the function is 4, and groups 1 and 3 are matched, but 2 is  not.  When
+       this  happens,  both values in the offset pairs corresponding to unused
        groups are set to PCRE2_UNSET.
 
-       Offset  values  that  correspond to unused groups at the end of the ex-
-       pression are also set to PCRE2_UNSET. For example, if the string  "abc"
-       is  matched  against  the pattern (abc)(x(yz)?)? groups 2 and 3 are not
-       matched. The return from the function is 2, because  the  highest  used
-       capture  group  number  is  1. The offsets for for the second and third
-       capture groupss (assuming the vector is large enough,  of  course)  are
+       Offset values that correspond to unused groups at the end  of  the  ex-
+       pression  are also set to PCRE2_UNSET. For example, if the string "abc"
+       is matched against the pattern (abc)(x(yz)?)? groups 2 and  3  are  not
+       matched.  The  return  from the function is 2, because the highest used
+       capture group number is 1. The offsets for for  the  second  and  third
+       capture  groupss  (assuming  the vector is large enough, of course) are
        set to PCRE2_UNSET.
 
        Elements in the ovector that do not correspond to capturing parentheses
        in the pattern are never changed. That is, if a pattern contains n cap-
        turing parentheses, no more than ovector[0] to ovector[2n+1] are set by
-       pcre2_match(). The other elements retain whatever  values  they  previ-
-       ously  had.  After  a failed match attempt, the contents of the ovector
+       pcre2_match().  The  other  elements retain whatever values they previ-
+       ously had. After a failed match attempt, the contents  of  the  ovector
        are unchanged.
 
 
@@ -2895,69 +2912,69 @@
 
        PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *match_data);
 
-       As well as the offsets in the ovector, other information about a  match
-       is  retained  in the match data block and can be retrieved by the above
-       functions in appropriate circumstances. If they  are  called  at  other
+       As  well as the offsets in the ovector, other information about a match
+       is retained in the match data block and can be retrieved by  the  above
+       functions  in  appropriate  circumstances.  If they are called at other
        times, the result is undefined.
 
-       After  a  successful match, a partial match (PCRE2_ERROR_PARTIAL), or a
-       failure to match (PCRE2_ERROR_NOMATCH), a mark name may  be  available.
-       The  function pcre2_get_mark() can be called to access this name, which
-       can be specified in the pattern by  any  of  the  backtracking  control
+       After a successful match, a partial match (PCRE2_ERROR_PARTIAL),  or  a
+       failure  to  match (PCRE2_ERROR_NOMATCH), a mark name may be available.
+       The function pcre2_get_mark() can be called to access this name,  which
+       can  be  specified  in  the  pattern by any of the backtracking control
        verbs, not just (*MARK). The same function applies to all the verbs. It
        returns a pointer to the zero-terminated name, which is within the com-
        piled pattern. If no name is available, NULL is returned. The length of
-       the name (excluding the terminating zero) is stored in  the  code  unit
-       that  precedes  the name. You should use this length instead of relying
+       the  name  (excluding  the terminating zero) is stored in the code unit
+       that precedes the name. You should use this length instead  of  relying
        on the terminating zero if the name might contain a binary zero.
 
-       After a successful match, the name that is returned is  the  last  mark
+       After  a  successful  match, the name that is returned is the last mark
        name encountered on the matching path through the pattern. Instances of
-       backtracking verbs without names do not count. Thus,  for  example,  if
+       backtracking  verbs  without  names do not count. Thus, for example, if
        the matching path contains (*MARK:A)(*PRUNE), the name "A" is returned.
        After a "no match" or a partial match, the last encountered name is re-
        turned. For example, consider this pattern:
 
          ^(*MARK:A)((*MARK:B)a|b)c
 
-       When  it  matches "bc", the returned name is A. The B mark is "seen" in
-       the first branch of the group, but it is not on the matching  path.  On
-       the  other  hand,  when  this pattern fails to match "bx", the returned
+       When it matches "bc", the returned name is A. The B mark is  "seen"  in
+       the  first  branch of the group, but it is not on the matching path. On
+       the other hand, when this pattern fails to  match  "bx",  the  returned
        name is B.
 
-       Warning: By default, certain start-of-match optimizations are  used  to
-       give  a  fast "no match" result in some situations. For example, if the
-       anchoring is removed from the pattern above, there is an initial  check
-       for  the presence of "c" in the subject before running the matching en-
+       Warning:  By  default, certain start-of-match optimizations are used to
+       give a fast "no match" result in some situations. For example,  if  the
+       anchoring  is removed from the pattern above, there is an initial check
+       for the presence of "c" in the subject before running the matching  en-
        gine. This check fails for "bx", causing a match failure without seeing
-       any  marks. You can disable the start-of-match optimizations by setting
-       the PCRE2_NO_START_OPTIMIZE option for pcre2_compile() or  by  starting
+       any marks. You can disable the start-of-match optimizations by  setting
+       the  PCRE2_NO_START_OPTIMIZE  option for pcre2_compile() or by starting
        the pattern with (*NO_START_OPT).
 
-       After  a  successful  match, a partial match, or one of the invalid UTF
-       errors (for example, PCRE2_ERROR_UTF8_ERR5), pcre2_get_startchar()  can
+       After a successful match, a partial match, or one of  the  invalid  UTF
+       errors  (for example, PCRE2_ERROR_UTF8_ERR5), pcre2_get_startchar() can
        be called. After a successful or partial match it returns the code unit
-       offset of the character at which the match started. For  a  non-partial
-       match,  this can be different to the value of ovector[0] if the pattern
-       contains the \K escape sequence. After a partial match,  however,  this
-       value  is  always the same as ovector[0] because \K does not affect the
+       offset  of  the character at which the match started. For a non-partial
+       match, this can be different to the value of ovector[0] if the  pattern
+       contains  the  \K escape sequence. After a partial match, however, this
+       value is always the same as ovector[0] because \K does not  affect  the
        result of a partial match.
 
-       After a UTF check failure, pcre2_get_startchar() can be used to  obtain
+       After  a UTF check failure, pcre2_get_startchar() can be used to obtain
        the code unit offset of the invalid UTF character. Details are given in
        the pcre2unicode page.
 
 
 ERROR RETURNS FROM pcre2_match()
 
-       If pcre2_match() fails, it returns a negative number. This can be  con-
-       verted  to a text string by calling the pcre2_get_error_message() func-
-       tion (see "Obtaining a textual error message" below).   Negative  error
-       codes  are  also  returned  by other functions, and are documented with
-       them. The codes are given names in the header file. If UTF checking  is
+       If  pcre2_match() fails, it returns a negative number. This can be con-
+       verted to a text string by calling the pcre2_get_error_message()  func-
+       tion  (see  "Obtaining a textual error message" below).  Negative error
+       codes are also returned by other functions,  and  are  documented  with
+       them.  The codes are given names in the header file. If UTF checking is
        in force and an invalid UTF subject string is detected, one of a number
-       of UTF-specific negative error codes is returned. Details are given  in
-       the  pcre2unicode  page. The following are the other errors that may be
+       of  UTF-specific negative error codes is returned. Details are given in
+       the pcre2unicode page. The following are the other errors that  may  be
        returned by pcre2_match():
 
          PCRE2_ERROR_NOMATCH
@@ -2966,20 +2983,20 @@
 
          PCRE2_ERROR_PARTIAL
 
-       The subject string did not match, but it did match partially.  See  the
+       The  subject  string did not match, but it did match partially. See the
        pcre2partial documentation for details of partial matching.
 
          PCRE2_ERROR_BADMAGIC
 
        PCRE2 stores a 4-byte "magic number" at the start of the compiled code,
-       to catch the case when it is passed a junk pointer. This is  the  error
+       to  catch  the case when it is passed a junk pointer. This is the error
        that is returned when the magic number is not present.
 
          PCRE2_ERROR_BADMODE
 
-       This  error is given when a compiled pattern is passed to a function in
-       a library of a different code unit width, for example, a  pattern  com-
-       piled  by  the  8-bit  library  is passed to a 16-bit or 32-bit library
+       This error is given when a compiled pattern is passed to a function  in
+       a  library  of a different code unit width, for example, a pattern com-
+       piled by the 8-bit library is passed to  a  16-bit  or  32-bit  library
        function.
 
          PCRE2_ERROR_BADOFFSET
@@ -2993,15 +3010,15 @@
          PCRE2_ERROR_BADUTFOFFSET
 
        The UTF code unit sequence that was passed as a subject was checked and
-       found  to be valid (the PCRE2_NO_UTF_CHECK option was not set), but the
-       value of startoffset did not point to the beginning of a UTF  character
+       found to be valid (the PCRE2_NO_UTF_CHECK option was not set), but  the
+       value  of startoffset did not point to the beginning of a UTF character
        or the end of the subject.
 
          PCRE2_ERROR_CALLOUT
 
-       This  error  is never generated by pcre2_match() itself. It is provided
-       for use by callout  functions  that  want  to  cause  pcre2_match()  or
-       pcre2_callout_enumerate()  to  return a distinctive error code. See the
+       This error is never generated by pcre2_match() itself. It  is  provided
+       for  use  by  callout  functions  that  want  to cause pcre2_match() or
+       pcre2_callout_enumerate() to return a distinctive error code.  See  the
        pcre2callout documentation for details.
 
          PCRE2_ERROR_DEPTHLIMIT
@@ -3014,14 +3031,14 @@
 
          PCRE2_ERROR_INTERNAL
 
-       An unexpected internal error has occurred. This error could  be  caused
+       An  unexpected  internal error has occurred. This error could be caused
        by a bug in PCRE2 or by overwriting of the compiled pattern.
 
          PCRE2_ERROR_JIT_STACKLIMIT
 
        This error is returned when a pattern that was successfully studied us-
        ing JIT is being matched, but the memory available for the just-in-time
-       processing  stack  is  not large enough. See the pcre2jit documentation
+       processing stack is not large enough. See  the  pcre2jit  documentation
        for more details.
 
          PCRE2_ERROR_MATCHLIMIT
@@ -3030,11 +3047,11 @@
 
          PCRE2_ERROR_NOMEMORY
 
-       If a pattern contains many nested backtracking points, heap  memory  is
-       used  to  remember them. This error is given when the memory allocation
-       function (default or  custom)  fails.  Note  that  a  different  error,
-       PCRE2_ERROR_HEAPLIMIT,  is given if the amount of memory needed exceeds
-       the   heap   limit.   PCRE2_ERROR_NOMEMORY   is   also   returned    if
+       If  a  pattern contains many nested backtracking points, heap memory is
+       used to remember them. This error is given when the  memory  allocation
+       function  (default  or  custom)  fails.  Note  that  a different error,
+       PCRE2_ERROR_HEAPLIMIT, is given if the amount of memory needed  exceeds
+       the    heap   limit.   PCRE2_ERROR_NOMEMORY   is   also   returned   if
        PCRE2_COPY_MATCHED_SUBJECT is set and memory allocation fails.
 
          PCRE2_ERROR_NULL
@@ -3043,12 +3060,12 @@
 
          PCRE2_ERROR_RECURSELOOP
 
-       This  error  is  returned  when  pcre2_match() detects a recursion loop
-       within the pattern. Specifically, it means that either the  whole  pat-
+       This error is returned when  pcre2_match()  detects  a  recursion  loop
+       within  the  pattern. Specifically, it means that either the whole pat-
        tern or a capture group has been called recursively for the second time
-       at the same position in the subject string. Some simple  patterns  that
-       might  do  this are detected and faulted at compile time, but more com-
-       plicated cases, in particular mutual recursions between  two  different
+       at  the  same position in the subject string. Some simple patterns that
+       might do this are detected and faulted at compile time, but  more  com-
+       plicated  cases,  in particular mutual recursions between two different
        groups, cannot be detected until matching is attempted.
 
 
@@ -3057,20 +3074,20 @@
        int pcre2_get_error_message(int errorcode, PCRE2_UCHAR *buffer,
          PCRE2_SIZE bufflen);
 
-       A  text  message  for  an  error code from any PCRE2 function (compile,
-       match, or auxiliary) can be obtained  by  calling  pcre2_get_error_mes-
-       sage().  The  code  is passed as the first argument, with the remaining
-       two arguments specifying a code unit buffer  and  its  length  in  code
-       units,  into  which the text message is placed. The message is returned
-       in code units of the appropriate width for the library  that  is  being
+       A text message for an error code  from  any  PCRE2  function  (compile,
+       match,  or  auxiliary)  can be obtained by calling pcre2_get_error_mes-
+       sage(). The code is passed as the first argument,  with  the  remaining
+       two  arguments  specifying  a  code  unit buffer and its length in code
+       units, into which the text message is placed. The message  is  returned
+       in  code  units  of the appropriate width for the library that is being
        used.
 
-       The  returned message is terminated with a trailing zero, and the func-
-       tion returns the number of code  units  used,  excluding  the  trailing
+       The returned message is terminated with a trailing zero, and the  func-
+       tion  returns  the  number  of  code units used, excluding the trailing
        zero. If the error number is unknown, the negative error code PCRE2_ER-
-       ROR_BADDATA is returned. If the buffer is too  small,  the  message  is
+       ROR_BADDATA  is  returned.  If  the buffer is too small, the message is
        truncated (but still with a trailing zero), and the negative error code
-       PCRE2_ERROR_NOMEMORY is returned.  None of the messages are very  long;
+       PCRE2_ERROR_NOMEMORY  is returned.  None of the messages are very long;
        a buffer size of 120 code units is ample.
 
 
@@ -3089,39 +3106,39 @@
 
        void pcre2_substring_free(PCRE2_UCHAR *buffer);
 
-       Captured  substrings  can  be accessed directly by using the ovector as
+       Captured substrings can be accessed directly by using  the  ovector  as
        described above.  For convenience, auxiliary functions are provided for
-       extracting   captured  substrings  as  new,  separate,  zero-terminated
+       extracting  captured  substrings  as  new,  separate,   zero-terminated
        strings. A substring that contains a binary zero is correctly extracted
-       and  has  a  further  zero  added on the end, but the result is not, of
+       and has a further zero added on the end, but  the  result  is  not,  of
        course, a C string.
 
        The functions in this section identify substrings by number. The number
        zero refers to the entire matched substring, with higher numbers refer-
-       ring to substrings captured by parenthesized groups.  After  a  partial
-       match,  only  substring  zero  is  available. An attempt to extract any
-       other substring gives the error PCRE2_ERROR_PARTIAL. The  next  section
+       ring  to  substrings  captured by parenthesized groups. After a partial
+       match, only substring zero is available.  An  attempt  to  extract  any
+       other  substring  gives the error PCRE2_ERROR_PARTIAL. The next section
        describes similar functions for extracting captured substrings by name.
 
-       If  a  pattern uses the \K escape sequence within a positive assertion,
+       If a pattern uses the \K escape sequence within a  positive  assertion,
        the reported start of a successful match can be greater than the end of
-       the  match.   For  example,  if the pattern (?=ab\K) is matched against
-       "ab", the start and end offset values for the match are  2  and  0.  In
-       this  situation,  calling  these functions with a zero substring number
+       the match.  For example, if the pattern  (?=ab\K)  is  matched  against
+       "ab",  the  start  and  end offset values for the match are 2 and 0. In
+       this situation, calling these functions with a  zero  substring  number
        extracts a zero-length empty string.
 
-       You can find the length in code units of a captured  substring  without
-       extracting  it  by calling pcre2_substring_length_bynumber(). The first
-       argument is a pointer to the match data block, the second is the  group
-       number,  and the third is a pointer to a variable into which the length
-       is placed. If you just want to know whether or not  the  substring  has
+       You  can  find the length in code units of a captured substring without
+       extracting it by calling pcre2_substring_length_bynumber().  The  first
+       argument  is a pointer to the match data block, the second is the group
+       number, and the third is a pointer to a variable into which the  length
+       is  placed.  If  you just want to know whether or not the substring has
        been captured, you can pass the third argument as NULL.
 
-       The  pcre2_substring_copy_bynumber()  function  copies  a captured sub-
-       string into a supplied buffer,  whereas  pcre2_substring_get_bynumber()
-       copies  it  into  new memory, obtained using the same memory allocation
-       function that was used for the match data block. The  first  two  argu-
-       ments  of  these  functions are a pointer to the match data block and a
+       The pcre2_substring_copy_bynumber() function  copies  a  captured  sub-
+       string  into  a supplied buffer, whereas pcre2_substring_get_bynumber()
+       copies it into new memory, obtained using the  same  memory  allocation
+       function  that  was  used for the match data block. The first two argu-
+       ments of these functions are a pointer to the match data  block  and  a
        capture group number.
 
        The final arguments of pcre2_substring_copy_bynumber() are a pointer to
@@ -3130,25 +3147,25 @@
        for the extracted substring, excluding the terminating zero.
 
        For pcre2_substring_get_bynumber() the third and fourth arguments point
-       to variables that are updated with a pointer to the new memory and  the
-       number  of  code units that comprise the substring, again excluding the
-       terminating zero. When the substring is no longer  needed,  the  memory
+       to  variables that are updated with a pointer to the new memory and the
+       number of code units that comprise the substring, again  excluding  the
+       terminating  zero.  When  the substring is no longer needed, the memory
        should be freed by calling pcre2_substring_free().
 
-       The  return  value  from  all these functions is zero for success, or a
-       negative error code. If the pattern match  failed,  the  match  failure
-       code  is returned.  If a substring number greater than zero is used af-
-       ter a partial match, PCRE2_ERROR_PARTIAL is  returned.  Other  possible
+       The return value from all these functions is zero  for  success,  or  a
+       negative  error  code.  If  the pattern match failed, the match failure
+       code is returned.  If a substring number greater than zero is used  af-
+       ter  a  partial  match, PCRE2_ERROR_PARTIAL is returned. Other possible
        error codes are:
 
          PCRE2_ERROR_NOMEMORY
 
-       The  buffer  was  too small for pcre2_substring_copy_bynumber(), or the
+       The buffer was too small for  pcre2_substring_copy_bynumber(),  or  the
        attempt to get memory failed for pcre2_substring_get_bynumber().
 
          PCRE2_ERROR_NOSUBSTRING
 
-       There is no substring with that number in the  pattern,  that  is,  the
+       There  is  no  substring  with that number in the pattern, that is, the
        number is greater than the number of capturing parentheses.
 
          PCRE2_ERROR_UNAVAILABLE
@@ -3159,8 +3176,8 @@
 
          PCRE2_ERROR_UNSET
 
-       The  substring  did  not  participate in the match. For example, if the
-       pattern is (abc)|(def) and the subject is "def", and the  ovector  con-
+       The substring did not participate in the match.  For  example,  if  the
+       pattern  is  (abc)|(def) and the subject is "def", and the ovector con-
        tains at least two capturing slots, substring number 1 is unset.
 
 
@@ -3171,31 +3188,31 @@
 
        void pcre2_substring_list_free(PCRE2_SPTR *list);
 
-       The  pcre2_substring_list_get()  function  extracts  all available sub-
-       strings and builds a list of pointers to  them.  It  also  (optionally)
-       builds  a  second list that contains their lengths (in code units), ex-
-       cluding a terminating zero that is added to each of them. All  this  is
+       The pcre2_substring_list_get() function  extracts  all  available  sub-
+       strings  and  builds  a  list of pointers to them. It also (optionally)
+       builds a second list that contains their lengths (in code  units),  ex-
+       cluding  a  terminating zero that is added to each of them. All this is
        done in a single block of memory that is obtained using the same memory
        allocation function that was used to get the match data block.
 
-       This function must be called only after a successful match.  If  called
+       This  function  must be called only after a successful match. If called
        after a partial match, the error code PCRE2_ERROR_PARTIAL is returned.
 
-       The  address of the memory block is returned via listptr, which is also
+       The address of the memory block is returned via listptr, which is  also
        the start of the list of string pointers. The end of the list is marked
-       by  a  NULL pointer. The address of the list of lengths is returned via
-       lengthsptr. If your strings do not contain binary zeros and you do  not
+       by a NULL pointer. The address of the list of lengths is  returned  via
+       lengthsptr.  If your strings do not contain binary zeros and you do not
        therefore need the lengths, you may supply NULL as the lengthsptr argu-
-       ment to disable the creation of a list of lengths.  The  yield  of  the
-       function  is zero if all went well, or PCRE2_ERROR_NOMEMORY if the mem-
-       ory block could not be obtained. When the list is no longer needed,  it
+       ment  to  disable  the  creation of a list of lengths. The yield of the
+       function is zero if all went well, or PCRE2_ERROR_NOMEMORY if the  mem-
+       ory  block could not be obtained. When the list is no longer needed, it
        should be freed by calling pcre2_substring_list_free().
 
        If this function encounters a substring that is unset, which can happen
-       when capture group number n+1 matches some part  of  the  subject,  but
-       group  n has not been used at all, it returns an empty string. This can
+       when  capture  group  number  n+1 matches some part of the subject, but
+       group n has not been used at all, it returns an empty string. This  can
        be distinguished from a genuine zero-length substring by inspecting the
-       appropriate  offset in the ovector, which contain PCRE2_UNSET for unset
+       appropriate offset in the ovector, which contain PCRE2_UNSET for  unset
        substrings, or by calling pcre2_substring_length_bynumber().
 
 
@@ -3215,7 +3232,7 @@
 
        void pcre2_substring_free(PCRE2_UCHAR *buffer);
 
-       To extract a substring by name, you first have to find associated  num-
+       To  extract a substring by name, you first have to find associated num-
        ber.  For example, for this pattern:
 
          (a+)b(?<xxx>\d+)...
@@ -3223,32 +3240,32 @@
        the number of the capture group called "xxx" is 2. If the name is known
        to be unique (PCRE2_DUPNAMES was not set), you can find the number from
        the name by calling pcre2_substring_number_from_name(). The first argu-
-       ment is the compiled pattern, and the second is the name. The yield  of
-       the  function  is the group number, PCRE2_ERROR_NOSUBSTRING if there is
-       no group with that name, or PCRE2_ERROR_NOUNIQUESUBSTRING if  there  is
-       more  than one group with that name.  Given the number, you can extract
-       the substring directly from the ovector, or use one of  the  "bynumber"
+       ment  is the compiled pattern, and the second is the name. The yield of
+       the function is the group number, PCRE2_ERROR_NOSUBSTRING if  there  is
+       no  group  with that name, or PCRE2_ERROR_NOUNIQUESUBSTRING if there is
+       more than one group with that name.  Given the number, you can  extract
+       the  substring  directly from the ovector, or use one of the "bynumber"
        functions described above.
 
-       For  convenience,  there are also "byname" functions that correspond to
+       For convenience, there are also "byname" functions that  correspond  to
        the "bynumber" functions, the only difference being that the second ar-
-       gument  is  a  name  instead  of a number. If PCRE2_DUPNAMES is set and
+       gument is a name instead of a number.  If  PCRE2_DUPNAMES  is  set  and
        there are duplicate names, these functions scan all the groups with the
-       given  name,  and  return  the  captured substring from the first named
+       given name, and return the captured  substring  from  the  first  named
        group that is set.
 
-       If there are no groups with the given name, PCRE2_ERROR_NOSUBSTRING  is
-       returned.  If  all  groups  with the name have numbers that are greater
+       If  there are no groups with the given name, PCRE2_ERROR_NOSUBSTRING is
+       returned. If all groups with the name have  numbers  that  are  greater
        than the number of slots in the ovector, PCRE2_ERROR_UNAVAILABLE is re-
-       turned.  If there is at least one group with a slot in the ovector, but
+       turned. If there is at least one group with a slot in the ovector,  but
        no group is found to be set, PCRE2_ERROR_UNSET is returned.
 
        Warning: If the pattern uses the (?| feature to set up multiple capture
-       groups  with  the same number, as described in the section on duplicate
+       groups with the same number, as described in the section  on  duplicate
        group numbers in the pcre2pattern page, you cannot use names to distin-
-       guish  the  different capture groups, because names are not included in
-       the compiled code. The matching process uses  only  numbers.  For  this
-       reason,  the  use  of  different  names for groups with the same number
+       guish the different capture groups, because names are not  included  in
+       the  compiled  code.  The  matching process uses only numbers. For this
+       reason, the use of different names for  groups  with  the  same  number
        causes an error at compile time.
 
 
@@ -3261,126 +3278,126 @@
          PCRE2_SIZE rlength, PCRE2_UCHAR *outputbuffer,
          PCRE2_SIZE *outlengthptr);
 
-       This function optionally calls pcre2_match() and then makes a  copy  of
-       the  subject  string in outputbuffer, replacing parts that were matched
-       with the replacement string, whose length is supplied in rlength.  This
-       can  be  given  as  PCRE2_ZERO_TERMINATED for a zero-terminated string.
+       This  function  optionally calls pcre2_match() and then makes a copy of
+       the subject string in outputbuffer, replacing parts that  were  matched
+       with  the replacement string, whose length is supplied in rlength. This
+       can be given as PCRE2_ZERO_TERMINATED  for  a  zero-terminated  string.
        There is an option (see PCRE2_SUBSTITUTE_REPLACEMENT_ONLY below) to re-
-       turn  just  the replacement string(s). The default action is to perform
-       just one replacement if the pattern matches, but  there  is  an  option
-       that  requests  multiple  replacements (see PCRE2_SUBSTITUTE_GLOBAL be-
+       turn just the replacement string(s). The default action is  to  perform
+       just  one  replacement  if  the pattern matches, but there is an option
+       that requests multiple replacements  (see  PCRE2_SUBSTITUTE_GLOBAL  be-
        low).
 
-       If successful, pcre2_substitute() returns the number  of  substitutions
-       that  were  carried out. This may be zero if no match was found, and is
-       never greater than one unless PCRE2_SUBSTITUTE_GLOBAL is set.  A  nega-
+       If  successful,  pcre2_substitute() returns the number of substitutions
+       that were carried out. This may be zero if no match was found,  and  is
+       never  greater  than one unless PCRE2_SUBSTITUTE_GLOBAL is set. A nega-
        tive value is returned if an error is detected.
 
-       Matches  in  which  a  \K item in a lookahead in the pattern causes the
-       match to end before it starts are not supported, and give  rise  to  an
+       Matches in which a \K item in a lookahead in  the  pattern  causes  the
+       match  to  end  before it starts are not supported, and give rise to an
        error return. For global replacements, matches in which \K in a lookbe-
-       hind causes the match to start earlier than the point that was  reached
+       hind  causes the match to start earlier than the point that was reached
        in the previous iteration are also not supported.
 
-       The  first  seven  arguments  of pcre2_substitute() are the same as for
+       The first seven arguments of pcre2_substitute() are  the  same  as  for
        pcre2_match(), except that the partial matching options are not permit-
-       ted,  and  match_data may be passed as NULL, in which case a match data
-       block is obtained and freed within this function, using memory  manage-
-       ment  functions from the match context, if provided, or else those that
+       ted, and match_data may be passed as NULL, in which case a  match  data
+       block  is obtained and freed within this function, using memory manage-
+       ment functions from the match context, if provided, or else those  that
        were used to allocate memory for the compiled code.
 
-       If match_data is not NULL and PCRE2_SUBSTITUTE_MATCHED is not set,  the
+       If  match_data is not NULL and PCRE2_SUBSTITUTE_MATCHED is not set, the
        provided block is used for all calls to pcre2_match(), and its contents
-       afterwards are the result of the final call. For global  changes,  this
+       afterwards  are  the result of the final call. For global changes, this
        will always be a no-match error. The contents of the ovector within the
        match data block may or may not have been changed.
 
-       As well as the usual options for pcre2_match(), a number of  additional
-       options  can be set in the options argument of pcre2_substitute().  One
-       such option is PCRE2_SUBSTITUTE_MATCHED. When this is set, an  external
-       match_data  block  must  be provided, and it must have been used for an
-       external call to pcre2_match(). The data in the match_data  block  (re-
+       As  well as the usual options for pcre2_match(), a number of additional
+       options can be set in the options argument of pcre2_substitute().   One
+       such  option is PCRE2_SUBSTITUTE_MATCHED. When this is set, an external
+       match_data block must be provided, and it must have been  used  for  an
+       external  call  to pcre2_match(). The data in the match_data block (re-
        turn code, offset vector) is used for the first substitution instead of
-       calling pcre2_match() from within pcre2_substitute().  This  allows  an
+       calling  pcre2_match()  from  within pcre2_substitute(). This allows an
        application to check for a match before choosing to substitute, without
        having to repeat the match.
 
-       The contents of the  externally  supplied  match  data  block  are  not
-       changed   when   PCRE2_SUBSTITUTE_MATCHED   is  set.  If  PCRE2_SUBSTI-
-       TUTE_GLOBAL is also set, pcre2_match() is called after the  first  sub-
-       stitution  to  check for further matches, but this is done using an in-
-       ternally obtained match data block, thus always  leaving  the  external
+       The  contents  of  the  externally  supplied  match  data block are not
+       changed  when  PCRE2_SUBSTITUTE_MATCHED  is   set.   If   PCRE2_SUBSTI-
+       TUTE_GLOBAL  is  also set, pcre2_match() is called after the first sub-
+       stitution to check for further matches, but this is done using  an  in-
+       ternally  obtained  match  data block, thus always leaving the external
        block unchanged.
 
-       The  code  argument is not used for matching before the first substitu-
-       tion when PCRE2_SUBSTITUTE_MATCHED is set, but  it  must  be  provided,
-       even  when  PCRE2_SUBSTITUTE_GLOBAL is not set, because it contains in-
+       The code argument is not used for matching before the  first  substitu-
+       tion  when  PCRE2_SUBSTITUTE_MATCHED  is  set, but it must be provided,
+       even when PCRE2_SUBSTITUTE_GLOBAL is not set, because it  contains  in-
        formation such as the UTF setting and the number of capturing parenthe-
        ses in the pattern.
 
-       The  default  action  of  pcre2_substitute() is to return a copy of the
+       The default action of pcre2_substitute() is to return  a  copy  of  the
        subject string with matched substrings replaced. However, if PCRE2_SUB-
-       STITUTE_REPLACEMENT_ONLY  is  set,  only the replacement substrings are
+       STITUTE_REPLACEMENT_ONLY is set, only the  replacement  substrings  are
        returned. In the global case, multiple replacements are concatenated in
-       the  output  buffer.  Substitution  callouts (see below) can be used to
+       the output buffer. Substitution callouts (see below)  can  be  used  to
        separate them if necessary.
 
-       The outlengthptr argument of pcre2_substitute() must point to  a  vari-
-       able  that contains the length, in code units, of the output buffer. If
-       the function is successful, the value is updated to contain the  length
-       in  code  units  of the new string, excluding the trailing zero that is
+       The  outlengthptr  argument of pcre2_substitute() must point to a vari-
+       able that contains the length, in code units, of the output buffer.  If
+       the  function is successful, the value is updated to contain the length
+       in code units of the new string, excluding the trailing  zero  that  is
        automatically added.
 
-       If the function is not successful, the value set via  outlengthptr  de-
-       pends  on  the  type  of  error.  For  syntax errors in the replacement
+       If  the  function is not successful, the value set via outlengthptr de-
+       pends on the type of  error.  For  syntax  errors  in  the  replacement
        string, the value is the offset in the replacement string where the er-
-       ror  was  detected.  For  other errors, the value is PCRE2_UNSET by de-
+       ror was detected. For other errors, the value  is  PCRE2_UNSET  by  de-
        fault. This includes the case of the output buffer being too small, un-
        less PCRE2_SUBSTITUTE_OVERFLOW_LENGTH is set.
 
-       PCRE2_SUBSTITUTE_OVERFLOW_LENGTH  changes  what happens when the output
+       PCRE2_SUBSTITUTE_OVERFLOW_LENGTH changes what happens when  the  output
        buffer is too small. The default action is to return PCRE2_ERROR_NOMEM-
-       ORY  immediately.  If  this  option is set, however, pcre2_substitute()
+       ORY immediately. If this option  is  set,  however,  pcre2_substitute()
        continues to go through the motions of matching and substituting (with-
-       out,  of course, writing anything) in order to compute the size of buf-
-       fer that is needed. This value is  passed  back  via  the  outlengthptr
-       variable,  with  the  result  of  the  function  still  being PCRE2_ER-
+       out, of course, writing anything) in order to compute the size of  buf-
+       fer  that  is  needed.  This  value is passed back via the outlengthptr
+       variable, with  the  result  of  the  function  still  being  PCRE2_ER-
        ROR_NOMEMORY.
 
-       Passing a buffer size of zero is a permitted way  of  finding  out  how
-       much  memory  is needed for given substitution. However, this does mean
+       Passing  a  buffer  size  of zero is a permitted way of finding out how
+       much memory is needed for given substitution. However, this  does  mean
        that the entire operation is carried out twice. Depending on the appli-
-       cation,  it  may  be more efficient to allocate a large buffer and free
-       the  excess  afterwards,  instead   of   using   PCRE2_SUBSTITUTE_OVER-
+       cation, it may be more efficient to allocate a large  buffer  and  free
+       the   excess   afterwards,   instead  of  using  PCRE2_SUBSTITUTE_OVER-
        FLOW_LENGTH.
 
-       The  replacement  string,  which  is interpreted as a UTF string in UTF
-       mode, is checked for UTF validity unless PCRE2_NO_UTF_CHECK is set.  An
+       The replacement string, which is interpreted as a  UTF  string  in  UTF
+       mode,  is checked for UTF validity unless PCRE2_NO_UTF_CHECK is set. An
        invalid UTF replacement string causes an immediate return with the rel-
        evant UTF error code.
 
-       If PCRE2_SUBSTITUTE_LITERAL is set, the replacement string is  not  in-
+       If  PCRE2_SUBSTITUTE_LITERAL  is set, the replacement string is not in-
        terpreted in any way. By default, however, a dollar character is an es-
-       cape character that can specify the insertion of characters  from  cap-
-       ture  groups  and names from (*MARK) or other control verbs in the pat-
+       cape  character  that can specify the insertion of characters from cap-
+       ture groups and names from (*MARK) or other control verbs in  the  pat-
        tern. The following forms are always recognized:
 
          $$                  insert a dollar character
          $<n> or ${<n>}      insert the contents of group <n>
          $*MARK or ${*MARK}  insert a control verb name
 
-       Either a group number or a group name  can  be  given  for  <n>.  Curly
-       brackets  are  required only if the following character would be inter-
+       Either  a  group  number  or  a  group name can be given for <n>. Curly
+       brackets are required only if the following character would  be  inter-
        preted as part of the number or name. The number may be zero to include
-       the  entire  matched  string.   For  example,  if  the pattern a(b)c is
-       matched with "=abc=" and the replacement string "+$1$0$1+", the  result
+       the entire matched string.   For  example,  if  the  pattern  a(b)c  is
+       matched  with "=abc=" and the replacement string "+$1$0$1+", the result
        is "=+babcb+=".
 
-       $*MARK  inserts the name from the last encountered backtracking control
-       verb on the matching path that has a name. (*MARK) must always  include
-       a  name,  but  the  other  verbs  need not. For example, in the case of
+       $*MARK inserts the name from the last encountered backtracking  control
+       verb  on the matching path that has a name. (*MARK) must always include
+       a name, but the other verbs need not.  For  example,  in  the  case  of
        (*MARK:A)(*PRUNE) the name inserted is "A", but for (*MARK:A)(*PRUNE:B)
-       the  relevant  name is "B". This facility can be used to perform simple
+       the relevant name is "B". This facility can be used to  perform  simple
        simultaneous substitutions, as this pcre2test example shows:
 
          /(*MARK:pear)apple|(*MARK:orange)lemon/g,replace=${*MARK}
@@ -3388,15 +3405,15 @@
           2: pear orange
 
        PCRE2_SUBSTITUTE_GLOBAL causes the function to iterate over the subject
-       string,  replacing every matching substring. If this option is not set,
-       only the first matching substring is replaced. The search  for  matches
-       takes  place in the original subject string (that is, previous replace-
-       ments do not affect it).  Iteration is  implemented  by  advancing  the
-       startoffset  value  for  each search, which is always passed the entire
+       string, replacing every matching substring. If this option is not  set,
+       only  the  first matching substring is replaced. The search for matches
+       takes place in the original subject string (that is, previous  replace-
+       ments  do  not  affect  it).  Iteration is implemented by advancing the
+       startoffset value for each search, which is always  passed  the  entire
        subject string. If an offset limit is set in the match context, search-
        ing stops when that limit is reached.
 
-       You  can  restrict  the effect of a global substitution to a portion of
+       You can restrict the effect of a global substitution to  a  portion  of
        the subject string by setting either or both of startoffset and an off-
        set limit. Here is a pcre2test example:
 
@@ -3404,73 +3421,73 @@
          ABC ABC ABC ABC\=offset=3,offset_limit=12
           2: ABC A!C A!C ABC
 
-       When  continuing  with  global substitutions after matching a substring
+       When continuing with global substitutions after  matching  a  substring
        with zero length, an attempt to find a non-empty match at the same off-
        set is performed.  If this is not successful, the offset is advanced by
        one character except when CRLF is a valid newline sequence and the next
-       two  characters are CR, LF. In this case, the offset is advanced by two
+       two characters are CR, LF. In this case, the offset is advanced by  two
        characters.
 
        PCRE2_SUBSTITUTE_UNKNOWN_UNSET causes references to capture groups that
        do not appear in the pattern to be treated as unset groups. This option
-       should be used with care, because it means that a typo in a group  name
+       should  be used with care, because it means that a typo in a group name
        or number no longer causes the PCRE2_ERROR_NOSUBSTRING error.
 
        PCRE2_SUBSTITUTE_UNSET_EMPTY causes unset capture groups (including un-
-       known groups when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set) to be  treated
-       as  empty  strings  when inserted as described above. If this option is
+       known  groups when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set) to be treated
+       as empty strings when inserted as described above. If  this  option  is
        not set, an attempt to insert an unset group causes the PCRE2_ERROR_UN-
-       SET  error.  This  option  does not influence the extended substitution
+       SET error. This option does not  influence  the  extended  substitution
        syntax described below.
 
-       PCRE2_SUBSTITUTE_EXTENDED causes extra processing to be applied to  the
-       replacement  string.  Without this option, only the dollar character is
-       special, and only the group insertion forms  listed  above  are  valid.
+       PCRE2_SUBSTITUTE_EXTENDED  causes extra processing to be applied to the
+       replacement string. Without this option, only the dollar  character  is
+       special,  and  only  the  group insertion forms listed above are valid.
        When PCRE2_SUBSTITUTE_EXTENDED is set, two things change:
 
-       Firstly,  backslash in a replacement string is interpreted as an escape
+       Firstly, backslash in a replacement string is interpreted as an  escape
        character. The usual forms such as \n or \x{ddd} can be used to specify
-       particular  character codes, and backslash followed by any non-alphanu-
-       meric character quotes that character. Extended quoting  can  be  coded
+       particular character codes, and backslash followed by any  non-alphanu-
+       meric  character  quotes  that character. Extended quoting can be coded
        using \Q...\E, exactly as in pattern strings.
 
-       There  are  also four escape sequences for forcing the case of inserted
-       letters.  The insertion mechanism has three states:  no  case  forcing,
+       There are also four escape sequences for forcing the case  of  inserted
+       letters.   The  insertion  mechanism has three states: no case forcing,
        force upper case, and force lower case. The escape sequences change the
        current state: \U and \L change to upper or lower case forcing, respec-
-       tively,  and  \E (when not terminating a \Q quoted sequence) reverts to
-       no case forcing. The sequences \u and \l force the next  character  (if
-       it  is  a  letter)  to  upper or lower case, respectively, and then the
+       tively, and \E (when not terminating a \Q quoted sequence)  reverts  to
+       no  case  forcing. The sequences \u and \l force the next character (if
+       it is a letter) to upper or lower  case,  respectively,  and  then  the
        state automatically reverts to no case forcing. Case forcing applies to
-       all  inserted  characters, including those from capture groups and let-
-       ters within \Q...\E quoted sequences. If either PCRE2_UTF or  PCRE2_UCP
-       was  set when the pattern was compiled, Unicode properties are used for
+       all inserted  characters, including those from capture groups and  let-
+       ters  within \Q...\E quoted sequences. If either PCRE2_UTF or PCRE2_UCP
+       was set when the pattern was compiled, Unicode properties are used  for
        case forcing characters whose code points are greater than 127.
 
        Note that case forcing sequences such as \U...\E do not nest. For exam-
-       ple,  the  result of processing "\Uaa\LBB\Ecc\E" is "AAbbcc"; the final
-       \E has no effect. Note  also  that  the  PCRE2_ALT_BSUX  and  PCRE2_EX-
+       ple, the result of processing "\Uaa\LBB\Ecc\E" is "AAbbcc";  the  final
+       \E  has  no  effect.  Note  also  that the PCRE2_ALT_BSUX and PCRE2_EX-
        TRA_ALT_BSUX options do not apply to replacement strings.
 
-       The  second  effect of setting PCRE2_SUBSTITUTE_EXTENDED is to add more
-       flexibility to capture group substitution. The  syntax  is  similar  to
+       The second effect of setting PCRE2_SUBSTITUTE_EXTENDED is to  add  more
+       flexibility  to  capture  group  substitution. The syntax is similar to
        that used by Bash:
 
          ${<n>:-<string>}
          ${<n>:+<string1>:<string2>}
 
-       As  before,  <n> may be a group number or a name. The first form speci-
-       fies a default value. If group <n> is set, its value  is  inserted;  if
-       not,  <string>  is  expanded  and  the result inserted. The second form
-       specifies strings that are expanded and inserted when group <n> is  set
-       or  unset,  respectively. The first form is just a convenient shorthand
+       As before, <n> may be a group number or a name. The first  form  speci-
+       fies  a  default  value. If group <n> is set, its value is inserted; if
+       not, <string> is expanded and the  result  inserted.  The  second  form
+       specifies  strings that are expanded and inserted when group <n> is set
+       or unset, respectively. The first form is just a  convenient  shorthand
        for
 
          ${<n>:+${<n>}:<string>}
 
-       Backslash can be used to escape colons and closing  curly  brackets  in
-       the  replacement  strings.  A change of the case forcing state within a
-       replacement string remains  in  force  afterwards,  as  shown  in  this
+       Backslash  can  be  used to escape colons and closing curly brackets in
+       the replacement strings. A change of the case forcing  state  within  a
+       replacement  string  remains  in  force  afterwards,  as  shown in this
        pcre2test example:
 
          /(some)?(body)/substitute_extended,replace=${1:+\U:\L}HeLLo
@@ -3479,8 +3496,8 @@
              somebody
           1: HELLO
 
-       The  PCRE2_SUBSTITUTE_UNSET_EMPTY option does not affect these extended
-       substitutions. However, PCRE2_SUBSTITUTE_UNKNOWN_UNSET does  cause  un-
+       The PCRE2_SUBSTITUTE_UNSET_EMPTY option does not affect these  extended
+       substitutions.  However,  PCRE2_SUBSTITUTE_UNKNOWN_UNSET does cause un-
        known groups in the extended syntax forms to be treated as unset.
 
        If  PCRE2_SUBSTITUTE_LITERAL  is  set,  PCRE2_SUBSTITUTE_UNKNOWN_UNSET,
@@ -3489,37 +3506,37 @@
 
    Substitution errors
 
-       In  the  event of an error, pcre2_substitute() returns a negative error
-       code. Except for PCRE2_ERROR_NOMATCH (which is never returned),  errors
+       In the event of an error, pcre2_substitute() returns a  negative  error
+       code.  Except for PCRE2_ERROR_NOMATCH (which is never returned), errors
        from pcre2_match() are passed straight back.
 
        PCRE2_ERROR_NOSUBSTRING is returned for a non-existent substring inser-
        tion, unless PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set.
 
        PCRE2_ERROR_UNSET is returned for an unset substring insertion (includ-
-       ing  an  unknown  substring when PCRE2_SUBSTITUTE_UNKNOWN_UNSET is set)
-       when the simple (non-extended) syntax is used and  PCRE2_SUBSTITUTE_UN-
+       ing an unknown substring when  PCRE2_SUBSTITUTE_UNKNOWN_UNSET  is  set)
+       when  the simple (non-extended) syntax is used and PCRE2_SUBSTITUTE_UN-
        SET_EMPTY is not set.
 
-       PCRE2_ERROR_NOMEMORY  is  returned  if  the  output  buffer  is not big
+       PCRE2_ERROR_NOMEMORY is returned  if  the  output  buffer  is  not  big
        enough. If the PCRE2_SUBSTITUTE_OVERFLOW_LENGTH option is set, the size
-       of  buffer  that is needed is returned via outlengthptr. Note that this
+       of buffer that is needed is returned via outlengthptr. Note  that  this
        does not happen by default.
 
        PCRE2_ERROR_NULL is returned if PCRE2_SUBSTITUTE_MATCHED is set but the
        match_data argument is NULL.
 
-       PCRE2_ERROR_BADREPLACEMENT  is  used for miscellaneous syntax errors in
-       the replacement string, with more  particular  errors  being  PCRE2_ER-
+       PCRE2_ERROR_BADREPLACEMENT is used for miscellaneous syntax  errors  in
+       the  replacement  string,  with  more particular errors being PCRE2_ER-
        ROR_BADREPESCAPE (invalid escape sequence), PCRE2_ERROR_REPMISSINGBRACE
-       (closing curly bracket not found), PCRE2_ERROR_BADSUBSTITUTION  (syntax
-       error  in  extended group substitution), and PCRE2_ERROR_BADSUBSPATTERN
+       (closing  curly bracket not found), PCRE2_ERROR_BADSUBSTITUTION (syntax
+       error in extended group substitution),  and  PCRE2_ERROR_BADSUBSPATTERN
        (the pattern match ended before it started or the match started earlier
-       than  the  current  position  in the subject, which can happen if \K is
+       than the current position in the subject, which can  happen  if  \K  is
        used in an assertion).
 
        As for all PCRE2 errors, a text message that describes the error can be
-       obtained  by  calling  the pcre2_get_error_message() function (see "Ob-
+       obtained by calling the pcre2_get_error_message()  function  (see  "Ob-
        taining a textual error message" above).
 
    Substitution callouts
@@ -3528,15 +3545,15 @@
          int (*callout_function)(pcre2_substitute_callout_block *, void *),
          void *callout_data);
 
-       The pcre2_set_substitution_callout() function can be used to specify  a
-       callout  function for pcre2_substitute(). This information is passed in
+       The  pcre2_set_substitution_callout() function can be used to specify a
+       callout function for pcre2_substitute(). This information is passed  in
        a match context. The callout function is called after each substitution
        has been processed, but it can cause the replacement not to happen. The
-       callout function is not called for simulated substitutions that  happen
+       callout  function is not called for simulated substitutions that happen
        as a result of the PCRE2_SUBSTITUTE_OVERFLOW_LENGTH option.
 
        The first argument of the callout function is a pointer to a substitute
-       callout block structure, which contains the following fields, not  nec-
+       callout  block structure, which contains the following fields, not nec-
        essarily in this order:
 
          uint32_t    version;
@@ -3547,34 +3564,34 @@
          uint32_t    oveccount;
          PCRE2_SIZE  output_offsets[2];
 
-       The  version field contains the version number of the block format. The
-       current version is 0. The version number will  increase  in  future  if
-       more  fields are added, but the intention is never to remove any of the
+       The version field contains the version number of the block format.  The
+       current  version  is  0.  The version number will increase in future if
+       more fields are added, but the intention is never to remove any of  the
        existing fields.
 
        The subscount field is the number of the current match. It is 1 for the
        first callout, 2 for the second, and so on. The input and output point-
        ers are copies of the values passed to pcre2_substitute().
 
-       The ovector field points to the ovector, which contains the  result  of
+       The  ovector  field points to the ovector, which contains the result of
        the most recent match. The oveccount field contains the number of pairs
        that are set in the ovector, and is always greater than zero.
 
-       The output_offsets vector contains the offsets of  the  replacement  in
-       the  output  string. This has already been processed for dollar and (if
+       The  output_offsets  vector  contains the offsets of the replacement in
+       the output string. This has already been processed for dollar  and  (if
        requested) backslash substitutions as described above.
 
-       The second argument of the callout function  is  the  value  passed  as
-       callout_data  when  the  function was registered. The value returned by
+       The  second  argument  of  the  callout function is the value passed as
+       callout_data when the function was registered. The  value  returned  by
        the callout function is interpreted as follows:
 
-       If the value is zero, the replacement is accepted, and,  if  PCRE2_SUB-
-       STITUTE_GLOBAL  is set, processing continues with a search for the next
-       match. If the value is not zero, the current  replacement  is  not  ac-
-       cepted.  If  the  value is greater than zero, processing continues when
-       PCRE2_SUBSTITUTE_GLOBAL is set. Otherwise (the value is less than  zero
-       or  PCRE2_SUBSTITUTE_GLOBAL  is  not set), the the rest of the input is
-       copied to the output and the call to pcre2_substitute() exits,  return-
+       If  the  value is zero, the replacement is accepted, and, if PCRE2_SUB-
+       STITUTE_GLOBAL is set, processing continues with a search for the  next
+       match.  If  the  value  is not zero, the current replacement is not ac-
+       cepted. If the value is greater than zero,  processing  continues  when
+       PCRE2_SUBSTITUTE_GLOBAL  is set. Otherwise (the value is less than zero
+       or PCRE2_SUBSTITUTE_GLOBAL is not set), the the rest of  the  input  is
+       copied  to the output and the call to pcre2_substitute() exits, return-
        ing the number of matches so far.
 
 
@@ -3583,56 +3600,56 @@
        int pcre2_substring_nametable_scan(const pcre2_code *code,
          PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last);
 
-       When  a  pattern  is compiled with the PCRE2_DUPNAMES option, names for
-       capture groups are not required to be unique. Duplicate names  are  al-
-       ways  allowed for groups with the same number, created by using the (?|
+       When a pattern is compiled with the PCRE2_DUPNAMES  option,  names  for
+       capture  groups  are not required to be unique. Duplicate names are al-
+       ways allowed for groups with the same number, created by using the  (?|
        feature. Indeed, if such groups are named, they are required to use the
        same names.
 
-       Normally,  patterns  that  use duplicate names are such that in any one
-       match, only one of each set of identically-named  groups  participates.
+       Normally, patterns that use duplicate names are such that  in  any  one
+       match,  only  one of each set of identically-named groups participates.
        An example is shown in the pcre2pattern documentation.
 
-       When   duplicates   are   present,   pcre2_substring_copy_byname()  and
-       pcre2_substring_get_byname() return the first  substring  corresponding
-       to  the given name that is set. Only if none are set is PCRE2_ERROR_UN-
-       SET is returned. The  pcre2_substring_number_from_name()  function  re-
-       turns  the error PCRE2_ERROR_NOUNIQUESUBSTRING when there are duplicate
+       When  duplicates   are   present,   pcre2_substring_copy_byname()   and
+       pcre2_substring_get_byname()  return  the first substring corresponding
+       to the given name that is set. Only if none are set is  PCRE2_ERROR_UN-
+       SET  is  returned.  The pcre2_substring_number_from_name() function re-
+       turns the error PCRE2_ERROR_NOUNIQUESUBSTRING when there are  duplicate
        names.
 
-       If you want to get full details of all captured substrings for a  given
-       name,  you  must use the pcre2_substring_nametable_scan() function. The
-       first argument is the compiled pattern, and the second is the name.  If
-       the  third  and fourth arguments are NULL, the function returns a group
+       If  you want to get full details of all captured substrings for a given
+       name, you must use the pcre2_substring_nametable_scan()  function.  The
+       first  argument is the compiled pattern, and the second is the name. If
+       the third and fourth arguments are NULL, the function returns  a  group
        number for a unique name, or PCRE2_ERROR_NOUNIQUESUBSTRING otherwise.
 
        When the third and fourth arguments are not NULL, they must be pointers
-       to  variables  that are updated by the function. After it has run, they
+       to variables that are updated by the function. After it has  run,  they
        point to the first and last entries in the name-to-number table for the
-       given  name,  and the function returns the length of each entry in code
-       units. In both cases, PCRE2_ERROR_NOSUBSTRING is returned if there  are
+       given name, and the function returns the length of each entry  in  code
+       units.  In both cases, PCRE2_ERROR_NOSUBSTRING is returned if there are
        no entries for the given name.
 
        The format of the name table is described above in the section entitled
-       Information about a pattern. Given all the  relevant  entries  for  the
-       name,  you  can  extract  each of their numbers, and hence the captured
+       Information  about  a  pattern.  Given all the relevant entries for the
+       name, you can extract each of their numbers,  and  hence  the  captured
        data.
 
 
 FINDING ALL POSSIBLE MATCHES AT ONE POSITION
 
-       The traditional matching function uses a  similar  algorithm  to  Perl,
-       which  stops when it finds the first match at a given point in the sub-
+       The  traditional  matching  function  uses a similar algorithm to Perl,
+       which stops when it finds the first match at a given point in the  sub-
        ject. If you want to find all possible matches, or the longest possible
-       match  at  a  given  position,  consider using the alternative matching
-       function (see below) instead. If you cannot use the  alternative  func-
+       match at a given position,  consider  using  the  alternative  matching
+       function  (see  below) instead. If you cannot use the alternative func-
        tion, you can kludge it up by making use of the callout facility, which
        is described in the pcre2callout documentation.
 
        What you have to do is to insert a callout right at the end of the pat-
-       tern.   When your callout function is called, extract and save the cur-
-       rent matched substring. Then return 1, which  forces  pcre2_match()  to
-       backtrack  and  try other alternatives. Ultimately, when it runs out of
+       tern.  When your callout function is called, extract and save the  cur-
+       rent  matched  substring.  Then return 1, which forces pcre2_match() to
+       backtrack and try other alternatives. Ultimately, when it runs  out  of
        matches, pcre2_match() will yield PCRE2_ERROR_NOMATCH.
 
 
@@ -3644,26 +3661,26 @@
          pcre2_match_context *mcontext,
          int *workspace, PCRE2_SIZE wscount);
 
-       The function pcre2_dfa_match() is called  to  match  a  subject  string
-       against  a  compiled pattern, using a matching algorithm that scans the
+       The  function  pcre2_dfa_match()  is  called  to match a subject string
+       against a compiled pattern, using a matching algorithm that  scans  the
        subject string just once (not counting lookaround assertions), and does
-       not  backtrack.  This has different characteristics to the normal algo-
-       rithm, and is not compatible with Perl. Some of the features  of  PCRE2
-       patterns  are  not  supported.  Nevertheless, there are times when this
-       kind of matching can be useful. For a discussion of  the  two  matching
+       not backtrack.  This has different characteristics to the normal  algo-
+       rithm,  and  is not compatible with Perl. Some of the features of PCRE2
+       patterns are not supported.  Nevertheless, there are  times  when  this
+       kind  of  matching  can be useful. For a discussion of the two matching
        algorithms, and a list of features that pcre2_dfa_match() does not sup-
        port, see the pcre2matching documentation.
 
-       The arguments for the pcre2_dfa_match() function are the  same  as  for
+       The  arguments  for  the pcre2_dfa_match() function are the same as for
        pcre2_match(), plus two extras. The ovector within the match data block
        is used in a different way, and this is described below. The other com-
-       mon  arguments  are used in the same way as for pcre2_match(), so their
+       mon arguments are used in the same way as for pcre2_match(),  so  their
        description is not repeated here.
 
-       The two additional arguments provide workspace for  the  function.  The
-       workspace  vector  should  contain at least 20 elements. It is used for
+       The  two  additional  arguments provide workspace for the function. The
+       workspace vector should contain at least 20 elements. It  is  used  for
        keeping  track  of  multiple  paths  through  the  pattern  tree.  More
-       workspace  is needed for patterns and subjects where there are a lot of
+       workspace is needed for patterns and subjects where there are a lot  of
        potential matches.
 
        Here is an example of a simple call to pcre2_dfa_match():
@@ -3683,45 +3700,45 @@
 
    Option bits for pcre_dfa_match()
 
-       The unused bits of the options argument for pcre2_dfa_match()  must  be
-       zero.   The   only   bits   that   may   be   set  are  PCRE2_ANCHORED,
-       PCRE2_COPY_MATCHED_SUBJECT, PCRE2_ENDANCHORED, PCRE2_NOTBOL,  PCRE2_NO-
+       The  unused  bits of the options argument for pcre2_dfa_match() must be
+       zero.  The  only   bits   that   may   be   set   are   PCRE2_ANCHORED,
+       PCRE2_COPY_MATCHED_SUBJECT,  PCRE2_ENDANCHORED, PCRE2_NOTBOL, PCRE2_NO-
        TEOL,   PCRE2_NOTEMPTY,   PCRE2_NOTEMPTY_ATSTART,   PCRE2_NO_UTF_CHECK,
-       PCRE2_PARTIAL_HARD,   PCRE2_PARTIAL_SOFT,    PCRE2_DFA_SHORTEST,    and
-       PCRE2_DFA_RESTART.  All but the last four of these are exactly the same
+       PCRE2_PARTIAL_HARD,    PCRE2_PARTIAL_SOFT,    PCRE2_DFA_SHORTEST,   and
+       PCRE2_DFA_RESTART. All but the last four of these are exactly the  same
        as for pcre2_match(), so their description is not repeated here.
 
          PCRE2_PARTIAL_HARD
          PCRE2_PARTIAL_SOFT
 
-       These have the same general effect as they do  for  pcre2_match(),  but
-       the  details are slightly different. When PCRE2_PARTIAL_HARD is set for
-       pcre2_dfa_match(), it returns PCRE2_ERROR_PARTIAL if  the  end  of  the
+       These  have  the  same general effect as they do for pcre2_match(), but
+       the details are slightly different. When PCRE2_PARTIAL_HARD is set  for
+       pcre2_dfa_match(),  it  returns  PCRE2_ERROR_PARTIAL  if the end of the
        subject is reached and there is still at least one matching possibility
        that requires additional characters. This happens even if some complete
-       matches  have  already  been found. When PCRE2_PARTIAL_SOFT is set, the
-       return code PCRE2_ERROR_NOMATCH is converted  into  PCRE2_ERROR_PARTIAL
-       if  the  end  of  the  subject  is reached, there have been no complete
+       matches have already been found. When PCRE2_PARTIAL_SOFT  is  set,  the
+       return  code  PCRE2_ERROR_NOMATCH is converted into PCRE2_ERROR_PARTIAL
+       if the end of the subject is  reached,  there  have  been  no  complete
        matches, but there is still at least one matching possibility. The por-
-       tion  of  the  string that was inspected when the longest partial match
+       tion of the string that was inspected when the  longest  partial  match
        was found is set as the first matching string in both cases. There is a
-       more  detailed  discussion  of partial and multi-segment matching, with
+       more detailed discussion of partial and  multi-segment  matching,  with
        examples, in the pcre2partial documentation.
 
          PCRE2_DFA_SHORTEST
 
-       Setting the PCRE2_DFA_SHORTEST option causes the matching algorithm  to
+       Setting  the PCRE2_DFA_SHORTEST option causes the matching algorithm to
        stop as soon as it has found one match. Because of the way the alterna-
-       tive algorithm works, this is necessarily the shortest  possible  match
+       tive  algorithm  works, this is necessarily the shortest possible match
        at the first possible matching point in the subject string.
 
          PCRE2_DFA_RESTART
 
-       When  pcre2_dfa_match() returns a partial match, it is possible to call
+       When pcre2_dfa_match() returns a partial match, it is possible to  call
        it again, with additional subject characters, and have it continue with
        the same match. The PCRE2_DFA_RESTART option requests this action; when
-       it is set, the workspace and wscount options must  reference  the  same
-       vector  as  before  because data about the match so far is left in them
+       it  is  set,  the workspace and wscount options must reference the same
+       vector as before because data about the match so far is  left  in  them
        after a partial match. There is more discussion of this facility in the
        pcre2partial documentation.
 
@@ -3729,8 +3746,8 @@
 
        When pcre2_dfa_match() succeeds, it may have matched more than one sub-
        string in the subject. Note, however, that all the matches from one run
-       of  the  function  start  at the same point in the subject. The shorter
-       matches are all initial substrings of the longer matches. For  example,
+       of the function start at the same point in  the  subject.  The  shorter
+       matches  are all initial substrings of the longer matches. For example,
        if the pattern
 
          <.*>
@@ -3745,94 +3762,94 @@
          <something> <something else>
          <something>
 
-       On  success,  the  yield of the function is a number greater than zero,
-       which is the number of matched substrings.  The  offsets  of  the  sub-
-       strings  are returned in the ovector, and can be extracted by number in
-       the same way as for pcre2_match(), but the numbers bear no relation  to
-       any  capture groups that may exist in the pattern, because DFA matching
+       On success, the yield of the function is a number  greater  than  zero,
+       which  is  the  number  of  matched substrings. The offsets of the sub-
+       strings are returned in the ovector, and can be extracted by number  in
+       the  same way as for pcre2_match(), but the numbers bear no relation to
+       any capture groups that may exist in the pattern, because DFA  matching
        does not support capturing.
 
-       Calls to the convenience functions that extract substrings by name  re-
+       Calls  to the convenience functions that extract substrings by name re-
        turn the error PCRE2_ERROR_DFA_UFUNC (unsupported function) if used af-
-       ter a DFA match. The convenience functions that extract  substrings  by
+       ter  a  DFA match. The convenience functions that extract substrings by
        number never return PCRE2_ERROR_NOSUBSTRING.
 
-       The  matched  strings  are  stored  in  the ovector in reverse order of
-       length; that is, the longest matching string is first.  If  there  were
-       too  many matches to fit into the ovector, the yield of the function is
+       The matched strings are stored in  the  ovector  in  reverse  order  of
+       length;  that  is,  the longest matching string is first. If there were
+       too many matches to fit into the ovector, the yield of the function  is
        zero, and the vector is filled with the longest matches.
 
-       NOTE: PCRE2's "auto-possessification" optimization usually  applies  to
-       character  repeats at the end of a pattern (as well as internally). For
-       example, the pattern "a\d+" is compiled as if it were "a\d++". For  DFA
-       matching,  this means that only one possible match is found. If you re-
+       NOTE:  PCRE2's  "auto-possessification" optimization usually applies to
+       character repeats at the end of a pattern (as well as internally).  For
+       example,  the pattern "a\d+" is compiled as if it were "a\d++". For DFA
+       matching, this means that only one possible match is found. If you  re-
        ally do want multiple matches in such cases, either use an ungreedy re-
-       peat  such as "a\d+?" or set the PCRE2_NO_AUTO_POSSESS option when com-
+       peat such as "a\d+?" or set the PCRE2_NO_AUTO_POSSESS option when  com-
        piling.
 
    Error returns from pcre2_dfa_match()
 
        The pcre2_dfa_match() function returns a negative number when it fails.
-       Many  of  the  errors  are  the same as for pcre2_match(), as described
+       Many of the errors are the same  as  for  pcre2_match(),  as  described
        above.  There are in addition the following errors that are specific to
        pcre2_dfa_match():
 
          PCRE2_ERROR_DFA_UITEM
 
-       This  return  is  given  if pcre2_dfa_match() encounters an item in the
-       pattern that it does not support, for instance, the use of \C in a  UTF
+       This return is given if pcre2_dfa_match() encounters  an  item  in  the
+       pattern  that it does not support, for instance, the use of \C in a UTF
        mode or a backreference.
 
          PCRE2_ERROR_DFA_UCOND
 
-       This  return  is given if pcre2_dfa_match() encounters a condition item
+       This return is given if pcre2_dfa_match() encounters a  condition  item
        that uses a backreference for the condition, or a test for recursion in
        a specific capture group. These are not supported.
 
          PCRE2_ERROR_DFA_UINVALID_UTF
 
-       This  return is given if pcre2_dfa_match() is called for a pattern that
-       was compiled with PCRE2_MATCH_INVALID_UTF. This is  not  supported  for
+       This return is given if pcre2_dfa_match() is called for a pattern  that
+       was  compiled  with  PCRE2_MATCH_INVALID_UTF. This is not supported for
        DFA matching.
 
          PCRE2_ERROR_DFA_WSSIZE
 
-       This  return  is  given  if  pcre2_dfa_match() runs out of space in the
+       This return is given if pcre2_dfa_match() runs  out  of  space  in  the
        workspace vector.
 
          PCRE2_ERROR_DFA_RECURSE
 
        When a recursion or subroutine call is processed, the matching function
-       calls  itself  recursively,  using  private  memory for the ovector and
-       workspace.  This error is given if the internal ovector  is  not  large
-       enough.  This  should  be  extremely  rare, as a vector of size 1000 is
+       calls itself recursively, using private  memory  for  the  ovector  and
+       workspace.   This  error  is given if the internal ovector is not large
+       enough. This should be extremely rare, as a  vector  of  size  1000  is
        used.
 
          PCRE2_ERROR_DFA_BADRESTART
 
-       When pcre2_dfa_match() is called  with  the  PCRE2_DFA_RESTART  option,
-       some  plausibility  checks  are  made on the contents of the workspace,
-       which should contain data about the previous partial match. If  any  of
+       When  pcre2_dfa_match()  is  called  with the PCRE2_DFA_RESTART option,
+       some plausibility checks are made on the  contents  of  the  workspace,
+       which  should  contain data about the previous partial match. If any of
        these checks fail, this error is given.
 
 
 SEE ALSO
 
-       pcre2build(3),    pcre2callout(3),    pcre2demo(3),   pcre2matching(3),
+       pcre2build(3),   pcre2callout(3),    pcre2demo(3),    pcre2matching(3),
        pcre2partial(3), pcre2posix(3), pcre2sample(3), pcre2unicode(3).
 
 
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
 
 REVISION
 
-       Last updated: 04 November 2020
-       Copyright (c) 1997-2020 University of Cambridge.
+       Last updated: 30 August 2021
+       Copyright (c) 1997-2021 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -4993,8 +5010,10 @@
        specified.
 
        16. From release 5.32.0, Perl locks out the use of \K in lookaround as-
-       sertions. In PCRE2, \K is acted on when it occurs  in  positive  asser-
-       tions, but is ignored in negative assertions.
+       sertions. From release 10.38 PCRE2 does the same by  default.  However,
+       there  is  an  option for re-enabling the previous behaviour. When this
+       option is set, \K is acted on when it occurs  in  positive  assertions,
+       but is ignored in negative assertions.
 
        17.  PCRE2  provides some extensions to the Perl regular expression fa-
        cilities.  Perl 5.10 included new features that  were  not  in  earlier
@@ -5062,14 +5081,14 @@
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
 
 REVISION
 
-       Last updated: 06 October 2020
-       Copyright (c) 1997-2019 University of Cambridge.
+       Last updated: 30 August 2021
+       Copyright (c) 1997-2021 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -5107,6 +5126,7 @@
 
          ARM 32-bit (v5, v7, and Thumb2)
          ARM 64-bit
+         IBM s390x 64 bit
          Intel x86 32-bit and 64-bit
          MIPS 32-bit and 64-bit
          Power PC 32-bit and 64-bit
@@ -5326,7 +5346,7 @@
        This is a suggestion for how a multithreaded program that needs to  set
        up non-default JIT stacks might operate:
 
-         During thread initalization
+         During thread initialization
            thread_local_var = pcre2_jit_stack_create(...)
 
          During thread exit
@@ -5634,8 +5654,8 @@
        that  point the algorithm stops. Thus, if there is more than one possi-
        ble match, this algorithm returns the first one that it finds.  Whether
        this  is the shortest, the longest, or some intermediate length depends
-       on the way the greedy and ungreedy repetition quantifiers are specified
-       in the pattern.
+       on the way the alternations and the greedy or ungreedy repetition quan-
+       tifiers are specified in the pattern.
 
        Because  it  ends  up  with a single path through the tree, it is rela-
        tively straightforward for this algorithm to keep  track  of  the  sub-
@@ -5664,12 +5684,18 @@
        represent the different matching possibilities (if there are none,  the
        match  has  failed).   Thus,  if there is more than one possible match,
        this algorithm finds all of them, and in particular, it finds the long-
-       est.  The  matches are returned in decreasing order of length. There is
-       an option to stop the algorithm after the first match (which is  neces-
-       sarily the shortest) is found.
+       est.  The matches are returned in the output vector in decreasing order
+       of length. There is an option to stop the  algorithm  after  the  first
+       match (which is necessarily the shortest) is found.
 
-       Note that all the matches that are found start at the same point in the
-       subject. If the pattern
+       Note  that the size of vector needed to contain all the results depends
+       on the number of simultaneous matches, not on the number of parentheses
+       in  the pattern. Using pcre2_match_data_create_from_pattern() to create
+       the match data block is therefore not advisable when doing  DFA  match-
+       ing.
+
+       Note  also  that all the matches that are found start at the same point
+       in the subject. If the pattern
 
          cat(er(pillar)?)?
 
@@ -5745,50 +5771,45 @@
 
 ADVANTAGES OF THE ALTERNATIVE ALGORITHM
 
-       Using  the alternative matching algorithm provides the following advan-
-       tages:
-
-       1. All possible matches (at a single point in the subject) are automat-
-       ically  found,  and  in particular, the longest match is found. To find
-       more than one match using the standard algorithm, you have to do kludgy
+       The  main  advantage  of the alternative algorithm is that all possible
+       matches (at a single point in the subject) are automatically found, and
+       in  particular, the longest match is found. To find more than one match
+       at the same point using the standard algorithm, you have to  do  kludgy
        things with callouts.
 
-       2.  Because  the  alternative  algorithm  scans the subject string just
-       once, and never needs to backtrack (except for lookbehinds), it is pos-
-       sible  to  pass  very  long subject strings to the matching function in
-       several pieces, checking for partial matching each time. Although it is
-       also  possible  to  do  multi-segment matching using the standard algo-
-       rithm, by retaining partially matched substrings, it  is  more  compli-
-       cated. The pcre2partial documentation gives details of partial matching
-       and discusses multi-segment matching.
+       Partial  matching  is  possible with this algorithm, though it has some
+       limitations. The pcre2partial documentation gives  details  of  partial
+       matching and discusses multi-segment matching.
 
 
 DISADVANTAGES OF THE ALTERNATIVE ALGORITHM
 
        The alternative algorithm suffers from a number of disadvantages:
 
-       1. It is substantially slower than  the  standard  algorithm.  This  is
-       partly  because  it has to search for all possible matches, but is also
+       1.  It  is  substantially  slower  than the standard algorithm. This is
+       partly because it has to search for all possible matches, but  is  also
        because it is less susceptible to optimization.
 
-       2. Capturing parentheses, backreferences,  script  runs,  and  matching
+       2.  Capturing  parentheses,  backreferences,  script runs, and matching
        within invalid UTF string are not supported.
 
        3. Although atomic groups are supported, their use does not provide the
        performance advantage that it does for the standard algorithm.
 
+       4. JIT optimization is not supported.
+
 
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
 
 REVISION
 
-       Last updated: 23 May 2019
-       Copyright (c) 1997-2019 University of Cambridge.
+       Last updated: 28 August 2021
+       Copyright (c) 1997-2021 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -6816,7 +6837,7 @@
 
        It is possible to restrict \R to match only CR, LF, or CRLF (instead of
        the  complete  set  of  Unicode  line  endings)  by  setting the option
-       PCRE2_BSR_ANYCRLF at compile time. (BSR is an  abbrevation  for  "back-
+       PCRE2_BSR_ANYCRLF at compile time. (BSR is an abbreviation  for  "back-
        slash R".) This can be made the default when PCRE2 is built; if this is
        the case, the other behaviour can be requested via  the  PCRE2_BSR_UNI-
        CODE  option. It is also possible to specify these settings by starting
@@ -7016,8 +7037,8 @@
        3. Do not break Hangul (a Korean  script)  syllable  sequences.  Hangul
        characters  are of five types: L, V, T, LV, and LVT. An L character may
        be followed by an L, V, LV, or LVT character; an LV or V character  may
-       be followed by a V or T character; an LVT or T character may be follwed
-       only by a T character.
+       be  followed  by  a V or T character; an LVT or T character may be fol-
+       lowed only by a T character.
 
        4. Do not end before extending  characters  or  spacing  marks  or  the
        "zero-width  joiner" character. Characters with the "mark" property al-
@@ -7091,14 +7112,16 @@
 
        matches "foobar", the first substring is still set to "foo".
 
-       Perl  used  to document that the use of \K within lookaround assertions
-       is "not well defined", but from version 5.32.0 Perl  does  not  support
-       this  usage  at  all.  In PCRE2, \K is acted upon when it occurs inside
-       positive assertions, but is ignored in negative assertions.  Note  that
-       when  a  pattern  such  as  (?=ab\K) matches, the reported start of the
-       match can be greater than the end of the match. Using \K in  a  lookbe-
-       hind  assertion at the start of a pattern can also lead to odd effects.
-       For example, consider this pattern:
+       From  version  5.32.0  Perl  forbids the use of \K in lookaround asser-
+       tions. From release 10.38 PCRE2 also forbids this by default.  However,
+       the  PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK  option  can be used when calling
+       pcre2_compile() to re-enable the previous behaviour. When  this  option
+       is set, \K is acted upon when it occurs inside positive assertions, but
+       is ignored in negative assertions. Note that when  a  pattern  such  as
+       (?=ab\K)  matches,  the reported start of the match can be greater than
+       the end of the match. Using \K in a lookbehind assertion at  the  start
+       of  a  pattern can also lead to odd effects. For example, consider this
+       pattern:
 
          (?<=\Kfoo)bar
 
@@ -9388,7 +9411,7 @@
        If  the  subject  is  "aaaac...",  after  the first match attempt fails
        (starting at the first character in the  string),  the  starting  point
        skips on to start the next attempt at "c". Note that a possessive quan-
-       tifer does not have the same effect as this example; although it  would
+       tifier does not have the same effect as this example; although it would
        suppress  backtracking  during  the first match attempt, the second at-
        tempt would start at the second character instead  of  skipping  on  to
        "c".
@@ -9609,14 +9632,14 @@
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
 
 REVISION
 
-       Last updated: 06 October 2020
-       Copyright (c) 1997-2020 University of Cambridge.
+       Last updated: 30 August 2021
+       Copyright (c) 1997-2021 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
@@ -10723,7 +10746,11 @@
 
          \K          set reported start of match
 
-       \K is honoured in positive assertions, but ignored in negative ones.
+       From  release 10.38 \K is not permitted by default in lookaround asser-
+       tions, for compatibility with Perl.  However,  if  the  PCRE2_EXTRA_AL-
+       LOW_LOOKAROUND_BSK option is set, the previous behaviour is re-enabled.
+       When this option is set, \K is honoured in positive assertions, but ig-
+       nored in negative ones.
 
 
 ALTERNATION
@@ -10973,14 +11000,14 @@
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
 
 REVISION
 
-       Last updated: 28 December 2019
-       Copyright (c) 1997-2019 University of Cambridge.
+       Last updated: 30 August 2021
+       Copyright (c) 1997-2021 University of Cambridge.
 ------------------------------------------------------------------------------
 
 
diff --git a/dist2/doc/pcre2_callout_enumerate.3 b/doc/pcre2_callout_enumerate.3
similarity index 100%
rename from dist2/doc/pcre2_callout_enumerate.3
rename to doc/pcre2_callout_enumerate.3
diff --git a/dist2/doc/pcre2_code_copy.3 b/doc/pcre2_code_copy.3
similarity index 100%
rename from dist2/doc/pcre2_code_copy.3
rename to doc/pcre2_code_copy.3
diff --git a/dist2/doc/pcre2_code_copy_with_tables.3 b/doc/pcre2_code_copy_with_tables.3
similarity index 100%
rename from dist2/doc/pcre2_code_copy_with_tables.3
rename to doc/pcre2_code_copy_with_tables.3
diff --git a/dist2/doc/pcre2_code_free.3 b/doc/pcre2_code_free.3
similarity index 100%
rename from dist2/doc/pcre2_code_free.3
rename to doc/pcre2_code_free.3
diff --git a/dist2/doc/pcre2_compile.3 b/doc/pcre2_compile.3
similarity index 100%
rename from dist2/doc/pcre2_compile.3
rename to doc/pcre2_compile.3
diff --git a/dist2/doc/pcre2_compile_context_copy.3 b/doc/pcre2_compile_context_copy.3
similarity index 100%
rename from dist2/doc/pcre2_compile_context_copy.3
rename to doc/pcre2_compile_context_copy.3
diff --git a/dist2/doc/pcre2_compile_context_create.3 b/doc/pcre2_compile_context_create.3
similarity index 100%
rename from dist2/doc/pcre2_compile_context_create.3
rename to doc/pcre2_compile_context_create.3
diff --git a/dist2/doc/pcre2_compile_context_free.3 b/doc/pcre2_compile_context_free.3
similarity index 100%
rename from dist2/doc/pcre2_compile_context_free.3
rename to doc/pcre2_compile_context_free.3
diff --git a/dist2/doc/pcre2_config.3 b/doc/pcre2_config.3
similarity index 100%
rename from dist2/doc/pcre2_config.3
rename to doc/pcre2_config.3
diff --git a/dist2/doc/pcre2_convert_context_copy.3 b/doc/pcre2_convert_context_copy.3
similarity index 100%
rename from dist2/doc/pcre2_convert_context_copy.3
rename to doc/pcre2_convert_context_copy.3
diff --git a/dist2/doc/pcre2_convert_context_create.3 b/doc/pcre2_convert_context_create.3
similarity index 100%
rename from dist2/doc/pcre2_convert_context_create.3
rename to doc/pcre2_convert_context_create.3
diff --git a/dist2/doc/pcre2_convert_context_free.3 b/doc/pcre2_convert_context_free.3
similarity index 100%
rename from dist2/doc/pcre2_convert_context_free.3
rename to doc/pcre2_convert_context_free.3
diff --git a/dist2/doc/pcre2_converted_pattern_free.3 b/doc/pcre2_converted_pattern_free.3
similarity index 100%
rename from dist2/doc/pcre2_converted_pattern_free.3
rename to doc/pcre2_converted_pattern_free.3
diff --git a/dist2/doc/pcre2_dfa_match.3 b/doc/pcre2_dfa_match.3
similarity index 82%
rename from dist2/doc/pcre2_dfa_match.3
rename to doc/pcre2_dfa_match.3
index 6413cb6..ea87aac 100644
--- a/dist2/doc/pcre2_dfa_match.3
+++ b/doc/pcre2_dfa_match.3
@@ -1,4 +1,4 @@
-.TH PCRE2_DFA_MATCH 3 "16 October 2018" "PCRE2 10.33"
+.TH PCRE2_DFA_MATCH 3 "28 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH SYNOPSIS
@@ -33,10 +33,15 @@
   \fIworkspace\fP    Points to a vector of ints used as working space
   \fIwscount\fP      Number of elements in the vector
 .sp
-For \fBpcre2_dfa_match()\fP, a match context is needed only if you want to set
-up a callout function or specify the heap limit or the match or the recursion
-depth limits. The \fIlength\fP and \fIstartoffset\fP values are code units, not
-characters. The options are:
+The size of output vector needed to contain all the results depends on the
+number of simultaneous matches, not on the number of parentheses in the
+pattern. Using \fBpcre2_match_data_create_from_pattern()\fP to create the match
+data block is therefore not advisable when using this function.
+.P
+A match context is needed only if you want to set up a callout function or
+specify the heap limit or the match or the recursion depth limits. The
+\fIlength\fP and \fIstartoffset\fP values are code units, not characters. The
+options are:
 .sp
   PCRE2_ANCHORED          Match only at the first position
   PCRE2_COPY_MATCHED_SUBJECT
diff --git a/dist2/doc/pcre2_general_context_copy.3 b/doc/pcre2_general_context_copy.3
similarity index 100%
rename from dist2/doc/pcre2_general_context_copy.3
rename to doc/pcre2_general_context_copy.3
diff --git a/dist2/doc/pcre2_general_context_create.3 b/doc/pcre2_general_context_create.3
similarity index 100%
rename from dist2/doc/pcre2_general_context_create.3
rename to doc/pcre2_general_context_create.3
diff --git a/dist2/doc/pcre2_general_context_free.3 b/doc/pcre2_general_context_free.3
similarity index 100%
rename from dist2/doc/pcre2_general_context_free.3
rename to doc/pcre2_general_context_free.3
diff --git a/dist2/doc/pcre2_get_error_message.3 b/doc/pcre2_get_error_message.3
similarity index 100%
rename from dist2/doc/pcre2_get_error_message.3
rename to doc/pcre2_get_error_message.3
diff --git a/dist2/doc/pcre2_get_mark.3 b/doc/pcre2_get_mark.3
similarity index 100%
rename from dist2/doc/pcre2_get_mark.3
rename to doc/pcre2_get_mark.3
diff --git a/dist2/doc/pcre2_get_match_data_size.3 b/doc/pcre2_get_match_data_size.3
similarity index 100%
rename from dist2/doc/pcre2_get_match_data_size.3
rename to doc/pcre2_get_match_data_size.3
diff --git a/dist2/doc/pcre2_get_ovector_count.3 b/doc/pcre2_get_ovector_count.3
similarity index 100%
rename from dist2/doc/pcre2_get_ovector_count.3
rename to doc/pcre2_get_ovector_count.3
diff --git a/dist2/doc/pcre2_get_ovector_pointer.3 b/doc/pcre2_get_ovector_pointer.3
similarity index 100%
rename from dist2/doc/pcre2_get_ovector_pointer.3
rename to doc/pcre2_get_ovector_pointer.3
diff --git a/dist2/doc/pcre2_get_startchar.3 b/doc/pcre2_get_startchar.3
similarity index 100%
rename from dist2/doc/pcre2_get_startchar.3
rename to doc/pcre2_get_startchar.3
diff --git a/dist2/doc/pcre2_jit_compile.3 b/doc/pcre2_jit_compile.3
similarity index 100%
rename from dist2/doc/pcre2_jit_compile.3
rename to doc/pcre2_jit_compile.3
diff --git a/dist2/doc/pcre2_jit_free_unused_memory.3 b/doc/pcre2_jit_free_unused_memory.3
similarity index 100%
rename from dist2/doc/pcre2_jit_free_unused_memory.3
rename to doc/pcre2_jit_free_unused_memory.3
diff --git a/dist2/doc/pcre2_jit_match.3 b/doc/pcre2_jit_match.3
similarity index 100%
rename from dist2/doc/pcre2_jit_match.3
rename to doc/pcre2_jit_match.3
diff --git a/dist2/doc/pcre2_jit_stack_assign.3 b/doc/pcre2_jit_stack_assign.3
similarity index 100%
rename from dist2/doc/pcre2_jit_stack_assign.3
rename to doc/pcre2_jit_stack_assign.3
diff --git a/dist2/doc/pcre2_jit_stack_create.3 b/doc/pcre2_jit_stack_create.3
similarity index 100%
rename from dist2/doc/pcre2_jit_stack_create.3
rename to doc/pcre2_jit_stack_create.3
diff --git a/dist2/doc/pcre2_jit_stack_free.3 b/doc/pcre2_jit_stack_free.3
similarity index 100%
rename from dist2/doc/pcre2_jit_stack_free.3
rename to doc/pcre2_jit_stack_free.3
diff --git a/dist2/doc/pcre2_maketables.3 b/doc/pcre2_maketables.3
similarity index 100%
rename from dist2/doc/pcre2_maketables.3
rename to doc/pcre2_maketables.3
diff --git a/dist2/doc/pcre2_maketables_free.3 b/doc/pcre2_maketables_free.3
similarity index 100%
rename from dist2/doc/pcre2_maketables_free.3
rename to doc/pcre2_maketables_free.3
diff --git a/dist2/doc/pcre2_match.3 b/doc/pcre2_match.3
similarity index 100%
rename from dist2/doc/pcre2_match.3
rename to doc/pcre2_match.3
diff --git a/dist2/doc/pcre2_match_context_copy.3 b/doc/pcre2_match_context_copy.3
similarity index 100%
rename from dist2/doc/pcre2_match_context_copy.3
rename to doc/pcre2_match_context_copy.3
diff --git a/dist2/doc/pcre2_match_context_create.3 b/doc/pcre2_match_context_create.3
similarity index 100%
rename from dist2/doc/pcre2_match_context_create.3
rename to doc/pcre2_match_context_create.3
diff --git a/dist2/doc/pcre2_match_context_free.3 b/doc/pcre2_match_context_free.3
similarity index 100%
rename from dist2/doc/pcre2_match_context_free.3
rename to doc/pcre2_match_context_free.3
diff --git a/dist2/doc/pcre2_match_data_create.3 b/doc/pcre2_match_data_create.3
similarity index 76%
rename from dist2/doc/pcre2_match_data_create.3
rename to doc/pcre2_match_data_create.3
index 3b0a29e..439dea3 100644
--- a/dist2/doc/pcre2_match_data_create.3
+++ b/doc/pcre2_match_data_create.3
@@ -1,4 +1,4 @@
-.TH PCRE2_MATCH_DATA_CREATE 3 "29 July 2015" "PCRE2 10.21"
+.TH PCRE2_MATCH_DATA_CREATE 3 "28 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH SYNOPSIS
@@ -18,8 +18,9 @@
 result of a match. The first argument specifies the number of pairs of offsets
 that are required. These form the "output vector" (ovector) within the match
 data block, and are used to identify the matched string and any captured
-substrings. There is always one pair of offsets; if \fBovecsize\fP is zero, it
-is treated as one.
+substrings when matching with \fBpcre2_match()\fP, or a number of different
+matches at the same point when used with \fBpcre2_dfa_match()\fP. There is
+always one pair of offsets; if \fBovecsize\fP is zero, it is treated as one.
 .P
 The second argument points to a general context, for custom memory management,
 or is NULL for system memory management. The result of the function is NULL if
diff --git a/doc/pcre2_match_data_create_from_pattern.3 b/doc/pcre2_match_data_create_from_pattern.3
new file mode 100644
index 0000000..37486dd
--- /dev/null
+++ b/doc/pcre2_match_data_create_from_pattern.3
@@ -0,0 +1,40 @@
+.TH PCRE2_MATCH_DATA_CREATE_FROM_PATTERN 3 "28 August 2021" "PCRE2 10.38"
+.SH NAME
+PCRE2 - Perl-compatible regular expressions (revised API)
+.SH SYNOPSIS
+.rs
+.sp
+.B #include <pcre2.h>
+.PP
+.nf
+.B pcre2_match_data *pcre2_match_data_create_from_pattern(
+.B "  const pcre2_code *\fIcode\fP, pcre2_general_context *\fIgcontext\fP);"
+.fi
+.
+.SH DESCRIPTION
+.rs
+.sp
+This function creates a new match data block for holding the result of a match.
+The first argument points to a compiled pattern. The number of capturing
+parentheses within the pattern is used to compute the number of pairs of
+offsets that are required in the match data block. These form the "output
+vector" (ovector) within the match data block, and are used to identify the
+matched string and any captured substrings when matching with
+\fBpcre2_match()\fP. If you are using \fBpcre2_dfa_match()\fP, which uses the
+outut vector in a different way, you should use \fBpcre2_match_data_create()\fP
+instead of this function.
+.P
+The second argument points to a general context, for custom memory management,
+or is NULL to use the same memory allocator as was used for the compiled
+pattern. The result of the function is NULL if the memory for the block could
+not be obtained.
+.P
+There is a complete description of the PCRE2 native API in the
+.\" HREF
+\fBpcre2api\fP
+.\"
+page and a description of the POSIX API in the
+.\" HREF
+\fBpcre2posix\fP
+.\"
+page.
diff --git a/dist2/doc/pcre2_match_data_free.3 b/doc/pcre2_match_data_free.3
similarity index 100%
rename from dist2/doc/pcre2_match_data_free.3
rename to doc/pcre2_match_data_free.3
diff --git a/dist2/doc/pcre2_pattern_convert.3 b/doc/pcre2_pattern_convert.3
similarity index 100%
rename from dist2/doc/pcre2_pattern_convert.3
rename to doc/pcre2_pattern_convert.3
diff --git a/dist2/doc/pcre2_pattern_info.3 b/doc/pcre2_pattern_info.3
similarity index 100%
rename from dist2/doc/pcre2_pattern_info.3
rename to doc/pcre2_pattern_info.3
diff --git a/dist2/doc/pcre2_serialize_decode.3 b/doc/pcre2_serialize_decode.3
similarity index 100%
rename from dist2/doc/pcre2_serialize_decode.3
rename to doc/pcre2_serialize_decode.3
diff --git a/dist2/doc/pcre2_serialize_encode.3 b/doc/pcre2_serialize_encode.3
similarity index 100%
rename from dist2/doc/pcre2_serialize_encode.3
rename to doc/pcre2_serialize_encode.3
diff --git a/dist2/doc/pcre2_serialize_free.3 b/doc/pcre2_serialize_free.3
similarity index 100%
rename from dist2/doc/pcre2_serialize_free.3
rename to doc/pcre2_serialize_free.3
diff --git a/dist2/doc/pcre2_serialize_get_number_of_codes.3 b/doc/pcre2_serialize_get_number_of_codes.3
similarity index 100%
rename from dist2/doc/pcre2_serialize_get_number_of_codes.3
rename to doc/pcre2_serialize_get_number_of_codes.3
diff --git a/dist2/doc/pcre2_set_bsr.3 b/doc/pcre2_set_bsr.3
similarity index 100%
rename from dist2/doc/pcre2_set_bsr.3
rename to doc/pcre2_set_bsr.3
diff --git a/dist2/doc/pcre2_set_callout.3 b/doc/pcre2_set_callout.3
similarity index 100%
rename from dist2/doc/pcre2_set_callout.3
rename to doc/pcre2_set_callout.3
diff --git a/dist2/doc/pcre2_set_character_tables.3 b/doc/pcre2_set_character_tables.3
similarity index 100%
rename from dist2/doc/pcre2_set_character_tables.3
rename to doc/pcre2_set_character_tables.3
diff --git a/dist2/doc/pcre2_set_compile_extra_options.3 b/doc/pcre2_set_compile_extra_options.3
similarity index 85%
rename from dist2/doc/pcre2_set_compile_extra_options.3
rename to doc/pcre2_set_compile_extra_options.3
index 764a75e..58cefe5 100644
--- a/dist2/doc/pcre2_set_compile_extra_options.3
+++ b/doc/pcre2_set_compile_extra_options.3
@@ -1,4 +1,4 @@
-.TH PCRE2_SET_COMPILE_EXTRA_OPTIONS 3 "11 February 2019" "PCRE2 10.33"
+.TH PCRE2_SET_COMPILE_EXTRA_OPTIONS 3 "31 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH SYNOPSIS
@@ -19,11 +19,12 @@
 options are:
 .sp
 .\" JOIN
+  PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK     Allow \eK in lookarounds
   PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES  Allow \ex{df800} to \ex{dfff}
                                          in UTF-8 and UTF-32 modes
 .\" JOIN
-  PCRE2_EXTRA_ALT_BSUX                 Extended alternate \eu, \eU, and \ex
-                                         handling
+  PCRE2_EXTRA_ALT_BSUX                 Extended alternate \eu, \eU, and
+                                         \ex handling
 .\" JOIN
   PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL    Treat all invalid escapes as
                                          a literal following character
diff --git a/dist2/doc/pcre2_set_compile_recursion_guard.3 b/doc/pcre2_set_compile_recursion_guard.3
similarity index 100%
rename from dist2/doc/pcre2_set_compile_recursion_guard.3
rename to doc/pcre2_set_compile_recursion_guard.3
diff --git a/dist2/doc/pcre2_set_depth_limit.3 b/doc/pcre2_set_depth_limit.3
similarity index 100%
rename from dist2/doc/pcre2_set_depth_limit.3
rename to doc/pcre2_set_depth_limit.3
diff --git a/dist2/doc/pcre2_set_glob_escape.3 b/doc/pcre2_set_glob_escape.3
similarity index 100%
rename from dist2/doc/pcre2_set_glob_escape.3
rename to doc/pcre2_set_glob_escape.3
diff --git a/dist2/doc/pcre2_set_glob_separator.3 b/doc/pcre2_set_glob_separator.3
similarity index 100%
rename from dist2/doc/pcre2_set_glob_separator.3
rename to doc/pcre2_set_glob_separator.3
diff --git a/dist2/doc/pcre2_set_heap_limit.3 b/doc/pcre2_set_heap_limit.3
similarity index 100%
rename from dist2/doc/pcre2_set_heap_limit.3
rename to doc/pcre2_set_heap_limit.3
diff --git a/dist2/doc/pcre2_set_match_limit.3 b/doc/pcre2_set_match_limit.3
similarity index 100%
rename from dist2/doc/pcre2_set_match_limit.3
rename to doc/pcre2_set_match_limit.3
diff --git a/dist2/doc/pcre2_set_max_pattern_length.3 b/doc/pcre2_set_max_pattern_length.3
similarity index 100%
rename from dist2/doc/pcre2_set_max_pattern_length.3
rename to doc/pcre2_set_max_pattern_length.3
diff --git a/dist2/doc/pcre2_set_newline.3 b/doc/pcre2_set_newline.3
similarity index 100%
rename from dist2/doc/pcre2_set_newline.3
rename to doc/pcre2_set_newline.3
diff --git a/dist2/doc/pcre2_set_offset_limit.3 b/doc/pcre2_set_offset_limit.3
similarity index 100%
rename from dist2/doc/pcre2_set_offset_limit.3
rename to doc/pcre2_set_offset_limit.3
diff --git a/dist2/doc/pcre2_set_parens_nest_limit.3 b/doc/pcre2_set_parens_nest_limit.3
similarity index 100%
rename from dist2/doc/pcre2_set_parens_nest_limit.3
rename to doc/pcre2_set_parens_nest_limit.3
diff --git a/dist2/doc/pcre2_set_recursion_limit.3 b/doc/pcre2_set_recursion_limit.3
similarity index 100%
rename from dist2/doc/pcre2_set_recursion_limit.3
rename to doc/pcre2_set_recursion_limit.3
diff --git a/dist2/doc/pcre2_set_recursion_memory_management.3 b/doc/pcre2_set_recursion_memory_management.3
similarity index 100%
rename from dist2/doc/pcre2_set_recursion_memory_management.3
rename to doc/pcre2_set_recursion_memory_management.3
diff --git a/dist2/doc/pcre2_set_substitute_callout.3 b/doc/pcre2_set_substitute_callout.3
similarity index 100%
rename from dist2/doc/pcre2_set_substitute_callout.3
rename to doc/pcre2_set_substitute_callout.3
diff --git a/dist2/doc/pcre2_substitute.3 b/doc/pcre2_substitute.3
similarity index 100%
rename from dist2/doc/pcre2_substitute.3
rename to doc/pcre2_substitute.3
diff --git a/dist2/doc/pcre2_substring_copy_byname.3 b/doc/pcre2_substring_copy_byname.3
similarity index 100%
rename from dist2/doc/pcre2_substring_copy_byname.3
rename to doc/pcre2_substring_copy_byname.3
diff --git a/dist2/doc/pcre2_substring_copy_bynumber.3 b/doc/pcre2_substring_copy_bynumber.3
similarity index 100%
rename from dist2/doc/pcre2_substring_copy_bynumber.3
rename to doc/pcre2_substring_copy_bynumber.3
diff --git a/dist2/doc/pcre2_substring_free.3 b/doc/pcre2_substring_free.3
similarity index 100%
rename from dist2/doc/pcre2_substring_free.3
rename to doc/pcre2_substring_free.3
diff --git a/dist2/doc/pcre2_substring_get_byname.3 b/doc/pcre2_substring_get_byname.3
similarity index 100%
rename from dist2/doc/pcre2_substring_get_byname.3
rename to doc/pcre2_substring_get_byname.3
diff --git a/dist2/doc/pcre2_substring_get_bynumber.3 b/doc/pcre2_substring_get_bynumber.3
similarity index 100%
rename from dist2/doc/pcre2_substring_get_bynumber.3
rename to doc/pcre2_substring_get_bynumber.3
diff --git a/dist2/doc/pcre2_substring_length_byname.3 b/doc/pcre2_substring_length_byname.3
similarity index 100%
rename from dist2/doc/pcre2_substring_length_byname.3
rename to doc/pcre2_substring_length_byname.3
diff --git a/dist2/doc/pcre2_substring_length_bynumber.3 b/doc/pcre2_substring_length_bynumber.3
similarity index 100%
rename from dist2/doc/pcre2_substring_length_bynumber.3
rename to doc/pcre2_substring_length_bynumber.3
diff --git a/dist2/doc/pcre2_substring_list_free.3 b/doc/pcre2_substring_list_free.3
similarity index 100%
rename from dist2/doc/pcre2_substring_list_free.3
rename to doc/pcre2_substring_list_free.3
diff --git a/dist2/doc/pcre2_substring_list_get.3 b/doc/pcre2_substring_list_get.3
similarity index 100%
rename from dist2/doc/pcre2_substring_list_get.3
rename to doc/pcre2_substring_list_get.3
diff --git a/dist2/doc/pcre2_substring_nametable_scan.3 b/doc/pcre2_substring_nametable_scan.3
similarity index 100%
rename from dist2/doc/pcre2_substring_nametable_scan.3
rename to doc/pcre2_substring_nametable_scan.3
diff --git a/dist2/doc/pcre2_substring_number_from_name.3 b/doc/pcre2_substring_number_from_name.3
similarity index 100%
rename from dist2/doc/pcre2_substring_number_from_name.3
rename to doc/pcre2_substring_number_from_name.3
diff --git a/dist2/doc/pcre2api.3 b/doc/pcre2api.3
similarity index 98%
rename from dist2/doc/pcre2api.3
rename to doc/pcre2api.3
index 148dca6..1ad6e26 100644
--- a/dist2/doc/pcre2api.3
+++ b/doc/pcre2api.3
@@ -1,4 +1,4 @@
-.TH PCRE2API 3 "04 November 2020" "PCRE2 10.36"
+.TH PCRE2API 3 "30 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .sp
@@ -1876,6 +1876,13 @@
 The option bits that can be set in a compile context by calling the
 \fBpcre2_set_compile_extra_options()\fP function are as follows:
 .sp
+  PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+.sp
+Since release 10.38 PCRE2 has forbidden the use of \eK within lookaround
+assertions, following Perl's lead. This option is provided to re-enable the
+previous behaviour (act in positive lookarounds, ignore in negative ones) in
+case anybody is relying on it.
+.sp
   PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES
 .sp
 This option applies when compiling a pattern in UTF-8 or UTF-32 mode. It is
@@ -2490,19 +2497,27 @@
 Information about a successful or unsuccessful match is placed in a match
 data block, which is an opaque structure that is accessed by function calls. In
 particular, the match data block contains a vector of offsets into the subject
-string that define the matched part of the subject and any substrings that were
-captured. This is known as the \fIovector\fP.
+string that define the matched parts of the subject. This is known as the
+\fIovector\fP.
 .P
 Before calling \fBpcre2_match()\fP, \fBpcre2_dfa_match()\fP, or
 \fBpcre2_jit_match()\fP you must create a match data block by calling one of
 the creation functions above. For \fBpcre2_match_data_create()\fP, the first
-argument is the number of pairs of offsets in the \fIovector\fP. One pair of
-offsets is required to identify the string that matched the whole pattern, with
-an additional pair for each captured substring. For example, a value of 4
-creates enough space to record the matched portion of the subject plus three
-captured substrings. A minimum of at least 1 pair is imposed by
-\fBpcre2_match_data_create()\fP, so it is always possible to return the overall
-matched string.
+argument is the number of pairs of offsets in the \fIovector\fP.
+.P
+When using \fBpcre2_match()\fP, one pair of offsets is required to identify the
+string that matched the whole pattern, with an additional pair for each
+captured substring. For example, a value of 4 creates enough space to record
+the matched portion of the subject plus three captured substrings.
+.P
+When using \fBpcre2_dfa_match()\fP there may be multiple matched substrings of
+different lengths at the same point in the subject. The ovector should be made
+large enough to hold as many as are expected.
+.P
+A minimum of at least 1 pair is imposed by \fBpcre2_match_data_create()\fP, so
+it is always possible to return the overall matched string in the case of
+\fBpcre2_match()\fP or the longest match in the case of
+\fBpcre2_dfa_match()\fP.
 .P
 The second argument of \fBpcre2_match_data_create()\fP is a pointer to a
 general context, which can specify custom memory management for obtaining the
@@ -2511,10 +2526,11 @@
 .P
 For \fBpcre2_match_data_create_from_pattern()\fP, the first argument is a
 pointer to a compiled pattern. The ovector is created to be exactly the right
-size to hold all the substrings a pattern might capture. The second argument is
-again a pointer to a general context, but in this case if NULL is passed, the
-memory is obtained using the same allocator that was used for the compiled
-pattern (custom or default).
+size to hold all the substrings a pattern might capture when matched using
+\fBpcre2_match()\fP. You should not use this call when matching with
+\fBpcre2_dfa_match()\fP. The second argument is again a pointer to a general
+context, but in this case if NULL is passed, the memory is obtained using the
+same allocator that was used for the compiled pattern (custom or default).
 .P
 A match data block can be used many times, with the same or different compiled
 patterns. You can extract information from a match data block after a match
@@ -2628,10 +2644,10 @@
 .sp
 which finds occurrences of "iss" in the middle of words. (\eB matches only if
 the current position in the subject is not a word boundary.) When applied to
-the string "Mississipi" the first call to \fBpcre2_match()\fP finds the first
+the string "Mississippi" the first call to \fBpcre2_match()\fP finds the first
 occurrence. If \fBpcre2_match()\fP is called again with just the remainder of
-the subject, namely "issipi", it does not match, because \eB is always false at
-the start of the subject, which is deemed to be a word boundary. However, if
+the subject, namely "issippi", it does not match, because \eB is always false
+at the start of the subject, which is deemed to be a word boundary. However, if
 \fBpcre2_match()\fP is passed the entire string again, but with
 \fIstartoffset\fP set to 4, it finds the second occurrence of "iss" because it
 is able to look behind the starting point to discover that it is preceded by a
@@ -3991,7 +4007,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -4000,6 +4016,6 @@
 .rs
 .sp
 .nf
-Last updated: 04 November 2020
-Copyright (c) 1997-2020 University of Cambridge.
+Last updated: 30 August 2021
+Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2build.3 b/doc/pcre2build.3
similarity index 100%
rename from dist2/doc/pcre2build.3
rename to doc/pcre2build.3
diff --git a/dist2/doc/pcre2callout.3 b/doc/pcre2callout.3
similarity index 100%
rename from dist2/doc/pcre2callout.3
rename to doc/pcre2callout.3
diff --git a/dist2/doc/pcre2compat.3 b/doc/pcre2compat.3
similarity index 95%
rename from dist2/doc/pcre2compat.3
rename to doc/pcre2compat.3
index 026e664..311d6eb 100644
--- a/dist2/doc/pcre2compat.3
+++ b/doc/pcre2compat.3
@@ -1,4 +1,4 @@
-.TH PCRE2COMPAT 3 "06 October 2020" "PCRE2 10.36"
+.TH PCRE2COMPAT 3 "30 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "DIFFERENCES BETWEEN PCRE2 AND PERL"
@@ -133,8 +133,10 @@
 letters, regardless of case, when case independence is specified.
 .P
 16. From release 5.32.0, Perl locks out the use of \eK in lookaround
-assertions. In PCRE2, \eK is acted on when it occurs in positive assertions,
-but is ignored in negative assertions.
+assertions. From release 10.38 PCRE2 does the same by default. However, there
+is an option for re-enabling the previous behaviour. When this option is set,
+\eK is acted on when it occurs in positive assertions, but is ignored in
+negative assertions.
 .P
 17. PCRE2 provides some extensions to the Perl regular expression facilities.
 Perl 5.10 included new features that were not in earlier versions of Perl, some
@@ -203,7 +205,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -212,6 +214,6 @@
 .rs
 .sp
 .nf
-Last updated: 06 October 2020
-Copyright (c) 1997-2019 University of Cambridge.
+Last updated: 30 August 2021
+Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2convert.3 b/doc/pcre2convert.3
similarity index 100%
rename from dist2/doc/pcre2convert.3
rename to doc/pcre2convert.3
diff --git a/dist2/doc/pcre2demo.3 b/doc/pcre2demo.3
similarity index 97%
rename from dist2/doc/pcre2demo.3
rename to doc/pcre2demo.3
index 0d30145..57615a5 100644
--- a/dist2/doc/pcre2demo.3
+++ b/doc/pcre2demo.3
@@ -215,8 +215,8 @@
   return 1;
   }
 
-/* Match succeded. Get a pointer to the output vector, where string offsets are
-stored. */
+/* Match succeeded. Get a pointer to the output vector, where string offsets
+are stored. */
 
 ovector = pcre2_get_ovector_pointer(match_data);
 printf("Match succeeded at offset %d\en", (int)ovector[0]);
@@ -234,9 +234,12 @@
 if (rc == 0)
   printf("ovector was not big enough for all the captured substrings\en");
 
-/* We must guard against patterns such as /(?=.\eK)/ that use \eK in an assertion
-to set the start of a match later than its end. In this demonstration program,
-we just detect this case and give up. */
+/* Since release 10.38 PCRE2 has locked out the use of \eK in lookaround
+assertions. However, there is an option to re-enable the old behaviour. If that
+is set, it is possible to run patterns such as /(?=.\eK)/ that use \eK in an
+assertion to set the start of a match later than its end. In this demonstration
+program, we show how to detect this case, but it shouldn't arise because the
+option is never set. */
 
 if (ovector[0] > ovector[1])
   {
@@ -453,7 +456,7 @@
     return 1;
     }
 
-  /* Match succeded */
+  /* Match succeeded */
 
   printf("\enMatch succeeded again at offset %d\en", (int)ovector[0]);
 
diff --git a/dist2/doc/pcre2grep.1 b/doc/pcre2grep.1
similarity index 98%
rename from dist2/doc/pcre2grep.1
rename to doc/pcre2grep.1
index 66377ce..1081591 100644
--- a/dist2/doc/pcre2grep.1
+++ b/doc/pcre2grep.1
@@ -1,4 +1,4 @@
-.TH PCRE2GREP 1 "04 October 2020" "PCRE2 10.36"
+.TH PCRE2GREP 1 "31 August 2021" "PCRE2 10.38"
 .SH NAME
 pcre2grep - a grep with Perl-compatible regular expressions.
 .SH SYNOPSIS
@@ -157,6 +157,11 @@
 Treat binary files as text. This is equivalent to
 \fB--binary-files\fP=\fItext\fP.
 .TP
+\fB--allow-lookaround-bsk\fP
+PCRE2 now forbids the use of \eK in lookarounds by default, in line with Perl.
+This option causes \fBpcre2grep\fP to set the PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+option, which enables this somewhat dangerous usage.
+.TP
 \fB-B\fP \fInumber\fP, \fB--before-context=\fP\fInumber\fP
 Output up to \fInumber\fP lines of context before each matching line. Fewer
 lines are output if the previous match or the start of the file is within
@@ -946,7 +951,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -955,6 +960,6 @@
 .rs
 .sp
 .nf
-Last updated: 04 October 2020
-Copyright (c) 1997-2020 University of Cambridge.
+Last updated: 31 August 2021
+Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/doc/pcre2grep.txt b/doc/pcre2grep.txt
new file mode 100644
index 0000000..8e9c757
--- /dev/null
+++ b/doc/pcre2grep.txt
@@ -0,0 +1,1026 @@
+PCRE2GREP(1)                General Commands Manual               PCRE2GREP(1)
+
+
+
+NAME
+       pcre2grep - a grep with Perl-compatible regular expressions.
+
+SYNOPSIS
+       pcre2grep [options] [long options] [pattern] [path1 path2 ...]
+
+
+DESCRIPTION
+
+       pcre2grep  searches  files  for  character patterns, in the same way as
+       other grep commands do, but it uses the PCRE2  regular  expression  li-
+       brary  to support patterns that are compatible with the regular expres-
+       sions of Perl 5. See pcre2syntax(3) for a  quick-reference  summary  of
+       pattern syntax, or pcre2pattern(3) for a full description of the syntax
+       and semantics of the regular expressions that PCRE2 supports.
+
+       Patterns, whether supplied on the command line or in a  separate  file,
+       are given without delimiters. For example:
+
+         pcre2grep Thursday /etc/motd
+
+       If you attempt to use delimiters (for example, by surrounding a pattern
+       with slashes, as is common in Perl scripts), they  are  interpreted  as
+       part  of  the pattern. Quotes can of course be used to delimit patterns
+       on the command line because they are interpreted by the shell, and  in-
+       deed  quotes  are  required  if a pattern contains white space or shell
+       metacharacters.
+
+       The first argument that follows any option settings is treated  as  the
+       single  pattern  to be matched when neither -e nor -f is present.  Con-
+       versely, when one or both of these options are  used  to  specify  pat-
+       terns, all arguments are treated as path names. At least one of -e, -f,
+       or an argument pattern must be provided.
+
+       If no files are specified, pcre2grep  reads  the  standard  input.  The
+       standard  input can also be referenced by a name consisting of a single
+       hyphen.  For example:
+
+         pcre2grep some-pattern file1 - file3
+
+       Input files are searched line by  line.  By  default,  each  line  that
+       matches  a  pattern  is  copied to the standard output, and if there is
+       more than one file, the file name is output at the start of each  line,
+       followed  by  a  colon.  However, there are options that can change how
+       pcre2grep behaves. In particular, the -M option makes  it  possible  to
+       search  for  strings  that  span  line  boundaries. What defines a line
+       boundary is controlled by the -N (--newline) option.
+
+       The amount of memory used for buffering files that are being scanned is
+       controlled  by  parameters  that  can  be  set by the --buffer-size and
+       --max-buffer-size options. The first of these sets the size  of  buffer
+       that  is obtained at the start of processing. If an input file contains
+       very long lines, a larger buffer may be needed; this is handled by  au-
+       tomatically  extending  the buffer, up to the limit specified by --max-
+       buffer-size. The default values for these parameters can  be  set  when
+       pcre2grep  is  built;  if nothing is specified, the defaults are set to
+       20KiB and 1MiB respectively. An error occurs if a line is too long  and
+       the buffer can no longer be expanded.
+
+       The  block  of  memory that is actually used is three times the "buffer
+       size", to allow for buffering "before" and "after" lines. If the buffer
+       size  is too small, fewer than requested "before" and "after" lines may
+       be output.
+
+       Patterns can be no longer than 8KiB or BUFSIZ bytes, whichever  is  the
+       greater.   BUFSIZ  is defined in <stdio.h>. When there is more than one
+       pattern (specified by the use of -e and/or -f), each pattern is applied
+       to  each  line  in the order in which they are defined, except that all
+       the -e patterns are tried before the -f patterns.
+
+       By default, as soon as one pattern matches a line, no further  patterns
+       are considered. However, if --colour (or --color) is used to colour the
+       matching substrings, or if --only-matching, --file-offsets, or  --line-
+       offsets  is  used to output only the part of the line that matched (ei-
+       ther shown literally, or as an offset),  scanning  resumes  immediately
+       following  the  match,  so that further matches on the same line can be
+       found. If there are multiple patterns, they are all tried  on  the  re-
+       mainder  of the line, but patterns that follow the one that matched are
+       not tried on the earlier matched part of the line.
+
+       This behaviour means that the order  in  which  multiple  patterns  are
+       specified  can affect the output when one of the above options is used.
+       This is no longer the same behaviour as GNU grep, which now manages  to
+       display  earlier  matches  for  later  patterns (as long as there is no
+       overlap).
+
+       Patterns that can match an empty string are accepted, but empty  string
+       matches   are  never  recognized.  An  example  is  the  pattern  "(su-
+       per)?(man)?", in which all components are optional. This pattern  finds
+       all  occurrences  of  both  "super"  and "man"; the output differs from
+       matching with "super|man" when only the matching substrings  are  being
+       shown.
+
+       If  the  LC_ALL or LC_CTYPE environment variable is set, pcre2grep uses
+       the value to set a locale when calling the PCRE2 library.  The --locale
+       option can be used to override this.
+
+
+SUPPORT FOR COMPRESSED FILES
+
+       It  is  possible to compile pcre2grep so that it uses libz or libbz2 to
+       read compressed files whose names end in .gz or .bz2, respectively. You
+       can  find out whether your pcre2grep binary has support for one or both
+       of these file types by running it with the --help option. If the appro-
+       priate support is not present, all files are treated as plain text. The
+       standard input is always so treated. When input is  from  a  compressed
+       .gz or .bz2 file, the --line-buffered option is ignored.
+
+
+BINARY FILES
+
+       By  default,  a  file that contains a binary zero byte within the first
+       1024 bytes is identified as a binary file, and is processed  specially.
+       However,  if  the  newline  type is specified as NUL, that is, the line
+       terminator is a binary zero, the test for a binary file is not applied.
+       See  the  --binary-files  option for a means of changing the way binary
+       files are handled.
+
+
+BINARY ZEROS IN PATTERNS
+
+       Patterns passed from the command line are strings that  are  terminated
+       by  a  binary zero, so cannot contain internal zeros. However, patterns
+       that are read from a file via the -f option may contain binary zeros.
+
+
+OPTIONS
+
+       The order in which some of the options appear can  affect  the  output.
+       For  example,  both  the  -H and -l options affect the printing of file
+       names. Whichever comes later in the command line will be the  one  that
+       takes  effect.  Similarly,  except  where  noted below, if an option is
+       given twice, the later setting is used. Numerical  values  for  options
+       may  be  followed  by  K  or  M,  to  signify multiplication by 1024 or
+       1024*1024 respectively.
+
+       --        This terminates the list of options. It is useful if the next
+                 item  on  the command line starts with a hyphen but is not an
+                 option. This allows for the processing of patterns  and  file
+                 names that start with hyphens.
+
+       -A number, --after-context=number
+                 Output  up  to  number  lines  of context after each matching
+                 line. Fewer lines are output if the next match or the end  of
+                 the  file  is  reached,  or if the processing buffer size has
+                 been set too small. If file names and/or line numbers are be-
+                 ing output, a hyphen separator is used instead of a colon for
+                 the context lines. A line containing "--" is  output  between
+                 each  group  of  lines, unless they are in fact contiguous in
+                 the input file. The value of number is expected to  be  rela-
+                 tively small. When -c is used, -A is ignored.
+
+       -a, --text
+                 Treat  binary  files as text. This is equivalent to --binary-
+                 files=text.
+
+       --allow-lookaround-bsk
+                 PCRE2 now forbids the use of \K in lookarounds by default, in
+                 line  with  Perl.   This  option  causes pcre2grep to set the
+                 PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK option, which  enables  this
+                 somewhat dangerous usage.
+
+       -B number, --before-context=number
+                 Output  up  to  number  lines of context before each matching
+                 line. Fewer lines are output if the  previous  match  or  the
+                 start  of the file is within number lines, or if the process-
+                 ing buffer size has been set too small. If file names  and/or
+                 line numbers are being output, a hyphen separator is used in-
+                 stead of a colon for the context  lines.  A  line  containing
+                 "--"  is  output between each group of lines, unless they are
+                 in fact contiguous in the input file. The value of number  is
+                 expected  to  be relatively small. When -c is used, -B is ig-
+                 nored.
+
+       --binary-files=word
+                 Specify how binary files are to be processed. If the word  is
+                 "binary"  (the default), pattern matching is performed on bi-
+                 nary files, but  the  only  output  is  "Binary  file  <name>
+                 matches"  when a match succeeds. If the word is "text", which
+                 is equivalent to the -a or --text option,  binary  files  are
+                 processed  in  the  same way as any other file. In this case,
+                 when a match succeeds, the  output  may  be  binary  garbage,
+                 which  can  have  nasty effects if sent to a terminal. If the
+                 word is "without-match", which is equivalent to  the  -I  op-
+                 tion, binary files are not processed at all; they are assumed
+                 not to be of interest and are  skipped  without  causing  any
+                 output or affecting the return code.
+
+       --buffer-size=number
+                 Set  the  parameter that controls how much memory is obtained
+                 at the start of processing for buffering files that are being
+                 scanned. See also --max-buffer-size below.
+
+       -C number, --context=number
+                 Output  number  lines  of  context both before and after each
+                 matching line.  This is equivalent to setting both -A and  -B
+                 to the same value.
+
+       -c, --count
+                 Do  not  output  lines from the files that are being scanned;
+                 instead output the number  of  lines  that  would  have  been
+                 shown, either because they matched, or, if -v is set, because
+                 they failed to match. By default, this count is  exactly  the
+                 same  as the number of lines that would have been output, but
+                 if the -M (multiline) option is used (without -v), there  may
+                 be  more suppressed lines than the count (that is, the number
+                 of matches).
+
+                 If no lines are selected, the number zero is output. If  sev-
+                 eral  files are are being scanned, a count is output for each
+                 of them and the -t option can be used to cause a total to  be
+                 output  at  the end. However, if the --files-with-matches op-
+                 tion is also used, only those files whose counts are  greater
+                 than zero are listed. When -c is used, the -A, -B, and -C op-
+                 tions are ignored.
+
+       --colour, --color
+                 If this option is given without any data, it is equivalent to
+                 "--colour=auto".   If  data  is required, it must be given in
+                 the same shell item, separated by an equals sign.
+
+       --colour=value, --color=value
+                 This option specifies under what circumstances the parts of a
+                 line that matched a pattern should be coloured in the output.
+                 By default, the output is not coloured. The value  (which  is
+                 optional,  see above) may be "never", "always", or "auto". In
+                 the latter case, colouring happens only if the standard  out-
+                 put  is connected to a terminal. More resources are used when
+                 colouring is enabled, because pcre2grep has to search for all
+                 possible  matches in a line, not just one, in order to colour
+                 them all.
+
+                 The colour that is used can be specified by  setting  one  of
+                 the  environment variables PCRE2GREP_COLOUR, PCRE2GREP_COLOR,
+                 PCREGREP_COLOUR, or PCREGREP_COLOR, which are checked in that
+                 order.  If  none  of  these  are  set,  pcre2grep  looks  for
+                 GREP_COLORS or GREP_COLOR (in that order). The value  of  the
+                 variable  should  be  a string of two numbers, separated by a
+                 semicolon, except in the  case  of  GREP_COLORS,  which  must
+                 start with "ms=" or "mt=" followed by two semicolon-separated
+                 colours, terminated by the end of the string or by  a  colon.
+                 If  GREP_COLORS  does not start with "ms=" or "mt=" it is ig-
+                 nored, and GREP_COLOR is checked.
+
+                 If the string obtained from one of the above  variables  con-
+                 tains any characters other than semicolon or digits, the set-
+                 ting is ignored and the default colour is used. The string is
+                 copied directly into the control string for setting colour on
+                 a terminal, so it is your responsibility to ensure  that  the
+                 values  make  sense.  If  no relevant environment variable is
+                 set, the default is "1;31", which gives red.
+
+       -D action, --devices=action
+                 If an input path is not a regular file or a  directory,  "ac-
+                 tion"  specifies  how it is to be processed. Valid values are
+                 "read" (the default) or "skip" (silently skip the path).
+
+       -d action, --directories=action
+                 If an input path is a directory, "action" specifies how it is
+                 to  be  processed.   Valid  values are "read" (the default in
+                 non-Windows environments, for compatibility with  GNU  grep),
+                 "recurse"  (equivalent to the -r option), or "skip" (silently
+                 skip the path, the default in Windows environments).  In  the
+                 "read"  case,  directories  are read as if they were ordinary
+                 files. In some operating systems the effect of reading a  di-
+                 rectory  like  this is an immediate end-of-file; in others it
+                 may provoke an error.
+
+       --depth-limit=number
+                 See --match-limit below.
+
+       -e pattern, --regex=pattern, --regexp=pattern
+                 Specify a pattern to be matched. This option can be used mul-
+                 tiple times in order to specify several patterns. It can also
+                 be used as a way of specifying a single pattern  that  starts
+                 with  a hyphen. When -e is used, no argument pattern is taken
+                 from the command line; all  arguments  are  treated  as  file
+                 names.  There is no limit to the number of patterns. They are
+                 applied to each line in the order in which they  are  defined
+                 until one matches.
+
+                 If  -f is used with -e, the command line patterns are matched
+                 first, followed by the patterns from the file(s), independent
+                 of  the order in which these options are specified. Note that
+                 multiple use of -e is not the same as a single  pattern  with
+                 alternatives. For example, X|Y finds the first character in a
+                 line that is X or Y, whereas if the two  patterns  are  given
+                 separately, with X first, pcre2grep finds X if it is present,
+                 even if it follows Y in the line. It finds Y only if there is
+                 no  X  in  the line. This matters only if you are using -o or
+                 --colo(u)r to show the part(s) of the line that matched.
+
+       --exclude=pattern
+                 Files (but not directories) whose names match the pattern are
+                 skipped  without  being processed. This applies to all files,
+                 whether listed on the command  line,  obtained  from  --file-
+                 list, or by scanning a directory. The pattern is a PCRE2 reg-
+                 ular expression, and is matched against the  final  component
+                 of the file name, not the entire path. The -F, -w, and -x op-
+                 tions do not apply to this pattern. The option may  be  given
+                 any number of times in order to specify multiple patterns. If
+                 a file name matches both an --include and an  --exclude  pat-
+                 tern, it is excluded. There is no short form for this option.
+
+       --exclude-from=filename
+                 Treat  each  non-empty  line  of  the file as the data for an
+                 --exclude option. What constitutes a newline when reading the
+                 file  is the operating system's default. The --newline option
+                 has no effect on this option. This option may be  given  more
+                 than once in order to specify a number of files to read.
+
+       --exclude-dir=pattern
+                 Directories whose names match the pattern are skipped without
+                 being processed, whatever the setting of the --recursive  op-
+                 tion.  This applies to all directories, whether listed on the
+                 command line, obtained from --file-list,  or  by  scanning  a
+                 parent  directory. The pattern is a PCRE2 regular expression,
+                 and is matched against the final component of  the  directory
+                 name,  not the entire path. The -F, -w, and -x options do not
+                 apply to this pattern. The option may be given any number  of
+                 times  in order to specify more than one pattern. If a direc-
+                 tory matches both --include-dir and --exclude-dir, it is  ex-
+                 cluded. There is no short form for this option.
+
+       -F, --fixed-strings
+                 Interpret  each  data-matching  pattern  as  a  list of fixed
+                 strings, separated by newlines, instead of as a  regular  ex-
+                 pression. What constitutes a newline for this purpose is con-
+                 trolled by the --newline option. The -w (match as a word) and
+                 -x  (match whole line) options can be used with -F.  They ap-
+                 ply to each of the fixed strings. A line is selected  if  any
+                 of the fixed strings are found in it (subject to -w or -x, if
+                 present). This option applies only to the patterns  that  are
+                 matched  against  the contents of files; it does not apply to
+                 patterns specified by any of the --include or  --exclude  op-
+                 tions.
+
+       -f filename, --file=filename
+                 Read  patterns  from  the  file, one per line, and match them
+                 against each line of input. As is the case with  patterns  on
+                 the  command line, no delimiters should be used. What consti-
+                 tutes a newline when reading the file is the  operating  sys-
+                 tem's  default interpretation of \n. The --newline option has
+                 no effect on this option. Trailing  white  space  is  removed
+                 from  each  line,  and blank lines are ignored. An empty file
+                 contains no patterns and therefore matches nothing.  Patterns
+                 read  from a file in this way may contain binary zeros, which
+                 are treated as ordinary data characters. See  also  the  com-
+                 ments  about  multiple  patterns versus a single pattern with
+                 alternatives in the description of -e above.
+
+                 If this option is given more than  once,  all  the  specified
+                 files  are read. A data line is output if any of the patterns
+                 match it. A file name can be given as "-"  to  refer  to  the
+                 standard  input.  When  -f is used, patterns specified on the
+                 command line using -e may also be present;  they  are  tested
+                 before  the  file's  patterns.  However,  no other pattern is
+                 taken from the command line; all arguments are treated as the
+                 names of paths to be searched.
+
+       --file-list=filename
+                 Read  a  list  of  files  and/or  directories  that are to be
+                 scanned from the given file, one per line. What constitutes a
+                 newline  when  reading the file is the operating system's de-
+                 fault. Trailing white space is removed from  each  line,  and
+                 blank lines are ignored. These paths are processed before any
+                 that are listed on the command line. The  file  name  can  be
+                 given  as  "-"  to refer to the standard input. If --file and
+                 --file-list are both specified  as  "-",  patterns  are  read
+                 first.  This is useful only when the standard input is a ter-
+                 minal, from which further lines (the list of  files)  can  be
+                 read after an end-of-file indication. If this option is given
+                 more than once, all the specified files are read.
+
+       --file-offsets
+                 Instead of showing lines or parts of lines that  match,  show
+                 each  match  as  an  offset  from the start of the file and a
+                 length, separated by a comma. In this  mode,  no  context  is
+                 shown.  That  is,  the -A, -B, and -C options are ignored. If
+                 there is more than one match in a line, each of them is shown
+                 separately.  This option is mutually exclusive with --output,
+                 --line-offsets, and --only-matching.
+
+       -H, --with-filename
+                 Force the inclusion of the file name at the start  of  output
+                 lines when searching a single file. By default, the file name
+                 is not shown in this case.  For matching lines, the file name
+                 is followed by a colon; for context lines, a hyphen separator
+                 is used. If a line number is also being  output,  it  follows
+                 the  file  name. When the -M option causes a pattern to match
+                 more than one line, only the first is preceded  by  the  file
+                 name.  This  option  overrides any previous -h, -l, or -L op-
+                 tions.
+
+       -h, --no-filename
+                 Suppress the output file names when searching multiple files.
+                 By  default,  file  names  are  shown when multiple files are
+                 searched. For matching lines, the file name is followed by  a
+                 colon;  for  context lines, a hyphen separator is used.  If a
+                 line number is also being output, it follows the  file  name.
+                 This option overrides any previous -H, -L, or -l options.
+
+       --heap-limit=number
+                 See --match-limit below.
+
+       --help    Output  a  help  message, giving brief details of the command
+                 options and file type support, and then exit.  Anything  else
+                 on the command line is ignored.
+
+       -I        Ignore   binary   files.  This  is  equivalent  to  --binary-
+                 files=without-match.
+
+       -i, --ignore-case
+                 Ignore upper/lower case distinctions during comparisons.
+
+       --include=pattern
+                 If any --include patterns are specified, the only files  that
+                 are processed are those whose names match one of the patterns
+                 and do not match an --exclude pattern. This option  does  not
+                 affect  directories,  but  it  applies  to all files, whether
+                 listed on the command line, obtained from --file-list, or  by
+                 scanning  a directory. The pattern is a PCRE2 regular expres-
+                 sion, and is matched against the final component of the  file
+                 name,  not the entire path. The -F, -w, and -x options do not
+                 apply to this pattern. The option may be given any number  of
+                 times.  If a file name matches both an --include and an --ex-
+                 clude pattern, it is excluded.  There is no  short  form  for
+                 this option.
+
+       --include-from=filename
+                 Treat  each  non-empty  line  of  the file as the data for an
+                 --include option. What constitutes a newline for this purpose
+                 is  the  operating system's default. The --newline option has
+                 no effect on this option. This option may be given any number
+                 of times; all the files are read.
+
+       --include-dir=pattern
+                 If  any --include-dir patterns are specified, the only direc-
+                 tories that are processed are those whose names match one  of
+                 the  patterns and do not match an --exclude-dir pattern. This
+                 applies to all directories, whether  listed  on  the  command
+                 line,  obtained from --file-list, or by scanning a parent di-
+                 rectory. The pattern is a PCRE2 regular  expression,  and  is
+                 matched  against  the  final component of the directory name,
+                 not the entire path. The -F, -w, and -x options do not  apply
+                 to this pattern. The option may be given any number of times.
+                 If a directory matches both --include-dir and  --exclude-dir,
+                 it is excluded. There is no short form for this option.
+
+       -L, --files-without-match
+                 Instead  of  outputting lines from the files, just output the
+                 names of the files that do not contain any lines  that  would
+                 have  been  output. Each file name is output once, on a sepa-
+                 rate line. This option overrides any previous -H, -h,  or  -l
+                 options.
+
+       -l, --files-with-matches
+                 Instead  of  outputting lines from the files, just output the
+                 names of the files containing lines that would have been out-
+                 put.  Each  file  name  is  output  once, on a separate line.
+                 Searching normally stops as soon as a matching line is  found
+                 in  a  file.  However, if the -c (count) option is also used,
+                 matching continues in order to obtain the correct count,  and
+                 those  files  that  have  at least one match are listed along
+                 with their counts. Using this option with -c is a way of sup-
+                 pressing  the  listing  of  files with no matches that occurs
+                 with -c on its own. This option overrides  any  previous  -H,
+                 -h, or -L options.
+
+       --label=name
+                 This option supplies a name to be used for the standard input
+                 when file names are being output. If not supplied, "(standard
+                 input)" is used. There is no short form for this option.
+
+       --line-buffered
+                 When  this  option is given, non-compressed input is read and
+                 processed line by line, and the output is flushed after  each
+                 write.  By  default,  input  is  read in large chunks, unless
+                 pcre2grep can determine that it is reading from  a  terminal,
+                 which is currently possible only in Unix-like environments or
+                 Windows. Output to terminal is normally automatically flushed
+                 by  the  operating system. This option can be useful when the
+                 input or output is attached to a pipe and  you  do  not  want
+                 pcre2grep  to  buffer up large amounts of data.  However, its
+                 use will affect performance, and the  -M  (multiline)  option
+                 ceases  to  work. When input is from a compressed .gz or .bz2
+                 file, --line-buffered is ignored.
+
+       --line-offsets
+                 Instead of showing lines or parts of lines that  match,  show
+                 each match as a line number, the offset from the start of the
+                 line, and a length. The line number is terminated by a  colon
+                 (as  usual; see the -n option), and the offset and length are
+                 separated by a comma. In this  mode,  no  context  is  shown.
+                 That  is, the -A, -B, and -C options are ignored. If there is
+                 more than one match in a line, each of them  is  shown  sepa-
+                 rately.  This  option  is  mutually  exclusive with --output,
+                 --file-offsets, and --only-matching.
+
+       --locale=locale-name
+                 This option specifies a locale to be used for pattern  match-
+                 ing.  It  overrides the value in the LC_ALL or LC_CTYPE envi-
+                 ronment variables. If no locale is specified, the  PCRE2  li-
+                 brary's default (usually the "C" locale) is used. There is no
+                 short form for this option.
+
+       -M, --multiline
+                 Allow patterns to match more than one line. When this  option
+                 is set, the PCRE2 library is called in "multiline" mode. This
+                 allows a matched string to extend past the end of a line  and
+                 continue  on one or more subsequent lines. Patterns used with
+                 -M may usefully contain literal newline characters and inter-
+                 nal  occurrences of ^ and $ characters. The output for a suc-
+                 cessful match may consist of more than one  line.  The  first
+                 line  is  the  line  in which the match started, and the last
+                 line is the line in which the match  ended.  If  the  matched
+                 string  ends  with a newline sequence, the output ends at the
+                 end of that line.  If -v is set,  none  of  the  lines  in  a
+                 multi-line  match  are output. Once a match has been handled,
+                 scanning restarts at the beginning of the line after the  one
+                 in which the match ended.
+
+                 The  newline  sequence  that separates multiple lines must be
+                 matched as part of the pattern.  For  example,  to  find  the
+                 phrase  "regular  expression" in a file where "regular" might
+                 be at the end of a line and "expression" at the start of  the
+                 next line, you could use this command:
+
+                   pcre2grep -M 'regular\s+expression' <file>
+
+                 The \s escape sequence matches any white space character, in-
+                 cluding newlines, and is followed by + so as to match  trail-
+                 ing  white  space  on the first line as well as possibly han-
+                 dling a two-character newline sequence.
+
+                 There is a limit to the number of lines that can be  matched,
+                 imposed  by  the way that pcre2grep buffers the input file as
+                 it scans it. With a  sufficiently  large  processing  buffer,
+                 this should not be a problem, but the -M option does not work
+                 when input is read line by line (see --line-buffered.)
+
+       -m number, --max-count=number
+                 Stop processing after finding number matching lines, or  non-
+                 matching  lines if -v is also set. Any trailing context lines
+                 are output after the final match.  In  multiline  mode,  each
+                 multiline  match counts as just one line for this purpose. If
+                 this limit is reached when reading the standard input from  a
+                 regular file, the file is left positioned just after the last
+                 matching line.  If -c is also set, the count that  is  output
+                 is  never  greater  than number. This option has no effect if
+                 used with -L, -l, or -q, or when just checking for a match in
+                 a binary file.
+
+       --match-limit=number
+                 Processing  some  regular expression patterns may take a very
+                 long time to search for all possible matching strings. Others
+                 may  require  a  very large amount of memory. There are three
+                 options that set resource limits for matching.
+
+                 The --match-limit option provides a means of limiting comput-
+                 ing  resource usage when processing patterns that are not go-
+                 ing to match, but which have a very large number of possibil-
+                 ities in their search trees. The classic example is a pattern
+                 that uses nested unlimited repeats. Internally, PCRE2  has  a
+                 counter  that  is  incremented each time around its main pro-
+                 cessing loop. If the value set by --match-limit  is  reached,
+                 an error occurs.
+
+                 The  --heap-limit  option specifies, as a number of kibibytes
+                 (units of 1024 bytes), the amount of heap memory that may  be
+                 used for matching. Heap memory is needed only if matching the
+                 pattern requires a significant number of nested  backtracking
+                 points to be remembered. This parameter can be set to zero to
+                 forbid the use of heap memory altogether.
+
+                 The --depth-limit option limits the  depth  of  nested  back-
+                 tracking points, which indirectly limits the amount of memory
+                 that is used. The amount of memory needed for each backtrack-
+                 ing  point  depends on the number of capturing parentheses in
+                 the pattern, so the amount of memory that is used before this
+                 limit  acts  varies from pattern to pattern. This limit is of
+                 use only if it is set smaller than --match-limit.
+
+                 There are no short forms for these options. The default  lim-
+                 its  can  be  set when the PCRE2 library is compiled; if they
+                 are not specified, the defaults are very large and so  effec-
+                 tively unlimited.
+
+       --max-buffer-size=number
+                 This  limits  the  expansion  of the processing buffer, whose
+                 initial size can be set by --buffer-size. The maximum  buffer
+                 size  is  silently  forced to be no smaller than the starting
+                 buffer size.
+
+       -N newline-type, --newline=newline-type
+                 Six different conventions for indicating the ends of lines in
+                 scanned files are supported. For example:
+
+                   pcre2grep -N CRLF 'some pattern' <file>
+
+                 The  newline  type may be specified in upper, lower, or mixed
+                 case. If the newline type is NUL, lines are separated by  bi-
+                 nary  zero characters. The other types are the single-charac-
+                 ter sequences CR (carriage return)  and  LF  (linefeed),  the
+                 two-character  sequence CRLF, an "anycrlf" type, which recog-
+                 nizes any of the preceding three types, and  an  "any"  type,
+                 for  which any Unicode line ending sequence is assumed to end
+                 a line. The Unicode sequences are the three  just  mentioned,
+                 plus  VT  (vertical tab, U+000B), FF (form feed, U+000C), NEL
+                 (next line, U+0085), LS  (line  separator,  U+2028),  and  PS
+                 (paragraph separator, U+2029).
+
+                 When  the  PCRE2  library is built, a default line-ending se-
+                 quence is specified.  This is normally the standard  sequence
+                 for  the operating system. Unless otherwise specified by this
+                 option, pcre2grep uses the library's default.
+
+                 This option makes it possible to use pcre2grep to scan  files
+                 that have come from other environments without having to mod-
+                 ify their line endings. If the data  that  is  being  scanned
+                 does  not  agree  with  the  convention  set  by this option,
+                 pcre2grep may behave in strange ways. Note that  this  option
+                 does  not apply to files specified by the -f, --exclude-from,
+                 or --include-from options, which are expected to use the  op-
+                 erating system's standard newline sequence.
+
+       -n, --line-number
+                 Precede each output line by its line number in the file, fol-
+                 lowed by a colon for matching lines or a hyphen  for  context
+                 lines. If the file name is also being output, it precedes the
+                 line number. When the -M option causes  a  pattern  to  match
+                 more  than  one  line, only the first is preceded by its line
+                 number. This option is forced if --line-offsets is used.
+
+       --no-jit  If the PCRE2 library is built with support  for  just-in-time
+                 compiling (which speeds up matching), pcre2grep automatically
+                 makes use of this, unless it was explicitly disabled at build
+                 time.  This  option  can be used to disable the use of JIT at
+                 run time. It is provided for testing and working round  prob-
+                 lems.  It should never be needed in normal use.
+
+       -O text, --output=text
+                 When  there  is  a match, instead of outputting the line that
+                 matched, output just the text specified in this option,  fol-
+                 lowed  by an operating-system standard newline. In this mode,
+                 no context is shown. That is, the -A, -B, and -C options  are
+                 ignored.  The  --newline option has no effect on this option,
+                 which is mutually exclusive with --only-matching, --file-off-
+                 sets,  and  --line-offsets. However, like --only-matching, if
+                 there is more than one match in a line, each of them causes a
+                 line of output.
+
+                 Escape sequences starting with a dollar character may be used
+                 to insert the contents of the matched part of the line and/or
+                 captured substrings into the text.
+
+                 $<digits>  or  ${<digits>}  is  replaced by the captured sub-
+                 string of the given  decimal  number;  zero  substitutes  the
+                 whole match. If the number is greater than the number of cap-
+                 turing substrings, or if the capture is unset,  the  replace-
+                 ment is empty.
+
+                 $a  is replaced by bell; $b by backspace; $e by escape; $f by
+                 form feed; $n by newline; $r by carriage return; $t  by  tab;
+                 $v by vertical tab.
+
+                 $o<digits> or $o{<digits>} is replaced by the character whose
+                 code point is the given octal number. In the first  form,  up
+                 to  three  octal  digits are processed.  When more digits are
+                 needed in Unicode mode to specify a wide character, the  sec-
+                 ond form must be used.
+
+                 $x<digits>  or $x{<digits>} is replaced by the character rep-
+                 resented by the given hexadecimal number. In the first  form,
+                 up  to two hexadecimal digits are processed. When more digits
+                 are needed in Unicode mode to specify a wide  character,  the
+                 second form must be used.
+
+                 Any  other character is substituted by itself. In particular,
+                 $$ is replaced by a single dollar.
+
+       -o, --only-matching
+                 Show only the part of the line that matched a pattern instead
+                 of  the  whole  line. In this mode, no context is shown. That
+                 is, the -A, -B, and -C options are ignored. If there is  more
+                 than  one  match in a line, each of them is shown separately,
+                 on a separate line of output. If -o is combined with -v  (in-
+                 vert  the  sense of the match to find non-matching lines), no
+                 output is generated, but the return  code  is  set  appropri-
+                 ately.  If  the matched portion of the line is empty, nothing
+                 is output unless the file  name  or  line  number  are  being
+                 printed,  in  which case they are shown on an otherwise empty
+                 line.  This  option  is  mutually  exclusive  with  --output,
+                 --file-offsets and --line-offsets.
+
+       -onumber, --only-matching=number
+                 Show  only  the  part  of the line that matched the capturing
+                 parentheses of the given number. Up to 50 capturing parenthe-
+                 ses  are  supported by default. This limit can be changed via
+                 the --om-capture option. A pattern may contain any number  of
+                 capturing  parentheses, but only those whose number is within
+                 the limit can be accessed by -o. An error occurs if the  num-
+                 ber specified by -o is greater than the limit.
+
+                 -o0 is the same as -o without a number. Because these options
+                 can be given without an argument (see above), if an  argument
+                 is  present, it must be given in the same shell item, for ex-
+                 ample, -o3 or --only-matching=2. The comments given  for  the
+                 non-argument  case  above  also  apply to this option. If the
+                 specified capturing parentheses do not exist in the  pattern,
+                 or  were  not  set in the match, nothing is output unless the
+                 file name or line number are being output.
+
+                 If this option is given multiple times,  multiple  substrings
+                 are  output  for  each  match,  in  the order the options are
+                 given, and all on one line. For example, -o3 -o1  -o3  causes
+                 the  substrings  matched by capturing parentheses 3 and 1 and
+                 then 3 again to be output. By default, there is no  separator
+                 (but see the next but one option).
+
+       --om-capture=number
+                 Set  the number of capturing parentheses that can be accessed
+                 by -o. The default is 50.
+
+       --om-separator=text
+                 Specify a separating string for multiple occurrences  of  -o.
+                 The  default is an empty string. Separating strings are never
+                 coloured.
+
+       -q, --quiet
+                 Work quietly, that is, display nothing except error messages.
+                 The  exit  status  indicates  whether or not any matches were
+                 found.
+
+       -r, --recursive
+                 If any given path is a directory, recursively scan the  files
+                 it  contains, taking note of any --include and --exclude set-
+                 tings. By default, a directory is read as a normal  file;  in
+                 some  operating  systems this gives an immediate end-of-file.
+                 This option is a shorthand for setting the -d option to  "re-
+                 curse".
+
+       --recursion-limit=number
+                 This  is  an obsolete synonym for --depth-limit. See --match-
+                 limit above for details.
+
+       -s, --no-messages
+                 Suppress error  messages  about  non-existent  or  unreadable
+                 files.  Such  files  are quietly skipped. However, the return
+                 code is still 2, even if matches were found in other files.
+
+       -t, --total-count
+                 This option is useful when scanning more than  one  file.  If
+                 used  on its own, -t suppresses all output except for a grand
+                 total number of matching lines (or non-matching lines  if  -v
+                 is used) in all the files. If -t is used with -c, a grand to-
+                 tal is output except when the previous  output  is  just  one
+                 line.  In  other words, it is not output when just one file's
+                 count is listed. If file names are being  output,  the  grand
+                 total  is preceded by "TOTAL:". Otherwise, it appears as just
+                 another number. The -t option is ignored when  used  with  -L
+                 (list  files  without matches), because the grand total would
+                 always be zero.
+
+       -u, --utf Operate in UTF-8 mode. This option is available only if PCRE2
+                 has been compiled with UTF-8 support. All patterns (including
+                 those for any --exclude and --include options) and all  lines
+                 that  are  scanned must be valid strings of UTF-8 characters.
+                 If an invalid UTF-8 string is encountered, an error occurs.
+
+       -U, --utf-allow-invalid
+                 As --utf, but in addition subject lines may  contain  invalid
+                 UTF-8  code  unit sequences. These can never form part of any
+                 pattern match. Patterns themselves, however,  must  still  be
+                 valid UTF-8 strings. This facility allows valid UTF-8 strings
+                 to be sought within arbitrary byte sequences in executable or
+                 other  binary  files. For more details about matching in non-
+                 valid UTF-8 strings, see the pcre2unicode(3) documentation.
+
+       -V, --version
+                 Write the version numbers of pcre2grep and the PCRE2  library
+                 to  the  standard  output and then exit. Anything else on the
+                 command line is ignored.
+
+       -v, --invert-match
+                 Invert the sense of the match, so that  lines  which  do  not
+                 match  any  of the patterns are the ones that are found. When
+                 this option is  set,  options  such  as  --only-matching  and
+                 --output,  which specify parts of a match that are to be out-
+                 put, are ignored.
+
+       -w, --word-regex, --word-regexp
+                 Force the patterns only to match "words". That is, there must
+                 be  a  word  boundary  at  the  start and end of each matched
+                 string. This is equivalent to having "\b(?:" at the start  of
+                 each  pattern, and ")\b" at the end. This option applies only
+                 to the patterns that are  matched  against  the  contents  of
+                 files;  it does not apply to patterns specified by any of the
+                 --include or --exclude options.
+
+       -x, --line-regex, --line-regexp
+                 Force the patterns to start matching only at  the  beginnings
+                 of  lines,  and  in  addition,  require  them to match entire
+                 lines. In multiline mode the match may be more than one line.
+                 This is equivalent to having "^(?:" at the start of each pat-
+                 tern and ")$" at the end. This option  applies  only  to  the
+                 patterns  that  are matched against the contents of files; it
+                 does not apply to patterns specified by any of the  --include
+                 or --exclude options.
+
+
+ENVIRONMENT VARIABLES
+
+       The environment variables LC_ALL and LC_CTYPE are examined, in that or-
+       der, for a locale. The first one that is set is used. This can be over-
+       ridden by the --locale option. If no locale is set, the PCRE2 library's
+       default (usually the "C" locale) is used.
+
+
+NEWLINES
+
+       The -N (--newline) option allows pcre2grep to scan files  with  newline
+       conventions  that differ from the default. This option affects only the
+       way scanned files are processed. It does not affect the  interpretation
+       of  files  specified  by  the -f, --file-list, --exclude-from, or --in-
+       clude-from options.
+
+       Any parts of the scanned input files that are written to  the  standard
+       output  are copied with whatever newline sequences they have in the in-
+       put. However, if the final line of a file is output, and  it  does  not
+       end  with  a newline sequence, a newline sequence is added. If the new-
+       line setting is CR, LF, CRLF or NUL, that line ending  is  output;  for
+       the other settings (ANYCRLF or ANY) a single NL is used.
+
+       The  newline  setting does not affect the way in which pcre2grep writes
+       newlines in informational messages to the  standard  output  and  error
+       streams.   Under  Windows,  the standard output is set to be binary, so
+       that "\r\n" at the ends of output lines that are copied from the  input
+       is  not converted to "\r\r\n" by the C I/O library. This means that any
+       messages written to the standard output must end with "\r\n".  For  all
+       other  operating  systems,  and  for all messages to the standard error
+       stream, "\n" is used.
+
+
+OPTIONS COMPATIBILITY
+
+       Many of the short and long forms of pcre2grep's options are the same as
+       in  the GNU grep program. Any long option of the form --xxx-regexp (GNU
+       terminology) is also available as --xxx-regex (PCRE2 terminology). How-
+       ever,  the  --depth-limit,  --file-list,  --file-offsets, --heap-limit,
+       --include-dir, --line-offsets, --locale,  --match-limit,  -M,  --multi-
+       line,  -N,  --newline,  --om-separator,  --output,  -u,  --utf, -U, and
+       --utf-allow-invalid options are specific to pcre2grep, as is the use of
+       the --only-matching option with a capturing parentheses number.
+
+       Although  most  of the common options work the same way, a few are dif-
+       ferent in pcre2grep. For example, the --include option's argument is  a
+       glob  for GNU grep, but a regular expression for pcre2grep. If both the
+       -c and -l options are given, GNU grep lists only  file  names,  without
+       counts, but pcre2grep gives the counts as well.
+
+
+OPTIONS WITH DATA
+
+       There are four different ways in which an option with data can be spec-
+       ified.  If a short form option is used, the  data  may  follow  immedi-
+       ately, or (with one exception) in the next command line item. For exam-
+       ple:
+
+         -f/some/file
+         -f /some/file
+
+       The exception is the -o option, which may appear with or without  data.
+       Because  of this, if data is present, it must follow immediately in the
+       same item, for example -o3.
+
+       If a long form option is used, the data may appear in the same  command
+       line  item,  separated by an equals character, or (with two exceptions)
+       it may appear in the next command line item. For example:
+
+         --file=/some/file
+         --file /some/file
+
+       Note, however, that if you want to supply a file name beginning with  ~
+       as  data  in a shell command, and have the shell expand ~ to a home di-
+       rectory, you must separate the file name from the option,  because  the
+       shell does not treat ~ specially unless it is at the start of an item.
+
+       The  exceptions  to the above are the --colour (or --color) and --only-
+       matching options, for which the data is optional. If one of  these  op-
+       tions  does  have  data,  it  must be given in the first form, using an
+       equals character. Otherwise pcre2grep will assume that it has no data.
+
+
+USING PCRE2'S CALLOUT FACILITY
+
+       pcre2grep has, by default, support for  calling  external  programs  or
+       scripts  or  echoing  specific strings during matching by making use of
+       PCRE2's callout facility. However, this support can  be  completely  or
+       partially  disabled  when  pcre2grep is built. You can find out whether
+       your binary has support for callouts by running it with the --help  op-
+       tion.  If  callout support is completely disabled, all callouts in pat-
+       terns are ignored by pcre2grep.  If the facility is partially disabled,
+       calling  external  programs is not supported, and callouts that request
+       it are ignored.
+
+       A callout in a PCRE2 pattern is of the form (?C<arg>) where  the  argu-
+       ment  is either a number or a quoted string (see the pcre2callout docu-
+       mentation for details). Numbered callouts  are  ignored  by  pcre2grep;
+       only callouts with string arguments are useful.
+
+   Echoing a specific string
+
+       Starting  the  callout  string with a pipe character invokes an echoing
+       facility that avoids calling an external program or script. This facil-
+       ity  is  always  available,  provided that callouts were not completely
+       disabled when pcre2grep was built. The rest of the  callout  string  is
+       processed  as  a zero-terminated string, which means it should not con-
+       tain any internal binary zeros. It is written  to  the  output,  having
+       first  been  passed through the same escape processing as text from the
+       --output (-O) option (see above). However, $0 cannot be used to  insert
+       a  matched  substring  because the match is still in progress. Instead,
+       the single character '0' is inserted. Any syntax errors in  the  string
+       (for  example,  a  dollar not followed by another character) causes the
+       callout to be ignored. No terminator is added to the output string,  so
+       if  you want a newline, you must include it explicitly using the escape
+       $n. For example:
+
+         pcre2grep '(.)(..(.))(?C"|[$1] [$2] [$3]$n")' <some file>
+
+       Matching continues normally after the string is output. If you want  to
+       see  only  the  callout output but not any output from an actual match,
+       you should end the pattern with (*FAIL).
+
+   Calling external programs or scripts
+
+       This facility can be independently disabled when pcre2grep is built. It
+       is  supported for Windows, where a call to _spawnvp() is used, for VMS,
+       where lib$spawn() is used, and  for  any  Unix-like  environment  where
+       fork() and execv() are available.
+
+       If the callout string does not start with a pipe (vertical bar) charac-
+       ter, it is parsed into a list of substrings separated by  pipe  charac-
+       ters.  The first substring must be an executable name, with the follow-
+       ing substrings specifying arguments:
+
+         executable_name|arg1|arg2|...
+
+       Any substring (including the executable name) may  contain  escape  se-
+       quences  started  by  a dollar character. These are the same as for the
+       --output (-O) option documented above, except that $0 cannot insert the
+       matched  string  because  the  match is still in progress. Instead, the
+       character '0' is inserted. If you need a literal dollar or pipe charac-
+       ter in any substring, use $$ or $| respectively. Here is an example:
+
+         echo -e "abcde\n12345" | pcre2grep \
+           '(?x)(.)(..(.))
+           (?C"/bin/echo|Arg1: [$1] [$2] [$3]|Arg2: $|${1}$| ($4)")()' -
+
+         Output:
+
+           Arg1: [a] [bcd] [d] Arg2: |a| ()
+           abcde
+           Arg1: [1] [234] [4] Arg2: |1| ()
+           12345
+
+       The  parameters  for the system call that is used to run the program or
+       script are zero-terminated strings. This means that binary zero charac-
+       ters  in the callout argument will cause premature termination of their
+       substrings, and therefore should not be present. Any syntax  errors  in
+       the  string  (for  example, a dollar not followed by another character)
+       causes the callout to be ignored.  If running the program fails for any
+       reason  (including the non-existence of the executable), a local match-
+       ing failure occurs and the matcher backtracks in the normal way.
+
+
+MATCHING ERRORS
+
+       It is possible to supply a regular expression that takes  a  very  long
+       time  to  fail  to  match certain lines. Such patterns normally involve
+       nested indefinite repeats, for example: (a+)*\d when matched against  a
+       line  of a's with no final digit. The PCRE2 matching function has a re-
+       source limit that causes it to abort in these  circumstances.  If  this
+       happens,  pcre2grep  outputs  an error message and the line that caused
+       the problem to the standard error stream. If there  are  more  than  20
+       such errors, pcre2grep gives up.
+
+       The  --match-limit  option  of pcre2grep can be used to set the overall
+       resource limit. There are also other limits that affect the  amount  of
+       memory  used  during  matching;  see the discussion of --heap-limit and
+       --depth-limit above.
+
+
+DIAGNOSTICS
+
+       Exit status is 0 if any matches were found, 1 if no matches were found,
+       and  2  for syntax errors, overlong lines, non-existent or inaccessible
+       files (even if matches were found in other files) or too many  matching
+       errors. Using the -s option to suppress error messages about inaccessi-
+       ble files does not affect the return code.
+
+       When  run  under  VMS,  the  return  code  is  placed  in  the   symbol
+       PCRE2GREP_RC  because  VMS  does  not  distinguish  between exit(0) and
+       exit(1).
+
+
+SEE ALSO
+
+       pcre2pattern(3), pcre2syntax(3), pcre2callout(3), pcre2unicode(3).
+
+
+AUTHOR
+
+       Philip Hazel
+       Retired from University Computing Service
+       Cambridge, England.
+
+
+REVISION
+
+       Last updated: 31 August 2021
+       Copyright (c) 1997-2021 University of Cambridge.
diff --git a/dist2/doc/pcre2jit.3 b/doc/pcre2jit.3
similarity index 99%
rename from dist2/doc/pcre2jit.3
rename to doc/pcre2jit.3
index fab8366..9b77550 100644
--- a/dist2/doc/pcre2jit.3
+++ b/doc/pcre2jit.3
@@ -29,6 +29,7 @@
 .sp
   ARM 32-bit (v5, v7, and Thumb2)
   ARM 64-bit
+  IBM s390x 64 bit
   Intel x86 32-bit and 64-bit
   MIPS 32-bit and 64-bit
   Power PC 32-bit and 64-bit
@@ -266,7 +267,7 @@
 This is a suggestion for how a multithreaded program that needs to set up
 non-default JIT stacks might operate:
 .sp
-  During thread initalization
+  During thread initialization
     thread_local_var = pcre2_jit_stack_create(...)
 .sp
   During thread exit
diff --git a/dist2/doc/pcre2limits.3 b/doc/pcre2limits.3
similarity index 100%
rename from dist2/doc/pcre2limits.3
rename to doc/pcre2limits.3
diff --git a/dist2/doc/pcre2matching.3 b/doc/pcre2matching.3
similarity index 87%
rename from dist2/doc/pcre2matching.3
rename to doc/pcre2matching.3
index 7f9bbac..673952d 100644
--- a/dist2/doc/pcre2matching.3
+++ b/doc/pcre2matching.3
@@ -1,4 +1,4 @@
-.TH PCRE2MATCHING 3 "23 May 2019" "PCRE2 10.34"
+.TH PCRE2MATCHING 3 "28 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "PCRE2 MATCHING ALGORITHMS"
@@ -61,8 +61,9 @@
 If a leaf node is reached, a matching string has been found, and at that point
 the algorithm stops. Thus, if there is more than one possible match, this
 algorithm returns the first one that it finds. Whether this is the shortest,
-the longest, or some intermediate length depends on the way the greedy and
-ungreedy repetition quantifiers are specified in the pattern.
+the longest, or some intermediate length depends on the way the alternations
+and the greedy or ungreedy repetition quantifiers are specified in the
+pattern.
 .P
 Because it ends up with a single path through the tree, it is relatively
 straightforward for this algorithm to keep track of the substrings that are
@@ -91,10 +92,15 @@
 different matching possibilities (if there are none, the match has failed).
 Thus, if there is more than one possible match, this algorithm finds all of
 them, and in particular, it finds the longest. The matches are returned in
-decreasing order of length. There is an option to stop the algorithm after the
-first match (which is necessarily the shortest) is found.
+the output vector in decreasing order of length. There is an option to stop the
+algorithm after the first match (which is necessarily the shortest) is found.
 .P
-Note that all the matches that are found start at the same point in the
+Note that the size of vector needed to contain all the results depends on the
+number of simultaneous matches, not on the number of parentheses in the
+pattern. Using \fBpcre2_match_data_create_from_pattern()\fP to create the match
+data block is therefore not advisable when doing DFA matching.
+.P
+Note also that all the matches that are found start at the same point in the
 subject. If the pattern
 .sp
   cat(er(pillar)?)?
@@ -165,19 +171,13 @@
 .SH "ADVANTAGES OF THE ALTERNATIVE ALGORITHM"
 .rs
 .sp
-Using the alternative matching algorithm provides the following advantages:
+The main advantage of the alternative algorithm is that all possible matches
+(at a single point in the subject) are automatically found, and in particular,
+the longest match is found. To find more than one match at the same point using
+the standard algorithm, you have to do kludgy things with callouts.
 .P
-1. All possible matches (at a single point in the subject) are automatically
-found, and in particular, the longest match is found. To find more than one
-match using the standard algorithm, you have to do kludgy things with
-callouts.
-.P
-2. Because the alternative algorithm scans the subject string just once, and
-never needs to backtrack (except for lookbehinds), it is possible to pass very
-long subject strings to the matching function in several pieces, checking for
-partial matching each time. Although it is also possible to do multi-segment
-matching using the standard algorithm, by retaining partially matched
-substrings, it is more complicated. The
+Partial matching is possible with this algorithm, though it has some
+limitations. The
 .\" HREF
 \fBpcre2partial\fP
 .\"
@@ -199,6 +199,8 @@
 .P
 3. Although atomic groups are supported, their use does not provide the
 performance advantage that it does for the standard algorithm.
+.P
+4. JIT optimization is not supported.
 .
 .
 .SH AUTHOR
@@ -206,7 +208,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -215,6 +217,6 @@
 .rs
 .sp
 .nf
-Last updated: 23 May 2019
-Copyright (c) 1997-2019 University of Cambridge.
+Last updated: 28 August 2021
+Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2partial.3 b/doc/pcre2partial.3
similarity index 100%
rename from dist2/doc/pcre2partial.3
rename to doc/pcre2partial.3
diff --git a/dist2/doc/pcre2pattern.3 b/doc/pcre2pattern.3
similarity index 99%
rename from dist2/doc/pcre2pattern.3
rename to doc/pcre2pattern.3
index dc78e4d..8daaa11 100644
--- a/dist2/doc/pcre2pattern.3
+++ b/doc/pcre2pattern.3
@@ -1,4 +1,4 @@
-.TH PCRE2PATTERN 3 "06 October 2020" "PCRE2 10.35"
+.TH PCRE2PATTERN 3 "3o0 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "PCRE2 REGULAR EXPRESSION DETAILS"
@@ -741,7 +741,7 @@
 .P
 It is possible to restrict \eR to match only CR, LF, or CRLF (instead of the
 complete set of Unicode line endings) by setting the option PCRE2_BSR_ANYCRLF
-at compile time. (BSR is an abbrevation for "backslash R".) This can be made
+at compile time. (BSR is an abbreviation for "backslash R".) This can be made
 the default when PCRE2 is built; if this is the case, the other behaviour can
 be requested via the PCRE2_BSR_UNICODE option. It is also possible to specify
 these settings by starting a pattern string with one of the following
@@ -1082,7 +1082,7 @@
 3. Do not break Hangul (a Korean script) syllable sequences. Hangul characters
 are of five types: L, V, T, LV, and LVT. An L character may be followed by an
 L, V, LV, or LVT character; an LV or V character may be followed by a V or T
-character; an LVT or T character may be follwed only by a T character.
+character; an LVT or T character may be followed only by a T character.
 .P
 4. Do not end before extending characters or spacing marks or the "zero-width
 joiner" character. Characters with the "mark" property always have the
@@ -1168,9 +1168,11 @@
 .sp
 matches "foobar", the first substring is still set to "foo".
 .P
-Perl used to document that the use of \eK within lookaround assertions is "not
-well defined", but from version 5.32.0 Perl does not support this usage at all.
-In PCRE2, \eK is acted upon when it occurs inside positive assertions, but is
+From version 5.32.0 Perl forbids the use of \eK in lookaround assertions. From
+release 10.38 PCRE2 also forbids this by default. However, the
+PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK option can be used when calling
+\fBpcre2_compile()\fP to re-enable the previous behaviour. When this option is
+set, \eK is acted upon when it occurs inside positive assertions, but is
 ignored in negative assertions. Note that when a pattern such as (?=ab\eK)
 matches, the reported start of the match can be greater than the end of the
 match. Using \eK in a lookbehind assertion at the start of a pattern can also
@@ -3658,7 +3660,7 @@
 .sp
 If the subject is "aaaac...", after the first match attempt fails (starting at
 the first character in the string), the starting point skips on to start the
-next attempt at "c". Note that a possessive quantifer does not have the same
+next attempt at "c". Note that a possessive quantifier does not have the same
 effect as this example; although it would suppress backtracking during the
 first match attempt, the second attempt would start at the second character
 instead of skipping on to "c".
@@ -3889,7 +3891,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -3898,6 +3900,6 @@
 .rs
 .sp
 .nf
-Last updated: 06 October 2020
-Copyright (c) 1997-2020 University of Cambridge.
+Last updated: 30 August 2021
+Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2perform.3 b/doc/pcre2perform.3
similarity index 100%
rename from dist2/doc/pcre2perform.3
rename to doc/pcre2perform.3
diff --git a/dist2/doc/pcre2posix.3 b/doc/pcre2posix.3
similarity index 100%
rename from dist2/doc/pcre2posix.3
rename to doc/pcre2posix.3
diff --git a/dist2/doc/pcre2sample.3 b/doc/pcre2sample.3
similarity index 100%
rename from dist2/doc/pcre2sample.3
rename to doc/pcre2sample.3
diff --git a/dist2/doc/pcre2serialize.3 b/doc/pcre2serialize.3
similarity index 100%
rename from dist2/doc/pcre2serialize.3
rename to doc/pcre2serialize.3
diff --git a/dist2/doc/pcre2syntax.3 b/doc/pcre2syntax.3
similarity index 97%
rename from dist2/doc/pcre2syntax.3
rename to doc/pcre2syntax.3
index 7076462..599027d 100644
--- a/dist2/doc/pcre2syntax.3
+++ b/doc/pcre2syntax.3
@@ -1,4 +1,4 @@
-.TH PCRE2SYNTAX 3 "28 December 2019" "PCRE2 10.35"
+.TH PCRE2SYNTAX 3 "30 August 2021" "PCRE2 10.38"
 .SH NAME
 PCRE2 - Perl-compatible regular expressions (revised API)
 .SH "PCRE2 REGULAR EXPRESSION SYNTAX SUMMARY"
@@ -401,6 +401,9 @@
 .sp
   \eK          set reported start of match
 .sp
+From release 10.38 \eK is not permitted by default in lookaround assertions,
+for compatibility with Perl. However, if the PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
+option is set, the previous behaviour is re-enabled. When this option is set,
 \eK is honoured in positive assertions, but ignored in negative ones.
 .
 .
@@ -667,7 +670,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -676,6 +679,6 @@
 .rs
 .sp
 .nf
-Last updated: 28 December 2019
-Copyright (c) 1997-2019 University of Cambridge.
+Last updated: 30 August 2021
+Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2test.1 b/doc/pcre2test.1
similarity index 98%
rename from dist2/doc/pcre2test.1
rename to doc/pcre2test.1
index 627f95a..d98e974 100644
--- a/dist2/doc/pcre2test.1
+++ b/doc/pcre2test.1
@@ -1,4 +1,4 @@
-.TH PCRE2TEST 1 "28 April 2021" "PCRE 10.37"
+.TH PCRE2TEST 1 "30 August 2021" "PCRE 10.38"
 .SH NAME
 pcre2test - a program for testing Perl-compatible regular expressions.
 .SH SYNOPSIS
@@ -27,12 +27,7 @@
 patterns, and the subject lines specify PCRE2 function options, control how the
 subject is processed, and what output is produced.
 .P
-As the original fairly simple PCRE library evolved, it acquired many different
-features, and as a result, the original \fBpcretest\fP program ended up with a
-lot of options in a messy, arcane syntax for testing all the features. The
-move to the new PCRE2 API provided an opportunity to re-implement the test
-program as \fBpcre2test\fP, with a cleaner modifier syntax. Nevertheless, there
-are still many obscure modifiers, some of which are specifically designed for
+There are many obscure modifiers, some of which are specifically designed for
 use in conjunction with the test script and data files that are distributed as
 part of PCRE2. All the modifiers are documented here, some without much
 justification, but many of them are unlikely to be of use except when testing
@@ -61,10 +56,10 @@
 .rs
 .sp
 Input to \fBpcre2test\fP is processed line by line, either by calling the C
-library's \fBfgets()\fP function, or via the \fBlibreadline\fP library. In some
-Windows environments character 26 (hex 1A) causes an immediate end of file, and
-no further data is read, so this character should be avoided unless you really
-want that action.
+library's \fBfgets()\fP function, or via the \fBlibreadline\fP or \fBlibedit\fP
+library. In some Windows environments character 26 (hex 1A) causes an immediate
+end of file, and no further data is read, so this character should be avoided
+unless you really want that action.
 .P
 The input is processed using using C's string functions, so must not
 contain binary zeros, even though in Unix-like environments, \fBfgets()\fP
@@ -443,15 +438,17 @@
 .sp
 This is interpreted as the pattern's delimiter. A regular expression may be
 continued over several input lines, in which case the newline characters are
-included within it. It is possible to include the delimiter within the pattern
-by escaping it with a backslash, for example
+included within it. It is possible to include the delimiter as a literal within
+the pattern by escaping it with a backslash, for example
 .sp
   /abc\e/def/
 .sp
 If you do this, the escape and the delimiter form part of the pattern, but
-since the delimiters are all non-alphanumeric, this does not affect its
-interpretation. If the terminating delimiter is immediately followed by a
-backslash, for example,
+since the delimiters are all non-alphanumeric, the inclusion of the backslash
+does not affect the pattern's interpretation. Note, however, that this trick
+does not work within \eQ...\eE literal bracketing because the backslash will
+itself be interpreted as a literal. If the terminating delimiter is immediately
+followed by a backslash, for example,
 .sp
   /abc/\e
 .sp
@@ -470,11 +467,11 @@
 .SH "SUBJECT LINE SYNTAX"
 .rs
 .sp
-Before each subject line is passed to \fBpcre2_match()\fP or
-\fBpcre2_dfa_match()\fP, leading and trailing white space is removed, and the
-line is scanned for backslash escapes, unless the \fBsubject_literal\fP
-modifier was set for the pattern. The following provide a means of encoding
-non-printing characters in a visible way:
+Before each subject line is passed to \fBpcre2_match()\fP,
+\fBpcre2_dfa_match()\fP, or \fBpcre2_jit_match()\fP, leading and trailing white
+space is removed, and the line is scanned for backslash escapes, unless the
+\fBsubject_literal\fP modifier was set for the pattern. The following provide a
+means of encoding non-printing characters in a visible way:
 .sp
   \ea         alarm (BEL, \ex07)
   \eb         backspace (\ex08)
@@ -570,6 +567,7 @@
 for a description of the effects of these options.
 .sp
       allow_empty_class         set PCRE2_ALLOW_EMPTY_CLASS
+      allow_lookaround_bsk      set PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
       allow_surrogate_escapes   set PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES
       alt_bsux                  set PCRE2_ALT_BSUX
       alt_circumflex            set PCRE2_ALT_CIRCUMFLEX
@@ -2096,7 +2094,7 @@
 .sp
 .nf
 Philip Hazel
-University Computing Service
+Retired from University Computing Service
 Cambridge, England.
 .fi
 .
@@ -2105,6 +2103,6 @@
 .rs
 .sp
 .nf
-Last updated: 28 April 2021
+Last updated: 30 August 2021
 Copyright (c) 1997-2021 University of Cambridge.
 .fi
diff --git a/dist2/doc/pcre2test.txt b/doc/pcre2test.txt
similarity index 61%
rename from dist2/doc/pcre2test.txt
rename to doc/pcre2test.txt
index a91f356..217bed5 100644
--- a/dist2/doc/pcre2test.txt
+++ b/doc/pcre2test.txt
@@ -24,17 +24,11 @@
        tion  options, control how the subject is processed, and what output is
        produced.
 
-       As the original fairly simple PCRE library evolved,  it  acquired  many
-       different  features,  and  as  a  result, the original pcretest program
-       ended up with a lot of options in a messy, arcane  syntax  for  testing
-       all the features. The move to the new PCRE2 API provided an opportunity
-       to re-implement the test program as pcre2test, with a cleaner  modifier
-       syntax.  Nevertheless,  there are still many obscure modifiers, some of
-       which are specifically designed for use in conjunction  with  the  test
-       script  and  data  files that are distributed as part of PCRE2. All the
-       modifiers are documented here, some  without  much  justification,  but
-       many  of  them  are  unlikely  to be of use except when testing the li-
-       braries.
+       There are many obscure modifiers, some of which  are  specifically  de-
+       signed  for use in conjunction with the test script and data files that
+       are distributed as part of PCRE2.  All  the  modifiers  are  documented
+       here, some without much justification, but many of them are unlikely to
+       be of use except when testing the libraries.
 
 
 PCRE2's 8-BIT, 16-BIT AND 32-BIT LIBRARIES
@@ -58,10 +52,10 @@
 INPUT ENCODING
 
        Input  to  pcre2test is processed line by line, either by calling the C
-       library's fgets() function, or via the  libreadline  library.  In  some
-       Windows  environments  character 26 (hex 1A) causes an immediate end of
-       file, and no further data is read, so this character should be  avoided
-       unless you really want that action.
+       library's fgets() function, or via the libreadline or libedit  library.
+       In  some Windows environments character 26 (hex 1A) causes an immediate
+       end of file, and no further data is read, so this character  should  be
+       avoided unless you really want that action.
 
        The  input  is  processed using using C's string functions, so must not
        contain binary zeros, even though in  Unix-like  environments,  fgets()
@@ -425,25 +419,28 @@
        This  is  interpreted  as the pattern's delimiter. A regular expression
        may be continued over several input lines, in which  case  the  newline
        characters are included within it. It is possible to include the delim-
-       iter within the pattern by escaping it with a backslash, for example
+       iter as a literal within the pattern by escaping it with  a  backslash,
+       for example
 
          /abc\/def/
 
-       If you do this, the escape and the delimiter form part of the  pattern,
-       but since the delimiters are all non-alphanumeric, this does not affect
-       its interpretation. If the terminating delimiter  is  immediately  fol-
-       lowed by a backslash, for example,
+       If  you do this, the escape and the delimiter form part of the pattern,
+       but since the delimiters are all non-alphanumeric, the inclusion of the
+       backslash  does not affect the pattern's interpretation. Note, however,
+       that this trick does not work within \Q...\E literal bracketing because
+       the backslash will itself be interpreted as a literal. If the terminat-
+       ing delimiter is immediately followed by a backslash, for example,
 
          /abc/\
 
-       then  a  backslash  is added to the end of the pattern. This is done to
-       provide a way of testing the error condition that arises if  a  pattern
+       then a backslash is added to the end of the pattern. This  is  done  to
+       provide  a  way of testing the error condition that arises if a pattern
        finishes with a backslash, because
 
          /abc\/
 
-       is  interpreted as the first line of a pattern that starts with "abc/",
-       causing pcre2test to read the next line as a continuation of the  regu-
+       is interpreted as the first line of a pattern that starts with  "abc/",
+       causing  pcre2test to read the next line as a continuation of the regu-
        lar expression.
 
        A pattern can be followed by a modifier list (details below).
@@ -451,11 +448,11 @@
 
 SUBJECT LINE SYNTAX
 
-       Before    each   subject   line   is   passed   to   pcre2_match()   or
-       pcre2_dfa_match(), leading and trailing white space is removed, and the
-       line is scanned for backslash escapes, unless the subject_literal modi-
-       fier was set for the pattern. The following provide a means of encoding
-       non-printing characters in a visible way:
+       Before each subject line is passed to pcre2_match(), pcre2_dfa_match(),
+       or  pcre2_jit_match(), leading and trailing white space is removed, and
+       the line is scanned for backslash escapes, unless  the  subject_literal
+       modifier  was set for the pattern. The following provide a means of en-
+       coding non-printing characters in a visible way:
 
          \a         alarm (BEL, \x07)
          \b         backspace (\x08)
@@ -472,23 +469,23 @@
          \x{hh...}  hexadecimal character (any number of hex digits)
 
        The use of \x{hh...} is not dependent on the use of the utf modifier on
-       the pattern. It is recognized always. There may be any number of  hexa-
-       decimal  digits  inside  the  braces; invalid values provoke error mes-
+       the  pattern. It is recognized always. There may be any number of hexa-
+       decimal digits inside the braces; invalid  values  provoke  error  mes-
        sages.
 
-       Note that \xhh specifies one byte rather than one  character  in  UTF-8
-       mode;  this  makes it possible to construct invalid UTF-8 sequences for
-       testing purposes. On the other hand, \x{hh} is interpreted as  a  UTF-8
-       character  in UTF-8 mode, generating more than one byte if the value is
-       greater than 127.  When testing the 8-bit library not  in  UTF-8  mode,
+       Note  that  \xhh  specifies one byte rather than one character in UTF-8
+       mode; this makes it possible to construct invalid UTF-8  sequences  for
+       testing  purposes.  On the other hand, \x{hh} is interpreted as a UTF-8
+       character in UTF-8 mode, generating more than one byte if the value  is
+       greater  than  127.   When testing the 8-bit library not in UTF-8 mode,
        \x{hh} generates one byte for values less than 256, and causes an error
        for greater values.
 
        In UTF-16 mode, all 4-digit \x{hhhh} values are accepted. This makes it
        possible to construct invalid UTF-16 sequences for testing purposes.
 
-       In  UTF-32  mode,  all  4- to 8-digit \x{...} values are accepted. This
-       makes it possible to construct invalid  UTF-32  sequences  for  testing
+       In UTF-32 mode, all 4- to 8-digit \x{...}  values  are  accepted.  This
+       makes  it  possible  to  construct invalid UTF-32 sequences for testing
        purposes.
 
        There is a special backslash sequence that specifies replication of one
@@ -496,31 +493,31 @@
 
          \[<characters>]{<count>}
 
-       This makes it possible to test long strings without having  to  provide
+       This  makes  it possible to test long strings without having to provide
        them as part of the file. For example:
 
          \[abc]{4}
 
-       is  converted to "abcabcabcabc". This feature does not support nesting.
+       is converted to "abcabcabcabc". This feature does not support  nesting.
        To include a closing square bracket in the characters, code it as \x5D.
 
-       A backslash followed by an equals sign marks the  end  of  the  subject
+       A  backslash  followed  by  an equals sign marks the end of the subject
        string and the start of a modifier list. For example:
 
          abc\=notbol,notempty
 
-       If  the  subject  string is empty and \= is followed by whitespace, the
-       line is treated as a comment line, and is not used  for  matching.  For
+       If the subject string is empty and \= is followed  by  whitespace,  the
+       line  is  treated  as a comment line, and is not used for matching. For
        example:
 
          \= This is a comment.
          abc\= This is an invalid modifier list.
 
-       A  backslash  followed by any other non-alphanumeric character just es-
-       capes that character. A backslash followed by anything else  causes  an
-       error.  However,  if the very last character in the line is a backslash
-       (and there is no modifier list), it is ignored. This  gives  a  way  of
-       passing  an  empty line as data, since a real empty line terminates the
+       A backslash followed by any other non-alphanumeric character  just  es-
+       capes  that  character. A backslash followed by anything else causes an
+       error. However, if the very last character in the line is  a  backslash
+       (and  there  is  no  modifier list), it is ignored. This gives a way of
+       passing an empty line as data, since a real empty line  terminates  the
        data input.
 
        If the subject_literal modifier is set for a pattern, all subject lines
@@ -531,25 +528,26 @@
 
 PATTERN MODIFIERS
 
-       There  are  several types of modifier that can appear in pattern lines.
+       There are several types of modifier that can appear in  pattern  lines.
        Except where noted below, they may also be used in #pattern commands. A
-       pattern's  modifier  list can add to or override default modifiers that
+       pattern's modifier list can add to or override default  modifiers  that
        were set by a previous #pattern command.
 
    Setting compilation options
 
-       The following modifiers set options for pcre2_compile(). Most  of  them
-       set  bits  in  the  options  argument of that function, but those whose
+       The  following  modifiers set options for pcre2_compile(). Most of them
+       set bits in the options argument of  that  function,  but  those  whose
        names start with PCRE2_EXTRA are additional options that are set in the
        compile context. For the main options, there are some single-letter ab-
-       breviations that are the same as Perl options. There  is  special  han-
-       dling  for  /x:  if  a second x is present, PCRE2_EXTENDED is converted
-       into PCRE2_EXTENDED_MORE as in Perl. A third appearance adds  PCRE2_EX-
-       TENDED  as  well, though this makes no difference to the way pcre2_com-
-       pile() behaves. See pcre2api for a description of the effects of  these
+       breviations  that  are  the same as Perl options. There is special han-
+       dling for /x: if a second x is  present,  PCRE2_EXTENDED  is  converted
+       into  PCRE2_EXTENDED_MORE as in Perl. A third appearance adds PCRE2_EX-
+       TENDED as well, though this makes no difference to the  way  pcre2_com-
+       pile()  behaves. See pcre2api for a description of the effects of these
        options.
 
              allow_empty_class         set PCRE2_ALLOW_EMPTY_CLASS
+             allow_lookaround_bsk      set PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK
              allow_surrogate_escapes   set PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES
              alt_bsux                  set PCRE2_ALT_BSUX
              alt_circumflex            set PCRE2_ALT_CIRCUMFLEX
@@ -587,16 +585,16 @@
              utf                       set PCRE2_UTF
 
        As well as turning on the PCRE2_UTF option, the utf modifier causes all
-       non-printing characters in output  strings  to  be  printed  using  the
-       \x{hh...}  notation. Otherwise, those less than 0x100 are output in hex
-       without the curly brackets. Setting utf in 16-bit or 32-bit  mode  also
-       causes  pattern  and  subject  strings  to  be  translated to UTF-16 or
+       non-printing  characters  in  output  strings  to  be printed using the
+       \x{hh...} notation. Otherwise, those less than 0x100 are output in  hex
+       without  the  curly brackets. Setting utf in 16-bit or 32-bit mode also
+       causes pattern and subject  strings  to  be  translated  to  UTF-16  or
        UTF-32, respectively, before being passed to library functions.
 
    Setting compilation controls
 
-       The following modifiers affect the compilation process or  request  in-
-       formation  about the pattern. There are single-letter abbreviations for
+       The  following  modifiers affect the compilation process or request in-
+       formation about the pattern. There are single-letter abbreviations  for
        some that are heavily used in the test files.
 
              bsr=[anycrlf|unicode]     specify \R handling
@@ -634,35 +632,35 @@
 
    Newline and \R handling
 
-       The bsr modifier specifies what \R in a pattern should match. If it  is
-       set  to  "anycrlf",  \R  matches  CR, LF, or CRLF only. If it is set to
-       "unicode", \R matches any Unicode newline sequence. The default can  be
+       The  bsr modifier specifies what \R in a pattern should match. If it is
+       set to "anycrlf", \R matches CR, LF, or CRLF only.  If  it  is  set  to
+       "unicode",  \R matches any Unicode newline sequence. The default can be
        specified when PCRE2 is built; if it is not, the default is set to Uni-
        code.
 
-       The newline modifier specifies which characters are to  be  interpreted
+       The  newline  modifier specifies which characters are to be interpreted
        as newlines, both in the pattern and in subject lines. The type must be
        one of CR, LF, CRLF, ANYCRLF, ANY, or NUL (in upper or lower case).
 
    Information about a pattern
 
-       The debug modifier is a shorthand for info,fullbincode, requesting  all
+       The  debug modifier is a shorthand for info,fullbincode, requesting all
        available information.
 
        The bincode modifier causes a representation of the compiled code to be
-       output after compilation. This information does not contain length  and
+       output  after compilation. This information does not contain length and
        offset values, which ensures that the same output is generated for dif-
-       ferent internal link sizes and different code  unit  widths.  By  using
-       bincode,  the  same  regression tests can be used in different environ-
+       ferent  internal  link  sizes  and different code unit widths. By using
+       bincode, the same regression tests can be used  in  different  environ-
        ments.
 
-       The fullbincode modifier, by contrast, does include length  and  offset
-       values.  This is used in a few special tests that run only for specific
+       The  fullbincode  modifier, by contrast, does include length and offset
+       values. This is used in a few special tests that run only for  specific
        code unit widths and link sizes, and is also useful for one-off tests.
 
-       The info modifier  requests  information  about  the  compiled  pattern
-       (whether  it  is anchored, has a fixed first character, and so on). The
-       information is obtained from the  pcre2_pattern_info()  function.  Here
+       The  info  modifier  requests  information  about  the compiled pattern
+       (whether it is anchored, has a fixed first character, and so  on).  The
+       information  is  obtained  from the pcre2_pattern_info() function. Here
        are some typical examples:
 
            re> /(?i)(^a|^b)/m,info
@@ -680,117 +678,117 @@
          Last code unit = 'c' (caseless)
          Subject length lower bound = 3
 
-       "Compile  options"  are those specified by modifiers; "overall options"
-       have added options that are taken or deduced from the pattern. If  both
-       sets  of  options are the same, just a single "options" line is output;
-       if there are no options, the line is  omitted.  "First  code  unit"  is
-       where  any  match must start; if there is more than one they are listed
-       as "starting code units". "Last code unit" is  the  last  literal  code
-       unit  that  must  be  present in any match. This is not necessarily the
-       last character. These lines are omitted if no starting or  ending  code
-       units   are   recorded.   The  subject  length  line  is  omitted  when
-       no_start_optimize is set because the minimum length is  not  calculated
+       "Compile options" are those specified by modifiers;  "overall  options"
+       have  added options that are taken or deduced from the pattern. If both
+       sets of options are the same, just a single "options" line  is  output;
+       if  there  are  no  options,  the line is omitted. "First code unit" is
+       where any match must start; if there is more than one they  are  listed
+       as  "starting  code  units".  "Last code unit" is the last literal code
+       unit that must be present in any match. This  is  not  necessarily  the
+       last  character.  These lines are omitted if no starting or ending code
+       units  are  recorded.  The  subject  length  line   is   omitted   when
+       no_start_optimize  is  set because the minimum length is not calculated
        when it can never be used.
 
-       The  framesize modifier shows the size, in bytes, of the storage frames
-       used by pcre2_match() for handling backtracking. The  size  depends  on
+       The framesize modifier shows the size, in bytes, of the storage  frames
+       used  by  pcre2_match()  for handling backtracking. The size depends on
        the number of capturing parentheses in the pattern.
 
-       The  callout_info  modifier requests information about all the callouts
+       The callout_info modifier requests information about all  the  callouts
        in the pattern. A list of them is output at the end of any other infor-
        mation that is requested. For each callout, either its number or string
        is given, followed by the item that follows it in the pattern.
 
    Passing a NULL context
 
-       Normally, pcre2test passes a context block to pcre2_compile().  If  the
-       null_context  modifier  is  set,  however,  NULL is passed. This is for
-       testing that pcre2_compile() behaves correctly in this  case  (it  uses
+       Normally,  pcre2test  passes a context block to pcre2_compile(). If the
+       null_context modifier is set, however, NULL  is  passed.  This  is  for
+       testing  that  pcre2_compile()  behaves correctly in this case (it uses
        default values).
 
    Specifying pattern characters in hexadecimal
 
-       The  hex  modifier specifies that the characters of the pattern, except
-       for substrings enclosed in single or double quotes, are  to  be  inter-
-       preted  as  pairs  of hexadecimal digits. This feature is provided as a
+       The hex modifier specifies that the characters of the  pattern,  except
+       for  substrings  enclosed  in single or double quotes, are to be inter-
+       preted as pairs of hexadecimal digits. This feature is  provided  as  a
        way of creating patterns that contain binary zeros and other non-print-
-       ing  characters.  White space is permitted between pairs of digits. For
+       ing characters. White space is permitted between pairs of  digits.  For
        example, this pattern contains three characters:
 
          /ab 32 59/hex
 
-       Parts of such a pattern are taken literally  if  quoted.  This  pattern
-       contains  nine characters, only two of which are specified in hexadeci-
+       Parts  of  such  a  pattern are taken literally if quoted. This pattern
+       contains nine characters, only two of which are specified in  hexadeci-
        mal:
 
          /ab "literal" 32/hex
 
-       Either single or double quotes may be used. There is no way of  includ-
-       ing  the delimiter within a substring. The hex and expand modifiers are
+       Either  single or double quotes may be used. There is no way of includ-
+       ing the delimiter within a substring. The hex and expand modifiers  are
        mutually exclusive.
 
    Specifying the pattern's length
 
        By default, patterns are passed to the compiling functions as zero-ter-
-       minated  strings but can be passed by length instead of being zero-ter-
-       minated. The use_length modifier causes this to happen. Using a  length
-       happens  automatically  (whether  or not use_length is set) when hex is
-       set, because patterns specified in hexadecimal may contain  binary  ze-
+       minated strings but can be passed by length instead of being  zero-ter-
+       minated.  The use_length modifier causes this to happen. Using a length
+       happens automatically (whether or not use_length is set)  when  hex  is
+       set,  because  patterns specified in hexadecimal may contain binary ze-
        ros.
 
        If hex or use_length is used with the POSIX wrapper API (see "Using the
-       POSIX wrapper API" below), the REG_PEND extension is used to  pass  the
+       POSIX  wrapper  API" below), the REG_PEND extension is used to pass the
        pattern's length.
 
    Specifying wide characters in 16-bit and 32-bit modes
 
        In 16-bit and 32-bit modes, all input is automatically treated as UTF-8
-       and translated to UTF-16 or UTF-32 when the utf modifier  is  set.  For
+       and  translated  to  UTF-16 or UTF-32 when the utf modifier is set. For
        testing the 16-bit and 32-bit libraries in non-UTF mode, the utf8_input
-       modifier can be used. It is mutually exclusive with  utf.  Input  lines
+       modifier  can  be  used. It is mutually exclusive with utf. Input lines
        are interpreted as UTF-8 as a means of specifying wide characters. More
        details are given in "Input encoding" above.
 
    Generating long repetitive patterns
 
-       Some tests use long patterns that are very repetitive. Instead of  cre-
-       ating  a very long input line for such a pattern, you can use a special
-       repetition feature, similar to the  one  described  for  subject  lines
-       above.  If  the  expand  modifier is present on a pattern, parts of the
+       Some  tests use long patterns that are very repetitive. Instead of cre-
+       ating a very long input line for such a pattern, you can use a  special
+       repetition  feature,  similar  to  the  one described for subject lines
+       above. If the expand modifier is present on a  pattern,  parts  of  the
        pattern that have the form
 
          \[<characters>]{<count>}
 
        are expanded before the pattern is passed to pcre2_compile(). For exam-
        ple, \[AB]{6000} is expanded to "ABAB..." 6000 times. This construction
-       cannot be nested. An initial "\[" sequence is recognized only  if  "]{"
-       followed  by  decimal  digits and "}" is found later in the pattern. If
+       cannot  be  nested. An initial "\[" sequence is recognized only if "]{"
+       followed by decimal digits and "}" is found later in  the  pattern.  If
        not, the characters remain in the pattern unaltered. The expand and hex
        modifiers are mutually exclusive.
 
-       If  part  of an expanded pattern looks like an expansion, but is really
+       If part of an expanded pattern looks like an expansion, but  is  really
        part of the actual pattern, unwanted expansion can be avoided by giving
        two values in the quantifier. For example, \[AB]{6000,6000} is not rec-
        ognized as an expansion item.
 
-       If the info modifier is set on an expanded pattern, the result  of  the
+       If  the  info modifier is set on an expanded pattern, the result of the
        expansion is included in the information that is output.
 
    JIT compilation
 
-       Just-in-time  (JIT)  compiling  is  a heavyweight optimization that can
-       greatly speed up pattern matching. See the pcre2jit  documentation  for
-       details.  JIT  compiling  happens, optionally, after a pattern has been
-       successfully compiled into an internal form. The JIT compiler  converts
+       Just-in-time (JIT) compiling is a  heavyweight  optimization  that  can
+       greatly  speed  up pattern matching. See the pcre2jit documentation for
+       details. JIT compiling happens, optionally, after a  pattern  has  been
+       successfully  compiled into an internal form. The JIT compiler converts
        this to optimized machine code. It needs to know whether the match-time
        options PCRE2_PARTIAL_HARD and PCRE2_PARTIAL_SOFT are going to be used,
-       because  different  code  is generated for the different cases. See the
-       partial modifier in "Subject Modifiers" below for details of how  these
+       because different code is generated for the different  cases.  See  the
+       partial  modifier in "Subject Modifiers" below for details of how these
        options are specified for each match attempt.
 
        JIT compilation is requested by the jit pattern modifier, which may op-
-       tionally be followed by an equals sign and a number in the range  0  to
-       7.   The  three bits that make up the number specify which of the three
+       tionally  be  followed by an equals sign and a number in the range 0 to
+       7.  The three bits that make up the number specify which of  the  three
        JIT operating modes are to be compiled:
 
          1  compile JIT code for non-partial matching
@@ -807,31 +805,31 @@
          6  soft and hard partial matching only
          7  all three modes
 
-       If no number is given, 7 is  assumed.  The  phrase  "partial  matching"
+       If  no  number  is  given,  7 is assumed. The phrase "partial matching"
        means a call to pcre2_match() with either the PCRE2_PARTIAL_SOFT or the
-       PCRE2_PARTIAL_HARD option set. Note that such a call may return a  com-
+       PCRE2_PARTIAL_HARD  option set. Note that such a call may return a com-
        plete match; the options enable the possibility of a partial match, but
-       do not require it. Note also that if you request JIT  compilation  only
-       for  partial  matching  (for example, jit=2) but do not set the partial
-       modifier on a subject line, that match will not use  JIT  code  because
+       do  not  require it. Note also that if you request JIT compilation only
+       for partial matching (for example, jit=2) but do not  set  the  partial
+       modifier  on  a  subject line, that match will not use JIT code because
        none was compiled for non-partial matching.
 
-       If  JIT compilation is successful, the compiled JIT code will automati-
+       If JIT compilation is successful, the compiled JIT code will  automati-
        cally be used when an appropriate type of match is run, except when in-
-       compatible  run-time  options  are specified. For more details, see the
-       pcre2jit documentation. See also the jitstack modifier below for a  way
+       compatible run-time options are specified. For more  details,  see  the
+       pcre2jit  documentation. See also the jitstack modifier below for a way
        of setting the size of the JIT stack.
 
-       If  the  jitfast  modifier is specified, matching is done using the JIT
-       "fast path" interface, pcre2_jit_match(), which skips some of the  san-
-       ity  checks that are done by pcre2_match(), and of course does not work
-       when JIT is not supported. If jitfast is specified without  jit,  jit=7
+       If the jitfast modifier is specified, matching is done  using  the  JIT
+       "fast  path" interface, pcre2_jit_match(), which skips some of the san-
+       ity checks that are done by pcre2_match(), and of course does not  work
+       when  JIT  is not supported. If jitfast is specified without jit, jit=7
        is assumed.
 
-       If  the jitverify modifier is specified, information about the compiled
-       pattern shows whether JIT compilation was or  was  not  successful.  If
-       jitverify  is  specified without jit, jit=7 is assumed. If JIT compila-
-       tion is successful when jitverify is set, the text "(JIT)" is added  to
+       If the jitverify modifier is specified, information about the  compiled
+       pattern  shows  whether  JIT  compilation was or was not successful. If
+       jitverify is specified without jit, jit=7 is assumed. If  JIT  compila-
+       tion  is successful when jitverify is set, the text "(JIT)" is added to
        the first output line after a match or non match when JIT-compiled code
        was actually used in the match.
 
@@ -842,19 +840,19 @@
          /pattern/locale=fr_FR
 
        The given locale is set, pcre2_maketables() is called to build a set of
-       character  tables for the locale, and this is then passed to pcre2_com-
-       pile() when compiling the regular expression. The same tables are  used
-       when  matching the following subject lines. The locale modifier applies
+       character tables for the locale, and this is then passed to  pcre2_com-
+       pile()  when compiling the regular expression. The same tables are used
+       when matching the following subject lines. The locale modifier  applies
        only to the pattern on which it appears, but can be given in a #pattern
-       command  if a default is needed. Setting a locale and alternate charac-
+       command if a default is needed. Setting a locale and alternate  charac-
        ter tables are mutually exclusive.
 
    Showing pattern memory
 
        The memory modifier causes the size in bytes of the memory used to hold
-       the  compiled  pattern  to be output. This does not include the size of
-       the pcre2_code block; it is just the actual compiled data. If the  pat-
-       tern  is  subsequently  passed to the JIT compiler, the size of the JIT
+       the compiled pattern to be output. This does not include  the  size  of
+       the  pcre2_code block; it is just the actual compiled data. If the pat-
+       tern is subsequently passed to the JIT compiler, the size  of  the  JIT
        compiled code is also output. Here is an example:
 
            re> /a(b)c/jit,memory
@@ -864,27 +862,27 @@
 
    Limiting nested parentheses
 
-       The parens_nest_limit modifier sets a limit  on  the  depth  of  nested
-       parentheses  in a pattern. Breaching the limit causes a compilation er-
-       ror.  The default for the library is  set  when  PCRE2  is  built,  but
-       pcre2test  sets  its  own default of 220, which is required for running
+       The  parens_nest_limit  modifier  sets  a  limit on the depth of nested
+       parentheses in a pattern. Breaching the limit causes a compilation  er-
+       ror.   The  default  for  the  library  is set when PCRE2 is built, but
+       pcre2test sets its own default of 220, which is  required  for  running
        the standard test suite.
 
    Limiting the pattern length
 
-       The max_pattern_length modifier sets a limit, in  code  units,  to  the
+       The  max_pattern_length  modifier  sets  a limit, in code units, to the
        length of pattern that pcre2_compile() will accept. Breaching the limit
-       causes a compilation  error.  The  default  is  the  largest  number  a
+       causes  a  compilation  error.  The  default  is  the  largest number a
        PCRE2_SIZE variable can hold (essentially unlimited).
 
    Using the POSIX wrapper API
 
-       The  posix  and posix_nosub modifiers cause pcre2test to call PCRE2 via
-       the POSIX wrapper API rather than its native API. When  posix_nosub  is
-       used,  the  POSIX  option  REG_NOSUB  is passed to regcomp(). The POSIX
-       wrapper supports only the 8-bit library. Note that it  does  not  imply
+       The posix and posix_nosub modifiers cause pcre2test to call  PCRE2  via
+       the  POSIX  wrapper API rather than its native API. When posix_nosub is
+       used, the POSIX option REG_NOSUB is  passed  to  regcomp().  The  POSIX
+       wrapper  supports  only  the 8-bit library. Note that it does not imply
        POSIX matching semantics; for more detail see the pcre2posix documenta-
-       tion. The following pattern modifiers set  options  for  the  regcomp()
+       tion.  The  following  pattern  modifiers set options for the regcomp()
        function:
 
          caseless           REG_ICASE
@@ -894,42 +892,42 @@
          ucp                REG_UCP        )   the POSIX standard
          utf                REG_UTF8       )
 
-       The  regerror_buffsize  modifier  specifies a size for the error buffer
-       that is passed to regerror() in the event of a compilation  error.  For
+       The regerror_buffsize modifier specifies a size for  the  error  buffer
+       that  is  passed to regerror() in the event of a compilation error. For
        example:
 
          /abc/posix,regerror_buffsize=20
 
-       This  provides  a means of testing the behaviour of regerror() when the
-       buffer is too small for the error message. If  this  modifier  has  not
+       This provides a means of testing the behaviour of regerror()  when  the
+       buffer  is  too  small  for the error message. If this modifier has not
        been set, a large buffer is used.
 
-       The  aftertext and allaftertext subject modifiers work as described be-
+       The aftertext and allaftertext subject modifiers work as described  be-
        low. All other modifiers are either ignored, with a warning message, or
        cause an error.
 
-       The  pattern  is passed to regcomp() as a zero-terminated string by de-
+       The pattern is passed to regcomp() as a zero-terminated string  by  de-
        fault, but if the use_length or hex modifiers are set, the REG_PEND ex-
        tension is used to pass it by length.
 
    Testing the stack guard feature
 
-       The  stackguard  modifier  is  used  to  test the use of pcre2_set_com-
-       pile_recursion_guard(), a function that is  provided  to  enable  stack
-       availability  to  be checked during compilation (see the pcre2api docu-
-       mentation for details). If the number  specified  by  the  modifier  is
+       The stackguard modifier is used  to  test  the  use  of  pcre2_set_com-
+       pile_recursion_guard(),  a  function  that  is provided to enable stack
+       availability to be checked during compilation (see the  pcre2api  docu-
+       mentation  for  details).  If  the  number specified by the modifier is
        greater than zero, pcre2_set_compile_recursion_guard() is called to set
-       up callback from pcre2_compile() to a local function. The  argument  it
-       receives  is  the current nesting parenthesis depth; if this is greater
+       up  callback  from pcre2_compile() to a local function. The argument it
+       receives is the current nesting parenthesis depth; if this  is  greater
        than the value given by the modifier, non-zero is returned, causing the
        compilation to be aborted.
 
    Using alternative character tables
 
-       The  value  specified for the tables modifier must be one of the digits
+       The value specified for the tables modifier must be one of  the  digits
        0, 1, 2, or 3. It causes a specific set of built-in character tables to
-       be  passed to pcre2_compile(). This is used in the PCRE2 tests to check
-       behaviour with different character tables. The digit specifies the  ta-
+       be passed to pcre2_compile(). This is used in the PCRE2 tests to  check
+       behaviour  with different character tables. The digit specifies the ta-
        bles as follows:
 
          0   do not pass any special character tables
@@ -940,15 +938,15 @@
 
        In tables 2, some characters whose codes are greater than 128 are iden-
        tified as letters, digits, spaces, etc. Tables 3 can be used only after
-       a  #loadtables  command has loaded them from a binary file. Setting al-
+       a #loadtables command has loaded them from a binary file.  Setting  al-
        ternate character tables and a locale are mutually exclusive.
 
    Setting certain match controls
 
        The following modifiers are really subject modifiers, and are described
-       under  "Subject  Modifiers"  below.  However, they may be included in a
-       pattern's modifier list, in which case they are applied to  every  sub-
-       ject  line  that is processed with that pattern. These modifiers do not
+       under "Subject Modifiers" below. However, they may  be  included  in  a
+       pattern's  modifier  list, in which case they are applied to every sub-
+       ject line that is processed with that pattern. These modifiers  do  not
        affect the compilation process.
 
              aftertext                   show text after match
@@ -973,39 +971,39 @@
              substitute_unknown_unset    use PCRE2_SUBSTITUTE_UNKNOWN_UNSET
              substitute_unset_empty      use PCRE2_SUBSTITUTE_UNSET_EMPTY
 
-       These modifiers may not appear in a #pattern command. If you want  them
+       These  modifiers may not appear in a #pattern command. If you want them
        as defaults, set them in a #subject command.
 
    Specifying literal subject lines
 
-       If  the  subject_literal modifier is present on a pattern, all the sub-
+       If the subject_literal modifier is present on a pattern, all  the  sub-
        ject lines that it matches are taken as literal strings, with no inter-
-       pretation  of  backslashes. It is not possible to set subject modifiers
-       on such lines, but any that are set as defaults by a  #subject  command
+       pretation of backslashes. It is not possible to set  subject  modifiers
+       on  such  lines, but any that are set as defaults by a #subject command
        are recognized.
 
    Saving a compiled pattern
 
-       When  a  pattern with the push modifier is successfully compiled, it is
-       pushed onto a stack of compiled patterns,  and  pcre2test  expects  the
-       next  line to contain a new pattern (or a command) instead of a subject
+       When a pattern with the push modifier is successfully compiled,  it  is
+       pushed  onto  a  stack  of compiled patterns, and pcre2test expects the
+       next line to contain a new pattern (or a command) instead of a  subject
        line. This facility is used when saving compiled patterns to a file, as
-       described  in  the section entitled "Saving and restoring compiled pat-
-       terns" below.  If pushcopy is used instead of push, a copy of the  com-
-       piled  pattern  is  stacked,  leaving the original as current, ready to
-       match the following input lines. This provides a  way  of  testing  the
-       pcre2_code_copy()  function.   The push and pushcopy  modifiers are in-
-       compatible with compilation modifiers such as global that act at  match
+       described in the section entitled "Saving and restoring  compiled  pat-
+       terns"  below.  If pushcopy is used instead of push, a copy of the com-
+       piled pattern is stacked, leaving the original  as  current,  ready  to
+       match  the  following  input  lines. This provides a way of testing the
+       pcre2_code_copy() function.  The push and pushcopy  modifiers  are  in-
+       compatible  with compilation modifiers such as global that act at match
        time. Any that are specified are ignored (for the stacked copy), with a
-       warning message, except for replace, which causes an error.  Note  that
-       jitverify,  which  is allowed, does not carry through to any subsequent
+       warning  message,  except for replace, which causes an error. Note that
+       jitverify, which is allowed, does not carry through to  any  subsequent
        matching that uses a stacked pattern.
 
    Testing foreign pattern conversion
 
-       The experimental foreign pattern conversion functions in PCRE2  can  be
-       tested  by  setting the convert modifier. Its argument is a colon-sepa-
-       rated list  of  options,  which  set  the  equivalent  option  for  the
+       The  experimental  foreign pattern conversion functions in PCRE2 can be
+       tested by setting the convert modifier. Its argument is  a  colon-sepa-
+       rated  list  of  options,  which  set  the  equivalent  option  for the
        pcre2_pattern_convert() function:
 
          glob                    PCRE2_CONVERT_GLOB
@@ -1017,19 +1015,19 @@
 
        The "unset" value is useful for turning off a default that has been set
        by a #pattern command. When one of these options is set, the input pat-
-       tern  is  passed  to pcre2_pattern_convert(). If the conversion is suc-
-       cessful, the result is reflected in  the  output  and  then  passed  to
+       tern is passed to pcre2_pattern_convert(). If the  conversion  is  suc-
+       cessful,  the  result  is  reflected  in  the output and then passed to
        pcre2_compile(). The normal utf and no_utf_check options, if set, cause
-       the PCRE2_CONVERT_UTF  and  PCRE2_CONVERT_NO_UTF_CHECK  options  to  be
+       the  PCRE2_CONVERT_UTF  and  PCRE2_CONVERT_NO_UTF_CHECK  options  to be
        passed to pcre2_pattern_convert().
 
        By default, the conversion function is allowed to allocate a buffer for
-       its output. However, if the convert_length modifier is set to  a  value
-       greater  than zero, pcre2test passes a buffer of the given length. This
+       its  output.  However, if the convert_length modifier is set to a value
+       greater than zero, pcre2test passes a buffer of the given length.  This
        makes it possible to test the length check.
 
-       The convert_glob_escape and  convert_glob_separator  modifiers  can  be
-       used  to  specify the escape and separator characters for glob process-
+       The  convert_glob_escape  and  convert_glob_separator  modifiers can be
+       used to specify the escape and separator characters for  glob  process-
        ing, overriding the defaults, which are operating-system dependent.
 
 
@@ -1040,7 +1038,7 @@
 
    Setting match options
 
-       The    following   modifiers   set   options   for   pcre2_match()   or
+       The   following   modifiers   set   options   for   pcre2_match()    or
        pcre2_dfa_match(). See pcreapi for a description of their effects.
 
              anchored                  set PCRE2_ANCHORED
@@ -1056,35 +1054,35 @@
              partial_hard (or ph)      set PCRE2_PARTIAL_HARD
              partial_soft (or ps)      set PCRE2_PARTIAL_SOFT
 
-       The partial matching modifiers are provided with abbreviations  because
+       The  partial matching modifiers are provided with abbreviations because
        they appear frequently in tests.
 
-       If  the posix or posix_nosub modifier was present on the pattern, caus-
+       If the posix or posix_nosub modifier was present on the pattern,  caus-
        ing the POSIX wrapper API to be used, the only option-setting modifiers
        that have any effect are notbol, notempty, and noteol, causing REG_NOT-
-       BOL, REG_NOTEMPTY,  and  REG_NOTEOL,  respectively,  to  be  passed  to
+       BOL,  REG_NOTEMPTY,  and  REG_NOTEOL,  respectively,  to  be  passed to
        regexec(). The other modifiers are ignored, with a warning message.
 
-       There  is one additional modifier that can be used with the POSIX wrap-
+       There is one additional modifier that can be used with the POSIX  wrap-
        per. It is ignored (with a warning) if used for non-POSIX matching.
 
              posix_startend=<n>[:<m>]
 
-       This causes the subject string to be  passed  to  regexec()  using  the
-       REG_STARTEND  option,  which  uses offsets to specify which part of the
-       string is searched. If only one number is  given,  the  end  offset  is
-       passed  as  the end of the subject string. For more detail of REG_STAR-
-       TEND, see the pcre2posix documentation. If the subject string  contains
-       binary  zeros  (coded  as escapes such as \x{00} because pcre2test does
+       This  causes  the  subject  string  to be passed to regexec() using the
+       REG_STARTEND option, which uses offsets to specify which  part  of  the
+       string  is  searched.  If  only  one number is given, the end offset is
+       passed as the end of the subject string. For more detail  of  REG_STAR-
+       TEND,  see the pcre2posix documentation. If the subject string contains
+       binary zeros (coded as escapes such as \x{00}  because  pcre2test  does
        not support actual binary zeros in its input), you must use posix_star-
        tend to specify its length.
 
    Setting match controls
 
-       The  following  modifiers  affect the matching process or request addi-
-       tional information. Some of them may also be  specified  on  a  pattern
-       line  (see  above), in which case they apply to every subject line that
-       is matched against that pattern, but can be overridden by modifiers  on
+       The following modifiers affect the matching process  or  request  addi-
+       tional  information.  Some  of  them may also be specified on a pattern
+       line (see above), in which case they apply to every subject  line  that
+       is  matched against that pattern, but can be overridden by modifiers on
        the subject.
 
              aftertext                  show text after match
@@ -1133,29 +1131,29 @@
              zero_terminate             pass the subject as zero-terminated
 
        The effects of these modifiers are described in the following sections.
-       When matching via the POSIX wrapper API, the  aftertext,  allaftertext,
-       and  ovector subject modifiers work as described below. All other modi-
+       When  matching  via the POSIX wrapper API, the aftertext, allaftertext,
+       and ovector subject modifiers work as described below. All other  modi-
        fiers are either ignored, with a warning message, or cause an error.
 
    Showing more text
 
-       The aftertext modifier requests that as well as outputting the part  of
+       The  aftertext modifier requests that as well as outputting the part of
        the subject string that matched the entire pattern, pcre2test should in
        addition output the remainder of the subject string. This is useful for
        tests where the subject contains multiple copies of the same substring.
-       The allaftertext modifier requests the same action  for  captured  sub-
+       The  allaftertext  modifier  requests the same action for captured sub-
        strings as well as the main matched substring. In each case the remain-
        der is output on the following line with a plus character following the
        capture number.
 
-       The  allusedtext modifier requests that all the text that was consulted
-       during a successful pattern match by the interpreter should  be  shown,
-       for  both  full  and partial matches. This feature is not supported for
-       JIT matching, and if requested with JIT it is ignored (with  a  warning
-       message).  Setting this modifier affects the output if there is a look-
-       behind at the start of a match, or, for a complete match,  a  lookahead
+       The allusedtext modifier requests that all the text that was  consulted
+       during  a  successful pattern match by the interpreter should be shown,
+       for both full and partial matches. This feature is  not  supported  for
+       JIT  matching,  and if requested with JIT it is ignored (with a warning
+       message). Setting this modifier affects the output if there is a  look-
+       behind  at  the start of a match, or, for a complete match, a lookahead
        at the end, or if \K is used in the pattern. Characters that precede or
-       follow the start and end of the actual match are indicated in the  out-
+       follow  the start and end of the actual match are indicated in the out-
        put by '<' or '>' characters underneath them.  Here is an example:
 
            re> /(?<=pqr)abc(?=xyz)/
@@ -1166,16 +1164,16 @@
          Partial match: pqrabcxy
                         <<<
 
-       The  first, complete match shows that the matched string is "abc", with
-       the preceding and following strings "pqr" and "xyz"  having  been  con-
-       sulted  during  the match (when processing the assertions). The partial
+       The first, complete match shows that the matched string is "abc",  with
+       the  preceding  and  following strings "pqr" and "xyz" having been con-
+       sulted during the match (when processing the assertions).  The  partial
        match can indicate only the preceding string.
 
-       The startchar modifier requests that the  starting  character  for  the
-       match  be  indicated,  if  it  is different to the start of the matched
+       The  startchar  modifier  requests  that the starting character for the
+       match be indicated, if it is different to  the  start  of  the  matched
        string. The only time when this occurs is when \K has been processed as
        part of the match. In this situation, the output for the matched string
-       is displayed from the starting character  instead  of  from  the  match
+       is  displayed  from  the  starting  character instead of from the match
        point, with circumflex characters under the earlier characters. For ex-
        ample:
 
@@ -1184,7 +1182,7 @@
           0: abcxyz
              ^^^
 
-       Unlike allusedtext, the startchar modifier can be used with JIT.   How-
+       Unlike  allusedtext, the startchar modifier can be used with JIT.  How-
        ever, these two modifiers are mutually exclusive.
 
    Showing the value of all capture groups
@@ -1192,104 +1190,104 @@
        The allcaptures modifier requests that the values of all potential cap-
        tured parentheses be output after a match. By default, only those up to
        the highest one actually used in the match are output (corresponding to
-       the return code from pcre2_match()). Groups that did not take  part  in
-       the  match  are  output as "<unset>". This modifier is not relevant for
-       DFA matching (which does no capturing) and does not apply when  replace
+       the  return  code from pcre2_match()). Groups that did not take part in
+       the match are output as "<unset>". This modifier is  not  relevant  for
+       DFA  matching (which does no capturing) and does not apply when replace
        is specified; it is ignored, with a warning message, if present.
 
    Showing the entire ovector, for all outcomes
 
        The allvector modifier requests that the entire ovector be shown, what-
        ever the outcome of the match. Compare allcaptures, which shows only up
-       to  the maximum number of capture groups for the pattern, and then only
-       for a successful complete non-DFA match. This modifier, which acts  af-
-       ter  any  match  result, and also for DFA matching, provides a means of
-       checking that there are no unexpected modifications to ovector  fields.
-       Before  each match attempt, the ovector is filled with a special value,
-       and if this is found in  both  elements  of  a  capturing  pair,  "<un-
-       changed>"  is  output.  After  a  successful match, this applies to all
-       groups after the maximum capture group for the pattern. In other  cases
-       it  applies to the entire ovector. After a partial match, the first two
-       elements are the only ones that should be set. After a DFA  match,  the
-       amount  of  ovector  that is used depends on the number of matches that
+       to the maximum number of capture groups for the pattern, and then  only
+       for  a successful complete non-DFA match. This modifier, which acts af-
+       ter any match result, and also for DFA matching, provides  a  means  of
+       checking  that there are no unexpected modifications to ovector fields.
+       Before each match attempt, the ovector is filled with a special  value,
+       and  if  this  is  found  in  both  elements of a capturing pair, "<un-
+       changed>" is output. After a successful  match,  this  applies  to  all
+       groups  after the maximum capture group for the pattern. In other cases
+       it applies to the entire ovector. After a partial match, the first  two
+       elements  are  the only ones that should be set. After a DFA match, the
+       amount of ovector that is used depends on the number  of  matches  that
        were found.
 
    Testing pattern callouts
 
-       A callout function is supplied when pcre2test calls the library  match-
-       ing  functions,  unless callout_none is specified. Its behaviour can be
-       controlled by various modifiers listed above  whose  names  begin  with
-       callout_.  Details  are given in the section entitled "Callouts" below.
-       Testing callouts from  pcre2_substitute()  is  decribed  separately  in
+       A  callout function is supplied when pcre2test calls the library match-
+       ing functions, unless callout_none is specified. Its behaviour  can  be
+       controlled  by  various  modifiers  listed above whose names begin with
+       callout_. Details are given in the section entitled  "Callouts"  below.
+       Testing  callouts  from  pcre2_substitute()  is  decribed separately in
        "Testing the substitution function" below.
 
    Finding all matches in a string
 
        Searching for all possible matches within a subject can be requested by
-       the global or altglobal modifier. After finding a match,  the  matching
-       function  is  called  again to search the remainder of the subject. The
-       difference between global and altglobal is that  the  former  uses  the
-       start_offset  argument  to  pcre2_match() or pcre2_dfa_match() to start
-       searching at a new point within the entire string (which is  what  Perl
+       the  global  or altglobal modifier. After finding a match, the matching
+       function is called again to search the remainder of  the  subject.  The
+       difference  between  global  and  altglobal is that the former uses the
+       start_offset argument to pcre2_match() or  pcre2_dfa_match()  to  start
+       searching  at  a new point within the entire string (which is what Perl
        does), whereas the latter passes over a shortened subject. This makes a
        difference to the matching process if the pattern begins with a lookbe-
        hind assertion (including \b or \B).
 
-       If  an  empty  string  is  matched,  the  next  match  is done with the
+       If an empty string  is  matched,  the  next  match  is  done  with  the
        PCRE2_NOTEMPTY_ATSTART and PCRE2_ANCHORED flags set, in order to search
        for another, non-empty, match at the same point in the subject. If this
-       match fails, the start offset is advanced, and the normal match is  re-
-       tried.  This imitates the way Perl handles such cases when using the /g
-       modifier or the split() function. Normally, the  start  offset  is  ad-
-       vanced  by one character, but if the newline convention recognizes CRLF
-       as a newline, and the current character is CR followed by  LF,  an  ad-
+       match  fails, the start offset is advanced, and the normal match is re-
+       tried. This imitates the way Perl handles such cases when using the  /g
+       modifier  or  the  split()  function. Normally, the start offset is ad-
+       vanced by one character, but if the newline convention recognizes  CRLF
+       as  a  newline,  and the current character is CR followed by LF, an ad-
        vance of two characters occurs.
 
    Testing substring extraction functions
 
-       The  copy  and  get  modifiers  can  be  used  to  test  the pcre2_sub-
+       The copy  and  get  modifiers  can  be  used  to  test  the  pcre2_sub-
        string_copy_xxx() and pcre2_substring_get_xxx() functions.  They can be
        given more than once, and each can specify a capture group name or num-
        ber, for example:
 
           abcd\=copy=1,copy=3,get=G1
 
-       If the #subject command is used to set default copy and/or  get  lists,
-       these  can  be unset by specifying a negative number to cancel all num-
+       If  the  #subject command is used to set default copy and/or get lists,
+       these can be unset by specifying a negative number to cancel  all  num-
        bered groups and an empty name to cancel all named groups.
 
-       The getall modifier tests  pcre2_substring_list_get(),  which  extracts
+       The  getall  modifier  tests pcre2_substring_list_get(), which extracts
        all captured substrings.
 
-       If  the  subject line is successfully matched, the substrings extracted
-       by the convenience functions are output with  C,  G,  or  L  after  the
-       string  number  instead  of  a colon. This is in addition to the normal
-       full list. The string length (that is, the return from  the  extraction
+       If the subject line is successfully matched, the  substrings  extracted
+       by  the  convenience  functions  are  output  with C, G, or L after the
+       string number instead of a colon. This is in  addition  to  the  normal
+       full  list.  The string length (that is, the return from the extraction
        function) is given in parentheses after each substring, followed by the
        name when the extraction was by name.
 
    Testing the substitution function
 
-       If the replace modifier is  set,  the  pcre2_substitute()  function  is
-       called  instead  of one of the matching functions (or after one call of
-       pcre2_match() in the case of PCRE2_SUBSTITUTE_MATCHED). Note  that  re-
-       placement  strings cannot contain commas, because a comma signifies the
-       end of a modifier. This is not thought to be an issue in  a  test  pro-
+       If  the  replace  modifier  is  set, the pcre2_substitute() function is
+       called instead of one of the matching functions (or after one  call  of
+       pcre2_match()  in  the case of PCRE2_SUBSTITUTE_MATCHED). Note that re-
+       placement strings cannot contain commas, because a comma signifies  the
+       end  of  a  modifier. This is not thought to be an issue in a test pro-
        gram.
 
-       Specifying  a  completely  empty replacement string disables this modi-
-       fier.  However, it is possible to specify an empty replacement by  pro-
-       viding  a buffer length, as described below, for an otherwise empty re-
+       Specifying a completely empty replacement string  disables  this  modi-
+       fier.   However, it is possible to specify an empty replacement by pro-
+       viding a buffer length, as described below, for an otherwise empty  re-
        placement.
 
-       Unlike subject strings, pcre2test does not process replacement  strings
-       for  escape  sequences. In UTF mode, a replacement string is checked to
-       see if it is a valid UTF-8 string. If so, it is correctly converted  to
-       a  UTF  string of the appropriate code unit width. If it is not a valid
-       UTF-8 string, the individual code units are copied directly. This  pro-
+       Unlike  subject strings, pcre2test does not process replacement strings
+       for escape sequences. In UTF mode, a replacement string is  checked  to
+       see  if it is a valid UTF-8 string. If so, it is correctly converted to
+       a UTF string of the appropriate code unit width. If it is not  a  valid
+       UTF-8  string, the individual code units are copied directly. This pro-
        vides a means of passing an invalid UTF-8 string for testing purposes.
 
-       The  following modifiers set options (in additional to the normal match
+       The following modifiers set options (in additional to the normal  match
        options) for pcre2_substitute():
 
          global                      PCRE2_SUBSTITUTE_GLOBAL
@@ -1303,8 +1301,8 @@
 
        See the pcre2api documentation for details of these options.
 
-       After a successful substitution, the modified string  is  output,  pre-
-       ceded  by the number of replacements. This may be zero if there were no
+       After  a  successful  substitution, the modified string is output, pre-
+       ceded by the number of replacements. This may be zero if there were  no
        matches. Here is a simple example of a substitution test:
 
          /abc/replace=xxx
@@ -1313,12 +1311,12 @@
              =abc=abc=\=global
           2: =xxx=xxx=
 
-       Subject and replacement strings should be kept relatively short  (fewer
-       than  256 characters) for substitution tests, as fixed-size buffers are
-       used. To make it easy to test for buffer overflow, if  the  replacement
-       string  starts  with a number in square brackets, that number is passed
-       to pcre2_substitute() as the size of the output buffer,  with  the  re-
-       placement  string  starting  at  the next character. Here is an example
+       Subject  and replacement strings should be kept relatively short (fewer
+       than 256 characters) for substitution tests, as fixed-size buffers  are
+       used.  To  make it easy to test for buffer overflow, if the replacement
+       string starts with a number in square brackets, that number  is  passed
+       to  pcre2_substitute()  as  the size of the output buffer, with the re-
+       placement string starting at the next character.  Here  is  an  example
        that tests the edge case:
 
          /abc/
@@ -1328,12 +1326,12 @@
          Failed: error -47: no more memory
 
        The  default  action  of  pcre2_substitute()  is  to  return  PCRE2_ER-
-       ROR_NOMEMORY  when  the  output  buffer  is  too small. However, if the
-       PCRE2_SUBSTITUTE_OVERFLOW_LENGTH option is set (by  using  the  substi-
+       ROR_NOMEMORY when the output buffer  is  too  small.  However,  if  the
+       PCRE2_SUBSTITUTE_OVERFLOW_LENGTH  option  is  set (by using the substi-
        tute_overflow_length  modifier),  pcre2_substitute()  continues  to  go
-       through the motions of matching and substituting  (but  not  doing  any
-       callouts),  in  order  to  compute the size of buffer that is required.
-       When this happens, pcre2test shows the required  buffer  length  (which
+       through  the  motions  of  matching and substituting (but not doing any
+       callouts), in order to compute the size of  buffer  that  is  required.
+       When  this  happens,  pcre2test shows the required buffer length (which
        includes space for the trailing zero) as part of the error message. For
        example:
 
@@ -1342,15 +1340,15 @@
          Failed: error -47: no more memory: 10 code units are needed
 
        A replacement string is ignored with POSIX and DFA matching. Specifying
-       partial  matching  provokes  an  error return ("bad option value") from
+       partial matching provokes an error return  ("bad  option  value")  from
        pcre2_substitute().
 
    Testing substitute callouts
 
        If the substitute_callout modifier is set, a substitution callout func-
-       tion  is set up. The null_context modifier must not be set, because the
-       address of the callout function is passed in a match context. When  the
-       callout  function  is  called (after each substitution), details of the
+       tion is set up. The null_context modifier must not be set, because  the
+       address  of the callout function is passed in a match context. When the
+       callout function is called (after each substitution),  details  of  the
        the input and output strings are output. For example:
 
          /abc/g,replace=<$0>,substitute_callout
@@ -1359,19 +1357,19 @@
           2(1) Old 6 9 "abc" New 8 13 "<abc>"
           2: <abc>def<abc>pqr
 
-       The first number on each callout line is  the  count  of  matches.  The
+       The  first  number  on  each  callout line is the count of matches. The
        parenthesized number is the number of pairs that are set in the ovector
-       (that is, one more than the number of capturing groups that were  set).
+       (that  is, one more than the number of capturing groups that were set).
        Then are listed the offsets of the old substring, its contents, and the
        same for the replacement.
 
-       By default, the substitution callout function returns zero,  which  ac-
-       cepts  the  replacement and causes matching to continue if /g was used.
-       Two further modifiers can be used to test other return values. If  sub-
-       stitute_skip  is  set to a value greater than zero the callout function
-       returns +1 for the match of that number, and similarly  substitute_stop
-       returns  -1.  These cause the replacement to be rejected, and -1 causes
-       no further matching to take place. If either of them are  set,  substi-
+       By  default,  the substitution callout function returns zero, which ac-
+       cepts the replacement and causes matching to continue if /g  was  used.
+       Two  further modifiers can be used to test other return values. If sub-
+       stitute_skip is set to a value greater than zero the  callout  function
+       returns  +1 for the match of that number, and similarly substitute_stop
+       returns -1. These cause the replacement to be rejected, and  -1  causes
+       no  further  matching to take place. If either of them are set, substi-
        tute_callout is assumed. For example:
 
          /abc/g,replace=<$0>,substitute_skip=1
@@ -1389,160 +1387,160 @@
 
    Setting the JIT stack size
 
-       The  jitstack modifier provides a way of setting the maximum stack size
-       that is used by the just-in-time optimization code. It  is  ignored  if
-       JIT  optimization is not being used. The value is a number of kibibytes
-       (units of 1024 bytes). Setting zero reverts to the  default  of  32KiB.
+       The jitstack modifier provides a way of setting the maximum stack  size
+       that  is  used  by the just-in-time optimization code. It is ignored if
+       JIT optimization is not being used. The value is a number of  kibibytes
+       (units  of  1024  bytes). Setting zero reverts to the default of 32KiB.
        Providing a stack that is larger than the default is necessary only for
-       very complicated patterns. If jitstack is set  non-zero  on  a  subject
+       very  complicated  patterns.  If  jitstack is set non-zero on a subject
        line it overrides any value that was set on the pattern.
 
    Setting heap, match, and depth limits
 
-       The  heap_limit,  match_limit, and depth_limit modifiers set the appro-
-       priate limits in the match context. These values are ignored  when  the
+       The heap_limit, match_limit, and depth_limit modifiers set  the  appro-
+       priate  limits  in the match context. These values are ignored when the
        find_limits modifier is specified.
 
    Finding minimum limits
 
-       If  the  find_limits  modifier  is present on a subject line, pcre2test
-       calls the relevant matching function several times,  setting  different
-       values    in    the    match    context   via   pcre2_set_heap_limit(),
-       pcre2_set_match_limit(), or pcre2_set_depth_limit() until it finds  the
-       minimum  values  for  each  parameter that allows the match to complete
+       If the find_limits modifier is present on  a  subject  line,  pcre2test
+       calls  the  relevant matching function several times, setting different
+       values   in   the    match    context    via    pcre2_set_heap_limit(),
+       pcre2_set_match_limit(),  or pcre2_set_depth_limit() until it finds the
+       minimum values for each parameter that allows  the  match  to  complete
        without error. If JIT is being used, only the match limit is relevant.
 
        When using this modifier, the pattern should not contain any limit set-
-       tings  such  as  (*LIMIT_MATCH=...)  within  it.  If  such a setting is
+       tings such as (*LIMIT_MATCH=...)  within  it.  If  such  a  setting  is
        present and is lower than the minimum matching value, the minimum value
-       cannot  be  found because pcre2_set_match_limit() etc. are only able to
+       cannot be found because pcre2_set_match_limit() etc. are only  able  to
        reduce the value of an in-pattern limit; they cannot increase it.
 
-       For non-DFA matching, the minimum depth_limit number is  a  measure  of
+       For  non-DFA  matching,  the minimum depth_limit number is a measure of
        how much nested backtracking happens (that is, how deeply the pattern's
-       tree is searched). In the case of DFA  matching,  depth_limit  controls
-       the  depth of recursive calls of the internal function that is used for
+       tree  is  searched).  In the case of DFA matching, depth_limit controls
+       the depth of recursive calls of the internal function that is used  for
        handling pattern recursion, lookaround assertions, and atomic groups.
 
        For non-DFA matching, the match_limit number is a measure of the amount
        of backtracking that takes place, and learning the minimum value can be
-       instructive. For most simple matches, the number is  quite  small,  but
-       for  patterns with very large numbers of matching possibilities, it can
-       become large very quickly with increasing length of subject string.  In
-       the  case  of  DFA  matching,  match_limit controls the total number of
+       instructive.  For  most  simple matches, the number is quite small, but
+       for patterns with very large numbers of matching possibilities, it  can
+       become  large very quickly with increasing length of subject string. In
+       the case of DFA matching, match_limit  controls  the  total  number  of
        calls, both recursive and non-recursive, to the internal matching func-
        tion, thus controlling the overall amount of computing resource that is
        used.
 
-       For both  kinds  of  matching,  the  heap_limit  number,  which  is  in
-       kibibytes  (units of 1024 bytes), limits the amount of heap memory used
+       For  both  kinds  of  matching,  the  heap_limit  number,  which  is in
+       kibibytes (units of 1024 bytes), limits the amount of heap memory  used
        for matching. A value of zero disables the use of any heap memory; many
-       simple  pattern  matches can be done without using the heap, so zero is
+       simple pattern matches can be done without using the heap, so  zero  is
        not an unreasonable setting.
 
    Showing MARK names
 
 
        The mark modifier causes the names from backtracking control verbs that
-       are  returned from calls to pcre2_match() to be displayed. If a mark is
-       returned for a match, non-match, or partial match, pcre2test shows  it.
-       For  a  match, it is on a line by itself, tagged with "MK:". Otherwise,
+       are returned from calls to pcre2_match() to be displayed. If a mark  is
+       returned  for a match, non-match, or partial match, pcre2test shows it.
+       For a match, it is on a line by itself, tagged with  "MK:".  Otherwise,
        it is added to the non-match message.
 
    Showing memory usage
 
-       The memory modifier causes pcre2test to log the sizes of all heap  mem-
-       ory   allocation  and  freeing  calls  that  occur  during  a  call  to
-       pcre2_match() or pcre2_dfa_match(). These occur only when a  match  re-
-       quires  a  bigger  vector than the default for remembering backtracking
-       points (pcre2_match()) or for internal  workspace  (pcre2_dfa_match()).
-       In  many cases there will be no heap memory used and therefore no addi-
+       The  memory modifier causes pcre2test to log the sizes of all heap mem-
+       ory  allocation  and  freeing  calls  that  occur  during  a  call   to
+       pcre2_match()  or  pcre2_dfa_match(). These occur only when a match re-
+       quires a bigger vector than the default  for  remembering  backtracking
+       points  (pcre2_match())  or for internal workspace (pcre2_dfa_match()).
+       In many cases there will be no heap memory used and therefore no  addi-
        tional output. No heap memory is allocated during matching with JIT, so
-       in  that  case the memory modifier never has any effect. For this modi-
-       fier to work, the null_context modifier must not be  set  on  both  the
+       in that case the memory modifier never has any effect. For  this  modi-
+       fier  to  work,  the  null_context modifier must not be set on both the
        pattern and the subject, though it can be set on one or the other.
 
    Setting a starting offset
 
-       The  offset  modifier  sets  an  offset  in the subject string at which
+       The offset modifier sets an offset  in  the  subject  string  at  which
        matching starts. Its value is a number of code units, not characters.
 
    Setting an offset limit
 
-       The offset_limit modifier sets a limit for  unanchored  matches.  If  a
+       The  offset_limit  modifier  sets  a limit for unanchored matches. If a
        match cannot be found starting at or before this offset in the subject,
        a "no match" return is given. The data value is a number of code units,
-       not  characters. When this modifier is used, the use_offset_limit modi-
+       not characters. When this modifier is used, the use_offset_limit  modi-
        fier must have been set for the pattern; if not, an error is generated.
 
    Setting the size of the output vector
 
-       The ovector modifier applies only to the subject line in which  it  ap-
+       The  ovector  modifier applies only to the subject line in which it ap-
        pears, though of course it can also be used to set a default in a #sub-
-       ject command. It specifies the number of  pairs  of  offsets  that  are
+       ject  command.  It  specifies  the  number of pairs of offsets that are
        available for storing matching information. The default is 15.
 
-       A  value of zero is useful when testing the POSIX API because it causes
+       A value of zero is useful when testing the POSIX API because it  causes
        regexec() to be called with a NULL capture vector. When not testing the
-       POSIX  API,  a  value  of  zero  is used to cause pcre2_match_data_cre-
-       ate_from_pattern() to be called, in order to create a  match  block  of
+       POSIX API, a value of  zero  is  used  to  cause  pcre2_match_data_cre-
+       ate_from_pattern()  to  be  called, in order to create a match block of
        exactly the right size for the pattern. (It is not possible to create a
-       match block with a zero-length ovector; there is always  at  least  one
+       match  block  with  a zero-length ovector; there is always at least one
        pair of offsets.)
 
    Passing the subject as zero-terminated
 
        By default, the subject string is passed to a native API matching func-
        tion with its correct length. In order to test the facility for passing
-       a  zero-terminated  string, the zero_terminate modifier is provided. It
-       causes the length to be passed as PCRE2_ZERO_TERMINATED. When  matching
+       a zero-terminated string, the zero_terminate modifier is  provided.  It
+       causes  the length to be passed as PCRE2_ZERO_TERMINATED. When matching
        via the POSIX interface, this modifier is ignored, with a warning.
 
-       When  testing  pcre2_substitute(), this modifier also has the effect of
+       When testing pcre2_substitute(), this modifier also has the  effect  of
        passing the replacement string as zero-terminated.
 
    Passing a NULL context
 
-       Normally,  pcre2test  passes  a   context   block   to   pcre2_match(),
-       pcre2_dfa_match(),  pcre2_jit_match()  or  pcre2_substitute().   If the
-       null_context modifier is set, however, NULL  is  passed.  This  is  for
-       testing  that  the matching and substitution functions behave correctly
-       in this case (they use default values). This modifier  cannot  be  used
+       Normally,   pcre2test   passes   a   context  block  to  pcre2_match(),
+       pcre2_dfa_match(), pcre2_jit_match()  or  pcre2_substitute().   If  the
+       null_context  modifier  is  set,  however,  NULL is passed. This is for
+       testing that the matching and substitution functions  behave  correctly
+       in  this  case  (they use default values). This modifier cannot be used
        with the find_limits or substitute_callout modifiers.
 
 
 THE ALTERNATIVE MATCHING FUNCTION
 
-       By  default,  pcre2test  uses  the  standard  PCRE2  matching function,
+       By default,  pcre2test  uses  the  standard  PCRE2  matching  function,
        pcre2_match() to match each subject line. PCRE2 also supports an alter-
-       native  matching  function, pcre2_dfa_match(), which operates in a dif-
-       ferent way, and has some restrictions. The differences between the  two
+       native matching function, pcre2_dfa_match(), which operates in  a  dif-
+       ferent  way, and has some restrictions. The differences between the two
        functions are described in the pcre2matching documentation.
 
-       If  the dfa modifier is set, the alternative matching function is used.
-       This function finds all possible matches at a given point in  the  sub-
-       ject.  If,  however, the dfa_shortest modifier is set, processing stops
-       after the first match is found. This is always  the  shortest  possible
+       If the dfa modifier is set, the alternative matching function is  used.
+       This  function  finds all possible matches at a given point in the sub-
+       ject. If, however, the dfa_shortest modifier is set,  processing  stops
+       after  the  first  match is found. This is always the shortest possible
        match.
 
 
 DEFAULT OUTPUT FROM pcre2test
 
-       This  section  describes  the output when the normal matching function,
+       This section describes the output when the  normal  matching  function,
        pcre2_match(), is being used.
 
-       When a match succeeds, pcre2test outputs  the  list  of  captured  sub-
-       strings,  starting  with number 0 for the string that matched the whole
+       When  a  match  succeeds,  pcre2test  outputs the list of captured sub-
+       strings, starting with number 0 for the string that matched  the  whole
        pattern.  Otherwise, it outputs "No match" when the return is PCRE2_ER-
-       ROR_NOMATCH,  or  "Partial  match:"  followed by the partially matching
-       substring when the return is PCRE2_ERROR_PARTIAL. (Note  that  this  is
-       the  entire  substring  that was inspected during the partial match; it
-       may include characters before the actual match start  if  a  lookbehind
+       ROR_NOMATCH, or "Partial match:" followed  by  the  partially  matching
+       substring  when  the  return is PCRE2_ERROR_PARTIAL. (Note that this is
+       the entire substring that was inspected during the  partial  match;  it
+       may  include  characters  before the actual match start if a lookbehind
        assertion, \K, \b, or \B was involved.)
 
        For any other return, pcre2test outputs the PCRE2 negative error number
-       and a short descriptive phrase. If the error is  a  failed  UTF  string
-       check,  the  code  unit offset of the start of the failing character is
+       and  a  short  descriptive  phrase. If the error is a failed UTF string
+       check, the code unit offset of the start of the  failing  character  is
        also output. Here is an example of an interactive pcre2test run.
 
          $ pcre2test
@@ -1558,8 +1556,8 @@
        Unset capturing substrings that are not followed by one that is set are
        not shown by pcre2test unless the allcaptures modifier is specified. In
        the following example, there are two capturing substrings, but when the
-       first  data  line is matched, the second, unset substring is not shown.
-       An "internal" unset substring is shown as "<unset>", as for the  second
+       first data line is matched, the second, unset substring is  not  shown.
+       An  "internal" unset substring is shown as "<unset>", as for the second
        data line.
 
            re> /(a)|(b)/
@@ -1571,11 +1569,11 @@
           1: <unset>
           2: b
 
-       If  the strings contain any non-printing characters, they are output as
-       \xhh escapes if the value is less than 256 and UTF  mode  is  not  set.
+       If the strings contain any non-printing characters, they are output  as
+       \xhh  escapes  if  the  value is less than 256 and UTF mode is not set.
        Otherwise they are output as \x{hh...} escapes. See below for the defi-
-       nition of non-printing characters. If the aftertext  modifier  is  set,
-       the  output  for substring 0 is followed by the the rest of the subject
+       nition  of  non-printing  characters. If the aftertext modifier is set,
+       the output for substring 0 is followed by the the rest of  the  subject
        string, identified by "0+" like this:
 
            re> /cat/aftertext
@@ -1595,8 +1593,8 @@
           0: ipp
           1: pp
 
-       "No  match" is output only if the first match attempt fails. Here is an
-       example of a failure message (the offset 4 that  is  specified  by  the
+       "No match" is output only if the first match attempt fails. Here is  an
+       example  of  a  failure  message (the offset 4 that is specified by the
        offset modifier is past the end of the subject string):
 
            re> /xyz/
@@ -1604,7 +1602,7 @@
          Error -24 (bad offset value)
 
        Note that whereas patterns can be continued over several lines (a plain
-       ">" prompt is used for continuations), subject lines may  not.  However
+       ">"  prompt  is used for continuations), subject lines may not. However
        newlines can be included in a subject by means of the \n escape (or \r,
        \r\n, etc., depending on the newline sequence setting).
 
@@ -1612,7 +1610,7 @@
 OUTPUT FROM THE ALTERNATIVE MATCHING FUNCTION
 
        When the alternative matching function, pcre2_dfa_match(), is used, the
-       output  consists  of  a list of all the matches that start at the first
+       output consists of a list of all the matches that start  at  the  first
        point in the subject where there is at least one match. For example:
 
            re> /(tang|tangerine|tan)/
@@ -1621,11 +1619,11 @@
           1: tang
           2: tan
 
-       Using the normal matching function on this data finds only "tang".  The
-       longest  matching string is always given first (and numbered zero). Af-
-       ter a PCRE2_ERROR_PARTIAL return, the output is "Partial match:",  fol-
+       Using  the normal matching function on this data finds only "tang". The
+       longest matching string is always given first (and numbered zero).  Af-
+       ter  a PCRE2_ERROR_PARTIAL return, the output is "Partial match:", fol-
        lowed by the partially matching substring. Note that this is the entire
-       substring that was inspected during the partial match; it  may  include
+       substring  that  was inspected during the partial match; it may include
        characters before the actual match start if a lookbehind assertion, \b,
        or \B was involved. (\K is not supported for DFA matching.)
 
@@ -1641,16 +1639,16 @@
           1: tan
           0: tan
 
-       The  alternative  matching function does not support substring capture,
-       so the modifiers that are concerned with captured  substrings  are  not
+       The alternative matching function does not support  substring  capture,
+       so  the  modifiers  that are concerned with captured substrings are not
        relevant.
 
 
 RESTARTING AFTER A PARTIAL MATCH
 
-       When  the  alternative matching function has given the PCRE2_ERROR_PAR-
+       When the alternative matching function has given  the  PCRE2_ERROR_PAR-
        TIAL return, indicating that the subject partially matched the pattern,
-       you  can restart the match with additional subject data by means of the
+       you can restart the match with additional subject data by means of  the
        dfa_restart modifier. For example:
 
            re> /^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$/
@@ -1659,37 +1657,37 @@
          data> n05\=dfa,dfa_restart
           0: n05
 
-       For further information about partial matching,  see  the  pcre2partial
+       For  further  information  about partial matching, see the pcre2partial
        documentation.
 
 
 CALLOUTS
 
        If the pattern contains any callout requests, pcre2test's callout func-
-       tion is called during matching unless callout_none is  specified.  This
+       tion  is  called during matching unless callout_none is specified. This
        works with both matching functions, and with JIT, though there are some
-       differences in behaviour. The output for callouts with numerical  argu-
+       differences  in behaviour. The output for callouts with numerical argu-
        ments and those with string arguments is slightly different.
 
    Callouts with numerical arguments
 
        By default, the callout function displays the callout number, the start
-       and current positions in the subject text at the callout time, and  the
+       and  current positions in the subject text at the callout time, and the
        next pattern item to be tested. For example:
 
          --->pqrabcdef
            0    ^  ^     \d
 
-       This  output  indicates  that callout number 0 occurred for a match at-
-       tempt starting at the fourth character of the subject string, when  the
-       pointer  was  at  the seventh character, and when the next pattern item
-       was \d. Just one circumflex is output if the start  and  current  posi-
+       This output indicates that callout number 0 occurred for  a  match  at-
+       tempt  starting at the fourth character of the subject string, when the
+       pointer was at the seventh character, and when the  next  pattern  item
+       was  \d.  Just  one circumflex is output if the start and current posi-
        tions are the same, or if the current position precedes the start posi-
        tion, which can happen if the callout is in a lookbehind assertion.
 
        Callouts numbered 255 are assumed to be automatic callouts, inserted as
        a result of the auto_callout pattern modifier. In this case, instead of
-       showing the callout number, the offset in the pattern,  preceded  by  a
+       showing  the  callout  number, the offset in the pattern, preceded by a
        plus, is output. For example:
 
            re> /\d?[A-E]\*/auto_callout
@@ -1716,17 +1714,17 @@
          +12 ^  ^
           0: abc
 
-       The  mark  changes between matching "a" and "b", but stays the same for
-       the rest of the match, so nothing more is output. If, as  a  result  of
-       backtracking,  the  mark  reverts to being unset, the text "<unset>" is
+       The mark changes between matching "a" and "b", but stays the  same  for
+       the  rest  of  the match, so nothing more is output. If, as a result of
+       backtracking, the mark reverts to being unset, the  text  "<unset>"  is
        output.
 
    Callouts with string arguments
 
        The output for a callout with a string argument is similar, except that
-       instead  of outputting a callout number before the position indicators,
-       the callout string and its offset in the pattern string are output  be-
-       fore  the  reflection  of the subject string, and the subject string is
+       instead of outputting a callout number before the position  indicators,
+       the  callout string and its offset in the pattern string are output be-
+       fore the reflection of the subject string, and the  subject  string  is
        reflected for each callout. For example:
 
            re> /^ab(?C'first')cd(?C"second")ef/
@@ -1742,26 +1740,26 @@
 
    Callout modifiers
 
-       The callout function in pcre2test returns zero (carry on  matching)  by
-       default,  but  you can use a callout_fail modifier in a subject line to
+       The  callout  function in pcre2test returns zero (carry on matching) by
+       default, but you can use a callout_fail modifier in a subject  line  to
        change this and other parameters of the callout (see below).
 
        If the callout_capture modifier is set, the current captured groups are
        output when a callout occurs. This is useful only for non-DFA matching,
-       as pcre2_dfa_match() does not support capturing,  so  no  captures  are
+       as  pcre2_dfa_match()  does  not  support capturing, so no captures are
        ever shown.
 
        The normal callout output, showing the callout number or pattern offset
-       (as described above) is suppressed if the callout_no_where modifier  is
+       (as  described above) is suppressed if the callout_no_where modifier is
        set.
 
-       When  using  the  interpretive  matching function pcre2_match() without
-       JIT, setting the callout_extra modifier causes additional  output  from
-       pcre2test's  callout function to be generated. For the first callout in
-       a match attempt at a new starting position in the subject,  "New  match
-       attempt"  is output. If there has been a backtrack since the last call-
+       When using the interpretive  matching  function  pcre2_match()  without
+       JIT,  setting  the callout_extra modifier causes additional output from
+       pcre2test's callout function to be generated. For the first callout  in
+       a  match  attempt at a new starting position in the subject, "New match
+       attempt" is output. If there has been a backtrack since the last  call-
        out (or start of matching if this is the first callout), "Backtrack" is
-       output,  followed  by  "No other matching paths" if the backtrack ended
+       output, followed by "No other matching paths" if  the  backtrack  ended
        the previous match attempt. For example:
 
           re> /(a+)b/auto_callout,no_start_optimize,no_auto_possess
@@ -1798,86 +1796,86 @@
           +1    ^    a+
          No match
 
-       Notice that various optimizations must be turned off if  you  want  all
-       possible  matching  paths  to  be  scanned. If no_start_optimize is not
-       used, there is an immediate "no match", without any  callouts,  because
-       the  starting  optimization  fails to find "b" in the subject, which it
-       knows must be present for any match. If no_auto_possess  is  not  used,
-       the  "a+"  item is turned into "a++", which reduces the number of back-
+       Notice  that  various  optimizations must be turned off if you want all
+       possible matching paths to be  scanned.  If  no_start_optimize  is  not
+       used,  there  is an immediate "no match", without any callouts, because
+       the starting optimization fails to find "b" in the  subject,  which  it
+       knows  must  be  present for any match. If no_auto_possess is not used,
+       the "a+" item is turned into "a++", which reduces the number  of  back-
        tracks.
 
-       The callout_extra modifier has no effect if used with the DFA  matching
+       The  callout_extra modifier has no effect if used with the DFA matching
        function, or with JIT.
 
    Return values from callouts
 
-       The  default  return  from  the  callout function is zero, which allows
+       The default return from the callout  function  is  zero,  which  allows
        matching to continue. The callout_fail modifier can be given one or two
        numbers. If there is only one number, 1 is returned instead of 0 (caus-
        ing matching to backtrack) when a callout of that number is reached. If
-       two  numbers  (<n>:<m>)  are  given,  1 is returned when callout <n> is
-       reached and there have been at least <m>  callouts.  The  callout_error
+       two numbers (<n>:<m>) are given, 1 is  returned  when  callout  <n>  is
+       reached  and  there  have been at least <m> callouts. The callout_error
        modifier is similar, except that PCRE2_ERROR_CALLOUT is returned, caus-
-       ing the entire matching process to be aborted. If both these  modifiers
-       are  set  for  the same callout number, callout_error takes precedence.
-       Note that callouts with string arguments are always  given  the  number
+       ing  the entire matching process to be aborted. If both these modifiers
+       are set for the same callout number,  callout_error  takes  precedence.
+       Note  that  callouts  with string arguments are always given the number
        zero.
 
-       The  callout_data  modifier can be given an unsigned or a negative num-
-       ber.  This is set as the "user data" that is  passed  to  the  matching
-       function,  and  passed  back  when the callout function is invoked. Any
-       value other than zero is used as  a  return  from  pcre2test's  callout
+       The callout_data modifier can be given an unsigned or a  negative  num-
+       ber.   This  is  set  as the "user data" that is passed to the matching
+       function, and passed back when the callout  function  is  invoked.  Any
+       value  other  than  zero  is  used as a return from pcre2test's callout
        function.
 
        Inserting callouts can be helpful when using pcre2test to check compli-
-       cated regular expressions. For further information about callouts,  see
+       cated  regular expressions. For further information about callouts, see
        the pcre2callout documentation.
 
 
 NON-PRINTING CHARACTERS
 
        When pcre2test is outputting text in the compiled version of a pattern,
-       bytes other than 32-126 are always treated as  non-printing  characters
+       bytes  other  than 32-126 are always treated as non-printing characters
        and are therefore shown as hex escapes.
 
-       When  pcre2test  is outputting text that is a matched part of a subject
-       string, it behaves in the same way, unless a different locale has  been
-       set  for the pattern (using the locale modifier). In this case, the is-
+       When pcre2test is outputting text that is a matched part of  a  subject
+       string,  it behaves in the same way, unless a different locale has been
+       set for the pattern (using the locale modifier). In this case, the  is-
        print() function is used to distinguish printing and non-printing char-
        acters.
 
 
 SAVING AND RESTORING COMPILED PATTERNS
 
-       It  is  possible  to  save  compiled patterns on disc or elsewhere, and
+       It is possible to save compiled patterns  on  disc  or  elsewhere,  and
        reload them later, subject to a number of restrictions. JIT data cannot
-       be  saved.  The host on which the patterns are reloaded must be running
+       be saved. The host on which the patterns are reloaded must  be  running
        the same version of PCRE2, with the same code unit width, and must also
-       have  the  same  endianness,  pointer width and PCRE2_SIZE type. Before
-       compiled patterns can be saved they must be serialized, that  is,  con-
-       verted  to a stream of bytes. A single byte stream may contain any num-
-       ber of compiled patterns, but they must all use the same character  ta-
-       bles.  A  single copy of the tables is included in the byte stream (its
+       have the same endianness, pointer width  and  PCRE2_SIZE  type.  Before
+       compiled  patterns  can be saved they must be serialized, that is, con-
+       verted to a stream of bytes. A single byte stream may contain any  num-
+       ber  of compiled patterns, but they must all use the same character ta-
+       bles. A single copy of the tables is included in the byte  stream  (its
        size is 1088 bytes).
 
-       The functions whose names begin with pcre2_serialize_ are used for  se-
-       rializing  and de-serializing. They are described in the pcre2serialize
-       documentation. In this section we describe the  features  of  pcre2test
+       The  functions whose names begin with pcre2_serialize_ are used for se-
+       rializing and de-serializing. They are described in the  pcre2serialize
+       documentation.  In  this  section we describe the features of pcre2test
        that can be used to test these functions.
 
-       Note  that  "serialization" in PCRE2 does not convert compiled patterns
-       to an abstract format like Java or .NET. It  just  makes  a  reloadable
+       Note that "serialization" in PCRE2 does not convert  compiled  patterns
+       to  an  abstract  format  like Java or .NET. It just makes a reloadable
        byte code stream.  Hence the restrictions on reloading mentioned above.
 
-       In  pcre2test,  when  a pattern with push modifier is successfully com-
-       piled, it is pushed onto a stack of compiled  patterns,  and  pcre2test
-       expects  the next line to contain a new pattern (or command) instead of
+       In pcre2test, when a pattern with push modifier  is  successfully  com-
+       piled,  it  is  pushed onto a stack of compiled patterns, and pcre2test
+       expects the next line to contain a new pattern (or command) instead  of
        a subject line. By contrast, the pushcopy modifier causes a copy of the
-       compiled  pattern to be stacked, leaving the original available for im-
-       mediate matching. By using push and/or pushcopy, a number  of  patterns
-       can  be  compiled  and  retained. These modifiers are incompatible with
+       compiled pattern to be stacked, leaving the original available for  im-
+       mediate  matching.  By using push and/or pushcopy, a number of patterns
+       can be compiled and retained. These  modifiers  are  incompatible  with
        posix, and control modifiers that act at match time are ignored (with a
-       message)  for the stacked patterns. The jitverify modifier applies only
+       message) for the stacked patterns. The jitverify modifier applies  only
        at compile time.
 
        The command
@@ -1885,21 +1883,21 @@
          #save <filename>
 
        causes all the stacked patterns to be serialized and the result written
-       to  the named file. Afterwards, all the stacked patterns are freed. The
+       to the named file. Afterwards, all the stacked patterns are freed.  The
        command
 
          #load <filename>
 
-       reads the data in the file, and then arranges for it to  be  de-serial-
-       ized,  with the resulting compiled patterns added to the pattern stack.
-       The pattern on the top of the stack can be retrieved by the  #pop  com-
-       mand,  which  must  be  followed  by  lines  of subjects that are to be
-       matched with the pattern, terminated as usual by an empty line  or  end
-       of  file.  This  command  may be followed by a modifier list containing
-       only control modifiers that act after a pattern has been  compiled.  In
-       particular,  hex,  posix,  posix_nosub,  push, and pushcopy are not al-
-       lowed, nor are any option-setting modifiers.  The  JIT  modifiers  are,
-       however  permitted.  Here is an example that saves and reloads two pat-
+       reads  the  data in the file, and then arranges for it to be de-serial-
+       ized, with the resulting compiled patterns added to the pattern  stack.
+       The  pattern  on the top of the stack can be retrieved by the #pop com-
+       mand, which must be followed by  lines  of  subjects  that  are  to  be
+       matched  with  the pattern, terminated as usual by an empty line or end
+       of file. This command may be followed by  a  modifier  list  containing
+       only  control  modifiers that act after a pattern has been compiled. In
+       particular, hex, posix, posix_nosub, push, and  pushcopy  are  not  al-
+       lowed,  nor  are  any option-setting modifiers.  The JIT modifiers are,
+       however permitted. Here is an example that saves and reloads  two  pat-
        terns.
 
          /abc/push
@@ -1912,10 +1910,10 @@
          #pop jit,bincode
          abc
 
-       If jitverify is used with #pop, it does not  automatically  imply  jit,
+       If  jitverify  is  used with #pop, it does not automatically imply jit,
        which is different behaviour from when it is used on a pattern.
 
-       The  #popcopy  command is analagous to the pushcopy modifier in that it
+       The #popcopy command is analagous to the pushcopy modifier in  that  it
        makes current a copy of the topmost stack pattern, leaving the original
        still on the stack.
 
@@ -1929,11 +1927,11 @@
 AUTHOR
 
        Philip Hazel
-       University Computing Service
+       Retired from University Computing Service
        Cambridge, England.
 
 
 REVISION
 
-       Last updated: 28 April 2021
+       Last updated: 30 August 2021
        Copyright (c) 1997-2021 University of Cambridge.
diff --git a/dist2/doc/pcre2unicode.3 b/doc/pcre2unicode.3
similarity index 100%
rename from dist2/doc/pcre2unicode.3
rename to doc/pcre2unicode.3
diff --git a/include/pcre2.h b/include/pcre2.h
index cecf6ba..8962f9d 100644
--- a/include/pcre2.h
+++ b/include/pcre2.h
@@ -1,10 +1,5 @@
-
-#ifndef _INCLUDE_PCRE2_H_
-#define _INCLUDE_PCRE2_H_
+#pragma once
 
 #define PCRE2_CODE_UNIT_WIDTH 8
 
-#include "../dist2/src/pcre2.h.generic"
-
-
-#endif // _INCLUDE_PCRE2_H_
+#include "../src/pcre2.h.generic"
diff --git a/dist2/install-sh b/install-sh
similarity index 100%
rename from dist2/install-sh
rename to install-sh
diff --git a/dist2/libpcre2-16.pc.in b/libpcre2-16.pc.in
similarity index 100%
rename from dist2/libpcre2-16.pc.in
rename to libpcre2-16.pc.in
diff --git a/dist2/libpcre2-32.pc.in b/libpcre2-32.pc.in
similarity index 100%
rename from dist2/libpcre2-32.pc.in
rename to libpcre2-32.pc.in
diff --git a/dist2/libpcre2-8.pc.in b/libpcre2-8.pc.in
similarity index 100%
rename from dist2/libpcre2-8.pc.in
rename to libpcre2-8.pc.in
diff --git a/dist2/libpcre2-posix.pc.in b/libpcre2-posix.pc.in
similarity index 100%
rename from dist2/libpcre2-posix.pc.in
rename to libpcre2-posix.pc.in
diff --git a/dist2/ltmain.sh b/ltmain.sh
similarity index 100%
rename from dist2/ltmain.sh
rename to ltmain.sh
diff --git a/dist2/m4/ax_pthread.m4 b/m4/ax_pthread.m4
similarity index 100%
rename from dist2/m4/ax_pthread.m4
rename to m4/ax_pthread.m4
diff --git a/dist2/m4/libtool.m4 b/m4/libtool.m4
similarity index 100%
rename from dist2/m4/libtool.m4
rename to m4/libtool.m4
diff --git a/dist2/m4/ltoptions.m4 b/m4/ltoptions.m4
similarity index 100%
rename from dist2/m4/ltoptions.m4
rename to m4/ltoptions.m4
diff --git a/dist2/m4/ltsugar.m4 b/m4/ltsugar.m4
similarity index 100%
rename from dist2/m4/ltsugar.m4
rename to m4/ltsugar.m4
diff --git a/dist2/m4/ltversion.m4 b/m4/ltversion.m4
similarity index 100%
rename from dist2/m4/ltversion.m4
rename to m4/ltversion.m4
diff --git a/dist2/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
similarity index 100%
rename from dist2/m4/lt~obsolete.m4
rename to m4/lt~obsolete.m4
diff --git a/dist2/m4/pcre2_visibility.m4 b/m4/pcre2_visibility.m4
similarity index 100%
rename from dist2/m4/pcre2_visibility.m4
rename to m4/pcre2_visibility.m4
diff --git a/dist2/missing b/missing
similarity index 98%
rename from dist2/missing
rename to missing
index 8d0eaad..1fe1611 100755
--- a/dist2/missing
+++ b/missing
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 1996-2020 Free Software Foundation, Inc.
+# Copyright (C) 1996-2021 Free Software Foundation, Inc.
 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 
 # This program is free software; you can redistribute it and/or modify
diff --git a/dist2/pcre2-config.in b/pcre2-config.in
similarity index 100%
rename from dist2/pcre2-config.in
rename to pcre2-config.in
diff --git a/dist2/perltest.sh b/perltest.sh
similarity index 100%
rename from dist2/perltest.sh
rename to perltest.sh
diff --git a/include_internal/config.h b/src/config.h
similarity index 98%
rename from include_internal/config.h
rename to src/config.h
index a9d1316..08cc59f 100644
--- a/include_internal/config.h
+++ b/src/config.h
@@ -104,6 +104,9 @@
 /* Define to 1 if you have the <readline/readline.h> header file. */
 /* #undef HAVE_READLINE_READLINE_H */
 
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
 /* Define to 1 if you have the `secure_getenv' function. */
 /* #undef HAVE_SECURE_GETENV */
 
@@ -214,7 +217,7 @@
 #define PACKAGE_NAME "PCRE2"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "PCRE2 10.37"
+#define PACKAGE_STRING "PCRE2 10.38"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "pcre2"
@@ -223,7 +226,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "10.37"
+#define PACKAGE_VERSION "10.38"
 
 /* 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
@@ -421,7 +424,7 @@
 
 
 /* Version number of package */
-#define VERSION "10.37"
+#define VERSION "10.38"
 
 /* Define to empty if `const' does not conform to ANSI C. */
 /* #undef const */
diff --git a/dist2/src/config.h.generic b/src/config.h.generic
similarity index 98%
rename from dist2/src/config.h.generic
rename to src/config.h.generic
index e620bb0..d07aa60 100644
--- a/dist2/src/config.h.generic
+++ b/src/config.h.generic
@@ -103,6 +103,9 @@
 /* Define to 1 if you have the <readline/readline.h> header file. */
 /* #undef HAVE_READLINE_READLINE_H */
 
+/* Define to 1 if you have the `realpath' function. */
+/* #undef HAVE_REALPATH */
+
 /* Define to 1 if you have the `secure_getenv' function. */
 /* #undef HAVE_SECURE_GETENV */
 
@@ -230,7 +233,7 @@
 #define PACKAGE_NAME "PCRE2"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "PCRE2 10.37"
+#define PACKAGE_STRING "PCRE2 10.38"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "pcre2"
@@ -239,7 +242,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "10.37"
+#define PACKAGE_VERSION "10.38"
 
 /* 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
@@ -432,7 +435,7 @@
 #endif
 
 /* Version number of package */
-#define VERSION "10.37"
+#define VERSION "10.38"
 
 /* Define to empty if `const' does not conform to ANSI C. */
 /* #undef const */
diff --git a/dist2/src/config.h.in b/src/config.h.in
similarity index 99%
rename from dist2/src/config.h.in
rename to src/config.h.in
index e7ab064..99add60 100644
--- a/dist2/src/config.h.in
+++ b/src/config.h.in
@@ -103,6 +103,9 @@
 /* Define to 1 if you have the <readline/readline.h> header file. */
 #undef HAVE_READLINE_READLINE_H
 
+/* Define to 1 if you have the `realpath' function. */
+#undef HAVE_REALPATH
+
 /* Define to 1 if you have the `secure_getenv' function. */
 #undef HAVE_SECURE_GETENV
 
diff --git a/dist2/src/pcre2.h.generic b/src/pcre2.h
similarity index 98%
copy from dist2/src/pcre2.h.generic
copy to src/pcre2.h
index 7ab6b39..2175caa 100644
--- a/dist2/src/pcre2.h.generic
+++ b/src/pcre2.h
@@ -5,7 +5,7 @@
 /* This is the public header file for the PCRE library, second API, to be
 #included by applications that call PCRE2 functions.
 
-           Copyright (c) 2016-2020 University of Cambridge
+           Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,9 @@
 /* The current PCRE version information. */
 
 #define PCRE2_MAJOR           10
-#define PCRE2_MINOR           37
+#define PCRE2_MINOR           38
 #define PCRE2_PRERELEASE      
-#define PCRE2_DATE            2021-05-26
+#define PCRE2_DATE            2021-10-01
 
 /* When an application links to a PCRE DLL in Windows, the symbols that are
 imported have to be identified as such. When building PCRE2, the appropriate
@@ -152,6 +152,7 @@
 #define PCRE2_EXTRA_MATCH_LINE               0x00000008u  /* C */
 #define PCRE2_EXTRA_ESCAPED_CR_IS_LF         0x00000010u  /* C */
 #define PCRE2_EXTRA_ALT_BSUX                 0x00000020u  /* C */
+#define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK     0x00000040u  /* C */
 
 /* These are for pcre2_jit_compile(). */
 
@@ -311,6 +312,7 @@
 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE       196
 #define PCRE2_ERROR_TOO_MANY_CAPTURES              197
 #define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED  198
+#define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND      199
 
 
 /* "Expected" matching error codes: no match and partial match. */
diff --git a/dist2/src/pcre2.h.generic b/src/pcre2.h.generic
similarity index 99%
rename from dist2/src/pcre2.h.generic
rename to src/pcre2.h.generic
index 7ab6b39..2175caa 100644
--- a/dist2/src/pcre2.h.generic
+++ b/src/pcre2.h.generic
@@ -5,7 +5,7 @@
 /* This is the public header file for the PCRE library, second API, to be
 #included by applications that call PCRE2 functions.
 
-           Copyright (c) 2016-2020 University of Cambridge
+           Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -42,9 +42,9 @@
 /* The current PCRE version information. */
 
 #define PCRE2_MAJOR           10
-#define PCRE2_MINOR           37
+#define PCRE2_MINOR           38
 #define PCRE2_PRERELEASE      
-#define PCRE2_DATE            2021-05-26
+#define PCRE2_DATE            2021-10-01
 
 /* When an application links to a PCRE DLL in Windows, the symbols that are
 imported have to be identified as such. When building PCRE2, the appropriate
@@ -152,6 +152,7 @@
 #define PCRE2_EXTRA_MATCH_LINE               0x00000008u  /* C */
 #define PCRE2_EXTRA_ESCAPED_CR_IS_LF         0x00000010u  /* C */
 #define PCRE2_EXTRA_ALT_BSUX                 0x00000020u  /* C */
+#define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK     0x00000040u  /* C */
 
 /* These are for pcre2_jit_compile(). */
 
@@ -311,6 +312,7 @@
 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE       196
 #define PCRE2_ERROR_TOO_MANY_CAPTURES              197
 #define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED  198
+#define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND      199
 
 
 /* "Expected" matching error codes: no match and partial match. */
diff --git a/dist2/src/pcre2.h.in b/src/pcre2.h.in
similarity index 99%
rename from dist2/src/pcre2.h.in
rename to src/pcre2.h.in
index 4fd6a1e..d44a311 100644
--- a/dist2/src/pcre2.h.in
+++ b/src/pcre2.h.in
@@ -5,7 +5,7 @@
 /* This is the public header file for the PCRE library, second API, to be
 #included by applications that call PCRE2 functions.
 
-           Copyright (c) 2016-2020 University of Cambridge
+           Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -152,6 +152,7 @@
 #define PCRE2_EXTRA_MATCH_LINE               0x00000008u  /* C */
 #define PCRE2_EXTRA_ESCAPED_CR_IS_LF         0x00000010u  /* C */
 #define PCRE2_EXTRA_ALT_BSUX                 0x00000020u  /* C */
+#define PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK     0x00000040u  /* C */
 
 /* These are for pcre2_jit_compile(). */
 
@@ -311,6 +312,7 @@
 #define PCRE2_ERROR_SCRIPT_RUN_NOT_AVAILABLE       196
 #define PCRE2_ERROR_TOO_MANY_CAPTURES              197
 #define PCRE2_ERROR_CONDITION_ATOMIC_ASSERTION_EXPECTED  198
+#define PCRE2_ERROR_BACKSLASH_K_IN_LOOKAROUND      199
 
 
 /* "Expected" matching error codes: no match and partial match. */
diff --git a/dist2/src/pcre2_auto_possess.c b/src/pcre2_auto_possess.c
similarity index 100%
rename from dist2/src/pcre2_auto_possess.c
rename to src/pcre2_auto_possess.c
diff --git a/src/pcre2_chartables.c b/src/pcre2_chartables.c
new file mode 120000
index 0000000..aca471c
--- /dev/null
+++ b/src/pcre2_chartables.c
@@ -0,0 +1 @@
+pcre2_chartables.c.dist
\ No newline at end of file
diff --git a/dist2/src/pcre2_chartables.c.dist b/src/pcre2_chartables.c.dist
similarity index 100%
rename from dist2/src/pcre2_chartables.c.dist
rename to src/pcre2_chartables.c.dist
diff --git a/dist2/src/pcre2_compile.c b/src/pcre2_compile.c
similarity index 99%
rename from dist2/src/pcre2_compile.c
rename to src/pcre2_compile.c
index da449ae..383159b 100644
--- a/dist2/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -7,7 +7,7 @@
 
                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-          New API code Copyright (c) 2016-2020 University of Cambridge
+          New API code Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -137,7 +137,7 @@
 
 static int
   check_lookbehinds(uint32_t *, uint32_t **, parsed_recurse_check *,
-    compile_block *);
+    compile_block *, int *);
 
 
 /*************************************************
@@ -782,12 +782,15 @@
 #define PUBLIC_COMPILE_EXTRA_OPTIONS \
    (PUBLIC_LITERAL_COMPILE_EXTRA_OPTIONS| \
     PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES|PCRE2_EXTRA_BAD_ESCAPE_IS_LITERAL| \
-    PCRE2_EXTRA_ESCAPED_CR_IS_LF|PCRE2_EXTRA_ALT_BSUX)
+    PCRE2_EXTRA_ESCAPED_CR_IS_LF|PCRE2_EXTRA_ALT_BSUX| \
+    PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
 
 /* Compile time error code numbers. They are given names so that they can more
 easily be tracked. When a new number is added, the tables called eint1 and
 eint2 in pcre2posix.c may need to be updated, and a new error text must be
-added to compile_error_texts in pcre2_error.c. */
+added to compile_error_texts in pcre2_error.c. Also, the error codes in
+pcre2.h.in must be updated - their values are exactly 100 greater than these
+values. */
 
 enum { ERR0 = COMPILE_ERROR_BASE,
        ERR1,  ERR2,  ERR3,  ERR4,  ERR5,  ERR6,  ERR7,  ERR8,  ERR9,  ERR10,
@@ -799,7 +802,7 @@
        ERR61, ERR62, ERR63, ERR64, ERR65, ERR66, ERR67, ERR68, ERR69, ERR70,
        ERR71, ERR72, ERR73, ERR74, ERR75, ERR76, ERR77, ERR78, ERR79, ERR80,
        ERR81, ERR82, ERR83, ERR84, ERR85, ERR86, ERR87, ERR88, ERR89, ERR90,
-       ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98 };
+       ERR91, ERR92, ERR93, ERR94, ERR95, ERR96, ERR97, ERR98, ERR99 };
 
 /* This is a table of start-of-pattern options such as (*UTF) and settings such
 as (*LIMIT_MATCH=nnnn) and (*CRLF). For completeness and backward
@@ -7799,6 +7802,16 @@
       }
 #endif
 
+    /* \K is forbidden in lookarounds since 10.38 because that's what Perl has
+    done. However, there's an option, in case anyone was relying on it. */
+
+    if (cb->assert_depth > 0 && meta_arg == ESC_K &&
+        (cb->cx->extra_options & PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) == 0)
+      {
+      *errorcodeptr = ERR99;
+      return 0;
+      }
+
     /* For the rest (including \X when Unicode is supported - if not it's
     faulted at parse time), the OP value is the escape value when PCRE2_UCP is
     not set; if it is set, these escapes do not show up here because they are
@@ -9148,7 +9161,7 @@
     case META_LOOKAHEAD:
     case META_LOOKAHEADNOT:
     case META_LOOKAHEAD_NA:
-    *errcodeptr = check_lookbehinds(pptr + 1, &pptr, recurses, cb);
+    *errcodeptr = check_lookbehinds(pptr + 1, &pptr, recurses, cb, lcptr);
     if (*errcodeptr != 0) return -1;
 
     /* Ignore any qualifiers that follow a lookahead assertion. */
@@ -9488,16 +9501,16 @@
   retptr    if not NULL, return the ket pointer here
   recurses  chain of recurse_check to catch mutual recursion
   cb        points to the compile block
+  lcptr     points to loop counter
 
 Returns:    0 on success, or an errorcode (cb->erroroffset will be set)
 */
 
 static int
 check_lookbehinds(uint32_t *pptr, uint32_t **retptr,
-  parsed_recurse_check *recurses, compile_block *cb)
+  parsed_recurse_check *recurses, compile_block *cb, int *lcptr)
 {
 int errorcode = 0;
-int loopcount = 0;
 int nestlevel = 0;
 
 cb->erroroffset = PCRE2_UNSET;
@@ -9623,7 +9636,7 @@
     case META_LOOKBEHIND:
     case META_LOOKBEHINDNOT:
     case META_LOOKBEHIND_NA:
-    if (!set_lookbehind_lengths(&pptr, &errorcode, &loopcount, recurses, cb))
+    if (!set_lookbehind_lengths(&pptr, &errorcode, lcptr, recurses, cb))
       return errorcode;
     break;
     }
@@ -10078,7 +10091,8 @@
 
 if (has_lookbehind)
   {
-  errorcode = check_lookbehinds(cb.parsed_pattern, NULL, NULL, &cb);
+  int loopcount = 0;
+  errorcode = check_lookbehinds(cb.parsed_pattern, NULL, NULL, &cb, &loopcount);
   if (errorcode != 0) goto HAD_CB_ERROR;
   }
 
diff --git a/dist2/src/pcre2_config.c b/src/pcre2_config.c
similarity index 100%
rename from dist2/src/pcre2_config.c
rename to src/pcre2_config.c
diff --git a/dist2/src/pcre2_context.c b/src/pcre2_context.c
similarity index 100%
rename from dist2/src/pcre2_context.c
rename to src/pcre2_context.c
diff --git a/dist2/src/pcre2_convert.c b/src/pcre2_convert.c
similarity index 100%
rename from dist2/src/pcre2_convert.c
rename to src/pcre2_convert.c
diff --git a/dist2/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c
similarity index 98%
rename from dist2/src/pcre2_dfa_match.c
rename to src/pcre2_dfa_match.c
index 625695b..060dc76 100644
--- a/dist2/src/pcre2_dfa_match.c
+++ b/src/pcre2_dfa_match.c
@@ -7,7 +7,7 @@
 
                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-          New API code Copyright (c) 2016-2020 University of Cambridge
+          New API code Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -3256,8 +3256,8 @@
 BOOL has_req_cu = FALSE;
 
 #if PCRE2_CODE_UNIT_WIDTH == 8
-BOOL memchr_not_found_first_cu = FALSE;
-BOOL memchr_not_found_first_cu2 = FALSE;
+PCRE2_SPTR memchr_found_first_cu = NULL;
+PCRE2_SPTR memchr_found_first_cu2 = NULL;
 #endif
 
 PCRE2_UCHAR first_cu = 0;
@@ -3648,13 +3648,7 @@
         }
       }
 
-    /* Not anchored. Advance to a unique first code unit if there is one. In
-    8-bit mode, the use of memchr() gives a big speed up, even though we have
-    to call it twice in caseless mode, in order to find the earliest occurrence
-    of the character in either of its cases. If a call to memchr() that
-    searches the rest of the subject fails to find one case, remember that in
-    order not to keep on repeating the search. This can make a huge difference
-    when the strings are very long and only one case is present. */
+    /* Not anchored. Advance to a unique first code unit if there is one. */
 
     else
       {
@@ -3662,43 +3656,68 @@
         {
         if (first_cu != first_cu2)  /* Caseless */
           {
+          /* In 16-bit and 32_bit modes we have to do our own search, so can
+          look for both cases at once. */
+
 #if PCRE2_CODE_UNIT_WIDTH != 8
           PCRE2_UCHAR smc;
           while (start_match < end_subject &&
                 (smc = UCHAR21TEST(start_match)) != first_cu &&
-                  smc != first_cu2)
+                 smc != first_cu2)
             start_match++;
+#else
+          /* In 8-bit mode, the use of memchr() gives a big speed up, even
+          though we have to call it twice in order to find the earliest
+          occurrence of the code unit in either of its cases. Caching is used
+          to remember the positions of previously found code units. This can
+          make a huge difference when the strings are very long and only one
+          case is actually present. */
 
-#else  /* 8-bit code units */
           PCRE2_SPTR pp1 = NULL;
           PCRE2_SPTR pp2 = NULL;
-          PCRE2_SIZE cu2size = end_subject - start_match;
+          PCRE2_SIZE searchlength = end_subject - start_match;
 
-          if (!memchr_not_found_first_cu)
+          /* If we haven't got a previously found position for first_cu, or if
+          the current starting position is later, we need to do a search. If
+          the code unit is not found, set it to the end. */
+
+          if (memchr_found_first_cu == NULL ||
+              start_match > memchr_found_first_cu)
             {
-            pp1 = memchr(start_match, first_cu, end_subject - start_match);
-            if (pp1 == NULL) memchr_not_found_first_cu = TRUE;
-              else cu2size = pp1 - start_match;
+            pp1 = memchr(start_match, first_cu, searchlength);
+            memchr_found_first_cu = (pp1 == NULL)? end_subject : pp1;
             }
 
-          /* If pp1 is not NULL, we have arranged to search only as far as pp1,
-          to see if the other case is earlier, so we can set "not found" only
-          when both searches have returned NULL. */
+          /* If the start is before a previously found position, use the
+          previous position, or NULL if a previous search failed. */
 
-          if (!memchr_not_found_first_cu2)
+          else pp1 = (memchr_found_first_cu == end_subject)? NULL :
+            memchr_found_first_cu;
+
+          /* Do the same thing for the other case. */
+
+          if (memchr_found_first_cu2 == NULL ||
+              start_match > memchr_found_first_cu2)
             {
-            pp2 = memchr(start_match, first_cu2, cu2size);
-            memchr_not_found_first_cu2 = (pp2 == NULL && pp1 == NULL);
+            pp2 = memchr(start_match, first_cu2, searchlength);
+            memchr_found_first_cu2 = (pp2 == NULL)? end_subject : pp2;
             }
 
+          else pp2 = (memchr_found_first_cu2 == end_subject)? NULL :
+            memchr_found_first_cu2;
+
+          /* Set the start to the end of the subject if neither case was found.
+          Otherwise, use the earlier found point. */
+
           if (pp1 == NULL)
             start_match = (pp2 == NULL)? end_subject : pp2;
           else
             start_match = (pp2 == NULL || pp1 < pp2)? pp1 : pp2;
-#endif
+
+#endif  /* 8-bit handling */
           }
 
-        /* The caseful case */
+        /* The caseful case is much simpler. */
 
         else
           {
diff --git a/dist2/src/pcre2_dftables.c b/src/pcre2_dftables.c
similarity index 100%
rename from dist2/src/pcre2_dftables.c
rename to src/pcre2_dftables.c
diff --git a/dist2/src/pcre2_error.c b/src/pcre2_error.c
similarity index 98%
rename from dist2/src/pcre2_error.c
rename to src/pcre2_error.c
index c61648c..3dee63d 100644
--- a/dist2/src/pcre2_error.c
+++ b/src/pcre2_error.c
@@ -7,7 +7,7 @@
 
                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-          New API code Copyright (c) 2016-2019 University of Cambridge
+          New API code Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -186,6 +186,7 @@
   "script runs require Unicode support, which this version of PCRE2 does not have\0"
   "too many capturing groups (maximum 65535)\0"
   "atomic assertion expected after (?( or (?(?C)\0"
+  "\\K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)\0"
   ;
 
 /* Match-time and UTF error texts are in the same format. */
diff --git a/dist2/src/pcre2_extuni.c b/src/pcre2_extuni.c
similarity index 100%
rename from dist2/src/pcre2_extuni.c
rename to src/pcre2_extuni.c
diff --git a/dist2/src/pcre2_find_bracket.c b/src/pcre2_find_bracket.c
similarity index 100%
rename from dist2/src/pcre2_find_bracket.c
rename to src/pcre2_find_bracket.c
diff --git a/dist2/src/pcre2_fuzzsupport.c b/src/pcre2_fuzzsupport.c
similarity index 100%
rename from dist2/src/pcre2_fuzzsupport.c
rename to src/pcre2_fuzzsupport.c
diff --git a/dist2/src/pcre2_internal.h b/src/pcre2_internal.h
similarity index 100%
rename from dist2/src/pcre2_internal.h
rename to src/pcre2_internal.h
diff --git a/dist2/src/pcre2_intmodedep.h b/src/pcre2_intmodedep.h
similarity index 100%
rename from dist2/src/pcre2_intmodedep.h
rename to src/pcre2_intmodedep.h
diff --git a/dist2/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
similarity index 99%
rename from dist2/src/pcre2_jit_compile.c
rename to src/pcre2_jit_compile.c
index f3a26ae..495920d 100644
--- a/dist2/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -1236,15 +1236,16 @@
 
 return: current number of iterators enhanced with fast fail
 */
-static int detect_early_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start, sljit_s32 depth, int start)
+static int detect_early_fail(compiler_common *common, PCRE2_SPTR cc, int *private_data_start,
+   sljit_s32 depth, int start, BOOL fast_forward_allowed)
 {
 PCRE2_SPTR begin = cc;
 PCRE2_SPTR next_alt;
 PCRE2_SPTR end;
 PCRE2_SPTR accelerated_start;
+BOOL prev_fast_forward_allowed;
 int result = 0;
 int count;
-BOOL fast_forward_allowed = TRUE;
 
 SLJIT_ASSERT(*cc == OP_ONCE || *cc == OP_BRA || *cc == OP_CBRA);
 SLJIT_ASSERT(*cc != OP_CBRA || common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] != 0);
@@ -1476,6 +1477,7 @@
       case OP_CBRA:
       end = cc + GET(cc, 1);
 
+      prev_fast_forward_allowed = fast_forward_allowed;
       fast_forward_allowed = FALSE;
       if (depth >= 4)
         break;
@@ -1484,7 +1486,7 @@
       if (*end != OP_KET || (*cc == OP_CBRA && common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0))
         break;
 
-      count = detect_early_fail(common, cc, private_data_start, depth + 1, count);
+      count = detect_early_fail(common, cc, private_data_start, depth + 1, count, prev_fast_forward_allowed);
 
       if (PRIVATE_DATA(cc) != 0)
         common->private_data_ptrs[begin - common->start] = 1;
@@ -8135,7 +8137,7 @@
     }
   else
     OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
-  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
 
   if (!common->endonly)
     compile_simple_assertion_matchingpath(common, OP_EODN, cc, backtracks);
@@ -8155,7 +8157,7 @@
     }
   else
     OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTEOL);
-  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
   check_partial(common, FALSE);
   jump[0] = JUMP(SLJIT_JUMP);
   JUMPHERE(jump[1]);
@@ -8195,14 +8197,14 @@
     OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, begin));
     add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
     OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(TMP2), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
-    add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+    add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
     }
   else
     {
     OP1(SLJIT_MOV, TMP1, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, begin));
     add_jump(compiler, backtracks, CMP(SLJIT_GREATER, STR_PTR, 0, TMP1, 0));
     OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
-    add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+    add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
     }
   return cc;
 
@@ -8221,7 +8223,7 @@
     jump[1] = CMP(SLJIT_GREATER, STR_PTR, 0, TMP2, 0);
     OP2(SLJIT_AND32 | SLJIT_SET_Z, SLJIT_UNUSED, 0, SLJIT_MEM1(ARGUMENTS), SLJIT_OFFSETOF(jit_arguments, options), SLJIT_IMM, PCRE2_NOTBOL);
     }
-  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO32));
+  add_jump(compiler, backtracks, JUMP(SLJIT_NOT_ZERO));
   jump[0] = JUMP(SLJIT_JUMP);
   JUMPHERE(jump[1]);
 
@@ -9575,11 +9577,11 @@
 
 /* Check return value. */
 OP2(SLJIT_SUB32 | SLJIT_SET_Z | SLJIT_SET_SIG_GREATER, SLJIT_UNUSED, 0, SLJIT_RETURN_REG, 0, SLJIT_IMM, 0);
-add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER32));
+add_jump(compiler, &backtrack->topbacktracks, JUMP(SLJIT_SIG_GREATER));
 if (common->abort_label == NULL)
-  add_jump(compiler, &common->abort, JUMP(SLJIT_NOT_EQUAL32) /* SIG_LESS */);
+  add_jump(compiler, &common->abort, JUMP(SLJIT_NOT_EQUAL) /* SIG_LESS */);
 else
-  JUMPTO(SLJIT_NOT_EQUAL32 /* SIG_LESS */, common->abort_label);
+  JUMPTO(SLJIT_NOT_EQUAL /* SIG_LESS */, common->abort_label);
 return cc + callout_length;
 }
 
@@ -11226,7 +11228,7 @@
 early_fail_ptr >>= 3;
 
 /* During recursion, these optimizations are disabled. */
-if (common->early_fail_start_ptr == 0)
+if (common->early_fail_start_ptr == 0 && common->fast_forward_bc_ptr == NULL)
   {
   early_fail_ptr = 0;
   early_fail_type = type_skip;
@@ -13657,7 +13659,7 @@
 private_data_size = common->cbra_ptr + (re->top_bracket + 1) * sizeof(sljit_sw);
 
 if ((re->overall_options & PCRE2_ANCHORED) == 0 && (re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0 && !common->has_skip_in_assert_back)
-  detect_early_fail(common, common->start, &private_data_size, 0, 0);
+  detect_early_fail(common, common->start, &private_data_size, 0, 0, TRUE);
 
 set_private_data_ptrs(common, &private_data_size, ccend);
 
diff --git a/dist2/src/pcre2_jit_match.c b/src/pcre2_jit_match.c
similarity index 100%
rename from dist2/src/pcre2_jit_match.c
rename to src/pcre2_jit_match.c
diff --git a/dist2/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c
similarity index 100%
rename from dist2/src/pcre2_jit_misc.c
rename to src/pcre2_jit_misc.c
diff --git a/dist2/src/pcre2_jit_neon_inc.h b/src/pcre2_jit_neon_inc.h
similarity index 100%
rename from dist2/src/pcre2_jit_neon_inc.h
rename to src/pcre2_jit_neon_inc.h
diff --git a/dist2/src/pcre2_jit_simd_inc.h b/src/pcre2_jit_simd_inc.h
similarity index 98%
rename from dist2/src/pcre2_jit_simd_inc.h
rename to src/pcre2_jit_simd_inc.h
index 5fd97b1..aa029cc 100644
--- a/dist2/src/pcre2_jit_simd_inc.h
+++ b/src/pcre2_jit_simd_inc.h
@@ -1356,8 +1356,6 @@
   sljit_emit_op_custom(compiler, instruction, 6);
   }
 
-/* TODO: use sljit_set_current_flags */
-
 /* VLGVB */
 instruction[0] = (sljit_u16)(0xe700 | (tmp1_reg_ind << 4) | data_ind);
 instruction[1] = 7;
@@ -1403,7 +1401,8 @@
   sljit_emit_op_custom(compiler, instruction, 6);
   }
 
-/* TODO: use sljit_set_current_flags */
+sljit_set_current_flags(compiler, SLJIT_SET_OVERFLOW);
+JUMPTO(SLJIT_OVERFLOW, start);
 
 /* VLGVB */
 instruction[0] = (sljit_u16)(0xe700 | (tmp1_reg_ind << 4) | data_ind);
@@ -1411,8 +1410,6 @@
 instruction[2] = (sljit_u16)((0x4 << 8) | 0x21);
 sljit_emit_op_custom(compiler, instruction, 6);
 
-CMPTO(SLJIT_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, 16, start);
-
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP1, 0);
 
 JUMPHERE(quit);
@@ -1549,8 +1546,6 @@
   sljit_emit_op_custom(compiler, instruction, 6);
   }
 
-/* TODO: use sljit_set_current_flags */
-
 /* VLGVB */
 instruction[0] = (sljit_u16)(0xe700 | (tmp3_reg_ind << 4) | data_ind);
 instruction[1] = 7;
@@ -1594,7 +1589,8 @@
   sljit_emit_op_custom(compiler, instruction, 6);
   }
 
-/* TODO: use sljit_set_current_flags */
+sljit_set_current_flags(compiler, SLJIT_SET_OVERFLOW);
+JUMPTO(SLJIT_OVERFLOW, start);
 
 /* VLGVB */
 instruction[0] = (sljit_u16)(0xe700 | (tmp3_reg_ind << 4) | data_ind);
@@ -1602,8 +1598,6 @@
 instruction[2] = (sljit_u16)((0x4 << 8) | 0x21);
 sljit_emit_op_custom(compiler, instruction, 6);
 
-CMPTO(SLJIT_GREATER_EQUAL, TMP3, 0, SLJIT_IMM, 16, start);
-
 OP2(SLJIT_ADD, TMP1, 0, TMP1, 0, TMP3, 0);
 
 JUMPHERE(quit);
@@ -1778,8 +1772,6 @@
 instruction[2] = (sljit_u16)((0xe << 8) | 0x81);
 sljit_emit_op_custom(compiler, instruction, 6);
 
-/* TODO: use sljit_set_current_flags */
-
 /* VLGVB */
 instruction[0] = (sljit_u16)(0xe700 | (tmp1_reg_ind << 4) | data1_ind);
 instruction[1] = 7;
@@ -1819,7 +1811,8 @@
 instruction[2] = (sljit_u16)((0xe << 8) | 0x81);
 sljit_emit_op_custom(compiler, instruction, 6);
 
-/* TODO: use sljit_set_current_flags */
+sljit_set_current_flags(compiler, SLJIT_SET_OVERFLOW);
+JUMPTO(SLJIT_OVERFLOW, start);
 
 /* VLGVB */
 instruction[0] = (sljit_u16)(0xe700 | (tmp2_reg_ind << 4) | data1_ind);
@@ -1827,8 +1820,6 @@
 instruction[2] = (sljit_u16)((0x4 << 8) | 0x21);
 sljit_emit_op_custom(compiler, instruction, 6);
 
-CMPTO(SLJIT_GREATER_EQUAL, TMP2, 0, SLJIT_IMM, 16, start);
-
 OP2(SLJIT_ADD, STR_PTR, 0, STR_PTR, 0, TMP2, 0);
 
 JUMPHERE(quit);
diff --git a/dist2/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
similarity index 99%
rename from dist2/src/pcre2_jit_test.c
rename to src/pcre2_jit_test.c
index d935887..f748016 100644
--- a/dist2/src/pcre2_jit_test.c
+++ b/src/pcre2_jit_test.c
@@ -351,6 +351,7 @@
 	{ MU, A, 0, 0, ".[ab]*a", "xxa" },
 	{ MU, A, 0, 0, ".[ab]?.", "xx" },
 	{ MU, A, 0, 0, "_[ab]+_*a", "_aa" },
+	{ MU, A, 0, 0, "#(A+)#\\d+", "#A#A#0" },
 
 	/* Bracket repeats with limit. */
 	{ MU, A, 0, 0, "(?:(ab){2}){5}M", "abababababababababababM" },
diff --git a/dist2/src/pcre2_maketables.c b/src/pcre2_maketables.c
similarity index 100%
rename from dist2/src/pcre2_maketables.c
rename to src/pcre2_maketables.c
diff --git a/dist2/src/pcre2_match.c b/src/pcre2_match.c
similarity index 98%
rename from dist2/src/pcre2_match.c
rename to src/pcre2_match.c
index ed60517..f28cdbb 100644
--- a/dist2/src/pcre2_match.c
+++ b/src/pcre2_match.c
@@ -7,7 +7,7 @@
 
                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-          New API code Copyright (c) 2015-2020 University of Cambridge
+          New API code Copyright (c) 2015-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -6117,8 +6117,8 @@
 BOOL startline;
 
 #if PCRE2_CODE_UNIT_WIDTH == 8
-BOOL memchr_not_found_first_cu;
-BOOL memchr_not_found_first_cu2;
+PCRE2_SPTR memchr_found_first_cu;
+PCRE2_SPTR memchr_found_first_cu2;
 #endif
 
 PCRE2_UCHAR first_cu = 0;
@@ -6712,8 +6712,8 @@
 mb->hitend = FALSE;
 
 #if PCRE2_CODE_UNIT_WIDTH == 8
-memchr_not_found_first_cu = FALSE;
-memchr_not_found_first_cu2 = FALSE;
+memchr_found_first_cu = NULL;
+memchr_found_first_cu2 = NULL;
 #endif
 
 for(;;)
@@ -6782,13 +6782,7 @@
         }
       }
 
-    /* Not anchored. Advance to a unique first code unit if there is one. In
-    8-bit mode, the use of memchr() gives a big speed up, even though we have
-    to call it twice in caseless mode, in order to find the earliest occurrence
-    of the character in either of its cases. If a call to memchr() that
-    searches the rest of the subject fails to find one case, remember that in
-    order not to keep on repeating the search. This can make a huge difference
-    when the strings are very long and only one case is present. */
+    /* Not anchored. Advance to a unique first code unit if there is one. */
 
     else
       {
@@ -6796,43 +6790,68 @@
         {
         if (first_cu != first_cu2)  /* Caseless */
           {
+          /* In 16-bit and 32_bit modes we have to do our own search, so can
+          look for both cases at once. */
+
 #if PCRE2_CODE_UNIT_WIDTH != 8
           PCRE2_UCHAR smc;
           while (start_match < end_subject &&
                 (smc = UCHAR21TEST(start_match)) != first_cu &&
-                  smc != first_cu2)
+                 smc != first_cu2)
             start_match++;
+#else
+          /* In 8-bit mode, the use of memchr() gives a big speed up, even
+          though we have to call it twice in order to find the earliest
+          occurrence of the code unit in either of its cases. Caching is used
+          to remember the positions of previously found code units. This can
+          make a huge difference when the strings are very long and only one
+          case is actually present. */
 
-#else  /* 8-bit code units */
           PCRE2_SPTR pp1 = NULL;
           PCRE2_SPTR pp2 = NULL;
-          PCRE2_SIZE cu2size = end_subject - start_match;
+          PCRE2_SIZE searchlength = end_subject - start_match;
 
-          if (!memchr_not_found_first_cu)
+          /* If we haven't got a previously found position for first_cu, or if
+          the current starting position is later, we need to do a search. If
+          the code unit is not found, set it to the end. */
+
+          if (memchr_found_first_cu == NULL ||
+              start_match > memchr_found_first_cu)
             {
-            pp1 = memchr(start_match, first_cu, end_subject - start_match);
-            if (pp1 == NULL) memchr_not_found_first_cu = TRUE;
-              else cu2size = pp1 - start_match;
+            pp1 = memchr(start_match, first_cu, searchlength);
+            memchr_found_first_cu = (pp1 == NULL)? end_subject : pp1;
             }
 
-          /* If pp1 is not NULL, we have arranged to search only as far as pp1,
-          to see if the other case is earlier, so we can set "not found" only
-          when both searches have returned NULL. */
+          /* If the start is before a previously found position, use the
+          previous position, or NULL if a previous search failed. */
 
-          if (!memchr_not_found_first_cu2)
+          else pp1 = (memchr_found_first_cu == end_subject)? NULL :
+            memchr_found_first_cu;
+
+          /* Do the same thing for the other case. */
+
+          if (memchr_found_first_cu2 == NULL ||
+              start_match > memchr_found_first_cu2)
             {
-            pp2 = memchr(start_match, first_cu2, cu2size);
-            memchr_not_found_first_cu2 = (pp2 == NULL && pp1 == NULL);
+            pp2 = memchr(start_match, first_cu2, searchlength);
+            memchr_found_first_cu2 = (pp2 == NULL)? end_subject : pp2;
             }
 
+          else pp2 = (memchr_found_first_cu2 == end_subject)? NULL :
+            memchr_found_first_cu2;
+
+          /* Set the start to the end of the subject if neither case was found.
+          Otherwise, use the earlier found point. */
+
           if (pp1 == NULL)
             start_match = (pp2 == NULL)? end_subject : pp2;
           else
             start_match = (pp2 == NULL || pp1 < pp2)? pp1 : pp2;
-#endif
+
+#endif  /* 8-bit handling */
           }
 
-        /* The caseful case */
+        /* The caseful case is much simpler. */
 
         else
           {
diff --git a/dist2/src/pcre2_match_data.c b/src/pcre2_match_data.c
similarity index 100%
rename from dist2/src/pcre2_match_data.c
rename to src/pcre2_match_data.c
diff --git a/dist2/src/pcre2_newline.c b/src/pcre2_newline.c
similarity index 100%
rename from dist2/src/pcre2_newline.c
rename to src/pcre2_newline.c
diff --git a/dist2/src/pcre2_ord2utf.c b/src/pcre2_ord2utf.c
similarity index 100%
rename from dist2/src/pcre2_ord2utf.c
rename to src/pcre2_ord2utf.c
diff --git a/dist2/src/pcre2_pattern_info.c b/src/pcre2_pattern_info.c
similarity index 100%
rename from dist2/src/pcre2_pattern_info.c
rename to src/pcre2_pattern_info.c
diff --git a/dist2/src/pcre2_printint.c b/src/pcre2_printint.c
similarity index 100%
rename from dist2/src/pcre2_printint.c
rename to src/pcre2_printint.c
diff --git a/dist2/src/pcre2_script_run.c b/src/pcre2_script_run.c
similarity index 100%
rename from dist2/src/pcre2_script_run.c
rename to src/pcre2_script_run.c
diff --git a/dist2/src/pcre2_serialize.c b/src/pcre2_serialize.c
similarity index 100%
rename from dist2/src/pcre2_serialize.c
rename to src/pcre2_serialize.c
diff --git a/dist2/src/pcre2_string_utils.c b/src/pcre2_string_utils.c
similarity index 100%
rename from dist2/src/pcre2_string_utils.c
rename to src/pcre2_string_utils.c
diff --git a/dist2/src/pcre2_study.c b/src/pcre2_study.c
similarity index 100%
rename from dist2/src/pcre2_study.c
rename to src/pcre2_study.c
diff --git a/dist2/src/pcre2_substitute.c b/src/pcre2_substitute.c
similarity index 100%
rename from dist2/src/pcre2_substitute.c
rename to src/pcre2_substitute.c
diff --git a/dist2/src/pcre2_substring.c b/src/pcre2_substring.c
similarity index 100%
rename from dist2/src/pcre2_substring.c
rename to src/pcre2_substring.c
diff --git a/dist2/src/pcre2_tables.c b/src/pcre2_tables.c
similarity index 100%
rename from dist2/src/pcre2_tables.c
rename to src/pcre2_tables.c
diff --git a/dist2/src/pcre2_ucd.c b/src/pcre2_ucd.c
similarity index 100%
rename from dist2/src/pcre2_ucd.c
rename to src/pcre2_ucd.c
diff --git a/dist2/src/pcre2_ucp.h b/src/pcre2_ucp.h
similarity index 100%
rename from dist2/src/pcre2_ucp.h
rename to src/pcre2_ucp.h
diff --git a/dist2/src/pcre2_valid_utf.c b/src/pcre2_valid_utf.c
similarity index 100%
rename from dist2/src/pcre2_valid_utf.c
rename to src/pcre2_valid_utf.c
diff --git a/dist2/src/pcre2_xclass.c b/src/pcre2_xclass.c
similarity index 100%
rename from dist2/src/pcre2_xclass.c
rename to src/pcre2_xclass.c
diff --git a/dist2/src/pcre2demo.c b/src/pcre2demo.c
similarity index 97%
rename from dist2/src/pcre2demo.c
rename to src/pcre2demo.c
index a49f1f8..de2e584 100644
--- a/dist2/src/pcre2demo.c
+++ b/src/pcre2demo.c
@@ -198,8 +198,8 @@
   return 1;
   }
 
-/* Match succeded. Get a pointer to the output vector, where string offsets are
-stored. */
+/* Match succeeded. Get a pointer to the output vector, where string offsets
+are stored. */
 
 ovector = pcre2_get_ovector_pointer(match_data);
 printf("Match succeeded at offset %d\n", (int)ovector[0]);
@@ -217,9 +217,12 @@
 if (rc == 0)
   printf("ovector was not big enough for all the captured substrings\n");
 
-/* We must guard against patterns such as /(?=.\K)/ that use \K in an assertion
-to set the start of a match later than its end. In this demonstration program,
-we just detect this case and give up. */
+/* Since release 10.38 PCRE2 has locked out the use of \K in lookaround
+assertions. However, there is an option to re-enable the old behaviour. If that
+is set, it is possible to run patterns such as /(?=.\K)/ that use \K in an
+assertion to set the start of a match later than its end. In this demonstration
+program, we show how to detect this case, but it shouldn't arise because the
+option is never set. */
 
 if (ovector[0] > ovector[1])
   {
@@ -436,7 +439,7 @@
     return 1;
     }
 
-  /* Match succeded */
+  /* Match succeeded */
 
   printf("\nMatch succeeded again at offset %d\n", (int)ovector[0]);
 
diff --git a/dist2/src/pcre2grep.c b/src/pcre2grep.c
similarity index 98%
rename from dist2/src/pcre2grep.c
rename to src/pcre2grep.c
index b54229b..f233c1d 100644
--- a/dist2/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -63,7 +63,7 @@
 #define WIN32
 #endif
 
-/* Some cmake's define it still */
+/* Some CMake's define it still */
 #if defined(__CYGWIN__) && defined(WIN32)
 #undef WIN32
 #endif
@@ -423,6 +423,7 @@
 #define N_OM_SEPARATOR (-22)
 #define N_MAX_BUFSIZE  (-23)
 #define N_OM_CAPTURE   (-24)
+#define N_ALLABSK      (-25)
 
 static option_item optionlist[] = {
   { OP_NODATA,     N_NULL,   NULL,              "",              "terminate options" },
@@ -490,6 +491,7 @@
   { OP_NODATA,    'v',      NULL,              "invert-match",  "select non-matching lines" },
   { OP_NODATA,    'w',      NULL,              "word-regex(p)", "force patterns to match only as words"  },
   { OP_NODATA,    'x',      NULL,              "line-regex(p)", "force patterns to match only whole lines" },
+  { OP_NODATA,   N_ALLABSK, NULL,              "allow-lookaround-bsk", "allow \\K in lookarounds" },
   { OP_NODATA,    0,        NULL,               NULL,            NULL }
 };
 
@@ -3327,7 +3329,7 @@
 
   if (dee_action == dee_RECURSE)
     {
-    char buffer[FNBUFSIZ];
+    char childpath[FNBUFSIZ];
     char *nextfile;
     directory_type *dir = opendirectory(pathname);
 
@@ -3349,8 +3351,31 @@
         rc = 2;
         break;
         }
-      sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile);
-      frc = grep_or_recurse(buffer, dir_recurse, FALSE);
+      sprintf(childpath, "%s%c%s", pathname, FILESEP, nextfile);
+
+      /* If the realpath() function is available, we can try to prevent endless
+      recursion caused by a symlink pointing to a parent directory (GitHub
+      issue #2 (old Bugzilla #2794). Original patch from Thomas Tempelmann.
+      Modified to avoid using strlcat() because that isn't a standard C
+      function, and also modified not to copy back the fully resolved path,
+      because that affects the output from pcre2grep. */
+
+#ifdef HAVE_REALPATH
+      char resolvedpath[PATH_MAX];
+      if (realpath(childpath, resolvedpath) == NULL)
+        continue;     /* This path is invalid - we can skip processing this */
+      BOOL isSame = strcmp(pathname, resolvedpath) == 0;
+      if (isSame) continue;    /* We have a recursion */
+      size_t rlen = strlen(resolvedpath);
+      if (rlen++ < sizeof(resolvedpath) - 3)
+        {
+        strcat(resolvedpath, "/");
+        BOOL contained = strncmp(pathname, resolvedpath, rlen) == 0;
+        if (contained) continue;    /* We have a recursion */
+        }
+#endif  /* HAVE_REALPATH */
+
+      frc = grep_or_recurse(childpath, dir_recurse, FALSE);
       if (frc > 1) rc = frc;
        else if (frc == 0 && rc == 1) rc = 0;
       }
@@ -3521,7 +3546,7 @@
 
 
 /*************************************************
-*    Handle a single-letter, no data option      *
+*          Handle a no-data option               *
 *************************************************/
 
 static int
@@ -3534,6 +3559,7 @@
   case N_LBUFFER: line_buffered = TRUE; break;
   case N_LOFFSETS: line_offsets = number = TRUE; break;
   case N_NOJIT: use_jit = FALSE; break;
+  case N_ALLABSK: extra_options |= PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK; break;
   case 'a': binary_files = BIN_TEXT; break;
   case 'c': count_only = TRUE; break;
   case 'F': options |= PCRE2_LITERAL; break;
diff --git a/dist2/src/pcre2posix.c b/src/pcre2posix.c
similarity index 99%
rename from dist2/src/pcre2posix.c
rename to src/pcre2posix.c
index 486bcce..a5162df 100644
--- a/dist2/src/pcre2posix.c
+++ b/src/pcre2posix.c
@@ -148,6 +148,7 @@
   37, REG_EESCAPE, /* PCRE2 does not support \L, \l, \N{name}, \U, or \u */
   56, REG_INVARG,  /* internal error: unknown newline setting */
   92, REG_INVARG,  /* invalid option bits with PCRE2_LITERAL */
+  99, REG_EESCAPE  /* \K in lookaround */
 };
 
 /* Table of texts corresponding to POSIX error codes */
diff --git a/dist2/src/pcre2posix.h b/src/pcre2posix.h
similarity index 100%
rename from dist2/src/pcre2posix.h
rename to src/pcre2posix.h
diff --git a/dist2/src/pcre2test.c b/src/pcre2test.c
similarity index 99%
rename from dist2/src/pcre2test.c
rename to src/pcre2test.c
index aa007f8..512df22 100644
--- a/dist2/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -11,7 +11,7 @@
 
                        Written by Philip Hazel
      Original code Copyright (c) 1997-2012 University of Cambridge
-    Rewritten code Copyright (c) 2016-2020 University of Cambridge
+    Rewritten code Copyright (c) 2016-2021 University of Cambridge
 
 -----------------------------------------------------------------------------
 Redistribution and use in source and binary forms, with or without
@@ -622,6 +622,7 @@
   { "allaftertext",                MOD_PNDP, MOD_CTL, CTL_ALLAFTERTEXT,           PO(control) },
   { "allcaptures",                 MOD_PND,  MOD_CTL, CTL_ALLCAPTURES,            PO(control) },
   { "allow_empty_class",           MOD_PAT,  MOD_OPT, PCRE2_ALLOW_EMPTY_CLASS,    PO(options) },
+  { "allow_lookaround_bsk",        MOD_CTC,  MOD_OPT, PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK, CO(extra_options) },
   { "allow_surrogate_escapes",     MOD_CTC,  MOD_OPT, PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES, CO(extra_options) },
   { "allusedtext",                 MOD_PNDP, MOD_CTL, CTL_ALLUSEDTEXT,            PO(control) },
   { "allvector",                   MOD_PND,  MOD_CTL, CTL2_ALLVECTOR,             PO(control2) },
diff --git a/dist2/src/sljit/sljitConfig.h b/src/sljit/sljitConfig.h
similarity index 100%
rename from dist2/src/sljit/sljitConfig.h
rename to src/sljit/sljitConfig.h
diff --git a/dist2/src/sljit/sljitConfigInternal.h b/src/sljit/sljitConfigInternal.h
similarity index 98%
rename from dist2/src/sljit/sljitConfigInternal.h
rename to src/sljit/sljitConfigInternal.h
index ff36e5b..7bb9990 100644
--- a/dist2/src/sljit/sljitConfigInternal.h
+++ b/src/sljit/sljitConfigInternal.h
@@ -761,6 +761,18 @@
 #define SLJIT_NUMBER_OF_SCRATCH_FLOAT_REGISTERS \
 	(SLJIT_NUMBER_OF_FLOAT_REGISTERS - SLJIT_NUMBER_OF_SAVED_FLOAT_REGISTERS)
 
+/********************************/
+/* CPU status flags management. */
+/********************************/
+
+#if (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) \
+	|| (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64) \
+	|| (defined SLJIT_CONFIG_MIPS && SLJIT_CONFIG_MIPS) \
+	|| (defined SLJIT_CONFIG_SPARC && SLJIT_CONFIG_SPARC) \
+	|| (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
+#define SLJIT_HAS_STATUS_FLAGS_STATE 1
+#endif
+
 /*************************************/
 /* Debug and verbose related macros. */
 /*************************************/
diff --git a/dist2/src/sljit/sljitExecAllocator.c b/src/sljit/sljitExecAllocator.c
similarity index 100%
rename from dist2/src/sljit/sljitExecAllocator.c
rename to src/sljit/sljitExecAllocator.c
diff --git a/dist2/src/sljit/sljitLir.c b/src/sljit/sljitLir.c
similarity index 98%
rename from dist2/src/sljit/sljitLir.c
rename to src/sljit/sljitLir.c
index d817c90..a24a99a 100644
--- a/dist2/src/sljit/sljitLir.c
+++ b/src/sljit/sljitLir.c
@@ -532,13 +532,21 @@
 		put_label->label = label;
 }
 
+#define SLJIT_CURRENT_FLAGS_ALL \
+	(SLJIT_CURRENT_FLAGS_I32_OP | SLJIT_CURRENT_FLAGS_ADD_SUB | SLJIT_CURRENT_FLAGS_COMPARE)
+
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler, sljit_s32 current_flags)
 {
 	SLJIT_UNUSED_ARG(compiler);
 	SLJIT_UNUSED_ARG(current_flags);
 
+#if (defined SLJIT_HAS_STATUS_FLAGS_STATE && SLJIT_HAS_STATUS_FLAGS_STATE)
+	compiler->status_flags_state = current_flags;
+#endif
+
 #if (defined SLJIT_ARGUMENT_CHECKS && SLJIT_ARGUMENT_CHECKS)
-	if ((current_flags & ~(VARIABLE_FLAG_MASK | SLJIT_I32_OP | SLJIT_SET_Z)) == 0) {
+	compiler->last_flags = 0;
+	if ((current_flags & ~(VARIABLE_FLAG_MASK | SLJIT_SET_Z | SLJIT_CURRENT_FLAGS_ALL)) == 0) {
 		compiler->last_flags = GET_FLAG_TYPE(current_flags) | (current_flags & (SLJIT_I32_OP | SLJIT_SET_Z));
 	}
 #endif
@@ -968,7 +976,7 @@
 };
 
 #define JUMP_POSTFIX(type) \
-	((type & 0xff) <= SLJIT_MUL_NOT_OVERFLOW ? ((type & SLJIT_I32_OP) ? "32" : "") \
+	((type & 0xff) <= SLJIT_NOT_OVERFLOW ? ((type & SLJIT_I32_OP) ? "32" : "") \
 	: ((type & 0xff) <= SLJIT_ORDERED_F64 ? ((type & SLJIT_F32_OP) ? ".f32" : ".f64") : ""))
 
 static char* jump_names[] = {
@@ -978,7 +986,6 @@
 	(char*)"sig_less", (char*)"sig_greater_equal",
 	(char*)"sig_greater", (char*)"sig_less_equal",
 	(char*)"overflow", (char*)"not_overflow",
-	(char*)"mul_overflow", (char*)"mul_not_overflow",
 	(char*)"carry", (char*)"",
 	(char*)"equal", (char*)"not_equal",
 	(char*)"less", (char*)"greater_equal",
@@ -1278,7 +1285,7 @@
 	case SLJIT_MUL:
 		CHECK_ARGUMENT(!(op & SLJIT_SET_Z));
 		CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
-			|| GET_FLAG_TYPE(op) == SLJIT_MUL_OVERFLOW);
+			|| GET_FLAG_TYPE(op) == SLJIT_OVERFLOW);
 		break;
 	case SLJIT_ADD:
 		CHECK_ARGUMENT(!(op & VARIABLE_FLAG_MASK)
@@ -1601,9 +1608,7 @@
 			CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
 		else
 			CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
-				|| ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
-				|| ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
-		CHECK_ARGUMENT((type & SLJIT_I32_OP) == (compiler->last_flags & SLJIT_I32_OP));
+				|| ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW));
 	}
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
@@ -1818,8 +1823,7 @@
 		CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
 	else
 		CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
-			|| ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
-			|| ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
+			|| ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW));
 
 	FUNCTION_CHECK_DST(dst, dstw, 0);
 
@@ -1858,8 +1862,7 @@
 		CHECK_ARGUMENT(compiler->last_flags & SLJIT_SET_Z);
 	else
 		CHECK_ARGUMENT((type & 0xff) == (compiler->last_flags & 0xff)
-			|| ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW)
-			|| ((type & 0xff) == SLJIT_MUL_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_MUL_OVERFLOW));
+			|| ((type & 0xff) == SLJIT_NOT_OVERFLOW && (compiler->last_flags & 0xff) == SLJIT_OVERFLOW));
 #endif
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
 	if (SLJIT_UNLIKELY(!!compiler->verbose)) {
diff --git a/dist2/src/sljit/sljitLir.h b/src/sljit/sljitLir.h
similarity index 97%
rename from dist2/src/sljit/sljitLir.h
rename to src/sljit/sljitLir.h
index 93d2804..0eb62fc 100644
--- a/dist2/src/sljit/sljitLir.h
+++ b/src/sljit/sljitLir.h
@@ -412,6 +412,10 @@
 	/* Executable size for statistical purposes. */
 	sljit_uw executable_size;
 
+#if (defined SLJIT_HAS_STATUS_FLAGS_STATE && SLJIT_HAS_STATUS_FLAGS_STATE)
+	sljit_s32 status_flags_state;
+#endif
+
 #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
 	sljit_s32 args;
 	sljit_s32 locals_offset;
@@ -460,7 +464,7 @@
 
 #if (defined SLJIT_CONFIG_S390X && SLJIT_CONFIG_S390X)
 	/* Need to allocate register save area to make calls. */
-	sljit_s32 have_save_area;
+	sljit_s32 mode;
 #endif
 
 #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
@@ -996,7 +1000,7 @@
 #define SLJIT_SUBC			(SLJIT_OP2_BASE + 3)
 #define SLJIT_SUBC32			(SLJIT_SUBC | SLJIT_I32_OP)
 /* Note: integer mul
-   Flags: MUL_OVERFLOW */
+   Flags: OVERFLOW */
 #define SLJIT_MUL			(SLJIT_OP2_BASE + 4)
 #define SLJIT_MUL32			(SLJIT_MUL | SLJIT_I32_OP)
 /* Flags: Z */
@@ -1141,89 +1145,69 @@
 
 /* Integer comparison types. */
 #define SLJIT_EQUAL			0
-#define SLJIT_EQUAL32			(SLJIT_EQUAL | SLJIT_I32_OP)
-#define SLJIT_ZERO			0
-#define SLJIT_ZERO32			(SLJIT_ZERO | SLJIT_I32_OP)
+#define SLJIT_ZERO			SLJIT_EQUAL
 #define SLJIT_NOT_EQUAL			1
-#define SLJIT_NOT_EQUAL32		(SLJIT_NOT_EQUAL | SLJIT_I32_OP)
-#define SLJIT_NOT_ZERO			1
-#define SLJIT_NOT_ZERO32		(SLJIT_NOT_ZERO | SLJIT_I32_OP)
+#define SLJIT_NOT_ZERO			SLJIT_NOT_EQUAL
 
 #define SLJIT_LESS			2
-#define SLJIT_LESS32			(SLJIT_LESS | SLJIT_I32_OP)
 #define SLJIT_SET_LESS			SLJIT_SET(SLJIT_LESS)
 #define SLJIT_GREATER_EQUAL		3
-#define SLJIT_GREATER_EQUAL32		(SLJIT_GREATER_EQUAL | SLJIT_I32_OP)
 #define SLJIT_SET_GREATER_EQUAL		SLJIT_SET(SLJIT_GREATER_EQUAL)
 #define SLJIT_GREATER			4
-#define SLJIT_GREATER32			(SLJIT_GREATER | SLJIT_I32_OP)
 #define SLJIT_SET_GREATER		SLJIT_SET(SLJIT_GREATER)
 #define SLJIT_LESS_EQUAL		5
-#define SLJIT_LESS_EQUAL32		(SLJIT_LESS_EQUAL | SLJIT_I32_OP)
 #define SLJIT_SET_LESS_EQUAL		SLJIT_SET(SLJIT_LESS_EQUAL)
 #define SLJIT_SIG_LESS			6
-#define SLJIT_SIG_LESS32		(SLJIT_SIG_LESS | SLJIT_I32_OP)
 #define SLJIT_SET_SIG_LESS		SLJIT_SET(SLJIT_SIG_LESS)
 #define SLJIT_SIG_GREATER_EQUAL		7
-#define SLJIT_SIG_GREATER_EQUAL32	(SLJIT_SIG_GREATER_EQUAL | SLJIT_I32_OP)
 #define SLJIT_SET_SIG_GREATER_EQUAL	SLJIT_SET(SLJIT_SIG_GREATER_EQUAL)
 #define SLJIT_SIG_GREATER		8
-#define SLJIT_SIG_GREATER32		(SLJIT_SIG_GREATER | SLJIT_I32_OP)
 #define SLJIT_SET_SIG_GREATER		SLJIT_SET(SLJIT_SIG_GREATER)
 #define SLJIT_SIG_LESS_EQUAL		9
-#define SLJIT_SIG_LESS_EQUAL32		(SLJIT_SIG_LESS_EQUAL | SLJIT_I32_OP)
 #define SLJIT_SET_SIG_LESS_EQUAL	SLJIT_SET(SLJIT_SIG_LESS_EQUAL)
 
 #define SLJIT_OVERFLOW			10
-#define SLJIT_OVERFLOW32		(SLJIT_OVERFLOW | SLJIT_I32_OP)
 #define SLJIT_SET_OVERFLOW		SLJIT_SET(SLJIT_OVERFLOW)
 #define SLJIT_NOT_OVERFLOW		11
-#define SLJIT_NOT_OVERFLOW32		(SLJIT_NOT_OVERFLOW | SLJIT_I32_OP)
-
-#define SLJIT_MUL_OVERFLOW		12
-#define SLJIT_MUL_OVERFLOW32		(SLJIT_MUL_OVERFLOW | SLJIT_I32_OP)
-#define SLJIT_SET_MUL_OVERFLOW		SLJIT_SET(SLJIT_MUL_OVERFLOW)
-#define SLJIT_MUL_NOT_OVERFLOW		13
-#define SLJIT_MUL_NOT_OVERFLOW32	(SLJIT_MUL_NOT_OVERFLOW | SLJIT_I32_OP)
 
 /* There is no SLJIT_CARRY or SLJIT_NOT_CARRY. */
-#define SLJIT_SET_CARRY			SLJIT_SET(14)
+#define SLJIT_SET_CARRY			SLJIT_SET(12)
 
 /* Floating point comparison types. */
-#define SLJIT_EQUAL_F64			16
+#define SLJIT_EQUAL_F64			14
 #define SLJIT_EQUAL_F32			(SLJIT_EQUAL_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_EQUAL_F		SLJIT_SET(SLJIT_EQUAL_F64)
-#define SLJIT_NOT_EQUAL_F64		17
+#define SLJIT_NOT_EQUAL_F64		15
 #define SLJIT_NOT_EQUAL_F32		(SLJIT_NOT_EQUAL_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_NOT_EQUAL_F		SLJIT_SET(SLJIT_NOT_EQUAL_F64)
-#define SLJIT_LESS_F64			18
+#define SLJIT_LESS_F64			16
 #define SLJIT_LESS_F32			(SLJIT_LESS_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_LESS_F		SLJIT_SET(SLJIT_LESS_F64)
-#define SLJIT_GREATER_EQUAL_F64		19
+#define SLJIT_GREATER_EQUAL_F64		17
 #define SLJIT_GREATER_EQUAL_F32		(SLJIT_GREATER_EQUAL_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_GREATER_EQUAL_F	SLJIT_SET(SLJIT_GREATER_EQUAL_F64)
-#define SLJIT_GREATER_F64		20
+#define SLJIT_GREATER_F64		18
 #define SLJIT_GREATER_F32		(SLJIT_GREATER_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_GREATER_F		SLJIT_SET(SLJIT_GREATER_F64)
-#define SLJIT_LESS_EQUAL_F64		21
+#define SLJIT_LESS_EQUAL_F64		19
 #define SLJIT_LESS_EQUAL_F32		(SLJIT_LESS_EQUAL_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_LESS_EQUAL_F		SLJIT_SET(SLJIT_LESS_EQUAL_F64)
-#define SLJIT_UNORDERED_F64		22
+#define SLJIT_UNORDERED_F64		20
 #define SLJIT_UNORDERED_F32		(SLJIT_UNORDERED_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_UNORDERED_F		SLJIT_SET(SLJIT_UNORDERED_F64)
-#define SLJIT_ORDERED_F64		23
+#define SLJIT_ORDERED_F64		21
 #define SLJIT_ORDERED_F32		(SLJIT_ORDERED_F64 | SLJIT_F32_OP)
 #define SLJIT_SET_ORDERED_F		SLJIT_SET(SLJIT_ORDERED_F64)
 
 /* Unconditional jump types. */
-#define SLJIT_JUMP			24
+#define SLJIT_JUMP			22
 	/* Fast calling method. See sljit_emit_fast_enter / SLJIT_FAST_RETURN. */
-#define SLJIT_FAST_CALL			25
+#define SLJIT_FAST_CALL			23
 	/* Called function must be declared with the SLJIT_FUNC attribute. */
-#define SLJIT_CALL			26
+#define SLJIT_CALL			24
 	/* Called function must be declared with cdecl attribute.
 	   This is the default attribute for C functions. */
-#define SLJIT_CALL_CDECL		27
+#define SLJIT_CALL_CDECL		25
 
 /* The target can be changed during runtime (see: sljit_set_jump_addr). */
 #define SLJIT_REWRITABLE_JUMP		0x1000
@@ -1534,8 +1518,22 @@
 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_custom(struct sljit_compiler *compiler,
 	void *instruction, sljit_s32 size);
 
-/* Define the currently available CPU status flags. It is usually used after an
-   sljit_emit_op_custom call to define which flags are set. */
+/* Flags were set by a 32 bit operation. */
+#define SLJIT_CURRENT_FLAGS_I32_OP		SLJIT_I32_OP
+
+/* Flags were set by an ADD, ADDC, SUB, SUBC, or NEG operation. */
+#define SLJIT_CURRENT_FLAGS_ADD_SUB		0x01
+
+/* Flags were set by a SUB with unused destination.
+   Must be combined with SLJIT_CURRENT_FLAGS_ADD_SUB. */
+#define SLJIT_CURRENT_FLAGS_COMPARE		0x02
+
+/* Define the currently available CPU status flags. It is usually used after
+   an sljit_emit_label or sljit_emit_op_custom operations to define which CPU
+   status flags are available.
+
+   The current_flags must be a valid combination of SLJIT_SET_* and
+   SLJIT_CURRENT_FLAGS_* constants. */
 
 SLJIT_API_FUNC_ATTRIBUTE void sljit_set_current_flags(struct sljit_compiler *compiler,
 	sljit_s32 current_flags);
diff --git a/dist2/src/sljit/sljitNativeARM_32.c b/src/sljit/sljitNativeARM_32.c
similarity index 98%
rename from dist2/src/sljit/sljitNativeARM_32.c
rename to src/sljit/sljitNativeARM_32.c
index ae8479f..74cf55f 100644
--- a/dist2/src/sljit/sljitNativeARM_32.c
+++ b/src/sljit/sljitNativeARM_32.c
@@ -1197,6 +1197,8 @@
 
 	case SLJIT_ADD:
 		SLJIT_ASSERT(!(flags & INV_IMM));
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
+
 		if ((flags & (UNUSED_RETURN | SET_FLAGS)) == (UNUSED_RETURN | SET_FLAGS) && !(flags & ARGS_SWAPPED))
 			return push_inst(compiler, CMN | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
 		return push_inst(compiler, ADD | (flags & SET_FLAGS) | RD(dst) | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
@@ -1207,6 +1209,8 @@
 
 	case SLJIT_SUB:
 		SLJIT_ASSERT(!(flags & INV_IMM));
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
+
 		if ((flags & (UNUSED_RETURN | SET_FLAGS)) == (UNUSED_RETURN | SET_FLAGS) && !(flags & ARGS_SWAPPED))
 			return push_inst(compiler, CMP | SET_FLAGS | RN(src1) | ((src2 & SRC2_IMM) ? src2 : RM(src2)));
 		return push_inst(compiler, (!(flags & ARGS_SWAPPED) ? SUB : RSB) | (flags & SET_FLAGS)
@@ -1220,6 +1224,7 @@
 	case SLJIT_MUL:
 		SLJIT_ASSERT(!(flags & INV_IMM));
 		SLJIT_ASSERT(!(src2 & SRC2_IMM));
+		compiler->status_flags_state = 0;
 
 		if (!HAS_FLAGS(op))
 			return push_inst(compiler, MUL | (reg_map[dst] << 16) | (reg_map[src2] << 8) | reg_map[src1]);
@@ -2153,16 +2158,14 @@
 /*  Conditional instructions                                             */
 /* --------------------------------------------------------------------- */
 
-static sljit_uw get_cc(sljit_s32 type)
+static sljit_uw get_cc(struct sljit_compiler *compiler, sljit_s32 type)
 {
 	switch (type) {
 	case SLJIT_EQUAL:
-	case SLJIT_MUL_NOT_OVERFLOW:
 	case SLJIT_EQUAL_F64:
 		return 0x00000000;
 
 	case SLJIT_NOT_EQUAL:
-	case SLJIT_MUL_OVERFLOW:
 	case SLJIT_NOT_EQUAL_F64:
 		return 0x10000000;
 
@@ -2195,10 +2198,16 @@
 		return 0xd0000000;
 
 	case SLJIT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return 0x10000000;
+
 	case SLJIT_UNORDERED_F64:
 		return 0x60000000;
 
 	case SLJIT_NOT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return 0x00000000;
+
 	case SLJIT_ORDERED_F64:
 		return 0x70000000;
 
@@ -2242,7 +2251,7 @@
 	if (type >= SLJIT_FAST_CALL)
 		PTR_FAIL_IF(prepare_blx(compiler));
 	PTR_FAIL_IF(push_inst_with_unique_literal(compiler, ((EMIT_DATA_TRANSFER(WORD_SIZE | LOAD_DATA, 1,
-		type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0)) & ~COND_MASK) | get_cc(type), 0));
+		type <= SLJIT_JUMP ? TMP_PC : TMP_REG1, TMP_PC, 0)) & ~COND_MASK) | get_cc(compiler, type), 0));
 
 	if (jump->flags & SLJIT_REWRITABLE_JUMP) {
 		jump->addr = compiler->size;
@@ -2260,7 +2269,7 @@
 	if (type >= SLJIT_FAST_CALL)
 		jump->flags |= IS_BL;
 	PTR_FAIL_IF(emit_imm(compiler, TMP_REG1, 0));
-	PTR_FAIL_IF(push_inst(compiler, (((type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1)) & ~COND_MASK) | get_cc(type)));
+	PTR_FAIL_IF(push_inst(compiler, (((type <= SLJIT_JUMP ? BX : BLX) | RM(TMP_REG1)) & ~COND_MASK) | get_cc(compiler, type)));
 	jump->addr = compiler->size;
 #endif
 	return jump;
@@ -2589,7 +2598,7 @@
 	ADJUST_LOCAL_OFFSET(dst, dstw);
 
 	op = GET_OPCODE(op);
-	cc = get_cc(type & 0xff);
+	cc = get_cc(compiler, type & 0xff);
 	dst_reg = FAST_IS_REG(dst) ? dst : TMP_REG1;
 
 	if (op < SLJIT_ADD) {
@@ -2629,7 +2638,7 @@
 
 	dst_reg &= ~SLJIT_I32_OP;
 
-	cc = get_cc(type & 0xff);
+	cc = get_cc(compiler, type & 0xff);
 
 	if (SLJIT_UNLIKELY(src & SLJIT_IMM)) {
 		tmp = get_imm(srcw);
diff --git a/dist2/src/sljit/sljitNativeARM_64.c b/src/sljit/sljitNativeARM_64.c
similarity index 98%
rename from dist2/src/sljit/sljitNativeARM_64.c
rename to src/sljit/sljitNativeARM_64.c
index 52267e7..3f0f5fc 100644
--- a/dist2/src/sljit/sljitNativeARM_64.c
+++ b/src/sljit/sljitNativeARM_64.c
@@ -644,6 +644,7 @@
 			imm = -imm;
 			/* Fall through. */
 		case SLJIT_ADD:
+			compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 			if (imm == 0) {
 				CHECK_FLAGS(1 << 29);
 				return push_inst(compiler, ((op == SLJIT_ADD ? ADDI : SUBI) ^ inv_bits) | RD(dst) | RN(reg));
@@ -781,6 +782,7 @@
 		break; /* Set flags. */
 	case SLJIT_NEG:
 		SLJIT_ASSERT(arg1 == TMP_REG1);
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		if (flags & SET_FLAGS)
 			inv_bits |= 1 << 29;
 		return push_inst(compiler, (SUB ^ inv_bits) | RD(dst) | RN(TMP_ZERO) | RM(arg2));
@@ -789,17 +791,20 @@
 		return push_inst(compiler, (CLZ ^ inv_bits) | RD(dst) | RN(arg2));
 	case SLJIT_ADD:
 		CHECK_FLAGS(1 << 29);
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return push_inst(compiler, (ADD ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2));
 	case SLJIT_ADDC:
 		CHECK_FLAGS(1 << 29);
 		return push_inst(compiler, (ADC ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2));
 	case SLJIT_SUB:
 		CHECK_FLAGS(1 << 29);
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return push_inst(compiler, (SUB ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2));
 	case SLJIT_SUBC:
 		CHECK_FLAGS(1 << 29);
 		return push_inst(compiler, (SBC ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2));
 	case SLJIT_MUL:
+		compiler->status_flags_state = 0;
 		if (!(flags & SET_FLAGS))
 			return push_inst(compiler, (MADD ^ inv_bits) | RD(dst) | RN(arg1) | RM(arg2) | RT2(TMP_ZERO));
 		if (flags & INT_OP) {
@@ -1600,16 +1605,14 @@
 /*  Conditional instructions                                             */
 /* --------------------------------------------------------------------- */
 
-static sljit_uw get_cc(sljit_s32 type)
+static sljit_uw get_cc(struct sljit_compiler *compiler, sljit_s32 type)
 {
 	switch (type) {
 	case SLJIT_EQUAL:
-	case SLJIT_MUL_NOT_OVERFLOW:
 	case SLJIT_EQUAL_F64:
 		return 0x1;
 
 	case SLJIT_NOT_EQUAL:
-	case SLJIT_MUL_OVERFLOW:
 	case SLJIT_NOT_EQUAL_F64:
 		return 0x0;
 
@@ -1642,10 +1645,16 @@
 		return 0xc;
 
 	case SLJIT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return 0x0;
+
 	case SLJIT_UNORDERED_F64:
 		return 0x7;
 
 	case SLJIT_NOT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return 0x1;
+
 	case SLJIT_ORDERED_F64:
 		return 0x6;
 
@@ -1685,7 +1694,7 @@
 
 	if (type < SLJIT_JUMP) {
 		jump->flags |= IS_COND;
-		PTR_FAIL_IF(push_inst(compiler, B_CC | (6 << 5) | get_cc(type)));
+		PTR_FAIL_IF(push_inst(compiler, B_CC | (6 << 5) | get_cc(compiler, type)));
 	}
 	else if (type >= SLJIT_FAST_CALL)
 		jump->flags |= IS_BL;
@@ -1799,7 +1808,7 @@
 	CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
 	ADJUST_LOCAL_OFFSET(dst, dstw);
 
-	cc = get_cc(type & 0xff);
+	cc = get_cc(compiler, type & 0xff);
 	dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
 
 	if (GET_OPCODE(op) < SLJIT_ADD) {
@@ -1854,7 +1863,7 @@
 		srcw = 0;
 	}
 
-	cc = get_cc(type & 0xff);
+	cc = get_cc(compiler, type & 0xff);
 	dst_reg &= ~SLJIT_I32_OP;
 
 	return push_inst(compiler, (CSEL ^ inv_bits) | (cc << 12) | RD(dst_reg) | RN(dst_reg) | RM(src));
diff --git a/dist2/src/sljit/sljitNativeARM_T2_32.c b/src/sljit/sljitNativeARM_T2_32.c
similarity index 98%
rename from dist2/src/sljit/sljitNativeARM_T2_32.c
rename to src/sljit/sljitNativeARM_T2_32.c
index 4624882..e35dbe9 100644
--- a/dist2/src/sljit/sljitNativeARM_T2_32.c
+++ b/src/sljit/sljitNativeARM_T2_32.c
@@ -610,6 +610,7 @@
 			   Although some clever things could be done here, "NOT IMM" does not worth the efforts. */
 			break;
 		case SLJIT_ADD:
+			compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 			nimm = -(sljit_sw)imm;
 			if (IS_2_LO_REGS(reg, dst)) {
 				if (imm <= 0x7)
@@ -643,6 +644,7 @@
 			break;
 		case SLJIT_SUB:
 			/* SUB operation can be replaced by ADD because of the negative carry flag. */
+			compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 			if (flags & ARG1_IMM) {
 				if (imm == 0 && IS_2_LO_REGS(reg, dst))
 					return push_inst16(compiler, RSBSI | RD3(dst) | RN3(reg));
@@ -801,6 +803,7 @@
 		FAIL_IF(push_inst32(compiler, CLZ | RN4(arg2) | RD4(dst) | RM4(arg2)));
 		return SLJIT_SUCCESS;
 	case SLJIT_ADD:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		if (IS_3_LO_REGS(dst, arg1, arg2))
 			return push_inst16(compiler, ADDS | RD3(dst) | RN3(arg1) | RM3(arg2));
 		if (dst == arg1 && !(flags & SET_FLAGS))
@@ -811,6 +814,7 @@
 			return push_inst16(compiler, ADCS | RD3(dst) | RN3(arg2));
 		return push_inst32(compiler, ADC_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
 	case SLJIT_SUB:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		if (flags & UNUSED_RETURN) {
 			if (IS_2_LO_REGS(arg1, arg2))
 				return push_inst16(compiler, CMP | RD3(arg1) | RN3(arg2));
@@ -824,6 +828,7 @@
 			return push_inst16(compiler, SBCS | RD3(dst) | RN3(arg2));
 		return push_inst32(compiler, SBC_W | (flags & SET_FLAGS) | RD4(dst) | RN4(arg1) | RM4(arg2));
 	case SLJIT_MUL:
+		compiler->status_flags_state = 0;
 		if (!(flags & SET_FLAGS))
 			return push_inst32(compiler, MUL | RD4(dst) | RN4(arg1) | RM4(arg2));
 		SLJIT_ASSERT(dst != TMP_REG2);
@@ -1760,16 +1765,14 @@
 /*  Conditional instructions                                             */
 /* --------------------------------------------------------------------- */
 
-static sljit_uw get_cc(sljit_s32 type)
+static sljit_uw get_cc(struct sljit_compiler *compiler, sljit_s32 type)
 {
 	switch (type) {
 	case SLJIT_EQUAL:
-	case SLJIT_MUL_NOT_OVERFLOW:
 	case SLJIT_EQUAL_F64:
 		return 0x0;
 
 	case SLJIT_NOT_EQUAL:
-	case SLJIT_MUL_OVERFLOW:
 	case SLJIT_NOT_EQUAL_F64:
 		return 0x1;
 
@@ -1802,10 +1805,16 @@
 		return 0xd;
 
 	case SLJIT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return 0x1;
+
 	case SLJIT_UNORDERED_F64:
 		return 0x6;
 
 	case SLJIT_NOT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return 0x0;
+
 	case SLJIT_ORDERED_F64:
 		return 0x7;
 
@@ -1847,7 +1856,7 @@
 	PTR_FAIL_IF(emit_imm32_const(compiler, TMP_REG1, 0));
 	if (type < SLJIT_JUMP) {
 		jump->flags |= IS_COND;
-		cc = get_cc(type);
+		cc = get_cc(compiler, type);
 		jump->flags |= cc << 8;
 		PTR_FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
 	}
@@ -2177,7 +2186,7 @@
 	ADJUST_LOCAL_OFFSET(dst, dstw);
 
 	op = GET_OPCODE(op);
-	cc = get_cc(type & 0xff);
+	cc = get_cc(compiler, type & 0xff);
 	dst_r = FAST_IS_REG(dst) ? dst : TMP_REG1;
 
 	if (op < SLJIT_ADD) {
@@ -2229,7 +2238,7 @@
 
 	dst_reg &= ~SLJIT_I32_OP;
 
-	cc = get_cc(type & 0xff);
+	cc = get_cc(compiler, type & 0xff);
 
 	if (!(src & SLJIT_IMM)) {
 		FAIL_IF(push_inst16(compiler, IT | (cc << 4) | 0x8));
diff --git a/dist2/src/sljit/sljitNativeMIPS_32.c b/src/sljit/sljitNativeMIPS_32.c
similarity index 99%
rename from dist2/src/sljit/sljitNativeMIPS_32.c
rename to src/sljit/sljitNativeMIPS_32.c
index f887ee1..a90345f 100644
--- a/dist2/src/sljit/sljitNativeMIPS_32.c
+++ b/src/sljit/sljitNativeMIPS_32.c
@@ -367,7 +367,7 @@
 	case SLJIT_MUL:
 		SLJIT_ASSERT(!(flags & SRC2_IMM));
 
-		if (GET_FLAG_TYPE(op) != SLJIT_MUL_OVERFLOW) {
+		if (GET_FLAG_TYPE(op) != SLJIT_OVERFLOW) {
 #if (defined SLJIT_MIPS_REV && SLJIT_MIPS_REV >= 1)
 			return push_inst(compiler, MUL | S(src1) | T(src2) | D(dst), DR(dst));
 #else /* SLJIT_MIPS_REV < 1 */
diff --git a/dist2/src/sljit/sljitNativeMIPS_64.c b/src/sljit/sljitNativeMIPS_64.c
similarity index 99%
rename from dist2/src/sljit/sljitNativeMIPS_64.c
rename to src/sljit/sljitNativeMIPS_64.c
index 5ab9b7d..1f22e49 100644
--- a/dist2/src/sljit/sljitNativeMIPS_64.c
+++ b/src/sljit/sljitNativeMIPS_64.c
@@ -458,7 +458,7 @@
 	case SLJIT_MUL:
 		SLJIT_ASSERT(!(flags & SRC2_IMM));
 
-		if (GET_FLAG_TYPE(op) != SLJIT_MUL_OVERFLOW) {
+		if (GET_FLAG_TYPE(op) != SLJIT_OVERFLOW) {
 #if (defined SLJIT_MIPS_REV && SLJIT_MIPS_REV >= 6)
 			return push_inst(compiler, SELECT_OP(DMUL, MUL) | S(src1) | T(src2) | D(dst), DR(dst));
 #elif (defined SLJIT_MIPS_REV && SLJIT_MIPS_REV >= 1)
diff --git a/dist2/src/sljit/sljitNativeMIPS_common.c b/src/sljit/sljitNativeMIPS_common.c
similarity index 99%
rename from dist2/src/sljit/sljitNativeMIPS_common.c
rename to src/sljit/sljitNativeMIPS_common.c
index ecf4dac..fd74769 100644
--- a/dist2/src/sljit/sljitNativeMIPS_common.c
+++ b/src/sljit/sljitNativeMIPS_common.c
@@ -1377,6 +1377,7 @@
 		return emit_op(compiler, op, flags, dst, dstw, TMP_REG1, 0, src, srcw);
 
 	case SLJIT_NEG:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return emit_op(compiler, SLJIT_SUB | GET_ALL_FLAGS(op), flags | IMM_OP, dst, dstw, SLJIT_IMM, 0, src, srcw);
 
 	case SLJIT_CLZ:
@@ -1424,13 +1425,16 @@
 	switch (GET_OPCODE(op)) {
 	case SLJIT_ADD:
 	case SLJIT_ADDC:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return emit_op(compiler, op, flags | CUMULATIVE_OP | IMM_OP, dst, dstw, src1, src1w, src2, src2w);
 
 	case SLJIT_SUB:
 	case SLJIT_SUBC:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return emit_op(compiler, op, flags | IMM_OP, dst, dstw, src1, src1w, src2, src2w);
 
 	case SLJIT_MUL:
+		compiler->status_flags_state = 0;
 		return emit_op(compiler, op, flags | CUMULATIVE_OP, dst, dstw, src1, src1w, src2, src2w);
 
 	case SLJIT_AND:
@@ -1860,7 +1864,6 @@
 	case SLJIT_SIG_LESS:
 	case SLJIT_SIG_GREATER:
 	case SLJIT_OVERFLOW:
-	case SLJIT_MUL_OVERFLOW:
 		BR_Z(OTHER_FLAG);
 		break;
 	case SLJIT_GREATER_EQUAL:
@@ -1868,7 +1871,6 @@
 	case SLJIT_SIG_GREATER_EQUAL:
 	case SLJIT_SIG_LESS_EQUAL:
 	case SLJIT_NOT_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
 		BR_NZ(OTHER_FLAG);
 		break;
 	case SLJIT_NOT_EQUAL_F64:
@@ -2127,8 +2129,12 @@
 		FAIL_IF(push_inst(compiler, SLTIU | SA(EQUAL_FLAG) | TA(dst_ar) | IMM(1), dst_ar));
 		src_ar = dst_ar;
 		break;
-	case SLJIT_MUL_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
+	case SLJIT_OVERFLOW:
+	case SLJIT_NOT_OVERFLOW:
+		if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB) {
+			src_ar = OTHER_FLAG;
+			break;
+		}
 		FAIL_IF(push_inst(compiler, SLTIU | SA(OTHER_FLAG) | TA(dst_ar) | IMM(1), dst_ar));
 		src_ar = dst_ar;
 		type ^= 0x1; /* Flip type bit for the XORI below. */
@@ -2219,7 +2225,6 @@
 	case SLJIT_SIG_LESS:
 	case SLJIT_SIG_GREATER:
 	case SLJIT_OVERFLOW:
-	case SLJIT_MUL_OVERFLOW:
 		ins = MOVN | TA(OTHER_FLAG);
 		break;
 	case SLJIT_GREATER_EQUAL:
@@ -2227,7 +2232,6 @@
 	case SLJIT_SIG_GREATER_EQUAL:
 	case SLJIT_SIG_LESS_EQUAL:
 	case SLJIT_NOT_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
 		ins = MOVZ | TA(OTHER_FLAG);
 		break;
 	case SLJIT_EQUAL_F64:
diff --git a/dist2/src/sljit/sljitNativePPC_32.c b/src/sljit/sljitNativePPC_32.c
similarity index 94%
rename from dist2/src/sljit/sljitNativePPC_32.c
rename to src/sljit/sljitNativePPC_32.c
index 7d9ec53..6ddb550 100644
--- a/dist2/src/sljit/sljitNativePPC_32.c
+++ b/src/sljit/sljitNativePPC_32.c
@@ -119,9 +119,10 @@
 			SLJIT_ASSERT(src2 == TMP_REG2);
 			return push_inst(compiler, ADDIC | D(dst) | A(src1) | compiler->imm);
 		}
+		SLJIT_ASSERT(!(flags & ALT_FORM4));
 		if (!(flags & ALT_SET_FLAGS))
 			return push_inst(compiler, ADD | D(dst) | A(src1) | B(src2));
-		if (flags & ALT_FORM4)
+		if (flags & ALT_FORM5)
 			return push_inst(compiler, ADDC | RC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
 		return push_inst(compiler, ADD | RC(flags) | D(dst) | A(src1) | B(src2));
 
@@ -143,24 +144,29 @@
 		}
 
 		if (flags & ALT_FORM2) {
+			if (flags & ALT_FORM3) {
+				FAIL_IF(push_inst(compiler, CMPI | CRD(0) | A(src1) | compiler->imm));
+				if (!(flags & ALT_FORM4))
+					return SLJIT_SUCCESS;
+				return push_inst(compiler, ADDI | D(dst) | A(src1) | (-compiler->imm & 0xffff));
+			}
+			FAIL_IF(push_inst(compiler, CMP | CRD(0) | A(src1) | B(src2)));
+			if (!(flags & ALT_FORM4))
+				return SLJIT_SUCCESS;
+			return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
+		}
+
+		if (flags & ALT_FORM3) {
 			/* Setting XER SO is not enough, CR SO is also needed. */
 			return push_inst(compiler, SUBF | OE(ALT_SET_FLAGS) | RC(ALT_SET_FLAGS) | D(dst) | A(src2) | B(src1));
 		}
 
-		if (flags & ALT_FORM3) {
+		if (flags & ALT_FORM4) {
 			/* Flags does not set: BIN_IMM_EXTS unnecessary. */
 			SLJIT_ASSERT(src2 == TMP_REG2);
 			return push_inst(compiler, SUBFIC | D(dst) | A(src1) | compiler->imm);
 		}
 
-		if (flags & ALT_FORM4) {
-			if (flags & ALT_FORM5) {
-				SLJIT_ASSERT(src2 == TMP_REG2);
-				return push_inst(compiler, CMPI | CRD(0) | A(src1) | compiler->imm);
-			}
-			return push_inst(compiler, CMP | CRD(0) | A(src1) | B(src2));
-		}
-
 		if (!(flags & ALT_SET_FLAGS))
 			return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
 		if (flags & ALT_FORM5)
diff --git a/dist2/src/sljit/sljitNativePPC_64.c b/src/sljit/sljitNativePPC_64.c
similarity index 95%
rename from dist2/src/sljit/sljitNativePPC_64.c
rename to src/sljit/sljitNativePPC_64.c
index 92147d2..cbdf2dd 100644
--- a/dist2/src/sljit/sljitNativePPC_64.c
+++ b/src/sljit/sljitNativePPC_64.c
@@ -252,10 +252,17 @@
 			BIN_IMM_EXTS();
 			return push_inst(compiler, ADDIC | D(dst) | A(src1) | compiler->imm);
 		}
+		if (flags & ALT_FORM4) {
+			if (flags & ALT_FORM5)
+				FAIL_IF(push_inst(compiler, ADDI | D(dst) | A(src1) | compiler->imm));
+			else
+				FAIL_IF(push_inst(compiler, ADD | D(dst) | A(src1) | B(src2)));
+			return push_inst(compiler, CMPI | A(dst) | 0);
+		}
 		if (!(flags & ALT_SET_FLAGS))
 			return push_inst(compiler, ADD | D(dst) | A(src1) | B(src2));
 		BIN_EXTS();
-		if (flags & ALT_FORM4)
+		if (flags & ALT_FORM5)
 			return push_inst(compiler, ADDC | RC(ALT_SET_FLAGS) | D(dst) | A(src1) | B(src2));
 		return push_inst(compiler, ADD | RC(flags) | D(dst) | A(src1) | B(src2));
 
@@ -278,6 +285,19 @@
 		}
 
 		if (flags & ALT_FORM2) {
+			if (flags & ALT_FORM3) {
+				FAIL_IF(push_inst(compiler, CMPI | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | compiler->imm));
+				if (!(flags & ALT_FORM4))
+					return SLJIT_SUCCESS;
+				return push_inst(compiler, ADDI | D(dst) | A(src1) | (-compiler->imm & 0xffff));
+			}
+			FAIL_IF(push_inst(compiler, CMP | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2)));
+			if (!(flags & ALT_FORM4))
+				return SLJIT_SUCCESS;
+			return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
+		}
+
+		if (flags & ALT_FORM3) {
 			if (flags & ALT_SIGN_EXT) {
 				FAIL_IF(push_inst(compiler, RLDI(TMP_REG1, src1, 32, 31, 1)));
 				src1 = TMP_REG1;
@@ -291,20 +311,12 @@
 			return SLJIT_SUCCESS;
 		}
 
-		if (flags & ALT_FORM3) {
+		if (flags & ALT_FORM4) {
 			/* Flags does not set: BIN_IMM_EXTS unnecessary. */
 			SLJIT_ASSERT(src2 == TMP_REG2);
 			return push_inst(compiler, SUBFIC | D(dst) | A(src1) | compiler->imm);
 		}
 
-		if (flags & ALT_FORM4) {
-			if (flags & ALT_FORM5) {
-				SLJIT_ASSERT(src2 == TMP_REG2);
-				return push_inst(compiler, CMPI | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | compiler->imm);
-			}
-			return push_inst(compiler, CMP | CRD(0 | ((flags & ALT_SIGN_EXT) ? 0 : 1)) | A(src1) | B(src2));
-		}
-
 		if (!(flags & ALT_SET_FLAGS))
 			return push_inst(compiler, SUBF | D(dst) | A(src2) | B(src1));
 		BIN_EXTS();
diff --git a/dist2/src/sljit/sljitNativePPC_common.c b/src/sljit/sljitNativePPC_common.c
similarity index 96%
rename from dist2/src/sljit/sljitNativePPC_common.c
rename to src/sljit/sljitNativePPC_common.c
index d84562c..2174dbb 100644
--- a/dist2/src/sljit/sljitNativePPC_common.c
+++ b/src/sljit/sljitNativePPC_common.c
@@ -1324,6 +1324,25 @@
 	((src) & SLJIT_IMM)
 #endif
 
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+#define TEST_ADD_FORM1(op) \
+	(GET_FLAG_TYPE(op) == SLJIT_OVERFLOW \
+		|| (op & (SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK)) == (SLJIT_I32_OP | SLJIT_SET_Z | SLJIT_SET_CARRY))
+#define TEST_SUB_FORM2(op) \
+	((GET_FLAG_TYPE(op) >= SLJIT_SIG_LESS && GET_FLAG_TYPE(op) <= SLJIT_SIG_LESS_EQUAL) \
+		|| (op & (SLJIT_I32_OP | SLJIT_SET_Z | VARIABLE_FLAG_MASK)) == (SLJIT_I32_OP | SLJIT_SET_Z))
+#define TEST_SUB_FORM3(op) \
+	(GET_FLAG_TYPE(op) == SLJIT_OVERFLOW \
+		|| (op & (SLJIT_I32_OP | SLJIT_SET_Z)) == (SLJIT_I32_OP | SLJIT_SET_Z))
+#else
+#define TEST_ADD_FORM1(op) \
+	(GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
+#define TEST_SUB_FORM2(op) \
+	(GET_FLAG_TYPE(op) >= SLJIT_SIG_LESS && GET_FLAG_TYPE(op) <= SLJIT_SIG_LESS_EQUAL)
+#define TEST_SUB_FORM3(op) \
+	(GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
+#endif
+
 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
 	sljit_s32 dst, sljit_sw dstw,
 	sljit_s32 src1, sljit_sw src1w,
@@ -1362,7 +1381,7 @@
 
 	switch (GET_OPCODE(op)) {
 	case SLJIT_ADD:
-		if (GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
+		if (TEST_ADD_FORM1(op))
 			return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM1, dst, dstw, src1, src1w, src2, src2w);
 
 		if (!HAS_FLAGS(op) && ((src1 | src2) & SLJIT_IMM)) {
@@ -1392,6 +1411,20 @@
 				return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2 | ALT_FORM4, dst, dstw, src2, src2w, TMP_REG2, 0);
 			}
 		}
+
+#if (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
+		if ((op & (SLJIT_I32_OP | SLJIT_SET_Z)) == (SLJIT_I32_OP | SLJIT_SET_Z)) {
+			if (TEST_SL_IMM(src2, src2w)) {
+				compiler->imm = src2w & 0xffff;
+				return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM4 | ALT_FORM5, dst, dstw, src1, src1w, TMP_REG2, 0);
+			}
+			if (TEST_SL_IMM(src1, src1w)) {
+				compiler->imm = src1w & 0xffff;
+				return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM4 | ALT_FORM5, dst, dstw, src2, src2w, TMP_REG2, 0);
+			}
+			return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM4, dst, dstw, src1, src1w, src2, src2w);
+		}
+#endif
 		if (HAS_FLAGS(op)) {
 			if (TEST_SL_IMM(src2, src2w)) {
 				compiler->imm = src2w & 0xffff;
@@ -1402,7 +1435,7 @@
 				return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src2, src2w, TMP_REG2, 0);
 			}
 		}
-		return emit_op(compiler, SLJIT_ADD, flags | ((GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)) ? ALT_FORM4 : 0), dst, dstw, src1, src1w, src2, src2w);
+		return emit_op(compiler, SLJIT_ADD, flags | ((GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)) ? ALT_FORM5 : 0), dst, dstw, src1, src1w, src2, src2w);
 
 	case SLJIT_ADDC:
 		return emit_op(compiler, SLJIT_ADDC, flags, dst, dstw, src1, src1w, src2, src2w);
@@ -1424,18 +1457,36 @@
 			return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM1 | ALT_FORM3, dst, dstw, src1, src1w, src2, src2w);
 		}
 
-		if (GET_FLAG_TYPE(op) == SLJIT_OVERFLOW)
+		if (dst == SLJIT_UNUSED && GET_FLAG_TYPE(op) <= SLJIT_SIG_LESS_EQUAL) {
+			if (TEST_SL_IMM(src2, src2w)) {
+				compiler->imm = src2w & 0xffff;
+				return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2 | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
+			}
 			return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2, dst, dstw, src1, src1w, src2, src2w);
+		}
 
-		if (!HAS_FLAGS(op) && ((src1 | src2) & SLJIT_IMM)) {
-			if (TEST_SL_IMM(src2, -src2w)) {
-				compiler->imm = (-src2w) & 0xffff;
-				return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM2, dst, dstw, src1, src1w, TMP_REG2, 0);
+		if (TEST_SUB_FORM2(op)) {
+			if ((src2 & SLJIT_IMM) && src2w >= -SIMM_MAX && src2w <= SIMM_MAX) {
+				compiler->imm = src2w & 0xffff;
+				return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2 | ALT_FORM3 | ALT_FORM4, dst, dstw, src1, src1w, TMP_REG2, 0);
 			}
-			if (TEST_SL_IMM(src1, src1w)) {
-				compiler->imm = src1w & 0xffff;
-				return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM3, dst, dstw, src2, src2w, TMP_REG2, 0);
-			}
+			return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM2 | ALT_FORM4, dst, dstw, src1, src1w, src2, src2w);
+		}
+
+		if (TEST_SUB_FORM3(op))
+			return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM3, dst, dstw, src1, src1w, src2, src2w);
+
+		if (TEST_SL_IMM(src2, -src2w)) {
+			compiler->imm = (-src2w) & 0xffff;
+			return emit_op(compiler, SLJIT_ADD, flags | (!HAS_FLAGS(op) ? ALT_FORM2 : ALT_FORM3), dst, dstw, src1, src1w, TMP_REG2, 0);
+		}
+
+		if (TEST_SL_IMM(src1, src1w) && !(op & SLJIT_SET_Z)) {
+			compiler->imm = src1w & 0xffff;
+			return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM4, dst, dstw, src2, src2w, TMP_REG2, 0);
+		}
+
+		if (!HAS_FLAGS(op)) {
 			if (TEST_SH_IMM(src2, -src2w)) {
 				compiler->imm = ((-src2w) >> 16) & 0xffff;
 				return emit_op(compiler, SLJIT_ADD, flags |  ALT_FORM2 | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
@@ -1447,18 +1498,6 @@
 			}
 		}
 
-		if (dst == SLJIT_UNUSED && GET_FLAG_TYPE(op) != GET_FLAG_TYPE(SLJIT_SET_CARRY)) {
-			if (TEST_SL_IMM(src2, src2w)) {
-				compiler->imm = src2w & 0xffff;
-				return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM4 | ALT_FORM5, dst, dstw, src1, src1w, TMP_REG2, 0);
-			}
-			return emit_op(compiler, SLJIT_SUB, flags | ALT_FORM4, dst, dstw, src1, src1w, src2, src2w);
-		}
-
-		if (TEST_SL_IMM(src2, -src2w)) {
-			compiler->imm = (-src2w) & 0xffff;
-			return emit_op(compiler, SLJIT_ADD, flags | ALT_FORM3, dst, dstw, src1, src1w, TMP_REG2, 0);
-		}
 		/* We know ALT_SIGN_EXT is set if it is an SLJIT_I32_OP on 64 bit systems. */
 		return emit_op(compiler, SLJIT_SUB, flags | ((GET_FLAG_TYPE(op) == GET_FLAG_TYPE(SLJIT_SET_CARRY)) ? ALT_FORM5 : 0), dst, dstw, src1, src1w, src2, src2w);
 
@@ -1536,6 +1575,10 @@
 	return SLJIT_SUCCESS;
 }
 
+#undef TEST_ADD_FORM1
+#undef TEST_SUB_FORM2
+#undef TEST_SUB_FORM3
+
 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op_src(struct sljit_compiler *compiler, sljit_s32 op,
 	sljit_s32 src, sljit_sw srcw)
 {
@@ -1941,11 +1984,9 @@
 		return (4 << 21) | ((4 + 1) << 16);
 
 	case SLJIT_OVERFLOW:
-	case SLJIT_MUL_OVERFLOW:
 		return (12 << 21) | (3 << 16);
 
 	case SLJIT_NOT_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
 		return (4 << 21) | (3 << 16);
 
 	case SLJIT_EQUAL_F64:
@@ -2143,12 +2184,10 @@
 		break;
 
 	case SLJIT_OVERFLOW:
-	case SLJIT_MUL_OVERFLOW:
 		cr_bit = 3;
 		break;
 
 	case SLJIT_NOT_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
 		cr_bit = 3;
 		invert = 1;
 		break;
diff --git a/dist2/src/sljit/sljitNativeS390X.c b/src/sljit/sljitNativeS390X.c
similarity index 66%
rename from dist2/src/sljit/sljitNativeS390X.c
rename to src/sljit/sljitNativeS390X.c
index 3d007fe..716491e 100644
--- a/dist2/src/sljit/sljitNativeS390X.c
+++ b/src/sljit/sljitNativeS390X.c
@@ -45,7 +45,7 @@
 static const sljit_ins sljit_ins_const = (sljit_ins)1 << 48;
 
 static const sljit_u8 reg_map[SLJIT_NUMBER_OF_REGISTERS + 4] = {
-	14, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 0, 1
+	0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 0, 1
 };
 
 /* there are also a[2-15] available, but they are slower to access and
@@ -120,8 +120,7 @@
 /* Convert SLJIT register to hardware register. */
 static SLJIT_INLINE sljit_gpr gpr(sljit_s32 r)
 {
-	SLJIT_ASSERT(r != SLJIT_UNUSED);
-	SLJIT_ASSERT(r < (sljit_s32)(sizeof(reg_map) / sizeof(reg_map[0])));
+	SLJIT_ASSERT(r >= 0 && r < (sljit_s32)(sizeof(reg_map) / sizeof(reg_map[0])));
 	return reg_map[r];
 }
 
@@ -172,51 +171,93 @@
 	return SLJIT_SUCCESS;
 }
 
+#define SLJIT_ADD_SUB_NO_COMPARE(status_flags_state) \
+	(((status_flags_state) & (SLJIT_CURRENT_FLAGS_ADD_SUB | SLJIT_CURRENT_FLAGS_COMPARE)) == SLJIT_CURRENT_FLAGS_ADD_SUB)
+
 /* Map the given type to a 4-bit condition code mask. */
-static SLJIT_INLINE sljit_u8 get_cc(sljit_s32 type) {
-	const sljit_u8 eq = 1 << 3; /* equal {,to zero} */
-	const sljit_u8 lt = 1 << 2; /* less than {,zero} */
-	const sljit_u8 gt = 1 << 1; /* greater than {,zero} */
-	const sljit_u8 ov = 1 << 0; /* {overflow,NaN} */
+static SLJIT_INLINE sljit_u8 get_cc(struct sljit_compiler *compiler, sljit_s32 type) {
+	const sljit_u8 cc0 = 1 << 3; /* equal {,to zero} */
+	const sljit_u8 cc1 = 1 << 2; /* less than {,zero} */
+	const sljit_u8 cc2 = 1 << 1; /* greater than {,zero} */
+	const sljit_u8 cc3 = 1 << 0; /* {overflow,NaN} */
 
 	switch (type) {
 	case SLJIT_EQUAL:
+		if (SLJIT_ADD_SUB_NO_COMPARE(compiler->status_flags_state)) {
+			sljit_s32 type = GET_FLAG_TYPE(compiler->status_flags_state);
+			if (type >= SLJIT_SIG_LESS && type <= SLJIT_SIG_LESS_EQUAL)
+				return cc0;
+			if (type == SLJIT_OVERFLOW)
+				return (cc0 | cc3);
+			return (cc0 | cc2);
+		}
+
 	case SLJIT_EQUAL_F64:
-		return eq;
+		return cc0;
 
 	case SLJIT_NOT_EQUAL:
+		if (SLJIT_ADD_SUB_NO_COMPARE(compiler->status_flags_state)) {
+			sljit_s32 type = GET_FLAG_TYPE(compiler->status_flags_state);
+			if (type >= SLJIT_SIG_LESS && type <= SLJIT_SIG_LESS_EQUAL)
+				return (cc1 | cc2 | cc3);
+			if (type == SLJIT_OVERFLOW)
+				return (cc1 | cc2);
+			return (cc1 | cc3);
+		}
+
 	case SLJIT_NOT_EQUAL_F64:
-		return ~eq;
+		return (cc1 | cc2 | cc3);
 
 	case SLJIT_LESS:
-	case SLJIT_SIG_LESS:
-	case SLJIT_LESS_F64:
-		return lt;
-
-	case SLJIT_LESS_EQUAL:
-	case SLJIT_SIG_LESS_EQUAL:
-	case SLJIT_LESS_EQUAL_F64:
-		return (lt | eq);
-
-	case SLJIT_GREATER:
-	case SLJIT_SIG_GREATER:
-	case SLJIT_GREATER_F64:
-		return gt;
+		return cc1;
 
 	case SLJIT_GREATER_EQUAL:
+		return (cc0 | cc2 | cc3);
+
+	case SLJIT_GREATER:
+		if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_COMPARE)
+			return cc2;
+		return cc3;
+
+	case SLJIT_LESS_EQUAL:
+		if (compiler->status_flags_state & SLJIT_CURRENT_FLAGS_COMPARE)
+			return (cc0 | cc1);
+		return (cc0 | cc1 | cc2);
+
+	case SLJIT_SIG_LESS:
+	case SLJIT_LESS_F64:
+		return cc1;
+
+	case SLJIT_SIG_LESS_EQUAL:
+	case SLJIT_LESS_EQUAL_F64:
+		return (cc0 | cc1);
+
+	case SLJIT_SIG_GREATER:
+		/* Overflow is considered greater, see SLJIT_SUB. */
+		return cc2 | cc3;
+
 	case SLJIT_SIG_GREATER_EQUAL:
-	case SLJIT_GREATER_EQUAL_F64:
-		return (gt | eq);
+		return (cc0 | cc2 | cc3);
 
 	case SLJIT_OVERFLOW:
-	case SLJIT_MUL_OVERFLOW:
+		if (compiler->status_flags_state & SLJIT_SET_Z)
+			return (cc2 | cc3);
+
 	case SLJIT_UNORDERED_F64:
-		return ov;
+		return cc3;
 
 	case SLJIT_NOT_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
+		if (compiler->status_flags_state & SLJIT_SET_Z)
+			return (cc0 | cc1);
+
 	case SLJIT_ORDERED_F64:
-		return ~ov;
+		return (cc0 | cc1 | cc2);
+
+	case SLJIT_GREATER_F64:
+		return cc2;
+
+	case SLJIT_GREATER_EQUAL_F64:
+		return (cc0 | cc2);
 	}
 
 	SLJIT_UNREACHABLE();
@@ -346,19 +387,20 @@
 #define is_u32(d)	(0 <= (d) && (d) <= 0xffffffffL)
 
 #define CHECK_SIGNED(v, bitlen) \
-	((v) == (((v) << (sizeof(v) * 8 - bitlen)) >> (sizeof(v) * 8 - bitlen)))
+	((v) >= -(1 << ((bitlen) - 1)) && (v) < (1 << ((bitlen) - 1)))
 
+#define is_s8(d)	CHECK_SIGNED((d), 8)
 #define is_s16(d)	CHECK_SIGNED((d), 16)
 #define is_s20(d)	CHECK_SIGNED((d), 20)
-#define is_s32(d)	CHECK_SIGNED((d), 32)
+#define is_s32(d)	((d) == (sljit_s32)(d))
 
-static SLJIT_INLINE sljit_uw disp_s20(sljit_s32 d)
+static SLJIT_INLINE sljit_ins disp_s20(sljit_s32 d)
 {
+	SLJIT_ASSERT(is_s20(d));
+
 	sljit_uw dh = (d >> 12) & 0xff;
 	sljit_uw dl = (d << 8) & 0xfff00;
-
-	SLJIT_ASSERT(is_s20(d));
-	return dh | dl;
+	return (dh | dl) << 8;
 }
 
 /* TODO(carenas): variadic macro is not strictly needed */
@@ -372,12 +414,6 @@
 	return (pattern) | ((dst & 0xf) << 4) | (src & 0xf); \
 }
 
-/* ADD */
-SLJIT_S390X_RR(ar,   0x1a00)
-
-/* ADD LOGICAL */
-SLJIT_S390X_RR(alr,  0x1e00)
-
 /* AND */
 SLJIT_S390X_RR(nr,   0x1400)
 
@@ -387,12 +423,6 @@
 /* BRANCH ON CONDITION */
 SLJIT_S390X_RR(bcr,  0x0700) /* TODO(mundaym): type for mask? */
 
-/* COMPARE */
-SLJIT_S390X_RR(cr,   0x1900)
-
-/* COMPARE LOGICAL */
-SLJIT_S390X_RR(clr,  0x1500)
-
 /* DIVIDE */
 SLJIT_S390X_RR(dr,   0x1d00)
 
@@ -408,12 +438,6 @@
 /* OR */
 SLJIT_S390X_RR(or,   0x1600)
 
-/* SUBTRACT */
-SLJIT_S390X_RR(sr,   0x1b00)
-
-/* SUBTRACT LOGICAL */
-SLJIT_S390X_RR(slr,  0x1f00)
-
 #undef SLJIT_S390X_RR
 
 /* RRE form instructions */
@@ -423,25 +447,9 @@
 	return (pattern) | ((dst & 0xf) << 4) | (src & 0xf); \
 }
 
-/* ADD */
-SLJIT_S390X_RRE(agr,   0xb9080000)
-
-/* ADD LOGICAL */
-SLJIT_S390X_RRE(algr,  0xb90a0000)
-
-/* ADD LOGICAL WITH CARRY */
-SLJIT_S390X_RRE(alcr,  0xb9980000)
-SLJIT_S390X_RRE(alcgr, 0xb9880000)
-
 /* AND */
 SLJIT_S390X_RRE(ngr,   0xb9800000)
 
-/* COMPARE */
-SLJIT_S390X_RRE(cgr,   0xb9200000)
-
-/* COMPARE LOGICAL */
-SLJIT_S390X_RRE(clgr,  0xb9210000)
-
 /* DIVIDE LOGICAL */
 SLJIT_S390X_RRE(dlr,   0xb9970000)
 SLJIT_S390X_RRE(dlgr,  0xb9870000)
@@ -482,8 +490,6 @@
 SLJIT_S390X_RRE(mlgr,  0xb9860000)
 
 /* MULTIPLY SINGLE */
-SLJIT_S390X_RRE(msr,   0xb2520000)
-SLJIT_S390X_RRE(msgr,  0xb90c0000)
 SLJIT_S390X_RRE(msgfr, 0xb91c0000)
 
 /* OR */
@@ -492,13 +498,6 @@
 /* SUBTRACT */
 SLJIT_S390X_RRE(sgr,   0xb9090000)
 
-/* SUBTRACT LOGICAL */
-SLJIT_S390X_RRE(slgr,  0xb90b0000)
-
-/* SUBTRACT LOGICAL WITH BORROW */
-SLJIT_S390X_RRE(slbr,  0xb9990000)
-SLJIT_S390X_RRE(slbgr, 0xb9890000)
-
 #undef SLJIT_S390X_RRE
 
 /* RI-a form instructions */
@@ -509,13 +508,8 @@
 }
 
 /* ADD HALFWORD IMMEDIATE */
-SLJIT_S390X_RIA(ahi,   0xa70a0000, sljit_s16)
 SLJIT_S390X_RIA(aghi,  0xa70b0000, sljit_s16)
 
-/* COMPARE HALFWORD IMMEDIATE */
-SLJIT_S390X_RIA(chi,   0xa70e0000, sljit_s16)
-SLJIT_S390X_RIA(cghi,  0xa70f0000, sljit_s16)
-
 /* LOAD HALFWORD IMMEDIATE */
 SLJIT_S390X_RIA(lhi,   0xa7080000, sljit_s16)
 SLJIT_S390X_RIA(lghi,  0xa7090000, sljit_s16)
@@ -533,9 +527,6 @@
 /* OR IMMEDIATE */
 SLJIT_S390X_RIA(oilh,  0xa50a0000, sljit_u16)
 
-/* TEST UNDER MASK */
-SLJIT_S390X_RIA(tmlh,  0xa7000000, sljit_u16)
-
 #undef SLJIT_S390X_RIA
 
 /* RIL-a form instructions (requires extended immediate facility) */
@@ -547,30 +538,13 @@
 }
 
 /* ADD IMMEDIATE */
-SLJIT_S390X_RILA(afi,   0xc20900000000, sljit_s32)
 SLJIT_S390X_RILA(agfi,  0xc20800000000, sljit_s32)
 
 /* ADD IMMEDIATE HIGH */
 SLJIT_S390X_RILA(aih,   0xcc0800000000, sljit_s32) /* TODO(mundaym): high-word facility? */
 
-/* ADD LOGICAL IMMEDIATE */
-SLJIT_S390X_RILA(alfi,  0xc20b00000000, sljit_u32)
-SLJIT_S390X_RILA(algfi, 0xc20a00000000, sljit_u32)
-
 /* AND IMMEDIATE */
 SLJIT_S390X_RILA(nihf,  0xc00a00000000, sljit_u32)
-SLJIT_S390X_RILA(nilf,  0xc00b00000000, sljit_u32)
-
-/* COMPARE IMMEDIATE */
-SLJIT_S390X_RILA(cfi,   0xc20d00000000, sljit_s32)
-SLJIT_S390X_RILA(cgfi,  0xc20c00000000, sljit_s32)
-
-/* COMPARE IMMEDIATE HIGH */
-SLJIT_S390X_RILA(cih,   0xcc0d00000000, sljit_s32) /* TODO(mundaym): high-word facility? */
-
-/* COMPARE LOGICAL IMMEDIATE */
-SLJIT_S390X_RILA(clfi,  0xc20f00000000, sljit_u32)
-SLJIT_S390X_RILA(clgfi, 0xc20e00000000, sljit_u32)
 
 /* EXCLUSIVE OR IMMEDIATE */
 SLJIT_S390X_RILA(xilf,  0xc00700000000, sljit_u32)
@@ -586,8 +560,8 @@
 SLJIT_S390X_RILA(llihf, 0xc00e00000000, sljit_u32)
 SLJIT_S390X_RILA(llilf, 0xc00f00000000, sljit_u32)
 
-/* OR IMMEDIATE */
-SLJIT_S390X_RILA(oilf,  0xc00d00000000, sljit_u32)
+/* SUBTRACT LOGICAL IMMEDIATE */
+SLJIT_S390X_RILA(slfi,  0xc20500000000, sljit_u32)
 
 #undef SLJIT_S390X_RILA
 
@@ -606,18 +580,6 @@
 	return (pattern) | ri | xi | bi | di; \
 }
 
-/* ADD */
-SLJIT_S390X_RXA(a,   0x5a000000)
-
-/* ADD LOGICAL */
-SLJIT_S390X_RXA(al,  0x5e000000)
-
-/* AND */
-SLJIT_S390X_RXA(n,   0x54000000)
-
-/* EXCLUSIVE OR */
-SLJIT_S390X_RXA(x,   0x57000000)
-
 /* LOAD */
 SLJIT_S390X_RXA(l,   0x58000000)
 
@@ -630,9 +592,6 @@
 /* MULTIPLY SINGLE */
 SLJIT_S390X_RXA(ms,  0x71000000)
 
-/* OR */
-SLJIT_S390X_RXA(o,   0x56000000)
-
 /* STORE */
 SLJIT_S390X_RXA(st,  0x50000000)
 
@@ -642,12 +601,6 @@
 /* STORE HALFWORD */
 SLJIT_S390X_RXA(sth, 0x40000000)
 
-/* SUBTRACT */
-SLJIT_S390X_RXA(s,   0x5b000000)
-
-/* SUBTRACT LOGICAL */
-SLJIT_S390X_RXA(sl,  0x5f000000)
-
 #undef SLJIT_S390X_RXA
 
 /* RXY-a instructions */
@@ -660,31 +613,11 @@
 	ri = (sljit_ins)(r & 0xf) << 36; \
 	xi = (sljit_ins)(x & 0xf) << 32; \
 	bi = (sljit_ins)(b & 0xf) << 28; \
-	di = (sljit_ins)disp_s20(d) << 8; \
+	di = disp_s20(d); \
 \
 	return (pattern) | ri | xi | bi | di; \
 }
 
-/* ADD */
-SLJIT_S390X_RXYA(ay,    0xe3000000005a, have_ldisp())
-SLJIT_S390X_RXYA(ag,    0xe30000000008, 1)
-
-/* ADD LOGICAL */
-SLJIT_S390X_RXYA(aly,   0xe3000000005e, have_ldisp())
-SLJIT_S390X_RXYA(alg,   0xe3000000000a, 1)
-
-/* ADD LOGICAL WITH CARRY */
-SLJIT_S390X_RXYA(alc,   0xe30000000098, 1)
-SLJIT_S390X_RXYA(alcg,  0xe30000000088, 1)
-
-/* AND */
-SLJIT_S390X_RXYA(ny,    0xe30000000054, have_ldisp())
-SLJIT_S390X_RXYA(ng,    0xe30000000080, 1)
-
-/* EXCLUSIVE OR */
-SLJIT_S390X_RXYA(xy,    0xe30000000057, have_ldisp())
-SLJIT_S390X_RXYA(xg,    0xe30000000082, 1)
-
 /* LOAD */
 SLJIT_S390X_RXYA(ly,    0xe30000000058, have_ldisp())
 SLJIT_S390X_RXYA(lg,    0xe30000000004, 1)
@@ -713,10 +646,6 @@
 SLJIT_S390X_RXYA(msy,   0xe30000000051, have_ldisp())
 SLJIT_S390X_RXYA(msg,   0xe3000000000c, 1)
 
-/* OR */
-SLJIT_S390X_RXYA(oy,    0xe30000000056, have_ldisp())
-SLJIT_S390X_RXYA(og,    0xe30000000081, 1)
-
 /* STORE */
 SLJIT_S390X_RXYA(sty,   0xe30000000050, have_ldisp())
 SLJIT_S390X_RXYA(stg,   0xe30000000024, 1)
@@ -727,41 +656,8 @@
 /* STORE HALFWORD */
 SLJIT_S390X_RXYA(sthy,  0xe30000000070, have_ldisp())
 
-/* SUBTRACT */
-SLJIT_S390X_RXYA(sy,    0xe3000000005b, have_ldisp())
-SLJIT_S390X_RXYA(sg,    0xe30000000009, 1)
-
-/* SUBTRACT LOGICAL */
-SLJIT_S390X_RXYA(sly,   0xe3000000005f, have_ldisp())
-SLJIT_S390X_RXYA(slg,   0xe3000000000b, 1)
-
-/* SUBTRACT LOGICAL WITH BORROW */
-SLJIT_S390X_RXYA(slb,   0xe30000000099, 1)
-SLJIT_S390X_RXYA(slbg,  0xe30000000089, 1)
-
 #undef SLJIT_S390X_RXYA
 
-/* RS-a instructions */
-#define SLJIT_S390X_RSA(name, pattern) \
-SLJIT_S390X_INSTRUCTION(name, sljit_gpr reg, sljit_sw d, sljit_gpr b) \
-{ \
-	sljit_ins r1 = (sljit_ins)(reg & 0xf) << 20; \
-	sljit_ins b2 = (sljit_ins)(b & 0xf) << 12; \
-	sljit_ins d2 = (sljit_ins)(d & 0xfff); \
-	return (pattern) | r1 | b2 | d2; \
-}
-
-/* SHIFT LEFT SINGLE LOGICAL */
-SLJIT_S390X_RSA(sll, 0x89000000)
-
-/* SHIFT RIGHT SINGLE */
-SLJIT_S390X_RSA(sra, 0x8a000000)
-
-/* SHIFT RIGHT SINGLE LOGICAL */
-SLJIT_S390X_RSA(srl, 0x88000000)
-
-#undef SLJIT_S390X_RSA
-
 /* RSY-a instructions */
 #define SLJIT_S390X_RSYA(name, pattern, cond) \
 SLJIT_S390X_INSTRUCTION(name, sljit_gpr dst, sljit_gpr src, sljit_sw d, sljit_gpr b) \
@@ -772,7 +668,7 @@
 	r1 = (sljit_ins)(dst & 0xf) << 36; \
 	r3 = (sljit_ins)(src & 0xf) << 32; \
 	b2 = (sljit_ins)(b & 0xf) << 28; \
-	d2 = (sljit_ins)disp_s20(d) << 8; \
+	d2 = disp_s20(d); \
 \
 	return (pattern) | r1 | r3 | b2 | d2; \
 }
@@ -786,9 +682,6 @@
 /* SHIFT RIGHT SINGLE */
 SLJIT_S390X_RSYA(srag,  0xeb000000000a, 1)
 
-/* SHIFT RIGHT SINGLE LOGICAL */
-SLJIT_S390X_RSYA(srlg,  0xeb000000000c, 1)
-
 /* STORE MULTIPLE */
 SLJIT_S390X_RSYA(stmg,  0xeb0000000024, 1)
 
@@ -831,26 +724,6 @@
 
 #undef SLJIT_S390X_RIEF
 
-/* RRF-a instructions */
-#define SLJIT_S390X_RRFA(name, pattern, cond) \
-SLJIT_S390X_INSTRUCTION(name, sljit_gpr dst, sljit_gpr src1, sljit_gpr src2) \
-{ \
-	sljit_ins r1, r2, r3; \
-\
-	SLJIT_ASSERT(cond); \
-	r1 = (sljit_ins)(dst & 0xf) << 4; \
-	r2 = (sljit_ins)(src1 & 0xf); \
-	r3 = (sljit_ins)(src2 & 0xf) << 12; \
-\
-	return (pattern) | r3 | r1 | r2; \
-}
-
-/* MULTIPLY */
-SLJIT_S390X_RRFA(msrkc,  0xb9fd0000, have_misc2())
-SLJIT_S390X_RRFA(msgrkc, 0xb9ed0000, have_misc2())
-
-#undef SLJIT_S390X_RRFA
-
 /* RRF-c instructions (require load/store-on-condition 1 facility) */
 #define SLJIT_S390X_RRFC(name, pattern) \
 SLJIT_S390X_INSTRUCTION(name, sljit_gpr dst, sljit_gpr src, sljit_uw mask) \
@@ -919,6 +792,13 @@
 	return 0x07f0 | target;
 }
 
+SLJIT_S390X_INSTRUCTION(brc, sljit_uw mask, sljit_sw target)
+{
+	sljit_ins m1 = (sljit_ins)(mask & 0xf) << 20;
+	sljit_ins ri2 = (sljit_ins)target & 0xffff;
+	return 0xa7040000L | m1 | ri2;
+}
+
 SLJIT_S390X_INSTRUCTION(brcl, sljit_uw mask, sljit_sw target)
 {
 	sljit_ins m1 = (sljit_ins)(mask & 0xf) << 36;
@@ -940,6 +820,12 @@
 	return 0xb2220000 | ((sljit_ins)(dst & 0xf) << 4);
 }
 
+/* SET PROGRAM MASK */
+SLJIT_S390X_INSTRUCTION(spm, sljit_gpr dst)
+{
+	return 0x0400 | ((sljit_ins)(dst & 0xf) << 4);
+}
+
 /* ROTATE THEN INSERT SELECTED BITS HIGH (ZERO) */
 SLJIT_S390X_INSTRUCTION(risbhgz, sljit_gpr dst, sljit_gpr src, sljit_u8 start, sljit_u8 end, sljit_u8 rot)
 {
@@ -948,30 +834,20 @@
 
 #undef SLJIT_S390X_INSTRUCTION
 
-/* load condition code as needed to match type */
-static sljit_s32 push_load_cc(struct sljit_compiler *compiler, sljit_s32 type)
+static sljit_s32 update_zero_overflow(struct sljit_compiler *compiler, sljit_s32 op, sljit_gpr dst_r)
 {
-	type &= ~SLJIT_I32_OP;
-	switch (type) {
-	case SLJIT_ZERO:
-	case SLJIT_NOT_ZERO:
-		return push_inst(compiler, cih(flag_r, 0));
-		break;
-	default:
-		return push_inst(compiler, tmlh(flag_r, 0x3000));
-		break;
-	}
-	return SLJIT_SUCCESS;
-}
-
-static sljit_s32 push_store_zero_flag(struct sljit_compiler *compiler, sljit_s32 op, sljit_gpr source)
-{
-	/* insert low 32-bits into high 32-bits of flag register */
-	FAIL_IF(push_inst(compiler, risbhgz(flag_r, source, 0, 31, 32)));
-	if (!(op & SLJIT_I32_OP)) {
-		/* OR high 32-bits with high 32-bits of flag register */
-		return push_inst(compiler, rosbg(flag_r, source, 0, 31, 0));
-	}
+	/* Condition codes: bits 18 and 19.
+	   Transformation:
+	     0 (zero and no overflow) : unchanged
+	     1 (non-zero and no overflow) : unchanged
+	     2 (zero and overflow) : decreased by 1
+	     3 (non-zero and overflow) : decreased by 1 if non-zero */
+	FAIL_IF(push_inst(compiler, brc(0xc, 2 + 2 + ((op & SLJIT_I32_OP) ? 1 : 2) + 2 + 3 + 1)));
+	FAIL_IF(push_inst(compiler, ipm(flag_r)));
+	FAIL_IF(push_inst(compiler, (op & SLJIT_I32_OP) ? or(dst_r, dst_r) : ogr(dst_r, dst_r)));
+	FAIL_IF(push_inst(compiler, brc(0x8, 2 + 3)));
+	FAIL_IF(push_inst(compiler, slfi(flag_r, 0x10000000)));
+	FAIL_IF(push_inst(compiler, spm(flag_r)));
 	return SLJIT_SUCCESS;
 }
 
@@ -1088,18 +964,19 @@
 #define WHEN(cond, r, i1, i2, addr) \
 	(cond) ? EVAL(i1, r, addr) : EVAL(i2, r, addr)
 
+/* May clobber tmp1. */
 static sljit_s32 load_word(struct sljit_compiler *compiler, sljit_gpr dst,
 		sljit_s32 src, sljit_sw srcw,
-		sljit_gpr tmp /* clobbered */, sljit_s32 is_32bit)
+		sljit_s32 is_32bit)
 {
 	struct addr addr;
 	sljit_ins ins;
 
 	SLJIT_ASSERT(src & SLJIT_MEM);
 	if (have_ldisp() || !is_32bit)
-		FAIL_IF(make_addr_bxy(compiler, &addr, src, srcw, tmp));
+		FAIL_IF(make_addr_bxy(compiler, &addr, src, srcw, tmp1));
 	else
-		FAIL_IF(make_addr_bx(compiler, &addr, src, srcw, tmp));
+		FAIL_IF(make_addr_bx(compiler, &addr, src, srcw, tmp1));
 
 	if (is_32bit)
 		ins = WHEN(is_u12(addr.offset), dst, l, ly, addr);
@@ -1109,18 +986,19 @@
 	return push_inst(compiler, ins);
 }
 
+/* May clobber tmp1. */
 static sljit_s32 store_word(struct sljit_compiler *compiler, sljit_gpr src,
 		sljit_s32 dst, sljit_sw dstw,
-		sljit_gpr tmp /* clobbered */, sljit_s32 is_32bit)
+		sljit_s32 is_32bit)
 {
 	struct addr addr;
 	sljit_ins ins;
 
 	SLJIT_ASSERT(dst & SLJIT_MEM);
 	if (have_ldisp() || !is_32bit)
-		FAIL_IF(make_addr_bxy(compiler, &addr, dst, dstw, tmp));
+		FAIL_IF(make_addr_bxy(compiler, &addr, dst, dstw, tmp1));
 	else
-		FAIL_IF(make_addr_bx(compiler, &addr, dst, dstw, tmp));
+		FAIL_IF(make_addr_bx(compiler, &addr, dst, dstw, tmp1));
 
 	if (is_32bit)
 		ins = WHEN(is_u12(addr.offset), src, st, sty, addr);
@@ -1132,6 +1010,358 @@
 
 #undef WHEN
 
+static sljit_s32 emit_move(struct sljit_compiler *compiler,
+	sljit_gpr dst_r,
+	sljit_s32 src, sljit_sw srcw)
+{
+	SLJIT_ASSERT(!SLOW_IS_REG(src) || dst_r != gpr(src & REG_MASK));
+
+	if (src & SLJIT_IMM)
+		return push_load_imm_inst(compiler, dst_r, srcw);
+
+	if (src & SLJIT_MEM)
+		return load_word(compiler, dst_r, src, srcw, (compiler->mode & SLJIT_I32_OP) != 0);
+
+	sljit_gpr src_r = gpr(src & REG_MASK);
+	return push_inst(compiler, (compiler->mode & SLJIT_I32_OP) ? lr(dst_r, src_r) : lgr(dst_r, src_r));
+}
+
+static sljit_s32 emit_rr(struct sljit_compiler *compiler, sljit_ins ins,
+	sljit_s32 dst,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_gpr dst_r = tmp0;
+	sljit_gpr src_r = tmp1;
+	sljit_s32 needs_move = 1;
+
+	if (SLOW_IS_REG(dst)) {
+		dst_r = gpr(dst & REG_MASK);
+
+		if (dst == src1)
+			needs_move = 0;
+		else if (dst == src2) {
+			dst_r = tmp0;
+			needs_move = 2;
+		}
+	}
+
+	if (needs_move)
+		FAIL_IF(emit_move(compiler, dst_r, src1, src1w));
+
+	if (FAST_IS_REG(src2))
+		src_r = gpr(src2 & REG_MASK);
+	else
+		FAIL_IF(emit_move(compiler, tmp1, src2, src2w));
+
+	FAIL_IF(push_inst(compiler, ins | (dst_r << 4) | src_r));
+
+	if (needs_move != 2)
+		return SLJIT_SUCCESS;
+
+	dst_r = gpr(dst & REG_MASK);
+	return push_inst(compiler, (compiler->mode & SLJIT_I32_OP) ? lr(dst_r, tmp0) : lgr(dst_r, tmp0));
+}
+
+static sljit_s32 emit_rrf(struct sljit_compiler *compiler, sljit_ins ins,
+	sljit_s32 dst,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_gpr dst_r = SLOW_IS_REG(dst) ? gpr(dst & REG_MASK) : tmp0;
+	sljit_gpr src1_r = tmp0;
+	sljit_gpr src2_r = tmp1;
+
+	if (FAST_IS_REG(src1))
+		src1_r = gpr(src1 & REG_MASK);
+	else
+		FAIL_IF(emit_move(compiler, tmp0, src1, src1w));
+
+	if (FAST_IS_REG(src2))
+		src2_r = gpr(src2 & REG_MASK);
+	else
+		FAIL_IF(emit_move(compiler, tmp1, src2, src2w));
+
+	return push_inst(compiler, ins | (dst_r << 4) | src1_r | (src2_r << 12));
+}
+
+typedef enum {
+	RI_A,
+	RIL_A,
+} emit_ril_type;
+
+static sljit_s32 emit_ri(struct sljit_compiler *compiler, sljit_ins ins,
+	sljit_s32 dst,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_sw src2w,
+	emit_ril_type type)
+{
+	sljit_gpr dst_r = tmp0;
+	sljit_s32 needs_move = 1;
+
+	if (SLOW_IS_REG(dst)) {
+		dst_r = gpr(dst & REG_MASK);
+
+		if (dst == src1)
+			needs_move = 0;
+	}
+
+	if (needs_move)
+		FAIL_IF(emit_move(compiler, dst_r, src1, src1w));
+
+	if (type == RIL_A)
+		return push_inst(compiler, ins | (dst_r << 36) | (src2w & 0xffffffff));
+	return push_inst(compiler, ins | (dst_r << 20) | (src2w & 0xffff));
+}
+
+static sljit_s32 emit_rie_d(struct sljit_compiler *compiler, sljit_ins ins,
+	sljit_s32 dst,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_sw src2w)
+{
+	sljit_gpr dst_r = SLOW_IS_REG(dst) ? gpr(dst & REG_MASK) : tmp0;
+	sljit_gpr src_r = tmp0;
+
+	if (!SLOW_IS_REG(src1))
+		FAIL_IF(emit_move(compiler, tmp0, src1, src1w));
+	else
+		src_r = gpr(src1 & REG_MASK);
+
+	return push_inst(compiler, ins | (dst_r << 36) | (src_r << 32) | (src2w & 0xffff) << 16);
+}
+
+typedef enum {
+	RX_A,
+	RXY_A,
+} emit_rx_type;
+
+static sljit_s32 emit_rx(struct sljit_compiler *compiler, sljit_ins ins,
+	sljit_s32 dst,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w,
+	emit_rx_type type)
+{
+	sljit_gpr dst_r = tmp0;
+	sljit_s32 needs_move = 1;
+	sljit_gpr base, index;
+
+	SLJIT_ASSERT(src2 & SLJIT_MEM);
+
+	if (SLOW_IS_REG(dst)) {
+		dst_r = gpr(dst);
+
+		if (dst == src1)
+			needs_move = 0;
+		else if (dst == (src2 & REG_MASK) || (dst == OFFS_REG(src2))) {
+			dst_r = tmp0;
+			needs_move = 2;
+		}
+	}
+
+	if (needs_move)
+		FAIL_IF(emit_move(compiler, dst_r, src1, src1w));
+
+	base = gpr(src2 & REG_MASK);
+	index = tmp0;
+
+	if (src2 & OFFS_REG_MASK) {
+		index = gpr(OFFS_REG(src2));
+
+		if (src2w != 0) {
+			FAIL_IF(push_inst(compiler, sllg(tmp1, index, src2w & 0x3, 0)));
+			src2w = 0;
+			index = tmp1;
+		}
+	} else if ((type == RX_A && !is_u12(src2w)) || (type == RXY_A && !is_s20(src2w))) {
+		FAIL_IF(push_load_imm_inst(compiler, tmp1, src2w));
+
+		if (src2 & REG_MASK)
+			index = tmp1;
+		else
+			base = tmp1;
+		src2w = 0;
+	}
+
+	if (type == RX_A)
+		ins |= (dst_r << 20) | (index << 16) | (base << 12) | src2w;
+	else
+		ins |= (dst_r << 36) | (index << 32) | (base << 28) | disp_s20(src2w);
+
+	FAIL_IF(push_inst(compiler, ins));
+
+	if (needs_move != 2)
+		return SLJIT_SUCCESS;
+
+	dst_r = gpr(dst);
+	return push_inst(compiler, (compiler->mode & SLJIT_I32_OP) ? lr(dst_r, tmp0) : lgr(dst_r, tmp0));
+}
+
+static sljit_s32 emit_siy(struct sljit_compiler *compiler, sljit_ins ins,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_sw srcw)
+{
+	SLJIT_ASSERT(dst & SLJIT_MEM);
+
+	sljit_gpr dst_r = tmp1;
+
+	if (dst & OFFS_REG_MASK) {
+		sljit_gpr index = tmp1;
+
+		if ((dstw & 0x3) == 0)
+			index = gpr(OFFS_REG(dst));
+		else
+			FAIL_IF(push_inst(compiler, sllg(tmp1, index, dstw & 0x3, 0)));
+
+		FAIL_IF(push_inst(compiler, la(tmp1, 0, dst_r, index)));
+		dstw = 0;
+	}
+	else if (!is_s20(dstw)) {
+		FAIL_IF(push_load_imm_inst(compiler, tmp1, dstw));
+
+		if (dst & REG_MASK)
+			FAIL_IF(push_inst(compiler, la(tmp1, 0, dst_r, tmp1)));
+
+		dstw = 0;
+	}
+	else
+		dst_r = gpr(dst & REG_MASK);
+
+	return push_inst(compiler, ins | ((srcw & 0xff) << 32) | (dst_r << 28) | disp_s20(dstw));
+}
+
+struct ins_forms {
+	sljit_ins op_r;
+	sljit_ins op_gr;
+	sljit_ins op_rk;
+	sljit_ins op_grk;
+	sljit_ins op;
+	sljit_ins op_y;
+	sljit_ins op_g;
+};
+
+static sljit_s32 emit_commutative(struct sljit_compiler *compiler, const struct ins_forms *forms,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_s32 mode = compiler->mode;
+	sljit_ins ins, ins_k;
+
+	if ((src1 | src2) & SLJIT_MEM) {
+		sljit_ins ins12, ins20;
+
+		if (mode & SLJIT_I32_OP) {
+			ins12 = forms->op;
+			ins20 = forms->op_y;
+		}
+		else {
+			ins12 = 0;
+			ins20 = forms->op_g;
+		}
+
+		if (ins12 && ins20) {
+			/* Extra instructions needed for address computation can be executed independently. */
+			if ((src2 & SLJIT_MEM) && (!(src1 & SLJIT_MEM)
+					|| ((src1 & OFFS_REG_MASK) ? (src1w & 0x3) == 0 : is_s20(src1w)))) {
+				if ((src2 & OFFS_REG_MASK) || is_u12(src2w) || !is_s20(src2w))
+					return emit_rx(compiler, ins12, dst, src1, src1w, src2, src2w, RX_A);
+
+				return emit_rx(compiler, ins20, dst, src1, src1w, src2, src2w, RXY_A);
+			}
+
+			if (src1 & SLJIT_MEM) {
+				if ((src1 & OFFS_REG_MASK) || is_u12(src1w) || !is_s20(src1w))
+					return emit_rx(compiler, ins12, dst, src2, src2w, src1, src1w, RX_A);
+
+				return emit_rx(compiler, ins20, dst, src2, src2w, src1, src1w, RXY_A);
+			}
+		}
+		else if (ins12 || ins20) {
+			emit_rx_type rx_type;
+
+			if (ins12) {
+				rx_type = RX_A;
+				ins = ins12;
+			}
+			else {
+				rx_type = RXY_A;
+				ins = ins20;
+			}
+
+			if ((src2 & SLJIT_MEM) && (!(src1 & SLJIT_MEM)
+					|| ((src1 & OFFS_REG_MASK) ? (src1w & 0x3) == 0 : (rx_type == RX_A ? is_u12(src1w) : is_s20(src1w)))))
+				return emit_rx(compiler, ins, dst, src1, src1w, src2, src2w, rx_type);
+
+			if (src1 & SLJIT_MEM)
+				return emit_rx(compiler, ins, dst, src2, src2w, src1, src1w, rx_type);
+		}
+	}
+
+	if (mode & SLJIT_I32_OP) {
+		ins = forms->op_r;
+		ins_k = forms->op_rk;
+	}
+	else {
+		ins = forms->op_gr;
+		ins_k = forms->op_grk;
+	}
+
+	SLJIT_ASSERT(ins != 0 || ins_k != 0);
+
+	if (ins && SLOW_IS_REG(dst)) {
+		if (dst == src1)
+			return emit_rr(compiler, ins, dst, src1, src1w, src2, src2w);
+
+		if (dst == src2)
+			return emit_rr(compiler, ins, dst, src2, src2w, src1, src1w);
+	}
+
+	if (ins_k == 0)
+		return emit_rr(compiler, ins, dst, src1, src1w, src2, src2w);
+
+	return emit_rrf(compiler, ins_k, dst, src1, src1w, src2, src2w);
+}
+
+static sljit_s32 emit_non_commutative(struct sljit_compiler *compiler, const struct ins_forms *forms,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_s32 mode = compiler->mode;
+	sljit_ins ins;
+
+	if (src2 & SLJIT_MEM) {
+		sljit_ins ins12, ins20;
+
+		if (mode & SLJIT_I32_OP) {
+			ins12 = forms->op;
+			ins20 = forms->op_y;
+		}
+		else {
+			ins12 = 0;
+			ins20 = forms->op_g;
+		}
+
+		if (ins12 && ins20) {
+			if ((src2 & OFFS_REG_MASK) || is_u12(src2w) || !is_s20(src2w))
+				return emit_rx(compiler, ins12, dst, src1, src1w, src2, src2w, RX_A);
+
+			return emit_rx(compiler, ins20, dst, src1, src1w, src2, src2w, RXY_A);
+		}
+		else if (ins12)
+			return emit_rx(compiler, ins12, dst, src1, src1w, src2, src2w, RX_A);
+		else if (ins20)
+			return emit_rx(compiler, ins20, dst, src1, src1w, src2, src2w, RXY_A);
+	}
+
+	ins = (mode & SLJIT_I32_OP) ? forms->op_rk : forms->op_grk;
+
+	if (ins == 0 || (SLOW_IS_REG(dst) && dst == src1))
+		return emit_rr(compiler, (mode & SLJIT_I32_OP) ? forms->op_r : forms->op_gr, dst, src1, src1w, src2, src2w);
+
+	return emit_rrf(compiler, ins, dst, src1, src1w, src2, src2w);
+}
+
 SLJIT_API_FUNC_ATTRIBUTE void* sljit_generate_code(struct sljit_compiler *compiler)
 {
 	struct sljit_label *label;
@@ -1560,6 +1790,7 @@
 		/* TODO(carenas): implement prefetch? */
 		return SLJIT_SUCCESS;
 	}
+
 	if (opcode >= SLJIT_MOV && opcode <= SLJIT_MOV_P) {
 		/* LOAD REGISTER */
 		if (FAST_IS_REG(dst) && FAST_IS_REG(src)) {
@@ -1610,11 +1841,6 @@
 				SLJIT_UNREACHABLE();
 			}
 			FAIL_IF(push_inst(compiler, ins));
-			if (HAS_FLAGS(op)) {
-				/* only handle zero flag */
-				SLJIT_ASSERT(!(op & VARIABLE_FLAG_MASK));
-				return push_store_zero_flag(compiler, op, dst_r);
-			}
 			return SLJIT_SUCCESS;
 		}
 		/* LOAD IMMEDIATE */
@@ -1691,11 +1917,6 @@
 				SLJIT_UNREACHABLE();
 			}
 			FAIL_IF(push_inst(compiler, ins));
-			if (HAS_FLAGS(op)) {
-				/* only handle zero flag */
-				SLJIT_ASSERT(!(op & VARIABLE_FLAG_MASK));
-				return push_store_zero_flag(compiler, op, reg);
-			}
 			return SLJIT_SUCCESS;
 		}
 		/* STORE and STORE IMMEDIATE */
@@ -1724,11 +1945,6 @@
 			case SLJIT_MOV_P:
 			case SLJIT_MOV:
 				FAIL_IF(push_inst(compiler, LEVAL(stg)));
-				if (HAS_FLAGS(op)) {
-					/* only handle zero flag */
-					SLJIT_ASSERT(!(op & VARIABLE_FLAG_MASK));
-					return push_store_zero_flag(compiler, op, reg);
-				}
 				return SLJIT_SUCCESS;
 			default:
 				SLJIT_UNREACHABLE();
@@ -1768,11 +1984,6 @@
 				FAIL_IF(make_addr_bxy(compiler, &mem, dst, dstw, tmp1));
 				FAIL_IF(push_inst(compiler,
 					EVAL(stg, tmp0, mem)));
-				if (HAS_FLAGS(op)) {
-					/* only handle zero flag */
-					SLJIT_ASSERT(!(op & VARIABLE_FLAG_MASK));
-					return push_store_zero_flag(compiler, op, tmp0);
-				}
 				return SLJIT_SUCCESS;
 			default:
 				SLJIT_UNREACHABLE();
@@ -1786,7 +1997,9 @@
 	dst_r = SLOW_IS_REG(dst) ? gpr(REG_MASK & dst) : tmp0;
 	src_r = FAST_IS_REG(src) ? gpr(REG_MASK & src) : tmp0;
 	if (src & SLJIT_MEM)
-		FAIL_IF(load_word(compiler, src_r, src, srcw, tmp1, src & SLJIT_I32_OP));
+		FAIL_IF(load_word(compiler, src_r, src, srcw, src & SLJIT_I32_OP));
+
+	compiler->status_flags_state = op & (VARIABLE_FLAG_MASK | SLJIT_SET_Z);
 
 	/* TODO(mundaym): optimize loads and stores */
 	switch (opcode | (op & SLJIT_I32_OP)) {
@@ -1811,9 +2024,11 @@
 		}
 		break;
 	case SLJIT_NEG:
+		compiler->status_flags_state |= SLJIT_CURRENT_FLAGS_ADD_SUB;
 		FAIL_IF(push_inst(compiler, lcgr(dst_r, src_r)));
 		break;
 	case SLJIT_NEG32:
+		compiler->status_flags_state |= SLJIT_CURRENT_FLAGS_ADD_SUB;
 		FAIL_IF(push_inst(compiler, lcr(dst_r, src_r)));
 		break;
 	case SLJIT_CLZ:
@@ -1840,17 +2055,12 @@
 		SLJIT_UNREACHABLE();
 	}
 
-	/* write condition code to emulated flag register */
-	if (op & VARIABLE_FLAG_MASK)
-		FAIL_IF(push_inst(compiler, ipm(flag_r)));
-
-	/* write zero flag to emulated flag register */
-	if (op & SLJIT_SET_Z)
-		FAIL_IF(push_store_zero_flag(compiler, op, dst_r));
+	if ((op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)) == (SLJIT_SET_Z | SLJIT_SET_OVERFLOW))
+		FAIL_IF(update_zero_overflow(compiler, op, dst_r));
 
 	/* TODO(carenas): doesn't need FAIL_IF */
 	if ((dst != SLJIT_UNUSED) && (dst & SLJIT_MEM))
-		FAIL_IF(store_word(compiler, dst_r, dst, dstw, tmp1, op & SLJIT_I32_OP));
+		FAIL_IF(store_word(compiler, dst_r, dst, dstw, op & SLJIT_I32_OP));
 
 	return SLJIT_SUCCESS;
 }
@@ -1888,60 +2098,492 @@
 	return 0;
 }
 
-/* Report whether we have an instruction for:
-     op dst src imm
-   where dst and src are separate registers. */
-static int have_op_3_imm(sljit_s32 op, sljit_sw imm) {
-	return 0; /* TODO(mundaym): implement */
-}
+static const struct ins_forms add_forms = {
+	0x1a00, /* ar */
+	0xb9080000, /* agr */
+	0xb9f80000, /* ark */
+	0xb9e80000, /* agrk */
+	0x5a000000, /* a */
+	0xe3000000005a, /* ay */
+	0xe30000000008, /* ag */
+};
 
-/* Report whether we have an instruction for:
-     op reg imm
-  where reg is both a source and the destination. */
-static int have_op_2_imm(sljit_s32 op, sljit_sw imm) {
-	switch (GET_OPCODE(op) | (op & SLJIT_I32_OP)) {
-	case SLJIT_ADD32:
-	case SLJIT_ADD:
-		if (!HAS_FLAGS(op) || sets_signed_flag(op))
-			return have_eimm() ? is_s32(imm) : is_s16(imm);
+static const struct ins_forms logical_add_forms = {
+	0x1e00, /* alr */
+	0xb90a0000, /* algr */
+	0xb9fa0000, /* alrk */
+	0xb9ea0000, /* algrk */
+	0x5e000000, /* al */
+	0xe3000000005e, /* aly */
+	0xe3000000000a, /* alg */
+};
 
-		return have_eimm() && is_u32(imm);
-	case SLJIT_MUL32:
-	case SLJIT_MUL:
-		/* TODO(mundaym): general extension check */
-		/* for ms{,g}fi */
-		if (op & VARIABLE_FLAG_MASK)
-			return 0;
+static sljit_s32 sljit_emit_add(struct sljit_compiler *compiler, sljit_s32 op,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	int sets_overflow = (op & VARIABLE_FLAG_MASK) == SLJIT_SET_OVERFLOW;
+	int sets_zero_overflow = (op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)) == (SLJIT_SET_Z | SLJIT_SET_OVERFLOW);
+	const struct ins_forms *forms;
+	sljit_ins ins;
 
-		return have_genext() && is_s16(imm);
-	case SLJIT_OR32:
-	case SLJIT_XOR32:
-	case SLJIT_AND32:
-		/* only use if have extended immediate facility */
-		/* this ensures flags are set correctly */
-		return have_eimm();
-	case SLJIT_AND:
-	case SLJIT_OR:
-	case SLJIT_XOR:
-		/* TODO(mundaym): make this more flexible */
-		/* avoid using immediate variations, flags */
-		/* won't be set correctly */
-		return 0;
-	case SLJIT_ADDC32:
-	case SLJIT_ADDC:
-		/* no ADD LOGICAL WITH CARRY IMMEDIATE */
-		return 0;
-	case SLJIT_SUB:
-	case SLJIT_SUB32:
-	case SLJIT_SUBC:
-	case SLJIT_SUBC32:
-		/* no SUBTRACT IMMEDIATE */
-		/* TODO(mundaym): SUBTRACT LOGICAL IMMEDIATE */
-		return 0;
+	if (src2 & SLJIT_IMM) {
+		if (!sets_zero_overflow && is_s8(src2w) && (src1 & SLJIT_MEM) && (dst == src1 && dstw == src1w)) {
+			if (sets_overflow)
+				ins = (op & SLJIT_I32_OP) ? 0xeb000000006a /* asi */ : 0xeb000000007a /* agsi */;
+			else
+				ins = (op & SLJIT_I32_OP) ? 0xeb000000006e /* alsi */ : 0xeb000000007e /* algsi */;
+			return emit_siy(compiler, ins, dst, dstw, src2w);
+		}
+
+		if (is_s16(src2w)) {
+			if (sets_overflow)
+				ins = (op & SLJIT_I32_OP) ? 0xec00000000d8 /* ahik */ : 0xec00000000d9 /* aghik */;
+			else
+				ins = (op & SLJIT_I32_OP) ? 0xec00000000da /* alhsik */ : 0xec00000000db /* alghsik */;
+			FAIL_IF(emit_rie_d(compiler, ins, dst, src1, src1w, src2w));
+			goto done;
+		}
+
+		if (!sets_overflow) {
+			if ((op & SLJIT_I32_OP) || is_u32(src2w)) {
+				ins = (op & SLJIT_I32_OP) ? 0xc20b00000000 /* alfi */ : 0xc20a00000000 /* algfi */;
+				FAIL_IF(emit_ri(compiler, ins, dst, src1, src1w, src2w, RIL_A));
+				goto done;
+			}
+			if (is_u32(-src2w)) {
+				FAIL_IF(emit_ri(compiler, 0xc20400000000 /* slgfi */, dst, src1, src1w, -src2w, RIL_A));
+				goto done;
+			}
+		}
+		else if ((op & SLJIT_I32_OP) || is_s32(src2w)) {
+			ins = (op & SLJIT_I32_OP) ? 0xc20900000000 /* afi */ : 0xc20800000000 /* agfi */;
+			FAIL_IF(emit_ri(compiler, ins, dst, src1, src1w, src2w, RIL_A));
+			goto done;
+		}
 	}
-	return 0;
+
+	forms = sets_overflow ? &add_forms : &logical_add_forms;
+	FAIL_IF(emit_commutative(compiler, forms, dst, dstw, src1, src1w, src2, src2w));
+
+done:
+	if (sets_zero_overflow)
+		FAIL_IF(update_zero_overflow(compiler, op, SLOW_IS_REG(dst) ? gpr(dst & REG_MASK) : tmp0));
+
+	if (dst & SLJIT_MEM)
+		return store_word(compiler, tmp0, dst, dstw, op & SLJIT_I32_OP);
+
+	return SLJIT_SUCCESS;
 }
 
+static const struct ins_forms sub_forms = {
+	0x1b00, /* sr */
+	0xb9090000, /* sgr */
+	0xb9f90000, /* srk */
+	0xb9e90000, /* sgrk */
+	0x5b000000, /* s */
+	0xe3000000005b, /* sy */
+	0xe30000000009, /* sg */
+};
+
+static const struct ins_forms logical_sub_forms = {
+	0x1f00, /* slr */
+	0xb90b0000, /* slgr */
+	0xb9fb0000, /* slrk */
+	0xb9eb0000, /* slgrk */
+	0x5f000000, /* sl */
+	0xe3000000005f, /* sly */
+	0xe3000000000b, /* slg */
+};
+
+static sljit_s32 sljit_emit_sub(struct sljit_compiler *compiler, sljit_s32 op,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	int sets_signed = sets_signed_flag(op);
+	int sets_zero_overflow = (op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)) == (SLJIT_SET_Z | SLJIT_SET_OVERFLOW);
+	const struct ins_forms *forms;
+	sljit_ins ins;
+
+	if (dst == SLJIT_UNUSED && GET_FLAG_TYPE(op) <= SLJIT_SIG_LESS_EQUAL) {
+		int compare_signed = GET_FLAG_TYPE(op) >= SLJIT_SIG_LESS;
+
+		compiler->status_flags_state |= SLJIT_CURRENT_FLAGS_COMPARE;
+
+		if (src2 & SLJIT_IMM) {
+			if (compare_signed || ((op & VARIABLE_FLAG_MASK) == 0 && is_s32(src2w)))
+			{
+				if ((op & SLJIT_I32_OP) || is_s32(src2w)) {
+					ins = (op & SLJIT_I32_OP) ? 0xc20d00000000 /* cfi */ : 0xc20c00000000 /* cgfi */;
+					return emit_ri(compiler, ins, src1, src1, src1w, src2w, RIL_A);
+				}
+			}
+			else {
+				if ((op & SLJIT_I32_OP) || is_u32(src2w)) {
+					ins = (op & SLJIT_I32_OP) ? 0xc20f00000000 /* clfi */ : 0xc20e00000000 /* clgfi */;
+					return emit_ri(compiler, ins, src1, src1, src1w, src2w, RIL_A);
+				}
+				if (is_s16(src2w))
+					return emit_rie_d(compiler, 0xec00000000db /* alghsik */, SLJIT_UNUSED, src1, src1w, src2w);
+			}
+		}
+		else if (src2 & SLJIT_MEM) {
+			if ((op & SLJIT_I32_OP) && ((src2 & OFFS_REG_MASK) || is_u12(src2w))) {
+				ins = compare_signed ? 0x59000000 /* c */ : 0x55000000 /* cl */;
+				return emit_rx(compiler, ins, src1, src1, src1w, src2, src2w, RX_A);
+			}
+
+			if (compare_signed)
+				ins = (op & SLJIT_I32_OP) ? 0xe30000000059 /* cy */ : 0xe30000000020 /* cg */;
+			else
+				ins = (op & SLJIT_I32_OP) ? 0xe30000000055 /* cly */ : 0xe30000000021 /* clg */;
+			return emit_rx(compiler, ins, src1, src1, src1w, src2, src2w, RXY_A);
+		}
+
+		if (compare_signed)
+			ins = (op & SLJIT_I32_OP) ? 0x1900 /* cr */ : 0xb9200000 /* cgr */;
+		else
+			ins = (op & SLJIT_I32_OP) ? 0x1500 /* clr */ : 0xb9210000 /* clgr */;
+		return emit_rr(compiler, ins, src1, src1, src1w, src2, src2w);
+	}
+
+	if (src2 & SLJIT_IMM) {
+		sljit_sw neg_src2w = -src2w;
+
+		if (sets_signed || neg_src2w != 0 || (op & (SLJIT_SET_Z | VARIABLE_FLAG_MASK)) == 0) {
+			if (!sets_zero_overflow && is_s8(neg_src2w) && (src1 & SLJIT_MEM) && (dst == src1 && dstw == src1w)) {
+				if (sets_signed)
+					ins = (op & SLJIT_I32_OP) ? 0xeb000000006a /* asi */ : 0xeb000000007a /* agsi */;
+				else
+					ins = (op & SLJIT_I32_OP) ? 0xeb000000006e /* alsi */ : 0xeb000000007e /* algsi */;
+				return emit_siy(compiler, ins, dst, dstw, neg_src2w);
+			}
+
+			if (is_s16(neg_src2w)) {
+				if (sets_signed)
+					ins = (op & SLJIT_I32_OP) ? 0xec00000000d8 /* ahik */ : 0xec00000000d9 /* aghik */;
+				else
+					ins = (op & SLJIT_I32_OP) ? 0xec00000000da /* alhsik */ : 0xec00000000db /* alghsik */;
+				FAIL_IF(emit_rie_d(compiler, ins, dst, src1, src1w, neg_src2w));
+				goto done;
+			}
+		}
+
+		if (!sets_signed) {
+			if ((op & SLJIT_I32_OP) || is_u32(src2w)) {
+				ins = (op & SLJIT_I32_OP) ? 0xc20500000000 /* slfi */ : 0xc20400000000 /* slgfi */;
+				FAIL_IF(emit_ri(compiler, ins, dst, src1, src1w, src2w, RIL_A));
+				goto done;
+			}
+			if (is_u32(neg_src2w)) {
+				FAIL_IF(emit_ri(compiler, 0xc20a00000000 /* algfi */, dst, src1, src1w, neg_src2w, RIL_A));
+				goto done;
+			}
+		}
+		else if ((op & SLJIT_I32_OP) || is_s32(neg_src2w)) {
+			ins = (op & SLJIT_I32_OP) ? 0xc20900000000 /* afi */ : 0xc20800000000 /* agfi */;
+			FAIL_IF(emit_ri(compiler, ins, dst, src1, src1w, neg_src2w, RIL_A));
+			goto done;
+		}
+	}
+
+	forms = sets_signed ? &sub_forms : &logical_sub_forms;
+	FAIL_IF(emit_non_commutative(compiler, forms, dst, dstw, src1, src1w, src2, src2w));
+
+done:
+	if (sets_signed) {
+		sljit_gpr dst_r = SLOW_IS_REG(dst) ? gpr(dst & REG_MASK) : tmp0;
+
+		if ((op & VARIABLE_FLAG_MASK) != SLJIT_SET_OVERFLOW) {
+			/* In case of overflow, the sign bit of the two source operands must be different, and
+			     - the first operand is greater if the sign bit of the result is set
+			     - the first operand is less if the sign bit of the result is not set
+			   The -result operation sets the corrent sign, because the result cannot be zero.
+			   The overflow is considered greater, since the result must be equal to INT_MIN so its sign bit is set. */
+			FAIL_IF(push_inst(compiler, brc(0xe, 2 + 2)));
+			FAIL_IF(push_inst(compiler, (op & SLJIT_I32_OP) ? lcr(tmp1, dst_r) : lcgr(tmp1, dst_r)));
+		}
+		else if (op & SLJIT_SET_Z)
+			FAIL_IF(update_zero_overflow(compiler, op, dst_r));
+	}
+
+	if (dst & SLJIT_MEM)
+		return store_word(compiler, tmp0, dst, dstw, op & SLJIT_I32_OP);
+
+	return SLJIT_SUCCESS;
+}
+
+static const struct ins_forms multiply_forms = {
+	0xb2520000, /* msr */
+	0xb90c0000, /* msgr */
+	0xb9fd0000, /* msrkc */
+	0xb9ed0000, /* msgrkc */
+	0x71000000, /* ms */
+	0xe30000000051, /* msy */
+	0xe3000000000c, /* msg */
+};
+
+static const struct ins_forms multiply_overflow_forms = {
+	0,
+	0,
+	0xb9fd0000, /* msrkc */
+	0xb9ed0000, /* msgrkc */
+	0,
+	0xe30000000053, /* msc */
+	0xe30000000083, /* msgc */
+};
+
+static sljit_s32 sljit_emit_multiply(struct sljit_compiler *compiler, sljit_s32 op,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_ins ins;
+
+	if (HAS_FLAGS(op)) {
+		/* if have_misc2 fails, this operation should be emulated. 32 bit emulation:
+		FAIL_IF(push_inst(compiler, lgfr(tmp0, src1_r)));
+		FAIL_IF(push_inst(compiler, msgfr(tmp0, src2_r)));
+		if (dst_r != tmp0) {
+			FAIL_IF(push_inst(compiler, lr(dst_r, tmp0)));
+		}
+		FAIL_IF(push_inst(compiler, aih(tmp0, 1)));
+		FAIL_IF(push_inst(compiler, nihf(tmp0, ~1U)));
+		FAIL_IF(push_inst(compiler, ipm(flag_r)));
+		FAIL_IF(push_inst(compiler, oilh(flag_r, 0x2000))); */
+
+		return emit_commutative(compiler, &multiply_overflow_forms, dst, dstw, src1, src1w, src2, src2w);
+	}
+
+	if (src2 & SLJIT_IMM) {
+		if (is_s16(src2w)) {
+			ins = (op & SLJIT_I32_OP) ? 0xa70c0000 /* mhi */ : 0xa70d0000 /* mghi */;
+			return emit_ri(compiler, ins, dst, src1, src1w, src2w, RI_A);
+		}
+
+		if (is_s32(src2w)) {
+			ins = (op & SLJIT_I32_OP) ? 0xc20100000000 /* msfi */ : 0xc20000000000 /* msgfi */;
+			return emit_ri(compiler, ins, dst, src1, src1w, src2w, RIL_A);
+		}
+	}
+
+	return emit_commutative(compiler, &multiply_forms, dst, dstw, src1, src1w, src2, src2w);
+}
+
+static sljit_s32 sljit_emit_bitwise_imm(struct sljit_compiler *compiler, sljit_s32 type,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_uw imm, sljit_s32 count16)
+{
+	sljit_s32 mode = compiler->mode;
+	sljit_gpr dst_r = tmp0;
+	sljit_s32 needs_move = 1;
+
+	if (SLOW_IS_REG(dst)) {
+		dst_r = gpr(dst & REG_MASK);
+		if (dst == src1)
+			needs_move = 0;
+	}
+
+	if (needs_move)
+		FAIL_IF(emit_move(compiler, dst_r, src1, src1w));
+
+	if (type == SLJIT_AND) {
+		if (!(mode & SLJIT_I32_OP))
+			FAIL_IF(push_inst(compiler, 0xc00a00000000 /* nihf */ | (dst_r << 36) | (imm >> 32)));
+		return push_inst(compiler, 0xc00b00000000 /* nilf */ | (dst_r << 36) | (imm & 0xffffffff));
+	}
+	else if (type == SLJIT_OR) {
+		if (count16 >= 3) {
+			FAIL_IF(push_inst(compiler, 0xc00c00000000 /* oihf */ | (dst_r << 36) | (imm >> 32)));
+			return push_inst(compiler, 0xc00d00000000 /* oilf */ | (dst_r << 36) | (imm & 0xffffffff));
+		}
+
+		if (count16 >= 2) {
+			if ((imm & 0x00000000ffffffffull) == 0)
+				return push_inst(compiler, 0xc00c00000000 /* oihf */ | (dst_r << 36) | (imm >> 32));
+			if ((imm & 0xffffffff00000000ull) == 0)
+				return push_inst(compiler, 0xc00d00000000 /* oilf */ | (dst_r << 36) | (imm & 0xffffffff));
+		}
+
+		if ((imm & 0xffff000000000000ull) != 0)
+			FAIL_IF(push_inst(compiler, 0xa5080000 /* oihh */ | (dst_r << 20) | (imm >> 48)));
+		if ((imm & 0x0000ffff00000000ull) != 0)
+			FAIL_IF(push_inst(compiler, 0xa5090000 /* oihl */ | (dst_r << 20) | ((imm >> 32) & 0xffff)));
+		if ((imm & 0x00000000ffff0000ull) != 0)
+			FAIL_IF(push_inst(compiler, 0xa50a0000 /* oilh */ | (dst_r << 20) | ((imm >> 16) & 0xffff)));
+		if ((imm & 0x000000000000ffffull) != 0 || imm == 0)
+			return push_inst(compiler, 0xa50b0000 /* oill */ | (dst_r << 20) | (imm & 0xffff));
+		return SLJIT_SUCCESS;
+	}
+
+	if ((imm & 0xffffffff00000000ull) != 0)
+		FAIL_IF(push_inst(compiler, 0xc00600000000 /* xihf */ | (dst_r << 36) | (imm >> 32)));
+	if ((imm & 0x00000000ffffffffull) != 0 || imm == 0)
+		return push_inst(compiler, 0xc00700000000 /* xilf */ | (dst_r << 36) | (imm & 0xffffffff));
+	return SLJIT_SUCCESS;
+}
+
+static const struct ins_forms bitwise_and_forms = {
+	0x1400, /* nr */
+	0xb9800000, /* ngr */
+	0xb9f40000, /* nrk */
+	0xb9e40000, /* ngrk */
+	0x54000000, /* n */
+	0xe30000000054, /* ny */
+	0xe30000000080, /* ng */
+};
+
+static const struct ins_forms bitwise_or_forms = {
+	0x1600, /* or */
+	0xb9810000, /* ogr */
+	0xb9f60000, /* ork */
+	0xb9e60000, /* ogrk */
+	0x56000000, /* o */
+	0xe30000000056, /* oy */
+	0xe30000000081, /* og */
+};
+
+static const struct ins_forms bitwise_xor_forms = {
+	0x1700, /* xr */
+	0xb9820000, /* xgr */
+	0xb9f70000, /* xrk */
+	0xb9e70000, /* xgrk */
+	0x57000000, /* x */
+	0xe30000000057, /* xy */
+	0xe30000000082, /* xg */
+};
+
+static sljit_s32 sljit_emit_bitwise(struct sljit_compiler *compiler, sljit_s32 op,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_s32 type = GET_OPCODE(op);
+	const struct ins_forms *forms;
+
+	if ((src2 & SLJIT_IMM) && (!(op & SLJIT_SET_Z) || (type == SLJIT_AND && dst == SLJIT_UNUSED))) {
+		sljit_s32 count16 = 0;
+		sljit_uw imm = (sljit_uw)src2w;
+
+		if (op & SLJIT_I32_OP)
+			imm &= 0xffffffffull;
+
+		if ((imm & 0x000000000000ffffull) != 0 || imm == 0)
+			count16++;
+		if ((imm & 0x00000000ffff0000ull) != 0)
+			count16++;
+		if ((imm & 0x0000ffff00000000ull) != 0)
+			count16++;
+		if ((imm & 0xffff000000000000ull) != 0)
+			count16++;
+
+		if (type == SLJIT_AND && dst == SLJIT_UNUSED && count16 == 1) {
+			sljit_gpr src_r = tmp0;
+
+			if (FAST_IS_REG(src1))
+				src_r = gpr(src1 & REG_MASK);
+			else
+				FAIL_IF(emit_move(compiler, tmp0, src1, src1w));
+
+			if ((imm & 0x000000000000ffffull) != 0 || imm == 0)
+				return push_inst(compiler, 0xa7010000 | (src_r << 20) | imm);
+			if ((imm & 0x00000000ffff0000ull) != 0)
+				return push_inst(compiler, 0xa7000000 | (src_r << 20) | (imm >> 16));
+			if ((imm & 0x0000ffff00000000ull) != 0)
+				return push_inst(compiler, 0xa7030000 | (src_r << 20) | (imm >> 32));
+			return push_inst(compiler, 0xa7020000 | (src_r << 20) | (imm >> 48));
+		}
+
+		if (!(op & SLJIT_SET_Z))
+			return sljit_emit_bitwise_imm(compiler, type, dst, dstw, src1, src1w, imm, count16);
+	}
+
+	if (type == SLJIT_AND)
+		forms = &bitwise_and_forms;
+	else if (type == SLJIT_OR)
+		forms = &bitwise_or_forms;
+	else
+		forms = &bitwise_xor_forms;
+
+	return emit_commutative(compiler, forms, dst, dstw, src1, src1w, src2, src2w);
+}
+
+static sljit_s32 sljit_emit_shift(struct sljit_compiler *compiler, sljit_s32 op,
+	sljit_s32 dst, sljit_sw dstw,
+	sljit_s32 src1, sljit_sw src1w,
+	sljit_s32 src2, sljit_sw src2w)
+{
+	sljit_s32 type = GET_OPCODE(op);
+	sljit_gpr dst_r = SLOW_IS_REG(dst) ? gpr(dst & REG_MASK) : tmp0;
+	sljit_gpr src_r = tmp0;
+	sljit_gpr base_r = tmp0;
+	sljit_ins imm = 0;
+	sljit_ins ins;
+
+	if (FAST_IS_REG(src1))
+		src_r = gpr(src1 & REG_MASK);
+	else
+		FAIL_IF(emit_move(compiler, tmp0, src1, src1w));
+
+	if (src2 & SLJIT_IMM)
+		imm = src2w & ((op & SLJIT_I32_OP) ? 0x1f : 0x3f);
+	else if (FAST_IS_REG(src2))
+		base_r = gpr(src2 & REG_MASK);
+	else {
+		FAIL_IF(emit_move(compiler, tmp1, src2, src2w));
+		base_r = tmp1;
+	}
+
+	if ((op & SLJIT_I32_OP) && dst_r == src_r) {
+		if (type == SLJIT_SHL)
+			ins = 0x89000000 /* sll */;
+		else if (type == SLJIT_LSHR)
+			ins = 0x88000000 /* srl */;
+		else
+			ins = 0x8a000000 /* sra */;
+
+		FAIL_IF(push_inst(compiler, ins | (dst_r << 20) | (base_r << 12) | imm));
+	}
+	else {
+		if (type == SLJIT_SHL)
+			ins = (op & SLJIT_I32_OP) ? 0xeb00000000df /* sllk */ : 0xeb000000000d /* sllg */;
+		else if (type == SLJIT_LSHR)
+			ins = (op & SLJIT_I32_OP) ? 0xeb00000000de /* srlk */ : 0xeb000000000c /* srlg */;
+		else
+			ins = (op & SLJIT_I32_OP) ? 0xeb00000000dc /* srak */ : 0xeb000000000a /* srag */;
+
+		FAIL_IF(push_inst(compiler, ins | (dst_r << 36) | (src_r << 32) | (base_r << 28) | (imm << 16)));
+	}
+
+	if ((op & SLJIT_SET_Z) && type != SLJIT_ASHR)
+		return push_inst(compiler, (op & SLJIT_I32_OP) ? or(dst_r, dst_r) : ogr(dst_r, dst_r));
+
+	return SLJIT_SUCCESS;
+}
+
+static const struct ins_forms addc_forms = {
+	0xb9980000, /* alcr */
+	0xb9880000, /* alcgr */
+	0,
+	0,
+	0,
+	0xe30000000098, /* alc */
+	0xe30000000088, /* alcg */
+};
+
+static const struct ins_forms subc_forms = {
+	0xb9990000, /* slbr */
+	0xb9890000, /* slbgr */
+	0,
+	0,
+	0,
+	0xe30000000099, /* slb */
+	0xe30000000089, /* slbg */
+};
+
 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_op2(struct sljit_compiler *compiler, sljit_s32 op,
 	sljit_s32 dst, sljit_sw dstw,
 	sljit_s32 src1, sljit_sw src1w,
@@ -1956,462 +2598,54 @@
 	if (dst == SLJIT_UNUSED && !HAS_FLAGS(op))
 		return SLJIT_SUCCESS;
 
-	sljit_gpr dst_r = SLOW_IS_REG(dst) ? gpr(dst & REG_MASK) : tmp0;
+	compiler->mode = op & SLJIT_I32_OP;
+	compiler->status_flags_state = op & (VARIABLE_FLAG_MASK | SLJIT_SET_Z);
 
-	if (is_commutative(op)) {
-		#define SWAP_ARGS \
-		do {                         \
-			sljit_s32 t = src1;  \
-			sljit_sw tw = src1w; \
-			src1 = src2;         \
-			src1w = src2w;       \
-			src2 = t;            \
-			src2w = tw;          \
-		} while(0);
+	if (GET_OPCODE(op) >= SLJIT_ADD || GET_OPCODE(op) <= SLJIT_SUBC)
+		compiler->status_flags_state |= SLJIT_CURRENT_FLAGS_ADD_SUB;
 
-		/* prefer immediate in src2 */
-		if (src1 & SLJIT_IMM) {
-			SWAP_ARGS
-		}
+	if (is_commutative(op) && (src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM)) {
+		src1 ^= src2;
+		src2 ^= src1;
+		src1 ^= src2;
 
-		/* prefer to have src1 use same register as dst */
-		if (FAST_IS_REG(src2) && gpr(src2 & REG_MASK) == dst_r) {
-			SWAP_ARGS
-		}
-
-		/* prefer memory argument in src2 */
-		if (FAST_IS_REG(src2) && (src1 & SLJIT_MEM)) {
-			SWAP_ARGS
-		}
-		#undef SWAP_ARGS
+		src1w ^= src2w;
+		src2w ^= src1w;
+		src1w ^= src2w;
 	}
 
-	/* src1 must be in a register */
-	sljit_gpr src1_r = FAST_IS_REG(src1) ? gpr(src1 & REG_MASK) : tmp0;
-	if (src1 & SLJIT_IMM)
-		FAIL_IF(push_load_imm_inst(compiler, src1_r, src1w));
-
-	if (src1 & SLJIT_MEM)
-		FAIL_IF(load_word(compiler, src1_r, src1, src1w, tmp1, op & SLJIT_I32_OP));
-
-	/* emit comparison before subtract */
-	if (GET_OPCODE(op) == SLJIT_SUB && (op & VARIABLE_FLAG_MASK)) {
-		sljit_sw cmp = 0;
-		switch (GET_FLAG_TYPE(op)) {
-		case SLJIT_LESS:
-		case SLJIT_LESS_EQUAL:
-		case SLJIT_GREATER:
-		case SLJIT_GREATER_EQUAL:
-			cmp = 1; /* unsigned */
-			break;
-		case SLJIT_EQUAL:
-		case SLJIT_SIG_LESS:
-		case SLJIT_SIG_LESS_EQUAL:
-		case SLJIT_SIG_GREATER:
-		case SLJIT_SIG_GREATER_EQUAL:
-			cmp = -1; /* signed */
-			break;
-		}
-		if (cmp) {
-			/* clear flags - no need to generate now */
-			op &= ~VARIABLE_FLAG_MASK;
-			sljit_gpr src2_r = FAST_IS_REG(src2) ? gpr(src2 & REG_MASK) : tmp1;
-			if (src2 & SLJIT_IMM) {
-				#define LEVAL(i) i(src1_r, src2w)
-				if (cmp > 0 && is_u32(src2w)) {
-					/* unsigned */
-					FAIL_IF(push_inst(compiler,
-					WHEN2(op & SLJIT_I32_OP, clfi, clgfi)));
-				}
-				else if (cmp < 0 && is_s16(src2w)) {
-					/* signed */
-					FAIL_IF(push_inst(compiler,
-					WHEN2(op & SLJIT_I32_OP, chi, cghi)));
-				}
-				else if (cmp < 0 && is_s32(src2w)) {
-					/* signed */
-					FAIL_IF(push_inst(compiler,
-					WHEN2(op & SLJIT_I32_OP, cfi, cgfi)));
-				}
-				#undef LEVAL
-				#define LEVAL(i) i(src1_r, src2_r)
-				else {
-					FAIL_IF(push_load_imm_inst(compiler, src2_r, src2w));
-					if (cmp > 0) {
-						/* unsigned */
-						FAIL_IF(push_inst(compiler,
-						WHEN2(op & SLJIT_I32_OP, clr, clgr)));
-					}
-					if (cmp < 0) {
-						/* signed */
-						FAIL_IF(push_inst(compiler,
-						WHEN2(op & SLJIT_I32_OP, cr, cgr)));
-					}
-				}
-			}
-			else {
-				if (src2 & SLJIT_MEM) {
-					/* TODO(mundaym): comparisons with memory */
-					/* load src2 into register */
-					FAIL_IF(load_word(compiler, src2_r, src2, src2w, tmp1, op & SLJIT_I32_OP));
-				}
-				if (cmp > 0) {
-					/* unsigned */
-					FAIL_IF(push_inst(compiler,
-						WHEN2(op & SLJIT_I32_OP, clr, clgr)));
-				}
-				if (cmp < 0) {
-					/* signed */
-					FAIL_IF(push_inst(compiler,
-						WHEN2(op & SLJIT_I32_OP, cr, cgr)));
-				}
-				#undef LEVAL
-			}
-			FAIL_IF(push_inst(compiler, ipm(flag_r)));
-		}
-	}
-
-	if (!HAS_FLAGS(op) && dst == SLJIT_UNUSED)
+	switch (GET_OPCODE(op)) {
+	case SLJIT_ADD:
+		return sljit_emit_add(compiler, op, dst, dstw, src1, src1w, src2, src2w);
+	case SLJIT_ADDC:
+		FAIL_IF(emit_commutative(compiler, &addc_forms, dst, dstw, src1, src1w, src2, src2w));
+		if (dst & SLJIT_MEM)
+			return store_word(compiler, tmp0, dst, dstw, op & SLJIT_I32_OP);
 		return SLJIT_SUCCESS;
-
-	/* need to specify signed or logical operation */
-	int signed_flags = sets_signed_flag(op);
-
-	if (is_shift(op)) {
-		/* handle shifts first, they have more constraints than other operations */
-		sljit_sw d = 0;
-		sljit_gpr b = FAST_IS_REG(src2) ? gpr(src2 & REG_MASK) : r0;
-		if (src2 & SLJIT_IMM)
-			d = src2w & ((op & SLJIT_I32_OP) ? 31 : 63);
-
-		if (src2 & SLJIT_MEM) {
-			/* shift amount (b) cannot be in r0 (i.e. tmp0) */
-			FAIL_IF(load_word(compiler, tmp1, src2, src2w, tmp1, op & SLJIT_I32_OP));
-			b = tmp1;
-		}
-		/* src1 and dst share the same register in the base 32-bit ISA */
-		/* TODO(mundaym): not needed when distinct-operand facility is available */
-		int workaround_alias = op & SLJIT_I32_OP && src1_r != dst_r;
-		if (workaround_alias) {
-			/* put src1 into tmp0 so we can overwrite it */
-			FAIL_IF(push_inst(compiler, lr(tmp0, src1_r)));
-			src1_r = tmp0;
-		}
-		switch (GET_OPCODE(op) | (op & SLJIT_I32_OP)) {
-		case SLJIT_SHL:
-			FAIL_IF(push_inst(compiler, sllg(dst_r, src1_r, d, b)));
-			break;
-		case SLJIT_SHL32:
-			FAIL_IF(push_inst(compiler, sll(src1_r, d, b)));
-			break;
-		case SLJIT_LSHR:
-			FAIL_IF(push_inst(compiler, srlg(dst_r, src1_r, d, b)));
-			break;
-		case SLJIT_LSHR32:
-			FAIL_IF(push_inst(compiler, srl(src1_r, d, b)));
-			break;
-		case SLJIT_ASHR:
-			FAIL_IF(push_inst(compiler, srag(dst_r, src1_r, d, b)));
-			break;
-		case SLJIT_ASHR32:
-			FAIL_IF(push_inst(compiler, sra(src1_r, d, b)));
-			break;
-		default:
-			SLJIT_UNREACHABLE();
-		}
-		if (workaround_alias && dst_r != src1_r)
-			FAIL_IF(push_inst(compiler, lr(dst_r, src1_r)));
-
-	}
-	else if ((GET_OPCODE(op) == SLJIT_MUL) && HAS_FLAGS(op)) {
-		/* multiply instructions do not generally set flags so we need to manually */
-		/* detect overflow conditions */
-		/* TODO(mundaym): 64-bit overflow */
-		SLJIT_ASSERT(GET_FLAG_TYPE(op) == SLJIT_MUL_OVERFLOW ||
-		             GET_FLAG_TYPE(op) == SLJIT_MUL_NOT_OVERFLOW);
-		sljit_gpr src2_r = FAST_IS_REG(src2) ? gpr(src2 & REG_MASK) : tmp1;
-		if (src2 & SLJIT_IMM) {
-			/* load src2 into register */
-			FAIL_IF(push_load_imm_inst(compiler, src2_r, src2w));
-		}
-		if (src2 & SLJIT_MEM) {
-			/* load src2 into register */
-			FAIL_IF(load_word(compiler, src2_r, src2, src2w, tmp1, op & SLJIT_I32_OP));
-		}
-		if (have_misc2()) {
-			#define LEVAL(i) i(dst_r, src1_r, src2_r)
-			FAIL_IF(push_inst(compiler,
-				WHEN2(op & SLJIT_I32_OP, msrkc, msgrkc)));
-			#undef LEVAL
-		}
-		else if (op & SLJIT_I32_OP) {
-			op &= ~VARIABLE_FLAG_MASK;
-			FAIL_IF(push_inst(compiler, lgfr(tmp0, src1_r)));
-			FAIL_IF(push_inst(compiler, msgfr(tmp0, src2_r)));
-			if (dst_r != tmp0) {
-				FAIL_IF(push_inst(compiler, lr(dst_r, tmp0)));
-			}
-			FAIL_IF(push_inst(compiler, aih(tmp0, 1)));
-			FAIL_IF(push_inst(compiler, nihf(tmp0, ~1U)));
-			FAIL_IF(push_inst(compiler, ipm(flag_r)));
-			FAIL_IF(push_inst(compiler, oilh(flag_r, 0x2000)));
-		}
-		else
-			return SLJIT_ERR_UNSUPPORTED;
-
-	}
-	else if ((GET_OPCODE(op) == SLJIT_SUB) && (op & SLJIT_SET_Z) && !signed_flags) {
-		/* subtract logical instructions do not set the right flags unfortunately */
-		/* instead, negate src2 and issue an add logical */
-		/* TODO(mundaym): distinct operand facility where needed */
-		if (src1_r != dst_r && src1_r != tmp0) {
-			#define LEVAL(i) i(tmp0, src1_r)
-			FAIL_IF(push_inst(compiler,
-				WHEN2(op & SLJIT_I32_OP, lr, lgr)));
-			src1_r = tmp0;
-			#undef LEVAL
-		}
-		sljit_gpr src2_r = FAST_IS_REG(src2) ? gpr(src2 & REG_MASK) : tmp1;
-		if (src2 & SLJIT_IMM) {
-			/* load src2 into register */
-			FAIL_IF(push_load_imm_inst(compiler, src2_r, src2w));
-		}
-		if (src2 & SLJIT_MEM) {
-			/* load src2 into register */
-			FAIL_IF(load_word(compiler, src2_r, src2, src2w, tmp1, op & SLJIT_I32_OP));
-		}
-		if (op & SLJIT_I32_OP) {
-			FAIL_IF(push_inst(compiler, lcr(tmp1, src2_r)));
-			FAIL_IF(push_inst(compiler, alr(src1_r, tmp1)));
-			if (src1_r != dst_r)
-				FAIL_IF(push_inst(compiler, lr(dst_r, src1_r)));
-		}
-		else {
-			FAIL_IF(push_inst(compiler, lcgr(tmp1, src2_r)));
-			FAIL_IF(push_inst(compiler, algr(src1_r, tmp1)));
-			if (src1_r != dst_r)
-				FAIL_IF(push_inst(compiler, lgr(dst_r, src1_r)));
-		}
-	}
-	else if ((src2 & SLJIT_IMM) && (src1_r == dst_r) && have_op_2_imm(op, src2w)) {
-		switch (GET_OPCODE(op) | (op & SLJIT_I32_OP)) {
-		#define LEVAL(i) i(dst_r, src2w)
-		case SLJIT_ADD:
-			if (!HAS_FLAGS(op) || signed_flags) {
-				FAIL_IF(push_inst(compiler,
-					WHEN2(is_s16(src2w), aghi, agfi)));
-			}
-			else
-				FAIL_IF(push_inst(compiler, LEVAL(algfi)));
-
-			break;
-		case SLJIT_ADD32:
-			if (!HAS_FLAGS(op) || signed_flags)
-				FAIL_IF(push_inst(compiler,
-					WHEN2(is_s16(src2w), ahi, afi)));
-			else
-				FAIL_IF(push_inst(compiler, LEVAL(alfi)));
-
-			break;
-		#undef LEVAL /* TODO(carenas): move down and refactor? */
-		case SLJIT_MUL:
-			FAIL_IF(push_inst(compiler, mhi(dst_r, src2w)));
-			break;
-		case SLJIT_MUL32:
-			FAIL_IF(push_inst(compiler, mghi(dst_r, src2w)));
-			break;
-		case SLJIT_OR32:
-			FAIL_IF(push_inst(compiler, oilf(dst_r, src2w)));
-			break;
-		case SLJIT_XOR32:
-			FAIL_IF(push_inst(compiler, xilf(dst_r, src2w)));
-			break;
-		case SLJIT_AND32:
-			FAIL_IF(push_inst(compiler, nilf(dst_r, src2w)));
-			break;
-		default:
-			SLJIT_UNREACHABLE();
-		}
-	}
-	else if ((src2 & SLJIT_IMM) && have_op_3_imm(op, src2w)) {
-		abort(); /* TODO(mundaym): implement */
-	}
-	else if ((src2 & SLJIT_MEM) && (dst_r == src1_r)) {
-		/* most 32-bit instructions can only handle 12-bit immediate offsets */
-		int need_u12 = !have_ldisp() &&
-			(op & SLJIT_I32_OP) &&
-			(GET_OPCODE(op) != SLJIT_ADDC) &&
-			(GET_OPCODE(op) != SLJIT_SUBC);
-		struct addr mem;
-		if (need_u12)
-			FAIL_IF(make_addr_bx(compiler, &mem, src2, src2w, tmp1));
-		else
-			FAIL_IF(make_addr_bxy(compiler, &mem, src2, src2w, tmp1));
-
-		int can_u12 = is_u12(mem.offset) ? 1 : 0;
-		sljit_ins ins = 0;
-		switch (GET_OPCODE(op) | (op & SLJIT_I32_OP)) {
-		/* 64-bit ops */
-		#define LEVAL(i) EVAL(i, dst_r, mem)
-		case SLJIT_ADD:
-			ins = WHEN2(signed_flags, ag, alg);
-			break;
-		case SLJIT_SUB:
-			ins = WHEN2(signed_flags, sg, slg);
-			break;
-		case SLJIT_ADDC:
-			ins = LEVAL(alcg);
-			break;
-		case SLJIT_SUBC:
-			ins = LEVAL(slbg);
-			break;
-		case SLJIT_MUL:
-			ins = LEVAL(msg);
-			break;
-		case SLJIT_OR:
-			ins = LEVAL(og);
-			break;
-		case SLJIT_XOR:
-			ins = LEVAL(xg);
-			break;
-		case SLJIT_AND:
-			ins = LEVAL(ng);
-			break;
-		/* 32-bit ops */
-		case SLJIT_ADD32:
-			if (signed_flags)
-				ins = WHEN2(can_u12, a, ay);
-			else
-				ins = WHEN2(can_u12, al, aly);
-			break;
-		case SLJIT_SUB32:
-			if (signed_flags)
-				ins = WHEN2(can_u12, s, sy);
-			else
-				ins = WHEN2(can_u12, sl, sly);
-			break;
-		case SLJIT_ADDC32:
-			ins = LEVAL(alc);
-			break;
-		case SLJIT_SUBC32:
-			ins = LEVAL(slb);
-			break;
-		case SLJIT_MUL32:
-			ins = WHEN2(can_u12, ms, msy);
-			break;
-		case SLJIT_OR32:
-			ins = WHEN2(can_u12, o, oy);
-			break;
-		case SLJIT_XOR32:
-			ins = WHEN2(can_u12, x, xy);
-			break;
-		case SLJIT_AND32:
-			ins = WHEN2(can_u12, n, ny);
-			break;
-		#undef LEVAL
-		default:
-			SLJIT_UNREACHABLE();
-		}
-		FAIL_IF(push_inst(compiler, ins));
-	}
-	else {
-		sljit_gpr src2_r = FAST_IS_REG(src2) ? gpr(src2 & REG_MASK) : tmp1;
-		if (src2 & SLJIT_IMM) {
-			/* load src2 into register */
-			FAIL_IF(push_load_imm_inst(compiler, src2_r, src2w));
-		}
-		if (src2 & SLJIT_MEM) {
-			/* load src2 into register */
-			FAIL_IF(load_word(compiler, src2_r, src2, src2w, tmp1, op & SLJIT_I32_OP));
-		}
-		/* TODO(mundaym): distinct operand facility where needed */
-		#define LEVAL(i) i(tmp0, src1_r)
-		if (src1_r != dst_r && src1_r != tmp0) {
-			FAIL_IF(push_inst(compiler,
-				WHEN2(op & SLJIT_I32_OP, lr, lgr)));
-			src1_r = tmp0;
-		}
-		#undef LEVAL
-		sljit_ins ins = 0;
-		switch (GET_OPCODE(op) | (op & SLJIT_I32_OP)) {
-		#define LEVAL(i) i(src1_r, src2_r)
-		/* 64-bit ops */
-		case SLJIT_ADD:
-			ins = WHEN2(signed_flags, agr, algr);
-			break;
-		case SLJIT_SUB:
-			ins = WHEN2(signed_flags, sgr, slgr);
-			break;
-		case SLJIT_ADDC:
-			ins = LEVAL(alcgr);
-			break;
-		case SLJIT_SUBC:
-			ins = LEVAL(slbgr);
-			break;
-		case SLJIT_MUL:
-			ins = LEVAL(msgr);
-			break;
-		case SLJIT_AND:
-			ins = LEVAL(ngr);
-			break;
-		case SLJIT_OR:
-			ins = LEVAL(ogr);
-			break;
-		case SLJIT_XOR:
-			ins = LEVAL(xgr);
-			break;
-		/* 32-bit ops */
-		case SLJIT_ADD32:
-			ins = WHEN2(signed_flags, ar, alr);
-			break;
-		case SLJIT_SUB32:
-			ins = WHEN2(signed_flags, sr, slr);
-			break;
-		case SLJIT_ADDC32:
-			ins = LEVAL(alcr);
-			break;
-		case SLJIT_SUBC32:
-			ins = LEVAL(slbr);
-			break;
-		case SLJIT_MUL32:
-			ins = LEVAL(msr);
-			break;
-		case SLJIT_AND32:
-			ins = LEVAL(nr);
-			break;
-		case SLJIT_OR32:
-			ins = LEVAL(or);
-			break;
-		case SLJIT_XOR32:
-			ins = LEVAL(xr);
-			break;
-		#undef LEVAL
-		default:
-			SLJIT_UNREACHABLE();
-		}
-		FAIL_IF(push_inst(compiler, ins));
-		#define LEVAL(i) i(dst_r, src1_r)
-		if (src1_r != dst_r)
-			FAIL_IF(push_inst(compiler,
-				WHEN2(op & SLJIT_I32_OP, lr, lgr)));
-		#undef LEVAL
+	case SLJIT_SUB:
+		return sljit_emit_sub(compiler, op, dst, dstw, src1, src1w, src2, src2w);
+	case SLJIT_SUBC:
+		FAIL_IF(emit_non_commutative(compiler, &subc_forms, dst, dstw, src1, src1w, src2, src2w));
+		if (dst & SLJIT_MEM)
+			return store_word(compiler, tmp0, dst, dstw, op & SLJIT_I32_OP);
+		return SLJIT_SUCCESS;
+	case SLJIT_MUL:
+		FAIL_IF(sljit_emit_multiply(compiler, op, dst, dstw, src1, src1w, src2, src2w));
+		break;
+	case SLJIT_AND:
+	case SLJIT_OR:
+	case SLJIT_XOR:
+		FAIL_IF(sljit_emit_bitwise(compiler, op, dst, dstw, src1, src1w, src2, src2w));
+		break;
+	case SLJIT_SHL:
+	case SLJIT_LSHR:
+	case SLJIT_ASHR:
+		FAIL_IF(sljit_emit_shift(compiler, op, dst, dstw, src1, src1w, src2, src2w));
+		break;
 	}
 
-	/* write condition code to emulated flag register */
-	if (op & VARIABLE_FLAG_MASK)
-		FAIL_IF(push_inst(compiler, ipm(flag_r)));
-
-	/* write zero flag to emulated flag register */
-	if (op & SLJIT_SET_Z)
-		FAIL_IF(push_store_zero_flag(compiler, op, dst_r));
-
-	/* finally write the result to memory if required */
-	if (dst & SLJIT_MEM) {
-		SLJIT_ASSERT(dst_r != tmp1);
-		/* TODO(carenas): s/FAIL_IF/ return */
-		FAIL_IF(store_word(compiler, dst_r, dst, dstw, tmp1, op & SLJIT_I32_OP));
-	}
-
+	if (dst & SLJIT_MEM)
+		return store_word(compiler, tmp0, dst, dstw, op & SLJIT_I32_OP);
 	return SLJIT_SUCCESS;
 }
 
@@ -2429,7 +2663,7 @@
 	case SLJIT_FAST_RETURN:
 		src_r = FAST_IS_REG(src) ? gpr(src) : tmp1;
 		if (src & SLJIT_MEM)
-			FAIL_IF(load_word(compiler, tmp1, src, srcw, tmp1, 0));
+			FAIL_IF(load_word(compiler, tmp1, src, srcw, 0));
 
 		return push_inst(compiler, br(src_r));
 	case SLJIT_SKIP_FRAMES_BEFORE_FAST_RETURN:
@@ -2508,7 +2742,7 @@
 		return push_inst(compiler, lgr(gpr(dst), fast_link_r));
 
 	/* memory */
-	return store_word(compiler, fast_link_r, dst, dstw, tmp1, 0);
+	return store_word(compiler, fast_link_r, dst, dstw, 0);
 }
 
 /* --------------------------------------------------------------------- */
@@ -2533,15 +2767,11 @@
 
 SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_jump(struct sljit_compiler *compiler, sljit_s32 type)
 {
-	sljit_u8 mask = ((type & 0xff) < SLJIT_JUMP) ? get_cc(type & 0xff) : 0xf;
+	sljit_u8 mask = ((type & 0xff) < SLJIT_JUMP) ? get_cc(compiler, type & 0xff) : 0xf;
 
 	CHECK_ERROR_PTR();
 	CHECK_PTR(check_sljit_emit_jump(compiler, type));
 
-	/* reload condition code */
-	if (mask != 0xf)
-		PTR_FAIL_IF(push_load_cc(compiler, type & 0xff));
-
 	/* record jump */
 	struct sljit_jump *jump = (struct sljit_jump *)
 		ensure_abuf(compiler, sizeof(struct sljit_jump));
@@ -2586,7 +2816,7 @@
 		FAIL_IF(push_load_imm_inst(compiler, src_r, srcw));
 	}
 	else if (src & SLJIT_MEM)
-		FAIL_IF(load_word(compiler, src_r, src, srcw, tmp1, 0 /* 64-bit */));
+		FAIL_IF(load_word(compiler, src_r, src, srcw, 0 /* 64-bit */));
 
 	/* emit jump instruction */
 	if (type >= SLJIT_FAST_CALL)
@@ -2614,7 +2844,7 @@
 	sljit_s32 dst, sljit_sw dstw,
 	sljit_s32 type)
 {
-	sljit_u8 mask = get_cc(type & 0xff);
+	sljit_u8 mask = get_cc(compiler, type & 0xff);
 
 	CHECK_ERROR();
 	CHECK(check_sljit_emit_op_flags(compiler, op, dst, dstw, type));
@@ -2625,9 +2855,11 @@
 	case SLJIT_AND:
 	case SLJIT_OR:
 	case SLJIT_XOR:
+		compiler->status_flags_state = op & SLJIT_SET_Z;
+
 		/* dst is also source operand */
 		if (dst & SLJIT_MEM)
-			FAIL_IF(load_word(compiler, dst_r, dst, dstw, tmp1, op & SLJIT_I32_OP));
+			FAIL_IF(load_word(compiler, dst_r, dst, dstw, op & SLJIT_I32_OP));
 
 		break;
 	case SLJIT_MOV:
@@ -2639,9 +2871,6 @@
 		SLJIT_UNREACHABLE();
 	}
 
-	if (mask != 0xf)
-		FAIL_IF(push_load_cc(compiler, type & 0xff));
-
 	/* TODO(mundaym): fold into cmov helper function? */
 	#define LEVAL(i) i(loc_r, 1, mask)
 	if (have_lscond2()) {
@@ -2672,14 +2901,9 @@
 	#undef LEVAL
 	}
 
-	/* set zero flag if needed */
-	if (op & SLJIT_SET_Z)
-		FAIL_IF(push_store_zero_flag(compiler, op, dst_r));
-
 	/* store result to memory if required */
-	/* TODO(carenas): s/FAIL_IF/ return */
 	if (dst & SLJIT_MEM)
-		FAIL_IF(store_word(compiler, dst_r, dst, dstw, tmp1, op & SLJIT_I32_OP));
+		return store_word(compiler, dst_r, dst, dstw, op & SLJIT_I32_OP);
 
 	return SLJIT_SUCCESS;
 }
@@ -2688,16 +2912,13 @@
 	sljit_s32 dst_reg,
 	sljit_s32 src, sljit_sw srcw)
 {
-	sljit_u8 mask = get_cc(type & 0xff);
+	sljit_u8 mask = get_cc(compiler, type & 0xff);
 	sljit_gpr dst_r = gpr(dst_reg & ~SLJIT_I32_OP);
 	sljit_gpr src_r = FAST_IS_REG(src) ? gpr(src) : tmp0;
 
 	CHECK_ERROR();
 	CHECK(check_sljit_emit_cmov(compiler, type, dst_reg, src, srcw));
 
-	if (mask != 0xf)
-		FAIL_IF(push_load_cc(compiler, type & 0xff));
-
 	if (src & SLJIT_IMM) {
 		/* TODO(mundaym): fast path with lscond2 */
 		FAIL_IF(push_load_imm_inst(compiler, src_r, srcw));
@@ -2751,7 +2972,7 @@
 	}
 
 	if (dst & SLJIT_MEM)
-		PTR_FAIL_IF(store_word(compiler, dst_r, dst, dstw, tmp1, 0 /* always 64-bit */));
+		PTR_FAIL_IF(store_word(compiler, dst_r, dst, dstw, 0 /* always 64-bit */));
 
 	return (struct sljit_const*)const_;
 }
@@ -2798,7 +3019,7 @@
 	}
 
 	if (dst & SLJIT_MEM)
-		PTR_FAIL_IF(store_word(compiler, dst_r, dst, dstw, tmp1, 0));
+		PTR_FAIL_IF(store_word(compiler, dst_r, dst, dstw, 0));
 
 	return put_label;
 }
diff --git a/dist2/src/sljit/sljitNativeSPARC_32.c b/src/sljit/sljitNativeSPARC_32.c
similarity index 98%
rename from dist2/src/sljit/sljitNativeSPARC_32.c
rename to src/sljit/sljitNativeSPARC_32.c
index e5167f0..2888640 100644
--- a/dist2/src/sljit/sljitNativeSPARC_32.c
+++ b/src/sljit/sljitNativeSPARC_32.c
@@ -93,18 +93,21 @@
 		return push_inst(compiler, ADD | D(dst) | S1(dst) | IMM(1), UNMOVABLE_INS);
 
 	case SLJIT_ADD:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return push_inst(compiler, ADD | (flags & SET_FLAGS) | D(dst) | S1(src1) | ARG2(flags, src2), DR(dst) | (flags & SET_FLAGS));
 
 	case SLJIT_ADDC:
 		return push_inst(compiler, ADDC | (flags & SET_FLAGS) | D(dst) | S1(src1) | ARG2(flags, src2), DR(dst) | (flags & SET_FLAGS));
 
 	case SLJIT_SUB:
+		compiler->status_flags_state = SLJIT_CURRENT_FLAGS_ADD_SUB;
 		return push_inst(compiler, SUB | (flags & SET_FLAGS) | D(dst) | S1(src1) | ARG2(flags, src2), DR(dst) | (flags & SET_FLAGS));
 
 	case SLJIT_SUBC:
 		return push_inst(compiler, SUBC | (flags & SET_FLAGS) | D(dst) | S1(src1) | ARG2(flags, src2), DR(dst) | (flags & SET_FLAGS));
 
 	case SLJIT_MUL:
+		compiler->status_flags_state = 0;
 		FAIL_IF(push_inst(compiler, SMUL | D(dst) | S1(src1) | ARG2(flags, src2), DR(dst)));
 		if (!(flags & SET_FLAGS))
 			return SLJIT_SUCCESS;
diff --git a/dist2/src/sljit/sljitNativeSPARC_common.c b/src/sljit/sljitNativeSPARC_common.c
similarity index 98%
rename from dist2/src/sljit/sljitNativeSPARC_common.c
rename to src/sljit/sljitNativeSPARC_common.c
index 544d80d..e833f09 100644
--- a/dist2/src/sljit/sljitNativeSPARC_common.c
+++ b/src/sljit/sljitNativeSPARC_common.c
@@ -1275,16 +1275,14 @@
 	return label;
 }
 
-static sljit_ins get_cc(sljit_s32 type)
+static sljit_ins get_cc(struct sljit_compiler *compiler, sljit_s32 type)
 {
 	switch (type) {
 	case SLJIT_EQUAL:
-	case SLJIT_MUL_NOT_OVERFLOW:
 	case SLJIT_NOT_EQUAL_F64: /* Unordered. */
 		return DA(0x1);
 
 	case SLJIT_NOT_EQUAL:
-	case SLJIT_MUL_OVERFLOW:
 	case SLJIT_EQUAL_F64:
 		return DA(0x9);
 
@@ -1317,10 +1315,16 @@
 		return DA(0x2);
 
 	case SLJIT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return DA(0x9);
+
 	case SLJIT_UNORDERED_F64:
 		return DA(0x7);
 
 	case SLJIT_NOT_OVERFLOW:
+		if (!(compiler->status_flags_state & SLJIT_CURRENT_FLAGS_ADD_SUB))
+			return DA(0x1);
+
 	case SLJIT_ORDERED_F64:
 		return DA(0xf);
 
@@ -1347,7 +1351,7 @@
 		if (((compiler->delay_slot & DST_INS_MASK) != UNMOVABLE_INS) && !(compiler->delay_slot & ICC_IS_SET))
 			jump->flags |= IS_MOVABLE;
 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
-		PTR_FAIL_IF(push_inst(compiler, BICC | get_cc(type ^ 1) | 5, UNMOVABLE_INS));
+		PTR_FAIL_IF(push_inst(compiler, BICC | get_cc(compiler, type ^ 1) | 5, UNMOVABLE_INS));
 #else
 #error "Implementation required"
 #endif
@@ -1357,7 +1361,7 @@
 		if (((compiler->delay_slot & DST_INS_MASK) != UNMOVABLE_INS) && !(compiler->delay_slot & FCC_IS_SET))
 			jump->flags |= IS_MOVABLE;
 #if (defined SLJIT_CONFIG_SPARC_32 && SLJIT_CONFIG_SPARC_32)
-		PTR_FAIL_IF(push_inst(compiler, FBFCC | get_cc(type ^ 1) | 5, UNMOVABLE_INS));
+		PTR_FAIL_IF(push_inst(compiler, FBFCC | get_cc(compiler, type ^ 1) | 5, UNMOVABLE_INS));
 #else
 #error "Implementation required"
 #endif
@@ -1474,9 +1478,9 @@
 
 	type &= 0xff;
 	if (type < SLJIT_EQUAL_F64)
-		FAIL_IF(push_inst(compiler, BICC | get_cc(type) | 3, UNMOVABLE_INS));
+		FAIL_IF(push_inst(compiler, BICC | get_cc(compiler, type) | 3, UNMOVABLE_INS));
 	else
-		FAIL_IF(push_inst(compiler, FBFCC | get_cc(type) | 3, UNMOVABLE_INS));
+		FAIL_IF(push_inst(compiler, FBFCC | get_cc(compiler, type) | 3, UNMOVABLE_INS));
 
 	FAIL_IF(push_inst(compiler, OR | D(reg) | S1(0) | IMM(1), UNMOVABLE_INS));
 	FAIL_IF(push_inst(compiler, OR | D(reg) | S1(0) | IMM(0), UNMOVABLE_INS));
diff --git a/dist2/src/sljit/sljitNativeX86_32.c b/src/sljit/sljitNativeX86_32.c
similarity index 100%
rename from dist2/src/sljit/sljitNativeX86_32.c
rename to src/sljit/sljitNativeX86_32.c
diff --git a/dist2/src/sljit/sljitNativeX86_64.c b/src/sljit/sljitNativeX86_64.c
similarity index 100%
rename from dist2/src/sljit/sljitNativeX86_64.c
rename to src/sljit/sljitNativeX86_64.c
diff --git a/dist2/src/sljit/sljitNativeX86_common.c b/src/sljit/sljitNativeX86_common.c
similarity index 99%
rename from dist2/src/sljit/sljitNativeX86_common.c
rename to src/sljit/sljitNativeX86_common.c
index ddcc5eb..515d98a 100644
--- a/dist2/src/sljit/sljitNativeX86_common.c
+++ b/src/sljit/sljitNativeX86_common.c
@@ -411,11 +411,9 @@
 		return 0x8e /* jle */;
 
 	case SLJIT_OVERFLOW:
-	case SLJIT_MUL_OVERFLOW:
 		return 0x80 /* jo */;
 
 	case SLJIT_NOT_OVERFLOW:
-	case SLJIT_MUL_NOT_OVERFLOW:
 		return 0x81 /* jno */;
 
 	case SLJIT_UNORDERED_F64:
diff --git a/dist2/src/sljit/sljitProtExecAllocator.c b/src/sljit/sljitProtExecAllocator.c
similarity index 100%
rename from dist2/src/sljit/sljitProtExecAllocator.c
rename to src/sljit/sljitProtExecAllocator.c
diff --git a/dist2/src/sljit/sljitUtils.c b/src/sljit/sljitUtils.c
similarity index 100%
rename from dist2/src/sljit/sljitUtils.c
rename to src/sljit/sljitUtils.c
diff --git a/dist2/src/sljit/sljitWXExecAllocator.c b/src/sljit/sljitWXExecAllocator.c
similarity index 100%
rename from dist2/src/sljit/sljitWXExecAllocator.c
rename to src/sljit/sljitWXExecAllocator.c
diff --git a/dist2/test-driver b/test-driver
similarity index 92%
rename from dist2/test-driver
rename to test-driver
index 9759384..be73b80 100755
--- a/dist2/test-driver
+++ b/test-driver
@@ -3,7 +3,7 @@
 
 scriptversion=2018-03-07.03; # UTC
 
-# Copyright (C) 2011-2020 Free Software Foundation, Inc.
+# Copyright (C) 2011-2021 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -105,8 +105,11 @@
 trap "st=141; $do_exit" 13
 trap "st=143; $do_exit" 15
 
-# Test script is run here.
-"$@" >$log_file 2>&1
+# Test script is run here. We create the file first, then append to it,
+# to ameliorate tests themselves also writing to the log file. Our tests
+# don't, but others can (automake bug#35762).
+: >"$log_file"
+"$@" >>"$log_file" 2>&1
 estatus=$?
 
 if test $enable_hard_errors = no && test $estatus -eq 99; then
@@ -128,7 +131,7 @@
 # know whether the test passed or failed simply by looking at the '.log'
 # file, without the need of also peaking into the corresponding '.trs'
 # file (automake bug#11814).
-echo "$res $test_name (exit status: $estatus)" >>$log_file
+echo "$res $test_name (exit status: $estatus)" >>"$log_file"
 
 # Report outcome to console.
 echo "${col}${res}${std}: $test_name"
diff --git a/dist2/testdata/grepbinary b/testdata/grepbinary
similarity index 100%
rename from dist2/testdata/grepbinary
rename to testdata/grepbinary
Binary files differ
diff --git a/dist2/testdata/grepfilelist b/testdata/grepfilelist
similarity index 100%
rename from dist2/testdata/grepfilelist
rename to testdata/grepfilelist
diff --git a/dist2/testdata/grepinput b/testdata/grepinput
similarity index 100%
rename from dist2/testdata/grepinput
rename to testdata/grepinput
Binary files differ
diff --git a/dist2/testdata/grepinput3 b/testdata/grepinput3
similarity index 100%
rename from dist2/testdata/grepinput3
rename to testdata/grepinput3
diff --git a/dist2/testdata/grepinput8 b/testdata/grepinput8
similarity index 100%
rename from dist2/testdata/grepinput8
rename to testdata/grepinput8
Binary files differ
diff --git a/dist2/testdata/grepinputM b/testdata/grepinputM
similarity index 100%
rename from dist2/testdata/grepinputM
rename to testdata/grepinputM
diff --git a/dist2/testdata/grepinputv b/testdata/grepinputv
similarity index 100%
rename from dist2/testdata/grepinputv
rename to testdata/grepinputv
diff --git a/dist2/testdata/grepinputx b/testdata/grepinputx
similarity index 100%
rename from dist2/testdata/grepinputx
rename to testdata/grepinputx
diff --git a/dist2/testdata/greplist b/testdata/greplist
similarity index 100%
rename from dist2/testdata/greplist
rename to testdata/greplist
diff --git a/dist2/testdata/grepoutput b/testdata/grepoutput
similarity index 100%
rename from dist2/testdata/grepoutput
rename to testdata/grepoutput
Binary files differ
diff --git a/dist2/testdata/grepoutput8 b/testdata/grepoutput8
similarity index 100%
rename from dist2/testdata/grepoutput8
rename to testdata/grepoutput8
Binary files differ
diff --git a/dist2/testdata/grepoutputC b/testdata/grepoutputC
similarity index 100%
rename from dist2/testdata/grepoutputC
rename to testdata/grepoutputC
diff --git a/dist2/testdata/grepoutputCN b/testdata/grepoutputCN
similarity index 100%
rename from dist2/testdata/grepoutputCN
rename to testdata/grepoutputCN
diff --git a/dist2/testdata/grepoutputN b/testdata/grepoutputN
similarity index 100%
rename from dist2/testdata/grepoutputN
rename to testdata/grepoutputN
Binary files differ
diff --git a/dist2/testdata/greppatN4 b/testdata/greppatN4
similarity index 100%
rename from dist2/testdata/greppatN4
rename to testdata/greppatN4
diff --git a/dist2/testdata/testbtables b/testdata/testbtables
similarity index 100%
rename from dist2/testdata/testbtables
rename to testdata/testbtables
Binary files differ
diff --git a/dist2/testdata/testinput1 b/testdata/testinput1
similarity index 100%
rename from dist2/testdata/testinput1
rename to testdata/testinput1
diff --git a/dist2/testdata/testinput10 b/testdata/testinput10
similarity index 100%
rename from dist2/testdata/testinput10
rename to testdata/testinput10
diff --git a/dist2/testdata/testinput11 b/testdata/testinput11
similarity index 100%
rename from dist2/testdata/testinput11
rename to testdata/testinput11
diff --git a/dist2/testdata/testinput12 b/testdata/testinput12
similarity index 100%
rename from dist2/testdata/testinput12
rename to testdata/testinput12
diff --git a/dist2/testdata/testinput13 b/testdata/testinput13
similarity index 100%
rename from dist2/testdata/testinput13
rename to testdata/testinput13
diff --git a/dist2/testdata/testinput14 b/testdata/testinput14
similarity index 100%
rename from dist2/testdata/testinput14
rename to testdata/testinput14
diff --git a/dist2/testdata/testinput15 b/testdata/testinput15
similarity index 100%
rename from dist2/testdata/testinput15
rename to testdata/testinput15
diff --git a/dist2/testdata/testinput16 b/testdata/testinput16
similarity index 100%
rename from dist2/testdata/testinput16
rename to testdata/testinput16
diff --git a/dist2/testdata/testinput17 b/testdata/testinput17
similarity index 100%
rename from dist2/testdata/testinput17
rename to testdata/testinput17
diff --git a/dist2/testdata/testinput18 b/testdata/testinput18
similarity index 98%
rename from dist2/testdata/testinput18
rename to testdata/testinput18
index 563a506..a02521f 100644
--- a/dist2/testdata/testinput18
+++ b/testdata/testinput18
@@ -110,9 +110,6 @@
 //posix_nosub
     \=offset=70000
 
-/(?=(a\K))/
-    a
-     
 /^d(e)$/posix
     acdef\=posix_startend=2:4
     acde\=posix_startend=2 
diff --git a/dist2/testdata/testinput19 b/testdata/testinput19
similarity index 100%
rename from dist2/testdata/testinput19
rename to testdata/testinput19
diff --git a/dist2/testdata/testinput2 b/testdata/testinput2
similarity index 99%
rename from dist2/testdata/testinput2
rename to testdata/testinput2
index 865c903..731a64a 100644
--- a/dist2/testdata/testinput2
+++ b/testdata/testinput2
@@ -3932,7 +3932,7 @@
 
 /[a[:<:]] should give error/
 
-/(?=ab\K)/aftertext
+/(?=ab\K)/aftertext,allow_lookaround_bsk
     abcd\=startchar
 
 /abcd/newline=lf,firstline
@@ -4185,7 +4185,7 @@
 /(a)(b)|(c)/
     XcX\=ovector=2,get=1,get=2,get=3,get=4,getall
 
-/x(?=ab\K)/
+/x(?=ab\K)/allow_lookaround_bsk
     xab\=get=0
     xab\=copy=0
     xab\=getall
@@ -4345,10 +4345,10 @@
 
 # Perl loops on this (PCRE2 used to!)
 
-/(?<=\Ka)/g,aftertext
+/(?<=\Ka)/g,aftertext,allow_lookaround_bsk
     aaaaa
 
-/(?<=\Ka)/altglobal,aftertext
+/(?<=\Ka)/altglobal,aftertext,allow_lookaround_bsk
     aaaaa
 
 /((?2){73}(?2))((?1))/info
@@ -4659,10 +4659,10 @@
 
 /(?<!a{65535})x/I
 
-/(?=a\K)/replace=z
+/(?=a\K)/replace=z,allow_lookaround_bsk
     BaCaD
     
-/(?<=\K.)/g,replace=-
+/(?<=\K.)/g,replace=-,allow_lookaround_bsk
     ab
 
 /(?'abcdefghijklmnopqrstuvwxyzABCDEFG'toolong)/
@@ -5877,18 +5877,27 @@
 
 /(?(VERSION=0.0/
 
-# Perl has made \K in lookarounds an error. At the moment PCRE2 still accepts.
+# Perl has made \K in lookarounds an error. PCRE2 now rejects as well, unless
+# explicitly authorized.
 
 /(?=a\Kb)ab/
+
+/(?=a\Kb)ab/allow_lookaround_bsk
     ab 
 
 /(?!a\Kb)ac/
+
+/(?!a\Kb)ac/allow_lookaround_bsk
     ac 
     
 /^abc(?<=b\Kc)d/
+
+/^abc(?<=b\Kc)d/allow_lookaround_bsk
     abcd
 
 /^abc(?<!b\Kq)d/
+
+/^abc(?<!b\Kq)d/,allow_lookaround_bsk
     abcd
     
 # --------- 
diff --git a/dist2/testdata/testinput20 b/testdata/testinput20
similarity index 100%
rename from dist2/testdata/testinput20
rename to testdata/testinput20
diff --git a/dist2/testdata/testinput21 b/testdata/testinput21
similarity index 100%
rename from dist2/testdata/testinput21
rename to testdata/testinput21
diff --git a/dist2/testdata/testinput22 b/testdata/testinput22
similarity index 100%
rename from dist2/testdata/testinput22
rename to testdata/testinput22
Binary files differ
diff --git a/dist2/testdata/testinput23 b/testdata/testinput23
similarity index 100%
rename from dist2/testdata/testinput23
rename to testdata/testinput23
diff --git a/dist2/testdata/testinput24 b/testdata/testinput24
similarity index 100%
rename from dist2/testdata/testinput24
rename to testdata/testinput24
diff --git a/dist2/testdata/testinput25 b/testdata/testinput25
similarity index 100%
rename from dist2/testdata/testinput25
rename to testdata/testinput25
diff --git a/dist2/testdata/testinput3 b/testdata/testinput3
similarity index 100%
rename from dist2/testdata/testinput3
rename to testdata/testinput3
diff --git a/dist2/testdata/testinput4 b/testdata/testinput4
similarity index 100%
rename from dist2/testdata/testinput4
rename to testdata/testinput4
diff --git a/dist2/testdata/testinput5 b/testdata/testinput5
similarity index 99%
rename from dist2/testdata/testinput5
rename to testdata/testinput5
index 50dfda1..9126236 100644
--- a/dist2/testdata/testinput5
+++ b/testdata/testinput5
Binary files differ
diff --git a/dist2/testdata/testinput6 b/testdata/testinput6
similarity index 100%
rename from dist2/testdata/testinput6
rename to testdata/testinput6
diff --git a/dist2/testdata/testinput7 b/testdata/testinput7
similarity index 100%
rename from dist2/testdata/testinput7
rename to testdata/testinput7
diff --git a/dist2/testdata/testinput8 b/testdata/testinput8
similarity index 100%
rename from dist2/testdata/testinput8
rename to testdata/testinput8
diff --git a/dist2/testdata/testinput9 b/testdata/testinput9
similarity index 100%
rename from dist2/testdata/testinput9
rename to testdata/testinput9
diff --git a/dist2/testdata/testinputEBC b/testdata/testinputEBC
similarity index 100%
rename from dist2/testdata/testinputEBC
rename to testdata/testinputEBC
diff --git a/dist2/testdata/testoutput1 b/testdata/testoutput1
similarity index 100%
rename from dist2/testdata/testoutput1
rename to testdata/testoutput1
diff --git a/dist2/testdata/testoutput10 b/testdata/testoutput10
similarity index 100%
rename from dist2/testdata/testoutput10
rename to testdata/testoutput10
diff --git a/dist2/testdata/testoutput11-16 b/testdata/testoutput11-16
similarity index 100%
rename from dist2/testdata/testoutput11-16
rename to testdata/testoutput11-16
diff --git a/dist2/testdata/testoutput11-32 b/testdata/testoutput11-32
similarity index 100%
rename from dist2/testdata/testoutput11-32
rename to testdata/testoutput11-32
diff --git a/dist2/testdata/testoutput12-16 b/testdata/testoutput12-16
similarity index 100%
rename from dist2/testdata/testoutput12-16
rename to testdata/testoutput12-16
diff --git a/dist2/testdata/testoutput12-32 b/testdata/testoutput12-32
similarity index 100%
rename from dist2/testdata/testoutput12-32
rename to testdata/testoutput12-32
diff --git a/dist2/testdata/testoutput13 b/testdata/testoutput13
similarity index 100%
rename from dist2/testdata/testoutput13
rename to testdata/testoutput13
diff --git a/dist2/testdata/testoutput14-16 b/testdata/testoutput14-16
similarity index 100%
rename from dist2/testdata/testoutput14-16
rename to testdata/testoutput14-16
diff --git a/dist2/testdata/testoutput14-32 b/testdata/testoutput14-32
similarity index 100%
rename from dist2/testdata/testoutput14-32
rename to testdata/testoutput14-32
diff --git a/dist2/testdata/testoutput14-8 b/testdata/testoutput14-8
similarity index 100%
rename from dist2/testdata/testoutput14-8
rename to testdata/testoutput14-8
diff --git a/dist2/testdata/testoutput15 b/testdata/testoutput15
similarity index 100%
rename from dist2/testdata/testoutput15
rename to testdata/testoutput15
diff --git a/dist2/testdata/testoutput16 b/testdata/testoutput16
similarity index 100%
rename from dist2/testdata/testoutput16
rename to testdata/testoutput16
diff --git a/dist2/testdata/testoutput17 b/testdata/testoutput17
similarity index 100%
rename from dist2/testdata/testoutput17
rename to testdata/testoutput17
diff --git a/dist2/testdata/testoutput18 b/testdata/testoutput18
similarity index 96%
rename from dist2/testdata/testoutput18
rename to testdata/testoutput18
index d6e3c71..3e81737 100644
--- a/dist2/testdata/testoutput18
+++ b/testdata/testoutput18
@@ -169,12 +169,6 @@
 ** Ignored with POSIX interface: offset
 Matched with REG_NOSUB
 
-/(?=(a\K))/
-    a
-Start of matched string is beyond its end - displaying from end to start.
- 0: a
- 1: a
-     
 /^d(e)$/posix
     acdef\=posix_startend=2:4
  0: de
diff --git a/dist2/testdata/testoutput19 b/testdata/testoutput19
similarity index 100%
rename from dist2/testdata/testoutput19
rename to testdata/testoutput19
diff --git a/dist2/testdata/testoutput2 b/testdata/testoutput2
similarity index 99%
rename from dist2/testdata/testoutput2
rename to testdata/testoutput2
index 6065ed7..7479a0e 100644
--- a/dist2/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -13355,7 +13355,7 @@
 /[a[:<:]] should give error/
 Failed: error 130 at offset 4: unknown POSIX class name
 
-/(?=ab\K)/aftertext
+/(?=ab\K)/aftertext,allow_lookaround_bsk
     abcd\=startchar
 Start of matched string is beyond its end - displaying from end to start.
  0: ab
@@ -13783,7 +13783,7 @@
  0L c
  1L 
 
-/x(?=ab\K)/
+/x(?=ab\K)/allow_lookaround_bsk
     xab\=get=0
 Start of matched string is beyond its end - displaying from end to start.
  0: ab
@@ -14281,7 +14281,7 @@
 
 # Perl loops on this (PCRE2 used to!)
 
-/(?<=\Ka)/g,aftertext
+/(?<=\Ka)/g,aftertext,allow_lookaround_bsk
     aaaaa
  0: a
  0+ aaaa
@@ -14294,7 +14294,7 @@
  0: a
  0+ 
 
-/(?<=\Ka)/altglobal,aftertext
+/(?<=\Ka)/altglobal,aftertext,allow_lookaround_bsk
     aaaaa
  0: a
  0+ aaaa
@@ -14911,11 +14911,11 @@
 First code unit = 'x'
 Subject length lower bound = 1
 
-/(?=a\K)/replace=z
+/(?=a\K)/replace=z,allow_lookaround_bsk
     BaCaD
 Failed: error -60: match with end before start or start moved backwards is not supported
     
-/(?<=\K.)/g,replace=-
+/(?<=\K.)/g,replace=-,allow_lookaround_bsk
     ab
 Failed: error -60: match with end before start or start moved backwards is not supported
 
@@ -17641,21 +17641,34 @@
 /(?(VERSION=0.0/
 Failed: error 179 at offset 14: syntax error or number too big in (?(VERSION condition
 
-# Perl has made \K in lookarounds an error. At the moment PCRE2 still accepts.
+# Perl has made \K in lookarounds an error. PCRE2 now rejects as well, unless
+# explicitly authorized.
 
 /(?=a\Kb)ab/
+Failed: error 199 at offset 10: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
+
+/(?=a\Kb)ab/allow_lookaround_bsk
     ab 
  0: b
 
 /(?!a\Kb)ac/
+Failed: error 199 at offset 10: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
+
+/(?!a\Kb)ac/allow_lookaround_bsk
     ac 
  0: ac
     
 /^abc(?<=b\Kc)d/
+Failed: error 199 at offset 14: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
+
+/^abc(?<=b\Kc)d/allow_lookaround_bsk
     abcd
  0: cd
 
 /^abc(?<!b\Kq)d/
+Failed: error 199 at offset 14: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK)
+
+/^abc(?<!b\Kq)d/,allow_lookaround_bsk
     abcd
  0: abcd
     
diff --git a/dist2/testdata/testoutput20 b/testdata/testoutput20
similarity index 100%
rename from dist2/testdata/testoutput20
rename to testdata/testoutput20
diff --git a/dist2/testdata/testoutput21 b/testdata/testoutput21
similarity index 100%
rename from dist2/testdata/testoutput21
rename to testdata/testoutput21
diff --git a/dist2/testdata/testoutput22-16 b/testdata/testoutput22-16
similarity index 100%
rename from dist2/testdata/testoutput22-16
rename to testdata/testoutput22-16
Binary files differ
diff --git a/dist2/testdata/testoutput22-32 b/testdata/testoutput22-32
similarity index 100%
rename from dist2/testdata/testoutput22-32
rename to testdata/testoutput22-32
Binary files differ
diff --git a/dist2/testdata/testoutput22-8 b/testdata/testoutput22-8
similarity index 100%
rename from dist2/testdata/testoutput22-8
rename to testdata/testoutput22-8
Binary files differ
diff --git a/dist2/testdata/testoutput23 b/testdata/testoutput23
similarity index 100%
rename from dist2/testdata/testoutput23
rename to testdata/testoutput23
diff --git a/dist2/testdata/testoutput24 b/testdata/testoutput24
similarity index 100%
rename from dist2/testdata/testoutput24
rename to testdata/testoutput24
diff --git a/dist2/testdata/testoutput25 b/testdata/testoutput25
similarity index 100%
rename from dist2/testdata/testoutput25
rename to testdata/testoutput25
diff --git a/dist2/testdata/testoutput3 b/testdata/testoutput3
similarity index 100%
rename from dist2/testdata/testoutput3
rename to testdata/testoutput3
diff --git a/dist2/testdata/testoutput3A b/testdata/testoutput3A
similarity index 100%
rename from dist2/testdata/testoutput3A
rename to testdata/testoutput3A
diff --git a/dist2/testdata/testoutput3B b/testdata/testoutput3B
similarity index 100%
rename from dist2/testdata/testoutput3B
rename to testdata/testoutput3B
diff --git a/dist2/testdata/testoutput4 b/testdata/testoutput4
similarity index 100%
rename from dist2/testdata/testoutput4
rename to testdata/testoutput4
diff --git a/dist2/testdata/testoutput5 b/testdata/testoutput5
similarity index 99%
rename from dist2/testdata/testoutput5
rename to testdata/testoutput5
index c2f8c3d..b1842df 100644
--- a/dist2/testdata/testoutput5
+++ b/testdata/testoutput5
Binary files differ
diff --git a/dist2/testdata/testoutput6 b/testdata/testoutput6
similarity index 100%
rename from dist2/testdata/testoutput6
rename to testdata/testoutput6
diff --git a/dist2/testdata/testoutput7 b/testdata/testoutput7
similarity index 100%
rename from dist2/testdata/testoutput7
rename to testdata/testoutput7
diff --git a/dist2/testdata/testoutput8-16-2 b/testdata/testoutput8-16-2
similarity index 100%
rename from dist2/testdata/testoutput8-16-2
rename to testdata/testoutput8-16-2
diff --git a/dist2/testdata/testoutput8-16-3 b/testdata/testoutput8-16-3
similarity index 100%
rename from dist2/testdata/testoutput8-16-3
rename to testdata/testoutput8-16-3
diff --git a/dist2/testdata/testoutput8-16-4 b/testdata/testoutput8-16-4
similarity index 100%
rename from dist2/testdata/testoutput8-16-4
rename to testdata/testoutput8-16-4
diff --git a/dist2/testdata/testoutput8-32-2 b/testdata/testoutput8-32-2
similarity index 100%
rename from dist2/testdata/testoutput8-32-2
rename to testdata/testoutput8-32-2
diff --git a/dist2/testdata/testoutput8-32-3 b/testdata/testoutput8-32-3
similarity index 100%
rename from dist2/testdata/testoutput8-32-3
rename to testdata/testoutput8-32-3
diff --git a/dist2/testdata/testoutput8-32-4 b/testdata/testoutput8-32-4
similarity index 100%
rename from dist2/testdata/testoutput8-32-4
rename to testdata/testoutput8-32-4
diff --git a/dist2/testdata/testoutput8-8-2 b/testdata/testoutput8-8-2
similarity index 100%
rename from dist2/testdata/testoutput8-8-2
rename to testdata/testoutput8-8-2
diff --git a/dist2/testdata/testoutput8-8-3 b/testdata/testoutput8-8-3
similarity index 100%
rename from dist2/testdata/testoutput8-8-3
rename to testdata/testoutput8-8-3
diff --git a/dist2/testdata/testoutput8-8-4 b/testdata/testoutput8-8-4
similarity index 100%
rename from dist2/testdata/testoutput8-8-4
rename to testdata/testoutput8-8-4
diff --git a/dist2/testdata/testoutput9 b/testdata/testoutput9
similarity index 100%
rename from dist2/testdata/testoutput9
rename to testdata/testoutput9
diff --git a/dist2/testdata/testoutputEBC b/testdata/testoutputEBC
similarity index 100%
rename from dist2/testdata/testoutputEBC
rename to testdata/testoutputEBC
diff --git a/dist2/testdata/valgrind-jit.supp b/testdata/valgrind-jit.supp
similarity index 100%
rename from dist2/testdata/valgrind-jit.supp
rename to testdata/valgrind-jit.supp
diff --git a/dist2/testdata/wintestinput3 b/testdata/wintestinput3
similarity index 100%
rename from dist2/testdata/wintestinput3
rename to testdata/wintestinput3
diff --git a/dist2/testdata/wintestoutput3 b/testdata/wintestoutput3
similarity index 100%
rename from dist2/testdata/wintestoutput3
rename to testdata/wintestoutput3