summaryrefslogtreecommitdiff
path: root/devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
committerCraig Jennings <c@cjennings.net>2025-08-14 22:58:58 -0500
commit82ba818ff456bcd6d56a06226e3f27e98fbb55c3 (patch)
tree158cfc17b2f644a10f063cb546752cfaae12c97f /devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html
parent9278ddd4ea1a8b1a4c1edaa8894516e3f48d245b (diff)
downloaddotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.tar.gz
dotemacs-82ba818ff456bcd6d56a06226e3f27e98fbb55c3.zip
removing all downloaded devdocs files
Diffstat (limited to 'devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html')
-rw-r--r--devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html77
1 files changed, 0 insertions, 77 deletions
diff --git a/devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html b/devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html
deleted file mode 100644
index f67e7de6..00000000
--- a/devdocs/c/string%2Fmultibyte%2Fmbrtoc32.html
+++ /dev/null
@@ -1,77 +0,0 @@
- <h1 id="firstHeading" class="firstHeading">mbrtoc32</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code>&lt;uchar.h&gt;</code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c11"> <td> <pre data-language="c">size_t mbrtoc32( char32_t restrict * pc32, const char * restrict s,
- size_t n, mbstate_t * restrict ps );</pre>
-</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c11">(since C11)</span> </td> </tr> </table> <p>Converts a single code point from its narrow multibyte character representation to its variable-length 32-bit wide character representation (but typically, UTF-32).</p>
-<p>If <code>s</code> is not a null pointer, inspects at most <code>n</code> bytes of the multibyte character string, beginning with the byte pointed to by <code>s</code> to determine the number of bytes necessary to complete the next multibyte character (including any shift sequences, and taking into account the current multibyte conversion state <code>*ps</code>). If the function determines that the next multibyte character in <code>s</code> is complete and valid, converts it to the corresponding 32-bit wide character and stores it in <code>*pc32</code> (if <code>pc32</code> is not null).</p>
-<p>If the multibyte character in <code>*s</code> corresponds to a multi-char32_t sequence (not possible with UTF-32), then after the first call to this function, <code>*ps</code> is updated in such a way that the next calls to <code>mbrtoc32</code> will write out the additional char32_t, without considering <code>*s</code>.</p>
-<p>If <code>s</code> is a null pointer, the values of <code>n</code> and <code>pc32</code> are ignored and the call is equivalent to <code>mbrtoc32<span class="br0">(</span><a href="http://en.cppreference.com/w/c/types/NULL"><span class="kw103">NULL</span></a>, <span class="st0">""</span>, <span class="nu0">1</span>, ps<span class="br0">)</span></code>.</p>
-<p>If the wide character produced is the null character, the conversion state <code>*ps</code> represents the initial shift state.</p>
-<p>If the macro <code>__STDC_UTF_32__</code> is defined, the 32-bit encoding used by this function is UTF-32; otherwise, it is implementation-defined. <span class="t-rev-inl t-since-c23"><span>The macro is always defined and the encoding is always UTF-32.</span><span><span class="t-mark-rev t-since-c23">(since C23)</span></span></span> In any case, the multibyte character encoding used by this function is specified by the currently active C locale.</p>
-<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> pc32 </td> <td> - </td> <td> pointer to the location where the resulting 32-bit wide character will be written </td>
-</tr> <tr class="t-par"> <td> s </td> <td> - </td> <td> pointer to the multibyte character string used as input </td>
-</tr> <tr class="t-par"> <td> n </td> <td> - </td> <td> limit on the number of bytes in s that can be examined </td>
-</tr> <tr class="t-par"> <td> ps </td> <td> - </td> <td> pointer to the conversion state object used when interpreting the multibyte string </td>
-</tr>
-</table> <h3 id="Return_value"> Return value</h3> <p>The first of the following that applies:</p>
-<ul>
-<li> <code>​0​</code> if the character converted from <code>s</code> (and stored in <code>*pc32</code> if non-null) was the null character </li>
-<li> the number of bytes <code>[1...n]</code> of the multibyte character successfully converted from <code>s</code> </li>
-<li> <code><span class="br0">(</span><a href="http://en.cppreference.com/w/c/types/size_t"><span class="kw100">size_t</span></a><span class="br0">)</span><span class="sy2">-</span><span class="nu0">3</span></code> if the next <code>char32_t</code> from a multi-<code>char32_t</code> character has now been written to <code>*pc32</code>. No bytes are processed from the input in this case. </li>
-<li> <code><span class="br0">(</span><a href="http://en.cppreference.com/w/c/types/size_t"><span class="kw100">size_t</span></a><span class="br0">)</span><span class="sy2">-</span><span class="nu0">2</span></code> if the next <code>n</code> bytes constitute an incomplete, but so far valid, multibyte character. Nothing is written to <code>*pc32</code>. </li>
-<li> <code><span class="br0">(</span><a href="http://en.cppreference.com/w/c/types/size_t"><span class="kw100">size_t</span></a><span class="br0">)</span><span class="sy2">-</span><span class="nu0">1</span></code> if encoding error occurs. Nothing is written to <code>*pc32</code>, the value <code><a href="../../error/errno_macros" title="c/error/errno macros">EILSEQ</a></code> is stored in <code><a href="../../error/errno" title="c/error/errno">errno</a></code> and the value of <code>*ps</code> is unspecified. </li>
-</ul> <h3 id="Example"> Example</h3> <div class="t-example"> <div class="c source-c"><pre data-language="c">#include &lt;stdio.h&gt;
-#include &lt;locale.h&gt;
-#include &lt;string.h&gt;
-#include &lt;uchar.h&gt;
-#include &lt;assert.h&gt;
-
-int main(void)
-{
- setlocale(LC_ALL, "en_US.utf8");
- char in[] = u8"zß水🍌"; // or "z\u00df\u6c34\U0001F34C"
- const size_t in_size = sizeof in / sizeof *in;
-
- printf("Processing %zu UTF-8 code units: [ ", in_size);
- for (size_t i = 0; i &lt; in_size; ++i)
- printf("0x%02x ", (unsigned char)in[i]);
-
- puts("]");
-
- char32_t out[in_size];
- char32_t *p_out = out;
- char *p_in = in, *end = in + in_size;
- mbstate_t state;
- memset(&amp;state, 0, sizeof(state));
- size_t rc;
- while ((rc = mbrtoc32(p_out, p_in, end - p_in, &amp;state)))
- {
- assert(rc != (size_t)-3); // no surrogate pairs in UTF-32
- if (rc == (size_t)-1) break; // invalid input
- if (rc == (size_t)-2) break; // truncated input
- p_in += rc;
- ++p_out;
- }
-
- size_t out_size = p_out+1 - out;
- printf("into %zu UTF-32 code units: [ ", out_size);
- for (size_t i = 0; i &lt; out_size; ++i)
- printf("0x%08X ", out[i]);
-
- puts("]");
-}</pre></div> <p>Output:</p>
-<div class="text source-text"><pre data-language="c">Processing 11 UTF-8 code units: [ 0x7a 0xc3 0x9f 0xe6 0xb0 0xb4 0xf0 0x9f 0x8d 0x8c 0x00 ]
-into 5 UTF-32 code units: [ 0x0000007A 0x000000DF 0x00006C34 0x0001F34C 0x00000000 ]</pre></div> </div> <h3 id="References"> References</h3> <ul>
-<li> C23 standard (ISO/IEC 9899:2023): </li>
-<ul><li> 7.30.1.5 The mbrtoc32 function (p: 410) </li></ul>
-<li> C17 standard (ISO/IEC 9899:2018): </li>
-<ul><li> 7.28.1.3 The mbrtoc32 function (p: 293-294) </li></ul>
-<li> C11 standard (ISO/IEC 9899:2011): </li>
-<ul><li> 7.28.1.3 The mbrtoc32 function (p: 400-401) </li></ul>
-</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="c32rtomb" title="c/string/multibyte/c32rtomb"> <span class="t-lines"><span>c32rtomb</span></span></a></div>
-<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> converts a 32-bit wide character to narrow multibyte string <br> <span class="t-mark">(function)</span> </td>
-</tr> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/string/multibyte/mbrtoc32" title="cpp/string/multibyte/mbrtoc32">C++ documentation</a></span> for <code>mbrtoc32</code> </td>
-</tr> </table> <div class="_attribution">
- <p class="_attribution-p">
- &copy; cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
- <a href="https://en.cppreference.com/w/c/string/multibyte/mbrtoc32" class="_attribution-link">https://en.cppreference.com/w/c/string/multibyte/mbrtoc32</a>
- </p>
-</div>