Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 1 | .TH PCRE2_COMPILE 3 "23 March 2017" "PCRE2 10.30" |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 2 | .SH NAME |
| 3 | PCRE2 - 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 |
| 18 | This function scans a compiled regular expression and calls the \fIcallback()\fP |
| 19 | function for each callout within the pattern. The yield of the function is zero |
| 20 | for 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 |
| 26 | The \fIcallback()\fP function is passed a pointer to a data block containing |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 27 | the following fields (not necessarily in this order): |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 28 | .sp |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 29 | 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 Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 36 | .sp |
Elliott Hughes | 9bc971b | 2018-07-27 13:23:14 -0700 | [diff] [blame] | 37 | The second argument passed to the \fBcallback()\fP function is the callout data |
| 38 | that was passed to \fBpcre2_callout_enumerate()\fP. The \fBcallback()\fP |
| 39 | function must return zero for success. Any other value causes the pattern scan |
| 40 | to stop, with the value being passed back as the result of |
| 41 | \fBpcre2_callout_enumerate()\fP. |
Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 42 | .P |
| 43 | There is a complete description of the PCRE2 native API in the |
| 44 | .\" HREF |
| 45 | \fBpcre2api\fP |
| 46 | .\" |
| 47 | page and a description of the POSIX API in the |
| 48 | .\" HREF |
| 49 | \fBpcre2posix\fP |
| 50 | .\" |
| 51 | page. |