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