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 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
15 .\" all rights reserved.
16 .\" Translated Tue Jan 11 00:56:08 JST 2000
17 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
19 .TH MBSRTOWCS 3 2011-09-28 "GNU" "Linux Programmer's Manual"
22 .\"O mbsrtowcs \- convert a multibyte string to a wide-character string
23 mbsrtowcs \- マルチバイト文字列をワイド文字列に変換する
29 .BI "size_t mbsrtowcs(wchar_t *" dest ", const char **" src ,
30 .BI " size_t " len ", mbstate_t *" ps );
34 .\"O If \fIdest\fP is not a NULL pointer, the
36 .\"O function converts the
37 .\"O multibyte string \fI*src\fP to a wide-character string starting at \fIdest\fP.
38 .\"O At most \fIlen\fP wide characters are written to \fIdest\fP.
40 .\"O \fI*ps\fP is updated.
41 .\"O The conversion is effectively performed by repeatedly
43 .\"O .I "mbrtowc(dest, *src, n, ps)"
44 .\"O where \fIn\fP is some
45 .\"O positive number, as long as this call succeeds, and then incrementing
46 .\"O \fIdest\fP by one and \fI*src\fP by the number of bytes consumed.
47 .\"O The conversion can stop for three reasons:
48 \fIdest\fP が NULL ポインターでなければ、
51 マルチバイト文字列 \fI*src\fP を \fIdest\fP から始まるワイド文字列に
52 変換する。\fIdest\fP には最大で \fIlen\fP 文字のワイド文字が
53 書き込まれる。同時にシフト状態 \fI*ps\fP を更新する。
55 .I "mbrtowc(dest, *src, n, ps)"
56 を、この呼び出しが成功する限り繰り返し実行したのと実質的に同様である。
57 ここで \fIn\fP は正の数であり、繰り返しごとに \fIdest\fP が 1 増加させられ、
58 \fI*src\fP が消費したバイト数だけ増加させられる。変換は以下の三つの
61 .\"O An invalid multibyte sequence has been encountered.
62 .\"O In this case \fI*src\fP
63 .\"O is left pointing to the invalid multibyte sequence,
66 .\"O and \fIerrno\fP is set to \fBEILSEQ\fP.
67 不正なマルチバイト列に遭遇した。この場合には \fI*src\fP は不正な
70 を返し、\fIerrno\fP に \fBEILSEQ\fP を設定する。
72 .\"O \fIlen\fP non-L\(aq\\0\(aq wide characters have been stored at \fIdest\fP.
74 .\"O case \fI*src\fP is left pointing to the next
75 .\"O multibyte sequence to be converted,
76 .\"O and the number of wide characters written to \fIdest\fP is returned.
77 \fIlen\fP 文字の L\(aq\\0\(aq 以外のワイド文字を \fIdest\fP に格納した場合。
78 この場合は \fI*src\fP は次に変換されるマルチバイト列を指すようにして、
79 \fIdest\fP に書き込まれたワイド文字の数を返す。
81 .\"O The multibyte string has been completely converted, including the
82 .\"O terminating null wide character (\(aq\\0\(aq), which has the side
83 .\"O effect of bringing back \fI*ps\fP to the
85 .\"O In this case \fI*src\fP is set to NULL, and the number of wide
86 .\"O characters written to \fIdest\fP,
87 .\"O excluding the terminating null wide character, is returned.
88 マルチバイト文字列が終端の NULL ワイド文字 (\(aq\\0\(aq) まで含めて完全に
89 変換された場合。この時、副作用として \fI*ps\fP が初期状態に戻される。
90 この場合は \fI*src\fP には NULL が設定され、終端の NULL ワイド文字を除いて
91 \fIdest\fP に書き込まれた文字数を返す。
93 .\"O If \fIdest\fP is NULL, \fIlen\fP is ignored,
94 .\"O and the conversion proceeds as above,
95 .\"O except that the converted wide characters are not written out to memory,
96 .\"O and that no length limit exists.
97 \fIdest\fP が NULL の場合、\fIlen\fP は無視され、上記と同様の変換が
98 行われるが、変換されたワイド文字はメモリに書き込まれず、変換先の上限
101 .\"O In both of the above cases,
102 .\"O if \fIps\fP is a NULL pointer, a static anonymous
103 .\"O state only known to the
104 .\"O .BR mbsrtowcs ()
105 .\"O function is used instead.
106 上記のどちらの場合でも、\fIps\fP が NULL ポインターならば、
109 関数のみが使用する静的で名前のない状態が使用される。
111 .\"O The programmer must ensure that there is room for at least \fIlen\fP wide
112 .\"O characters at \fIdest\fP.
113 プログラマーは \fIdest\fP に最低でも \fIlen\fP ワイド文字を書き込むこ
114 とができる空間があることを保証しなければならない。
115 .\"O .SH "RETURN VALUE"
118 .\"O .BR mbsrtowcs ()
119 .\"O function returns the number of wide characters that make
120 .\"O up the converted part of the wide-character string, not including the
121 .\"O terminating null wide character.
122 .\"O If an invalid multibyte sequence was
124 .\"O .I (size_t)\ \-1
125 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
127 関数はワイド文字列に変換完了したワイド文字の数を返す。
128 終端のナルワイド文字は含まない。不正なマルチバイト列に遭遇した場合には
130 を返し、\fIerrno\fP に \fBEILSEQ\fP を設定する。
131 .\"O .SH "CONFORMING TO"
137 .\"O .BR mbsrtowcs ()
147 .\"O Passing NULL as \fIps\fP is not multithread safe.
148 \fIps\fP として NULL を渡すことはマルチスレッドでは安全でない。