1 .TH PCRE2_SERIALIZE_ENCODE 3 "27 June 2018" "PCRE2 10.32"
3 PCRE2 - Perl-compatible regular expressions (revised API)
10 .B int32_t pcre2_serialize_encode(const pcre2_code **\fIcodes\fP,
11 .B " int32_t \fInumber_of_codes\fP, uint8_t **\fIserialized_bytes\fP,"
12 .B " PCRE2_SIZE *\fIserialized_size\fP, pcre2_general_context *\fIgcontext\fP);"
18 This function encodes a list of compiled patterns into a byte stream that can
19 be saved on disc or elsewhere. Note that this is not an abstract format like
20 Java or .NET. Conversion of the byte stream back into usable compiled patterns
21 can only happen on a host that is running the same version of PCRE2, with the
22 same code unit width, and the host must also have the same endianness, pointer
23 width and PCRE2_SIZE type. The arguments for \fBpcre2_serialize_encode()\fP
26 \fIcodes\fP pointer to a vector containing the list
27 \fInumber_of_codes\fP number of slots in the vector
28 \fIserialized_bytes\fP set to point to the serialized byte stream
29 \fIserialized_size\fP set to the number of bytes in the byte stream
30 \fIgcontext\fP pointer to a general context or NULL
32 The context argument is used to obtain memory for the byte stream. When the
33 serialized data is no longer needed, it must be freed by calling
34 \fBpcre2_serialize_free()\fP. The yield of the function is the number of
35 serialized patterns, or one of the following negative error codes:
37 PCRE2_ERROR_BADDATA \fInumber_of_codes\fP 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 \fIgcontext\fP is NULL
43 PCRE2_ERROR_BADMAGIC means either that a pattern's code has been corrupted, or
44 that a slot in the vector does not point to a compiled pattern.
46 There is a complete description of the PCRE2 native API in the
50 page and a description of the serialization functions in the