1PCRE2_SERIALIZE_ENCODE(3)  Library Functions Manual  PCRE2_SERIALIZE_ENCODE(3)
2
3
4

NAME

6       PCRE2 - Perl-compatible regular expressions (revised API)
7

SYNOPSIS

9
10       #include <pcre2.h>
11
12       int32_t pcre2_serialize_encode(const pcre2_code **codes,
13         int32_t number_of_codes, uint8_t **serialized_bytes,
14         PCRE2_SIZE *serialized_size, pcre2_general_context *gcontext);
15

DESCRIPTION

17
18       This  function  encodes  a list of compiled patterns into a byte stream
19       that can be saved on disc or  elsewhere.  Note  that  this  is  not  an
20       abstract  format  like Java or .NET. Conversion of the byte stream back
21       into usable compiled patterns can only happen on a host that is running
22       the  same version of PCRE2, with the same code unit width, and the host
23       must also have the same endianness, pointer width and PCRE2_SIZE  type.
24       The arguments for pcre2_serialize_encode() are:
25
26         codes             pointer to a vector containing the list
27         number_of_codes   number of slots in the vector
28         serialized_bytes  set to point to the serialized byte stream
29         serialized_size   set to the number of bytes in the byte stream
30         gcontext          pointer to a general context or NULL
31
32       The context argument is used to obtain memory for the byte stream. When
33       the serialized data is no longer needed, it must be  freed  by  calling
34       pcre2_serialize_free().  The  yield  of  the  function is the number of
35       serialized patterns, or one of the following negative error codes:
36
37         PCRE2_ERROR_BADDATA      number_of_codes is zero or less
38         PCRE2_ERROR_BADMAGIC     mismatch of id bytes in one of the patterns
39         PCRE2_ERROR_MEMORY       memory allocation failed
40         PCRE2_ERROR_MIXEDTABLES  the patterns do not all use the same tables
41         PCRE2_ERROR_NULL         an argument other than gcontext is NULL
42
43       PCRE2_ERROR_BADMAGIC means either that a pattern's code has  been  cor‐
44       rupted,  or that a slot in the vector does not point to a compiled pat‐
45       tern.
46
47       There is a complete description of the PCRE2 native API in the pcre2api
48       page and a description of the serialization functions in the pcre2seri‐
49       alize page.
50
51
52
53PCRE2 10.32                      27 June 2018        PCRE2_SERIALIZE_ENCODE(3)
Impressum