blob: 109c9bec0bdd7e9c8c209343cac37a82dd9573d3 [file] [log] [blame]
Elliott Hughes9bc971b2018-07-27 13:23:14 -07001.TH PCRE2_COMPILE 3 "23 March 2017" "PCRE2 10.30"
Janis Danisevskis112c9cc2016-03-31 13:35:25 +01002.SH NAME
3PCRE2 - Perl-compatible regular expressions (revised API)
4.SH SYNOPSIS
5.rs
6.sp
7.B #include <pcre2.h>
8.PP
9.nf
10.B int pcre2_callout_enumerate(const pcre2_code *\fIcode\fP,
11.B " int (*\fIcallback\fP)(pcre2_callout_enumerate_block *, void *),"
12.B " void *\fIcallout_data\fP);"
13.fi
14.
15.SH DESCRIPTION
16.rs
17.sp
18This function scans a compiled regular expression and calls the \fIcallback()\fP
19function for each callout within the pattern. The yield of the function is zero
20for success and non-zero otherwise. The arguments are:
21.sp
22 \fIcode\fP Points to the compiled pattern
23 \fIcallback\fP The callback function
24 \fIcallout_data\fP User data that is passed to the callback
25.sp
26The \fIcallback()\fP function is passed a pointer to a data block containing
Elliott Hughes9bc971b2018-07-27 13:23:14 -070027the following fields (not necessarily in this order):
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010028.sp
Elliott Hughes9bc971b2018-07-27 13:23:14 -070029 uint32_t \fIversion\fP Block version number
30 uint32_t \fIcallout_number\fP Number for numbered callouts
31 PCRE2_SIZE \fIpattern_position\fP Offset to next item in pattern
32 PCRE2_SIZE \fInext_item_length\fP Length of next item in pattern
33 PCRE2_SIZE \fIcallout_string_offset\fP Offset to string within pattern
34 PCRE2_SIZE \fIcallout_string_length\fP Length of callout string
35 PCRE2_SPTR \fIcallout_string\fP Points to callout string or is NULL
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010036.sp
Elliott Hughes9bc971b2018-07-27 13:23:14 -070037The second argument passed to the \fBcallback()\fP function is the callout data
38that was passed to \fBpcre2_callout_enumerate()\fP. The \fBcallback()\fP
39function must return zero for success. Any other value causes the pattern scan
40to stop, with the value being passed back as the result of
41\fBpcre2_callout_enumerate()\fP.
Janis Danisevskis112c9cc2016-03-31 13:35:25 +010042.P
43There is a complete description of the PCRE2 native API in the
44.\" HREF
45\fBpcre2api\fP
46.\"
47page and a description of the POSIX API in the
48.\" HREF
49\fBpcre2posix\fP
50.\"
51page.