Full Code of PhilipHazel/pcre2 for AI

main 4f460e5edaa6 cached
496 files
14.2 MB
3.7M tokens
642 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (14,950K chars total). Download the full file to get everything.
Repository: PhilipHazel/pcre2
Branch: main
Commit: 4f460e5edaa6
Files: 496
Total size: 14.2 MB

Directory structure:
gitextract_ehge08ch/

├── .editorconfig
├── .gitattributes
├── .github/
│   ├── codecov.yml
│   ├── dependabot.yml
│   ├── scripts/
│   │   └── merge_sarif.py
│   └── workflows/
│       ├── build.yml
│       ├── cifuzz.yml
│       ├── clang-analyzer.yml
│       ├── codeql.yml
│       ├── dev.yml
│       ├── pages.yml
│       ├── scorecards.yml
│       └── sync.yml
├── .gitignore
├── .gitmodules
├── AUTHORS.md
├── BUILD.bazel
├── CMakeLists.txt
├── COPYING
├── ChangeLog
├── HACKING
├── INSTALL
├── LICENCE.md
├── MODULE.bazel
├── Makefile.am
├── NEWS
├── NON-AUTOTOOLS-BUILD
├── README
├── README.md
├── RunGrepTest
├── RunGrepTest.bat
├── RunTest
├── RunTest.bat
├── SECURITY.md
├── autogen.sh
├── build.zig
├── cmake/
│   ├── COPYING-CMAKE-SCRIPTS
│   ├── FindEditline.cmake
│   ├── FindReadline.cmake
│   ├── PCRE2CheckVscript.cmake
│   ├── PCRE2UseSystemExtensions.cmake
│   ├── PCRE2WarningAsError.cmake
│   └── pcre2-config.cmake.in
├── configure.ac
├── doc/
│   ├── html/
│   │   ├── NON-AUTOTOOLS-BUILD.txt
│   │   ├── README.txt
│   │   ├── index.html
│   │   ├── pcre2-config.html
│   │   ├── pcre2.html
│   │   ├── pcre2_callout_enumerate.html
│   │   ├── pcre2_code_copy.html
│   │   ├── pcre2_code_copy_with_tables.html
│   │   ├── pcre2_code_free.html
│   │   ├── pcre2_compile.html
│   │   ├── pcre2_compile_context_copy.html
│   │   ├── pcre2_compile_context_create.html
│   │   ├── pcre2_compile_context_free.html
│   │   ├── pcre2_config.html
│   │   ├── pcre2_convert_context_copy.html
│   │   ├── pcre2_convert_context_create.html
│   │   ├── pcre2_convert_context_free.html
│   │   ├── pcre2_converted_pattern_free.html
│   │   ├── pcre2_dfa_match.html
│   │   ├── pcre2_general_context_copy.html
│   │   ├── pcre2_general_context_create.html
│   │   ├── pcre2_general_context_free.html
│   │   ├── pcre2_get_error_message.html
│   │   ├── pcre2_get_mark.html
│   │   ├── pcre2_get_match_data_heapframes_size.html
│   │   ├── pcre2_get_match_data_size.html
│   │   ├── pcre2_get_ovector_count.html
│   │   ├── pcre2_get_ovector_pointer.html
│   │   ├── pcre2_get_startchar.html
│   │   ├── pcre2_jit_compile.html
│   │   ├── pcre2_jit_free_unused_memory.html
│   │   ├── pcre2_jit_match.html
│   │   ├── pcre2_jit_stack_assign.html
│   │   ├── pcre2_jit_stack_create.html
│   │   ├── pcre2_jit_stack_free.html
│   │   ├── pcre2_maketables.html
│   │   ├── pcre2_maketables_free.html
│   │   ├── pcre2_match.html
│   │   ├── pcre2_match_context_copy.html
│   │   ├── pcre2_match_context_create.html
│   │   ├── pcre2_match_context_free.html
│   │   ├── pcre2_match_data_create.html
│   │   ├── pcre2_match_data_create_from_pattern.html
│   │   ├── pcre2_match_data_free.html
│   │   ├── pcre2_next_match.html
│   │   ├── pcre2_pattern_convert.html
│   │   ├── pcre2_pattern_info.html
│   │   ├── pcre2_serialize_decode.html
│   │   ├── pcre2_serialize_encode.html
│   │   ├── pcre2_serialize_free.html
│   │   ├── pcre2_serialize_get_number_of_codes.html
│   │   ├── pcre2_set_bsr.html
│   │   ├── pcre2_set_callout.html
│   │   ├── pcre2_set_character_tables.html
│   │   ├── pcre2_set_compile_extra_options.html
│   │   ├── pcre2_set_compile_recursion_guard.html
│   │   ├── pcre2_set_depth_limit.html
│   │   ├── pcre2_set_glob_escape.html
│   │   ├── pcre2_set_glob_separator.html
│   │   ├── pcre2_set_heap_limit.html
│   │   ├── pcre2_set_match_limit.html
│   │   ├── pcre2_set_max_pattern_compiled_length.html
│   │   ├── pcre2_set_max_pattern_length.html
│   │   ├── pcre2_set_max_varlookbehind.html
│   │   ├── pcre2_set_newline.html
│   │   ├── pcre2_set_offset_limit.html
│   │   ├── pcre2_set_optimize.html
│   │   ├── pcre2_set_parens_nest_limit.html
│   │   ├── pcre2_set_recursion_limit.html
│   │   ├── pcre2_set_recursion_memory_management.html
│   │   ├── pcre2_set_substitute_callout.html
│   │   ├── pcre2_set_substitute_case_callout.html
│   │   ├── pcre2_substitute.html
│   │   ├── pcre2_substring_copy_byname.html
│   │   ├── pcre2_substring_copy_bynumber.html
│   │   ├── pcre2_substring_free.html
│   │   ├── pcre2_substring_get_byname.html
│   │   ├── pcre2_substring_get_bynumber.html
│   │   ├── pcre2_substring_length_byname.html
│   │   ├── pcre2_substring_length_bynumber.html
│   │   ├── pcre2_substring_list_free.html
│   │   ├── pcre2_substring_list_get.html
│   │   ├── pcre2_substring_nametable_scan.html
│   │   ├── pcre2_substring_number_from_name.html
│   │   ├── pcre2api.html
│   │   ├── pcre2build.html
│   │   ├── pcre2callout.html
│   │   ├── pcre2compat.html
│   │   ├── pcre2convert.html
│   │   ├── pcre2demo.html
│   │   ├── pcre2grep.html
│   │   ├── pcre2jit.html
│   │   ├── pcre2limits.html
│   │   ├── pcre2matching.html
│   │   ├── pcre2partial.html
│   │   ├── pcre2pattern.html
│   │   ├── pcre2perform.html
│   │   ├── pcre2posix.html
│   │   ├── pcre2sample.html
│   │   ├── pcre2serialize.html
│   │   ├── pcre2syntax.html
│   │   ├── pcre2test.html
│   │   └── pcre2unicode.html
│   ├── index.html.src
│   ├── pcre2-config.1
│   ├── pcre2-config.txt
│   ├── pcre2.3
│   ├── pcre2.txt
│   ├── pcre2_callout_enumerate.3
│   ├── pcre2_code_copy.3
│   ├── pcre2_code_copy_with_tables.3
│   ├── pcre2_code_free.3
│   ├── pcre2_compile.3
│   ├── pcre2_compile_context_copy.3
│   ├── pcre2_compile_context_create.3
│   ├── pcre2_compile_context_free.3
│   ├── pcre2_config.3
│   ├── pcre2_convert_context_copy.3
│   ├── pcre2_convert_context_create.3
│   ├── pcre2_convert_context_free.3
│   ├── pcre2_converted_pattern_free.3
│   ├── pcre2_dfa_match.3
│   ├── pcre2_general_context_copy.3
│   ├── pcre2_general_context_create.3
│   ├── pcre2_general_context_free.3
│   ├── pcre2_get_error_message.3
│   ├── pcre2_get_mark.3
│   ├── pcre2_get_match_data_heapframes_size.3
│   ├── pcre2_get_match_data_size.3
│   ├── pcre2_get_ovector_count.3
│   ├── pcre2_get_ovector_pointer.3
│   ├── pcre2_get_startchar.3
│   ├── pcre2_jit_compile.3
│   ├── pcre2_jit_free_unused_memory.3
│   ├── pcre2_jit_match.3
│   ├── pcre2_jit_stack_assign.3
│   ├── pcre2_jit_stack_create.3
│   ├── pcre2_jit_stack_free.3
│   ├── pcre2_maketables.3
│   ├── pcre2_maketables_free.3
│   ├── pcre2_match.3
│   ├── pcre2_match_context_copy.3
│   ├── pcre2_match_context_create.3
│   ├── pcre2_match_context_free.3
│   ├── pcre2_match_data_create.3
│   ├── pcre2_match_data_create_from_pattern.3
│   ├── pcre2_match_data_free.3
│   ├── pcre2_next_match.3
│   ├── pcre2_pattern_convert.3
│   ├── pcre2_pattern_info.3
│   ├── pcre2_serialize_decode.3
│   ├── pcre2_serialize_encode.3
│   ├── pcre2_serialize_free.3
│   ├── pcre2_serialize_get_number_of_codes.3
│   ├── pcre2_set_bsr.3
│   ├── pcre2_set_callout.3
│   ├── pcre2_set_character_tables.3
│   ├── pcre2_set_compile_extra_options.3
│   ├── pcre2_set_compile_recursion_guard.3
│   ├── pcre2_set_depth_limit.3
│   ├── pcre2_set_glob_escape.3
│   ├── pcre2_set_glob_separator.3
│   ├── pcre2_set_heap_limit.3
│   ├── pcre2_set_match_limit.3
│   ├── pcre2_set_max_pattern_compiled_length.3
│   ├── pcre2_set_max_pattern_length.3
│   ├── pcre2_set_max_varlookbehind.3
│   ├── pcre2_set_newline.3
│   ├── pcre2_set_offset_limit.3
│   ├── pcre2_set_optimize.3
│   ├── pcre2_set_parens_nest_limit.3
│   ├── pcre2_set_recursion_limit.3
│   ├── pcre2_set_recursion_memory_management.3
│   ├── pcre2_set_substitute_callout.3
│   ├── pcre2_set_substitute_case_callout.3
│   ├── pcre2_substitute.3
│   ├── pcre2_substring_copy_byname.3
│   ├── pcre2_substring_copy_bynumber.3
│   ├── pcre2_substring_free.3
│   ├── pcre2_substring_get_byname.3
│   ├── pcre2_substring_get_bynumber.3
│   ├── pcre2_substring_length_byname.3
│   ├── pcre2_substring_length_bynumber.3
│   ├── pcre2_substring_list_free.3
│   ├── pcre2_substring_list_get.3
│   ├── pcre2_substring_nametable_scan.3
│   ├── pcre2_substring_number_from_name.3
│   ├── pcre2api.3
│   ├── pcre2build.3
│   ├── pcre2callout.3
│   ├── pcre2compat.3
│   ├── pcre2convert.3
│   ├── pcre2demo.3
│   ├── pcre2grep.1
│   ├── pcre2grep.txt
│   ├── pcre2jit.3
│   ├── pcre2limits.3
│   ├── pcre2matching.3
│   ├── pcre2partial.3
│   ├── pcre2pattern.3
│   ├── pcre2perform.3
│   ├── pcre2posix.3
│   ├── pcre2sample.3
│   ├── pcre2serialize.3
│   ├── pcre2syntax.3
│   ├── pcre2test.1
│   ├── pcre2test.txt
│   └── pcre2unicode.3
├── libpcre2-16.pc.in
├── libpcre2-32.pc.in
├── libpcre2-8.pc.in
├── libpcre2-posix.pc.in
├── m4/
│   ├── ax_pthread.m4
│   ├── pcre2_check_vscript.m4
│   ├── pcre2_visibility.m4
│   └── pcre2_zos.m4
├── maint/
│   ├── .gitignore
│   ├── 132html
│   ├── CheckMan
│   ├── CheckTxt
│   ├── CleanTxt
│   ├── Detrail
│   ├── FetchUcd.sh
│   ├── FilterCoverage.py
│   ├── GenerateCommon.py
│   ├── GenerateTest.py
│   ├── GenerateUcd.py
│   ├── GenerateUcpHeader.py
│   ├── GenerateUcpTables.py
│   ├── LintMan
│   ├── ManyConfigTests
│   ├── README
│   ├── RunCoverage
│   ├── RunManifestTest
│   ├── RunManifestTest.ps1
│   ├── RunPerlTest
│   ├── RunSymbolTest
│   ├── RunSymbolTest.ps1
│   ├── Unicode.tables/
│   │   ├── BidiMirroring.txt
│   │   ├── CaseFolding.txt
│   │   ├── DerivedBidiClass.txt
│   │   ├── DerivedCoreProperties.txt
│   │   ├── DerivedGeneralCategory.txt
│   │   ├── GraphemeBreakProperty.txt
│   │   ├── PropList.txt
│   │   ├── PropertyAliases.txt
│   │   ├── PropertyValueAliases.txt
│   │   ├── ScriptExtensions.txt
│   │   ├── Scripts.txt
│   │   ├── UnicodeData.txt
│   │   └── emoji-data.txt
│   ├── UpdateAlways
│   ├── UpdateCommon.py
│   ├── UpdateDates.py
│   ├── UpdateRelease.py
│   ├── cmake-tests/
│   │   ├── build-interface/
│   │   │   ├── CMakeLists.txt
│   │   │   └── main.c
│   │   └── install-interface/
│   │       ├── CMakeLists.txt
│   │       └── main.c
│   ├── manifest-cmakeinstall-freebsd
│   ├── manifest-cmakeinstall-linux
│   ├── manifest-cmakeinstall-macos
│   ├── manifest-cmakeinstall-solaris
│   ├── manifest-cmakeinstall-windows
│   ├── manifest-makeinstall-freebsd
│   ├── manifest-makeinstall-linux
│   ├── manifest-makeinstall-solaris
│   ├── manifest-tarball
│   ├── pcre2_chartables.c.non-standard
│   ├── ucptest.c
│   └── ucptestdata/
│       ├── testinput1
│       ├── testinput2
│       ├── testoutput1
│       └── testoutput2
├── pcre2-config.in
├── perltest.sh
├── src/
│   ├── config-cmake.h.in
│   ├── config.h.generic
│   ├── libpcre2-16.sym.in
│   ├── libpcre2-32.sym.in
│   ├── libpcre2-8.sym.in
│   ├── libpcre2-posix.sym.in
│   ├── pcre2.h.generic
│   ├── pcre2.h.in
│   ├── pcre2_auto_possess.c
│   ├── pcre2_chartables.c.dist
│   ├── pcre2_chartables.c.ebcdic-1047-nl15
│   ├── pcre2_chartables.c.ebcdic-1047-nl25
│   ├── pcre2_chkdint.c
│   ├── pcre2_compile.c
│   ├── pcre2_compile.h
│   ├── pcre2_compile_cgroup.c
│   ├── pcre2_compile_class.c
│   ├── pcre2_config.c
│   ├── pcre2_context.c
│   ├── pcre2_convert.c
│   ├── pcre2_dfa_match.c
│   ├── pcre2_dftables.c
│   ├── pcre2_error.c
│   ├── pcre2_extuni.c
│   ├── pcre2_find_bracket.c
│   ├── pcre2_fuzzsupport.c
│   ├── pcre2_internal.h
│   ├── pcre2_intmodedep.h
│   ├── pcre2_jit_char_inc.h
│   ├── pcre2_jit_compile.c
│   ├── pcre2_jit_match_inc.h
│   ├── pcre2_jit_misc_inc.h
│   ├── pcre2_jit_simd_inc.h
│   ├── pcre2_jit_test.c
│   ├── pcre2_maketables.c
│   ├── pcre2_match.c
│   ├── pcre2_match_data.c
│   ├── pcre2_match_next.c
│   ├── pcre2_newline.c
│   ├── pcre2_ord2utf.c
│   ├── pcre2_pattern_info.c
│   ├── pcre2_printint_inc.h
│   ├── pcre2_script_run.c
│   ├── pcre2_serialize.c
│   ├── pcre2_string_utils.c
│   ├── pcre2_study.c
│   ├── pcre2_substitute.c
│   ├── pcre2_substring.c
│   ├── pcre2_tables.c
│   ├── pcre2_ucd.c
│   ├── pcre2_ucp.h
│   ├── pcre2_ucptables_inc.h
│   ├── pcre2_util.h
│   ├── pcre2_valid_utf.c
│   ├── pcre2_xclass.c
│   ├── pcre2demo.c
│   ├── pcre2grep.c
│   ├── pcre2posix.c
│   ├── pcre2posix.h
│   ├── pcre2posix_test.c
│   ├── pcre2test.c
│   └── pcre2test_inc.h
├── testdata/
│   ├── fuzzing/
│   │   ├── pcre2_fuzzer.dict
│   │   ├── pcre2_fuzzer.options
│   │   ├── pcre2_fuzzer_16.dict
│   │   ├── pcre2_fuzzer_16.options
│   │   ├── pcre2_fuzzer_32.dict
│   │   └── pcre2_fuzzer_32.options
│   ├── grepbinary
│   ├── grepfilelist
│   ├── grepinput
│   ├── grepinput3
│   ├── grepinput8
│   ├── grepinputBad8
│   ├── grepinputBad8_Trail
│   ├── grepinputC.bz2
│   ├── grepinputM
│   ├── grepinputUN
│   ├── grepinputv
│   ├── grepinputx
│   ├── greplist
│   ├── greplistBad
│   ├── grepnot.bz2
│   ├── grepoutput
│   ├── grepoutput8
│   ├── grepoutputC
│   ├── grepoutputCN
│   ├── grepoutputCNU
│   ├── grepoutputCU
│   ├── grepoutputCbz2
│   ├── grepoutputCgz
│   ├── grepoutputN
│   ├── grepoutputUN
│   ├── greppatN4
│   ├── testinput1
│   ├── testinput10
│   ├── testinput11
│   ├── testinput12
│   ├── testinput13
│   ├── testinput14
│   ├── testinput15
│   ├── testinput16
│   ├── testinput17
│   ├── testinput18
│   ├── testinput19
│   ├── testinput2
│   ├── testinput20
│   ├── testinput21
│   ├── testinput22
│   ├── testinput23
│   ├── testinput24
│   ├── testinput25
│   ├── testinput26
│   ├── testinput27
│   ├── testinput28
│   ├── testinput29
│   ├── testinput3
│   ├── testinput4
│   ├── testinput5
│   ├── testinput6
│   ├── testinput7
│   ├── testinput8
│   ├── testinput9
│   ├── testinputheap
│   ├── testoutput1
│   ├── testoutput10
│   ├── testoutput11-16
│   ├── testoutput11-32
│   ├── testoutput12-16
│   ├── testoutput12-32
│   ├── testoutput13
│   ├── testoutput14-16
│   ├── testoutput14-32
│   ├── testoutput14-8
│   ├── testoutput15
│   ├── testoutput17
│   ├── testoutput18
│   ├── testoutput19
│   ├── testoutput2
│   ├── testoutput20
│   ├── testoutput21
│   ├── testoutput22-16
│   ├── testoutput22-32
│   ├── testoutput22-8
│   ├── testoutput23
│   ├── testoutput24
│   ├── testoutput25
│   ├── testoutput26
│   ├── testoutput27
│   ├── testoutput28
│   ├── testoutput29
│   ├── testoutput3
│   ├── testoutput3A
│   ├── testoutput3B
│   ├── testoutput3C
│   ├── testoutput4
│   ├── testoutput5
│   ├── testoutput6
│   ├── testoutput7
│   ├── testoutput8-16-2
│   ├── testoutput8-16-4
│   ├── testoutput8-32-4
│   ├── testoutput8-8-2
│   ├── testoutput8-8-3
│   ├── testoutput8-8-4
│   ├── testoutput9
│   ├── testoutputheap-16
│   ├── testoutputheap-32
│   ├── testoutputheap-8
│   ├── valgrind-jit.supp
│   ├── wintestinput3
│   └── wintestoutput3
└── vms/
    ├── configure.com
    ├── openvms_readme.txt
    ├── pcre2.h_patch
    └── stdint.h

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# EditorConfig helps ensure that files are opened in editors with the correct
# settings, regardless of the editor or platform. See http://editorconfig.org.

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf

[Makefile.am]
indent_style = tab

[*.bat]
end_of_line = crlf

[testdata/*]
insert_final_newline = false
trim_trailing_whitespace = false

[testdata/test{input,output}{1,2,3,3A,3B,3C,6,28,29}]
charset = latin1


================================================
FILE: .gitattributes
================================================
testdata/*        -text
maint/manifest-*  -text
maint/ucptestdata -text
*.sh              text eol=lf
pcre2-config.in   text eol=lf
RunTest           text eol=lf
RunGrepTest       text eol=lf


================================================
FILE: .github/codecov.yml
================================================
codecov:
  strict_yaml_branch: default
  require_ci_to_pass: false
  notify:
    wait_for_ci: false
    notify_error: true

coverage:
  range: 75..90
  round: nearest
  precision: 2

  status:
    project: false

    patch:
      default:
        target: 0%

github_checks:
  annotations: false

comment: false
  # layout: "condensed_header, condensed_files, condensed_footer"
  # hide_project_coverage: true
  # require_head: true
  # require_base: true
  # require_changes: "coverage_drop OR uncovered_patch"

component_management:
  individual_components:
    - component_id: library
      name: "Core library"
      paths:
        - '!src/((pcre2test|pcre2grep|pcre2_jit_test|pcre2posix_test|pcre2_printint)\.c|pcre2test_inc\.h)'
      statuses:
        - type: project
          target: auto
          threshold: 0.5%

    - component_id: test_binaries
      name: "Test binaries"
      paths:
        - 'src/((pcre2test|pcre2grep|pcre2_jit_test|pcre2posix_test|pcre2_printint)\.c|pcre2test_inc\.h)'
      statuses:
        - type: project
          target: auto
          threshold: 2%


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
  - package-ecosystem: github-actions
    directory: /
    schedule:
      interval: monthly
    groups:
      minor-and-patch:
        update-types:
          - "minor"
          - "patch"


================================================
FILE: .github/scripts/merge_sarif.py
================================================
#! /usr/bin/env python3

# The purpose of this file is to adapt the output from
# Clang's static analyzer into a format suitable for GitHub
# Actions. The problem is that Clang outputs a separate "run"
# per file in its SARIF output, but GitHub requires a single
# run per tool (Clang is wrong here).

import sys
import json

if len(sys.argv) < 2:
    print("Usage: munge-sarif.py INPUT", file=sys.stderr)
    sys.exit(1)

data = None
with open(sys.argv[1], 'rb') as f:
    data = json.load(f)

# Arbitrarily pick the first run as the one from which to copy all the properties
base_run = data['runs'][0]

# We don't need these, GitHub ignores them
base_run['artifacts'] = []

# Concatenate results
for r in data['runs'][1:]:
    base_run['results'].extend(r['results'])

data['runs'] = [base_run]

def fix_region(region):
  startLine = region.get('startLine', None)
  startColumn = region.get('startColumn', 1)
  endLine = region.get('endLine', None)
  endColumn = region.get('endColumn', None)
  if startLine is None:
    raise ValueError("Region must have startLine")
  if endLine is not None and endLine < startLine:
    region['endLine'] = startLine
    del region['endColumn']
    endLine = startLine
    endColumn = None
  if endColumn is not None and (endLine == startLine or endLine is None) and endColumn < startColumn:
    region['endColumn'] = startColumn
    endColumn = startColumn

# Recursively scan the data dictionary, and apply the fix_region() function
# to all "region":Region key-value pairs.
def fix_regions(data):
    if isinstance(data, dict):
        if 'region' in data:
            fix_region(data['region'])
        for key, value in data.items():
            fix_regions(value)
    elif isinstance(data, list):
        for item in data:
            fix_regions(item)

fix_regions(data)

with open(sys.argv[1], 'w') as f:
    json.dump(data, f, indent=2)

================================================
FILE: .github/workflows/build.yml
================================================
name: Build
on:
  workflow_dispatch:
    inputs:
      job_id:
        type: choice
        description: Specific job to run
        default: all
        required: true
        options:
        - all
        - linux
        - alpine
        - macos
        - windows
        - freebsd
        - openbsd
        - solaris
        - zos
        - distcheck
        - coverage
  push:
    branches: [ main, "release/**" ]
  pull_request:
    branches: [ main ]

permissions:
  contents: read

env:
  CFLAGS_GCC_STYLE: '-Wall -Wextra -pedantic -Wdeclaration-after-statement -Wshadow -Wno-overlength-strings -Wimplicit-fallthrough'
  CFLAGS_MSVC: '/W3'
  CFLAGS_SOLARIS_CC: '-errtags=yes -erroff=E_STATEMENT_NOT_REACHED'
  CMAKE_FLAGS: '-Wdev -Werror=dev -Wdeprecated -Werror=deprecated --warn-uninitialized'

jobs:
  linux:
    name: Linux
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'linux')
    steps:
      - name: Setup
        run: |
          sudo apt-get -qq update
          sudo apt-get -qq install zlib1g-dev libbz2-dev

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Configure
        run: ./configure CFLAGS="$CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-Werror

      - name: Build
        run: make -j3

      - name: Test (main test script)
        run: ./RunTest

      - name: Test (JIT test program)
        run: ./pcre2_jit_test

      - name: Test (pcre2grep test script)
        run: ./RunGrepTest

      - name: Test (pcre2posix program)
        run: ./pcre2posix_test -v

      - name: Install
        run: |
          make install "DESTDIR=`pwd`/install-dir"
          maint/RunManifestTest install-dir maint/manifest-makeinstall-linux
          maint/RunSymbolTest install-dir/usr/local/lib/ maint/

  alpine:
    name: alpine
    runs-on: ubuntu-latest
    container: alpine
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'alpine')
    steps:
      - name: Setup
        run: apk add --no-cache automake autoconf gcc libtool make musl-dev git zlib zlib-dev bzip2 bzip2-dev

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Configure
        run: ./configure CFLAGS="$CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-Werror

      - name: Build
        run: make -j3

      - name: Test (main test script)
        run: ./RunTest

      - name: Test (JIT test program)
        run: ./pcre2_jit_test

      - name: Test (pcre2grep test script)
        run: ./RunGrepTest

      - name: Test (pcre2posix program)
        run: ./pcre2posix_test -v

      - name: Install
        run: |
          make install "DESTDIR=`pwd`/install-dir"
          maint/RunManifestTest install-dir maint/manifest-makeinstall-linux
          maint/RunSymbolTest install-dir/usr/local/lib/ maint/

  macos:
    name: macOS universal
    runs-on: macos-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'macos')
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        run: cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_SUPPORT_LIBZ=ON -DPCRE2_SUPPORT_LIBBZ2=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build

      - name: Build
        run: cd build && make -j3

      - name: Test
        run: cd build && ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

      - name: Install
        run: |
          cd build
          cmake --install . --prefix install-dir
          ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-macos
          ../maint/RunSymbolTest install-dir/lib/ ../maint/

      - name: Test CMake install interface
        run: |
          INSTALL_PREFIX=`pwd`/build/install-dir
          cd maint/cmake-tests/install-interface

          for useStaticLibs in ON OFF; do
            echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
            rm -rf build
            cmake $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build
            (cd build; make)
            ./build/test_executable
            otool -L ./build/test_executable
            if [ $useStaticLibs = ON ]; then
              (otool -L ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in otool output" && exit 1)
            else
              # Test that the shared library is actually linked in
              (otool -L ./build/test_executable | grep -q "@rpath/libpcre2-8.0.dylib") || (echo "Error: Shared library not linked in" && exit 1)
            fi
          done

      - name: Test CMake build interface
        run: |
          BUILD_DIR=`pwd`
          cp -rp maint/cmake-tests/build-interface ../cmake-tests-build-interface
          cd ../cmake-tests-build-interface
          ln -s "$BUILD_DIR" pcre2

          for buildLibs in "ON;OFF" "OFF;ON"; do
            static=`echo $buildLibs | cut -d';' -f1`
            shared=`echo $buildLibs | cut -d';' -f2`
            echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$static and BUILD_SHARED_LIBS=$shared =="
            rm -rf build
            cmake $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC_LIBS=$static -DBUILD_SHARED_LIBS=$shared -B build
            (cd build; make)
            ./build/test_executable
            otool -L ./build/test_executable
            if [ $static = ON ]; then
              (otool -L ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in ldd output" && exit 1)
            else
              # Test that the shared library is actually linked in
              (otool -L ./build/test_executable | grep -q "@rpath/libpcre2-8.0.dylib") || (echo "Error: Shared library not linked in" && exit 1)
            fi
          done

  windows:
    name: Windows
    runs-on: windows-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'windows')
    strategy:
      fail-fast: false
      matrix:
        arch: ["Win32", "x64"]
    steps:
      - name: Setup
        run: |
          # GitHub Actions Windows images ship with Git for Windows, which is great,
          # but it also pollutes the PATH with a lot of Unix tools which we don't
          # want to require as build dependencies. This filters out the Unix tools.
          # The GitHub images still include an absolute ton of junk in the PATH,
          # but it seems to be rare for unintended dependencies to be added to our
          # build scripts, so we can live with it for now.
          $PATCHED_PATH = ($env:PATH -split ';' | Where-Object { $_ -notmatch 'C:\\Program Files\\Git\\usr\\bin|C:\\Program Files\\Git\\mingw64\\bin' }) -join ';'
          # We can't seem to use $GITHUB_PATH here because that only allows
          # appending to the PATH, not replacing it.
          echo "PATH=$PATCHED_PATH" >> "$env:GITHUB_ENV"

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        run: |
          echo "PATH=$env:PATH"
          cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DCMAKE_C_FLAGS="$CFLAGS_MSVC" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build -A ${{ matrix.arch }}

      - name: Build
        run: cmake --build build --config Release

      - name: Test
        run: cd build && ctest -C Release -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

      - name: Install
        run: |
          cd build
          cmake --install . --config Release --prefix install-dir
          ../maint/RunManifestTest.ps1 install-dir ../maint/manifest-cmakeinstall-windows
          ../maint/RunSymbolTest.ps1 install-dir/bin ../maint/

      - name: Test CMake install interface
        run: |
          $INSTALL_PREFIX = (pwd).Path + "\build\install-dir"
          cd maint/cmake-tests/install-interface

          $vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
          $dumpbin = & $vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe | Select-Object -First 1

          foreach ($useStaticLibs in @("ON", "OFF")) {
            echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
            if (Test-Path build) { rm -Recurse -Force build }
            cmake $CMAKE_FLAGS "-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX" "-DPCRE2_USE_STATIC_LIBS=$useStaticLibs" -B build -A ${{ matrix.arch }}
            cmake --build build --config Release
            ./build/Release/test_executable.exe
            & $dumpbin /dependents ./build/Release/test_executable.exe
            if ($useStaticLibs -eq "ON") {
                if ((& $dumpbin /dependents ./build/Release/test_executable.exe | Out-String).Contains("pcre2")) {
                  Write-Error "Error: PCRE2 found in dumpbin output"
                  exit 1
                }
            } else {
              # Test that the shared library is actually linked in
              if (-not ((& $dumpbin /dependents ./build/Release/test_executable.exe | Out-String).Contains("pcre2-8.dll"))) {
                Write-Error "Error: Shared library not linked in"
                exit 1
              }
            }
          }

      - name: Test CMake build interface
        run: |
          $BUILD_DIR = (pwd).Path
          cp -Recurse -Path maint/cmake-tests/build-interface ../cmake-tests-build-interface
          cd ../cmake-tests-build-interface
          New-Item -ItemType SymbolicLink -Path "pcre2" -Target "$BUILD_DIR"

          $vswhere = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
          $dumpbin = & $vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -find VC\Tools\MSVC\*\bin\Hostx64\x64\dumpbin.exe | Select-Object -First 1

          foreach ($buildLibs in @(@{static="ON"; shared="OFF"}, @{static="OFF"; shared="ON"})) {
            echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$($buildLibs.static) =="
            if (Test-Path build) { rm -Recurse -Force build }
            cmake $CMAKE_FLAGS "-DBUILD_STATIC_LIBS=$($buildLibs.static)" "-DBUILD_SHARED_LIBS=$($buildLibs.shared)" -B build -A ${{ matrix.arch }}
            cmake --build build --config Debug
            ./build/Debug/test_executable.exe
            & $dumpbin /dependents ./build/Debug/test_executable.exe
            if ($buildLibs.static -eq "ON") {
                if ((& $dumpbin /dependents ./build/Debug/test_executable.exe | Out-String).Contains("pcre2")) {
                  Write-Error "Error: PCRE2 found in dumpbin output"
                  exit 1
                }
            } else {
              # Test that the shared library is actually linked in
              if (-not ((& $dumpbin /dependents ./build/Debug/test_executable.exe | Out-String).Contains("pcre2-8d.dll"))) {
                Write-Error "Error: Shared library not linked in"
                exit 1
              }
            }
          }

  freebsd:
    name: FreeBSD
    runs-on: ubuntu-latest
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'freebsd')) ||
      github.event_name == 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Build & test
        uses: vmactions/freebsd-vm@d1e65811565151536c0c894fff74f06351ed26e6 # v1.4.5
        with:
          envs: 'CFLAGS_GCC_STYLE CMAKE_FLAGS'
          usesh: true
          prepare: |
            set -e
            pkg install -y cmake

          run: |
            set -e

            cp -rp . ../build-autoconf
            cp -rp . ../build-cmake

            echo "== Autoconf =="
            cd ../build-autoconf

            ./configure CFLAGS="$CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-Werror
            make -j3
            (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

            make install "DESTDIR=`pwd`/install-dir"
            maint/RunManifestTest install-dir maint/manifest-makeinstall-freebsd
            maint/RunSymbolTest install-dir/usr/local/lib/ maint/

            echo "== CMake =="
            cd ../build-cmake

            cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build
            cd build
            make -j3
            ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)
            cmake --install . --prefix install-dir
            ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-freebsd
            ../maint/RunSymbolTest install-dir/lib/ ../maint/

  openbsd:
    name: OpenBSD
    runs-on: ubuntu-latest
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'openbsd')) ||
      github.event_name == 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Build & test
        uses: vmactions/openbsd-vm@d7d892b7b9ba97ed2747b0fc201be65037d64c3e # v1.4.0
        with:
          envs: 'CFLAGS_GCC_STYLE CMAKE_FLAGS'
          usesh: true
          prepare: |
            set -e
            pkg_add cmake

          run: |
            set -e

            export MALLOC_OPTIONS="USRJGFC>>"
            EXTRA_CFLAGS="-DSLJIT_WX_EXECUTABLE_ALLOCATOR"

            cp -rp . ../build-autoconf
            cp -rp . ../build-cmake

            echo "== Autoconf =="
            cd ../build-autoconf

            ./configure CFLAGS="$CFLAGS_GCC_STYLE $EXTRA_CFLAGS" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-Werror
            make -j3
            (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

            make install "DESTDIR=`pwd`/install-dir"
            # I don't really know enough about OpenBSD to say whether the unusually-numbered .so files
            # with no symlinks are correct or not.
            # maint/RunManifestTest install-dir maint/manifest-makeinstall-openbsd
            # maint/RunSymbolTest install-dir/usr/local/lib/ maint/

            echo "== CMake =="
            cd ../build-cmake

            cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE $EXTRA_CFLAGS" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build
            cd build
            make -j3
            ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)
            cmake --install . --prefix install-dir
            # ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-openbsd
            # ../maint/RunSymbolTest install-dir/lib/ ../maint/

  solaris:
    name: Solaris
    runs-on: ubuntu-latest
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'solaris')) ||
      github.event_name == 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Transfer Oracle Studio certificates
        env:
          PKG_ORACLE_COM_CERTIFICATE_PEM: ${{ secrets.PKG_ORACLE_COM_CERTIFICATE_PEM }}
          PKG_ORACLE_COM_KEY_PEM: ${{ secrets.PKG_ORACLE_COM_KEY_PEM }}
        run: |
          printenv PKG_ORACLE_COM_CERTIFICATE_PEM > pkg.oracle.com.certificate.pem
          printenv PKG_ORACLE_COM_KEY_PEM > pkg.oracle.com.key.pem

      - name: Prepare
        run: ./autogen.sh

      - name: Build & test
        uses: vmactions/solaris-vm@c20562b2c69737b06be9e828915761703e487373 # v1.3.3
        with:
          envs: 'CFLAGS_SOLARIS_CC CMAKE_FLAGS'
          usesh: true
          # Seriously! Solaris is the only OS to actually ship without a C
          # compiler, and not even to provide a simple download to get one!
          # You have to actually register with Oracle to get an X.509
          # certificate before you can even download their compiler. Whatever.
          prepare: |
            set -e
            cp "$GITHUB_WORKSPACE/pkg.oracle.com.key.pem" /root/pkg.oracle.com.key.pem
            cp "$GITHUB_WORKSPACE/pkg.oracle.com.certificate.pem" /root/pkg.oracle.com.certificate.pem
            sudo pkg set-publisher \
              -k /root/pkg.oracle.com.key.pem \
              -c /root/pkg.oracle.com.certificate.pem \
              -G "*" -g https://pkg.oracle.com/solarisstudio/release solarisstudio
            pkg install developer/build/make developer/build/cmake system/header
            pkg install --accept developerstudio-126/cc

          run: |
            set -e
            PATH=/opt/developerstudio12.6/bin:"$PATH"
            export PATH

            cp -rp . ../build-autoconf-32
            cp -rp . ../build-autoconf-64
            cp -rp . ../build-cmake-64

            echo "== Autoconf, 32-bit =="
            cd ../build-autoconf-32

            ./configure CC="cc -m32" CFLAGS="$CFLAGS_SOLARIS_CC" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-errwarn
            make
            (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

            make install "DESTDIR=`pwd`/install-dir"
            maint/RunManifestTest install-dir maint/manifest-makeinstall-solaris
            maint/RunSymbolTest install-dir/usr/local/lib/ maint/

            echo "== Autoconf, 64-bit =="
            cd ../build-autoconf-64

            ./configure CC="cc -m64" CFLAGS="$CFLAGS_SOLARIS_CC" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-errwarn
            make
            (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

            make install "DESTDIR=`pwd`/install-dir"
            maint/RunManifestTest install-dir maint/manifest-makeinstall-solaris
            maint/RunSymbolTest install-dir/usr/local/lib/ maint/

            echo "== CMake, 64-bit =="
            cd ../build-cmake-64

            CC="cc -m64" cmake $CMAKE_FLAGS -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_SOLARIS_CC" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build
            cd build
            make
            ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)
            cmake --install . --prefix install-dir
            ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-solaris
            ../maint/RunSymbolTest install-dir/lib/ ../maint/

  zos:
    name: z/OS
    runs-on: ubuntu-latest
    # No longer running on push events, due to flaky z/OS runner
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'zos'))
    concurrency:
      group: zos-ssh-build
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Build & test
        env:
          ZOS_HOST: ${{ secrets.ZOS_HOST }}
          ZOS_PORT: ${{ secrets.ZOS_PORT }}
          ZOS_PRIVATE_KEY: ${{ secrets.ZOS_PRIVATE_KEY }}
          ZOS_KNOWN_HOSTS: ${{ secrets.ZOS_KNOWN_HOSTS }}
        run: |
          (umask 0077 && printenv ZOS_PRIVATE_KEY > id_rsa_zos)
          mkdir -p ~/.ssh
          printenv ZOS_KNOWN_HOSTS > ~/.ssh/known_hosts

          tar czf ../pcre2-build.tar.gz --exclude=.git .
          mv ../pcre2-build.tar.gz .

          scp -i id_rsa_zos -P "$ZOS_PORT" pcre2-build.tar.gz "$ZOS_HOST:/data/"
          ssh -i id_rsa_zos -p "$ZOS_PORT" "$ZOS_HOST" /data/zopen/usr/local/bin/bash -c \
            'export _BPXK_AUTOCVT=ON;
            export _CEE_RUNOPTS="FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)";
            export _TAG_REDIR_ERR=txt;
            export _TAG_REDIR_IN=txt;
            export _TAG_REDIR_OUT=txt;
            export PATH="/data/zopen/usr/local/bin:/data/zopen/usr/bin:/data/zopen/bin:/data/zopen/boot:/bin:/usr/lpp/IBM/cnw/v2r1/openxl/bin";
            . /data/zopen/etc/zopen-config;
            set -e;
            set -x;
            cd /data;

            echo "== Autoconf, XLC compiler ==";
            rm -rf pcre2-build;
            mkdir pcre2-build;
            gtar xzf pcre2-build.tar.gz -C pcre2-build;
            cd pcre2-build;
            chtag -R -tc ISO8859-1 .;
            MAKE=gmake CC=xlc ./configure --enable-ebcdic --disable-unicode;
            gmake;
            (gmake check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc);

            echo "== CMake, IBM-Clang -m64 compiler ==";
            cd ..;
            rm -rf pcre2-build;
            mkdir pcre2-build;
            gtar xzf pcre2-build.tar.gz -C pcre2-build;
            cd pcre2-build;
            chtag -R -tc ISO8859-1 .;
            cmake $CMAKE_FLAGS -G Ninja -DPCRE2_EBCDIC=ON -DPCRE2_SUPPORT_UNICODE=OFF -DCMAKE_C_COMPILER=ibm-clang -DCMAKE_C_FLAGS="-m64 $CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build
            cd build;
            ninja;
            ctest -j3 --output-on-failure; && (cat ./Testing/Temporary/LastTest.log || true)
            '

  distcheck:
    name: Build & verify distribution
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'distcheck')
    permissions:
      id-token: write # Needed to make calls to the Sigstore service
      attestations: write # Needed to write the attestation to GitHub's database
      artifact-metadata: write # As detailed in the action documentation
      contents: read
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: |
          ./autogen.sh

          # Workaround for incorrect filesystem permissions on /usr/share/aclocal, which
          # causes the m4 macros to be copied with incorrect permissions.
          # https://github.com/actions/runner-images/issues/11212
          chmod u=rw,go=r m4/*.m4

      - name: Configure
        run: ./configure

      - name: Distcheck
        run: make distcheck -j3

      - name: Manifest
        run: |
          mkdir tarball-dir
          tar -C tarball-dir -xzf pcre2-*.tar.gz
          # Budge the directory, so we don't bake the version number into the
          # `manifest-tarball` file:
          mv tarball-dir/pcre2-* tarball-dir/pcre2-SNAPSHOT
          maint/RunManifestTest tarball-dir maint/manifest-tarball

      - name: Upload to GitHub artifacts
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: "Distribution release"
          path: |
            pcre2-*.tar.bz2
            pcre2-*.tar.gz
            pcre2-*.zip
          if-no-files-found: error

      - name: Attest
        uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
        if: |
          github.event_name != 'pull_request' &&
          (startsWith(github.ref, 'refs/heads/release/') ||
           startsWith(github.ref, 'refs/tags/pcre2-'))
        with:
          subject-path: 'pcre2-*.tar.bz2, pcre2-*.tar.gz, pcre2-*.zip'

  coverage:
    name: Code coverage
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'coverage')
    steps:
      - name: Setup
        run: |
          sudo apt-get -qq update
          sudo apt-get -qq install zlib1g-dev libbz2-dev libedit-dev lcov

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        # We use DEBUG=OFF here in order to suppress the coverage misses due to
        # assertions, which obviously always pass.
        run: CC="clang -fprofile-instr-generate -fcoverage-mapping" cmake $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug -DPCRE2_DEBUG=OFF -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_SUPPORT_LIBZ=ON -DPCRE2_SUPPORT_LIBBZ2=ON -DPCRE2_SUPPORT_LIBEDIT=ON -DPCRE2_SUPPORT_LIBREADLINE=OFF -B build

      - name: Build
        run: cd build && make -j3

      - name: Test
        run: |
          cd build
          ../maint/RunCoverage

      - name: Upload report to GitHub artifacts
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: "Coverage report"
          path: './build/coverage-html'
          if-no-files-found: error

      - name: Upload report to Codecov
        uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true
          disable_search: true
          files: ./build/coverage-lcov.info


================================================
FILE: .github/workflows/cifuzz.yml
================================================
name: CIFuzz
on:
  workflow_dispatch:
  pull_request:
    branches: [ main ]

permissions:
  contents: read

jobs:
  Fuzzing:
    runs-on: ubuntu-latest
    steps:
    - name: Build Fuzzers
      id: build
      uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@3d38acd485bc848e33396e7523b9a4f2aff9027e # master
      with:
        oss-fuzz-project-name: 'pcre2'
        dry-run: false
    - name: Run Fuzzers
      uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@3d38acd485bc848e33396e7523b9a4f2aff9027e # master
      with:
        oss-fuzz-project-name: 'pcre2'
        fuzz-seconds: 300
        dry-run: false
    - name: Upload Crash
      uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
      if: failure() && steps.build.outcome == 'success'
      with:
        name: artifacts
        path: ./out/artifacts


================================================
FILE: .github/workflows/clang-analyzer.yml
================================================
name: Clang Static Analyzer
on:
  workflow_dispatch:
  push:
    branches: [ main, "release/**" ]
  pull_request:
    branches: [ main ]

permissions:
  contents: read

jobs:
  Analyze:
    runs-on: ubuntu-latest

    permissions:
      # Needed to upload the results to code-scanning dashboard.
      security-events: write
      contents: read

    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | sudo debconf-communicate && sudo dpkg-reconfigure man-db
          sudo apt-get -qq update
          sudo apt-get -qq install -y ninja-build clang-tools

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure & Build
        run: |
          LLVM_VER=`clang --version | head -n1 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | cut -d. -f1`
          echo "Using LLVM version $LLVM_VER"

          mkdir build
          cd build

          scan-build-py-$LLVM_VER cmake -G Ninja -DPCRE2_SUPPORT_JIT=ON -DCMAKE_BUILD_TYPE=Debug ..
          scan-build-py-$LLVM_VER -o clang-sarif-root/ --sarif-html ninja
          rm clang-sarif-root/*/result-*.sarif
          mv clang-sarif-root/* ../clang-report

          ../.github/scripts/merge_sarif.py ../clang-report/results-merged.sarif

      # Upload the browsable HTML report as an artifact.
      - name: Upload report
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: "Clang Static Analyzer report"
          path: './clang-report'

      # Upload the results to GitHub's code scanning dashboard.
      - name: "Upload to code-scanning"
        uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v3.29.5
        with:
          sarif_file: ./clang-report/results-merged.sarif
          category: clang-analyzer


================================================
FILE: .github/workflows/codeql.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
  push:
    branches: [ main, "release/**" ]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [ main ]
  schedule:
    - cron: '27 6 * * 4'

permissions:
  contents: read

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest

    permissions:
      # Needed to upload the results to code-scanning dashboard.
      security-events: write
      actions: read
      contents: read

    strategy:
      fail-fast: false
      matrix:
        language: [ 'cpp' ]
        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
        # Learn more about CodeQL language support at https://git.io/codeql-language-support

    steps:
    - name: Checkout repository
      uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      with:
        submodules: true

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v3.29.5
      with:
        languages: ${{ matrix.language }}
        # If you wish to specify custom queries, you can do so here or in a config file.
        # By default, queries listed here will override any specified in a config file.
        # Prefix the list here with "+" to use these queries and those in the config file.
        # queries: ./path/to/local/query, your-org/your-repo/queries@main

    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
    # If this step fails, then you should remove it and run the build manually (see below)
    - name: Autobuild
      uses: github/codeql-action/autobuild@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v3.29.5

    # ℹ️ Command-line programs to run using the OS shell.
    # 📚 https://git.io/JvXDl

    # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
    #    and modify them (or add more) to build your code if your project
    #    uses a compiled language

    #- run: |
    #   make bootstrap
    #   make release

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v3.29.5


================================================
FILE: .github/workflows/dev.yml
================================================
name: Dev
on:
  workflow_dispatch:
    inputs:
      job_id:
        type: choice
        description: Specific job to run
        default: all
        required: true
        options:
        - all
        - canary
        - dragon
        - puffin
        - dodo
        - passenger
        - greatawk
        - wasp
        - bat
        - pterodactyl
        - bigbird
        - camel
        - chaffinch
        - fruitbat
        - ptarmigan
        - zebrilus
        - bee
  push:
    branches: [ main, "release/**" ]
  pull_request:
    branches: [ main ]

permissions:
  contents: read

env:
  CFLAGS_GCC_STYLE: '-Wall -Wextra -pedantic -Wdeclaration-after-statement -Wshadow -Wno-overlength-strings -Wimplicit-fallthrough'
  CFLAGS_MSVC: '/W3'
  CMAKE_FLAGS: '-Wdev -Werror=dev -Wdeprecated -Werror=deprecated --warn-uninitialized'

jobs:

  canary:
    # Tests with: Debug & assertions; link-size=4; libedit
    name: GCC -O0
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'canary')
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | sudo debconf-communicate && sudo dpkg-reconfigure man-db
          sudo apt-get -qq update
          sudo apt-get -qq install -y libedit-dev

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Configure
        run: ./configure CC='gcc -fsanitize=undefined,address -fsanitize-undefined-trap-on-error' CFLAGS="-O0 $CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug --enable-Werror --enable-pcre2test-libedit --with-link-size=4

      - name: Build
        run: make -j3

      - name: Test
        run: (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

  dragon:
    # Tests with: clang AB/UB; link-size=3. Clang's logo is a dragon.
    name: Clang
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'dragon')
    strategy:
      fail-fast: false
      matrix:
        opt: ["-O0", "-O2"]
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Configure
        run: ./configure CC='clang -fsanitize=undefined,address,integer -fno-sanitize-recover=undefined,integer -fno-sanitize=unsigned-integer-overflow,unsigned-shift-base,function' CFLAGS="${{ matrix.opt }} $CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug --enable-Werror --with-link-size=3

      - name: Build
        run: make -j3

      - name: Test
        run: |
          ulimit -S -s 49152 # Raise stack limit; ASAN with -O0 is very stack-hungry
          (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

  puffin:
    # Tests with: GCC, -O3, very latest CMake, libedit
    name: GCC -O3, CMake
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'puffin')
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | sudo debconf-communicate && sudo dpkg-reconfigure man-db
          sudo apt-get -qq update
          sudo apt-get -qq install -y git build-essential cmake zlib1g-dev libbz2-dev libedit-dev ninja-build


      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Check latest CMake
        id: get-cmake-ver
        run: |
          CMAKE_VER=$(curl -s https://api.github.com/repos/Kitware/CMake/releases/latest | jq -r '.tag_name' | sed 's/^v//')
          if ! echo "$CMAKE_VER" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$' ; then
            echo "Extracted CMake version: '$CMAKE_VER'" >&2
            echo "This does not match the expected version format" >&2
            exit 1
          fi
          echo "CMAKE_VER=$CMAKE_VER" >> $GITHUB_OUTPUT
          echo "CMAKE_VER=$CMAKE_VER" >> $GITHUB_ENV
          echo "Latest CMake version is $CMAKE_VER"

      - name: Cache CMake
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          key: cmake-${{ steps.get-cmake-ver.outputs.CMAKE_VER }}-linux-x86_64
          path: cmake-${{ steps.get-cmake-ver.outputs.CMAKE_VER }}-linux-x86_64.tar.gz

      - name: Install CMake
        run: |
          [ -f cmake-${CMAKE_VER}-linux-x86_64.tar.gz ] || curl -L -S -O "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz"
          tar -xz -f cmake-${CMAKE_VER}-linux-x86_64.tar.gz -C "$RUNNER_TEMP"
          realpath "$RUNNER_TEMP/cmake-${CMAKE_VER}-linux-x86_64/bin" >> "$GITHUB_PATH"

      - name: Configure
        run: |
          cmake --version | grep "version ${CMAKE_VER}" || (echo "CMake version mismatch" && exit 1)
          cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DPCRE2_SUPPORT_LIBEDIT=ON -DPCRE2_SUPPORT_LIBREADLINE=OFF -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_POLICY_VERSION_MINIMUM=$CMAKE_VER -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build

      - name: Build
        run: cd build && make -j3

      - name: Test
        run: cd build && ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

      - name: Install
        run: |
          cd build
          cmake --install . --prefix install-dir
          ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-linux
          ../maint/RunSymbolTest install-dir/lib/ ../maint/

      - name: Test CMake install interface
        run: |
          INSTALL_PREFIX=`pwd`/build/install-dir
          cd maint/cmake-tests/install-interface

          for useStaticLibs in ON OFF; do
            echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
            rm -rf build
            cmake -GNinja $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build
            (cd build; ninja)
            ./build/test_executable
            ldd ./build/test_executable
            if [ $useStaticLibs = ON ]; then
              (ldd ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in ldd output" && exit 1)
            else
              # Test that the shared library is actually linked in
              (ldd ./build/test_executable | grep -q "$INSTALL_PREFIX/lib/libpcre2-8.so.0") || (echo "Error: Shared library not linked in" && exit 1)
            fi
          done

      - name: Test CMake build interface
        run: |
          BUILD_DIR=`pwd`
          cp -rp maint/cmake-tests/build-interface ../cmake-tests-build-interface
          cd ../cmake-tests-build-interface
          ln -s "$BUILD_DIR" pcre2

          for buildLibs in "ON;OFF" "OFF;ON"; do
            static=`echo $buildLibs | cut -d';' -f1`
            shared=`echo $buildLibs | cut -d';' -f2`
            echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$static and BUILD_SHARED_LIBS=$shared =="
            rm -rf build
            cmake -GNinja $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC_LIBS=$static -DBUILD_SHARED_LIBS=$shared -B build
            (cd build; ninja)
            ./build/test_executable
            ldd ./build/test_executable
            if [ $static = ON ]; then
              (ldd ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in ldd output" && exit 1)
            else
              # Test that the shared library is actually linked in
              (ldd ./build/test_executable | grep -q "`pwd`/build/pcre2/libpcre2-8.so.0") || (echo "Error: Shared library not linked in" && exit 1)
            fi
          done

  dodo:
    # Tests with: Autoconf on oldest supported Ubuntu (in non-extended support)
    name: GCC -Os, old Autotools
    runs-on: ubuntu-latest
    container: ubuntu:22.04
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'dodo')
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | debconf-communicate && dpkg-reconfigure man-db
          export DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC
          apt-get -qq update
          apt-get -qq install -y git build-essential autoconf automake libtool

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Configure
        run: ./configure CFLAGS="-Os $CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug --enable-Werror

      - name: Build
        run: make -j3

      - name: Test
        run: (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)

      - name: Install
        run: |
          make install "DESTDIR=`pwd`/install-dir"
          maint/RunManifestTest install-dir maint/manifest-makeinstall-linux
          maint/RunSymbolTest install-dir/usr/local/lib/ maint/

  passenger:
    # Tests with: Autoconf on oldest RHEL (in extended support).
    # That's the absolute limit to how old a Linux version I'll tolerate regular testing on.
    name: GCC, very old Autotools
    runs-on: ubuntu-latest
    container: redhat/ubi8:8.6
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'passenger')
    steps:
      - name: Setup
        run: |
          yum -q makecache
          yum -q install -y gcc git make automake autoconf libtool diffutils file glibc-langpack-en
          yum -q update -y glibc-common

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - name: Configure
        run: ./configure CFLAGS="-O0 $CFLAGS_GCC_STYLE" --enable-jit --enable-pcre2-16 --enable-pcre2-32 --enable-debug --enable-Werror

      - name: Build
        run: make -j3

      - name: Test
        run: (make check; rc=$?; for i in test-suite.log Run*Test.log pcre2*_test.log; do echo "== $i =="; cat $i; done; exit $rc)


      - name: Install
        run: |
          make install "DESTDIR=`pwd`/install-dir"
          maint/RunManifestTest install-dir maint/manifest-makeinstall-linux
          maint/RunSymbolTest install-dir/usr/local/lib/ maint/

  greatawk:
    # Tests with: GCC, -O2, oldest supported Ubuntu (in non-extended support)
    name: GCC -O2, old CMake
    runs-on: ubuntu-latest
    container: ubuntu:22.04
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'greatawk')
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | debconf-communicate && dpkg-reconfigure man-db
          export DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC
          apt-get -qq update
          apt-get -qq install -y git build-essential cmake zlib1g-dev libbz2-dev libreadline-dev

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        run: cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build

      - name: Build
        run: cd build && make -j3

      - name: Test
        run: cd build && ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

      - name: Install
        run: |
          cd build
          cmake --install . --prefix install-dir
          ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-linux relwithdebinfo
          ../maint/RunSymbolTest install-dir/lib/ ../maint/

      - name: Test CMake install interface
        run: |
          INSTALL_PREFIX=`pwd`/build/install-dir
          cd maint/cmake-tests/install-interface

          for useStaticLibs in ON OFF; do
            echo "== Testing CMake install interface with PCRE2_USE_STATIC_LIBS=$useStaticLibs =="
            rm -rf build
            cmake $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" -DPCRE2_USE_STATIC_LIBS=$useStaticLibs -B build
            (cd build; make)
            ./build/test_executable
            ldd ./build/test_executable
            if [ $useStaticLibs = ON ]; then
              (ldd ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in ldd output" && exit 1)
            else
              # Test that the shared library is actually linked in
              (ldd ./build/test_executable | grep -q "$INSTALL_PREFIX/lib/libpcre2-8.so.0") || (echo "Error: Shared library not linked in" && exit 1)
            fi
          done

      - name: Test CMake build interface
        run: |
          BUILD_DIR=`pwd`
          cp -rp maint/cmake-tests/build-interface ../cmake-tests-build-interface
          cd ../cmake-tests-build-interface
          ln -s "$BUILD_DIR" pcre2

          for buildLibs in "ON;OFF" "OFF;ON"; do
            static=`echo $buildLibs | cut -d';' -f1`
            shared=`echo $buildLibs | cut -d';' -f2`
            echo "== Testing CMake build interface with BUILD_STATIC_LIBS=$static and BUILD_SHARED_LIBS=$shared =="
            rm -rf build
            cmake $CMAKE_FLAGS -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC_LIBS=$static -DBUILD_SHARED_LIBS=$shared -B build
            (cd build; make)
            ./build/test_executable
            ldd ./build/test_executable
            if [ $static = ON ]; then
              (ldd ./build/test_executable | grep -q "pcre2") && (echo "Error: PCRE2 found in ldd output" && exit 1)
            else
              # Test that the shared library is actually linked in
              (ldd ./build/test_executable | grep -q "`pwd`/build/pcre2/libpcre2-8.so.0") || (echo "Error: Shared library not linked in" && exit 1)
            fi
          done

  wasp:
    # Tests with: French locale; oldest supported CMake; no JIT; -Os; libreadline
    name: GCC -Os, very old CMake, ninja, no JIT
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'wasp')
    env:
      CMAKE_VER: "3.15.7"
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | sudo debconf-communicate && sudo dpkg-reconfigure man-db
          sudo apt-get -qq update
          sudo apt-get -qq install -y language-pack-fr ninja-build zlib1g-dev libbz2-dev libreadline-dev

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Cache CMake
        uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
        with:
          key: cmake-${{ env.CMAKE_VER }}-Linux-x86_64
          path: cmake-${{ env.CMAKE_VER }}-Linux-x86_64.tar.gz

      - name: Install CMake
        run: |
          [ -f cmake-${CMAKE_VER}-Linux-x86_64.tar.gz ] || curl -L -S -O "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.tar.gz"
          tar -xz -f cmake-${CMAKE_VER}-Linux-x86_64.tar.gz -C "$RUNNER_TEMP"
          realpath "$RUNNER_TEMP/cmake-${CMAKE_VER}-Linux-x86_64/bin" >> "$GITHUB_PATH"

      - name: Configure
        run: |
          cmake --version | grep "version ${CMAKE_VER}" || (echo "CMake version mismatch" && exit 1)
          CC='clang' cmake $CMAKE_FLAGS -G Ninja -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DPCRE2_SUPPORT_LIBREADLINE=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=MinSizeRel -B build

      - name: Build
        run: ninja -C build

      - name: Test
        run: cd build && ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

      - name: Install
        run: |
          cd build
          cmake --install . --prefix install-dir
          ../maint/RunManifestTest install-dir ../maint/manifest-cmakeinstall-linux minsizerel
          ../maint/RunSymbolTest install-dir/lib/ ../maint/

  bat:
    # Tests with: MSVC 32-bit, and a variety of CMake options. Windows has "bat" files.
    name: Windows (Win32)
    runs-on: windows-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'bat')
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        run: cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2GREP_SUPPORT_CALLOUT_FORK=OFF -DPCRE2_DEBUG=ON -DPCRE2_NEWLINE=ANYCRLF -DPCRE2_STATIC_PIC=ON -DPCRE2_SUPPORT_BSR_ANYCRLF=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DCMAKE_C_FLAGS="$CFLAGS_MSVC" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -B build -A Win32

      - name: Build
        run: cmake --build build --config RelWithDebInfo

      - name: Test
        run: cd build && ctest -C RelWithDebInfo -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

  pterodactyl:
    # Tests with: MSVC 64-bit, Debug, shared libraries
    name: Windows (x64)
    runs-on: windows-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'pterodactyl')
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        run: cmake $CMAKE_FLAGS -DPCRE2_SUPPORT_JIT=OFF -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_DEBUG=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_C_FLAGS="$CFLAGS_MSVC" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build -A x64

      - name: Build
        run: cmake --build build --config Debug

      - name: Test
        run: cd build && ctest -C Debug -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

  bigbird:
    # Job to execute ManyConfigTests
    name: manyconfig
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'bigbird')
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | sudo debconf-communicate && sudo dpkg-reconfigure man-db
          sudo apt-get -qq update
          sudo apt-get -qq install -y valgrind

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Run
        run: |
          ./autogen.sh
          ./maint/ManyConfigTests

  camel:
    # Job to execute RunPerlTest. "Camel bird" is another name for an ostrich (and it's Perl's logo).
    name: perl
    runs-on: ubuntu-latest
    container: perl:devel
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'camel')
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: yes

      - name: Test
        run: |
          perl -v
          maint/RunPerlTest

  chaffinch:
    # Job to verify that the CMake "unity" build (single-file / jumbo build) passes.
    # If this fails, it's usually because two different files define some file-static
    # functions or macros which collide.
    name: CMake unity build
    runs-on: ubuntu-latest
    if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'chaffinch')
    env:
      # Disallowing shadowing would be very spammy for unity builds, because the
      # same variable name can be used in multiple files.
      CFLAGS_UNITY: "-Wno-shadow"
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Configure
        run: cmake $CMAKE_FLAGS -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=0 -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE $CFLAGS_UNITY" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build

      - name: Build
        run: cd build && make -j3

      - name: Test
        run: cd build && ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

  fruitbat:
    # Tests with: MSYS2 unix-on-Windows environment
    name: MSYS2
    runs-on: windows-latest
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'fruitbat')) ||
      github.event_name == 'push'
    strategy:
      fail-fast: false
      matrix:
        # UCRT64 is the new default MSYS2 runtime, which builds native 64-bit
        # binaries which can then be shipped and run on systems without MSYS2
        # installed (using MinGW-x64 + the UCRT).
        # MSYS is the Unix-variant runtime, which builds binaries that have a
        # dependency on MSYS2 being installed, but those binaries then use a
        # full emulated Unix environment at runtime.
        msystem: ["UCRT64", "MSYS"]
    steps:
      - name: Pre-checkout
        run: git config --global core.autocrlf input

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Setup
        uses: msys2/setup-msys2@e9898307ac31d1a803454791be09ab9973336e1c # v2.31.1
        with:
          msystem: ${{ matrix.msystem }}
          update: true
          pacboy: diffutils gcc:p cmake:p ninja:p ${{ matrix.msystem == 'MSYS' && 'libreadline:p' || 'readline:p' }}

      - name: Configure
        shell: msys2 {0}
        run: cmake $CMAKE_FLAGS -G Ninja -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build

      - name: Build
        shell: msys2 {0}
        run: ninja -C build

      - name: Test
        shell: msys2 {0}
        run: cd build && ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

  ptarmigan:
    # Tests with various unusual processor architectures
    name: Multiarch
    strategy:
      fail-fast: false
      matrix:
        include:
          # S390x is important, because it's basically the only supported big-endian
          # architecture I can find anywhere. I used to work on SPARC and PPC-be systems
          # a long time ago, but even Debian has dropped those architectures now, so
          # it's nice that there's *least one* arch remaining to shake out endian
          # assumptions.
          - arch: "s390x"
            distro: ubuntu_latest
          # Big-iron POWER only (this is not the PowerPC arch used in old Apple Macs)
          - arch: "ppc64le"
            distro: "ubuntu_latest"
          # A 32-bit Linux build. i386 is mostly gone now, so ARMv7 is all that's left.
          - arch: "armv7"
            distro: "ubuntu_latest"
          # The only really widely-deployed non-x86 archicture, at least that's likely
          # to be running PCRE2.
          - arch: "aarch64"
            distro: "ubuntu_latest"
          # Not used by anyone yet, really, but potentially the "next big thing".
          - arch: "riscv64"
            distro: "ubuntu_latest"
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write # Necessary for uraimo/run-on-arch-action to use GitHub's Docker repository as a cache
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'ptarmigan')) ||
      github.event_name == 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Prepare
        run: ./autogen.sh

      - uses: uraimo/run-on-arch-action@f9b26e3a1a408d5fd530d20c17b9f3f4428ff8d9 # v3.1.0
        name: Configure, build, and test
        with:
          arch: ${{ matrix.arch }}
          distro: ${{ matrix.distro }}

          # Not required, but speeds up builds by storing container images in
          # a GitHub package registry.
          githubToken: ${{ github.token }}

          env: | # YAML, but pipe character is necessary
            CFLAGS_GCC_STYLE: ${{ env.CFLAGS_GCC_STYLE }}
            CMAKE_FLAGS: ${{ env.CMAKE_FLAGS }}

          install: |
            echo "set man-db/auto-update false" | debconf-communicate && dpkg-reconfigure man-db
            apt-get -qq update
            apt-get -qq install -y gcc cmake ninja-build zlib1g-dev libbz2-dev libreadline-dev

          run: |
            set -e
            # TODO: Set -DCMAKE_COMPILE_WARNING_AS_ERROR=ON (there's currently a build failure on S390x)
            cmake $CMAKE_FLAGS -G Ninja -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DPCRE2_DEBUG=ON -DCMAKE_C_FLAGS="$CFLAGS_GCC_STYLE" -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -B build
            cd build
            ninja
            ctest -j3 --output-on-failure && (cat ./Testing/Temporary/LastTest.log || true)

  zebrilus:
    # Tests with: Zig compiler. A "zebrilus" is known as a "zigzag heron".
    name: Zig
    runs-on: ubuntu-latest
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'zebrilus')) ||
      github.event_name == 'push'
    steps:
      - name: Setup
        run: |
          sudo snap install zig --classic --beta

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Build
        run: zig build -Dsupport_jit

      - name: Test
        run: |
          srcdir=`pwd` pcre2test=`pwd`/zig-out/bin/pcre2test ./RunTest -bigstack

  bee:
    # Tests with: Bazel build system. A bee goes "buzz buzz buzz(el)".
    name: Bazel
    strategy:
      fail-fast: false
      matrix:
        os: ["ubuntu-latest", "windows-latest"]
    runs-on: ${{ matrix.os }}
    if: |
      (github.event_name == 'workflow_dispatch' && (inputs.job_id == 'all' || inputs.job_id == 'bee')) ||
      github.event_name == 'push'
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true

      - name: Build
        run: bazelisk build //... --enable_runfiles --incompatible_strict_action_env

      - name: Test
        run: bazelisk test //... --enable_runfiles --incompatible_strict_action_env --test_output=all


================================================
FILE: .github/workflows/pages.yml
================================================
name: Deploy Pages
on:
  workflow_dispatch:
  workflow_run:
    workflows: [ 'Sync' ]
    types:
      - completed
    branches: [ main ]
  push:
    branches: [ pages ]
  pull_request:
    branches: [ pages ]

permissions:
  contents: read

concurrency:
  group: "pages"
  cancel-in-progress: false

jobs:
  Build:
    runs-on: ubuntu-latest
    steps:
      - name: Setup
        run: |
          echo "set man-db/auto-update false" | sudo debconf-communicate && sudo dpkg-reconfigure man-db
          sudo apt-get -qq update
          sudo apt-get -qq install -y hugo

      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          ref: pages

      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0

      - name: Build with Hugo
        env:
          HUGO_BASE_URL: ${{ steps.pages.outputs.base_url }}
        run: pages/maint/Build.py

      - name: Upload artifact
        uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
        with:
          path: ./pages/public

  Deploy:
    needs: Build

    if: github.event_name != 'pull_request' && github.ref == 'refs/heads/pages'

    permissions:
      pages: write      # to deploy to Pages
      id-token: write   # to verify the deployment originates from an appropriate source

    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    runs-on: ubuntu-latest
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0


================================================
FILE: .github/workflows/scorecards.yml
================================================
name: Scorecards supply-chain security
on:
  workflow_dispatch:
  # Only the default branch is supported.
  branch_protection_rule:
  schedule:
    - cron: '23 17 * * 1'
  push:
    branches: [ main ]

permissions: read-all

jobs:
  analysis:
    name: Scorecards analysis
    runs-on: ubuntu-latest

    permissions:
      # Needed to upload the results to code-scanning dashboard.
      security-events: write
      # Needed to publish the results to Scorecard's service.
      id-token: write
      actions: read
      contents: read

    steps:
      - name: "Checkout code"
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: true
          persist-credentials: false

      - name: "Run analysis"
        uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # tag=v2.4.3
        with:
          results_file: results.sarif
          results_format: sarif
          # repo_token: ${{ secrets.GITHUB_TOKEN }}
          # Publish the results to enable scorecard badges. For more details, see
          # https://github.com/ossf/scorecard-action#publishing-results.
          # For private repositories, `publish_results` will automatically be set to `false`,
          # regardless of the value entered here.
          publish_results: true

      # Upload the results as artifacts (optional).
      - name: "Upload artifact"
        uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: SARIF file
          path: results.sarif
          retention-days: 5

      # Upload the results to GitHub's code scanning dashboard.
      - name: "Upload to code-scanning"
        uses: github/codeql-action/upload-sarif@95e58e9a2cdfd71adc6e0353d5c52f41a045d225 # v3.29.5
        with:
          sarif_file: results.sarif
          category: ossf-scorecard


================================================
FILE: .github/workflows/sync.yml
================================================
name: Sync
on:
  workflow_dispatch:
  push:
    branches: [ main, "release/**" ]
  pull_request:
    branches: [ main ]

permissions:
  contents: read

jobs:
  sync-autogenerated:
    # Job to verify that the tasks performed by UpdateAlways have been done. It is
    # the committer's responsibility (currently) to run UpdateAlways themselves when
    # making a PR, so that everything is kept in-sync.
    name: Check autogenerated file freshness
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: false
          fetch-depth: 0 # Necessary for maint/UpdateAlways
          fetch-tags: false
          # Check out the unmerged source branch for `pull_request`-triggered runs;
          # otherwise use the tip of the branch for `workflow_dispatch` and `pull` triggers.
          ref: ${{ github.event.pull_request.head.ref || github.ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}

      - name: UpdateDates
        if: |
          github.event_name != 'pull_request' &&
          (startsWith(github.ref, 'refs/heads/release/') ||
           startsWith(github.ref, 'refs/tags/pcre2-'))
        run: maint/UpdateDates.py

      - name: UpdateAlways
        run: maint/UpdateAlways

      - name: 'Rebuild *.h.generic'
        run: |
          ./autogen.sh && ./configure

          # Workaround for incorrect filesystem permissions on /usr/share/aclocal, which
          # causes the m4 macros to be copied with incorrect permissions.
          # https://github.com/actions/runner-images/issues/11212
          chmod u=rw,go=r m4/*.m4

          rm -f src/*.generic
          make src/config.h.generic src/pcre2.h.generic

      # If we're in a forked repo, it's too onerous to expect contributors to run the
      # checks locally to keep these files up to date (since the tool versions are very
      # fussy and brittle).
      #
      # However, we still want to run the steps above, to check that the UpdateAlways
      # process is able to run to completion, since it can pick up errors in the man pages.

      - name: Commit and push, if not in a forked repo
        if: github.event_name != 'pull_request' || ( ! github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' )
        run: |
          if [ -n "`git status --porcelain`" ] ; then
            # Dirty working tree: push it
            git config user.name "github-actions[bot]"
            git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
            git add -u
            git commit -m "Sync autogenerated files #noupdate"
            git push
          fi

  sync-docs:
    name: Sync content from main to pages
    runs-on: ubuntu-latest
    if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
    needs: ['sync-autogenerated']
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
        with:
          submodules: false
          fetch-depth: 0 # Necessary to get both the main and pages branches
          fetch-tags: false
          ref: pages

      - name: Commit and push, if docs have changed
        run: |
          if ! git diff --exit-code origin/main -- \
               ./doc ./AUTHORS.md ./LICENCE.md ./SECURITY.md ./README.md \
               ./README ./NON-AUTOTOOLS-BUILD >/dev/null ; then
            # Differences from main: merge and push
            git config user.name "github-actions[bot]"
            git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
            git merge origin/main --no-edit -m"Sync content from main to pages"
            git push
          else
            echo "No content changes to sync"
          fi

================================================
FILE: .gitignore
================================================
# Public .gitignore file for PCRE2

build/
build-*/

pages/

*.a
*.gcda
*.gcno
*.profraw
*.lo
*.la
*.pc
*.o
*~

*-coverage*

__pycache__
.deps
.libs

Makefile
Makefile.in
RunGrepTest.log
RunGrepTest.trs
RunTest.log
RunTest.trs

aclocal.m4
ar-lib
autom4te.cache
compile
config.guess
config.log
config.status
config.sub
config.lt
configure
depcomp
install-sh
libtool
ltmain.sh
missing
pcre2-config
pcre2_dftables
pcre2_jit_test
pcre2_jit_test.exe
pcre2_jit_test.log
pcre2_jit_test.trs
pcre2posix_test
pcre2posix_test.exe
pcre2posix_test.log
pcre2posix_test.trs
pcre2demo
pcre2fuzzcheck-*
pcre2fuzzer-*
pcre2grep
pcre2grep.exe
pcre2test
pcre2test.exe
test-driver
test-suite.log
test3input
test3output
test3outputA
test3outputB
testNinput
testNinputgrep
teststderr
teststderrM
teststderrgrep
teststdout
teststdoutM
testtemp1
testtemp1grep
testtemp2
testtemp2grep
testtry
testtry2
testtrygrep
testSinput
testSoutput
testbtables
testsaved1
testsaved2
testoutput8
testoutput8-jit
testoutput8-dfa
testoutput16
testoutput16-jit
testoutput16-dfa
testoutput32
testoutput32-jit
testoutput32-dfa

m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4

src/.deps
src/.dirstamp
src/config.h
src/config.h.in
src/pcre2.h
src/pcre2_chartables.c
src/libpcre2-8.sym
src/libpcre2-16.sym
src/libpcre2-32.sym
src/libpcre2-posix.sym
src/stamp-h1

/bazel-*
*.bazel.lock

zig-out/
zig-cache/
.zig-cache/

# Folders that may be used by individual developers, without appearing in git
# status output.
.vscode/
.devcontainer/
.personal/

# End


================================================
FILE: .gitmodules
================================================
[submodule "deps/sljit"]
	path = deps/sljit
	url = https://github.com/zherczeg/sljit.git


================================================
FILE: AUTHORS.md
================================================
PCRE2 Authorship and Contributors
=================================

Copyright
---------

Please see the file [LICENCE](./LICENCE.md) in the PCRE2 distribution for
copyright details.


Maintainers
-----------

The PCRE and PCRE2 libraries were authored and maintained by Philip Hazel.

Since 2024, the contributors with administrator access to the project are now
Nicholas Wilson and Zoltán Herczeg. See the file [SECURITY](./SECURITY.md) for
GPG keys.

Both administrators are volunteers acting in a personal capacity.

<table>
<thead>
<tr>
  <th>Name</th>
  <th>Role</th>
<tr>
</thead>
<tbody>
<tr>
  <td>

  Nicholas Wilson<br/>
  `nicholas@nicholaswilson.me.uk`<br/>
  Currently of Microsoft Research Cambridge, UK

  </td>
  <td>

  * General project administration & maintenance
  * Release management
  * Code maintenance

  </td>
</tr>
<tr>
  <td>

  Zoltán Herczeg<br/>
  `hzmester@freemail.hu`<br/>
  Currently of the University of Szeged, Hungary

  </td>
  <td>

  * Code maintenance
  * Ownership of `sljit` and PCRE2's JIT

  </td>
</tr>
</tbody>
</table>


Contributors
------------

Many others have participated and contributed to PCRE2 over its history.

The maintainers are grateful for all contributions and participation over the
years. We apologise for any names we have forgotten.

We are especially grateful to Philip Hazel, creator of PCRE and PCRE2, and
maintainer from 1997 to 2024.

All names listed alphabetically.

### Contributors to PCRE2

This list includes names up until the PCRE2 10.47 release. New names will be
added from the Git history on each release.

    Scott Bell
    Carlo Marcelo Arenas Belón
    Edward Betts
    Jan-Willem Blokland
    Ross Burton
    Dmitry Cherniachenko
    Alexey Chupahin
    Jessica Clarke
    Alejandro Colomar
    Jeremie Courreges-Anglas
    Addison Crump
    Alex Dowad
    Daniel Engberg
    Marco Feuerstein
    Daniel Richard G
    Isaac Oscar Gariano
    David Gaussmann
    Andrey Gorbachev
    Jordan Griege
    Jason Hood
    Bumsu Hyeon
    Roy Ivy
    Nobuhiro Iwamatsu
    Martin Joerg
    Guillem Jover
    Ralf Junker
    Ayesh Karunaratne
    Michael Kaufmann
    Yunho Kim
    Joshua Kinard
    David Korczynski
    Uwe Korn
    Jonas Kvinge
    Kristian Larsson
    Kai Lu
    Behzod Mansurov
    B. Scott Michel
    Greg Minshall
    Nathan Moinvaziri
    Mike Munday
    Marc Mutz
    Fabio Pagani
    Christian Persch
    Alex Reinking
    Joshua Rogers
    Tristan Ross
    William A Rowe Jr
    Rocco Ruscitti
    David Seifert
    Yaakov Selkowitz
    Rich Siegel
    Karl Skomski
    Maciej Sroczyński
    Wolfgang Stöggl
    Thomas Tempelmann
    Greg Thain
    Lucas Trzesniewski
    Theodore Tsirpanis
    Aaron M. Ucko
    Matthew Vernon
    Rémi Verschelde
    Thomas Voss
    Ezekiel Warren
    Carl Weaver
    Chris Wilson
    Amin Yahyaabadi
    Joe Zhang

### Contributors to PCRE1

These people contributed either by sending patches or reporting serious issues.

    Irfan Adilovic
    Alexander Barkov
    Daniel Bergström
    David Burgess
    Ross Burton
    David Byron
    Fred Cox
    Christian Ehrlicher
    Tom Fortmann
    Lionel Fourquaux
    Mike Frysinger
    Daniel Richard G
    Dair Gran
    "Graycode" (Red Hat Product Security)
    Viktor Griph
    Wen Guanxing
    Robin Houston
    Martin Jerabek
    Peter Kankowski
    Stephen Kelly
    Yunho Kim
    Joshua Kinard
    Carsten Klein
    Evgeny Kotkov
    Ronald Landheer-Cieslak
    Alan Lehotsky
    Dmitry V. Levin
    Nuno Lopes
    Kai Lu
    Giuseppe Maxia
    Dan Mooney
    Marc Mutz
    Markus Oberhumer
    Sheri Pierce
    Petr Pisar
    Ari Pollak
    Bob Rossi
    Ruiger Rill
    Michael Shigorin
    Rich Siegel
    Craig Silverstein (C++ wrapper)
    Karl Skomski
    Paul Sokolovsky
    Stan Switzer
    Ian Taylor
    Mark Tetrode
    Jeff Trawick
    Steven Van Ingelgem
    Lawrence Velazquez
    Jiong Wang
    Stefan Weber
    Chris Wilson

Thanks go to Jeffrey Friedl for testing and debugging assistance.


================================================
FILE: BUILD.bazel
================================================
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@bazel_skylib//rules:native_binary.bzl", "native_test")
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

copy_file(
    name = "config_h_generic",
    src = "src/config.h.generic",
    out = "src/config.h",
)

copy_file(
    name = "pcre2_h_generic",
    src = "src/pcre2.h.generic",
    out = "src/pcre2.h",
)

copy_file(
    name = "pcre2_chartables_c",
    src = "src/pcre2_chartables.c.dist",
    out = "src/pcre2_chartables.c",
)

LOCAL_DEFINES = [
    "HAVE_CONFIG_H",
    "SUPPORT_PCRE2_8",
    "SUPPORT_UNICODE",
] + select({
    "@platforms//os:windows": [],
    "//conditions:default": ["HAVE_UNISTD_H"],
})

# Workaround for a Bazel quirk. It is extremely strict about the #include path
# used for internal headers. We have our headers inside src/, but we #include
# them as '#include "pcre2_internal.h"', assuming that src/ is added to the
# compiler's include path. Unfortunately, that violates the conventions used by
# Bazel.
#
# This is a workaround. Note that we can't use the "include = [...]" property
# to add the src/ directory, since that pollutes the include path for projects
# depending on PCRE2 (we must not make our config.h file visible to consumers
# of PCRE2).
cc_library(
    name = "pcre2_internal_headers",
    hdrs = [
        "src/pcre2_compile.h",
        "src/pcre2_internal.h",
        "src/pcre2_intmodedep.h",
        "src/pcre2_jit_match_inc.h",
        "src/pcre2_jit_misc_inc.h",
        "src/pcre2_printint_inc.h",
        "src/pcre2_ucp.h",
        "src/pcre2_ucptables_inc.h",
        "src/pcre2_util.h",
        "src/pcre2test_inc.h",
        ":config_h_generic",
    ],
    strip_include_prefix = "src",
    visibility = ["//visibility:private"],
)

cc_library(
    name = "pcre2",
    srcs = [
        "src/pcre2_auto_possess.c",
        "src/pcre2_chkdint.c",
        "src/pcre2_compile.c",
        "src/pcre2_compile_cgroup.c",
        "src/pcre2_compile_class.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_jit_compile.c",
        "src/pcre2_maketables.c",
        "src/pcre2_match.c",
        "src/pcre2_match_data.c",
        "src/pcre2_match_next.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",
        ":pcre2_chartables_c",
    ],
    hdrs = [":pcre2_h_generic"],
    implementation_deps = [":pcre2_internal_headers"],
    defines = [
        "PCRE2_STATIC",
    ],
    local_defines = LOCAL_DEFINES + [
        "PCRE2_CODE_UNIT_WIDTH=8",
    ],
    strip_include_prefix = "src",
    linkstatic = True,
    visibility = ["//visibility:public"],
)

# See below for explanation of why we need this.
#
# https://github.com/bazelbuild/bazel/issues/680
cc_library(
    name = "pcre2posix_dotc_headers",
    hdrs = [
        "src/pcre2_tables.c",
    ],
    strip_include_prefix = "src",
    visibility = ["//visibility:private"],
)

cc_library(
    name = "pcre2-posix",
    srcs = ["src/pcre2posix.c"],
    hdrs = ["src/pcre2posix.h"],
    implementation_deps = [
        ":pcre2_internal_headers",
        ":pcre2posix_dotc_headers",
    ],
    local_defines = LOCAL_DEFINES + [
        "PCRE2_CODE_UNIT_WIDTH=8",
    ],
    strip_include_prefix = "src",
    linkstatic = True,
    visibility = ["//visibility:public"],
    deps = [
        ":pcre2",
    ],
)

# Totally weird issue in Bazel. It won't let you #include any files unless they
# are declared to the build system. OK, fair enough. But - for a cc_binary it
# uses the file extension to determine whether it's a header or a compilation
# unit. But... we have several .c files which are #included, rather than treated
# as a compilation unit.
#
# For cc_library() above, we can overcome this with textual_hdrs. But that
# doesn't work for cc_binary(). Here's our workaround.
#
# https://github.com/bazelbuild/bazel/issues/680
cc_library(
    name = "pcre2test_dotc_headers",
    hdrs = [
        "src/pcre2_chkdint.c",
        "src/pcre2_tables.c",
        "src/pcre2_ucd.c",
        "src/pcre2_valid_utf.c",
    ],
    strip_include_prefix = "src",
    visibility = ["//visibility:private"],
)

cc_binary(
    name = "pcre2test",
    srcs = ["src/pcre2test.c"],
    linkopts = select({
        "@platforms//os:windows": ["-STACK:2500000"],
        "//conditions:default": [],
    }),
    local_defines = LOCAL_DEFINES,
    visibility = ["//visibility:public"],
    deps = [
        ":pcre2",
        ":pcre2-posix",
        ":pcre2_internal_headers",
        ":pcre2test_dotc_headers",
    ],
)

filegroup(
    name = "testdata",
    srcs = glob(["testdata/*"]),
)

native_test(
    name = "pcre2_test",
    size = "small",
    src = select({
        "@platforms//os:windows": "RunTest.bat",
        "//conditions:default": "RunTest",
    }),
    out = select({
        "@platforms//os:windows": "RunTest.bat",
        "//conditions:default": "RunTest",
    }),
    data = [
        ":pcre2test",
        ":testdata",
    ],
)


================================================
FILE: CMakeLists.txt
================================================
# CMakeLists.txt
#
# This file enables PCRE2 to be built with the CMake configuration and build
# tool. Download CMake in source or binary form from http://www.cmake.org/
# Converted to support PCRE2 from the original PCRE file, August 2014.
#
# Original listfile by Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
# Refined and expanded by Daniel Richard G. <skunk@iSKUNK.ORG>
# 2007-09-14 mod by Sheri so 7.4 supported configuration options can be entered
# 2007-09-19 Adjusted by PH to retain previous default settings
# 2007-12-26 (a) On UNIX, use names libpcre instead of just pcre
#            (b) Ensure pcretest and pcregrep link with the local library,
#                not a previously-installed one.
#            (c) Add PCRE_SUPPORT_LIBREADLINE, PCRE_SUPPORT_LIBZ, and
#                PCRE_SUPPORT_LIBBZ2.
# 2008-01-20 Brought up to date to include several new features by Christian
#            Ehrlicher.
# 2008-01-22 Sheri added options for backward compatibility of library names
#            when building with minGW:
#            if "ON", NON_STANDARD_LIB_PREFIX causes shared libraries to
#            be built without "lib" as prefix. (The libraries will be named
#            pcre.dll, pcreposix.dll and pcrecpp.dll).
#            if "ON", NON_STANDARD_LIB_SUFFIX causes shared libraries to
#            be built with suffix of "-0.dll". (The libraries will be named
#            libpcre-0.dll, libpcreposix-0.dll and libpcrecpp-0.dll - same names
#            built by default with Configure and Make.
# 2008-01-23 PH removed the automatic build of pcredemo.
# 2008-04-22 PH modified READLINE support so it finds NCURSES when needed.
# 2008-07-03 PH updated for revised UCP property support (change of files)
# 2009-03-23 PH applied Steven Van Ingelgem's patch to change the name
#            CMAKE_BINARY_DIR to PROJECT_BINARY_DIR so that it works when PCRE
#            is included within another project.
# 2009-03-23 PH applied a modified version of Steven Van Ingelgem's patches to
#            add options to stop the building of pcregrep and the tests, and
#            to disable the final configuration report.
# 2009-04-11 PH applied Christian Ehrlicher's patch to show compiler flags that
#            are set by specifying a release type.
# 2010-01-02 PH added test for stdint.h
# 2010-03-02 PH added test for inttypes.h
# 2011-08-01 PH added PCREGREP_BUFSIZE
# 2011-08-22 PH added PCRE_SUPPORT_JIT
# 2011-09-06 PH modified WIN32 ADD_TEST line as suggested by Sergey Cherepanov
# 2011-09-06 PH added PCRE_SUPPORT_PCREGREP_JIT
# 2011-10-04 Sheri added support for including coff data in windows shared libraries
#            compiled with MINGW if pcre.rc and/or pcreposix.rc are placed in
#            the source dir by the user prior to building
# 2011-10-04 Sheri changed various add_test's to use exes' location built instead
#            of DEBUG location only (likely only matters in MSVC)
# 2011-10-04 Sheri added scripts to provide needed variables to RunTest and
#            RunGrepTest (used for UNIX and Msys)
# 2011-10-04 Sheri added scripts to provide needed variables and to execute
#            RunTest.bat in Win32 (for effortless testing with "make test")
# 2011-10-04 Sheri Increased minimum required cmake version
# 2012-01-06 PH removed pcre_info.c and added pcre_string_utils.c
# 2012-01-10 Zoltan Herczeg added libpcre16 support
# 2012-01-13 Stephen Kelly added out of source build support
# 2012-01-17 PH applied Stephen Kelly's patch to parse the version data out
#            of the configure.ac file
# 2012-02-26 PH added support for libedit
# 2012-09-06 PH added support for PCRE_EBCDIC_NL25
# 2012-09-08 ChPe added PCRE32 support
# 2012-10-23 PH added support for VALGRIND and GCOV
# 2012-12-08 PH added patch from Daniel Richard G to quash some MSVC warnings
# 2013-07-01 PH realized that the "support" for GCOV was a total nonsense and
#            so it has been removed.
# 2013-10-08 PH got rid of the "source" command, which is a bash-ism (use ".")
# 2013-11-05 PH added support for PARENS_NEST_LIMIT
# 2014-08-29 PH converted the file for PCRE2 (which has no C++).
# 2015-04-24 PH added support for PCRE2_DEBUG
# 2015-07-16 PH updated for new pcre2_find_bracket source module
# 2015-08-24 PH correct C_FLAGS setting (patch from Roy Ivy III)
# 2015-10=16 PH added support for never-backslash-C
# 2016-03-01 PH applied Chris Wilson's patch for MSVC static
# 2016-06-24 PH applied Chris Wilson's second patch, putting the first under
#            a new option instead of being unconditional.
# 2016-10-05 PH fixed a typo (PCRE should be PCRE2) in above patch
#            fix by David Gaussmann
# 2016-10-07 PH added PCREGREP_MAX_BUFSIZE
# 2017-03-11 PH turned HEAP_MATCH_RECURSE into a NO-OP for 10.30
# 2017-04-08 PH added HEAP_LIMIT
# 2017-06-15 ZH added SUPPORT_JIT_SEALLOC support
# 2018-06-19 PH added checks for stdint.h and inttypes.h (later removed)
# 2018-06-27 PH added Daniel's patch to increase the stack for MSVC
# 2018-11-14 PH removed unnecessary checks for stdint.h and inttypes.h
# 2018-11-16 PH added PCRE2GREP_SUPPORT_CALLOUT_FORK support and tidied
# 2019-02-16 PH hacked to avoid CMP0026 policy issue (see comments below)
# 2020-03-16 PH renamed dftables as pcre2_dftables (as elsewhere)
# 2020-03-24 PH changed CMAKE_MODULE_PATH definition to add, not replace
# 2020-04-08 Carlo added function check for secure_getenv, fixed strerror
# 2020-04-16 enh added check for __attribute__((uninitialized))
# 2020-04-25 PH applied patches from Uwe Korn to support pkg-config and
#            library versioning.
# 2020-04-25 Carlo added function check for mkostemp used in ProtExecAllocator
# 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()
# 2022-12-10 PH added support for pcre2posix_test
# 2023-01-15 Carlo added C99 as the minimum required
# 2023-08-06 PH added support for setting variable length lookbehind maximum
# 2025-03-27 Theodore used standard CMake constructs to export the library's
#            targets.

################################################################################
# We have used `gersemi` for auto-formatting our CMake files.
# Applied to all CMake files using:
#    > pip3 install gersemi
#    > gersemi --in-place --line-length 120 --indent 2 \
#          --definitions cmake/*.cmake \
#          -- ./CMakeLists.txt ./cmake/*.cmake ./cmake/*.cmake.in
################################################################################

message(STATUS "Using CMake version ${CMAKE_VERSION} (${CMAKE_COMMAND})")

# Increased minimum to 3.15 to allow use of string(REPEAT).
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(PCRE2 C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_VISIBILITY_PRESET hidden)

# Solaris-specific fix for "CMAKE_C_VISIBILITY_PRESET": this feature was only
# recently added to CMake for the `cc` compiler (Oracle Developer Studio). The
# CMake version from OpenCSW and Oracle's package repository is too old and
# requires this fix.
if(
  CMAKE_SYSTEM_NAME STREQUAL "SunOS"
  AND CMAKE_VERSION VERSION_LESS 3.31
  AND CMAKE_C_COMPILER_ID STREQUAL "SunPro"
  AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 5.15
)
  set(CMAKE_C_COMPILE_OPTIONS_VISIBILITY "-fvisibility=")
endif()

# The following policies have been set in the PCRE2 CMake file in the past.
# Since we specify a minimum of CMake 3.15, these are no longer required.
# cmake_policy(SET CMP0063 NEW)
# cmake_policy(SET CMP0026 OLD)
# cmake_policy(SET CMP0074 NEW)

# For our modules in cmake/. This uses list(APPEND) rather than set() to allow
# setting CMAKE_MODULE_PATH on the command line.
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

# External packages
find_package(BZip2)
find_package(ZLIB)
find_package(Readline)
find_package(Editline)

# Configuration checks

include(CheckCSourceCompiles)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckIncludeFile)
include(CheckTypeSize)
include(CMakePackageConfigHelpers)
include(CMakePushCheckState)
include(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR
include(PCRE2CheckVscript)
include(PCRE2UseSystemExtensions)
include(PCRE2WarningAsError)

check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(dirent.h HAVE_DIRENT_H)
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(windows.h HAVE_WINDOWS_H)

# Check whether any system-wide extensions need to be enabled, in order for
# OS functionality to be exposed.
pcre2_use_system_extensions()

cmake_push_check_state(RESET)
# Propagate the _GNU_SOURCE definition (added to COMPILE_DEFINITIONS by
# pcre2_use_system_extensions()) so that these check_symbol_exists() calls
# can find symbols only exposed with _GNU_SOURCE.
# We only pass through known plain-text definitions (like _GNU_SOURCE) and
# skip anything else (e.g. generator expressions inherited from a parent
# project), because try_compile() cannot handle generator expressions.
get_directory_property(_pcre2_compile_definitions COMPILE_DEFINITIONS)
if(DEFINED _pcre2_compile_definitions)
  set(CMAKE_REQUIRED_DEFINITIONS "")
  list(FIND _pcre2_compile_definitions "_GNU_SOURCE" _idx)
  if(_idx GREATER -1)
    list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
  endif()
endif()

check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP) # glibc 2.7
check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE) # glibc 2.27
check_symbol_exists(secure_getenv "stdlib.h" HAVE_SECURE_GETENV) # glibc 2.17
check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT)
cmake_pop_check_state()

check_c_source_compiles(
  [=[
  #include <stdlib.h>
  #include <limits.h>
  int main(int c, char *v[]) { char buf[PATH_MAX]; realpath(v[c], buf); return 0; }
  ]=]
  HAVE_REALPATH
)

# Many CMake tests use highly-dubious C source code which generates warnings
# (for example, calling a function with the wrong signature just to see whether
# the linker can find it). These couple of tests here though need to be compiled
# with -Werror to be effective.
cmake_push_check_state()
if(NOT DEFINED CMAKE_REQUIRED_FLAGS)
  set(CMAKE_REQUIRED_FLAGS "")
endif()
pcre2_warning_as_error(WARNING_AS_ERROR_FLAGS)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${WARNING_AS_ERROR_FLAGS}")

check_c_source_compiles(
  "int main(void) { char buf[128] __attribute__((uninitialized)); (void)buf; return 0; }"
  HAVE_ATTRIBUTE_UNINITIALIZED
)

if(NOT MSVC)
  check_c_source_compiles(
    [=[
    extern __attribute__ ((visibility ("default"))) int f(void);
    int main(void) { return f(); }
    int f(void) { return 42; }
    ]=]
    HAVE_VISIBILITY
  )
endif()
if(CMAKE_C_COMPILE_OPTIONS_VISIBILITY AND NOT HAVE_VISIBILITY)
  # Hmm. We don't know of any way to set a symbol to have default visibility, other
  # than the common "__attribute__((visibility("default")))". But CMake thinks that
  # the compiler supports CMAKE_C_VISIBILITY_PRESET. The build is likely to fail to
  # generate a usable shared library.
  message(
    WARNING
    "C compiler uses the visibility flag ${CMAKE_C_COMPILE_OPTIONS_VISIBILITY}. We did not detect support for __attribute__((visibility(\"default\"))). We do not know how to set a symbol to have default visibility."
  )
elseif(HAVE_VISIBILITY AND NOT CMAKE_C_COMPILE_OPTIONS_VISIBILITY)
  # Here, the build may well work, but it's possible that CMake isn't correctly
  # suppressing the visibility of private symbols.
  message(
    WARNING
    "C compiler appears to support __attribute__((visibility(\"default\"))). However, CMake is not using a visibility flag. The visibility of private symbols may not be correct."
  )
endif()
if(HAVE_VISIBILITY)
  set(PCRE2_EXPORT [=[__attribute__ ((visibility ("default")))]=])
else()
  set(PCRE2_EXPORT)
endif()
cmake_pop_check_state()

check_c_source_compiles("int main(void) { __assume(1); return 0; }" HAVE_BUILTIN_ASSUME)

check_c_source_compiles(
  [=[
  #include <stddef.h>
  int main(void) { int a,b; size_t m; __builtin_mul_overflow(a,b,&m); return 0; }
  ]=]
  HAVE_BUILTIN_MUL_OVERFLOW
)

check_c_source_compiles(
  "int main(int c, char *v[]) { if (c) __builtin_unreachable(); return (int)(*v[0]); }"
  HAVE_BUILTIN_UNREACHABLE
)

# Detect support for linker scripts.

pcre2_check_vscript(HAVE_VSCRIPT VSCRIPT_FLAG HAVE_VSCRIPT_NO_STAR)

# Check whether Intel CET is enabled, and if so, adjust compiler flags. This
# code was written by PH, trying to imitate the logic from the autotools
# configuration.

check_c_source_compiles(
  [=[
  #ifndef __CET__
  #error CET is not enabled
  #endif
  int main() { return 0; }
  ]=]
  INTEL_CET_ENABLED
)

if(INTEL_CET_ENABLED)
  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mshstk")
endif()

# User-configurable options
#
# Note: CMakeSetup displays these in alphabetical order, regardless of
# the order we use here.

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)

option(PCRE2_BUILD_PCRE2_16 "Build 16 bit PCRE2 library" OFF)

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)

set(PCRE2_DEBUG "IfDebugBuild" CACHE STRING "Include debugging code")
set_property(CACHE PCRE2_DEBUG PROPERTY STRINGS "IfDebugBuild" "ON" "OFF")

option(PCRE2_DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF)

set(
  PCRE2_EBCDIC
  OFF
  CACHE BOOL
  "Use EBCDIC coding instead of ASCII. (This is rarely used outside of mainframe systems.)"
)

set(PCRE2_EBCDIC_NL25 OFF CACHE BOOL "Use 0x25 as EBCDIC NL character instead of 0x15; implies EBCDIC.")

set(
  PCRE2_EBCDIC_IGNORING_COMPILER
  OFF
  CACHE BOOL
  "Force EBCDIC 1047 using numeric literals rather than C character literals; implies EBCDIC."
)

option(PCRE2_REBUILD_CHARTABLES "Rebuild char tables" OFF)

set(
  PCRE2_LINK_SIZE
  "2"
  CACHE STRING
  "Internal link size (2, 3 or 4 allowed). See LINK_SIZE in config.h.in for details."
)

set(
  PCRE2_PARENS_NEST_LIMIT
  "250"
  CACHE STRING
  "Default nested parentheses limit. See PARENS_NEST_LIMIT in config.h.in for details."
)

set(
  PCRE2_HEAP_LIMIT
  "20000000"
  CACHE STRING
  "Default limit on heap memory (kibibytes). See HEAP_LIMIT in config.h.in for details."
)

set(PCRE2_MAX_VARLOOKBEHIND "255" CACHE STRING "Default limit on variable lookbehinds.")

set(
  PCRE2_MATCH_LIMIT
  "10000000"
  CACHE STRING
  "Default limit on internal looping. See MATCH_LIMIT in config.h.in for details."
)

set(
  PCRE2_MATCH_LIMIT_DEPTH
  "MATCH_LIMIT"
  CACHE STRING
  "Default limit on internal depth of search. See MATCH_LIMIT_DEPTH in config.h.in for details."
)

set(
  PCRE2GREP_BUFSIZE
  "20480"
  CACHE STRING
  "Buffer starting size parameter for pcre2grep. See PCRE2GREP_BUFSIZE in config.h.in for details."
)

set(
  PCRE2GREP_MAX_BUFSIZE
  "1048576"
  CACHE STRING
  "Buffer maximum size parameter for pcre2grep. See PCRE2GREP_MAX_BUFSIZE in config.h.in for details."
)

set(PCRE2_NEWLINE "LF" CACHE STRING "What to recognize as a newline (one of CR, LF, CRLF, ANY, ANYCRLF, NUL).")

set(PCRE2_HEAP_MATCH_RECURSE OFF CACHE BOOL "Obsolete option: do not use")
mark_as_advanced(PCRE2_HEAP_MATCH_RECURSE)

set(PCRE2_SUPPORT_JIT OFF CACHE BOOL "Enable support for Just-in-time compiling.")

if(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD)
  set(PCRE2_SUPPORT_JIT_SEALLOC OFF CACHE BOOL "Enable SELinux compatible execmem allocator in JIT (experimental).")
else()
  set(PCRE2_SUPPORT_JIT_SEALLOC IGNORE)
endif()

set(PCRE2GREP_SUPPORT_JIT ON CACHE BOOL "Enable use of Just-in-time compiling in pcre2grep.")

set(PCRE2GREP_SUPPORT_CALLOUT ON CACHE BOOL "Enable callout string support in pcre2grep.")

set(PCRE2GREP_SUPPORT_CALLOUT_FORK ON CACHE BOOL "Enable callout string fork support in pcre2grep.")

set(PCRE2_SUPPORT_UNICODE ON CACHE BOOL "Enable support for Unicode and UTF-8/UTF-16/UTF-32 encoding.")

set(
  PCRE2_SUPPORT_BSR_ANYCRLF
  OFF
  CACHE BOOL
  "ON=Backslash-R matches only LF CR and CRLF, OFF=Backslash-R matches all Unicode Linebreaks"
)

set(PCRE2_NEVER_BACKSLASH_C OFF CACHE BOOL "If ON, backslash-C (upper case C) is locked out.")

set(PCRE2_SUPPORT_VALGRIND OFF CACHE BOOL "Enable Valgrind support.")

option(PCRE2_SHOW_REPORT "Show the final configuration report" ON)
option(PCRE2_BUILD_PCRE2GREP "Build pcre2grep" ON)
option(PCRE2_BUILD_TESTS "Build the tests" ON)

set(
  PCRE2_INSTALL_CMAKEDIR
  "${CMAKE_INSTALL_LIBDIR}/cmake/pcre2"
  CACHE STRING
  "Path used during CMake install for placing PCRE2's CMake config files, relative to the installation root (prefix)"
)

if(MINGW)
  option(
    NON_STANDARD_LIB_PREFIX
    "ON=Shared libraries built in mingw will be named pcre2.dll, etc., instead of libpcre2.dll, etc."
    OFF
  )

  option(
    NON_STANDARD_LIB_SUFFIX
    "ON=Shared libraries built in mingw will be named libpcre2-0.dll, etc., instead of libpcre2.dll, etc."
    OFF
  )
endif()

if(MSVC)
  option(INSTALL_MSVC_PDB "ON=Install .pdb files built by MSVC, if generated" OFF)
endif()

if(HAVE_VSCRIPT)
  option(PCRE2_SYMVERS "Enable library symbol versioning" ON)
endif()

# bzip2 lib
if(BZip2_FOUND)
  option(PCRE2_SUPPORT_LIBBZ2 "Enable support for linking pcre2grep with libbz2." ON)
endif()

# zlib
if(ZLIB_FOUND)
  option(PCRE2_SUPPORT_LIBZ "Enable support for linking pcre2grep with libz." ON)
endif()

# editline lib
if(Editline_FOUND)
  option(PCRE2_SUPPORT_LIBEDIT "Enable support for linking pcre2test with libedit." OFF)
endif()

# readline lib
if(Readline_FOUND)
  option(PCRE2_SUPPORT_LIBREADLINE "Enable support for linking pcre2test with libreadline." ON)
endif()

# Prepare build configuration

include_directories(${PROJECT_BINARY_DIR}/interface ${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src)

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()

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"
  )
endif()

if(PCRE2_BUILD_PCRE2_8)
  set(SUPPORT_PCRE2_8 1)
endif()

if(PCRE2_BUILD_PCRE2_16)
  set(SUPPORT_PCRE2_16 1)
endif()

if(PCRE2_BUILD_PCRE2_32)
  set(SUPPORT_PCRE2_32 1)
endif()

if(PCRE2_BUILD_PCRE2GREP AND NOT PCRE2_BUILD_PCRE2_8)
  message(STATUS "** PCRE2_BUILD_PCRE2_8 must be enabled for the pcre2grep program")
  set(PCRE2_BUILD_PCRE2GREP OFF)
endif()

if(PCRE2_SUPPORT_LIBBZ2)
  if(BZip2_FOUND)
    include_directories(${BZIP2_INCLUDE_DIRS})
  else()
    message(
      FATAL_ERROR
      " libbz2 not found. Set BZIP2_INCLUDE_DIRS to a compatible header\n"
      " or set BZip2_ROOT to a full bzip2 installed tree, as needed."
    )
  endif()
endif()

if(PCRE2_SUPPORT_LIBZ)
  if(ZLIB_FOUND)
    include_directories(${ZLIB_INCLUDE_DIRS})
  else()
    message(
      FATAL_ERROR
      " zlib not found. Set ZLIB_INCLUDE_DIRS to a compatible header\n"
      " or set ZLIB_ROOT to a full zlib installed tree, as needed."
    )
  endif()
endif()

if(PCRE2_SUPPORT_LIBEDIT)
  if(Editline_FOUND)
    include_directories(${EDITLINE_INCLUDE_DIRS})
  else()
    message(
      FATAL_ERROR
      " libedit not found. Set EDITLINE_INCLUDE_DIRS to a compatible header\n"
      " or set Editline_ROOT to a full libedit installed tree, as needed."
    )
  endif()
endif()

if(PCRE2_SUPPORT_LIBREADLINE)
  if(Readline_FOUND)
    include_directories(${READLINE_INCLUDE_DIRS})
  else()
    message(
      FATAL_ERROR
      " libreadline not found. Set READLINE_INCLUDE_DIRS to a compatible header\n"
      " or set Readline_ROOT to a full libreadline installed tree, as needed."
    )
  endif()
endif()

if(PCRE2_SUPPORT_LIBREADLINE AND PCRE2_SUPPORT_LIBEDIT)
  if(Readline_FOUND)
    message(
      FATAL_ERROR
      " Only one of the readline compatible libraries can be enabled.\n"
      " Disable libreadline with -DPCRE2_SUPPORT_LIBREADLINE=OFF"
    )
  endif()
endif()

if(PCRE2_SUPPORT_BSR_ANYCRLF)
  set(BSR_ANYCRLF 1)
endif()

if(PCRE2_NEVER_BACKSLASH_C)
  set(NEVER_BACKSLASH_C 1)
endif()

if(PCRE2_SUPPORT_UNICODE)
  set(SUPPORT_UNICODE 1)
endif()

if(PCRE2_SUPPORT_JIT)
  set(SUPPORT_JIT 1)
  if(UNIX)
    find_package(Threads REQUIRED)
    if(CMAKE_USE_PTHREADS_INIT)
      set(REQUIRE_PTHREAD 1)
    endif()
  endif()
endif()

if(PCRE2_SUPPORT_JIT_SEALLOC)
  set(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1)
endif()

if(PCRE2GREP_SUPPORT_JIT)
  set(SUPPORT_PCRE2GREP_JIT 1)
endif()

if(PCRE2GREP_SUPPORT_CALLOUT)
  set(SUPPORT_PCRE2GREP_CALLOUT 1)
  if(PCRE2GREP_SUPPORT_CALLOUT_FORK)
    set(SUPPORT_PCRE2GREP_CALLOUT_FORK 1)
  endif()
endif()

if(PCRE2_SUPPORT_VALGRIND)
  set(SUPPORT_VALGRIND 1)
endif()

if(PCRE2_DISABLE_PERCENT_ZT)
  set(DISABLE_PERCENT_ZT 1)
endif()

set(PCRE2TEST_LIBS)
set(PCRE2GREP_LIBS)

if(PCRE2_SUPPORT_LIBREADLINE)
  set(SUPPORT_LIBREADLINE 1)
  list(APPEND PCRE2TEST_LIBS ${READLINE_LIBRARIES})
endif()

# libedit is a plug-compatible alternative to libreadline

if(PCRE2_SUPPORT_LIBEDIT)
  set(SUPPORT_LIBEDIT 1)
  list(APPEND PCRE2TEST_LIBS ${EDITLINE_LIBRARIES})
endif()

if(PCRE2_SUPPORT_LIBZ)
  set(SUPPORT_LIBZ 1)
  list(APPEND PCRE2GREP_LIBS ${ZLIB_LIBRARIES})
endif()

if(PCRE2_SUPPORT_LIBBZ2)
  set(SUPPORT_LIBBZ2 1)
  list(APPEND PCRE2GREP_LIBS ${BZIP2_LIBRARIES})
endif()

set(NEWLINE_DEFAULT "")

if(PCRE2_NEWLINE STREQUAL "CR")
  set(NEWLINE_DEFAULT "1")
endif()
if(PCRE2_NEWLINE STREQUAL "LF")
  set(NEWLINE_DEFAULT "2")
endif()
if(PCRE2_NEWLINE STREQUAL "CRLF")
  set(NEWLINE_DEFAULT "3")
endif()
if(PCRE2_NEWLINE STREQUAL "ANY")
  set(NEWLINE_DEFAULT "4")
endif()
if(PCRE2_NEWLINE STREQUAL "ANYCRLF")
  set(NEWLINE_DEFAULT "5")
endif()
if(PCRE2_NEWLINE STREQUAL "NUL")
  set(NEWLINE_DEFAULT "6")
endif()

if(NEWLINE_DEFAULT STREQUAL "")
  message(
    FATAL_ERROR
    "The PCRE2_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\"."
  )
endif()

set(REBUILD_CHARTABLES OFF)
if(PCRE2_REBUILD_CHARTABLES)
  set(REBUILD_CHARTABLES ON)
endif()

set(EBCDIC OFF)
if(PCRE2_EBCDIC)
  set(EBCDIC ON)
endif()

if(PCRE2_EBCDIC_NL25)
  set(EBCDIC ON)
  set(EBCDIC_NL25 ON)
endif()

if(PCRE2_EBCDIC_IGNORING_COMPILER)
  set(EBCDIC ON)
  set(EBCDIC_IGNORING_COMPILER ON)
endif()

# Make sure that if EBCDIC is set (without EBCDIC_IGNORING_COMPILER), then
# REBUILD_CHARTABLES is also enabled.
# Also check that UTF support is not requested, because PCRE2 cannot handle
# EBCDIC and UTF in the same build. To do so it would need to use different
# character constants depending on the mode.
# Also, EBCDIC cannot be used with 16-bit and 32-bit libraries.
if(EBCDIC)
  if(NOT EBCDIC_IGNORING_COMPILER)
    set(REBUILD_CHARTABLES ON)
  endif()
  if(PCRE2_SUPPORT_UNICODE)
    message(FATAL_ERROR "Support for EBCDIC and Unicode cannot be enabled at the same time")
  endif()
  if(PCRE2_BUILD_PCRE2_16 OR PCRE2_BUILD_PCRE2_32)
    message(FATAL_ERROR "EBCDIC support is available only for the 8-bit library")
  endif()
endif()

# Remove the Autotools-generated copy of config.h and pcre2.h. I sometimes switch
# between Autoconf and CMake, and the conflicting copies of config.h generate some
# very unintuitive build errors.
file(REMOVE ${PROJECT_SOURCE_DIR}/src/config.h)
file(REMOVE ${PROJECT_SOURCE_DIR}/src/pcre2.h)

# Parse version numbers and date out of configure.ac

file(
  STRINGS
  ${PROJECT_SOURCE_DIR}/configure.ac
  configure_lines
  LIMIT_COUNT
    50 # Read only the first 50 lines of the file
)

set(
  SEARCHED_VARIABLES
  "pcre2_major"
  "pcre2_minor"
  "pcre2_prerelease"
  "pcre2_date"
  "libpcre2_posix_version"
  "libpcre2_8_version"
  "libpcre2_16_version"
  "libpcre2_32_version"
)
foreach(configure_line ${configure_lines})
  foreach(substitution_variable ${SEARCHED_VARIABLES})
    string(TOUPPER ${substitution_variable} substitution_variable_upper)
    if(NOT DEFINED ${substitution_variable_upper})
      if("${configure_line}" MATCHES "m4_define\\(${substitution_variable}, *\\[(.*)\\]")
        set(${substitution_variable_upper} "${CMAKE_MATCH_1}")
      endif()
    endif()
  endforeach()
endforeach()

macro(PARSE_LIB_VERSION variable_prefix)
  string(REPLACE ":" ";" ${variable_prefix}_VERSION_LIST ${${variable_prefix}_VERSION})
  list(GET ${variable_prefix}_VERSION_LIST 0 ${variable_prefix}_VERSION_CURRENT)
  list(GET ${variable_prefix}_VERSION_LIST 1 ${variable_prefix}_VERSION_REVISION)
  list(GET ${variable_prefix}_VERSION_LIST 2 ${variable_prefix}_VERSION_AGE)

  math(EXPR ${variable_prefix}_SOVERSION "${${variable_prefix}_VERSION_CURRENT} - ${${variable_prefix}_VERSION_AGE}")
  math(EXPR ${variable_prefix}_MACHO_COMPATIBILITY_VERSION "${${variable_prefix}_VERSION_CURRENT} + 1")
  math(EXPR ${variable_prefix}_MACHO_CURRENT_VERSION "${${variable_prefix}_VERSION_CURRENT} + 1")
  set(
    ${variable_prefix}_MACHO_CURRENT_VERSION
    "${${variable_prefix}_MACHO_CURRENT_VERSION}.${${variable_prefix}_VERSION_REVISION}}"
  )
  set(
    ${variable_prefix}_VERSION
    "${${variable_prefix}_SOVERSION}.${${variable_prefix}_VERSION_AGE}.${${variable_prefix}_VERSION_REVISION}"
  )
endmacro()

parse_lib_version(LIBPCRE2_POSIX)
parse_lib_version(LIBPCRE2_8)
parse_lib_version(LIBPCRE2_16)
parse_lib_version(LIBPCRE2_32)

# Output files

configure_file(src/config-cmake.h.in ${PROJECT_BINARY_DIR}/src/config.h @ONLY)

configure_file(src/pcre2.h.in ${PROJECT_BINARY_DIR}/interface/pcre2.h @ONLY)
configure_file(src/pcre2posix.h ${PROJECT_BINARY_DIR}/interface/pcre2posix.h COPYONLY)

# Configure the version script files.

if(HAVE_VSCRIPT AND PCRE2_SYMVERS)
  if(HAVE_VSCRIPT_NO_STAR)
    set(PCRE2_EXTRA_LOCAL_SYMS "")
  else()
    set(PCRE2_EXTRA_LOCAL_SYMS "  local: *;")
  endif()

  configure_file(src/libpcre2-8.sym.in ${PROJECT_BINARY_DIR}/src/libpcre2-8.sym @ONLY)
  configure_file(src/libpcre2-16.sym.in ${PROJECT_BINARY_DIR}/src/libpcre2-16.sym @ONLY)
  configure_file(src/libpcre2-32.sym.in ${PROJECT_BINARY_DIR}/src/libpcre2-32.sym @ONLY)
  configure_file(src/libpcre2-posix.sym.in ${PROJECT_BINARY_DIR}/src/libpcre2-posix.sym @ONLY)
endif()

# Character table generation

if(REBUILD_CHARTABLES)
  add_executable(pcre2_dftables src/pcre2_dftables.c)
  add_custom_command(
    OUTPUT ${PROJECT_BINARY_DIR}/src/pcre2_chartables.c
    COMMAND pcre2_dftables
    ARGS ${PROJECT_BINARY_DIR}/src/pcre2_chartables.c
    DEPENDS pcre2_dftables
    COMMENT "Generating character tables (pcre2_chartables.c) for current locale"
    VERBATIM
  )
elseif(NOT PCRE2_EBCDIC)
  configure_file(
    ${PROJECT_SOURCE_DIR}/src/pcre2_chartables.c.dist
    ${PROJECT_BINARY_DIR}/src/pcre2_chartables.c
    COPYONLY
  )
elseif(PCRE2_EBCDIC_NL25)
  configure_file(
    ${PROJECT_SOURCE_DIR}/src/pcre2_chartables.c.ebcdic-1047-nl25
    ${PROJECT_BINARY_DIR}/src/pcre2_chartables.c
    COPYONLY
  )
else()
  configure_file(
    ${PROJECT_SOURCE_DIR}/src/pcre2_chartables.c.ebcdic-1047-nl15
    ${PROJECT_BINARY_DIR}/src/pcre2_chartables.c
    COPYONLY
  )
endif()

# Source code

set(PCRE2_HEADERS ${PROJECT_BINARY_DIR}/interface/pcre2.h)

set(
  PCRE2_SOURCES
  src/pcre2_auto_possess.c
  ${PROJECT_BINARY_DIR}/src/pcre2_chartables.c
  src/pcre2_chkdint.c
  src/pcre2_compile.c
  src/pcre2_compile_cgroup.c
  src/pcre2_compile_class.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_jit_compile.c
  src/pcre2_maketables.c
  src/pcre2_match.c
  src/pcre2_match_data.c
  src/pcre2_match_next.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
)

set(PCRE2POSIX_HEADERS ${PROJECT_BINARY_DIR}/interface/pcre2posix.h)
set(PCRE2POSIX_SOURCES src/pcre2posix.c)

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"
    )
    list(APPEND PCRE2_SOURCES ${PROJECT_SOURCE_DIR}/pcre2.o)
  endif()

  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"
    )
    list(APPEND PCRE2POSIX_SOURCES ${PROJECT_SOURCE_DIR}/pcre2posix.o)
  endif()
endif()

if(MSVC AND BUILD_SHARED_LIBS)
  if(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
    list(APPEND PCRE2_SOURCES pcre2.rc)
  endif()

  if(EXISTS ${PROJECT_SOURCE_DIR}/pcre2posix.rc)
    list(APPEND PCRE2POSIX_SOURCES pcre2posix.rc)
  endif()
endif()

# Build setup

add_compile_definitions(HAVE_CONFIG_H)

if(PCRE2_DEBUG STREQUAL "IfDebugBuild")
  add_compile_definitions("$<$<CONFIG:Debug>:PCRE2_DEBUG>")
elseif(PCRE2_DEBUG)
  add_compile_definitions("PCRE2_DEBUG")
endif()

if(MSVC)
  add_compile_definitions(_CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS)
endif()

# Make sure to not link debug libs against release libs and vice versa.
if(WIN32)
  set(CMAKE_DEBUG_POSTFIX "d")
endif()

set(TARGETS)
set(DLL_PDB_FILES)
set(DLL_PDB_DEBUG_FILES)

# 8-bit library

if(PCRE2_BUILD_PCRE2_8)
  if(BUILD_STATIC_LIBS)
    add_library(pcre2-8-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES})
    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)
    target_include_directories(
      pcre2-8-static
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    if(REQUIRE_PTHREAD)
      target_link_libraries(pcre2-8-static Threads::Threads)
    endif()
    list(APPEND 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_include_directories(
      pcre2-posix-static
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    list(APPEND TARGETS pcre2-posix-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()
      set_target_properties(pcre2-8-static PROPERTIES OUTPUT_NAME pcre2-8)
      set_target_properties(pcre2-posix-static PROPERTIES OUTPUT_NAME pcre2-posix)
    endif()
    if(PCRE2_STATIC_PIC)
      set_target_properties(pcre2-8-static pcre2-posix-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
    endif()
  endif()

  if(BUILD_SHARED_LIBS)
    add_library(pcre2-8-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES})
    target_include_directories(
      pcre2-8-shared
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    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
    )
    if(REQUIRE_PTHREAD)
      target_link_libraries(pcre2-8-shared Threads::Threads)
    endif()
    if(HAVE_VSCRIPT AND PCRE2_SYMVERS)
      target_link_options(pcre2-8-shared PRIVATE -Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/src/libpcre2-8.sym)
      set_target_properties(pcre2-8-shared PROPERTIES LINK_DEPENDS ${PROJECT_BINARY_DIR}/src/libpcre2-8.sym)
    endif()
    list(APPEND TARGETS pcre2-8-shared)
    list(APPEND DLL_PDB_FILES $<TARGET_PDB_FILE_DIR:pcre2-8-shared>/pcre2-8.pdb)
    list(APPEND DLL_PDB_DEBUG_FILES $<TARGET_PDB_FILE_DIR:pcre2-8-shared>/pcre2-8d.pdb)

    add_library(pcre2-posix-shared SHARED ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
    target_include_directories(
      pcre2-posix-shared
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    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
    )
    if(HAVE_VSCRIPT AND PCRE2_SYMVERS)
      target_link_options(pcre2-posix-shared PRIVATE -Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/src/libpcre2-posix.sym)
      set_target_properties(pcre2-posix-shared PROPERTIES LINK_DEPENDS ${PROJECT_BINARY_DIR}/src/libpcre2-posix.sym)
    endif()
    target_compile_definitions(pcre2-posix-shared PUBLIC PCRE2POSIX_SHARED)
    target_link_libraries(pcre2-posix-shared pcre2-8-shared)
    list(APPEND TARGETS pcre2-posix-shared)
    list(APPEND DLL_PDB_FILES $<TARGET_PDB_FILE_DIR:pcre2-posix-shared>/pcre2-posix.pdb)
    list(APPEND DLL_PDB_DEBUG_FILES $<TARGET_PDB_FILE_DIR:pcre2-posix-shared>/pcre2-posixd.pdb)

    if(MINGW)
      if(NON_STANDARD_LIB_PREFIX)
        set_target_properties(pcre2-8-shared pcre2-posix-shared PROPERTIES PREFIX "")
      endif()
      if(NON_STANDARD_LIB_SUFFIX)
        set_target_properties(pcre2-8-shared pcre2-posix-shared PROPERTIES SUFFIX "-0.dll")
      endif()
    endif()
  endif()

  if(BUILD_STATIC_LIBS)
    add_library(pcre2-8 ALIAS pcre2-8-static)
    add_library(pcre2-posix ALIAS pcre2-posix-static)
  else()
    add_library(pcre2-8 ALIAS pcre2-8-shared)
    add_library(pcre2-posix ALIAS pcre2-posix-shared)
  endif()
endif()

# 16-bit library

if(PCRE2_BUILD_PCRE2_16)
  if(BUILD_STATIC_LIBS)
    add_library(pcre2-16-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES})
    target_include_directories(
      pcre2-16-static
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    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)
    if(REQUIRE_PTHREAD)
      target_link_libraries(pcre2-16-static Threads::Threads)
    endif()
    list(APPEND TARGETS pcre2-16-static)

    if(MSVC)
      set_target_properties(pcre2-16-static PROPERTIES OUTPUT_NAME pcre2-16-static)
    else()
      set_target_properties(pcre2-16-static PROPERTIES OUTPUT_NAME pcre2-16)
    endif()
    if(PCRE2_STATIC_PIC)
      set_target_properties(pcre2-16-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
    endif()
  endif()

  if(BUILD_SHARED_LIBS)
    add_library(pcre2-16-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES})
    target_include_directories(
      pcre2-16-shared
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    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
    )
    if(REQUIRE_PTHREAD)
      target_link_libraries(pcre2-16-shared Threads::Threads)
    endif()
    if(HAVE_VSCRIPT AND PCRE2_SYMVERS)
      target_link_options(pcre2-16-shared PRIVATE -Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/src/libpcre2-16.sym)
      set_target_properties(pcre2-16-shared PROPERTIES LINK_DEPENDS ${PROJECT_BINARY_DIR}/src/libpcre2-16.sym)
    endif()
    list(APPEND TARGETS pcre2-16-shared)
    list(APPEND DLL_PDB_FILES $<TARGET_PDB_FILE_DIR:pcre2-16-shared>/pcre2-16.pdb)
    list(APPEND DLL_PDB_DEBUG_FILES $<TARGET_PDB_FILE_DIR:pcre2-16-shared>/pcre2-16d.pdb)

    if(MINGW)
      if(NON_STANDARD_LIB_PREFIX)
        set_target_properties(pcre2-16-shared PROPERTIES PREFIX "")
      endif()
      if(NON_STANDARD_LIB_SUFFIX)
        set_target_properties(pcre2-16-shared PROPERTIES SUFFIX "-0.dll")
      endif()
    endif()
  endif()

  if(BUILD_STATIC_LIBS)
    add_library(pcre2-16 ALIAS pcre2-16-static)
  else()
    add_library(pcre2-16 ALIAS pcre2-16-shared)
  endif()
endif()

# 32-bit library

if(PCRE2_BUILD_PCRE2_32)
  if(BUILD_STATIC_LIBS)
    add_library(pcre2-32-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES})
    target_include_directories(
      pcre2-32-static
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    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)
    if(REQUIRE_PTHREAD)
      target_link_libraries(pcre2-32-static Threads::Threads)
    endif()
    list(APPEND TARGETS pcre2-32-static)

    if(MSVC)
      set_target_properties(pcre2-32-static PROPERTIES OUTPUT_NAME pcre2-32-static)
    else()
      set_target_properties(pcre2-32-static PROPERTIES OUTPUT_NAME pcre2-32)
    endif()
    if(PCRE2_STATIC_PIC)
      set_target_properties(pcre2-32-static PROPERTIES POSITION_INDEPENDENT_CODE 1)
    endif()
  endif()

  if(BUILD_SHARED_LIBS)
    add_library(pcre2-32-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES})
    target_include_directories(
      pcre2-32-shared
      PUBLIC "$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/interface>" "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
    )
    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
    )
    if(REQUIRE_PTHREAD)
      target_link_libraries(pcre2-32-shared Threads::Threads)
    endif()
    if(HAVE_VSCRIPT AND PCRE2_SYMVERS)
      target_link_options(pcre2-32-shared PRIVATE -Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/src/libpcre2-32.sym)
      set_target_properties(pcre2-32-shared PROPERTIES LINK_DEPENDS ${PROJECT_BINARY_DIR}/src/libpcre2-32.sym)
    endif()
    list(APPEND TARGETS pcre2-32-shared)
    list(APPEND DLL_PDB_FILES $<TARGET_PDB_FILE_DIR:pcre2-32-shared>/pcre2-32.pdb)
    list(APPEND DLL_PDB_DEBUG_FILES $<TARGET_PDB_FILE_DIR:pcre2-32-shared>/pcre2-32d.pdb)

    if(MINGW)
      if(NON_STANDARD_LIB_PREFIX)
        set_target_properties(pcre2-32-shared PROPERTIES PREFIX "")
      endif()
      if(NON_STANDARD_LIB_SUFFIX)
        set_target_properties(pcre2-32-shared PROPERTIES SUFFIX "-0.dll")
      endif()
    endif()
  endif()

  if(BUILD_STATIC_LIBS)
    add_library(pcre2-32 ALIAS pcre2-32-static)
  else()
    add_library(pcre2-32 ALIAS pcre2-32-shared)
  endif()
endif()

# Generate pkg-config files

set(PACKAGE_VERSION "${PCRE2_MAJOR}.${PCRE2_MINOR}")
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
set(includedir "\${prefix}/include")

set(LIB_POSTFIX "")
if(WIN32 AND (CMAKE_BUILD_TYPE MATCHES Debug))
  set(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
endif()

set(PCRE2_STATIC_CFLAG "")
if(NOT BUILD_SHARED_LIBS)
  set(PCRE2_STATIC_CFLAG "-DPCRE2_STATIC")
endif()

set(PCRE2POSIX_CFLAG "")
if(BUILD_SHARED_LIBS)
  set(PCRE2POSIX_CFLAG "-DPCRE2POSIX_SHARED")
endif()

set(PTHREAD_CFLAGS "")
set(PTHREAD_LIBS "")
if(REQUIRE_PTHREAD)
  set(PTHREAD_CFLAGS "$<TARGET_PROPERTY:Threads::Threads,INTERFACE_COMPILE_OPTIONS>")
  set(PTHREAD_LIBS "$<TARGET_PROPERTY:Threads::Threads,INTERFACE_LINK_LIBRARIES>")
endif()

if(PCRE2_BUILD_PCRE2_8)
  configure_file(libpcre2-posix.pc.in libpcre2-posix.pc.generator @ONLY)
  file(GENERATE OUTPUT libpcre2-posix.pc INPUT "${PROJECT_BINARY_DIR}/libpcre2-posix.pc.generator")
  list(APPEND pkg_config_files "${PROJECT_BINARY_DIR}/libpcre2-posix.pc")
  configure_file(libpcre2-8.pc.in libpcre2-8.pc.generator @ONLY)
  file(GENERATE OUTPUT libpcre2-8.pc INPUT "${PROJECT_BINARY_DIR}/libpcre2-8.pc.generator")
  list(APPEND pkg_config_files "${PROJECT_BINARY_DIR}/libpcre2-8.pc")
  set(enable_pcre2_8 "yes")
else()
  set(enable_pcre2_8 "no")
endif()

if(PCRE2_BUILD_PCRE2_16)
  configure_file(libpcre2-16.pc.in libpcre2-16.pc.generator @ONLY)
  file(GENERATE OUTPUT libpcre2-16.pc INPUT "${PROJECT_BINARY_DIR}/libpcre2-16.pc.generator")
  list(APPEND pkg_config_files "${PROJECT_BINARY_DIR}/libpcre2-16.pc")
  set(enable_pcre2_16 "yes")
else()
  set(enable_pcre2_16 "no")
endif()

if(PCRE2_BUILD_PCRE2_32)
  configure_file(libpcre2-32.pc.in libpcre2-32.pc.generator @ONLY)
  file(GENERATE OUTPUT libpcre2-32.pc INPUT "${PROJECT_BINARY_DIR}/libpcre2-32.pc.generator")
  list(APPEND pkg_config_files "${PROJECT_BINARY_DIR}/libpcre2-32.pc")
  set(enable_pcre2_32 "yes")
else()
  set(enable_pcre2_32 "no")
endif()

configure_file(pcre2-config.in pcre2-config @ONLY NEWLINE_STYLE LF)

# Executables

if(PCRE2_BUILD_PCRE2GREP)
  add_executable(pcre2grep src/pcre2grep.c)
  set_property(TARGET pcre2grep PROPERTY COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8)
  list(APPEND TARGETS pcre2grep)
  target_link_libraries(pcre2grep pcre2-posix ${PCRE2GREP_LIBS})
endif()

# Testing

if(PCRE2_BUILD_TESTS)
  enable_testing()

  set(PCRE2TEST_SOURCES src/pcre2test.c)

  set(PCRE2TEST_LINKER_FLAGS "")
  if(MSVC)
    # This is needed to avoid a stack overflow error in the standard tests. The
    # flag should be indicated with a forward-slash instead of a hyphen, but
    # then CMake treats it as a file path.
    set(PCRE2TEST_LINKER_FLAGS -STACK:2500000)
  endif()

  add_executable(pcre2test ${PCRE2TEST_SOURCES})
  list(APPEND TARGETS pcre2test)
  if(PCRE2_BUILD_PCRE2_8)
    list(APPEND PCRE2TEST_LIBS pcre2-posix pcre2-8)
  endif()
  if(PCRE2_BUILD_PCRE2_16)
    list(APPEND PCRE2TEST_LIBS pcre2-16)
  endif()
  if(PCRE2_BUILD_PCRE2_32)
    list(APPEND PCRE2TEST_LIBS pcre2-32)
  endif()
  target_link_libraries(pcre2test ${PCRE2TEST_LIBS} ${PCRE2TEST_LINKER_FLAGS})

  if(PCRE2_BUILD_PCRE2_8)
    add_executable(pcre2posix_test src/pcre2posix_test.c)
    target_link_libraries(pcre2posix_test pcre2-posix pcre2-8)
  endif()

  if(PCRE2_SUPPORT_JIT)
    add_executable(pcre2_jit_test src/pcre2_jit_test.c)
    set(PCRE2_JIT_TEST_LIBS)
    if(PCRE2_BUILD_PCRE2_8)
      list(APPEND PCRE2_JIT_TEST_LIBS pcre2-8)
    endif()
    if(PCRE2_BUILD_PCRE2_16)
      list(APPEND PCRE2_JIT_TEST_LIBS pcre2-16)
    endif()
    if(PCRE2_BUILD_PCRE2_32)
      list(APPEND PCRE2_JIT_TEST_LIBS pcre2-32)
    endif()
    target_link_libraries(pcre2_jit_test ${PCRE2_JIT_TEST_LIBS})
  endif()

  # =================================================
  # Write out a CTest configuration file
  #
  file(
    WRITE
    ${PROJECT_BINARY_DIR}/CTestCustom.ctest
    "# This is a generated file.
MESSAGE(\"When testing is complete, review test output in the
\\\"${PROJECT_BINARY_DIR}/Testing/Temporary\\\" folder.\")
MESSAGE(\" \")
"
  )

  file(
    WRITE
    ${PROJECT_BINARY_DIR}/pcre2_test.sh
    "#! /bin/sh
# This is a generated file.
srcdir=${PROJECT_SOURCE_DIR}
pcre2test=${PROJECT_BINARY_DIR}/pcre2test
test -z \"$CMAKE_CONFIG_TYPE\" || pcre2test=${PROJECT_BINARY_DIR}/$CMAKE_CONFIG_TYPE/pcre2test
. ${PROJECT_SOURCE_DIR}/RunTest
if test \"$?\" != \"0\"; then exit 1; fi
# End
"
  )

  if(UNIX)
    add_test(pcre2_test sh ${PROJECT_BINARY_DIR}/pcre2_test.sh)
  endif()

  if(PCRE2_BUILD_PCRE2GREP)
    file(
      WRITE
      ${PROJECT_BINARY_DIR}/pcre2_grep_test.sh
      "#! /bin/sh
# This is a generated file.
srcdir=${PROJECT_SOURCE_DIR}
pcre2grep=${PROJECT_BINARY_DIR}/pcre2grep
test -z \"$CMAKE_CONFIG_TYPE\" || pcre2grep=${PROJECT_BINARY_DIR}/$CMAKE_CONFIG_TYPE/pcre2grep
pcre2test=${PROJECT_BINARY_DIR}/pcre2test
test -z \"$CMAKE_CONFIG_TYPE\" || pcre2test=${PROJECT_BINARY_DIR}/$CMAKE_CONFIG_TYPE/pcre2test
. ${PROJECT_SOURCE_DIR}/RunGrepTest
if test \"$?\" != \"0\"; then exit 1; fi
# End
"
    )

    if(UNIX)
      add_test(pcre2_grep_test sh ${PROJECT_BINARY_DIR}/pcre2_grep_test.sh)

      if(PCRE2_EBCDIC)
        # The grep tests currently fail in EBCDIC mode because the test data
        # files are in ASCII. This could be fixed properly, but for now, we
        # have very few EBCDIC users and the pcre2grep utility is hardly even
        # part of the official project artifacts.
        set_property(TEST pcre2_grep_test PROPERTY WILL_FAIL TRUE)
      endif()
    endif()
  endif()

  if(WIN32)
    # Provide environment for executing the bat file version of RunTest
    file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} winsrc)
    file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} winbin)

    file(
      WRITE
      ${PROJECT_BINARY_DIR}/pcre2_test.bat
      "\@REM This is a generated file.
\@echo off
setlocal
SET srcdir=\"${winsrc}\"
SET pcre2test=\"${winbin}\\pcre2test.exe\"
if not [%CMAKE_CONFIG_TYPE%]==[] SET pcre2test=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcre2test.exe\"
call %srcdir%\\RunTest.bat
if errorlevel 1 exit /b 1
echo RunTest.bat tests successfully completed
"
    )

    add_test(NAME pcre2_test_bat COMMAND pcre2_test.bat)
    set_tests_properties(pcre2_test_bat PROPERTIES PASS_REGULAR_EXPRESSION "RunTest\\.bat tests successfully completed")

    if(PCRE2_BUILD_PCRE2GREP)
      file(
        WRITE
        ${PROJECT_BINARY_DIR}/pcre2_grep_test.bat
        "\@REM This is a generated file.
\@echo off
setlocal
SET srcdir=\"${winsrc}\"
SET pcre2test=\"${winbin}\\pcre2test.exe\"
if not [%CMAKE_CONFIG_TYPE%]==[] SET pcre2test=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcre2test.exe\"
SET pcre2grep=\"${winbin}\\pcre2grep.exe\"
if not [%CMAKE_CONFIG_TYPE%]==[] SET pcre2grep=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcre2grep.exe\"
call %srcdir%\\RunGrepTest.bat
if errorlevel 1 exit /b 1
echo RunGrepTest.bat tests successfully completed
"
      )

      add_test(NAME pcre2_grep_test_bat COMMAND pcre2_grep_test.bat)
      set_tests_properties(
        pcre2_grep_test_bat
        PROPERTIES PASS_REGULAR_EXPRESSION "RunGrepTest\\.bat tests successfully completed"
      )
    endif()

    if(DEFINED ENV{OSTYPE})
      if("$ENV{OSTYPE}" STREQUAL "msys")
        set(MSYS2 TRUE)
      endif()
    endif()
    if(MSYS2)
      # Both the sh and bat file versions of RunTest are run if make test is used
      # in msys
      add_test(pcre2_test_sh sh.exe ${PROJECT_BINARY_DIR}/pcre2_test.sh)
      if(PCRE2_BUILD_PCRE2GREP)
        add_test(pcre2_grep_test sh.exe ${PROJECT_BINARY_DIR}/pcre2_grep_test.sh)
      endif()
    endif()
  endif()

  # Changed to accommodate testing whichever location was just built

  if(PCRE2_SUPPORT_JIT)
    add_test(pcre2_jit_test pcre2_jit_test)
  endif()

  if(PCRE2_BUILD_PCRE2_8)
    add_test(pcre2posix_test pcre2posix_test)
  endif()
endif()

# Installation

set(CMAKE_INSTALL_ALWAYS 1)

install(
  TARGETS ${TARGETS}
  EXPORT pcre2-targets
  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(EXPORT pcre2-targets DESTINATION ${PCRE2_INSTALL_CMAKEDIR} NAMESPACE pcre2::)
install(FILES ${pkg_config_files} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(
  FILES "${PROJECT_BINARY_DIR}/pcre2-config"
  DESTINATION ${CMAKE_INSTALL_BINDIR}
  # Set 0755 permissions
  PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

install(FILES ${PCRE2_HEADERS} ${PCRE2POSIX_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# CMake config files.
set(PCRE2_CONFIG_IN ${PROJECT_SOURCE_DIR}/cmake/pcre2-config.cmake.in)
set(PCRE2_CONFIG_OUT ${PROJECT_BINARY_DIR}/cmake/pcre2-config.cmake)
configure_package_config_file(${PCRE2_CONFIG_IN} ${PCRE2_CONFIG_OUT} INSTALL_DESTINATION ${PCRE2_INSTALL_CMAKEDIR})
set(PCRE2_CONFIG_VERSION_OUT ${PROJECT_BINARY_DIR}/cmake/pcre2-config-version.cmake)
write_basic_package_version_file(
  ${PCRE2_CONFIG_VERSION_OUT}
  VERSION ${PCRE2_MAJOR}.${PCRE2_MINOR}.0
  COMPATIBILITY SameMajorVersion
)
install(FILES ${PCRE2_CONFIG_OUT} ${PCRE2_CONFIG_VERSION_OUT} DESTINATION ${PCRE2_INSTALL_CMAKEDIR})

file(GLOB html ${PROJECT_SOURCE_DIR}/doc/html/*.html ${PROJECT_SOURCE_DIR}/doc/html/*.txt)
file(
  GLOB txts
  ${PROJECT_SOURCE_DIR}/doc/*.txt
  AUTHORS.md
  COPYING
  ChangeLog
  LICENCE.md
  NEWS
  README
  SECURITY.md
)
file(GLOB man1 ${PROJECT_SOURCE_DIR}/doc/*.1)
file(GLOB man3 ${PROJECT_SOURCE_DIR}/doc/*.3)

install(FILES ${man1} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install(FILES ${man3} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
install(FILES ${txts} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/pcre2)
install(FILES ${html} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/pcre2/html)

if(MSVC AND INSTALL_MSVC_PDB)
  install(FILES ${DLL_PDB_FILES} DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS RelWithDebInfo)
  install(FILES ${DLL_PDB_DEBUG_FILES} DESTINATION ${CMAKE_INSTALL_BINDIR} CONFIGURATIONS Debug)
endif()

# Help, only for nice output
if(BUILD_STATIC_LIBS)
  set(BUILD_STATIC_LIBS ON)
else()
  set(BUILD_STATIC_LIBS OFF)
endif()

if(PCRE2_HEAP_MATCH_RECURSE)
  message(WARNING "HEAP_MATCH_RECURSE is obsolete and does nothing.")
endif()

if(PCRE2_SHOW_REPORT)
  message(STATUS "")
  message(STATUS "")
  message(STATUS "PCRE2-${PCRE2_MAJOR}.${PCRE2_MINOR} configuration summary:")
  message(STATUS "")
  message(STATUS "  Install prefix .................... : ${CMAKE_INSTALL_PREFIX}")
  message(STATUS "  C compiler ........................ : ${CMAKE_C_COMPILER}")

  set(CFSP "")
  if(CMAKE_C_FLAGS)
    set(CFSP " ")
  endif()
  if(CMAKE_CONFIGURATION_TYPES)
    foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
      string(TOUPPER "${config}" buildtype)
      string(LENGTH " (${config})" buildtypelen)
      math(EXPR dotslen "18 - ${buildtypelen}")
      string(REPEAT "." ${dotslen} dots)
      message(STATUS "  C compiler flags (${config}) ${dots} : ${CMAKE_C_FLAGS}${CFSP}${CMAKE_C_FLAGS_${buildtype}}")
    endforeach()
  else()
    string(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype)
    if(buildtype STREQUAL "")
      set(CFBLD "")
    else()
      set(CFBLD "${CMAKE_C_FLAGS_${buildtype}}")
    endif()
    message(STATUS "  C compiler flags .................. : ${CMAKE_C_FLAGS}${CFSP}${CFBLD}")
  endif()

  message(STATUS "")
  if(CMAKE_CONFIGURATION_TYPES)
    message(STATUS "  Build configurations .............. : ${CMAKE_CONFIGURATION_TYPES}")
  else()
    message(STATUS "  Build type ........................ : ${CMAKE_BUILD_TYPE}")
  endif()
  message(STATUS "  Build 8 bit pcre2 library ......... : ${PCRE2_BUILD_PCRE2_8}")
  message(STATUS "  Build 16 bit pcre2 library ........ : ${PCRE2_BUILD_PCRE2_16}")
  message(STATUS "  Build 32 bit pcre2 library ........ : ${PCRE2_BUILD_PCRE2_32}")
  message(STATUS "  Include debugging code ............ : ${PCRE2_DEBUG}")
  message(STATUS "  Enable JIT compiling support ...... : ${PCRE2_SUPPORT_JIT}")
  message(STATUS "  Use SELinux allocator in JIT ...... : ${PCRE2_SUPPORT_JIT_SEALLOC}")
  message(STATUS "  Enable Unicode support ............ : ${PCRE2_SUPPORT_UNICODE}")
  message(STATUS "  Newline char/sequence ............. : ${PCRE2_NEWLINE}")
  message(STATUS "  \\R matches only ANYCRLF ........... : ${PCRE2_SUPPORT_BSR_ANYCRLF}")
  message(STATUS "  \\C is disabled .................... : ${PCRE2_NEVER_BACKSLASH_C}")

  if(NOT EBCDIC)
    set(EBCDIC_NL_CODE "n/a")
  elseif(EBCDIC_NL25)
    set(EBCDIC_NL_CODE "0x25")
  else()
    set(EBCDIC_NL_CODE "0x15")
  endif()
  message(STATUS "  EBCDIC coding ..................... : ${EBCDIC}")
  message(STATUS "  EBCDIC code for NL ................ : ${EBCDIC_NL_CODE}")
  message(STATUS "  EBCDIC coding ignoring compiler ... : ${PCRE2_EBCDIC_IGNORING_COMPILER}")
  message(STATUS "  Rebuild char tables ............... : ${REBUILD_CHARTABLES}")

  message(STATUS "  Internal link size ................ : ${PCRE2_LINK_SIZE}")
  message(STATUS "  Maximum variable lookbehind ....... : ${PCRE2_MAX_VARLOOKBEHIND}")
  message(STATUS "  Nested parentheses limit .......... : ${PCRE2_PARENS_NEST_LIMIT}")
  message(STATUS "  Heap limit ........................ : ${PCRE2_HEAP_LIMIT}")
  message(STATUS "  Match limit ....................... : ${PCRE2_MATCH_LIMIT}")
  message(STATUS "  Match depth limit ................. : ${PCRE2_MATCH_LIMIT_DEPTH}")
  message(STATUS "  Build shared libs ................. : ${BUILD_SHARED_LIBS}")
  if(NOT HAVE_VSCRIPT)
    message(STATUS "      with symbol versioning ........ : n/a")
  else()
    message(STATUS "      with symbol versioning ........ : ${PCRE2_SYMVERS}")
  endif()
  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}")
  message(STATUS "  Enable callout fork in pcre2grep .. : ${PCRE2GREP_SUPPORT_CALLOUT_FORK}")
  message(STATUS "  Initial buffer size for pcre2grep . : ${PCRE2GREP_BUFSIZE}")
  message(STATUS "  Maximum buffer size for pcre2grep . : ${PCRE2GREP_MAX_BUFSIZE}")
  message(STATUS "  Build tests (implies pcre2test .... : ${PCRE2_BUILD_TESTS}")
  message(STATUS "               and pcre2grep)")
  if(ZLIB_FOUND)
    message(STATUS "  Link pcre2grep with libz .......... : ${PCRE2_SUPPORT_LIBZ}")
  else()
    message(STATUS "  Link pcre2grep with libz .......... : Library not found")
  endif()
  if(BZip2_FOUND)
    message(STATUS "  Link pcre2grep with libbz2 ........ : ${PCRE2_SUPPORT_LIBBZ2}")
  else()
    message(STATUS "  Link pcre2grep with libbz2 ........ : Library not found")
  endif()
  if(Editline_FOUND)
    message(STATUS "  Link pcre2test with libeditline ... : ${PCRE2_SUPPORT_LIBEDIT}")
  else()
    message(STATUS "  Link pcre2test with libeditline ... : Library not found")
  endif()
  if(Readline_FOUND)
    message(STATUS "  Link pcre2test with libreadline ... : ${PCRE2_SUPPORT_LIBREADLINE}")
  else()
    message(STATUS "  Link pcre2test with libreadline ... : Library not found")
  endif()
  message(STATUS "  Enable Valgrind support ........... : ${PCRE2_SUPPORT_VALGRIND}")
  if(PCRE2_DISABLE_PERCENT_ZT)
    message(STATUS "  Use %zu and %td ................... : OFF")
  else()
    message(STATUS "  Use %zu and %td ................... : AUTO")
  endif()

  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()

  if(MSVC)
    message(STATUS "  Install MSVC .pdb files ........... : ${INSTALL_MSVC_PDB}")
  endif()

  message(STATUS "")
endif()

# end CMakeLists.txt


================================================
FILE: COPYING
================================================
PCRE2 LICENCE

Please see the file LICENCE in the PCRE2 distribution for licensing details.

End


================================================
FILE: ChangeLog
================================================
Change Log for PCRE2
--------------------

Before the move to GitHub, this was the only record of changes to PCRE2. Now
there is also the log of commit messages.

Internal changes which are not visible to clients of the library are mostly not
listed here.

Version 10.48 xx-xxx-2026
-------------------------

...


Version 10.47 21-October-2025
-----------------------------

1. (#660, #655, #663) Expanded platforms tested by CI: FreeBSD, OpenBSD,
Solaris, MSYS (Cygwin), S390x, PPC64le, ARMv7, AARCH64, RiscV.

2. (#655) Made build clean of `/W3` warnings on MSVC. Further suppression of
minor build warnings on other platforms (various commits).

3. (#651) Added `--enable-Werror` flag to `./configure` to treat warnings as
errors (or `--enable-errwarn` for Solaris cc). Previously, you had to hackily
override the CPPFLAGS when calling make since you can't pass `-Werror` as a
CFLAG into `./configure` (it breaks compiler feature detection).

4. (#682) Added AM_MAINTAINER_MODE for Git tag releases. Users building with
the `./configure` script can check out the release tag using Git, which assigns
the current time as the modification time to each checked-out file. This caused
Autoconf to attempt to regenerate the configure script.

5. (#692) Add LICENSE file for sljit to the tarball release, to clarify that the
sljit code is governed separately by the 2-clause BSD license.

6. (#656, #695) Add full support for z/OS and native EBCDIC support. The z/OS
support is tested nightly using the XLC and IBM-Clang compilers, with Autoconf
and CMake. In addition, for test purposes, the EBCDIC support can now be enabled
on any platform using the new Autoconf `--enable-ebcdic-ignoring-compiler` and
CMake `-DPCRE2_EBCDIC_IGNORING_COMPILER` options.

7. (#700) Faster lookup of named capture groups during pattern compilation using
a hash table.

8. (#697, #756, #778) Improvements to pcre2test to increase code coverage:
-malloc argument; more detailed test assertions.

9. (#705, #710, #737, #738) Powerful new feature: pattern recursion of
the form "(?1(GROUP_NAME_OR_NUM,...))" acts as a subroutine call which
additionally returns the listed capturing groups to the calling context.

10. (#721) Add linker scripts to enable symbol versioning for the PCRE2 dynamic
libraries. Downstream Linux distributions may make use of this, or disable it
with the new Autoconf `--disable-symvers` and CMake `-DPCRE2_SYMVERS` options.
Currently, Linux, Solaris, and FreeBSD (GNU ld, LLVM lld, and Solaris ld) are
tested and supported.

11. (#733) New API function: pcre2_next_match(). This function makes it both
simpler and safer for clients to iterate over all matches in a subject. The
documentation in `pcre2api` also provides improved guidance in the section
"Iterating over all matches".

12. (#739, #744, #753) Modernize the CMake build files, to use standard
commands to export the PCRE2 targets. This makes use of the
"$<BUILD_INTERFACE:...>" and "$<INSTALL_INTERFACE:...>" expressions alongside
the built-in "install(EXPORT...)" command. This brings the CMake files in line
with the patches used by vcpkg to distribute PCRE2. The minimum CMake version
remains 3.15.

13. (#756) Improved error offsets and diagnostics for syntax errors during
pattern compilation.

14. (#708, #729, #724, #731, #777) Various updates to Bazel and Zig
build support.

15. (#775) Added PCRE2_CONFIG_EFFECTIVE_LINKSIZE option to pcre2_config(), to
report the actual number of code units used in compiled patterns for recording
string lengths and offsets.

16. (#801) Significant bugfix: Fix a crash in pcre2_callout_enumerate() which is
easily reachable on any pattern that contains a Unicode character class. If your
application uses this function, please read the details for this change and
evaluate its severity for your application.

17. (#806, #807) Improved input validation for pcre2_substitute() used with
PCRE2_SUBSTITUTE_MATCHED.

18. (#817) Add support for $+ replacement to pcre2_substitute().

19. (#818) New SIMD code generation in the JIT for AArch64.


Version 10.46 27-August-2025
----------------------------

1. (#771) (CVE-2025-58050) Security fix to prevent a read-past-the-end memory
error, of arbitrary length. An attacker-controlled regex pattern is required,
and it cannot be triggered by providing crafted subject (match) text. The
(*ACCEPT) and (*scs:) pattern features must be used together.

Release 10.44 and earlier are not affected.

This could have implications of denial-of-service or information disclosure,
and could potentially be used to escalate other vulnerabilities in a system
(such as information disclosure being used to escalate the severity of an
unrelated bug in another system).


Version 10.45 05-February-2025
------------------------------

1. (#418) Change 6 of 10.44 broke 32-bit tests because pcre2test's reporting of
memory size was changed to the entire compiled data block, instead of just the
pattern and tables data, so as to align with the new length restriction.
Because the block's header contains pointers, this meant the pcre2test output
was different in 32-bit mode. A patch by Carlo reverts to the previous state
and makes sure that any limit set by pcre2_set_max_pattern_compiled_length()
also avoids the internal struct overhead.

2. (#416, #622) Updates to build.zig.

3. (#427, et al.) Various fixes to pacify static analyzers.

4. (#428) Add --posix-pattern-file to pcre2grep to allow processing of empty
patterns through the -f option, as well as patterns that end in space
characters, for compatibility with other grep tools.

5. (4fa5b8bd) Fix a bug in the fuzz support quantifier-limiting code. It ignores
strings of more than 5 digits because they are necessarily numbers greater than
65535, the largest legal quantifier. However, it wasn't ignoring non-significant
leading zeros.

6. (6d82f0cd) The case-independent processing of the letter-matching Unicode
properties Ll, Lt, and Lu have been changed to match Perl (which changed a while
ago). When caseless matching is in force, all three of these properties are now
treated as Lc (cased letter).

7. (#433) The pcre2_jit_compile() function was updated by the addition of a new
option PCRE2_JIT_TEST_ALLOC which, if called with a NULL first argument, tests
not only the availability of JIT, but also its ability to allocate executable
memory. Update pcre2test to use this support to extend the -C option.

8. (75b1025a) The code for parsing Unicode property descriptions for \p and \P
been changed as follows:

  . White space etc. before ^ in a negated value such as \p{ ^L } was not being
    ignored.

  . The code wouldn't have worked if PCRE2 was compiled for UTF-8 support
    within an EBCDIC environment. Possibly nobody does this any more, but it
    should now work.

  . The documentation of the syntax of what can follow \p and \P has been
    updated.

9. (1c24ba01) There was an error in the table of lengths for parsed items for
the OPTIONS item, but fortuitously it could never have actually bitten. While
fixing this, some other code that could never be obeyed was discovered and
removed.

10. (674b6640) Removed some incorect optimization code from DFA matching that
has been there since PCRE1, but has just been found to cause a no match return
instead of a partial match in some cases. It involves partial matching when (*F)
is present so is unlikely to have actually affected anyone.

11. (b0f4ac17) Tidy the wording and formatting of some pcre2test error messages
concerned with bad modifiers. Also restrict single-letter modifier sequences to
the first item in a modifier list, as documented and always intended.

12. (1415565c) An iterator at the end of many assertions can always be
auto-possessified, but not at the end of variable-length lookbehinds. There was
a bug in the code that checks for such a lookbehind; it was looking only at the
first branch, which is wrong because some branches can be fixed length when
others are not, for example (?<=AB|CD?). Now all branches are checked for
variability.

13. (ead08288) Matching with pcre2_match() could give an incorrect result if a
variable-length lookbehind was used as the condition in a conditional group.
The condition could erroneously be treated as true if a branch matched but
overran the current position. This bug was in the interpreter only; matching
with JIT was correct.

14. (#443) Split out the sljit sub-project into a "Git submodule". Git users
must now run `git submodule init; git submodule update` after a Git checkout, or
the build will fail due to missing files in deps/sljit.

15. (#441) Add a new error code (PCRE2_ERROR_JIT_UNSUPPORTED) which is yielded
for unsupported jit features.

16. (#444) Fix bug in 'first code unit' and 'last code unit' optimization
combined with lookahead assertions.

17. (#445, #447, #449, #451, #452, #459, #563) Add a new feature called scan
substring. This feature is a new type of assertion which matches the content of
a capturing block to a sub-pattern.

18. (#450) Improvements to 'first code unit' / 'starting code units'
optimisation.

19. (#455) Many, many improvements to the JIT compiler.

20. Item 43 of 10.43 was incomplete because it addressed only \z and not \Z,
which was still misbehaving when matching fragments inside invalid UTF strings.

21. (d29e7290) Octal escapes of the form \045 or \111 were not being recognized
in substitution strings, and if encountered gave an error, though the \o{...}
form was recognized. This bug is now fixed.

22. (#463, #487) Fix 1 byte out-of-bounds read when parsing malformed limits
(e.g. LIMIT_HEAP)

23. Many improvements to test infrastructure. Many more platforms and
configurations are now run in Continuous Integration, and all the platforms now
run the full test suite, rather than a partial subset.

24. (#475) Implement title casing in substitution strings using Perl syntax.

25. (#478, #504) Disallow \x if not followed by { or a hex digit.

26. (#473) Implements Python-style backrefs in substitutions.

27. (#472) Fix error reporting for certain over-large octal escapes.

28. (#482) Fix parsing of named captures in replacement strings, allowing
non-ASCII capture names to be used.

29. (#477, #474, #488, #494, #496, #506, #508, #511, #518, #524, #540) Many
improvements to parsing and optimising of character classes.

30. (#483, #498) Add support for \g<n> and $<name> to replacement strings.

31. (#470) Add option flags PCRE2_EXTRA_NO_BS0 and PCRE2_EXTRA_PYTHON_OCTAL.

32. (#471) Add new API function pcre2_set_optimize() for controlling which
optimizations are enabled.

33. (#491) Adds $& $` $' and $_ to substitution replacements, as well as
interpreting \b and \v as characters.

34. (#499) Add option PCRE2_EXTRA_NEVER_CALLOUT to disable callouts.

35. (#503, #513) Update Unicode support to UCD 16.

36. (#512, #618, #638) Add new function pcre2_set_substitute_case_callout() to
allow clients to provide a custom callback with locale-aware case
transformation.

37. (#516) Fix case-insensitive matching of backreferences when using the
PCRE2_EXTRA_CASELESS_RESTRICT option.

38. (#519) In pcre2grep, add $& as an alias for $0

39. (c9bf8339, #534) Updated perltest.sh to enable locale setting.

40. (#521) Add support for Turkish I casefolding, using new options
PCRE2_EXTRA_TURKISH_CASING, and added pre-pattern flags (*TURKISH_CASING) and
(*CASELESS_RESTRICT).

41. (#523, #546, #547) Add support for UTS#18 compatible character classes,
using the new option PCRE2_ALT_EXTENDED_CLASS. This adds '[' as a metacharacter
within character classes and the operators '&&', '--' and '~~', allowing
subtractions and intersections of character classes to be easily expressed.

42. (#553, #586, #596, #597) Add support for Perl-style extended character
classes, using the syntax (?[...]). This also allows expressing subtractions and
intersections of character classes, but using a different syntax to UTS#18.

43. (#554) Fixed a bug in JIT affecting greedy bounded repeats. The upper limit
of repeats inside a repeated bracket might be incorrectly checked.

44. (#556) Fixed a bug in JIT affecting caseful matching of backreferences. When
utf is disabled, and dupnames is enabled, caseless matching was used even
if caseful matching was needed.

45. (f34fc0a3) Fixed a bug in pcre2grep reported by Alejandro Colomar
<alx@kernel.org> (GitHub issue #577). In certain cases, when lines of above and
below context were contiguous, a separator line was incorrectly being inserted.

46. (#594) Fix a small (one/two byte) out-of-bounds read on invalid UTF-8 input
in pcre2grep.

47. (#370) Fix the INSTALL_MSVC_PDB CMake flag.

48. (#366) Install cmake files in prefix/lib/cmake/pcre2 rather than
prefix/cmake. The new CMake flag PCRE2_INSTALL_CMAKEDIR allows customising this
location.

49. (#624, #626, #628, #632, #639, #641) Reduce code size of generated JIT code
for repeated character classes.

50. (#623) Update the Bazel build files.


Version 10.44 07-June-2024
--------------------------

1. If a pattern contained a variable-length lookbehind in which the first
branch was not the one with the shortest minimum length, and the lookbehind
contained a capturing group, and elsewhere in the pattern there was another
lookbehind that referenced that group, the pattern was incorrectly compiled,
leading to unpredictable results, including crashes in JIT compiling. An
example pattern is: /(((?<=123?456456|ABC)))(?<=\2)/

2. Further updates to the oss-fuzz support:

   (a) Limit quantifiers for groups and classes to be no more than 10. This
       avoids very long JIT compile times that happen in some cases when groups
       are replicated for quantification, and very long match times when
       classes contain a lot of non-ascii characters.

   (b) Added PCRE2_EXTENDED_MORE to the list of allowed options.

   (c) Arranged for text error messages to be shown in 16-bit and 32-bit modes.

   (d) Made the output in standalone mode more readable.

   (e) General code tidies.

   (f) Limit the size of compiled patterns to 10MB (see 6 below).

   (g) Do not run JIT on patterns whose compiled length is greater than 200K
       bytes because this takes a long time, causing oss-fuzz to time out.

   (h) Avoid compiling or matching twice with the same options (this could
       happen if the input didn't set any options).

3. Increase the maximum length of a name for a group from 32 to 128 because
there is a user for whom 32 is too small.

4. Cause pcre2test to output a message when pcre2_jit_compile() gives an error
return if either jitverify or info is specified.

5. Some auxiliary files for building under OpenVMS that were contributed by
Alexey Chupahin have been installed.

6. Added pcre2_set_max_pattern_compiled_length() to limit the size of compiled
patterns.

7. There was a bug in the implementation of \X caused by my (PH) misreading or
misunderstanding one of the grapheme sequence breaking rules in Unicode Annex
#29. A break should occur between two characters with the Extended Pictographic
break property unless a zero-width joiner intervenes. PCRE2 was not insisting
on the ZWJ, causing \X to match more than it should. See GitHub issue #410.

8. Avoid compilation issues with proprietary compilers in UNIX since 10.43.


Version 10.43 16-February-2024
------------------------------

1. The test program added by change 2 of 10.42 didn't work when the default
newline setting didn't include \n as a newline. One test needed (*LF) to ensure
that it worked.

2. Added the new freestanding POSIX test program to the ManyConfigTests script
in the maint directory (overlooked in 2 below). Also improved the selection
facilities in that script, and added a test with JIT in a non-source directory,
fixing an oversight that would have made such a test fail before.

3. Added pcre2_get_match_data_heapframes_size() and related pcre2test flags
to allow for finer control of the heap used when pcre2_match() without JIT is
used and the match_data might be reused. This began as PR #191, but has had
further refinement and documentation edits.

4. Applied PR #181, which tidies some casts in pcre2_valid_utf.c.

5. Applied PR #184, which avoids overflow issues with the heap limit
(introduced in 10.41/9).

6. Applied PR #192, which changes the timing units for pcre2test from
milliseconds to microseconds. This is more useful for modern CPUs.

7. Applied PR #193, which makes the requirement for C99 explicit in
configure.ac and CMakeLists.txt.

8. Fixed a bug in pcre2test when a ridiculously large string repeat required a
stupid amount of memory. It now gives a clean realloc() failure error.

9. Updates to restrict the interaction between ASCII and non-ASCII characters
for caseless matching and items like \d:

   (a) Added PCRE2_EXTRA_CASELESS_RESTRICT to lock out mixing of ASCII and
       non-ASCII when matching caselessly. This is also /r in pcre2test and
       (?r) within patterns.

   (b) Added PCRE2_EXTRA_ASCII_{BSD,BSS,BSW,POSIX} and corresponding (?aD) etc
       in patterns and /a in pcre2test.

   (c) Corresponding updates to pcre2test.

10. Unicode has been updated to 15.0.0.

11. The Python scripts and ucptest.c in maint have been updated (a) a minor
change needed for 9(a) above; (b) fix bugs in ucptest,

12. Integer overflow testing is now centralized in a new function.

13. Made PCRE2_UCP the default in UTF mode in pcre2grep, and added new options
--case-restrict and --no-ucp.

14. In the debugging printint module (which is normally only linked into
pcre2test), avoid the use of a variable called "not" because that's deprecated
in C and forbidden in C++. Also rewrite some code to avoid a goto into a block
that bypassed its initialization (though it didn't actually matter).

15. More minor code adjustments to avoid using reserved C++ words as variable
names ("new" and "typename") and another jump that bypassed an (irrelevant)
initialization.

16. Merged a pull request that removed pcre2_ucptables.c from the list of files
to compile in NON-AUTOTOOLS-BUILD because it is #included in pcre2_tables.c.
Also adjusted the BUILD.bazel and build.zig files, which had the same issue. At
the same time, fixed a typo in the Bazel file.

17. Add PCRE2_EXTRA_ASCII_DIGIT to allow [:digit:] to be kept on sync with \d
even in UCP mode.

18. Fix an invalid match of ascii word classes when invalid utf is enabled.

19. Add a --posix-digit to pcre2grep for compatibility with GNU grep, and
other tools that prefer the POSIX compatible unicode definition for \d.

20. Report the bit width of the library in use by pcre2test for usability.

21. A pathological pattern conversion test could result in a string longer than
the available input buffer. Cause such a test to fail.

22. Add a check that forces a compiler error if PCRE2_CODE_UNIT_WIDTH is not 8,
16, or 32 when compiling any of the library modules.

23. Update pcre2_compile() to treat a NULL pattern with zero length as an empty
string.

24. Add support for limited-length variable-length lookbehind assertions, with
default maximum length 255 characters (same as Perl) but with a function to
adjust the limit.

25. Applied pull request #262, which updates the zig configuration, and #278
which fixes a bug with out-of-source-tree CMake build testing.

26. Add support for LoongArch to JIT.

27. Fixed a bug in pcre2_match() in the code for handling the vector of
backtracking frames on the heap, which caused a heap overflow if *LIMIT_HEAP
restricted an attempt to extend to less than the frame size. Generally tidy up
the code for extending the heap frames vector. This fixes GitHub issue #275.

28. Update pcre2_fuzzsupport.c to avoid clang sanitize complaint about shifting
left by 16 when there are non-zeros in the top 16 bits.

29. Perl 5.34.0 changed the meaning of (for example) {,3} which did not used to
be treated as a quantifier. Now it is interpreted as {0,3} and PCRE2 has
changed to match. Note that {,} is still not a quantifier.

30. Perl allows spaces and/or horizontal tabs after { or before } in all items
that use braces, and also before or after the comma in quantifiers. PCRE2 now
does the same, except for \u{...}, which is recognized only when
PCRE2_EXTRA_ALT_BSUX is set. This an ECMAScript, non-Perl compatible,
extension, so PCRE2 follows ECMAScript rather than Perl.

31. Applied pull request #300 by Carlo, which fixes #261. The bug was that
pcre2_match() was not fully resetting all captures that had been set within a
(possibly recursive) subroutine call such as (?3).

32. Changed the meaning of \w (and its synonyms) in UCP mode to match Perl. It
now matches characters whose general categories are L or N or whose particular
categories are Mn (non-spacing mark) or Pc (combining punctuation). The latter
includes underscore.

33. Changed the meaning of [:xdigit:] in UCP mode to match Perl. It now also
matches the "fullwidth" versions of the hex digits. Just like it is done for
[:digit:], PCRE2_EXTRA_ASCII_DIGIT can be used to keep this class ASCII only
without affecting other POSIX classes.

34. GitHub PR305 fixes a potential integer overflow in pcre2_dfa_match().

35. Updated handling of \b and \B in UCP mode to match the changes to \w in 32
above because \b and \B are defined in terms of \w.

36. Within a pattern (?aT) and (?-aT) set and reset the PCRE2_EXTRA_ASCII_DIGIT
option, and (?aP) also sets (?aT) so that (?-aP) disables all ASCII
restrictions on POSIX classes.

37. If PCRE2_FIRSTLINE was set on an anchored pattern, pcre2_match() and
pcre2_dfa_match() misbehaved. PCRE2_FIRSTLINE is now ignored for anchored
patterns.

38. Add a test for ridiculous ovector offset values to the substring extraction
functions.

39. Make OP_REVERSE use IMM2_SIZE for its data instead of LINK_SIZE, for
consistency with OP_VREVERSE.

40. In some legacy environments with a pre C99 snprintf, pcre2_regerror could
return an incorrect value when the provided buffer was too small.

41. Applied pull request #342 which adds sanity checks for ctype functions and
locks out any accidental sign-extension.

42. In the 32-bit library, in non-UTF mode, a quantifier that followed a
literal character with a value greater than or equal to 0x80000000u caused
undefined behaviour.

43. \z was misbehaving when matching fragments inside invalid UTF strings.

44. Implement --group-separator and --no-group-separator for pcre2grep.

45. Fix \X matching in 32 bit mode without UTF in JIT.

46. Fix backref iterators when PCRE2_MATCH_UNSET_BACKREF is set in JIT.

47. Refactor the handling of whole-pattern recursion (?0) in pcre2_match() so
that its end is handled similarly to other recursions. This has altered the
behaviour of   /|(?0)./endanchored   which was previously not right.

48. Improved the test for looping recursion by checking the last referenced
character as well as the current character. This allows some patterns that
previously triggered the check to run to completion instead of giving the loop
error.

49. In 32-bit mode, the compiler looped for the pattern /[\x{ffffffff}]/ when
PCRE2_CASELESS and PCRE2_UCP (but not PCRE2_UTF) were set. Fixed by not trying
to look for other cases for characters above the Unicode range.

50. In caseless 32-bit mode with UCP (but not UTF) set, the character
0xffffffff incorrectly matched any character that has more than one other case,
in particular k and s.

51. Fix accept and endanchored interaction in JIT.

52. Fix backreferences with unset backref and non-greedy iterators in JIT.

53. Improve the logic that checks for a list of starting code units -- positive
lookahead assertions are now ignored if the immediately following item is one
that sets a mandatory starting character. For example, /a?(?=bc|)d/ used to set
all of a, b, and d as possible starting code units; now it sets only a and d.

54. Fix incorrect class character matches in JIT.

55. In pcre2test, ensure pcre2_jit_match() is used when jitfast is used with
substitution testing.

56. Insert omitted setting of subject length in match data at the end of
pcre2_jit_match().

57. Implemented PCRE2_DISABLE_RECURSELOOP_CHECK for pcre2_match() to enable
some apparently looping recursions to run to completion and therefore match the
JIT behaviour. With this set, real loops will eventually get caught by match or
heap limits or run out of resource.

58. AC did a lot of work on pcre2_fuzzsupport.c to extend it to 16-bit and
32-bit libraries and to compare JIT and non-JIT matching.


Version 10.42 11-December-2022
------------------------------

1. Change 19 of 10.41 wasn't quite right; it put the definition of a default,
empty value for PCRE2_CALL_CONVENTION in src/pcre2posix.c instead of
src/pcre2posix.h, which meant that programs that included pcre2posix.h but not
pcre2.h failed to compile.

2. To catch similar issues to the above in future, a new small test program
that includes pcre2posix.h but not pcre2.h has been added to the test suite.

3. When the -S option of pcre2test was used to set a stack size greater than
the allowed maximum, the error message displayed the hard limit incorrectly.
This was pointed out on GitHub pull request #171, but the suggested patch
didn't cope with all cases. Some further modification was required.

4. Supplying an ovector count of more than 65535 to pcre2_match_data_create()
caused a crash because the field in the match data block is only 16 bits. A
maximum of 65535 is now silently applied.

5. Merged @carenas patch #175 which fixes #86 - segfault on aarch64 (ARM),

6. The prototype for pcre2_substring_list_free() specified its argument as
PCRE2_SPTR * which is a const data type, whereas the yield from
pcre2_substring_list() is not const. This caused compiler warnings. I have
changed the argument of pcre2_substring_list_free() to be PCRE2_UCHAR ** to
remove this anomaly. This might cause new warnings in existing code where a
cast has been used to avoid previous ones.


Version 10.41 06-December-2022
------------------------------

1. Add fflush() before and after a fork callout in pcre2grep to get its output
to be the same on all systems. (There were previously ordering differences in
Alpine Linux).

2. Merged patch from @carenas (GitHub #110) for pthreads support in CMake.

3. SSF scorecards grumbled about possible overflow in an expression in
pcre2test. It never would have overflowed in practice, but some casts have been
added and at the some time there's been some tidying of fprints that output
size_t values.

4. PR #94 showed up an unused enum in pcre2_convert.c, which is now removed.

5. Minor code re-arrangement to remove gcc warning about realloc() in
pcre2test.

6. Change a number of int variables that hold buffer and line lengths in
pcre2grep to PCRE2_SIZE (aka size_t).

7. Added an #ifdef to cut out a call to PRIV(jit_free) when JIT is not
supported (even though that function would do nothing in that case) at the
request of a user who doesn't even want to link with pcre_jit_compile.o. Also
tidied up an untidy #ifdef arrangement in pcre2test.

8. Fixed an issue in the backtracking optimization of character repeats in
JIT. Furthermore optimize star repetitions, not just plus repetitions.

9. Removed the use of an initial backtracking frames vector on the system stack
in pcre2_match() so that it now always uses the heap. (In a multi-thread
environment with very small stacks there had been an issue.) This also is
tidier for JIT matching, which didn't need that vector. The heap vector is now
remembered in the match data block and re-used if that block itself is re-used.
It is freed with the match data block.

10. Adjusted the find_limits code in pcre2test to work with change 9 above.

11. Added find_limits_noheap to pcre2test, because the heap limits are now
different in different environments and so cannot be included in the standard
tests.

12. Created a test for pcre2_match() heap processing that is not part of the
tests run by 'make check', but can be run manually. The current output is from
a 64-bit system.

13. Implemented -Z aka --null in pcre2grep.

14. A minor change to pcre2test and the addition of several new pcre2grep tests
have improved LCOV coverage statistics. At the same time, code in pcre2grep and
elsewhere that can never be obeyed in normal testing has been excluded from
coverage.

15. Fixed a bug in pcre2grep that could cause an extra newline to be written
after output generated by --output.

16. If a file has a .bz2 extension but is not in fact compressed, pcre2grep
should process it as a plain text file. A bug stopped this happening; now fixed
and added to the tests.

17. When pcre2grep was running not in UTF mode, if a string specified by
--output or obtained from a callout in a pattern contained a character (byte)
greater than 127, it was incorrectly output in UTF-8 format.

18. Added some casts after warnings from Clang sanitize.

19. Merged patch from cbouc (GitHub #139): 4 function prototypes were missing
PCRE2_CALL_CONVENTION in src/pcre2posix.h. All function prototypes returning
pointers had out of place PCRE2_CALL_CONVENTION in src/pcre2.h.*. These
produced errors when building for Windows with #define PCRE2_CALL_CONVENTION
__stdcall.

20. A negative repeat value in a pcre2test subject line was not being
diagnosed, leading to infinite looping.

21. Updated RunGrepTest to discard the warning that Bash now gives when setting
LC_CTYPE to a bad value (because older versions didn't).

22. Updated pcre2grep so that it behaves like GNU grep when matching more than
one pattern and a later pattern matches at an earlier point in the subject when
the matched substrings are being identified by colour or by offsets.

23. Updated the PrepareRelease script so that the man page that it makes for
the pcre2demo demonstration program is more standard and does not cause errors
when processed by lexgrog or mandb -c (GitHub issue #160).

24. The JIT compiler was updated.


Version 10.40 15-April-2022
---------------------------

1. Merged patch from @carenas (GitHub #35, 7db87842) to fix pcre2grep incorrect
handling of multiple passes.

2. Merged patch from @carenas (GitHub #36, dae47509) to fix portability issue
in pcre2grep with buffered fseek(stdin).

3. Merged patch from @carenas (GitHub #37, acc520924) to fix tests when -S is
not supported.

4. Revert an unintended change in JIT repeat detection.

5. Merged patch from @carenas (GitHub #52, b037bfa1) to fix build on GNU Hurd.

6. Merged documentation and comments patches from @carenas (GitHub #47).

7. Merged patch from @carenas (GitHub #49) to remove obsolete JFriedl test code
from pcre2grep.

8. Merged patch from @carenas (GitHub #48) to fix CMake install issue #46.

9. Merged patch from @carenas (GitHub #53) fixing NULL checks in matching and
substituting.

10. Add null_subject and null_replacement modifiers to pcre2test.

11. Add check for NULL subject to POSIX regexec() function.

12. Add check for NULL replacement to pcre2_substitute().

13. For the subject arguments of pcre2_match(), pcre2_dfa_match(), and
pcre2_substitute(), and the replacement argument of the latter, if the pointer
is NULL and the length is zero, treat as an empty string. Apparently a number
of applications treat NULL/0 in this way.

14. Added support for Bidi_Class and a number of binary Unicode properties,
including Bidi_Control.

15. Fix some minor issues raised by clang sanitize.

16. Very minor code speed up for maximizing character property matches.

17. A number of changes to script matching for \p and \P:

    (a) Script extensions for a character are now coded as a bitmap instead of
        a list of script numbers, which should be faster and does not need a
        loop.

    (b) Added the syntax \p{script:xxx} and \p{script_extensions:xxx} (synonyms
        sc and scx).

    (c) Changed \p{scriptname} from being the same as \p{sc:scriptname} to being
        the same as \p{scx:scriptname} because this change happened in Perl at
        release 5.26.

    (d) The standard Unicode 4-letter abbreviations for script names are now
        recognized.

    (e) In accordance with Unicode and Perl's "loose matching" rules, spaces,
        hyphens, and underscores are ignored in property names, which are then
        matched independent of case.

18. The Python scripts in the maint directory have been refactored. There are
now three scripts that generate pcre2_ucd.c, pcre2_ucp.h, and pcre2_ucptables.c
(which is #included by pcre2_tables.c). The data lists that used to be
duplicated are now held in a single common Python module.

19. On CHERI, and thus Arm's Morello prototype, pointers are represented as
hardware capabilities, which consist of both an integer address and additional
metadata, meaning they are twice the size of the platform's size_t type, i.e.
16 bytes on a 64-bit system. The ovector member of heapframe happens to only be
8 byte aligned, and so computing frame_size ended up with a multiple of 8 but
not 16. Whilst the first frame was always suitably aligned, this then
misaligned the frame that follows, resulting in an alignment fault when storing
a pointer to Fecode at the start of match. Patch to fix this issue by Jessica
Clarke PR#72.

20. Added -LP and -LS listing options to pcre2test.

21. A user discovered that the library names in CMakeLists.txt for MSVC
debugger (PDB) files were incorrect - perhaps never tried for PCRE2?

22. An item such as [Aa] is optimized into a caseless single character match.
When this was quantified (e.g. [Aa]{2}) and was also the last literal item in a
pattern, the optimizing "must be present for a match" character check was not
being flagged as caseless, causing some matches that should have succeeded to
fail.

23. Fixed a unicode property matching issue in JIT. The character was not
fully read in caseless matching.

24. Fixed an issue affecting recursions in JIT caused by duplicated data
transfers.

25. Merged patch from @carenas (GitHub #96) which fixes some problems with
pcre2test and readline/readedit:

  * Use the right header for libedit in FreeBSD with autoconf
  * Really allow libedit with cmake
  * Avoid using readline headers with libedit


Version 10.39 29-October-2021
-----------------------------

1. Fix incorrect detection of alternatives in first character search in JIT.

2. Merged patch from @carenas (GitHub #28):

  Visual Studio 2013 includes support for %zu and %td, so let newer
  versions of it avoid the fallback, and while at it, make sure that
  the first check is for DISABLE_PERCENT_ZT so it will be always
  honoured if chosen.

  prtdiff_t is signed, so use a signed type instead, and make sure
  that an appropriate width is chosen if pointers are 64bit wide and
  long is not (ex: Windows 64bit).

  IMHO removing the cast (and therefore the possibility of truncation)
  make the code cleaner and the fallback is likely portable enough
  with all 64-bit POSIX systems doing LP64 except for Windows.

3. Merged patch from @carenas (GitHub #29) to update to Unicode 14.0.0.

4. Merged patch from @carenas (GitHub #30):

  * Cleanup: remove references to no longer used stdint.h

  Since 19c50b9d (Unconditionally use inttypes.h instead of trying for stdint.h
  (simplification) and remove the now unnecessary inclusion in
  pcre2_internal.h., 2018-11-14), stdint.h is no longer used.

  Remove checks for it in autotools and CMake and document better the expected
  build failures for systems that might have stdint.h (C99) and not inttypes.h
  (from POSIX), like old Windows.

  * Cleanup: remove detection for inttypes.h which is a hard dependency

  CMake checks for standard headers are not meant to be used for hard
  dependencies, so will prevent a possible fallback to work.

  Alternatively, the header could be checked to make the configuration fail
  instead of breaking the build, but that was punted, as it was missing anyway
  from autotools.

5. Merged patch from @carenas (GitHub #32):

  * jit: allow building with ancient MSVC versions

  Visual Studio older than 2013 fails to build with JIT enabled, because it is
  unable to parse non C89 compatible syntax, with mixed declarations and code.
  While most recent compilers wouldn't even report this as a warning since it
  is valid C99, it could be also made visible by adding to gcc/clang the
  -Wdeclaration-after-statement flag at build time.

  Move the code below the affected definitions.

  * pcre2grep: avoid mixing declarations with code

  Since d5a61ee8 (Patch to detect (and ignore) symlink loops in pcre2grep,
  2021-08-28), code will fail to build in a strict C89 compiler.

  Reformat slightly to make it C89 compatible again.


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 preceded 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
-------------------------

1. Change RunGrepTest to use tr instead of sed when testing with binary
zero bytes, because sed varies a lot from system to system and has problems
with binary zeros. This is from Bugzilla #2681. Patch from Jeremie
Courreges-Anglas via Nam Nguyen. This fixes RunGrepTest for OpenBSD. Later:
it broke it for at least one version of Solaris, where tr can't handle binary
zeros. However, that system had /usr/xpg4/bin/tr installed, which works OK, so
RunGrepTest now checks for that command and uses it if found.

2. Compiling with gcc 10.2's -fanalyzer option showed up a hypothetical problem
with a NULL dereference. I don't think this case could ever occur in practice,
but I have put in a check in order to get rid of the compiler error.

3. An alternative patch for CMakeLists.txt because 10.36 #4 breaks CMake on
Windows. Patch from email@cs-ware.de fixes bugzilla #2688.

4. Two bugs related to over-large numbers have been fixed so the behaviour is
now the same as Perl.

  (a) A pattern such as /\214748364/ gave an overflow error instead of being
  treated as the octal number \214 followed by literal digits.

  (b) A sequence such as {65536 that has no terminating } so is not a
  quantifier was nevertheless complaining that a quantifier number was too big.

5. A run of autoconf suggested that configure.ac was out-of-date with respect
to the latest autoconf. Running autoupdate made some valid changes, some valid
suggestions, and also some invalid changes, which were fixed by hand. Autoconf
now runs clean and the resulting "configure" seems to work, so I hope nothing
is broken. Later: the requirement for autoconf 2.70 broke some automatic test
robots. It doesn't seem to be necessary: trying a reduction to 2.60.

6. The pattern /a\K.(?0)*/ when matched against "abac" by the interpreter gave
the answer "bac", whereas Perl and JIT both yield "c". This was because the
effect of \K was not propagating back from the full pattern recursion. Other
recursions such as /(a\K.(?1)*)/ did not have this problem.

7. Restore single character repetition optimization in JIT. Currently fewer
character repetitions are optimized than in 10.34.

8. When the names of the functions in the POSIX wrapper were changed to
pcre2_regcomp() etc. (see change 10.33 #4 below), functions with the original
names were left in the library so that pre-compiled programs would still work.
However, this has proved troublesome when programs link with several libraries,
some of which use PCRE2 via the POSIX interface while others use a native POSIX
library. For this reason, the POSIX function names are removed in this release.
The macros in pcre2posix.h should ensure that re-compiling fixes any programs
that haven't been compiled since before 10.33.


Version 10.36 04-December-2020
------------------------------

1. Add CET_CFLAGS so that when Intel CET is enabled, pass -mshstk to
compiler. This fixes https://bugs.exim.org/show_bug.cgi?id=2578. Patch for
Makefile.am and configure.ac by H.J. Lu. Equivalent patch for CMakeLists.txt
invented by PH.

2. Fix infinite loop when a single byte newline is searched in JIT when
invalid utf8 mode is enabled.

3. Updated CMakeLists.txt with patch from Wolfgang Stöggl (Bugzilla #2584):

  - Include GNUInstallDirs and use ${CMAKE_INSTALL_LIBDIR} instead of hardcoded
    lib. This allows differentiation between lib and lib64.
    CMAKE_INSTALL_LIBDIR is used for installation of libraries and also for
    pkgconfig file generation.

  - Add the version of PCRE2 to the configuration summary like ./configure
    does.

  - Fix typo: MACTHED_STRING->MATCHED_STRING

4. Updated CMakeLists.txt with another patch from Wolfgang Stöggl (Bugzilla
#2588):

  - Add escaped double quotes around include directory in CMakeLists.txt to
    allow spaces in directory names.

  - This fixes a cmake error, if the path of the pcre2 source contains a space.

5. Updated CMakeLists.txt with a patch from B. Scott Michel: CMake's
documentation suggests using CHECK_SYMBOL_EXISTS over CHECK_FUNCTION_EXIST.
Moreover, these functions come from specific header files, which need to be
specified (and, thankfully, are the same on both the Linux and WinXX
platforms.)

6. Added a (uint32_t) cast to prevent a compiler warning in pcre2_compile.c.

7. Applied a patch from Wolfgang Stöggl (Bugzilla #2600) to fix postfix for
debug Windows builds using CMake. This also updated configure so that it
generates *.pc files and pcre2-config with the same content, as in the past.

8. If a pattern ended with (?(VERSION=n.d where n is any number but d is just a
single digit, the code unit beyond d was being read (i.e. there was a read
buffer overflow). Fixes ClusterFuzz 23779.

9. After the rework in r1235, certain character ranges were incorrectly
handled by an optimization in JIT. Furthermore a wrong offset was used to
read a value from a buffer which could lead to memory overread.

10. Unnoticed for many years was the fact that delimiters other than / in the
testinput1 and testinput4 files could cause incorrect behaviour when these
files were processed by perltest.sh. There were several tests that used quotes
as delimiters, and it was just luck that they didn't go wrong with perltest.sh.
All the patterns in testinput1 and testinput4 now use / as their delimiter.
This fixes Bugzilla #2641.

11. Perl has started to give an error for \K within lookarounds (though there
are cases where it doesn't). PCRE2 still allows this, so the tests that include
this case have been moved from test 1 to test 2.

12. Further to 10 above, pcre2test has been updated to detect and grumble if a
delimiter other than / is used after #perltest.

13. Fixed a bug with PCRE2_MATCH_INVALID_UTF in 8-bit mode when PCRE2_CASELESS
was set and PCRE2_NO_START_OPTIMIZE was not set. The optimization for finding
the start of a match was not resetting correctly after a failed match on the
first valid fragment of the subject, possibly causing incorrect "no match"
returns on subsequent fragments. For example, the pattern /A/ failed to match
the subject \xe5A. Fixes Bugzilla #2642.

14. Fixed a bug in character set matching when JIT is enabled and both unicode
scripts and unicode classes are present at the same time.

15. Added GNU grep's -m (aka --max-count) option to pcre2grep.

16. Refactored substitution processing in pcre2grep strings, both for the -O
option and when dealing with callouts. There is now a single function that
handles $ expansion in all cases (instead of multiple copies of almost
identical code). This means that the same escape sequences are available
everywhere, which was not previously the case. At the same time, the escape
sequences $x{...} and $o{...} have been introduced, to allow for characters
whose code points are greater than 255 in Unicode mode.

17. Applied the patch from Bugzilla #2628 to RunGrepTest. This does an explicit
test for a version of sed that can handle binary zero, instead of assuming that
any Linux version will work. Later: replaced $(...) by `...` because not all
shells recognize the former.

18. Fixed a word boundary check bug in JIT when partial matching is enabled.

19. Fix ARM64 compilation warning in JIT. Patch by Carlo.

20. A bug in the RunTest script meant that if the first part of test 2 failed,
the failure was not reported.

21. Test 2 was failing when run from a directory other than the source
directory. This failure was previously missed in RunTest because of 20 above.
Fixes added to both RunTest and RunTest.bat.

22. Patch to CMakeLists.txt from Daniel to fix problem with testing under
Windows.


Version 10.35 09-May-2020
---------------------------

1. Use PCRE2_MATCH_EMPTY flag to detect empty matches in JIT.

2. Fix ARMv5 JIT improper handling of labels right after a constant pool.

3. A JIT bug is fixed which allowed to read the fields of the compiled
pattern before its existence is checked.

4. Back in the PCRE1 day, capturing groups that contained recursive back
references to themselves were made atomic (version 8.01, change 18) because
after the end a repeated group, the captured substrings had their values from
the final repetition, not from an earlier repetition that might be the
destination of a backtrack. This feature was documented, and was carried over
into PCRE2. However, it has now been realized that the major refactoring that
was done for 10.30 has made this atomizing unnecessary, and it is confusing
when users are unaware of it, making some patterns appear not to be working as
expected. Capture values of recursive back references in repeated groups are
now correctly backtracked, so this unnecessary restriction has been removed.

5. Added PCRE2_SUBSTITUTE_LITERAL.

6. Avoid some VS compiler warnings.

7. Added PCRE2_SUBSTITUTE_MATCHED.

8. Added (?* and (?<* as synonyms for (*napla: and (*naplb: to match another
regex engine. The Perl regex folks are aware of this usage and have made a note
about it.

9. When an assertion is repeated, PCRE2 used to limit the maximum repetition to
1, believing that repeating an assertion is pointless. However, if a positive
assertion contains capturing groups, repetition can be useful. In any case, an
assertion could always be wrapped in a repeated group. The only restriction
that is now imposed is that an unlimited maximum is changed to one more than
the minimum.

10. Fix *THEN verbs in lookahead assertions in JIT.

11. Added PCRE2_SUBSTITUTE_REPLACEMENT_ONLY.

12. The JIT stack should be freed when the low-level stack allocation fails.

13. In pcre2grep, if the final line in a scanned file is output but does not
end with a newline sequence, add a newline according to the --newline setting.

14. (?(DEFINE)...) groups were not being handled correctly when checking for
the fixed length of a lookbehind assertion. Such a group within a lookbehind
should be skipped, as it does not contribute to the length of the group.
Instead, the (DEFINE) group was being processed, and if at the end of the
lookbehind, that end was not correctly recognized. Errors such as "lookbehind
assertion is not fixed length" and also "internal error: bad code value in
parsed_skip()" could result.

15. Put a limit of 1000 on recursive calls in pcre2_study() when searching
nested groups for starting code units, in order to avoid stack overflow issues.
If the limit is reached, it just gives up trying for this optimization.

16. The control verb chain list must always be restored when exiting from a
recurse function in JIT.

17. Fix a crash which occurs when the character type of an invalid UTF
character is decoded in JIT.

18. Changes in many areas of the code so that when Unicode is supported and
PCRE2_UCP is set without PCRE2_UTF, Unicode character properties are used for
upper/lower case computations on characters whose code points are greater than
127.

19. The function for checking UTF-16 validity was returning an incorrect offset
for the start of the error when a high surrogate was not followed by a valid
low surrogate. This caused incorrect behaviour, for example when
PCRE2_MATCH_INVALID_UTF was set and a match started immediately following the
invalid high surrogate, such as /aa/ matching "\x{d800}aa".

20. If a DEFINE group immediately preceded a lookbehind assertion, the pattern
could be mis-compiled and therefore not match correctly. This is the example
that found this: /(?(DEFINE)(?<foo>bar))(?<![-a-z0-9])word/ which failed to
match "word" because the "move back" value was set to zero.

21. Following a request from a user, some extensions and tidies to the
character tables handling have been done:

  (a) The dftables auxiliary program is renamed pcre2_dftables, but it is still
  not installed for public use.

  (b) There is now a -b option for pcre2_dftables, which causes the tables to
  be written in binary. There is also a -help option.

  (c) PCRE2_CONFIG_TABLES_LENGTH is added to pcre2_config() so that an
  application that wants to save tables in binary knows how long they are.

22. Changed setting of CMAKE_MODULE_PATH in CMakeLists.txt from SET to
LIST(APPEND...) to allow a setting from the command line to be included.

23. Updated to Unicode 13.0.0.

24. CMake build now checks for secure_getenv() and strerror(). Patch by Carlo.

25. Avoid using [-1] as a suffix in pcre2test because it can provoke a compiler
warning.

26. Added tests for __attribute__((uninitialized)) to both the configure and
CMake build files, and then applied this attribute to the variable called
stack_frames_vector[] in pcre2_match(). When implemented, this disables
automatic initialization (a facility in clang), which can take time on big
variables.

27. Updated CMakeLists.txt (patches by Uwe Korn) to add support for
pcre2-config, the libpcre*.pc files, SOVERSION, VERSION and the
MACHO_*_VERSIONS settings for CMake builds.

28. Another patch to CMakeLists.txt to check for mkostemp (configure already
does). Patch by Carlo Marcelo Arenas Belon.

29. Check for the existence of memfd_create in both CMake and configure
configurations. Patch by Carlo Marcelo Arenas Belon.

30. Restrict the configuration setting for the SELinux compatible execmem
allocator (change 10.30/44) to Linux and NetBSD.


Version 10.34 21-November-2019
------------------------------

1. The maximum number of capturing subpatterns is 65535 (documented), but no
check on this was ever implemented. This omission has been rectified; it fixes
ClusterFuzz 14376.

2. Improved the invalid utf32 support of the JIT compiler. Now it correctly
detects invalid characters in the 0xd800-0xdfff range.

3. Fix minor typo bug in JIT compile when \X is used in a non-UTF string.

4. Add support for matching in invalid UTF strings to the pcre2_match()
interpreter, and integrate with the existing JIT support via the new
PCRE2_MATCH_INVALID_UTF compile-time option.

5. Give more error detail for invalid UTF-8 when detected in pcre2grep.

6. Add support for invalid UTF-8 to pcre2grep.

7. Adjust the limit for "must have" code unit searching, in particular,
increase it substantially for non-anchored patterns.

8. Allow (*ACCEPT) to be quantified, because an ungreedy quantifier with a zero
minimum is potentially useful.

9. Some changes to the way the minimum subject length is handled:

   * When PCRE2_NO_START_OPTIMIZE is set, no minimum length is computed;
     pcre2test now omits this item instead of showing a value of zero.

   * An incorrect minimum length could be calculated for a pattern that
     contained (*ACCEPT) inside a qualified group whose minimum repetition was
     zero, for example /A(?:(*ACCEPT))?B/, which incorrectly computed a minimum
     of 2. The minimum length scan no longer happens for a pattern that
     contains (*ACCEPT).

   * When no minimum length is set by the normal scan, but a first and/or last
     code unit is recorded, set the minimum to 1 or 2 as appropriate.

   * When a pattern contains multiple groups with the same number, a back
     reference cannot know which one to scan for a minimum length. This used to
     cause the minimum length finder to give up with no result. Now it treats
     such references as not adding to the minimum length (which it should have
     done all along).

   * Furthermore, the above action now happens only if the back reference is to
     a group that exists more than once in a pattern instead of any back
     reference in a pattern with duplicate numbers.

10. A (*MARK) value inside a successful condition was not being returned by the
interpretive matcher (it was returned by JIT). This bug has been mended.

11. A bug in pcre2grep meant that -o without an argument (or -o0) didn't work
if the pattern had more than 32 capturing parentheses. This is fixed. In
addition (a) the default limit for groups requested by -o<n> has been raised to
50, (b) the new --om-capture option changes the limit, (c) an error is raised
if -o asks for a group that is above the limit.

12. The quantifier {1} was always being ignored, but this is incorrect when it
is made possessive and applied to an item in parentheses, because a
parenthesized item may contain multiple branches or other backtracking points,
for example /(a|ab){1}+c/ or /(a+){1}+a/.

13. For partial matches, pcre2test was always showing the maximum lookbehind
characters, flagged with "<", which is misleading when the lookbehind didn't
actually look behind the start (because it was later in the pattern). Showing
all consulted preceding characters for partial matches is now controlled by the
existing "allusedtext" modifier and, as for complete matches, this facility is
available only for non-JIT matching, because JIT does not maintain the first
and last consulted characters.

14. DFA matching (using pcre2_dfa_match()) was not recognising a partial match
if the end of the subject was encountered in a lookahead (conditional or
otherwise), an atomic group, or a recursion.

15. Give error if pcre2test -t, -T, -tm or -TM is given an argument of zero.

16. Check for integer overflow when computing lookbehind lengths. Fixes
Clusterfuzz issue 15636.

17. Implemented non-atomic positive lookaround assertions.

18. If a lookbehind contained a lookahead that contained another lookbehind
within it, the nested lookbehind was not correctly processed. For example, if
/(?<=(?=(?<=a)))b/ was matched to "ab" it gave no match instead of matching
"b".

19. Implemented pcre2_get_match_data_size().

20. Two alterations to partial matching:

    (a) The definition of a partial match is slightly changed: if a pattern
    contains any lookbehinds, an empty partial match may be given, because this
    is another situation where adding characters to the current subject can
    lead to a full match. Example: /c*+(?<=[bc])/ with subject "ab".

    (b) Similarly, if a pattern could match an empty string, an empty partial
    match may be given. Example: /(?![ab]).*/ with subject "ab". This case
    applies only to PCRE2_PARTIAL_HARD.

    (c) An empty string partial hard match can be returned for \z and \Z as it
    is documented that they shouldn't match.

21. A branch that started with (*ACCEPT) was not being recognized as one that
could match an empty string.

22. Corrected pcre2_set_character_tables() tables data type: was const unsigned
char * instead of const uint8_t *, as generated by pcre2_maketables().

23. Upgraded to Unicode 12.1.0.

24. Add -jitfast command line option to pcre2test (to make all the jit opti
Download .txt
gitextract_ehge08ch/

├── .editorconfig
├── .gitattributes
├── .github/
│   ├── codecov.yml
│   ├── dependabot.yml
│   ├── scripts/
│   │   └── merge_sarif.py
│   └── workflows/
│       ├── build.yml
│       ├── cifuzz.yml
│       ├── clang-analyzer.yml
│       ├── codeql.yml
│       ├── dev.yml
│       ├── pages.yml
│       ├── scorecards.yml
│       └── sync.yml
├── .gitignore
├── .gitmodules
├── AUTHORS.md
├── BUILD.bazel
├── CMakeLists.txt
├── COPYING
├── ChangeLog
├── HACKING
├── INSTALL
├── LICENCE.md
├── MODULE.bazel
├── Makefile.am
├── NEWS
├── NON-AUTOTOOLS-BUILD
├── README
├── README.md
├── RunGrepTest
├── RunGrepTest.bat
├── RunTest
├── RunTest.bat
├── SECURITY.md
├── autogen.sh
├── build.zig
├── cmake/
│   ├── COPYING-CMAKE-SCRIPTS
│   ├── FindEditline.cmake
│   ├── FindReadline.cmake
│   ├── PCRE2CheckVscript.cmake
│   ├── PCRE2UseSystemExtensions.cmake
│   ├── PCRE2WarningAsError.cmake
│   └── pcre2-config.cmake.in
├── configure.ac
├── doc/
│   ├── html/
│   │   ├── NON-AUTOTOOLS-BUILD.txt
│   │   ├── README.txt
│   │   ├── index.html
│   │   ├── pcre2-config.html
│   │   ├── pcre2.html
│   │   ├── pcre2_callout_enumerate.html
│   │   ├── pcre2_code_copy.html
│   │   ├── pcre2_code_copy_with_tables.html
│   │   ├── pcre2_code_free.html
│   │   ├── pcre2_compile.html
│   │   ├── pcre2_compile_context_copy.html
│   │   ├── pcre2_compile_context_create.html
│   │   ├── pcre2_compile_context_free.html
│   │   ├── pcre2_config.html
│   │   ├── pcre2_convert_context_copy.html
│   │   ├── pcre2_convert_context_create.html
│   │   ├── pcre2_convert_context_free.html
│   │   ├── pcre2_converted_pattern_free.html
│   │   ├── pcre2_dfa_match.html
│   │   ├── pcre2_general_context_copy.html
│   │   ├── pcre2_general_context_create.html
│   │   ├── pcre2_general_context_free.html
│   │   ├── pcre2_get_error_message.html
│   │   ├── pcre2_get_mark.html
│   │   ├── pcre2_get_match_data_heapframes_size.html
│   │   ├── pcre2_get_match_data_size.html
│   │   ├── pcre2_get_ovector_count.html
│   │   ├── pcre2_get_ovector_pointer.html
│   │   ├── pcre2_get_startchar.html
│   │   ├── pcre2_jit_compile.html
│   │   ├── pcre2_jit_free_unused_memory.html
│   │   ├── pcre2_jit_match.html
│   │   ├── pcre2_jit_stack_assign.html
│   │   ├── pcre2_jit_stack_create.html
│   │   ├── pcre2_jit_stack_free.html
│   │   ├── pcre2_maketables.html
│   │   ├── pcre2_maketables_free.html
│   │   ├── pcre2_match.html
│   │   ├── pcre2_match_context_copy.html
│   │   ├── pcre2_match_context_create.html
│   │   ├── pcre2_match_context_free.html
│   │   ├── pcre2_match_data_create.html
│   │   ├── pcre2_match_data_create_from_pattern.html
│   │   ├── pcre2_match_data_free.html
│   │   ├── pcre2_next_match.html
│   │   ├── pcre2_pattern_convert.html
│   │   ├── pcre2_pattern_info.html
│   │   ├── pcre2_serialize_decode.html
│   │   ├── pcre2_serialize_encode.html
│   │   ├── pcre2_serialize_free.html
│   │   ├── pcre2_serialize_get_number_of_codes.html
│   │   ├── pcre2_set_bsr.html
│   │   ├── pcre2_set_callout.html
│   │   ├── pcre2_set_character_tables.html
│   │   ├── pcre2_set_compile_extra_options.html
│   │   ├── pcre2_set_compile_recursion_guard.html
│   │   ├── pcre2_set_depth_limit.html
│   │   ├── pcre2_set_glob_escape.html
│   │   ├── pcre2_set_glob_separator.html
│   │   ├── pcre2_set_heap_limit.html
│   │   ├── pcre2_set_match_limit.html
│   │   ├── pcre2_set_max_pattern_compiled_length.html
│   │   ├── pcre2_set_max_pattern_length.html
│   │   ├── pcre2_set_max_varlookbehind.html
│   │   ├── pcre2_set_newline.html
│   │   ├── pcre2_set_offset_limit.html
│   │   ├── pcre2_set_optimize.html
│   │   ├── pcre2_set_parens_nest_limit.html
│   │   ├── pcre2_set_recursion_limit.html
│   │   ├── pcre2_set_recursion_memory_management.html
│   │   ├── pcre2_set_substitute_callout.html
│   │   ├── pcre2_set_substitute_case_callout.html
│   │   ├── pcre2_substitute.html
│   │   ├── pcre2_substring_copy_byname.html
│   │   ├── pcre2_substring_copy_bynumber.html
│   │   ├── pcre2_substring_free.html
│   │   ├── pcre2_substring_get_byname.html
│   │   ├── pcre2_substring_get_bynumber.html
│   │   ├── pcre2_substring_length_byname.html
│   │   ├── pcre2_substring_length_bynumber.html
│   │   ├── pcre2_substring_list_free.html
│   │   ├── pcre2_substring_list_get.html
│   │   ├── pcre2_substring_nametable_scan.html
│   │   ├── pcre2_substring_number_from_name.html
│   │   ├── pcre2api.html
│   │   ├── pcre2build.html
│   │   ├── pcre2callout.html
│   │   ├── pcre2compat.html
│   │   ├── pcre2convert.html
│   │   ├── pcre2demo.html
│   │   ├── pcre2grep.html
│   │   ├── pcre2jit.html
│   │   ├── pcre2limits.html
│   │   ├── pcre2matching.html
│   │   ├── pcre2partial.html
│   │   ├── pcre2pattern.html
│   │   ├── pcre2perform.html
│   │   ├── pcre2posix.html
│   │   ├── pcre2sample.html
│   │   ├── pcre2serialize.html
│   │   ├── pcre2syntax.html
│   │   ├── pcre2test.html
│   │   └── pcre2unicode.html
│   ├── index.html.src
│   ├── pcre2-config.1
│   ├── pcre2-config.txt
│   ├── pcre2.3
│   ├── pcre2.txt
│   ├── pcre2_callout_enumerate.3
│   ├── pcre2_code_copy.3
│   ├── pcre2_code_copy_with_tables.3
│   ├── pcre2_code_free.3
│   ├── pcre2_compile.3
│   ├── pcre2_compile_context_copy.3
│   ├── pcre2_compile_context_create.3
│   ├── pcre2_compile_context_free.3
│   ├── pcre2_config.3
│   ├── pcre2_convert_context_copy.3
│   ├── pcre2_convert_context_create.3
│   ├── pcre2_convert_context_free.3
│   ├── pcre2_converted_pattern_free.3
│   ├── pcre2_dfa_match.3
│   ├── pcre2_general_context_copy.3
│   ├── pcre2_general_context_create.3
│   ├── pcre2_general_context_free.3
│   ├── pcre2_get_error_message.3
│   ├── pcre2_get_mark.3
│   ├── pcre2_get_match_data_heapframes_size.3
│   ├── pcre2_get_match_data_size.3
│   ├── pcre2_get_ovector_count.3
│   ├── pcre2_get_ovector_pointer.3
│   ├── pcre2_get_startchar.3
│   ├── pcre2_jit_compile.3
│   ├── pcre2_jit_free_unused_memory.3
│   ├── pcre2_jit_match.3
│   ├── pcre2_jit_stack_assign.3
│   ├── pcre2_jit_stack_create.3
│   ├── pcre2_jit_stack_free.3
│   ├── pcre2_maketables.3
│   ├── pcre2_maketables_free.3
│   ├── pcre2_match.3
│   ├── pcre2_match_context_copy.3
│   ├── pcre2_match_context_create.3
│   ├── pcre2_match_context_free.3
│   ├── pcre2_match_data_create.3
│   ├── pcre2_match_data_create_from_pattern.3
│   ├── pcre2_match_data_free.3
│   ├── pcre2_next_match.3
│   ├── pcre2_pattern_convert.3
│   ├── pcre2_pattern_info.3
│   ├── pcre2_serialize_decode.3
│   ├── pcre2_serialize_encode.3
│   ├── pcre2_serialize_free.3
│   ├── pcre2_serialize_get_number_of_codes.3
│   ├── pcre2_set_bsr.3
│   ├── pcre2_set_callout.3
│   ├── pcre2_set_character_tables.3
│   ├── pcre2_set_compile_extra_options.3
│   ├── pcre2_set_compile_recursion_guard.3
│   ├── pcre2_set_depth_limit.3
│   ├── pcre2_set_glob_escape.3
│   ├── pcre2_set_glob_separator.3
│   ├── pcre2_set_heap_limit.3
│   ├── pcre2_set_match_limit.3
│   ├── pcre2_set_max_pattern_compiled_length.3
│   ├── pcre2_set_max_pattern_length.3
│   ├── pcre2_set_max_varlookbehind.3
│   ├── pcre2_set_newline.3
│   ├── pcre2_set_offset_limit.3
│   ├── pcre2_set_optimize.3
│   ├── pcre2_set_parens_nest_limit.3
│   ├── pcre2_set_recursion_limit.3
│   ├── pcre2_set_recursion_memory_management.3
│   ├── pcre2_set_substitute_callout.3
│   ├── pcre2_set_substitute_case_callout.3
│   ├── pcre2_substitute.3
│   ├── pcre2_substring_copy_byname.3
│   ├── pcre2_substring_copy_bynumber.3
│   ├── pcre2_substring_free.3
│   ├── pcre2_substring_get_byname.3
│   ├── pcre2_substring_get_bynumber.3
│   ├── pcre2_substring_length_byname.3
│   ├── pcre2_substring_length_bynumber.3
│   ├── pcre2_substring_list_free.3
│   ├── pcre2_substring_list_get.3
│   ├── pcre2_substring_nametable_scan.3
│   ├── pcre2_substring_number_from_name.3
│   ├── pcre2api.3
│   ├── pcre2build.3
│   ├── pcre2callout.3
│   ├── pcre2compat.3
│   ├── pcre2convert.3
│   ├── pcre2demo.3
│   ├── pcre2grep.1
│   ├── pcre2grep.txt
│   ├── pcre2jit.3
│   ├── pcre2limits.3
│   ├── pcre2matching.3
│   ├── pcre2partial.3
│   ├── pcre2pattern.3
│   ├── pcre2perform.3
│   ├── pcre2posix.3
│   ├── pcre2sample.3
│   ├── pcre2serialize.3
│   ├── pcre2syntax.3
│   ├── pcre2test.1
│   ├── pcre2test.txt
│   └── pcre2unicode.3
├── libpcre2-16.pc.in
├── libpcre2-32.pc.in
├── libpcre2-8.pc.in
├── libpcre2-posix.pc.in
├── m4/
│   ├── ax_pthread.m4
│   ├── pcre2_check_vscript.m4
│   ├── pcre2_visibility.m4
│   └── pcre2_zos.m4
├── maint/
│   ├── .gitignore
│   ├── 132html
│   ├── CheckMan
│   ├── CheckTxt
│   ├── CleanTxt
│   ├── Detrail
│   ├── FetchUcd.sh
│   ├── FilterCoverage.py
│   ├── GenerateCommon.py
│   ├── GenerateTest.py
│   ├── GenerateUcd.py
│   ├── GenerateUcpHeader.py
│   ├── GenerateUcpTables.py
│   ├── LintMan
│   ├── ManyConfigTests
│   ├── README
│   ├── RunCoverage
│   ├── RunManifestTest
│   ├── RunManifestTest.ps1
│   ├── RunPerlTest
│   ├── RunSymbolTest
│   ├── RunSymbolTest.ps1
│   ├── Unicode.tables/
│   │   ├── BidiMirroring.txt
│   │   ├── CaseFolding.txt
│   │   ├── DerivedBidiClass.txt
│   │   ├── DerivedCoreProperties.txt
│   │   ├── DerivedGeneralCategory.txt
│   │   ├── GraphemeBreakProperty.txt
│   │   ├── PropList.txt
│   │   ├── PropertyAliases.txt
│   │   ├── PropertyValueAliases.txt
│   │   ├── ScriptExtensions.txt
│   │   ├── Scripts.txt
│   │   ├── UnicodeData.txt
│   │   └── emoji-data.txt
│   ├── UpdateAlways
│   ├── UpdateCommon.py
│   ├── UpdateDates.py
│   ├── UpdateRelease.py
│   ├── cmake-tests/
│   │   ├── build-interface/
│   │   │   ├── CMakeLists.txt
│   │   │   └── main.c
│   │   └── install-interface/
│   │       ├── CMakeLists.txt
│   │       └── main.c
│   ├── manifest-cmakeinstall-freebsd
│   ├── manifest-cmakeinstall-linux
│   ├── manifest-cmakeinstall-macos
│   ├── manifest-cmakeinstall-solaris
│   ├── manifest-cmakeinstall-windows
│   ├── manifest-makeinstall-freebsd
│   ├── manifest-makeinstall-linux
│   ├── manifest-makeinstall-solaris
│   ├── manifest-tarball
│   ├── pcre2_chartables.c.non-standard
│   ├── ucptest.c
│   └── ucptestdata/
│       ├── testinput1
│       ├── testinput2
│       ├── testoutput1
│       └── testoutput2
├── pcre2-config.in
├── perltest.sh
├── src/
│   ├── config-cmake.h.in
│   ├── config.h.generic
│   ├── libpcre2-16.sym.in
│   ├── libpcre2-32.sym.in
│   ├── libpcre2-8.sym.in
│   ├── libpcre2-posix.sym.in
│   ├── pcre2.h.generic
│   ├── pcre2.h.in
│   ├── pcre2_auto_possess.c
│   ├── pcre2_chartables.c.dist
│   ├── pcre2_chartables.c.ebcdic-1047-nl15
│   ├── pcre2_chartables.c.ebcdic-1047-nl25
│   ├── pcre2_chkdint.c
│   ├── pcre2_compile.c
│   ├── pcre2_compile.h
│   ├── pcre2_compile_cgroup.c
│   ├── pcre2_compile_class.c
│   ├── pcre2_config.c
│   ├── pcre2_context.c
│   ├── pcre2_convert.c
│   ├── pcre2_dfa_match.c
│   ├── pcre2_dftables.c
│   ├── pcre2_error.c
│   ├── pcre2_extuni.c
│   ├── pcre2_find_bracket.c
│   ├── pcre2_fuzzsupport.c
│   ├── pcre2_internal.h
│   ├── pcre2_intmodedep.h
│   ├── pcre2_jit_char_inc.h
│   ├── pcre2_jit_compile.c
│   ├── pcre2_jit_match_inc.h
│   ├── pcre2_jit_misc_inc.h
│   ├── pcre2_jit_simd_inc.h
│   ├── pcre2_jit_test.c
│   ├── pcre2_maketables.c
│   ├── pcre2_match.c
│   ├── pcre2_match_data.c
│   ├── pcre2_match_next.c
│   ├── pcre2_newline.c
│   ├── pcre2_ord2utf.c
│   ├── pcre2_pattern_info.c
│   ├── pcre2_printint_inc.h
│   ├── pcre2_script_run.c
│   ├── pcre2_serialize.c
│   ├── pcre2_string_utils.c
│   ├── pcre2_study.c
│   ├── pcre2_substitute.c
│   ├── pcre2_substring.c
│   ├── pcre2_tables.c
│   ├── pcre2_ucd.c
│   ├── pcre2_ucp.h
│   ├── pcre2_ucptables_inc.h
│   ├── pcre2_util.h
│   ├── pcre2_valid_utf.c
│   ├── pcre2_xclass.c
│   ├── pcre2demo.c
│   ├── pcre2grep.c
│   ├── pcre2posix.c
│   ├── pcre2posix.h
│   ├── pcre2posix_test.c
│   ├── pcre2test.c
│   └── pcre2test_inc.h
├── testdata/
│   ├── fuzzing/
│   │   ├── pcre2_fuzzer.dict
│   │   ├── pcre2_fuzzer.options
│   │   ├── pcre2_fuzzer_16.dict
│   │   ├── pcre2_fuzzer_16.options
│   │   ├── pcre2_fuzzer_32.dict
│   │   └── pcre2_fuzzer_32.options
│   ├── grepbinary
│   ├── grepfilelist
│   ├── grepinput
│   ├── grepinput3
│   ├── grepinput8
│   ├── grepinputBad8
│   ├── grepinputBad8_Trail
│   ├── grepinputC.bz2
│   ├── grepinputM
│   ├── grepinputUN
│   ├── grepinputv
│   ├── grepinputx
│   ├── greplist
│   ├── greplistBad
│   ├── grepnot.bz2
│   ├── grepoutput
│   ├── grepoutput8
│   ├── grepoutputC
│   ├── grepoutputCN
│   ├── grepoutputCNU
│   ├── grepoutputCU
│   ├── grepoutputCbz2
│   ├── grepoutputCgz
│   ├── grepoutputN
│   ├── grepoutputUN
│   ├── greppatN4
│   ├── testinput1
│   ├── testinput10
│   ├── testinput11
│   ├── testinput12
│   ├── testinput13
│   ├── testinput14
│   ├── testinput15
│   ├── testinput16
│   ├── testinput17
│   ├── testinput18
│   ├── testinput19
│   ├── testinput2
│   ├── testinput20
│   ├── testinput21
│   ├── testinput22
│   ├── testinput23
│   ├── testinput24
│   ├── testinput25
│   ├── testinput26
│   ├── testinput27
│   ├── testinput28
│   ├── testinput29
│   ├── testinput3
│   ├── testinput4
│   ├── testinput5
│   ├── testinput6
│   ├── testinput7
│   ├── testinput8
│   ├── testinput9
│   ├── testinputheap
│   ├── testoutput1
│   ├── testoutput10
│   ├── testoutput11-16
│   ├── testoutput11-32
│   ├── testoutput12-16
│   ├── testoutput12-32
│   ├── testoutput13
│   ├── testoutput14-16
│   ├── testoutput14-32
│   ├── testoutput14-8
│   ├── testoutput15
│   ├── testoutput17
│   ├── testoutput18
│   ├── testoutput19
│   ├── testoutput2
│   ├── testoutput20
│   ├── testoutput21
│   ├── testoutput22-16
│   ├── testoutput22-32
│   ├── testoutput22-8
│   ├── testoutput23
│   ├── testoutput24
│   ├── testoutput25
│   ├── testoutput26
│   ├── testoutput27
│   ├── testoutput28
│   ├── testoutput29
│   ├── testoutput3
│   ├── testoutput3A
│   ├── testoutput3B
│   ├── testoutput3C
│   ├── testoutput4
│   ├── testoutput5
│   ├── testoutput6
│   ├── testoutput7
│   ├── testoutput8-16-2
│   ├── testoutput8-16-4
│   ├── testoutput8-32-4
│   ├── testoutput8-8-2
│   ├── testoutput8-8-3
│   ├── testoutput8-8-4
│   ├── testoutput9
│   ├── testoutputheap-16
│   ├── testoutputheap-32
│   ├── testoutputheap-8
│   ├── valgrind-jit.supp
│   ├── wintestinput3
│   └── wintestoutput3
└── vms/
    ├── configure.com
    ├── openvms_readme.txt
    ├── pcre2.h_patch
    └── stdint.h
Download .txt
SYMBOL INDEX (642 symbols across 56 files)

FILE: .github/scripts/merge_sarif.py
  function fix_region (line 32) | def fix_region(region):
  function fix_regions (line 50) | def fix_regions(data):

FILE: maint/FilterCoverage.py
  function scan_exclusions (line 11) | def scan_exclusions(srcpath):
  function process_block (line 54) | def process_block(block_lines):
  function filter_lcov (line 246) | def filter_lcov(in_fh, out_fh):

FILE: maint/GenerateCommon.py
  function getbpropslist (line 119) | def getbpropslist():
  function collect_property_names (line 161) | def collect_property_names():
  function reorder_scripts (line 222) | def reorder_scripts():
  function open_output (line 285) | def open_output(default):

FILE: maint/GenerateTest.py
  function write_both (line 18) | def write_both(text):
  function to_string_char (line 22) | def to_string_char(ch_idx):
  function gen_script_tests (line 46) | def gen_script_tests():

FILE: maint/GenerateUcd.py
  function make_get_names (line 277) | def make_get_names(enum):
  function get_bidi (line 283) | def get_bidi(chardata):
  function get_other_case (line 292) | def get_other_case(chardata):
  function get_script_extension (line 300) | def get_script_extension(chardata):
  function read_table (line 314) | def read_table(file_name, get_value, default_value):
  function get_type_size (line 357) | def get_type_size(table):
  function get_tables_size (line 372) | def get_tables_size(*tables):
  function compress_table (line 382) | def compress_table(table, block_size):
  function write_table (line 401) | def write_table(table, table_name, block_size = None):
  function combine_tables (line 430) | def combine_tables(*tables):
  function get_record_size_struct (line 443) | def get_record_size_struct(records):
  function write_records (line 465) | def write_records(records, record_size):
  function write_bitsets (line 477) | def write_bitsets(list, item_size):

FILE: maint/GenerateUcpTables.py
  function stdname (line 80) | def stdname(x):
  function stdnames (line 83) | def stdnames(x):

FILE: maint/UpdateCommon.py
  function get_current_release (line 8) | def get_current_release():
  function update_file (line 21) | def update_file(filename, pattern, replacement):

FILE: maint/UpdateDates.py
  function get_last_date (line 20) | def get_last_date(filename):
  function check_no_match (line 24) | def check_no_match(filename, pattern):
  function update_man_date (line 31) | def update_man_date(filename):

FILE: maint/UpdateRelease.py
  function update_man_version (line 13) | def update_man_version(filename):

FILE: maint/cmake-tests/build-interface/main.c
  function main (line 5) | int main(void)

FILE: maint/cmake-tests/install-interface/main.c
  function main (line 5) | int main(void)

FILE: maint/ucptest.c
  function BOOL (line 211) | static BOOL
  function print_prop (line 277) | static void
  function find_chars (line 452) | static void
  function process_command_line (line 813) | static void
  function main (line 937) | int

FILE: src/pcre2_auto_possess.c
  function BOOL (line 200) | static BOOL
  function PCRE2_UCHAR (line 296) | static PCRE2_UCHAR
  function PCRE2_SPTR (line 330) | static PCRE2_SPTR
  function BOOL (line 547) | static BOOL

FILE: src/pcre2_chkdint.c
  function BOOL (line 65) | BOOL

FILE: src/pcre2_compile.c
  type verbitem (line 521) | typedef struct verbitem {
  type alasitem (line 560) | typedef struct alasitem {
  type pso (line 731) | typedef struct pso {
  function show_parsed (line 836) | static void show_parsed(compile_block *cb)
  function PCRE2_CALL_CONVENTION (line 1200) | PCRE2_CALL_CONVENTION
  function BOOL (line 1259) | static BOOL
  function BOOL (line 1349) | static BOOL
  function BOOL (line 2258) | static BOOL
  function BOOL (line 2505) | static BOOL
  function check_posix_name (line 2546) | static int
  function BOOL (line 2592) | static BOOL
  function max_parsed_pattern (line 2978) | static ptrdiff_t
  type nest_save (line 3038) | typedef struct nest_save {
  function parse_regex (line 3112) | static int parse_regex(PCRE2_SPTR ptr, uint32_t options, uint32_t xoptions,
  function PCRE2_UCHAR (line 5967) | static const PCRE2_UCHAR*
  function compile_branch (line 6067) | static int
  function compile_regex (line 8574) | static int
  function BOOL (line 8895) | static BOOL
  function BOOL (line 9000) | static BOOL
  function PCRE2_UCHAR (line 9123) | static PCRE2_UCHAR *
  function find_firstassertedcu (line 9280) | static uint32_t
  function get_grouplength (line 9509) | static int
  function get_branchlength (line 9583) | static int
  function BOOL (line 10013) | static BOOL
  function check_lookbehinds (line 10104) | static int

FILE: src/pcre2_compile.h
  type eclass_op_info (line 255) | typedef struct {

FILE: src/pcre2_compile_cgroup.c
  function named_group (line 86) | named_group *
  function BOOL (line 211) | BOOL
  function do_heapify_u16 (line 464) | static void do_heapify_u16(uint16_t *captures, size_t size, size_t i)
  function BOOL (line 506) | BOOL

FILE: src/pcre2_compile_class.c
  type eclass_context (line 46) | typedef struct {
  function do_heapify (line 88) | static void do_heapify(uint32_t *buffer, size_t size, size_t i)
  function utf_caseless_extend (line 152) | static size_t
  function append_char_list (line 267) | static size_t
  function get_highest_char (line 294) | static uint32_t
  function append_negated_char_list (line 311) | static size_t
  function parse_class (line 360) | static size_t
  function class_ranges (line 499) | static class_ranges *
  function add_to_class (line 909) | static void
  function add_list_to_class (line 1014) | static void
  function add_not_list_to_class (line 1047) | static void
  function fold_negation (line 1880) | static void
  function fold_binary (line 1930) | static void
  function BOOL (line 2130) | static BOOL
  function BOOL (line 2294) | static BOOL
  function BOOL (line 2354) | static BOOL
  function BOOL (line 2384) | static BOOL
  function BOOL (line 2445) | static BOOL
  function BOOL (line 2542) | static BOOL
  function BOOL (line 2571) | BOOL

FILE: src/pcre2_config.c
  function PCRE2_CALL_CONVENTION (line 70) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_context.c
  function default_free (line 59) | static void default_free(void *block, void *data)
  function PCRE2_CALL_CONVENTION (line 282) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 290) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 298) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 306) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 325) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 333) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 348) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 355) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 362) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 381) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 388) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 395) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 402) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 411) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 446) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 455) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 465) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 476) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 483) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 490) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 497) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 507) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 513) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 528) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 547) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_convert.c
  function convert_posix (line 149) | static int
  type pcre2_output_context (line 393) | typedef struct pcre2_output_context {
  function convert_glob_write (line 408) | static void
  function convert_glob_write_str (line 425) | static void
  function convert_glob_print_separator (line 455) | static void
  function convert_glob_print_wildcard (line 474) | static void
  function convert_glob_parse_class (line 499) | static int
  function BOOL (line 563) | static BOOL
  function convert_glob_parse_range (line 636) | static int
  function convert_glob_print_commit (line 813) | static void
  function convert_glob (line 846) | static int
  function PCRE2_CALL_CONVENTION (line 1116) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 1250) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_dfa_match.c
  type stateblock (line 303) | typedef struct stateblock {
  type RWS_anchor (line 332) | typedef struct RWS_anchor {
  function do_callout_dfa (line 360) | static int
  function more_workspace (line 420) | static int
  function internal_dfa_match (line 529) | static int
  function PCRE2_CALL_CONVENTION (line 3339) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_dftables.c
  function identity (line 75) | static int identity(int c) { return c; }
  function ebcdic_to_unicode (line 78) | static int ebcdic_to_unicode(int c)
  function unicode_to_ebcdic (line 85) | static int unicode_to_ebcdic(int c)
  function usage (line 98) | static void
  function main (line 117) | int main(int argc, char **argv)

FILE: src/pcre2_error.c
  function PCRE2_CALL_CONVENTION (line 332) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_extuni.c
  function PCRE2_SPTR (line 56) | PCRE2_SPTR
  function PCRE2_SPTR (line 92) | PCRE2_SPTR

FILE: src/pcre2_find_bracket.c
  function PCRE2_SPTR (line 66) | PCRE2_SPTR

FILE: src/pcre2_fuzzsupport.c
  function print_compile_options (line 105) | static void print_compile_options(FILE *stream, uint32_t compile_options)
  function print_match_options (line 143) | static void print_match_options(FILE *stream, uint32_t match_options)
  function print_error (line 165) | static void print_error(FILE *f, int errorcode, const char *text, ...)
  function dump_matches (line 182) | static void dump_matches(FILE *stream, int count, pcre2_match_data *matc...
  function describe_failure (line 212) | static void describe_failure(
  function callout_function (line 280) | static int callout_function(pcre2_callout_block *cb, void *callout_data)
  function LLVMFuzzerInitialize (line 294) | int LLVMFuzzerInitialize(int *argc, char ***argv)
  function LLVMFuzzerTestOneInput (line 319) | int LLVMFuzzerTestOneInput(unsigned char *data, size_t size)
  function main (line 766) | int main(int argc, char **argv)

FILE: src/pcre2_internal.h
  type BOOL (line 93) | typedef int BOOL;
  type open_capitem (line 2091) | typedef struct open_capitem {
  type ucp_type_table (line 2102) | typedef struct {
  type ucd_record (line 2110) | typedef struct {
  type pcre2_serialized_data (line 2169) | typedef struct pcre2_serialized_data {

FILE: src/pcre2_intmodedep.h
  type pcre2_real_general_context (line 595) | typedef struct pcre2_real_general_context {
  type pcre2_real_compile_context (line 601) | typedef struct pcre2_real_compile_context {
  type pcre2_real_match_context (line 618) | typedef struct pcre2_real_match_context {
  type pcre2_real_convert_context (line 639) | typedef struct pcre2_real_convert_context {
  type pcre2_real_code (line 660) | typedef struct pcre2_real_code {
  type heapframe (line 696) | struct heapframe
  type pcre2_real_match_data (line 698) | typedef struct pcre2_real_match_data {
  type recurse_check (line 728) | typedef struct recurse_check {
  type parsed_recurse_check (line 733) | typedef struct parsed_recurse_check {
  type recurse_cache (line 740) | typedef struct recurse_cache {
  type branch_chain (line 748) | typedef struct branch_chain {
  type named_group (line 757) | typedef struct named_group {
  type compile_data (line 767) | typedef struct compile_data {
  type class_ranges (line 777) | typedef struct class_ranges {
  type recurse_arguments (line 788) | typedef struct recurse_arguments {
  type class_bits_storage (line 794) | typedef union class_bits_storage {
  type compile_block (line 802) | typedef struct compile_block {
  type pcre2_real_jit_stack (line 854) | typedef struct pcre2_real_jit_stack {
  type dfa_recursion_info (line 862) | typedef struct dfa_recursion_info {
  type heapframe (line 876) | typedef struct heapframe {
  type heapframe_align (line 1024) | typedef struct heapframe_align {
  type match_block (line 1036) | typedef struct match_block {
  type dfa_match_block (line 1085) | typedef struct dfa_match_block {

FILE: src/pcre2_jit_char_inc.h
  type xclass_stack_item (line 74) | typedef struct xclass_stack_item {
  type xclass_ranges (line 80) | typedef struct xclass_ranges {
  function xclass_compute_ranges (line 90) | static void xclass_compute_ranges(compiler_common *common, PCRE2_SPTR cc...
  function xclass_check_bitset (line 283) | static void xclass_check_bitset(compiler_common *common, const sljit_u8 ...
  function xclass_update_min_max (line 305) | static void xclass_update_min_max(compiler_common *common, PCRE2_SPTR cc...
  function compile_xclass_matchingpath (line 501) | static void compile_xclass_matchingpath(compiler_common *common, PCRE2_S...
  function PCRE2_SPTR (line 1231) | static PCRE2_SPTR compile_eclass_matchingpath(compiler_common *common, P...
  function PCRE2_SPTR (line 1485) | static PCRE2_SPTR SLJIT_FUNC do_extuni_utf(jit_arguments *args, PCRE2_SP...
  function PCRE2_SPTR (line 1568) | static PCRE2_SPTR SLJIT_FUNC do_extuni_utf_invalid(jit_arguments *args, ...
  function PCRE2_SPTR (line 1648) | static PCRE2_SPTR SLJIT_FUNC do_extuni_no_utf(jit_arguments *args, PCRE2...
  function compile_clist (line 1729) | static void compile_clist(compiler_common *common, PCRE2_SPTR cc, jump_l...
  function PCRE2_SPTR (line 1816) | static PCRE2_SPTR compile_char1_matchingpath(compiler_common *common, PC...
  function SLJIT_INLINE (line 2214) | static SLJIT_INLINE PCRE2_SPTR compile_charn_matchingpath(compiler_commo...

FILE: src/pcre2_jit_compile.c
  function pcre2_jit_free (line 75) | static void pcre2_jit_free(void *ptr, void *allocator_data)
  type jit_arguments (line 179) | typedef struct jit_arguments {
  type executable_functions (line 199) | typedef struct executable_functions {
  type jump_list (line 207) | typedef struct jump_list {
  type stub_list (line 212) | typedef struct stub_list {
  type frame_types (line 218) | enum frame_types {
  type control_types (line 223) | enum control_types {
  type early_fail_types (line 228) | enum  early_fail_types {
  type backtrack_common (line 240) | typedef struct backtrack_common {
  type assert_backtrack (line 260) | typedef struct assert_backtrack {
  type bracket_backtrack (line 271) | typedef struct bracket_backtrack {
  type bracketpos_backtrack (line 293) | typedef struct bracketpos_backtrack {
  type braminzero_backtrack (line 303) | typedef struct braminzero_backtrack {
  type char_iterator_backtrack (line 308) | typedef struct char_iterator_backtrack {
  type ref_iterator_backtrack (line 320) | typedef struct ref_iterator_backtrack {
  type recurse_entry (line 327) | typedef struct recurse_entry {
  type recurse_backtrack (line 345) | typedef struct recurse_backtrack {
  type vreverse_backtrack (line 355) | typedef struct vreverse_backtrack {
  type then_trap_backtrack (line 363) | typedef struct then_trap_backtrack {
  type fast_forward_char_data (line 379) | typedef struct fast_forward_char_data {
  type compiler_common (line 391) | typedef struct compiler_common {
  type compare_context (line 546) | typedef struct compare_context {
  function PCRE2_SPTR (line 874) | static PCRE2_SPTR bracketend(PCRE2_SPTR cc)
  function no_alternatives (line 883) | static int no_alternatives(PCRE2_SPTR cc)
  function BOOL (line 897) | static BOOL find_vreverse(PCRE2_SPTR cc)
  function PCRE2_SPTR (line 924) | static PCRE2_SPTR next_opcode(compiler_common *common, PCRE2_SPTR cc)
  function sljit_s32 (line 1131) | static sljit_s32 ref_update_local_size(compiler_common *common, PCRE2_SP...
  function SLJIT_INLINE (line 1155) | static SLJIT_INLINE BOOL is_optimized_cbracket(compiler_common *common, ...
  function SLJIT_INLINE (line 1161) | static SLJIT_INLINE void clear_optimized_cbracket(compiler_common *commo...
  function BOOL (line 1167) | static BOOL check_opcode_types(compiler_common *common, PCRE2_SPTR cc, P...
  function detect_early_fail (line 1397) | static int detect_early_fail(compiler_common *common, PCRE2_SPTR cc,
  function get_class_iterator_size (line 1773) | static int get_class_iterator_size(PCRE2_SPTR cc)
  function BOOL (line 1805) | static BOOL detect_repeat(compiler_common *common, PCRE2_SPTR begin)
  function set_private_data_ptrs (line 1944) | static void set_private_data_ptrs(compiler_common *common, int *private_...
  function SLJIT_INLINE (line 2148) | static SLJIT_INLINE BOOL is_cbracket_processed(compiler_common *common, ...
  function get_framesize (line 2159) | static int get_framesize(compiler_common *common, PCRE2_SPTR cc, PCRE2_S...
  function init_frame (line 2363) | static void init_frame(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPT...
  type delayed_mem_copy_status (line 2513) | typedef struct delayed_mem_copy_status {
  function delayed_mem_copy_init (line 2522) | static void delayed_mem_copy_init(delayed_mem_copy_status *status, compi...
  function delayed_mem_copy_move (line 2537) | static void delayed_mem_copy_move(delayed_mem_copy_status *status, int l...
  function delayed_mem_copy_finish (line 2562) | static void delayed_mem_copy_finish(delayed_mem_copy_status *status)
  function BOOL (line 2588) | static BOOL recurse_check_bit(compiler_common *common, sljit_sw bit_index)
  type get_recurse_flags (line 2609) | enum get_recurse_flags {
  function get_recurse_data_length (line 2618) | static int get_recurse_data_length(compiler_common *common, PCRE2_SPTR c...
  type copy_recurse_data_types (line 2901) | enum copy_recurse_data_types {
  function copy_recurse_data (line 2909) | static void copy_recurse_data(compiler_common *common, PCRE2_SPTR cc, PC...
  function SLJIT_INLINE (line 3386) | static SLJIT_INLINE PCRE2_SPTR set_then_offsets(compiler_common *common,...
  function SLJIT_INLINE (line 3461) | static SLJIT_INLINE BOOL is_powerof2(unsigned int value)
  function SLJIT_INLINE (line 3466) | static SLJIT_INLINE void set_jumps(jump_list *list, struct sljit_label *...
  function SLJIT_INLINE (line 3477) | static SLJIT_INLINE void add_jump(struct sljit_compiler *compiler, jump_...
  function add_stub (line 3488) | static void add_stub(compiler_common *common, struct sljit_jump *start)
  function flush_stubs (line 3502) | static void flush_stubs(compiler_common *common)
  function SLJIT_INLINE (line 3517) | static SLJIT_INLINE void count_match(compiler_common *common)
  function SLJIT_INLINE (line 3525) | static SLJIT_INLINE void allocate_stack(compiler_common *common, sljit_s...
  function SLJIT_INLINE (line 3546) | static SLJIT_INLINE void free_stack(compiler_common *common, sljit_s32 s...
  function sljit_uw (line 3554) | static sljit_uw * allocate_read_only_data(compiler_common *common, sljit...
  function SLJIT_INLINE (line 3574) | static SLJIT_INLINE void reset_ovector(compiler_common *common, int length)
  function SLJIT_INLINE (line 3613) | static SLJIT_INLINE void reset_early_fail(compiler_common *common)
  function SLJIT_INLINE (line 3663) | static SLJIT_INLINE void do_reset_match(compiler_common *common, int len...
  function sljit_sw (line 3717) | static sljit_sw SLJIT_FUNC do_search_mark(sljit_sw *current, PCRE2_SPTR ...
  function SLJIT_INLINE (line 3741) | static SLJIT_INLINE void copy_ovector(compiler_common *common, int topbr...
  function SLJIT_INLINE (line 3838) | static SLJIT_INLINE void return_with_partial_match(compiler_common *comm...
  function SLJIT_INLINE (line 3876) | static SLJIT_INLINE void check_start_used_ptr(compiler_common *common)
  function SLJIT_INLINE (line 3900) | static SLJIT_INLINE BOOL char_has_othercase(compiler_common *common, PCR...
  function char_othercase (line 3926) | static SLJIT_INLINE unsigned int char_othercase(compiler_common *common,...
  function char_get_othercase_bit (line 3936) | static unsigned int char_get_othercase_bit(compiler_common *common, PCRE...
  function check_partial (line 4015) | static void check_partial(compiler_common *common, BOOL force)
  function check_str_end (line 4045) | static void check_str_end(compiler_common *common, jump_list **end_reached)
  function detect_partial_match (line 4075) | static void detect_partial_match(compiler_common *common, jump_list **ba...
  function process_partial_match (line 4108) | static void process_partial_match(compiler_common *common)
  function detect_partial_match_to (line 4129) | static void detect_partial_match_to(compiler_common *common, struct slji...
  function peek_char (line 4137) | static void peek_char(compiler_common *common, sljit_u32 max, sljit_s32 ...
  function peek_char_back (line 4221) | static void peek_char_back(compiler_common *common, sljit_u32 max, jump_...
  function read_char (line 4294) | static void read_char(compiler_common *common, sljit_u32 min, sljit_u32 ...
  function skip_valid_char (line 4488) | static void skip_valid_char(compiler_common *common)
  function BOOL (line 4521) | static BOOL is_char7_bitset(const sljit_u8 *bitset, BOOL nclass)
  function read_char7_type (line 4538) | static void read_char7_type(compiler_common *common, jump_list **backtra...
  function read_char8_type (line 4576) | static void read_char8_type(compiler_common *common, jump_list **backtra...
  function move_back (line 4695) | static void move_back(compiler_common *common, jump_list **backtracks, B...
  function check_newlinechar (line 4782) | static void check_newlinechar(compiler_common *common, int nltype, jump_...
  function do_utfreadchar (line 4818) | static void do_utfreadchar(compiler_common *common)
  function do_utfreadtype8 (line 4863) | static void do_utfreadtype8(compiler_common *common)
  function do_utfreadchar_invalid (line 4899) | static void do_utfreadchar_invalid(compiler_common *common)
  function do_utfreadnewline_invalid (line 5058) | static void do_utfreadnewline_invalid(compiler_common *common)
  function do_utfmoveback_invalid (line 5149) | static void do_utfmoveback_invalid(compiler_common *common)
  function do_utfpeakcharback (line 5245) | static void do_utfpeakcharback(compiler_common *common)
  function do_utfpeakcharback_invalid (line 5282) | static void do_utfpeakcharback_invalid(compiler_common *common)
  function do_utfreadchar_invalid (line 5418) | static void do_utfreadchar_invalid(compiler_common *common)
  function do_utfreadnewline_invalid (line 5450) | static void do_utfreadnewline_invalid(compiler_common *common)
  function do_utfmoveback_invalid (line 5482) | static void do_utfmoveback_invalid(compiler_common *common)
  function do_utfpeakcharback_invalid (line 5510) | static void do_utfpeakcharback_invalid(compiler_common *common)
  function do_getucd (line 5548) | static void do_getucd(compiler_common *common)
  function do_getucdtype (line 5587) | static void do_getucdtype(compiler_common *common)
  function sljit_label (line 5634) | sljit_label *mainloop_entry(compiler_common *common)
  function SLJIT_INLINE (line 5826) | static SLJIT_INLINE void add_prefix_char(PCRE2_UCHAR chr, fast_forward_c...
  function scan_prefix (line 5883) | static int scan_prefix(compiler_common *common, PCRE2_SPTR cc, fast_forw...
  function jumpto_if_not_utf_char_start (line 6376) | static void jumpto_if_not_utf_char_start(struct sljit_compiler *compiler...
  function BOOL (line 6394) | static BOOL check_fast_forward_char_pair_simd(compiler_common *common, f...
  function fast_forward_first_char2 (line 6442) | static void fast_forward_first_char2(compiler_common *common, PCRE2_UCHA...
  function SLJIT_INLINE (line 6528) | static SLJIT_INLINE BOOL fast_forward_first_n_chars(compiler_common *com...
  function SLJIT_INLINE (line 6757) | static SLJIT_INLINE void fast_forward_first_char(compiler_common *common)
  function SLJIT_INLINE (line 6775) | static SLJIT_INLINE void fast_forward_newline(compiler_common *common)
  function SLJIT_INLINE (line 6950) | static SLJIT_INLINE void fast_forward_start_bits(compiler_common *common)
  function SLJIT_INLINE (line 7022) | static SLJIT_INLINE jump_list *search_requested_char(compiler_common *co...
  function do_revertframes (line 7098) | static void do_revertframes(compiler_common *common)
  function check_wordboundary (line 7163) | static void check_wordboundary(compiler_common *common, BOOL ucp)
  function BOOL (line 7313) | static BOOL optimize_class_ranges(compiler_common *common, const sljit_u...
  function BOOL (line 7465) | static BOOL optimize_class_chars(compiler_common *common, const sljit_u8...
  function BOOL (line 7566) | static BOOL optimize_class(compiler_common *common, const sljit_u8 *bits...
  function do_casefulcmp (line 7692) | static void do_casefulcmp(compiler_common *common)
  function do_caselesscmp (line 7774) | static void do_caselesscmp(compiler_common *common)
  function PCRE2_SPTR (line 7876) | static PCRE2_SPTR compile_simple_assertion_matchingpath(compiler_common ...
  type backtrack_common (line 8121) | struct backtrack_common
  function compile_dnref_search (line 8151) | static void compile_dnref_search(compiler_common *common, PCRE2_SPTR cc,...
  function compile_ref_matchingpath (line 8181) | static void compile_ref_matchingpath(compiler_common *common, PCRE2_SPTR...
  function SLJIT_INLINE (line 8388) | static SLJIT_INLINE PCRE2_SPTR compile_ref_iterator_matchingpath(compile...
  function SLJIT_INLINE (line 8714) | static SLJIT_INLINE PCRE2_SPTR compile_recurse_matchingpath(compiler_com...
  function sljit_s32 (line 8785) | static sljit_s32 SLJIT_FUNC do_callout_jit(struct jit_arguments *argumen...
  function SLJIT_INLINE (line 8842) | static SLJIT_INLINE PCRE2_SPTR compile_callout_matchingpath(compiler_com...
  function PCRE2_SPTR (line 8920) | static PCRE2_SPTR compile_reverse_matchingpath(compiler_common *common, ...
  function SLJIT_INLINE (line 9020) | static SLJIT_INLINE BOOL assert_needs_str_ptr_saving(PCRE2_SPTR cc)
  function PCRE2_SPTR (line 9052) | static PCRE2_SPTR compile_assert_matchingpath(compiler_common *common, P...
  function SLJIT_INLINE (line 9530) | static SLJIT_INLINE void match_once_common(compiler_common *common, PCRE...
  function SLJIT_INLINE (line 9578) | static SLJIT_INLINE int match_capture_common(compiler_common *common, in...
  function PCRE2_SPTR (line 9603) | static PCRE2_SPTR SLJIT_FUNC do_script_run(PCRE2_SPTR ptr, PCRE2_SPTR en...
  function PCRE2_SPTR (line 9612) | static PCRE2_SPTR SLJIT_FUNC do_script_run_utf(PCRE2_SPTR ptr, PCRE2_SPT...
  function match_script_run_common (line 9621) | static void match_script_run_common(compiler_common *common, int private...
  function PCRE2_SPTR (line 9692) | static PCRE2_SPTR compile_bracket_matchingpath(compiler_common *common, ...
  function PCRE2_SPTR (line 10396) | static PCRE2_SPTR compile_bracketpos_matchingpath(compiler_common *commo...
  function SLJIT_INLINE (line 10674) | static SLJIT_INLINE PCRE2_SPTR get_iterator_parameters(compiler_common *...
  type sljit_jump (line 10836) | struct sljit_jump
  type sljit_label (line 10837) | struct sljit_label
  function else (line 10984) | else if (type == OP_ALLANY)
  function compile_newline_move_back (line 12036) | static void compile_newline_move_back(compiler_common *common)
  function compile_iterator_backtrackingpath (line 12058) | static void compile_iterator_backtrackingpath(compiler_common *common, s...
  function SLJIT_INLINE (line 12242) | static SLJIT_INLINE void compile_ref_iterator_backtrackingpath(compiler_...
  function SLJIT_INLINE (line 12273) | static SLJIT_INLINE void compile_recurse_backtrackingpath(compiler_commo...
  function compile_assert_backtrackingpath (line 12293) | static void compile_assert_backtrackingpath(compiler_common *common, str...
  function compile_bracket_backtrackingpath (line 12362) | static void compile_bracket_backtrackingpath(compiler_common *common, st...
  function SLJIT_INLINE (line 12905) | static SLJIT_INLINE void compile_bracketpos_backtrackingpath(compiler_co...
  function SLJIT_INLINE (line 12952) | static SLJIT_INLINE void compile_braminzero_backtrackingpath(compiler_co...
  function SLJIT_INLINE (line 12980) | static SLJIT_INLINE void compile_control_verb_backtrackingpath(compiler_...
  function SLJIT_INLINE (line 13055) | static SLJIT_INLINE void compile_vreverse_backtrackingpath(compiler_comm...
  function SLJIT_INLINE (line 13072) | static SLJIT_INLINE void compile_then_trap_backtrackingpath(compiler_com...
  function compile_backtrackingpath (line 13110) | static void compile_backtrackingpath(compiler_common *common, struct bac...
  function SLJIT_INLINE (line 13313) | static SLJIT_INLINE void compile_recurse(compiler_common *common)
  function jit_compile (line 13528) | static int jit_compile(pcre2_code *code, sljit_u32 mode)
  function PCRE2_CALL_CONVENTION (line 14290) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_jit_match_inc.h
  function SLJIT_NOINLINE (line 53) | static SLJIT_NOINLINE int jit_machine_stack_exec(jit_arguments *argument...
  function PCRE2_CALL_CONVENTION (line 90) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_jit_misc_inc.h
  function PCRE2_CALL_CONVENTION (line 106) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 165) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 187) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_jit_simd_inc.h
  type vector_compare_type (line 49) | typedef enum {
  function SLJIT_INLINE (line 56) | static SLJIT_INLINE sljit_s32 max_fast_forward_char_pair_offset(void)
  function SLJIT_INLINE (line 75) | static SLJIT_INLINE sljit_s32 max_fast_forward_char_pair_offset(void)
  type sljit_jump (line 90) | struct sljit_jump
  type sljit_compiler (line 90) | struct sljit_compiler
  function sljit_s32 (line 108) | static sljit_s32 character_to_int32(PCRE2_UCHAR chr)
  function fast_forward_char_pair_sse2_compare (line 125) | static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *c...
  function fast_forward_char_simd (line 241) | static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR ...
  function jump_list (line 385) | static jump_list *fast_requested_char_simd(compiler_common *common, PCRE...
  function fast_forward_char_pair_simd (line 498) | static void fast_forward_char_pair_simd(compiler_common *common, sljit_s...
  function fast_forward_char_pair_sse2_compare (line 781) | static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *c...
  function fast_forward_char_simd (line 832) | static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR ...
  function jump_list (line 960) | static jump_list *fast_requested_char_simd(compiler_common *common, PCRE...
  function fast_forward_char_pair_simd (line 1050) | static void fast_forward_char_pair_simd(compiler_common *common, sljit_s...
  function load_from_mem_vector (line 1276) | static void load_from_mem_vector(struct sljit_compiler *compiler, BOOL v...
  function replicate_imm_vector (line 1290) | static void replicate_imm_vector(struct sljit_compiler *compiler, int st...
  function fast_forward_char_pair_sse2_compare (line 1331) | static void fast_forward_char_pair_sse2_compare(struct sljit_compiler *c...
  function fast_forward_char_simd (line 1383) | static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR ...
  function jump_list (line 1584) | static jump_list *fast_requested_char_simd(compiler_common *common, PCRE...
  function fast_forward_char_pair_simd (line 1746) | static void fast_forward_char_pair_simd(compiler_common *common, sljit_s...
  type sljit_ins (line 2004) | typedef sljit_ins sljit_u32;
  function fast_forward_char_pair_lsx_compare (line 2036) | static void fast_forward_char_pair_lsx_compare(struct sljit_compiler *co...
  function fast_forward_char_simd (line 2068) | static void fast_forward_char_simd(compiler_common *common, PCRE2_UCHAR ...
  function jump_list (line 2204) | static jump_list *fast_requested_char_simd(compiler_common *common, PCRE...
  function fast_forward_char_pair_simd (line 2303) | static void fast_forward_char_pair_simd(compiler_common *common, sljit_s...

FILE: src/pcre2_jit_test.c
  function main (line 104) | int main(void)
  type regression_test_case (line 154) | struct regression_test_case {
  type regression_test_case (line 163) | struct regression_test_case
  function pcre2_jit_stack_8 (line 949) | static pcre2_jit_stack_8* callback8(void *arg)
  function pcre2_jit_stack_16 (line 956) | static pcre2_jit_stack_16* callback16(void *arg)
  function pcre2_jit_stack_32 (line 963) | static pcre2_jit_stack_32* callback32(void *arg)
  function pcre2_jit_stack_8 (line 972) | static pcre2_jit_stack_8 *getstack8(void)
  function setstack8 (line 979) | static void setstack8(pcre2_match_context_8 *mcontext)
  function pcre2_jit_stack_16 (line 995) | static pcre2_jit_stack_16 *getstack16(void)
  function setstack16 (line 1002) | static void setstack16(pcre2_match_context_16 *mcontext)
  function pcre2_jit_stack_32 (line 1018) | static pcre2_jit_stack_32 *getstack32(void)
  function setstack32 (line 1025) | static void setstack32(pcre2_match_context_32 *mcontext)
  function convert_utf8_to_utf16 (line 1040) | static int convert_utf8_to_utf16(PCRE2_SPTR8 input, PCRE2_UCHAR16 *outpu...
  function copy_char8_to_char16 (line 1088) | static int copy_char8_to_char16(PCRE2_SPTR8 input, PCRE2_UCHAR16 *output...
  function convert_utf8_to_utf32 (line 1112) | static int convert_utf8_to_utf32(PCRE2_SPTR8 input, PCRE2_UCHAR32 *outpu...
  function copy_char8_to_char32 (line 1148) | static int copy_char8_to_char32(PCRE2_SPTR8 input, PCRE2_UCHAR32 *output...
  function check_ascii (line 1170) | static int check_ascii(const char *input)
  function regression_tests (line 1183) | static int regression_tests(void)
  function check_invalid_utf_result (line 1828) | static int check_invalid_utf_result(int pattern_index, const char *type,...
  type invalid_utf8_regression_test_case (line 1867) | struct invalid_utf8_regression_test_case {
  type invalid_utf8_regression_test_case (line 1881) | struct invalid_utf8_regression_test_case
  function run_invalid_utf8_test (line 2036) | static int run_invalid_utf8_test(const struct invalid_utf8_regression_te...
  function invalid_utf8_regression_tests (line 2087) | static int invalid_utf8_regression_tests(void)
  function invalid_utf8_regression_tests (line 2145) | static int invalid_utf8_regression_tests(void)
  type invalid_utf16_regression_test_case (line 2158) | struct invalid_utf16_regression_test_case {
  type invalid_utf16_regression_test_case (line 2191) | struct invalid_utf16_regression_test_case
  function run_invalid_utf16_test (line 2245) | static int run_invalid_utf16_test(const struct invalid_utf16_regression_...
  function invalid_utf16_regression_tests (line 2303) | static int invalid_utf16_regression_tests(void)
  function invalid_utf16_regression_tests (line 2353) | static int invalid_utf16_regression_tests(void)
  type invalid_utf32_regression_test_case (line 2366) | struct invalid_utf32_regression_test_case {
  type invalid_utf32_regression_test_case (line 2392) | struct invalid_utf32_regression_test_case
  function run_invalid_utf32_test (line 2432) | static int run_invalid_utf32_test(const struct invalid_utf32_regression_...
  function invalid_utf32_regression_tests (line 2490) | static int invalid_utf32_regression_tests(void)
  function invalid_utf32_regression_tests (line 2540) | static int invalid_utf32_regression_tests(void)

FILE: src/pcre2_maketables.c
  function PCRE2_EXP_DEFN (line 80) | PCRE2_EXP_DEFN const uint8_t * PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 167) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_match.c
  function display_frames (line 214) | static void
  function do_callout (line 268) | static int
  function match_ref (line 357) | static int
  function recurse_update_offsets (line 512) | static void
  function match (line 684) | static int

FILE: src/pcre2_match_data.c
  function PCRE2_CALL_CONVENTION (line 96) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 117) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 141) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 153) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 165) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 178) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_match_next.c
  function PCRE2_SIZE (line 49) | static PCRE2_SIZE do_bumpalong(pcre2_match_data *match_data,
  function PCRE2_CALL_CONVENTION (line 96) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_newline.c
  function BOOL (line 74) | BOOL
  function BOOL (line 164) | BOOL

FILE: src/pcre2_pattern_info.c
  function PCRE2_CALL_CONVENTION (line 61) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 265) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_printint_inc.h
  function print_char (line 97) | static unsigned int
  function print_custring (line 215) | static void
  function print_custring_bylen (line 226) | static void
  function print_prop (line 314) | static void
  function PCRE2_SPTR (line 345) | static PCRE2_SPTR
  function print_map (line 468) | static void
  function print_class (line 535) | static void
  function pcre2_printint (line 651) | static void

FILE: src/pcre2_script_run.c
  function BOOL (line 83) | BOOL

FILE: src/pcre2_serialize.c
  function PCRE2_CALL_CONVENTION (line 69) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 160) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 267) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 285) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_string_utils.c
  function PCRE2_SIZE (line 170) | PCRE2_SIZE
  function PCRE2_SIZE (line 190) | PCRE2_SIZE

FILE: src/pcre2_study.c
  function find_minlength (line 101) | static int
  function PCRE2_SPTR (line 788) | static PCRE2_SPTR
  function set_type_bits (line 873) | static void
  function set_nottype_bits (line 914) | static void
  function study_char_list (line 942) | static void
  function set_start_bits (line 1092) | static int

FILE: src/pcre2_substitute.c
  function find_text_end (line 76) | static int
  function BOOL (line 201) | static BOOL
  type case_state (line 272) | typedef struct {
  function PCRE2_SIZE (line 289) | static PCRE2_SIZE
  function PCRE2_SIZE (line 297) | static PCRE2_SIZE
  function PCRE2_SIZE (line 443) | static PCRE2_SIZE
  function pcre2_substitute (line 742) | int PCRE2_CALL_CONVENTION

FILE: src/pcre2_substring.c
  function PCRE2_CALL_CONVENTION (line 68) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 116) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 156) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 204) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 236) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 263) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 311) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 377) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 450) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 485) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 546) | PCRE2_CALL_CONVENTION

FILE: src/pcre2_xclass.c
  function BOOL (line 66) | BOOL
  function BOOL (line 461) | BOOL

FILE: src/pcre2demo.c
  function main (line 69) | int main(int argc, char **argv)

FILE: src/pcre2grep.c
  type BOOL (line 138) | typedef int BOOL;
  type omstr (line 308) | typedef struct omstr {
  type omdatastr (line 319) | typedef struct omdatastr {
  type fnstr (line 328) | typedef struct fnstr {
  type fndatastr (line 345) | typedef struct fndatastr {
  type patstr (line 358) | typedef struct patstr {
  type patdatastr (line 379) | typedef struct patdatastr {
  type option_item (line 401) | typedef struct option_item {
  function ord2utf8 (line 545) | static int
  function strcmpic (line 568) | static int
  function pcre2grep_exit (line 621) | static void
  function patstr (line 664) | static patstr *
  function free_pattern_chain (line 710) | static void
  function free_file_chain (line 732) | static void
  function WORD (line 771) | static WORD
  function init_colour_output (line 799) | static void
  type DIR (line 847) | typedef DIR directory_type;
  function isdirectory (line 850) | static int
  function directory_type (line 859) | static directory_type *
  type dirent (line 870) | struct dirent
  function closedirectory (line 879) | static void
  function isregfile (line 888) | static int
  function BOOL (line 902) | static BOOL
  function BOOL (line 908) | static BOOL
  function BOOL (line 918) | static BOOL
  function BOOL (line 924) | static BOOL
  function print_match (line 934) | static void
  type directory_type (line 960) | typedef struct directory_type
  function isdirectory (line 969) | int
  function directory_type (line 978) | directory_type *
  function closedirectory (line 1034) | void
  function isregfile (line 1047) | int isregfile(char *filename)
  function BOOL (line 1055) | static BOOL
  function BOOL (line 1061) | static BOOL
  function print_match (line 1070) | static void
  type directory_type (line 1097) | typedef void directory_type;
  function isdirectory (line 1099) | int isdirectory(char *filename) { return 0; }
  function directory_type (line 1100) | directory_type * opendirectory(char *filename) { return (directory_type*...
  function closedirectory (line 1102) | void closedirectory(directory_type *dir) {}
  function isregfile (line 1109) | int isregfile(char *filename) { return 1; }
  function BOOL (line 1114) | static BOOL
  function BOOL (line 1120) | static BOOL
  function print_match (line 1129) | static void
  function usage (line 1144) | static int
  function help (line 1165) | static void
  function BOOL (line 1249) | static BOOL
  function decode_number (line 1289) | static long int
  function omstr (line 1343) | static omstr *
  function PCRE2_SIZE (line 1392) | static PCRE2_SIZE
  function BOOL (line 1420) | static BOOL
  function write_final_newline (line 1727) | static void
  function do_after_lines (line 1771) | static void
  function BOOL (line 1826) | static BOOL
  function decode_dollar_escape (line 1955) | static int
  function BOOL (line 2150) | static BOOL
  function BOOL (line 2185) | static BOOL
  function pcre2grep_callout (line 2292) | static int
  function fill_buffer (line 2533) | static ptrdiff_t
  function pcre2grep (line 2595) | static int
  function handle_option (line 3657) | static int
  function BOOL (line 3775) | static BOOL
  function BOOL (line 3855) | static BOOL
  function main (line 3941) | int

FILE: src/pcre2posix.c
  function PCRE2_CALL_CONVENTION (line 198) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 254) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 277) | PCRE2_CALL_CONVENTION
  function PCRE2_CALL_CONVENTION (line 354) | PCRE2_CALL_CONVENTION

FILE: src/pcre2posix.h
  type regex_t (line 103) | typedef struct {
  type regoff_t (line 114) | typedef int regoff_t;
  type regmatch_t (line 116) | typedef struct {

FILE: src/pcre2posix_test.c
  function main (line 154) | int main(int argc, char **argv)

FILE: src/pcre2test.c
  type cmdstruct (line 448) | typedef struct cmdstruct {
  type convertstruct (line 483) | typedef struct convertstruct {
  type patctl (line 625) | typedef struct patctl {       /* Structure for pattern modifiers. */
  type datctl (line 647) | typedef struct datctl {        /* Structure for data line modifiers. */
  function patctl_zero (line 670) | static void patctl_zero(patctl *p)
  function datctl_zero (line 680) | static void datctl_zero(datctl *d)
  type modstruct (line 721) | typedef struct modstruct {
  type c1modstruct (line 960) | typedef struct c1modstruct {
  type coptstruct (line 1018) | typedef struct coptstruct {
  type force_encoding (line 1058) | enum force_encoding {
  function BOOL (line 1163) | static BOOL
  function colour_begin (line 1182) | static void
  function colour_end (line 1190) | static void
  function cfprintf (line 1197) | static int
  function reset_callout_state (line 1547) | static void
  function my_free (line 1600) | static void my_free(void *block, void *data)
  function stack_guard (line 1648) | static int
  function BOOL (line 1662) | static BOOL
  function ascii_to_ebcdic_str (line 1717) | static void
  function ebcdic_to_ascii_str (line 1724) | static void
  function ascii_to_ebcdic (line 1733) | static uint32_t
  function ebcdic_to_ascii (line 1739) | static uint32_t
  function utf8_to_ord (line 1769) | static int
  function utf16_to_ord (line 1831) | static int
  function ord_to_utf8 (line 1873) | static int
  function pchar (line 1908) | static int
  function expand_input_buffers (line 1957) | static void
  function strncmpic (line 2112) | static int
  function scan_modifiers (line 2140) | static int
  function error_direction (line 2182) | static int
  function prmsg (line 2368) | static void
  function show_controls (line 2395) | static void
  function show_compile_options (line 2470) | static void
  function show_compile_extra_options (line 2526) | static void
  function show_optimize_flags (line 2568) | static void
  function show_match_options (line 2590) | static void
  function open_file (line 2628) | static int
  function BOOL (line 2667) | static BOOL
  function show_ovector (line 2802) | static void
  function jit_compile_test (line 2936) | static int jit_compile_test(void)
  function pcre2_config (line 2941) | static int pcre2_config(uint32_t what, void *where)
  function BOOL (line 2951) | static BOOL decode_modifiers(uint8_t *p, int ctx, patctl *pctl, datctl *...
  function BOOL (line 2956) | static BOOL
  function process_command (line 2964) | static int process_command(void)
  function process_pattern (line 2969) | static int process_pattern(void)
  function BOOL (line 2974) | static BOOL have_active_pattern(void)
  function free_active_pattern (line 2979) | static void free_active_pattern(void)
  function process_data (line 2984) | static int process_data(void)
  function init_globals (line 2989) | static void init_globals(void)
  function free_globals (line 2994) | static void free_globals(void)
  function unittest (line 2999) | static void unittest(void)
  function print_version (line 3014) | static void
  function print_unicode_version (line 3033) | static void
  function print_jit_target (line 3047) | static void
  function print_newline_config (line 3069) | static void
  function usage (line 3085) | static void
  function c_option (line 3168) | static int
  function format_list_item (line 3363) | static void
  function display_properties (line 3420) | static void
  function display_one_modifier (line 3512) | static void
  function display_selected_modifiers (line 3541) | static void
  function display_modifiers (line 3623) | static void
  function main (line 3642) | int

FILE: src/pcre2test_inc.h
  function pcre2_jit_stack (line 137) | static pcre2_jit_stack*
  function pcre2_strcmp_c8 (line 150) | static int
  function pcre2_strlen (line 169) | static size_t
  function pchars (line 188) | static int pchars(int clr, PCRE2_SPTR p, ptrdiff_t length, BOOL utf, FIL...
  function ptrunc_8 (line 248) | static void ptrunc_8(int clr, PCRE2_SPTR p, size_t p_len, size_t offset,
  function ptrunc_16 (line 286) | static void ptrunc_16(int clr, PCRE2_SPTR p, size_t p_len, size_t offset,
  function ptrunc_32 (line 338) | static void ptrunc_32(int clr, PCRE2_SPTR p, size_t p_len, size_t offset,
  function to16 (line 409) | static int
  function to32 (line 498) | static int
  function BOOL (line 716) | static BOOL
  function pattern_info (line 1115) | static int
  function show_memory_info (line 1136) | static void
  function show_framesize (line 1170) | static void
  function show_heapframes_size (line 1184) | static void
  function BOOL (line 1199) | static BOOL
  function BOOL (line 1231) | static BOOL
  function callout_enumerate_function (line 1251) | static int callout_enumerate_function(pcre2_callout_enumerate_block *cb,
  function callout_enumerate_function_void (line 1285) | static int callout_enumerate_function_void(pcre2_callout_enumerate_block...
  function callout_enumerate_function_fail (line 1293) | static int callout_enumerate_function_fail(pcre2_callout_enumerate_block...
  function show_pattern_info (line 1316) | static int
  function BOOL (line 1685) | static BOOL
  function process_command (line 1709) | static int
  function process_pattern (line 2036) | static int
  function BOOL (line 3064) | static BOOL
  function free_active_pattern (line 3074) | static void
  function check_match_limit (line 3099) | static int
  function substitute_callout_function (line 3226) | static int
  function PCRE2_SIZE (line 3287) | static PCRE2_SIZE
  function callout_function (line 3373) | static int
  function BOOL (line 3595) | static BOOL
  function copy_substitute_string (line 3809) | static void
  function process_data (line 3886) | static int
  function init_globals (line 5590) | static void
  function free_globals (line 5613) | static void
  function unittest (line 5678) | static void
Copy disabled (too large) Download .json
Condensed preview — 496 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (15,588K chars).
[
  {
    "path": ".editorconfig",
    "chars": 455,
    "preview": "# EditorConfig helps ensure that files are opened in editors with the correct\n# settings, regardless of the editor or pl"
  },
  {
    "path": ".gitattributes",
    "chars": 199,
    "preview": "testdata/*        -text\r\nmaint/manifest-*  -text\r\nmaint/ucptestdata -text\r\n*.sh              text eol=lf\r\npcre2-config.i"
  },
  {
    "path": ".github/codecov.yml",
    "chars": 1092,
    "preview": "codecov:\n  strict_yaml_branch: default\n  require_ci_to_pass: false\n  notify:\n    wait_for_ci: false\n    notify_error: tr"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 210,
    "preview": "version: 2\nupdates:\n  - package-ecosystem: github-actions\n    directory: /\n    schedule:\n      interval: monthly\n    gro"
  },
  {
    "path": ".github/scripts/merge_sarif.py",
    "chars": 1882,
    "preview": "#! /usr/bin/env python3\n\n# The purpose of this file is to adapt the output from\n# Clang's static analyzer into a format "
  },
  {
    "path": ".github/workflows/build.yml",
    "chars": 26710,
    "preview": "name: Build\non:\n  workflow_dispatch:\n    inputs:\n      job_id:\n        type: choice\n        description: Specific job to"
  },
  {
    "path": ".github/workflows/cifuzz.yml",
    "chars": 861,
    "preview": "name: CIFuzz\non:\n  workflow_dispatch:\n  pull_request:\n    branches: [ main ]\n\npermissions:\n  contents: read\n\njobs:\n  Fuz"
  },
  {
    "path": ".github/workflows/clang-analyzer.yml",
    "chars": 1905,
    "preview": "name: Clang Static Analyzer\non:\n  workflow_dispatch:\n  push:\n    branches: [ main, \"release/**\" ]\n  pull_request:\n    br"
  },
  {
    "path": ".github/workflows/codeql.yml",
    "chars": 2658,
    "preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
  },
  {
    "path": ".github/workflows/dev.yml",
    "chars": 27703,
    "preview": "name: Dev\non:\n  workflow_dispatch:\n    inputs:\n      job_id:\n        type: choice\n        description: Specific job to r"
  },
  {
    "path": ".github/workflows/pages.yml",
    "chars": 1693,
    "preview": "name: Deploy Pages\non:\n  workflow_dispatch:\n  workflow_run:\n    workflows: [ 'Sync' ]\n    types:\n      - completed\n    b"
  },
  {
    "path": ".github/workflows/scorecards.yml",
    "chars": 1886,
    "preview": "name: Scorecards supply-chain security\non:\n  workflow_dispatch:\n  # Only the default branch is supported.\n  branch_prote"
  },
  {
    "path": ".github/workflows/sync.yml",
    "chars": 3948,
    "preview": "name: Sync\non:\n  workflow_dispatch:\n  push:\n    branches: [ main, \"release/**\" ]\n  pull_request:\n    branches: [ main ]\n"
  },
  {
    "path": ".gitignore",
    "chars": 1540,
    "preview": "# Public .gitignore file for PCRE2\n\nbuild/\nbuild-*/\n\npages/\n\n*.a\n*.gcda\n*.gcno\n*.profraw\n*.lo\n*.la\n*.pc\n*.o\n*~\n\n*-covera"
  },
  {
    "path": ".gitmodules",
    "chars": 89,
    "preview": "[submodule \"deps/sljit\"]\n\tpath = deps/sljit\n\turl = https://github.com/zherczeg/sljit.git\n"
  },
  {
    "path": "AUTHORS.md",
    "chars": 4006,
    "preview": "PCRE2 Authorship and Contributors\n=================================\n\nCopyright\n---------\n\nPlease see the file [LICENCE]("
  },
  {
    "path": "BUILD.bazel",
    "chars": 5483,
    "preview": "load(\"@bazel_skylib//rules:copy_file.bzl\", \"copy_file\")\nload(\"@bazel_skylib//rules:native_binary.bzl\", \"native_test\")\nlo"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 57012,
    "preview": "# CMakeLists.txt\n#\n# This file enables PCRE2 to be built with the CMake configuration and build\n# tool. Download CMake i"
  },
  {
    "path": "COPYING",
    "chars": 97,
    "preview": "PCRE2 LICENCE\n\nPlease see the file LICENCE in the PCRE2 distribution for licensing details.\n\nEnd\n"
  },
  {
    "path": "ChangeLog",
    "chars": 156992,
    "preview": "Change Log for PCRE2\n--------------------\n\nBefore the move to GitHub, this was the only record of changes to PCRE2. Now\n"
  },
  {
    "path": "HACKING",
    "chars": 43857,
    "preview": "Technical notes about PCRE2\n---------------------------\n\nThese are very rough technical notes that record potentially us"
  },
  {
    "path": "INSTALL",
    "chars": 15766,
    "preview": "Installation Instructions\n*************************\n\n   Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free\nSo"
  },
  {
    "path": "LICENCE.md",
    "chars": 4011,
    "preview": "PCRE2 Licence\n=============\n\n| SPDX-License-Identifier: | BSD-3-Clause WITH PCRE2-exception |\n|---------|-------|\n\nPCRE2"
  },
  {
    "path": "MODULE.bazel",
    "chars": 236,
    "preview": "module(\n    name = \"pcre2\",\n    version = \"10.48-DEV\",\n    compatibility_level = 1,\n)\n\nbazel_dep(name = \"rules_cc\", vers"
  },
  {
    "path": "Makefile.am",
    "chars": 31800,
    "preview": "## Process this file with automake to produce Makefile.in.\n\nAUTOMAKE_OPTIONS = subdir-objects\nACLOCAL_AMFLAGS = -I m4\n\n#"
  },
  {
    "path": "NEWS",
    "chars": 25094,
    "preview": "News about PCRE2 releases\n-------------------------\n\nVersion 10.48 xx-xxx-2026\n-------------------------\n\nIn development"
  },
  {
    "path": "NON-AUTOTOOLS-BUILD",
    "chars": 21903,
    "preview": "Building PCRE2 without using autotools\n======================================\n\nThis document contains the following sect"
  },
  {
    "path": "README",
    "chars": 47725,
    "preview": "README file for PCRE2 (Perl-compatible regular expression library)\n====================================================="
  },
  {
    "path": "README.md",
    "chars": 12784,
    "preview": "<picture>\n  <source media=\"(prefers-color-scheme: dark)\" width=\"100%\" height=\"100px\" srcset=\"https://raw.githubuserconte"
  },
  {
    "path": "RunGrepTest",
    "chars": 58199,
    "preview": "#! /bin/sh\n\n# Run pcre2grep tests. The assumption is that the PCRE2 tests check the library\n# itself. What we are checki"
  },
  {
    "path": "RunGrepTest.bat",
    "chars": 57482,
    "preview": "@echo off\r\n\r\n:: Run pcre2grep tests. The assumption is that the PCRE2 tests check the library\r\n:: itself. What we are ch"
  },
  {
    "path": "RunTest",
    "chars": 31745,
    "preview": "#! /bin/sh\n\n###############################################################################\n# Run the PCRE2 tests using "
  },
  {
    "path": "RunTest.bat",
    "chars": 16346,
    "preview": "@echo off\r\n@rem\r\n@rem MS Windows batch file to run pcre2test on testfiles with the correct\r\n@rem options. This file must"
  },
  {
    "path": "SECURITY.md",
    "chars": 2198,
    "preview": "Security policies\n=================\n\nRelease security\n----------------\n\nThe PCRE2 project provides source-only releases,"
  },
  {
    "path": "autogen.sh",
    "chars": 1346,
    "preview": "#!/bin/sh\n\n# Running aclocal here first (as happened for a while) caused the macros that\n# libtoolize puts in the m4 dir"
  },
  {
    "path": "build.zig",
    "chars": 8214,
    "preview": "const std = @import(\"std\");\n\npub const CodeUnitWidth = enum {\n    @\"8\",\n    @\"16\",\n    @\"32\",\n};\n\npub fn build(b: *std.B"
  },
  {
    "path": "cmake/COPYING-CMAKE-SCRIPTS",
    "chars": 1326,
    "preview": "Redistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the followi"
  },
  {
    "path": "cmake/FindEditline.cmake",
    "chars": 512,
    "preview": "# Modified from FindReadline.cmake (PH Feb 2012)\n\nfind_path(EDITLINE_INCLUDE_DIR readline.h PATH_SUFFIXES editline edit/"
  },
  {
    "path": "cmake/FindReadline.cmake",
    "chars": 2192,
    "preview": "# from http://websvn.kde.org/trunk/KDE/kdeedu/cmake/modules/FindReadline.cmake\n# http://websvn.kde.org/trunk/KDE/kdeedu/"
  },
  {
    "path": "cmake/PCRE2CheckVscript.cmake",
    "chars": 4978,
    "preview": "# Similarly to Autoconf's ax_check_vscript.m4, check whether the linker supports\n# version scripts (GNU ld) or map files"
  },
  {
    "path": "cmake/PCRE2UseSystemExtensions.cmake",
    "chars": 2677,
    "preview": "# This CMake module is supposed to give similar results to the\n# AC_USE_SYSTEM_EXTENSIONS Autoconf macro, which turns on"
  },
  {
    "path": "cmake/PCRE2WarningAsError.cmake",
    "chars": 1185,
    "preview": "# This file can be removed once the minimum CMake version is increased to 3.24\n# or higher. Calls to pcre2_warning_as_er"
  },
  {
    "path": "cmake/pcre2-config.cmake.in",
    "chars": 3294,
    "preview": "# pcre2-config.cmake\n# ----------------\n#\n# Finds the PCRE2 library, specify the starting search path in PCRE2_ROOT.\n#\n#"
  },
  {
    "path": "configure.ac",
    "chars": 49648,
    "preview": "dnl Process this file with autoconf to produce a configure script.\n\ndnl NOTE FOR MAINTAINERS: Do not use minor version n"
  },
  {
    "path": "doc/html/NON-AUTOTOOLS-BUILD.txt",
    "chars": 21903,
    "preview": "Building PCRE2 without using autotools\n======================================\n\nThis document contains the following sect"
  },
  {
    "path": "doc/html/README.txt",
    "chars": 47725,
    "preview": "README file for PCRE2 (Perl-compatible regular expression library)\n====================================================="
  },
  {
    "path": "doc/html/index.html",
    "chars": 14009,
    "preview": "<html>\n<!-- This is a manually maintained file that is the root of the HTML version of\n     the PCRE2 documentation. Whe"
  },
  {
    "path": "doc/html/pcre2-config.html",
    "chars": 3500,
    "preview": "<html>\n<head>\n<title>pcre2-config specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2.html",
    "chars": 10101,
    "preview": "<html>\n<head>\n<title>pcre2 specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alink=\"#3"
  },
  {
    "path": "doc/html/pcre2_callout_enumerate.html",
    "chars": 2419,
    "preview": "<html>\n<head>\n<title>pcre2_callout_enumerate specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\""
  },
  {
    "path": "doc/html/pcre2_code_copy.html",
    "chars": 1358,
    "preview": "<html>\n<head>\n<title>pcre2_code_copy specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\""
  },
  {
    "path": "doc/html/pcre2_code_copy_with_tables.html",
    "chars": 1479,
    "preview": "<html>\n<head>\n<title>pcre2_code_copy_with_tables specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" li"
  },
  {
    "path": "doc/html/pcre2_code_free.html",
    "chars": 1231,
    "preview": "<html>\n<head>\n<title>pcre2_code_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\""
  },
  {
    "path": "doc/html/pcre2_compile.html",
    "chars": 5293,
    "preview": "<html>\n<head>\n<title>pcre2_compile specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" a"
  },
  {
    "path": "doc/html/pcre2_compile_context_copy.html",
    "chars": 1164,
    "preview": "<html>\n<head>\n<title>pcre2_compile_context_copy specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_compile_context_create.html",
    "chars": 1259,
    "preview": "<html>\n<head>\n<title>pcre2_compile_context_create specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_compile_context_free.html",
    "chars": 1221,
    "preview": "<html>\n<head>\n<title>pcre2_compile_context_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_config.html",
    "chars": 3704,
    "preview": "<html>\n<head>\n<title>pcre2_config specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2_convert_context_copy.html",
    "chars": 1145,
    "preview": "<html>\n<head>\n<title>pcre2_convert_context_copy specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_convert_context_create.html",
    "chars": 1239,
    "preview": "<html>\n<head>\n<title>pcre2_convert_context_create specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_convert_context_free.html",
    "chars": 1202,
    "preview": "<html>\n<head>\n<title>pcre2_convert_context_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_converted_pattern_free.html",
    "chars": 1237,
    "preview": "<html>\n<head>\n<title>pcre2_converted_pattern_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_dfa_match.html",
    "chars": 3853,
    "preview": "<html>\n<head>\n<title>pcre2_dfa_match specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\""
  },
  {
    "path": "doc/html/pcre2_general_context_copy.html",
    "chars": 1213,
    "preview": "<html>\n<head>\n<title>pcre2_general_context_copy specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_general_context_create.html",
    "chars": 1470,
    "preview": "<html>\n<head>\n<title>pcre2_general_context_create specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_general_context_free.html",
    "chars": 1160,
    "preview": "<html>\n<head>\n<title>pcre2_general_context_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_get_error_message.html",
    "chars": 1733,
    "preview": "<html>\n<head>\n<title>pcre2_get_error_message specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\""
  },
  {
    "path": "doc/html/pcre2_get_mark.html",
    "chars": 1493,
    "preview": "<html>\n<head>\n<title>pcre2_get_mark specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" "
  },
  {
    "path": "doc/html/pcre2_get_match_data_heapframes_size.html",
    "chars": 1098,
    "preview": "<html>\n<head>\n<title>pcre2_get_match_data_heapframes_size specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#0"
  },
  {
    "path": "doc/html/pcre2_get_match_data_size.html",
    "chars": 1041,
    "preview": "<html>\n<head>\n<title>pcre2_get_match_data_size specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link"
  },
  {
    "path": "doc/html/pcre2_get_ovector_count.html",
    "chars": 1060,
    "preview": "<html>\n<head>\n<title>pcre2_get_ovector_count specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\""
  },
  {
    "path": "doc/html/pcre2_get_ovector_pointer.html",
    "chars": 1136,
    "preview": "<html>\n<head>\n<title>pcre2_get_ovector_pointer specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link"
  },
  {
    "path": "doc/html/pcre2_get_startchar.html",
    "chars": 1418,
    "preview": "<html>\n<head>\n<title>pcre2_get_startchar specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#006"
  },
  {
    "path": "doc/html/pcre2_jit_compile.html",
    "chars": 2823,
    "preview": "<html>\n<head>\n<title>pcre2_jit_compile specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066F"
  },
  {
    "path": "doc/html/pcre2_jit_free_unused_memory.html",
    "chars": 1316,
    "preview": "<html>\n<head>\n<title>pcre2_jit_free_unused_memory specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_jit_match.html",
    "chars": 2515,
    "preview": "<html>\n<head>\n<title>pcre2_jit_match specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\""
  },
  {
    "path": "doc/html/pcre2_jit_stack_assign.html",
    "chars": 2550,
    "preview": "<html>\n<head>\n<title>pcre2_jit_stack_assign specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#"
  },
  {
    "path": "doc/html/pcre2_jit_stack_create.html",
    "chars": 1805,
    "preview": "<html>\n<head>\n<title>pcre2_jit_stack_create specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#"
  },
  {
    "path": "doc/html/pcre2_jit_stack_free.html",
    "chars": 1211,
    "preview": "<html>\n<head>\n<title>pcre2_jit_stack_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#00"
  },
  {
    "path": "doc/html/pcre2_maketables.html",
    "chars": 1635,
    "preview": "<html>\n<head>\n<title>pcre2_maketables specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF"
  },
  {
    "path": "doc/html/pcre2_maketables_free.html",
    "chars": 1211,
    "preview": "<html>\n<head>\n<title>pcre2_maketables_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0"
  },
  {
    "path": "doc/html/pcre2_match.html",
    "chars": 3762,
    "preview": "<html>\n<head>\n<title>pcre2_match specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" ali"
  },
  {
    "path": "doc/html/pcre2_match_context_copy.html",
    "chars": 1152,
    "preview": "<html>\n<head>\n<title>pcre2_match_context_copy specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link="
  },
  {
    "path": "doc/html/pcre2_match_context_create.html",
    "chars": 1249,
    "preview": "<html>\n<head>\n<title>pcre2_match_context_create specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_match_context_free.html",
    "chars": 1211,
    "preview": "<html>\n<head>\n<title>pcre2_match_context_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link="
  },
  {
    "path": "doc/html/pcre2_match_data_create.html",
    "chars": 1743,
    "preview": "<html>\n<head>\n<title>pcre2_match_data_create specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\""
  },
  {
    "path": "doc/html/pcre2_match_data_create_from_pattern.html",
    "chars": 2036,
    "preview": "<html>\n<head>\n<title>pcre2_match_data_create_from_pattern specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#0"
  },
  {
    "path": "doc/html/pcre2_match_data_free.html",
    "chars": 1541,
    "preview": "<html>\n<head>\n<title>pcre2_match_data_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0"
  },
  {
    "path": "doc/html/pcre2_next_match.html",
    "chars": 1937,
    "preview": "<html>\n<head>\n<title>pcre2_next_match specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF"
  },
  {
    "path": "doc/html/pcre2_pattern_convert.html",
    "chars": 2651,
    "preview": "<html>\n<head>\n<title>pcre2_pattern_convert specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0"
  },
  {
    "path": "doc/html/pcre2_pattern_info.html",
    "chars": 4804,
    "preview": "<html>\n<head>\n<title>pcre2_pattern_info specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066"
  },
  {
    "path": "doc/html/pcre2_serialize_decode.html",
    "chars": 2535,
    "preview": "<html>\n<head>\n<title>pcre2_serialize_decode specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#"
  },
  {
    "path": "doc/html/pcre2_serialize_encode.html",
    "chars": 2709,
    "preview": "<html>\n<head>\n<title>pcre2_serialize_encode specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#"
  },
  {
    "path": "doc/html/pcre2_serialize_free.html",
    "chars": 1175,
    "preview": "<html>\n<head>\n<title>pcre2_serialize_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#00"
  },
  {
    "path": "doc/html/pcre2_serialize_get_number_of_codes.html",
    "chars": 1622,
    "preview": "<html>\n<head>\n<title>pcre2_serialize_get_number_of_codes specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00"
  },
  {
    "path": "doc/html/pcre2_set_bsr.html",
    "chars": 1187,
    "preview": "<html>\n<head>\n<title>pcre2_set_bsr specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" a"
  },
  {
    "path": "doc/html/pcre2_set_callout.html",
    "chars": 1264,
    "preview": "<html>\n<head>\n<title>pcre2_set_callout specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066F"
  },
  {
    "path": "doc/html/pcre2_set_character_tables.html",
    "chars": 1425,
    "preview": "<html>\n<head>\n<title>pcre2_set_character_tables specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_set_compile_extra_options.html",
    "chars": 2441,
    "preview": "<html>\n<head>\n<title>pcre2_set_compile_extra_options specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A"
  },
  {
    "path": "doc/html/pcre2_set_compile_recursion_guard.html",
    "chars": 1652,
    "preview": "<html>\n<head>\n<title>pcre2_set_compile_recursion_guard specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#0000"
  },
  {
    "path": "doc/html/pcre2_set_depth_limit.html",
    "chars": 1068,
    "preview": "<html>\n<head>\n<title>pcre2_set_depth_limit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0"
  },
  {
    "path": "doc/html/pcre2_set_glob_escape.html",
    "chars": 1353,
    "preview": "<html>\n<head>\n<title>pcre2_set_glob_escape specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0"
  },
  {
    "path": "doc/html/pcre2_set_glob_separator.html",
    "chars": 1324,
    "preview": "<html>\n<head>\n<title>pcre2_set_glob_separator specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link="
  },
  {
    "path": "doc/html/pcre2_set_heap_limit.html",
    "chars": 1064,
    "preview": "<html>\n<head>\n<title>pcre2_set_heap_limit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#00"
  },
  {
    "path": "doc/html/pcre2_set_match_limit.html",
    "chars": 1055,
    "preview": "<html>\n<head>\n<title>pcre2_set_match_limit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0"
  },
  {
    "path": "doc/html/pcre2_set_max_pattern_compiled_length.html",
    "chars": 1433,
    "preview": "<html>\n<head>\n<title>pcre2_set_max_pattern_compiled_length specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#"
  },
  {
    "path": "doc/html/pcre2_set_max_pattern_length.html",
    "chars": 1324,
    "preview": "<html>\n<head>\n<title>pcre2_set_max_pattern_length specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_set_max_varlookbehind.html",
    "chars": 1283,
    "preview": "<html>\n<head>\n<title>pcre2_set_max_varlookbehind specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" li"
  },
  {
    "path": "doc/html/pcre2_set_newline.html",
    "chars": 1554,
    "preview": "<html>\n<head>\n<title>pcre2_set_newline specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066F"
  },
  {
    "path": "doc/html/pcre2_set_offset_limit.html",
    "chars": 1061,
    "preview": "<html>\n<head>\n<title>pcre2_set_offset_limit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#"
  },
  {
    "path": "doc/html/pcre2_set_optimize.html",
    "chars": 1997,
    "preview": "<html>\n<head>\n<title>pcre2_set_optimize specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066"
  },
  {
    "path": "doc/html/pcre2_set_parens_nest_limit.html",
    "chars": 1110,
    "preview": "<html>\n<head>\n<title>pcre2_set_parens_nest_limit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" li"
  },
  {
    "path": "doc/html/pcre2_set_recursion_limit.html",
    "chars": 1085,
    "preview": "<html>\n<head>\n<title>pcre2_set_recursion_limit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link"
  },
  {
    "path": "doc/html/pcre2_set_recursion_memory_management.html",
    "chars": 1229,
    "preview": "<html>\n<head>\n<title>pcre2_set_recursion_memory_management specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#"
  },
  {
    "path": "doc/html/pcre2_set_substitute_callout.html",
    "chars": 1327,
    "preview": "<html>\n<head>\n<title>pcre2_set_substitute_callout specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_set_substitute_case_callout.html",
    "chars": 1456,
    "preview": "<html>\n<head>\n<title>pcre2_set_substitute_case_callout specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#0000"
  },
  {
    "path": "doc/html/pcre2_substitute.html",
    "chars": 5035,
    "preview": "<html>\n<head>\n<title>pcre2_substitute specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF"
  },
  {
    "path": "doc/html/pcre2_substring_copy_byname.html",
    "chars": 2047,
    "preview": "<html>\n<head>\n<title>pcre2_substring_copy_byname specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" li"
  },
  {
    "path": "doc/html/pcre2_substring_copy_bynumber.html",
    "chars": 1848,
    "preview": "<html>\n<head>\n<title>pcre2_substring_copy_bynumber specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" "
  },
  {
    "path": "doc/html/pcre2_substring_free.html",
    "chars": 1184,
    "preview": "<html>\n<head>\n<title>pcre2_substring_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#00"
  },
  {
    "path": "doc/html/pcre2_substring_get_byname.html",
    "chars": 2175,
    "preview": "<html>\n<head>\n<title>pcre2_substring_get_byname specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" lin"
  },
  {
    "path": "doc/html/pcre2_substring_get_bynumber.html",
    "chars": 2011,
    "preview": "<html>\n<head>\n<title>pcre2_substring_get_bynumber specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" l"
  },
  {
    "path": "doc/html/pcre2_substring_length_byname.html",
    "chars": 1442,
    "preview": "<html>\n<head>\n<title>pcre2_substring_length_byname specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" "
  },
  {
    "path": "doc/html/pcre2_substring_length_bynumber.html",
    "chars": 1506,
    "preview": "<html>\n<head>\n<title>pcre2_substring_length_bynumber specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A"
  },
  {
    "path": "doc/html/pcre2_substring_list_free.html",
    "chars": 1201,
    "preview": "<html>\n<head>\n<title>pcre2_substring_list_free specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link"
  },
  {
    "path": "doc/html/pcre2_substring_list_get.html",
    "chars": 2124,
    "preview": "<html>\n<head>\n<title>pcre2_substring_list_get specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link="
  },
  {
    "path": "doc/html/pcre2_substring_nametable_scan.html",
    "chars": 1825,
    "preview": "<html>\n<head>\n<title>pcre2_substring_nametable_scan specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\""
  },
  {
    "path": "doc/html/pcre2_substring_number_from_name.html",
    "chars": 1633,
    "preview": "<html>\n<head>\n<title>pcre2_substring_number_from_name specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005"
  },
  {
    "path": "doc/html/pcre2api.html",
    "chars": 217276,
    "preview": "<html>\n<head>\n<title>pcre2api specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alink="
  },
  {
    "path": "doc/html/pcre2build.html",
    "chars": 29385,
    "preview": "<html>\n<head>\n<title>pcre2build specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alin"
  },
  {
    "path": "doc/html/pcre2callout.html",
    "chars": 20361,
    "preview": "<html>\n<head>\n<title>pcre2callout specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2compat.html",
    "chars": 13435,
    "preview": "<html>\n<head>\n<title>pcre2compat specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" ali"
  },
  {
    "path": "doc/html/pcre2convert.html",
    "chars": 7916,
    "preview": "<html>\n<head>\n<title>pcre2convert specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2demo.html",
    "chars": 17580,
    "preview": "<html>\n<head>\n<title>pcre2demo specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alink"
  },
  {
    "path": "doc/html/pcre2grep.html",
    "chars": 56397,
    "preview": "<html>\n<head>\n<title>pcre2grep specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alink"
  },
  {
    "path": "doc/html/pcre2jit.html",
    "chars": 23456,
    "preview": "<html>\n<head>\n<title>pcre2jit specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alink="
  },
  {
    "path": "doc/html/pcre2limits.html",
    "chars": 3919,
    "preview": "<html>\n<head>\n<title>pcre2limits specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" ali"
  },
  {
    "path": "doc/html/pcre2matching.html",
    "chars": 11223,
    "preview": "<html>\n<head>\n<title>pcre2matching specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" a"
  },
  {
    "path": "doc/html/pcre2partial.html",
    "chars": 18588,
    "preview": "<html>\n<head>\n<title>pcre2partial specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2pattern.html",
    "chars": 187427,
    "preview": "<html>\n<head>\n<title>pcre2pattern specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2perform.html",
    "chars": 12806,
    "preview": "<html>\n<head>\n<title>pcre2perform specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/html/pcre2posix.html",
    "chars": 17082,
    "preview": "<html>\n<head>\n<title>pcre2posix specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alin"
  },
  {
    "path": "doc/html/pcre2sample.html",
    "chars": 3947,
    "preview": "<html>\n<head>\n<title>pcre2sample specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" ali"
  },
  {
    "path": "doc/html/pcre2serialize.html",
    "chars": 10079,
    "preview": "<html>\n<head>\n<title>pcre2serialize specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" "
  },
  {
    "path": "doc/html/pcre2syntax.html",
    "chars": 30991,
    "preview": "<html>\n<head>\n<title>pcre2syntax specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" ali"
  },
  {
    "path": "doc/html/pcre2test.html",
    "chars": 101616,
    "preview": "<html>\n<head>\n<title>pcre2test specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" alink"
  },
  {
    "path": "doc/html/pcre2unicode.html",
    "chars": 23543,
    "preview": "<html>\n<head>\n<title>pcre2unicode specification</title>\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#00005A\" link=\"#0066FF\" al"
  },
  {
    "path": "doc/index.html.src",
    "chars": 14009,
    "preview": "<html>\n<!-- This is a manually maintained file that is the root of the HTML version of\n     the PCRE2 documentation. Whe"
  },
  {
    "path": "doc/pcre2-config.1",
    "chars": 2576,
    "preview": ".TH PCRE2-CONFIG 1 \"22 February 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\npcre2-config - program to return PCRE2 configuration\n.S"
  },
  {
    "path": "doc/pcre2-config.txt",
    "chars": 3006,
    "preview": "PCRE2-CONFIG(1)             General Commands Manual            PCRE2-CONFIG(1)\n\n\nNAME\n       pcre2-config - program to r"
  },
  {
    "path": "doc/pcre2.3",
    "chars": 9108,
    "preview": ".TH PCRE2 3 \"22 February 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised API)\n.SH "
  },
  {
    "path": "doc/pcre2.txt",
    "chars": 651017,
    "preview": "-----------------------------------------------------------------------------\nThis file contains a concatenation of the "
  },
  {
    "path": "doc/pcre2_callout_enumerate.3",
    "chars": 1894,
    "preview": ".TH PCRE2_COMPILE 3 \"23 March 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised API)"
  },
  {
    "path": "doc/pcre2_code_copy.3",
    "chars": 883,
    "preview": ".TH PCRE2_CODE_COPY 3 \"22 November 2016\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised"
  },
  {
    "path": "doc/pcre2_code_copy_with_tables.3",
    "chars": 978,
    "preview": ".TH PCRE2_CODE_COPY 3 \"16 January 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised "
  },
  {
    "path": "doc/pcre2_code_free.3",
    "chars": 752,
    "preview": ".TH PCRE2_CODE_FREE 3 \"28 June 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised API"
  },
  {
    "path": "doc/pcre2_compile.3",
    "chars": 4733,
    "preview": ".TH PCRE2_COMPILE 3 \"30 October 2024\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised AP"
  },
  {
    "path": "doc/pcre2_compile_context_copy.3",
    "chars": 678,
    "preview": ".TH PCRE2_COMPILE_CONTEXT_COPY 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expression"
  },
  {
    "path": "doc/pcre2_compile_context_create.3",
    "chars": 770,
    "preview": ".TH PCRE2_COMPILE_CONTEXT_CREATE 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressi"
  },
  {
    "path": "doc/pcre2_compile_context_free.3",
    "chars": 733,
    "preview": ".TH PCRE2_COMPILE_CONTEXT_FREE 3 \"28 June 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions ("
  },
  {
    "path": "doc/pcre2_config.3",
    "chars": 3349,
    "preview": ".TH PCRE2_CONFIG 3 \"03 September 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised A"
  },
  {
    "path": "doc/pcre2_convert_context_copy.3",
    "chars": 670,
    "preview": ".TH PCRE2_CONVERT_CONTEXT_COPY 3 \"12 July 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions ("
  },
  {
    "path": "doc/pcre2_convert_context_create.3",
    "chars": 761,
    "preview": ".TH PCRE2_CONVERT_CONTEXT_CREATE 3 \"12 July 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions"
  },
  {
    "path": "doc/pcre2_convert_context_free.3",
    "chars": 730,
    "preview": ".TH PCRE2_CONVERT_CONTEXT_FREE 3 \"13 August 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions"
  },
  {
    "path": "doc/pcre2_converted_pattern_free.3",
    "chars": 763,
    "preview": ".TH PCRE2_CONVERTED_PATTERN_FREE 3 \"13 August 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressio"
  },
  {
    "path": "doc/pcre2_dfa_match.3",
    "chars": 3442,
    "preview": ".TH PCRE2_DFA_MATCH 3 \"31 August 2021\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised A"
  },
  {
    "path": "doc/pcre2_general_context_copy.3",
    "chars": 726,
    "preview": ".TH PCRE2_GENERAL_CONTEXT_COPY 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expression"
  },
  {
    "path": "doc/pcre2_general_context_create.3",
    "chars": 977,
    "preview": ".TH PCRE2_GENERAL_CONTEXT_CREATE 3 \"23 January 2023\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressi"
  },
  {
    "path": "doc/pcre2_general_context_free.3",
    "chars": 673,
    "preview": ".TH PCRE2_GENERAL_CONTEXT_FREE 3 \"28 June 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions ("
  },
  {
    "path": "doc/pcre2_get_error_message.3",
    "chars": 1237,
    "preview": ".TH PCRE2_GET_ERROR_MESSAGE 3 \"24 March 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (re"
  },
  {
    "path": "doc/pcre2_get_mark.3",
    "chars": 1014,
    "preview": ".TH PCRE2_GET_MARK 3 \"13 January 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised A"
  },
  {
    "path": "doc/pcre2_get_match_data_heapframes_size.3",
    "chars": 602,
    "preview": ".TH PCRE2_GET_MATCH_DATA_HEAPFRAMES_SIZE 3 \"18 January 2023\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular "
  },
  {
    "path": "doc/pcre2_get_match_data_size.3",
    "chars": 558,
    "preview": ".TH PCRE2_GET_MATCH_DATA_SIZE 3 \"17 October 2019\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions"
  },
  {
    "path": "doc/pcre2_get_ovector_count.3",
    "chars": 579,
    "preview": ".TH PCRE2_GET_OVECTOR_COUNT 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions ("
  },
  {
    "path": "doc/pcre2_get_ovector_pointer.3",
    "chars": 652,
    "preview": ".TH PCRE2_GET_OVECTOR_POINTER 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions"
  },
  {
    "path": "doc/pcre2_get_startchar.3",
    "chars": 940,
    "preview": ".TH PCRE2_GET_STARTCHAR 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revi"
  },
  {
    "path": "doc/pcre2_jit_compile.3",
    "chars": 2302,
    "preview": ".TH PCRE2_JIT_COMPILE 3 \"22 August 2024\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised"
  },
  {
    "path": "doc/pcre2_jit_free_unused_memory.3",
    "chars": 827,
    "preview": ".TH PCRE2_JIT_FREE_UNUSED_MEMORY 3 \"24 April 2020\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expression"
  },
  {
    "path": "doc/pcre2_jit_match.3",
    "chars": 1965,
    "preview": ".TH PCRE2_JIT_MATCH 3 \"20 January 2023\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised "
  },
  {
    "path": "doc/pcre2_jit_stack_assign.3",
    "chars": 1998,
    "preview": ".TH PCRE2_JIT_STACK_ASSIGN 3 \"13 August 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (re"
  },
  {
    "path": "doc/pcre2_jit_stack_create.3",
    "chars": 1302,
    "preview": ".TH PCRE2_JIT_STACK_CREATE 3 \"23 January 2023\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (r"
  },
  {
    "path": "doc/pcre2_jit_stack_free.3",
    "chars": 717,
    "preview": ".TH PCRE2_JIT_STACK_FREE 3 \"26 February 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (re"
  },
  {
    "path": "doc/pcre2_maketables.3",
    "chars": 1119,
    "preview": ".TH PCRE2_MAKETABLES 3 \"26 February 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revise"
  },
  {
    "path": "doc/pcre2_maketables_free.3",
    "chars": 717,
    "preview": ".TH PCRE2_MAKETABLES_FREE 3 \"03 September 2019\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions ("
  },
  {
    "path": "doc/pcre2_match.3",
    "chars": 3383,
    "preview": ".TH PCRE2_MATCH 3 \"27 January 2024\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised API)"
  },
  {
    "path": "doc/pcre2_match_context_copy.3",
    "chars": 668,
    "preview": ".TH PCRE2_MATCH_CONTEXT_COPY 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions "
  },
  {
    "path": "doc/pcre2_match_context_create.3",
    "chars": 762,
    "preview": ".TH PCRE2_MATCH_CONTEXT_CREATE 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expression"
  },
  {
    "path": "doc/pcre2_match_context_free.3",
    "chars": 725,
    "preview": ".TH PCRE2_MATCH_CONTEXT_FREE 3 \"28 June 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (re"
  },
  {
    "path": "doc/pcre2_match_data_create.3",
    "chars": 1249,
    "preview": ".TH PCRE2_MATCH_DATA_CREATE 3 \"28 August 2021\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (r"
  },
  {
    "path": "doc/pcre2_match_data_create_from_pattern.3",
    "chars": 1529,
    "preview": ".TH PCRE2_MATCH_DATA_CREATE_FROM_PATTERN 3 \"11 August 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular e"
  },
  {
    "path": "doc/pcre2_match_data_free.3",
    "chars": 1051,
    "preview": ".TH PCRE2_MATCH_DATA_FREE 3 \"16 August 2023\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (rev"
  },
  {
    "path": "doc/pcre2_next_match.3",
    "chars": 1437,
    "preview": ".TH PCRE2_NEXT_MATCH 3 \"24 March 2025\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised A"
  },
  {
    "path": "doc/pcre2_pattern_convert.3",
    "chars": 2144,
    "preview": ".TH PCRE2_PATTERN_CONVERT 3 \"12 July 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revis"
  },
  {
    "path": "doc/pcre2_pattern_info.3",
    "chars": 4533,
    "preview": ".TH PCRE2_PATTERN_INFO 3 \"14 February 2019\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revi"
  },
  {
    "path": "doc/pcre2_serialize_decode.3",
    "chars": 2021,
    "preview": ".TH PCRE2_SERIALIZE_DECODE 3 \"22 April 2022\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (rev"
  },
  {
    "path": "doc/pcre2_serialize_encode.3",
    "chars": 2197,
    "preview": ".TH PCRE2_SERIALIZE_ENCODE 3 \"13 August 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (re"
  },
  {
    "path": "doc/pcre2_serialize_free.3",
    "chars": 691,
    "preview": ".TH PCRE2_SERIALIZE_FREE 3 \"13 August 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revi"
  },
  {
    "path": "doc/pcre2_serialize_get_number_of_codes.3",
    "chars": 1116,
    "preview": ".TH PCRE2_SERIALIZE_GET_NUMBER_OF_CODES 3 \"13 August 2018\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular ex"
  },
  {
    "path": "doc/pcre2_set_bsr.3",
    "chars": 714,
    "preview": ".TH PCRE2_SET_BSR 3 \"25 October 2014\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised AP"
  },
  {
    "path": "doc/pcre2_set_callout.3",
    "chars": 781,
    "preview": ".TH PCRE2_SET_CALLOUT 3 \"25 March 2017\" \"PCRE2 10.48-DEV\"\n.SH NAME\nPCRE2 - Perl-compatible regular expressions (revised "
  }
]

// ... and 296 more files (download for full content)

About this extraction

This page contains the full source code of the PhilipHazel/pcre2 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 496 files (14.2 MB), approximately 3.7M tokens, and a symbol index with 642 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!