diff --git a/Makefile.am b/Makefile.am index 15781f9..6f89b12 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,6 @@ dist_doc_DATA = \ doc/pcre2grep.txt \ doc/pcre2test.txt -# FIXME dist_html_DATA = \ doc/html/NON-AUTOTOOLS-BUILD.txt \ doc/html/README.txt \ @@ -27,17 +26,43 @@ dist_html_DATA = \ doc/html/pcre2.html \ doc/html/pcre2_code_free.html \ doc/html/pcre2_compile.html \ + doc/html/pcre2_compile_context_copy.html \ + doc/html/pcre2_compile_context_create.html \ + doc/html/pcre2_compile_context_free.html \ doc/html/pcre2_config.html \ doc/html/pcre2_dfa_match.html \ + doc/html/pcre2_general_context_copy.html \ + doc/html/pcre2_general_context_create.html \ + doc/html/pcre2_general_context_free.html \ doc/html/pcre2_get_error_message.html \ + doc/html/pcre2_get_mark.html \ + doc/html/pcre2_get_ovector_count.html \ + doc/html/pcre2_get_ovector_pointer.html \ + doc/html/pcre2_get_startchar.html \ doc/html/pcre2_jit_compile.html \ + doc/html/pcre2_jit_free_unused_memory.html \ doc/html/pcre2_jit_match.html \ doc/html/pcre2_jit_stack_alloc.html \ doc/html/pcre2_jit_stack_assign.html \ doc/html/pcre2_jit_stack_free.html \ doc/html/pcre2_maketables.html \ doc/html/pcre2_match.html \ + doc/html/pcre2_match_context_copy.html \ + doc/html/pcre2_match_context_create.html \ + doc/html/pcre2_match_context_free.html \ + doc/html/pcre2_match_data_create.html \ + doc/html/pcre2_match_data_create_from_pattern.html \ + doc/html/pcre2_match_data_free.html \ doc/html/pcre2_pattern_info.html \ + doc/html/pcre2_set_bsr.html \ + doc/html/pcre2_set_callout.html \ + doc/html/pcre2_set_character_tables.html \ + doc/html/pcre2_set_compile_recursion_guard.html \ + doc/html/pcre2_set_match_limit.html \ + doc/html/pcre2_set_newline.html \ + doc/html/pcre2_set_parens_nest_limit.html \ + doc/html/pcre2_set_recursion_limit.html \ + doc/html/pcre2_set_recursion_memory_management.html \ doc/html/pcre2_substring_copy_byname.html \ doc/html/pcre2_substring_copy_bynumber.html \ doc/html/pcre2_substring_free.html \ @@ -67,24 +92,48 @@ dist_html_DATA = \ doc/html/pcre2test.html \ doc/html/pcre2unicode.html - -# FIXME dist_man_MANS = \ doc/pcre2-config.1 \ doc/pcre2.3 \ doc/pcre2_code_free.3 \ doc/pcre2_compile.3 \ + doc/pcre2_compile_context_copy.3 \ + doc/pcre2_compile_context_create.3 \ + doc/pcre2_compile_context_free.3 \ doc/pcre2_config.3 \ doc/pcre2_dfa_match.3 \ + doc/pcre2_general_context_copy.3 \ + doc/pcre2_general_context_create.3 \ + doc/pcre2_general_context_free.3 \ doc/pcre2_get_error_message.3 \ + doc/pcre2_get_mark.3 \ + doc/pcre2_get_ovector_count.3 \ + doc/pcre2_get_ovector_pointer.3 \ + doc/pcre2_get_startchar.3 \ doc/pcre2_jit_compile.3 \ + doc/pcre2_jit_free_unused_memory.3 \ doc/pcre2_jit_match.3 \ doc/pcre2_jit_stack_alloc.3 \ doc/pcre2_jit_stack_assign.3 \ doc/pcre2_jit_stack_free.3 \ doc/pcre2_maketables.3 \ doc/pcre2_match.3 \ + doc/pcre2_match_context_copy.3 \ + doc/pcre2_match_context_create.3 \ + doc/pcre2_match_context_free.3 \ + doc/pcre2_match_data_create.3 \ + doc/pcre2_match_data_create_from_pattern.3 \ + doc/pcre2_match_data_free.3 \ doc/pcre2_pattern_info.3 \ + doc/pcre2_set_bsr.3 \ + doc/pcre2_set_callout.3 \ + doc/pcre2_set_character_tables.3 \ + doc/pcre2_set_compile_recursion_guard.3 \ + doc/pcre2_set_match_limit.3 \ + doc/pcre2_set_newline.3 \ + doc/pcre2_set_parens_nest_limit.3 \ + doc/pcre2_set_recursion_limit.3 \ + doc/pcre2_set_recursion_memory_management.3 \ doc/pcre2_substring_copy_byname.3 \ doc/pcre2_substring_copy_bynumber.3 \ doc/pcre2_substring_free.3 \ @@ -151,7 +200,6 @@ EXTRA_DIST += \ # These files contain maintenance information EXTRA_DIST += \ - doc/perltest.txt \ NON-AUTOTOOLS-BUILD \ HACKING @@ -569,7 +617,7 @@ EXTRA_DIST += \ testdata/testoutputEBC \ testdata/wintestinput3 \ testdata/wintestoutput3 \ - perltest.pl + perltest.sh CLEANFILES += \ testsavedregex \ diff --git a/PrepareRelease b/PrepareRelease index 59037ac..f6b138f 100755 --- a/PrepareRelease +++ b/PrepareRelease @@ -191,7 +191,7 @@ files="\ RunGrepTest \ RunTest \ pcre2-config.in \ - perltest.pl \ + perltest.sh \ libpcre2-8.pc.in \ libpcre2-16.pc.in \ libpcre2-32.pc.in \ diff --git a/README b/README index d765b21..293c00a 100644 --- a/README +++ b/README @@ -574,7 +574,7 @@ a list of tests. The first two tests can always be run, as they expect only plain text strings (not UTF) and make no use of Unicode properties. The first test file can be fed -directly into the perltest.pl script to check that Perl gives the same results. +directly into the perltest.sh script to check that Perl gives the same results. The only difference you should see is in the first few lines, where the Perl version is given instead of the PCRE2 version. The second set of tests check auxiliary functions, error detection, and run-time flags that are specific to @@ -609,7 +609,7 @@ of the French locale have been encountered. The test passes if its output matches any one of them. The fourth and fifth tests check UTF and Unicode property support, the fourth -being compatible with the perltest.pl script, and the fifth checking +being compatible with the perltest.sh script, and the fifth checking PCRE2-specific things. The sixth and seventh tests check the pcre2_dfa_match() alternative matching @@ -781,7 +781,6 @@ The distribution should contain the files listed below. doc/html/* HTML documentation doc/pcre2.txt plain text version of the man pages doc/pcre2test.txt plain text documentation of test program - doc/perltest.txt plain text documentation of Perl test program install-sh a shell script for installing files libpcre2-8.pc.in template for libpcre2-8.pc for pkg-config libpcre2-16.pc.in template for libpcre2-16.pc for pkg-config @@ -791,7 +790,7 @@ The distribution should contain the files listed below. missing ) common stub for a few missing GNU programs while ) installing, generated by automake mkinstalldirs script for making install directories - perltest.pl Perl test program + perltest.sh Script for running a Perl test program pcre2-config.in source of script which retains PCRE2 information pcre2_jit_test.c test program for the JIT compiler testdata/testinput* test data for main library tests @@ -829,4 +828,4 @@ The distribution should contain the files listed below. Philip Hazel Email local part: ph10 Email domain: cam.ac.uk -Last updated: 27 October 2014 +Last updated: 25 October 2014 diff --git a/doc/html/index.html b/doc/html/index.html index afefd8c..865c895 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -91,8 +91,14 @@ in the library. pcre2_compile   Compile a regular expression pattern -pcre2_compile2 -   Compile a regular expression (alternate interface) +pcre2_compile_context_copy +   Copy a compile context + +pcre2_compile_context_create +   Create a compile context + +pcre2_compile_context_free +   Free a compile context pcre2_config   Show build-time configuration options @@ -101,12 +107,36 @@ in the library.   Match a compiled pattern to a subject string (DFA algorithm; not Perl compatible) +pcre2_general_context_copy +   Copy a general context + +pcre2_general_context_create +   Create a general context + +pcre2_general_context_free +   Free a general context + pcre2_get_error_message   Free study data +pcre2_get_mark +   Get a (*MARK) name + +pcre2_get_ovector_count +   Get the ovector count + +pcre2_get_ovector_pointer +   Get a pointer to the ovector + +pcre2_get_startchar +   Get the starting character offset + pcre2_jit_compile   Process a compiled pattern with the JIT compiler +pcre2_jit_free_unused_memory +   Free unused JIT memory + pcre2_jit_match   Fast path interface to JIT matching @@ -126,9 +156,54 @@ in the library.   Match a compiled pattern to a subject string (Perl compatible) +pcre2_match_context_copy +   Copy a match context + +pcre2_match_context_create +   Create a match context + +pcre2_match_contest_free +   Free a match context + +pcre2_match_data_create +   Create a match data block + +pcre2_match_data_create_from_pattern +   Create a match data block getting size from pattern + +pcre2_match_data_free +   Free a match data block + pcre2_pattern_info   Extract information about a pattern +pcre2_set_bsr +   Set \R convention + +pcre2_set_callout +   Set up a callout function + +pcre2_set_character_tables +   Set character tables + +pcre2_set_compile_recursion_guard +   Set up a compile recursion guard function + +pcre2_set_match_limit +   Set the match limit + +pcre2_set_newline +   Set the newline convention + +pcre2_set_parens_nest_limit +   Set the parentheses nesting limit + +pcre2_set_recursion_limit +   Set the match recursion limit + +pcre2_set_recursion_memory_management +   Set match recursion memory management + pcre2_substring_copy_byname   Extract named substring into given buffer diff --git a/doc/html/pcre2_compile_context_copy.html b/doc/html/pcre2_compile_context_copy.html new file mode 100644 index 0000000..9e9884b --- /dev/null +++ b/doc/html/pcre2_compile_context_copy.html @@ -0,0 +1,41 @@ + + +pcre2_compile_context_copy specification + + +

pcre2_compile_context_copy man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_compile_context *pcre2_compile_context_copy( + pcre2_compile_context *ccontext); +

+
+DESCRIPTION +
+

+This function makes a new copy of a compile context, using the memory +allocation function that was used for the original context. The result is NULL +if the memory cannot be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_compile_context_create.html b/doc/html/pcre2_compile_context_create.html new file mode 100644 index 0000000..5eacd4e --- /dev/null +++ b/doc/html/pcre2_compile_context_create.html @@ -0,0 +1,42 @@ + + +pcre2_compile_context_create specification + + +

pcre2_compile_context_create man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_compile_context *pcre2_compile_context_create( + pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function creates and initializes a new compile context. If its argument is +NULL, malloc() is used to get the necessary memory; otherwise the memory +allocation function within the general context is used. The result is NULL if +the memory could not be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_compile_context_free.html b/doc/html/pcre2_compile_context_free.html new file mode 100644 index 0000000..ea67a18 --- /dev/null +++ b/doc/html/pcre2_compile_context_free.html @@ -0,0 +1,40 @@ + + +pcre2_compile_context_free specification + + +

pcre2_compile_context_free man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+void pcre2_compile_context_free(pcre2_compile_context *ccontext); +

+
+DESCRIPTION +
+

+This function frees the memory occupied by a compile context, using the memory +freeing function from the general context with which it was created, or +free() if that was not set. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_general_context_copy.html b/doc/html/pcre2_general_context_copy.html new file mode 100644 index 0000000..0018534 --- /dev/null +++ b/doc/html/pcre2_general_context_copy.html @@ -0,0 +1,42 @@ + + +pcre2_general_context_copy specification + + +

pcre2_general_context_copy man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_general_context *pcre2_general_context_copy( + pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function makes a new copy of a general context, using the memory +allocation functions in the context, if set, to get the necessary memory. +Otherwise malloc() is used. The result is NULL if the memory cannot be +obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_general_context_create.html b/doc/html/pcre2_general_context_create.html new file mode 100644 index 0000000..bc31ee8 --- /dev/null +++ b/doc/html/pcre2_general_context_create.html @@ -0,0 +1,44 @@ + + +pcre2_general_context_create specification + + +

pcre2_general_context_create man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_general_context *pcre2_general_context_create( + void *(*private_malloc)(PCRE2_SIZE, void *), + void (*private_free)(void *, void *), void *memory_data); +

+
+DESCRIPTION +
+

+This function creates and initializes a general context. The arguments define +custom memory management functions and a data value that is passed to them when +they are called. The private_malloc() function is used to get memory for +the context. If either of the first two arguments is NULL, the system memory +management function is used. The result is NULL if no memory could be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_general_context_free.html b/doc/html/pcre2_general_context_free.html new file mode 100644 index 0000000..ec818ef --- /dev/null +++ b/doc/html/pcre2_general_context_free.html @@ -0,0 +1,39 @@ + + +pcre2_general_context_free specification + + +

pcre2_general_context_free man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+void pcre2_general_context_free(pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function frees the memory occupied by a general context, using the memory +freeing function within the context, if set. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_get_mark.html b/doc/html/pcre2_get_mark.html new file mode 100644 index 0000000..f8e50e3 --- /dev/null +++ b/doc/html/pcre2_get_mark.html @@ -0,0 +1,43 @@ + + +pcre2_get_mark specification + + +

pcre2_get_mark man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+PCRE2_SPTR pcre2_get_mark(pcre2_match_data *match_data); +

+
+DESCRIPTION +
+

+After a call of pcre2_match() that was passed the match block that is +this function's argument, this function returns a pointer to the last (*MARK) +name that was encountered. The name is zero-terminated, and is within the +compiled pattern. If no (*MARK) name is available, NULL is returned. A (*MARK) +name may be available after a failed match or a partial match, as well as after +a successful one. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_get_ovector_count.html b/doc/html/pcre2_get_ovector_count.html new file mode 100644 index 0000000..05aacb6 --- /dev/null +++ b/doc/html/pcre2_get_ovector_count.html @@ -0,0 +1,39 @@ + + +pcre2_get_ovector_count specification + + +

pcre2_get_ovector_count man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+uint32_t pcre2_get_ovector_count(pcre2_match_data *match_data); +

+
+DESCRIPTION +
+

+This function returns the number of pairs of offsets in the ovector that forms +part of the given match data block. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_get_ovector_pointer.html b/doc/html/pcre2_get_ovector_pointer.html new file mode 100644 index 0000000..ff6317e --- /dev/null +++ b/doc/html/pcre2_get_ovector_pointer.html @@ -0,0 +1,40 @@ + + +pcre2_get_ovector_pointer specification + + +

pcre2_get_ovector_pointer man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+PCRE2_SIZE *pcre2_get_ovector_pointer(pcre2_match_data *match_data); +

+
+DESCRIPTION +
+

+This function returns a pointer to the vector of offsets that forms part of the +given match data block. The number of pairs can be found by calling +pcre2_get_ovector_count(). +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_get_startchar.html b/doc/html/pcre2_get_startchar.html new file mode 100644 index 0000000..c9d0dfa --- /dev/null +++ b/doc/html/pcre2_get_startchar.html @@ -0,0 +1,42 @@ + + +pcre2_get_startchar specification + + +

pcre2_get_startchar man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *match_data); +

+
+DESCRIPTION +
+

+After a successful call of pcre2_match() that was passed the match block +that is this function's argument, this function returns the code unit offset of +the character at which the successful match started. This can be different to +the value of ovector[0] if the pattern contains the \K escape sequence. +Note, however, that \K has no effect for a partial match. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_jit_free_unused_memory.html b/doc/html/pcre2_jit_free_unused_memory.html new file mode 100644 index 0000000..cdd5b39 --- /dev/null +++ b/doc/html/pcre2_jit_free_unused_memory.html @@ -0,0 +1,40 @@ + + +pcre2_jit_free_unused_memory specification + + +

pcre2_jit_free_unused_memory man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+void pcre2_jit_free_unused_memory(pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function frees unused JIT executable memory. The argument is a general +context, for custom memory management, or NULL for standard memory management. +FIXME: more detail needed. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_match_context_copy.html b/doc/html/pcre2_match_context_copy.html new file mode 100644 index 0000000..4a719d6 --- /dev/null +++ b/doc/html/pcre2_match_context_copy.html @@ -0,0 +1,41 @@ + + +pcre2_match_context_copy specification + + +

pcre2_match_context_copy man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_match_context *pcre2_match_context_copy( + pcre2_match_context *mcontext); +

+
+DESCRIPTION +
+

+This function makes a new copy of a match context, using the memory +allocation function that was used for the original context. The result is NULL +if the memory cannot be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_match_context_create.html b/doc/html/pcre2_match_context_create.html new file mode 100644 index 0000000..f7f2735 --- /dev/null +++ b/doc/html/pcre2_match_context_create.html @@ -0,0 +1,42 @@ + + +pcre2_match_context_create specification + + +

pcre2_match_context_create man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_match_context *pcre2_match_context_create( + pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function creates and initializes a new match context. If its argument is +NULL, malloc() is used to get the necessary memory; otherwise the memory +allocation function within the general context is used. The result is NULL if +the memory could not be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_match_context_free.html b/doc/html/pcre2_match_context_free.html new file mode 100644 index 0000000..8248974 --- /dev/null +++ b/doc/html/pcre2_match_context_free.html @@ -0,0 +1,40 @@ + + +pcre2_match_context_free specification + + +

pcre2_match_context_free man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+void pcre2_match_context_free(pcre2_match_context *mcontext); +

+
+DESCRIPTION +
+

+This function frees the memory occupied by a match context, using the memory +freeing function from the general context with which it was created, or +free() if that was not set. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_match_data_create.html b/doc/html/pcre2_match_data_create.html new file mode 100644 index 0000000..03cbe24 --- /dev/null +++ b/doc/html/pcre2_match_data_create.html @@ -0,0 +1,49 @@ + + +pcre2_match_data_create specification + + +

pcre2_match_data_create man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_match_data_create(uint32_t ovecsize, + pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function creates a new match data block, which is used for holding the +result of a match. The first argument specifies the number of pairs of offsets +that are required. These form the "output vector" (ovector) within the match +data block, and are used to identify the matched string and any captured +substrings. There is always one pair of offsets; if ovecsize is zero, it +is treated as one. +

+

+The second argument points to a general context, for custom memory management, +or is NULL for system memory management. The result of the function is NULL if +the memory for the block could not be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_match_data_create_from_pattern.html b/doc/html/pcre2_match_data_create_from_pattern.html new file mode 100644 index 0000000..2d58232 --- /dev/null +++ b/doc/html/pcre2_match_data_create_from_pattern.html @@ -0,0 +1,49 @@ + + +pcre2_match_data_create_from_pattern specification + + +

pcre2_match_data_create_from_pattern man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+pcre2_match_data_create_from_pattern(pcre2_code *code, + pcre2_general_context *gcontext); +

+
+DESCRIPTION +
+

+This function creates a new match data block, which is used for holding the +result of a match. The first argument points to a compiled pattern. The number +of capturing parentheses within the pattern is used to compute the number of +pairs of offsets that are required in the match data block. These form the +"output vector" (ovector) within the match data block, and are used to identify +the matched string and any captured substrings. +

+

+The second argument points to a general context, for custom memory management, +or is NULL for system memory management. The result of the function is NULL if +the memory for the block could not be obtained. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_match_data_free.html b/doc/html/pcre2_match_data_free.html new file mode 100644 index 0000000..70e107e --- /dev/null +++ b/doc/html/pcre2_match_data_free.html @@ -0,0 +1,40 @@ + + +pcre2_match_data_free specification + + +

pcre2_match_data_free man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+void pcre2_match_data_free(pcre2_match_data *match_data); +

+
+DESCRIPTION +
+

+This function frees the memory occupied by a match data block, using the memory +freeing function from the general context with which it was created, or +free() if that was not set. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_bsr.html b/doc/html/pcre2_set_bsr.html new file mode 100644 index 0000000..8a62f18 --- /dev/null +++ b/doc/html/pcre2_set_bsr.html @@ -0,0 +1,42 @@ + + +pcre2_set_bsr specification + + +

pcre2_set_bsr man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_bsr(pcre2_compile_context *ccontext, + uint32_t value); +

+
+DESCRIPTION +
+

+This function sets the convention for processing \R within a compile context. +The second argument must be one of PCRE2_BSR_ANYCRLF or PCRE2_BSR_UNICODE. The +result is zero for success or PCRE2_ERROR_BADDATA if the second argument is +invalid. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_callout.html b/doc/html/pcre2_set_callout.html new file mode 100644 index 0000000..635e0c2 --- /dev/null +++ b/doc/html/pcre2_set_callout.html @@ -0,0 +1,43 @@ + + +pcre2_set_callout specification + + +

pcre2_set_callout man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_callout(pcre2_match_context *mcontext, + int (*callout_function)(pcre2_callout_block *), + void *callout_data); +

+
+DESCRIPTION +
+

+This function sets the callout fields in a match context (the first argument). +The second argument specifies a callout function, and the third argument is an +opaque data time that is passed to it. The result of this function is always +zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_character_tables.html b/doc/html/pcre2_set_character_tables.html new file mode 100644 index 0000000..5a1bd20 --- /dev/null +++ b/doc/html/pcre2_set_character_tables.html @@ -0,0 +1,42 @@ + + +pcre2_set_character_tables specification + + +

pcre2_set_character_tables man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_character_tables(pcre2_compile_context *ccontext, + const unsigned char *tables); +

+
+DESCRIPTION +
+

+This function sets a pointer to custom character tables within a compile +context. The second argument must be the result of a call to +pcre2_maketables() or NULL to request the default tables. The result is +always zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_compile_recursion_guard.html b/doc/html/pcre2_set_compile_recursion_guard.html new file mode 100644 index 0000000..8fa3edc --- /dev/null +++ b/doc/html/pcre2_set_compile_recursion_guard.html @@ -0,0 +1,45 @@ + + +pcre2_set_compile_recursion_guard specification + + +

pcre2_set_compile_recursion_guard man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_compile_recursion_guard(pcre2_compile_context *ccontext, + int (*guard_function)(uint32_t)); +

+
+DESCRIPTION +
+

+This function defines, within a compile context, a function that is called +whenever pcre2_compile() starts to compile a parenthesized part of a +pattern. The argument to the function gives the current depth of parenthesis +nesting. The function should return zero if all is well, or non-zero to force +an error. This feature is provided so that applications can check the available +system stack space, in order to avoid running out. The result of this function +is always zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_match_limit.html b/doc/html/pcre2_set_match_limit.html new file mode 100644 index 0000000..e840c74 --- /dev/null +++ b/doc/html/pcre2_set_match_limit.html @@ -0,0 +1,40 @@ + + +pcre2_set_match_limit specification + + +

pcre2_set_match_limit man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_match_limit(pcre2_match_context *mcontext, + uint32_t value); +

+
+DESCRIPTION +
+

+This function sets the match limit field in a match context. The result is +always zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_newline.html b/doc/html/pcre2_set_newline.html new file mode 100644 index 0000000..ae6332a --- /dev/null +++ b/doc/html/pcre2_set_newline.html @@ -0,0 +1,50 @@ + + +pcre2_set_newline specification + + +

pcre2_set_newline man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_newline(pcre2_compile_context *ccontext, + uint32_t value); +

+
+DESCRIPTION +
+

+This function sets the newline convention within a compile context. This +specifies which character(s) are recognized as newlines when compiling and +matching patterns. The second argument must be one of: +

+  PCRE2_NEWLINE_CR        Carriage return only
+  PCRE2_NEWLINE_LF        Linefeed only
+  PCRE2_NEWLINE_CRLF      CR followed by LF only
+  PCRE2_NEWLINE_ANYCRLF   Any of the above
+  PCRE2_NEWLINE_ANY       Any Unicode newline sequence
+
+The result is zero for success or PCRE2_ERROR_BADDATA if the second argument is +invalid. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_parens_nest_limit.html b/doc/html/pcre2_set_parens_nest_limit.html new file mode 100644 index 0000000..95fd31c --- /dev/null +++ b/doc/html/pcre2_set_parens_nest_limit.html @@ -0,0 +1,40 @@ + + +pcre2_set_parens_nest_limit specification + + +

pcre2_set_parens_nest_limit man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_parens_nest_limit(pcre2_compile_context *ccontext, + uint32_t value); +

+
+DESCRIPTION +
+

+This function sets, in a compile context, the maximum depth of nested +parentheses in a pattern. The result is always zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_recursion_limit.html b/doc/html/pcre2_set_recursion_limit.html new file mode 100644 index 0000000..5adcc99 --- /dev/null +++ b/doc/html/pcre2_set_recursion_limit.html @@ -0,0 +1,40 @@ + + +pcre2_set_recursion_limit specification + + +

pcre2_set_recursion_limit man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_recursion_limit(pcre2_match_context *mcontext, + uint32_t value); +

+
+DESCRIPTION +
+

+This function sets the recursion limit field in a match context. The result is +always zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2_set_recursion_memory_management.html b/doc/html/pcre2_set_recursion_memory_management.html new file mode 100644 index 0000000..ec18947 --- /dev/null +++ b/doc/html/pcre2_set_recursion_memory_management.html @@ -0,0 +1,47 @@ + + +pcre2_set_recursion_memory_management specification + + +

pcre2_set_recursion_memory_management man page

+

+Return to the PCRE2 index page. +

+

+This page is part of the PCRE2 HTML documentation. It was generated +automatically from the original man page. If there is any nonsense in it, +please consult the man page, in case the conversion went wrong. +
+
+SYNOPSIS +
+

+#include <pcre2.h> +

+

+int pcre2_set_recursion_memory_management( + pcre2_match_context *mcontext, + void *(*private_malloc)(PCRE2_SIZE, void *), + void (*private_free)(void *, void *), void *memory_data); +

+
+DESCRIPTION +
+

+This function sets the match context fields for custom memory management when +PCRE2 is compiled to use the heap instead of the system stack for recursive +function calls while matching. When PCRE2 is compiled to use the stack (the +default) this function does nothing. The first argument is a match context, the +second and third specify the memory allocation and freeing functions, and the +final argument is an opaque value that is passed to them whenever they are +called. The result of this function is always zero. +

+

+There is a complete description of the PCRE2 native API in the +pcre2api +page and a description of the POSIX API in the +pcre2posix +page. +

+Return to the PCRE2 index page. +

diff --git a/doc/html/pcre2api.html b/doc/html/pcre2api.html index eacf4e1..016fd4a 100644 --- a/doc/html/pcre2api.html +++ b/doc/html/pcre2api.html @@ -2053,7 +2053,7 @@ match or a partial match, as well as after a successful one. The offset of the character at which the successful match started is returned by pcre2_get_startchar(). This can be different to the value of ovector[0] if the pattern contains the \K escape sequence. Note, -however, the \K has no effect for a partial match. +however, that \K has no effect for a partial match.


Error return values from pcre2_match() diff --git a/doc/index.html.src b/doc/index.html.src index 5e7984f..738199a 100644 --- a/doc/index.html.src +++ b/doc/index.html.src @@ -91,8 +91,14 @@ in the library. pcre2_compile   Compile a regular expression pattern -pcre2_compile2 -   Compile a regular expression (alternate interface) +pcre2_compile_context_copy +   Copy a compile context + +pcre2_compile_context_create +   Create a compile context + +pcre2_compile_context_free +   Free a compile context pcre2_config   Show build-time configuration options @@ -101,12 +107,36 @@ in the library.   Match a compiled pattern to a subject string (DFA algorithm; not Perl compatible) +pcre2_general_context_copy +   Copy a general context + +pcre2_general_context_create +   Create a general context + +pcre2_general_context_free +   Free a general context + pcre2_get_error_message   Free study data +pcre2_get_mark +   Get a (*MARK) name + +pcre2_get_ovector_count +   Get the ovector count + +pcre2_get_ovector_pointer +   Get a pointer to the ovector + +pcre2_get_startchar +   Get the starting character offset + pcre2_jit_compile   Process a compiled pattern with the JIT compiler +pcre2_jit_free_unused_memory +   Free unused JIT memory + pcre2_jit_match   Fast path interface to JIT matching @@ -126,9 +156,54 @@ in the library.   Match a compiled pattern to a subject string (Perl compatible) +pcre2_match_context_copy +   Copy a match context + +pcre2_match_context_create +   Create a match context + +pcre2_match_context_free +   Free a match context + +pcre2_match_data_create +   Create a match data block + +pcre2_match_data_create_from_pattern +   Create a match data block getting size from pattern + +pcre2_match_data_free +   Free a match data block + pcre2_pattern_info   Extract information about a pattern +pcre2_set_bsr +   Set \R convention + +pcre2_set_callout +   Set up a callout function + +pcre2_set_character_tables +   Set character tables + +pcre2_set_compile_recursion_guard +   Set up a compile recursion guard function + +pcre2_set_match_limit +   Set the match limit + +pcre2_set_newline +   Set the newline convention + +pcre2_set_parens_nest_limit +   Set the parentheses nesting limit + +pcre2_set_recursion_limit +   Set the match recursion limit + +pcre2_set_recursion_memory_management +   Set match recursion memory management + pcre2_substring_copy_byname   Extract named substring into given buffer diff --git a/doc/pcre2.txt b/doc/pcre2.txt index adb33bc..806e3ab 100644 --- a/doc/pcre2.txt +++ b/doc/pcre2.txt @@ -2037,7 +2037,7 @@ HOW PCRE2_MATCH() RETURNS A STRING AND CAPTURED SUBSTRINGS The offset of the character at which the successful match started is returned by pcre2_get_startchar(). This can be different to the value of ovector[0] if the pattern contains the \K escape sequence. Note, - however, the \K has no effect for a partial match. + however, that \K has no effect for a partial match. Error return values from pcre2_match() diff --git a/doc/pcre2_compile_context_copy.3 b/doc/pcre2_compile_context_copy.3 new file mode 100644 index 0000000..aea1187 --- /dev/null +++ b/doc/pcre2_compile_context_copy.3 @@ -0,0 +1,29 @@ +.TH PCRE2_COMPILE_CONTEXT_COPY 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_compile_context *pcre2_compile_context_copy( +.B " pcre2_compile_context *\fIccontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function makes a new copy of a compile context, using the memory +allocation function that was used for the original context. The result is NULL +if the memory cannot be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_compile_context_create.3 b/doc/pcre2_compile_context_create.3 new file mode 100644 index 0000000..3053df4 --- /dev/null +++ b/doc/pcre2_compile_context_create.3 @@ -0,0 +1,30 @@ +.TH PCRE2_COMPILE_CONTEXT_CREATE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_compile_context *pcre2_compile_context_create( +.B " pcre2_general_context *\fIgcontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function creates and initializes a new compile context. If its argument is +NULL, \fBmalloc()\fP is used to get the necessary memory; otherwise the memory +allocation function within the general context is used. The result is NULL if +the memory could not be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_compile_context_free.3 b/doc/pcre2_compile_context_free.3 new file mode 100644 index 0000000..0c6d787 --- /dev/null +++ b/doc/pcre2_compile_context_free.3 @@ -0,0 +1,28 @@ +.TH PCRE2_COMPILE_CONTEXT_FREE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B void pcre2_compile_context_free(pcre2_compile_context *\fIccontext\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function frees the memory occupied by a compile context, using the memory +freeing function from the general context with which it was created, or +\fBfree()\fP if that was not set. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_general_context_copy.3 b/doc/pcre2_general_context_copy.3 new file mode 100644 index 0000000..637e565 --- /dev/null +++ b/doc/pcre2_general_context_copy.3 @@ -0,0 +1,30 @@ +.TH PCRE2_GENERAL_CONTEXT_COPY 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_general_context *pcre2_general_context_copy( +.B " pcre2_general_context *\fIgcontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function makes a new copy of a general context, using the memory +allocation functions in the context, if set, to get the necessary memory. +Otherwise \fBmalloc()\fP is used. The result is NULL if the memory cannot be +obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_general_context_create.3 b/doc/pcre2_general_context_create.3 new file mode 100644 index 0000000..a3e6c10 --- /dev/null +++ b/doc/pcre2_general_context_create.3 @@ -0,0 +1,32 @@ +.TH PCRE2_GENERAL_CONTEXT_CREATE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_general_context *pcre2_general_context_create( +.B " void *(*\fIprivate_malloc\fP)(PCRE2_SIZE, void *)," +.B " void (*\fIprivate_free\fP)(void *, void *), void *\fImemory_data\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function creates and initializes a general context. The arguments define +custom memory management functions and a data value that is passed to them when +they are called. The \fBprivate_malloc()\fP function is used to get memory for +the context. If either of the first two arguments is NULL, the system memory +management function is used. The result is NULL if no memory could be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_general_context_free.3 b/doc/pcre2_general_context_free.3 new file mode 100644 index 0000000..6285332 --- /dev/null +++ b/doc/pcre2_general_context_free.3 @@ -0,0 +1,27 @@ +.TH PCRE2_GENERAL_CONTEXT_FREE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B void pcre2_general_context_free(pcre2_general_context *\fIgcontext\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function frees the memory occupied by a general context, using the memory +freeing function within the context, if set. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_get_mark.3 b/doc/pcre2_get_mark.3 new file mode 100644 index 0000000..e741dfe --- /dev/null +++ b/doc/pcre2_get_mark.3 @@ -0,0 +1,31 @@ +.TH PCRE2_GET_MARK 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B PCRE2_SPTR pcre2_get_mark(pcre2_match_data *\fImatch_data\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +After a call of \fBpcre2_match()\fP that was passed the match block that is +this function's argument, this function returns a pointer to the last (*MARK) +name that was encountered. The name is zero-terminated, and is within the +compiled pattern. If no (*MARK) name is available, NULL is returned. A (*MARK) +name may be available after a failed match or a partial match, as well as after +a successful one. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_get_ovector_count.3 b/doc/pcre2_get_ovector_count.3 new file mode 100644 index 0000000..3f6d748 --- /dev/null +++ b/doc/pcre2_get_ovector_count.3 @@ -0,0 +1,27 @@ +.TH PCRE2_GET_OVECTOR_COUNT 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B uint32_t pcre2_get_ovector_count(pcre2_match_data *\fImatch_data\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function returns the number of pairs of offsets in the ovector that forms +part of the given match data block. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_get_ovector_pointer.3 b/doc/pcre2_get_ovector_pointer.3 new file mode 100644 index 0000000..261d652 --- /dev/null +++ b/doc/pcre2_get_ovector_pointer.3 @@ -0,0 +1,28 @@ +.TH PCRE2_GET_OVECTOR_POINTER 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B PCRE2_SIZE *pcre2_get_ovector_pointer(pcre2_match_data *\fImatch_data\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function returns a pointer to the vector of offsets that forms part of the +given match data block. The number of pairs can be found by calling +\fBpcre2_get_ovector_count()\fP. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_get_startchar.3 b/doc/pcre2_get_startchar.3 new file mode 100644 index 0000000..203ab93 --- /dev/null +++ b/doc/pcre2_get_startchar.3 @@ -0,0 +1,30 @@ +.TH PCRE2_GET_STARTCHAR 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *\fImatch_data\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +After a successful call of \fBpcre2_match()\fP that was passed the match block +that is this function's argument, this function returns the code unit offset of +the character at which the successful match started. This can be different to +the value of \fIovector[0]\fP if the pattern contains the \eK escape sequence. +Note, however, that \eK has no effect for a partial match. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_jit_free_unused_memory.3 b/doc/pcre2_jit_free_unused_memory.3 new file mode 100644 index 0000000..7a77997 --- /dev/null +++ b/doc/pcre2_jit_free_unused_memory.3 @@ -0,0 +1,28 @@ +.TH PCRE2_JIT_FREE_UNUSED_MEMORY 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B void pcre2_jit_free_unused_memory(pcre2_general_context *\fIgcontext\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function frees unused JIT executable memory. The argument is a general +context, for custom memory management, or NULL for standard memory management. +FIXME: more detail needed. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_match_context_copy.3 b/doc/pcre2_match_context_copy.3 new file mode 100644 index 0000000..26c33a6 --- /dev/null +++ b/doc/pcre2_match_context_copy.3 @@ -0,0 +1,29 @@ +.TH PCRE2_MATCH_CONTEXT_COPY 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_match_context *pcre2_match_context_copy( +.B " pcre2_match_context *\fImcontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function makes a new copy of a match context, using the memory +allocation function that was used for the original context. The result is NULL +if the memory cannot be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_match_context_create.3 b/doc/pcre2_match_context_create.3 new file mode 100644 index 0000000..d4a2665 --- /dev/null +++ b/doc/pcre2_match_context_create.3 @@ -0,0 +1,30 @@ +.TH PCRE2_MATCH_CONTEXT_CREATE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_match_context *pcre2_match_context_create( +.B " pcre2_general_context *\fIgcontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function creates and initializes a new match context. If its argument is +NULL, \fBmalloc()\fP is used to get the necessary memory; otherwise the memory +allocation function within the general context is used. The result is NULL if +the memory could not be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_match_context_free.3 b/doc/pcre2_match_context_free.3 new file mode 100644 index 0000000..71b9783 --- /dev/null +++ b/doc/pcre2_match_context_free.3 @@ -0,0 +1,28 @@ +.TH PCRE2_MATCH_CONTEXT_FREE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B void pcre2_match_context_free(pcre2_match_context *\fImcontext\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function frees the memory occupied by a match context, using the memory +freeing function from the general context with which it was created, or +\fBfree()\fP if that was not set. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_match_data_create.3 b/doc/pcre2_match_data_create.3 new file mode 100644 index 0000000..2a92f0b --- /dev/null +++ b/doc/pcre2_match_data_create.3 @@ -0,0 +1,36 @@ +.TH PCRE2_MATCH_DATA_CREATE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_match_data_create(uint32_t \fIovecsize\fP, +.B " pcre2_general_context *\fIgcontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function creates a new match data block, which is used for holding the +result of a match. The first argument specifies the number of pairs of offsets +that are required. These form the "output vector" (ovector) within the match +data block, and are used to identify the matched string and any captured +substrings. There is always one pair of offsets; if \fBovecsize\fP is zero, it +is treated as one. +.P +The second argument points to a general context, for custom memory management, +or is NULL for system memory management. The result of the function is NULL if +the memory for the block could not be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_match_data_create_from_pattern.3 b/doc/pcre2_match_data_create_from_pattern.3 new file mode 100644 index 0000000..aef93af --- /dev/null +++ b/doc/pcre2_match_data_create_from_pattern.3 @@ -0,0 +1,36 @@ +.TH PCRE2_MATCH_DATA_CREATE_FROM_PATTERN 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B pcre2_match_data_create_from_pattern(pcre2_code *\fIcode\fP, +.B " pcre2_general_context *\fIgcontext\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function creates a new match data block, which is used for holding the +result of a match. The first argument points to a compiled pattern. The number +of capturing parentheses within the pattern is used to compute the number of +pairs of offsets that are required in the match data block. These form the +"output vector" (ovector) within the match data block, and are used to identify +the matched string and any captured substrings. +.P +The second argument points to a general context, for custom memory management, +or is NULL for system memory management. The result of the function is NULL if +the memory for the block could not be obtained. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_match_data_free.3 b/doc/pcre2_match_data_free.3 new file mode 100644 index 0000000..5e4bc62 --- /dev/null +++ b/doc/pcre2_match_data_free.3 @@ -0,0 +1,28 @@ +.TH PCRE2_MATCH_DATA_FREE 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B void pcre2_match_data_free(pcre2_match_data *\fImatch_data\fP); +.fi +. +.SH DESCRIPTION +.rs +.sp +This function frees the memory occupied by a match data block, using the memory +freeing function from the general context with which it was created, or +\fBfree()\fP if that was not set. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_bsr.3 b/doc/pcre2_set_bsr.3 new file mode 100644 index 0000000..ecf2437 --- /dev/null +++ b/doc/pcre2_set_bsr.3 @@ -0,0 +1,30 @@ +.TH PCRE2_SET_BSR 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_bsr(pcre2_compile_context *\fIccontext\fP, +.B " uint32_t \fIvalue\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets the convention for processing \eR within a compile context. +The second argument must be one of PCRE2_BSR_ANYCRLF or PCRE2_BSR_UNICODE. The +result is zero for success or PCRE2_ERROR_BADDATA if the second argument is +invalid. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_callout.3 b/doc/pcre2_set_callout.3 new file mode 100644 index 0000000..2f86f69 --- /dev/null +++ b/doc/pcre2_set_callout.3 @@ -0,0 +1,31 @@ +.TH PCRE2_SET_CALLOUT 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_callout(pcre2_match_context *\fImcontext\fP, +.B " int (*\fIcallout_function\fP)(pcre2_callout_block *)," +.B " void *\fIcallout_data\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets the callout fields in a match context (the first argument). +The second argument specifies a callout function, and the third argument is an +opaque data time that is passed to it. The result of this function is always +zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_character_tables.3 b/doc/pcre2_set_character_tables.3 new file mode 100644 index 0000000..1ede4f9 --- /dev/null +++ b/doc/pcre2_set_character_tables.3 @@ -0,0 +1,30 @@ +.TH PCRE2_SET_CHARACTER_TABLES 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_character_tables(pcre2_compile_context *\fIccontext\fP, +.B " const unsigned char *\fItables\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets a pointer to custom character tables within a compile +context. The second argument must be the result of a call to +\fBpcre2_maketables()\fP or NULL to request the default tables. The result is +always zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_compile_recursion_guard.3 b/doc/pcre2_set_compile_recursion_guard.3 new file mode 100644 index 0000000..96f1566 --- /dev/null +++ b/doc/pcre2_set_compile_recursion_guard.3 @@ -0,0 +1,33 @@ +.TH PCRE2_SET_COMPILE_RECURSION_GUARD 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_compile_recursion_guard(pcre2_compile_context *\fIccontext\fP, +.B " int (*\fIguard_function\fP)(uint32_t));" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function defines, within a compile context, a function that is called +whenever \fBpcre2_compile()\fP starts to compile a parenthesized part of a +pattern. The argument to the function gives the current depth of parenthesis +nesting. The function should return zero if all is well, or non-zero to force +an error. This feature is provided so that applications can check the available +system stack space, in order to avoid running out. The result of this function +is always zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_match_limit.3 b/doc/pcre2_set_match_limit.3 new file mode 100644 index 0000000..523e97f --- /dev/null +++ b/doc/pcre2_set_match_limit.3 @@ -0,0 +1,28 @@ +.TH PCRE2_SET_MATCH_LIMIT 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_match_limit(pcre2_match_context *\fImcontext\fP, +.B " uint32_t \fIvalue\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets the match limit field in a match context. The result is +always zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_newline.3 b/doc/pcre2_set_newline.3 new file mode 100644 index 0000000..8237500 --- /dev/null +++ b/doc/pcre2_set_newline.3 @@ -0,0 +1,38 @@ +.TH PCRE2_SET_NEWLINE 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_newline(pcre2_compile_context *\fIccontext\fP, +.B " uint32_t \fIvalue\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets the newline convention within a compile context. This +specifies which character(s) are recognized as newlines when compiling and +matching patterns. The second argument must be one of: +.sp + PCRE2_NEWLINE_CR Carriage return only + PCRE2_NEWLINE_LF Linefeed only + PCRE2_NEWLINE_CRLF CR followed by LF only + PCRE2_NEWLINE_ANYCRLF Any of the above + PCRE2_NEWLINE_ANY Any Unicode newline sequence +.sp +The result is zero for success or PCRE2_ERROR_BADDATA if the second argument is +invalid. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_parens_nest_limit.3 b/doc/pcre2_set_parens_nest_limit.3 new file mode 100644 index 0000000..0367619 --- /dev/null +++ b/doc/pcre2_set_parens_nest_limit.3 @@ -0,0 +1,28 @@ +.TH PCRE2_SET_PARENS_NEST_LIMIT 3 "22 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_parens_nest_limit(pcre2_compile_context *\fIccontext\fP, +.B " uint32_t \fIvalue\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets, in a compile context, the maximum depth of nested +parentheses in a pattern. The result is always zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_recursion_limit.3 b/doc/pcre2_set_recursion_limit.3 new file mode 100644 index 0000000..ab1f3cd --- /dev/null +++ b/doc/pcre2_set_recursion_limit.3 @@ -0,0 +1,28 @@ +.TH PCRE2_SET_RECURSION_LIMIT 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_recursion_limit(pcre2_match_context *\fImcontext\fP, +.B " uint32_t \fIvalue\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets the recursion limit field in a match context. The result is +always zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2_set_recursion_memory_management.3 b/doc/pcre2_set_recursion_memory_management.3 new file mode 100644 index 0000000..9b5887a --- /dev/null +++ b/doc/pcre2_set_recursion_memory_management.3 @@ -0,0 +1,35 @@ +.TH PCRE2_SET_RECURSION_MEMORY_MANAGEMENT 3 "24 October 2014" "PCRE2 10.00" +.SH NAME +PCRE2 - Perl-compatible regular expressions (revised API) +.SH SYNOPSIS +.rs +.sp +.B #include +.PP +.nf +.B int pcre2_set_recursion_memory_management( +.B " pcre2_match_context *\fImcontext\fP," +.B " void *(*\fIprivate_malloc\fP)(PCRE2_SIZE, void *)," +.B " void (*\fIprivate_free\fP)(void *, void *), void *\fImemory_data\fP);" +.fi +. +.SH DESCRIPTION +.rs +.sp +This function sets the match context fields for custom memory management when +PCRE2 is compiled to use the heap instead of the system stack for recursive +function calls while matching. When PCRE2 is compiled to use the stack (the +default) this function does nothing. The first argument is a match context, the +second and third specify the memory allocation and freeing functions, and the +final argument is an opaque value that is passed to them whenever they are +called. The result of this function is always zero. +.P +There is a complete description of the PCRE2 native API in the +.\" HREF +\fBpcre2api\fP +.\" +page and a description of the POSIX API in the +.\" HREF +\fBpcre2posix\fP +.\" +page. diff --git a/doc/pcre2api.3 b/doc/pcre2api.3 index d79ea6d..136e6de 100644 --- a/doc/pcre2api.3 +++ b/doc/pcre2api.3 @@ -2072,7 +2072,7 @@ match or a partial match, as well as after a successful one. The offset of the character at which the successful match started is returned by \fBpcre2_get_startchar()\fP. This can be different to the value of \fIovector[0]\fP if the pattern contains the \eK escape sequence. Note, -however, the \eK has no effect for a partial match. +however, that \eK has no effect for a partial match. . . .\" HTML diff --git a/perltest.pl b/perltest.sh similarity index 62% rename from perltest.pl rename to perltest.sh index 964fc95..e45486a 100755 --- a/perltest.pl +++ b/perltest.sh @@ -1,20 +1,61 @@ -#! /usr/bin/env perl +#! /bin/sh -# Program for testing regular expressions with perl to check that PCRE2 handles -# them the same. This version needs to have "use utf8" at the start for running -# the UTF-8 tests, but *not* for the other tests. The only way I've found for -# doing this is to cat this line in explicitly in the RunPerlTest script. I've -# also used this method to supply "require Encode" for the UTF-8 tests, so that -# the main test will still run where Encode is not installed. +# Script for testing regular expressions with perl to check that PCRE2 handles +# them the same. The Perl code has to have "use utf8" and "require Encode" at +# the start when running UTF-8 tests, but *not* for non-utf8 tests. (The +# "require" would actually be OK for non-utf8-tests, but is not always +# installed, so this way the script will always run for these tests.) +# +# The desired effect is achieved by making this a shell script that passes the +# Perl script to Perl through a pipe. If the first argument is "-utf8", a +# suitable prefix is set up. +# +# The remaining arguments, if any, are passed to Perl. They are an input file +# and an output file. If there is one argument, the output is written to +# STDOUT. If Perl receives no arguments, it opens /dev/tty as input, and writes +# output to STDOUT. (I haven't found a way of getting it to use STDIN, because +# of the contorted piping input.) -#use utf8; -#require Encode; +perl=perl +prefix='' +if [ $# > 0 -a "$1" = "-utf8" ] ; then + prefix="use utf8; require Encode;" + shift +fi + + +# The Perl script that follows has a similar specification to pcre2test, and so +# can be given identical input, except that input patterns can be followed only +# by Perl's lower case modifiers and certain other pcre2test modifiers that are +# either handled or ignored: +# +# aftertext interpreted as "print $' afterwards" +# afteralltext ignored +# dupnames ignored (Perl always allows) +# mark ignored +# no_auto_possess ignored +# no_start_optimize ignored +# ucp sets Perl's /u modifier +# utf invoke UTF-8 functionality +# +# The data lines must not have any pcre2test modifiers. They are processed as +# Perl double-quoted strings, so if they contain " $ or @ characters, these +# have to be escaped. For this reason, all such characters in the +# Perl-compatible testinput1 and testinput4 files are escaped so that they can +# be used for perltest as well as for pcre2test. The output from this script +# should be same as from pcre2test, apart from the initial identifying banner. +# +# The other testinput files are not suitable for feeding to perltest.sh, +# because they make use of the special modifiers that pcre2test uses for +# testing features of PCRE2. Some of these files also contain malformed regular +# expressions, in order to check that PCRE2 diagnoses them correctly. + +(echo "$prefix" ; cat <<'PERLEND' # Function for turning a string into a string of printing chars. sub pchars { my($t) = ""; - if ($utf8) { @p = unpack('U*', $_[0]); @@ -33,14 +74,13 @@ else else { $t .= sprintf("\\x%02x", ord $c); } } } - $t; } -# Read lines from named file or stdin and write to named file or stdout; lines -# consist of a regular expression, in delimiters and optionally followed by -# options, followed by a set of test data, terminated by an empty line. +# Read lines from a named file or stdin and write to a named file or stdout; +# lines consist of a regular expression, in delimiters and optionally followed +# by options, followed by a set of test data, terminated by an empty line. # Sort out the input and output files @@ -48,8 +88,14 @@ if (@ARGV > 0) { open(INFILE, "<$ARGV[0]") || die "Failed to open $ARGV[0]\n"; $infile = "INFILE"; + $interact = 0; + } +else + { + open(INFILE, " 1) { @@ -65,18 +111,18 @@ printf($outfile "Perl $] Regular Expressions\n\n"); NEXT_RE: for (;;) { - printf " re> " if $infile eq "STDIN"; + printf " re> " if $interact; last if ! ($_ = <$infile>); - printf $outfile "$_" if $infile ne "STDIN"; + printf $outfile "$_" if ! $interact; next if ($_ =~ /^\s*$/ || $_ =~ /^#/); $pattern = $_; while ($pattern !~ /^\s*(.).*\1/s) { - printf " > " if $infile eq "STDIN"; + printf " > " if $interact; last if ! ($_ = <$infile>); - printf $outfile "$_" if $infile ne "STDIN"; + printf $outfile "$_" if ! $interact; $pattern .= $_; } @@ -126,7 +172,7 @@ for (;;) if ($@) { printf $outfile "Error: $@"; - if ($infile != "STDIN") + if (! $interact) { for (;;) { @@ -155,10 +201,10 @@ for (;;) for (;;) { - printf "data> " if $infile eq "STDIN"; + printf "data> " if $interact; last NEXT_RE if ! ($_ = <$infile>); chomp; - printf $outfile "$_\n" if $infile ne "STDIN"; + printf $outfile "$_\n" if ! $interact; s/\s+$//; # Remove trailing space s/^\s+//; # Remove leading space @@ -243,4 +289,7 @@ for (;;) # printf $outfile "\n"; +PERLEND +) | $perl - $@ + # End diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c index 0614ad1..a11f853 100644 --- a/src/pcre2_jit_misc.c +++ b/src/pcre2_jit_misc.c @@ -124,6 +124,7 @@ startsize = (startsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1); maxsize = (maxsize + STACK_GROWTH_RATE - 1) & ~(STACK_GROWTH_RATE - 1); jit_stack = PRIV(memctl_malloc)(sizeof(pcre2_real_jit_stack), (pcre2_memctl *)gcontext); +if (jit_stack == NULL) return NULL; jit_stack->stack = sljit_allocate_stack(startsize, maxsize, &jit_stack->memctl); return jit_stack; diff --git a/src/pcre2_match_data.c b/src/pcre2_match_data.c index 4ed78fb..473142e 100644 --- a/src/pcre2_match_data.c +++ b/src/pcre2_match_data.c @@ -61,6 +61,7 @@ if (oveccount < 1) oveccount = 1; yield = PRIV(memctl_malloc)( sizeof(pcre2_match_data) + 3*oveccount*sizeof(PCRE2_SIZE), (pcre2_memctl *)gcontext); +if (yield == NULL) return NULL; yield->oveccount = oveccount; return yield; }