1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
3 <!-- Created on September, 1 2014 by texi2html 1.78a -->
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
6 Karl Berry <karl@freefriends.org>
7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
14 <title>GNU libunistring: 2. Conventions</title>
16 <meta name="description" content="GNU libunistring: 2. Conventions">
17 <meta name="keywords" content="GNU libunistring: 2. Conventions">
18 <meta name="resource-type" content="document">
19 <meta name="distribution" content="global">
20 <meta name="Generator" content="texi2html 1.78a">
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
22 <style type="text/css">
24 a.summary-letter {text-decoration: none}
25 pre.display {font-family: serif}
26 pre.format {font-family: serif}
27 pre.menu-comment {font-family: serif}
28 pre.menu-preformatted {font-family: serif}
29 pre.smalldisplay {font-family: serif; font-size: smaller}
30 pre.smallexample {font-size: smaller}
31 pre.smallformat {font-family: serif; font-size: smaller}
32 pre.smalllisp {font-size: smaller}
33 span.roman {font-family:serif; font-weight:normal;}
34 span.sansserif {font-family:sans-serif; font-weight:normal;}
35 ul.toc {list-style: none}
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
44 <table cellpadding="1" cellspacing="1" border="0">
45 <tr><td valign="middle" align="left">[<a href="libunistring_1.html#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td>
46 <td valign="middle" align="left">[<a href="libunistring_3.html#SEC10" title="Next chapter"> >> </a>]</td>
47 <td valign="middle" align="left"> </td>
48 <td valign="middle" align="left"> </td>
49 <td valign="middle" align="left"> </td>
50 <td valign="middle" align="left"> </td>
51 <td valign="middle" align="left"> </td>
52 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
53 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
54 <td valign="middle" align="left">[<a href="libunistring_19.html#SEC77" title="Index">Index</a>]</td>
55 <td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
59 <a name="Conventions"></a>
61 <h1 class="chapter"> <a href="libunistring.html#TOC9">2. Conventions</a> </h1>
63 <p>This chapter explains conventions valid throughout the libunistring library.
66 <p>Variables of type <code>char *</code> denote C strings in locale encoding.
67 See <a href="libunistring_1.html#SEC4">Locale encodings</a>.
69 <p>Variables of type <code>uint8_t *</code> denote UTF-8 strings. Their units
72 <p>Variables of type <code>uint16_t *</code> denote UTF-16 strings, without byte
73 order mark. Their units are 2-byte words.
75 <p>Variables of type <code>uint32_t *</code> denote UTF-32 strings, without byte
76 order mark. Their units are 4-byte words.
78 <p>Argument pairs <code>(<var>s</var>, <var>n</var>)</code> denote a string
79 <code><var>s</var>[0..<var>n</var>-1]</code> with exactly <var>n</var> units.
81 <p>All functions with prefix ‘<samp>ulc_</samp>’ operate on C strings in locale
84 <p>All functions with prefix ‘<samp>u8_</samp>’ operate on UTF-8 strings.
86 <p>All functions with prefix ‘<samp>u16_</samp>’ operate on UTF-16 strings.
88 <p>All functions with prefix ‘<samp>u32_</samp>’ operate on UTF-32 strings.
90 <p>For every function with prefix ‘<samp>u8_</samp>’, operating on UTF-8 strings,
91 there is also a corresponding function with prefix ‘<samp>u16_</samp>’,
92 operating on UTF-16 strings, and a corresponding function with prefix
93 ‘<samp>u32_</samp>’, operating on UTF-32 strings. Their description is
94 analogous; in this documentation we describe only the function that
95 operates on UTF-8 strings, for brevity.
97 <p>A declaration with a variable <var>n</var> denotes the three concrete
98 declarations with <var>n</var> = 8, <var>n</var> = 16, <var>n</var> = 32.
100 <p>All parameters starting with ‘<samp>str</samp>’ and the parameters of
101 functions starting with <code>u8_str</code>/<code>u16_str</code>/<code>u32_str</code>
102 denote a NUL terminated string.
105 <p>Error values are always returned through the <code>errno</code> variable,
106 usually with a return value that indicates the presence of an error
107 (NULL for functions that return an pointer, or -1 for functions that
108 return an <code>int</code>).
110 <p>Functions returning a string result take a
111 <code>(<var>resultbuf</var>, <var>lengthp</var>)</code>
112 argument pair. If <var>resultbuf</var> is not NULL and the result fits
113 into <code>*<var>lengthp</var></code> units, it is put in <var>resultbuf</var>, and
114 <var>resultbuf</var> is returned. Otherwise, a freshly allocated string
115 is returned. In both cases, <code>*<var>lengthp</var></code> is set to the
116 length (number of units) of the returned string. In case of error,
117 NULL is returned and <code>errno</code> is set.
120 <table cellpadding="1" cellspacing="1" border="0">
121 <tr><td valign="middle" align="left">[<a href="libunistring_1.html#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td>
122 <td valign="middle" align="left">[<a href="libunistring_3.html#SEC10" title="Next chapter"> >> </a>]</td>
123 <td valign="middle" align="left"> </td>
124 <td valign="middle" align="left"> </td>
125 <td valign="middle" align="left"> </td>
126 <td valign="middle" align="left"> </td>
127 <td valign="middle" align="left"> </td>
128 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Top" title="Cover (top) of document">Top</a>]</td>
129 <td valign="middle" align="left">[<a href="libunistring.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
130 <td valign="middle" align="left">[<a href="libunistring_19.html#SEC77" title="Index">Index</a>]</td>
131 <td valign="middle" align="left">[<a href="libunistring_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
135 This document was generated by <em>Daiki Ueno</em> on <em>September, 1 2014</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>.