1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\" About this Japanese page, please contact to JM Project <JM@linux.or.jp>
15 .\" Translated Sat Oct 23 15:38:11 JST 1999
16 .\" by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
18 .TH WCSRTOMBS 3 2011-09-28 "GNU" "Linux Programmer's Manual"
21 .\"O wcsrtombs \- convert a wide-character string to a multibyte string
22 wcsrtombs \- ワイド文字文字列をマルチバイト文字列に変換する
28 .BI "size_t wcsrtombs(char *" dest ", const wchar_t **" src ,
29 .BI " size_t " len ", mbstate_t *" ps );
33 .\"O If \fIdest\fP is not a NULL pointer,
36 .\"O function converts
37 .\"O the wide-character string \fI*src\fP to a multibyte string starting at
39 .\"O At most \fIlen\fP bytes are written to \fIdest\fP.
41 .\"O \fI*ps\fP is updated.
42 .\"O The conversion is effectively performed by repeatedly
44 .\"O .IR "wcrtomb(dest, *src, ps)" ,
45 .\"O as long as this call succeeds,
46 .\"O and then incrementing \fIdest\fP by the
47 .\"O number of bytes written and \fI*src\fP
49 .\"O The conversion can stop for three reasons:
50 \fIdest\fP が NULL ポインタでなければ、
53 ワイド文字文字列 \fI*src\fP を \fIdest\fP が指すマルチバイト文字列
54 に変換する。最大 \fIlen\fP バイトまでが \fIdest\fP に書き込まれる。
55 シフト状態 \fI*ps\fP は更新される。実際の効果としては、この変換は以下
57 .IR "wcrtomb(dest, *src, ps)"
59 \fIdest\fP を書き込んだバイト数だけ増やし、\fI*src\fP を 1 増やす。
60 そして、wcrtomb が成功を返す限りこれを繰り返す。
63 .\"O 1. A wide character has been encountered that can not be represented as a
64 .\"O multibyte sequence (according to the current locale).
65 .\"O In this case \fI*src\fP
66 .\"O is left pointing to the invalid wide character,
71 .\"O is set to \fBEILSEQ\fP.
72 (現在のロケールに基づいて)マルチバイト列で表現できないワイド文字に
73 出会った場合。この場合は、\fI*src\fP は不正なワイド文字を指した状態になり、
77 に \fBEILSEQ\fP が設定される。
79 .\"O 2. The length limit forces a stop.
80 .\"O In this case \fI*src\fP is left pointing
81 .\"O to the next wide character to be converted,
82 .\"O and the number of bytes written to
83 .\"O \fIdest\fP is returned.
84 2. 長さの制限により変換が止められた場合。この場合には、\fI*src\fP は次に
85 変換されるべきワイド文字列を指した状態になり、\fIdest\fP に書き込まれ
88 .\"O 3. The wide-character string has been completely converted, including the
89 .\"O terminating null wide character (L\(aq\\0\(aq),
90 .\"O which has the side effect of bringing back \fI*ps\fP
91 .\"O to the initial state.
92 .\"O In this case \fI*src\fP is set to NULL, and the number
93 .\"O of bytes written to \fIdest\fP, excluding the terminating null, is returned.
94 3. ワイド文字列が終端の NULL ワイド文字 (L\(aq\\0\(aq) も含めて全て
95 変換された場合。この際、\fI*ps\fP が初期状態に戻るという副作用がある。
96 この場合には \fI*src\fP に NULL が設定され、\fIdest\fP に書き込まれた
97 バイト数が返される (終端の NULL は数えない)。
99 .\"O If \fIdest\fP is NULL, \fIlen\fP is ignored,
100 .\"O and the conversion proceeds as above, except that the converted bytes
101 .\"O are not written out to memory, and that
102 .\"O no length limit exists.
103 \fIdest\fP が NULL ならば \fIlen\fP は無視されて前述のように変換が行わ
104 れるが、変換されたバイトデータはメモリに書き出されない点と、出力先の長
107 .\"O In both of the above cases,
108 .\"O if \fIps\fP is a NULL pointer, a static anonymous
109 .\"O state only known to the wcsrtombs function is used instead.
110 上記のいずれの場合も、\fIps\fP が NULL ポインタならば、wcsnrtombs 関数
111 だけが知っている静的な匿名の状態がシフト状態の代わりに用いられる。
113 .\"O The programmer must ensure that there is room for at least \fIlen\fP bytes
115 プログラマは少なくとも \fIlen\fP バイトの領域を \fIdest\fP に確保しな
117 .\"O .SH "RETURN VALUE"
120 .\"O .BR wcsrtombs ()
121 .\"O function returns
122 .\"O the number of bytes that make up the
123 .\"O converted part of multibyte sequence,
124 .\"O not including the terminating null byte.
126 は、変換して得られたマルチバイト列のバイト数を返す。
127 これには終端の null バイトは含まれない。
128 .\"O If a wide character was encountered
129 .\"O which could not be converted,
130 .\"O .I (size_t)\ \-1
131 .\"O is returned, and
133 .\"O set to \fBEILSEQ\fP.
138 に \fBEILSEQ\fP が設定される。
139 .\"O .SH "CONFORMING TO"
144 .\"O .BR wcsrtombs ()
154 .\"O Passing NULL as \fIps\fP is not multithread safe.
155 \fIps\fP に NULL を渡した際の動作はマルチスレッドセーフでない。