xref: /aosp_15_r20/external/pcre/doc/html/pcre2_serialize_decode.html (revision 22dc650d8ae982c6770746019a6f94af92b0f024)
1*22dc650dSSadaf Ebrahimi<html>
2*22dc650dSSadaf Ebrahimi<head>
3*22dc650dSSadaf Ebrahimi<title>pcre2_serialize_decode 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_decode 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 &#60;pcre2.h&#62;</b>
20*22dc650dSSadaf Ebrahimi</P>
21*22dc650dSSadaf Ebrahimi<P>
22*22dc650dSSadaf Ebrahimi<b>int32_t pcre2_serialize_decode(pcre2_code **<i>codes</i>,</b>
23*22dc650dSSadaf Ebrahimi<b>  int32_t <i>number_of_codes</i>, const uint8_t *<i>bytes</i>,</b>
24*22dc650dSSadaf Ebrahimi<b>  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 decodes a serialized set of compiled patterns back into a list of
31*22dc650dSSadaf Ebrahimiindividual patterns. This is possible only on a host that is running the same
32*22dc650dSSadaf Ebrahimiversion of PCRE2, with the same code unit width, and the host must also have
33*22dc650dSSadaf Ebrahimithe same endianness, pointer width and PCRE2_SIZE type. The arguments for
34*22dc650dSSadaf Ebrahimi<b>pcre2_serialize_decode()</b> are:
35*22dc650dSSadaf Ebrahimi<pre>
36*22dc650dSSadaf Ebrahimi  <i>codes</i>            pointer to a vector in which to build the list
37*22dc650dSSadaf Ebrahimi  <i>number_of_codes</i>  number of slots in the vector
38*22dc650dSSadaf Ebrahimi  <i>bytes</i>            the serialized byte stream
39*22dc650dSSadaf Ebrahimi  <i>gcontext</i>         pointer to a general context or NULL
40*22dc650dSSadaf Ebrahimi</pre>
41*22dc650dSSadaf EbrahimiThe <i>bytes</i> argument must point to a block of data that was originally
42*22dc650dSSadaf Ebrahimicreated by <b>pcre2_serialize_encode()</b>, though it may have been saved on
43*22dc650dSSadaf Ebrahimidisc or elsewhere in the meantime. If there are more codes in the serialized
44*22dc650dSSadaf Ebrahimidata than slots in the list, only those compiled patterns that will fit are
45*22dc650dSSadaf Ebrahimidecoded. The yield of the function is the number of decoded patterns, or one of
46*22dc650dSSadaf Ebrahimithe following negative error codes:
47*22dc650dSSadaf Ebrahimi<pre>
48*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_BADDATA   <i>number_of_codes</i> is zero or less
49*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_BADMAGIC  mismatch of id bytes in <i>bytes</i>
50*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_BADMODE   mismatch of variable unit size or PCRE version
51*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_NOMEMORY  memory allocation failed
52*22dc650dSSadaf Ebrahimi  PCRE2_ERROR_NULL      <i>codes</i> or <i>bytes</i> is NULL
53*22dc650dSSadaf Ebrahimi</pre>
54*22dc650dSSadaf EbrahimiPCRE2_ERROR_BADMAGIC may mean that the data is corrupt, or that it was compiled
55*22dc650dSSadaf Ebrahimion a system with different endianness.
56*22dc650dSSadaf Ebrahimi</P>
57*22dc650dSSadaf Ebrahimi<P>
58*22dc650dSSadaf EbrahimiThere is a complete description of the PCRE2 native API in the
59*22dc650dSSadaf Ebrahimi<a href="pcre2api.html"><b>pcre2api</b></a>
60*22dc650dSSadaf Ebrahimipage and a description of the serialization functions in the
61*22dc650dSSadaf Ebrahimi<a href="pcre2serialize.html"><b>pcre2serialize</b></a>
62*22dc650dSSadaf Ebrahimipage.
63*22dc650dSSadaf Ebrahimi<p>
64*22dc650dSSadaf EbrahimiReturn to the <a href="index.html">PCRE2 index page</a>.
65*22dc650dSSadaf Ebrahimi</p>
66