1<html> 2<head> 3<title>pcre2_serialize_encode specification</title> 4</head> 5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB"> 6<h1>pcre2_serialize_encode man page</h1> 7<p> 8Return to the <a href="index.html">PCRE2 index page</a>. 9</p> 10<p> 11This page is part of the PCRE2 HTML documentation. It was generated 12automatically from the original man page. If there is any nonsense in it, 13please consult the man page, in case the conversion went wrong. 14<br> 15<br><b> 16SYNOPSIS 17</b><br> 18<P> 19<b>#include <pcre2.h></b> 20</P> 21<P> 22<b>int32_t pcre2_serialize_encode(const pcre2_code **<i>codes</i>,</b> 23<b> int32_t <i>number_of_codes</i>, uint8_t **<i>serialized_bytes</i>,</b> 24<b> PCRE2_SIZE *<i>serialized_size</i>, pcre2_general_context *<i>gcontext</i>);</b> 25</P> 26<br><b> 27DESCRIPTION 28</b><br> 29<P> 30This function encodes a list of compiled patterns into a byte stream that can 31be saved on disc or elsewhere. Note that this is not an abstract format like 32Java or .NET. Conversion of the byte stream back into usable compiled patterns 33can only happen on a host that is running the same version of PCRE2, with the 34same code unit width, and the host must also have the same endianness, pointer 35width and PCRE2_SIZE type. The arguments for <b>pcre2_serialize_encode()</b> 36are: 37<pre> 38 <i>codes</i> pointer to a vector containing the list 39 <i>number_of_codes</i> number of slots in the vector 40 <i>serialized_bytes</i> set to point to the serialized byte stream 41 <i>serialized_size</i> set to the number of bytes in the byte stream 42 <i>gcontext</i> pointer to a general context or NULL 43</pre> 44The context argument is used to obtain memory for the byte stream. When the 45serialized data is no longer needed, it must be freed by calling 46<b>pcre2_serialize_free()</b>. The yield of the function is the number of 47serialized patterns, or one of the following negative error codes: 48<pre> 49 PCRE2_ERROR_BADDATA <i>number_of_codes</i> is zero or less 50 PCRE2_ERROR_BADMAGIC mismatch of id bytes in one of the patterns 51 PCRE2_ERROR_MEMORY memory allocation failed 52 PCRE2_ERROR_MIXEDTABLES the patterns do not all use the same tables 53 PCRE2_ERROR_NULL an argument other than <i>gcontext</i> is NULL 54</pre> 55PCRE2_ERROR_BADMAGIC means either that a pattern's code has been corrupted, or 56that a slot in the vector does not point to a compiled pattern. 57</P> 58<P> 59There is a complete description of the PCRE2 native API in the 60<a href="pcre2api.html"><b>pcre2api</b></a> 61page and a description of the serialization functions in the 62<a href="pcre2serialize.html"><b>pcre2serialize</b></a> 63page. 64<p> 65Return to the <a href="index.html">PCRE2 index page</a>. 66</p> 67