OSDN Git Service

5e22cfca79b2f562b946554392a898236c2d9b57
[linuxjm/LDP_man-pages.git] / draft / man3 / wcrtomb.3
1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
2 .\"
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.
7 .\"
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
12 .\"   ISO/IEC 9899:1999
13 .\"
14 .\" About this Japanese page, please contact to JM Project <JM@linux.or.jp>
15 .\" Translated Mon Oct 25 22:55:40 JST 1999
16 .\"           by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
17 .\"
18 .TH WCRTOMB 3  2011-09-28 "GNU" "Linux Programmer's Manual"
19 .\"O .SH NAME
20 .SH 名前
21 .\"O wcrtomb \- convert a wide character to a multibyte sequence
22 wcrtomb \- ワイド文字 1 つをマルチバイト列に変換する
23 .\"O .SH SYNOPSIS
24 .SH 書式
25 .nf
26 .B #include <wchar.h>
27 .sp
28 .BI "size_t wcrtomb(char *" s ", wchar_t " wc ", mbstate_t *" ps );
29 .fi
30 .\"O .SH DESCRIPTION
31 .SH 説明
32 .\"O The main case for this function is when \fIs\fP is
33 .\"O not NULL and \fIwc\fP is not a null wide character (L\(aq\\0\(aq).
34 この関数が主に使われるのは、\fIs\fP が NULL でなく、
35 \fIwc\fP が NULL ワイド文字 (L\(aq\\0\(aq) でない場合である。
36 .\"O In this case, the
37 .\"O .BR wcrtomb ()
38 .\"O function
39 .\"O converts the wide character \fIwc\fP
40 .\"O to its multibyte representation and stores it
41 .\"O at the beginning of the character
42 .\"O array pointed to by \fIs\fP.
43 .\"O It updates the shift state \fI*ps\fP, and
44 .\"O returns the length of said multibyte representation,
45 .\"O that is, the number of bytes
46 .\"O written at \fIs\fP.
47 この場合には、
48 .BR wcrtomb ()
49 関数はワイド文字 \fIwc\fP をマルチバイト表
50 現に変換し、\fIs\fP が指す char 型の配列にこれを格納する。この関数は
51 シフト状態 \fI*ps\fP を更新し、出力されたマルチバイト表現の長さ、すな
52 わち \fIs\fP に書き込まれたバイト数を返す。
53 .PP
54 .\"O A different case is when \fIs\fP is not NULL,
55 .\"O but \fIwc\fP is a null wide character (L\(aq\\0\(aq).
56 .\"O In this
57 .\"O case the
58 .\"O .BR wcrtomb ()
59 .\"O function stores at
60 .\"O the character array pointed to by
61 .\"O \fIs\fP the shift sequence needed to
62 .\"O bring \fI*ps\fP back to the initial state,
63 .\"O followed by a \(aq\\0\(aq byte.
64 .\"O It updates the shift state \fI*ps\fP (i.e., brings
65 .\"O it into the initial state),
66 .\"O and returns the length of the shift sequence plus
67 .\"O one, that is, the number of bytes written at \fIs\fP.
68 別のケースとしては、\fIs\fP は NULL でないが
69 \fIwc\fP が NULL ワイド文字 (L\(aq\\0\(aq) のことがある。
70 この場合の
71 .BR wcrtomb ()
72 関数は、\fI*ps\fP を初期状態に戻すのに必
73 要なシフトシーケンスを \fIs\fP が指す char 型配列に格納し、その後に \(aq\\0\(aq
74 を格納する。この関数はシフト状態 \fI*ps\fP を更新し(つまり初期状態に戻
75 し)、シフトシーケンスの長さに 1 を加えた値を返す。この値は \fIs\fP に
76 書き込まれたバイト数である。
77 .PP
78 .\"O A third case is when \fIs\fP is NULL.
79 .\"O In this case \fIwc\fP is ignored,
80 .\"O and the function effectively returns
81 .\"O 
82 .\"O     wcrtomb(buf, L\(aq\\0\(aq, ps)
83 .\"O 
84 .\"O where
85 .\"O .I buf
86 .\"O is an internal anonymous buffer.
87 三番目のケースは、\fIs\fP が NULL の時である。
88 この場合には \fIwc\fP は無視され、関数の実際の動きとしては
89
90     wcrtomb(buf, L\(aq\\0\(aq, ps)
91
92 が返される。ここで、
93 .I buf
94 は内部的な無名バッファである。
95
96 .PP
97 .\"O In all of the above cases, if \fIps\fP is a NULL pointer, a static anonymous
98 .\"O state only known to the
99 .\"O .BR wcrtomb ()
100 .\"O function is used instead.
101 以上のいずれの場合も、\fIps\fP が NULL ポインタならばシフト状態は用い
102 られず、
103 .BR wcrtomb ()
104 関数だけが知っている静的な匿名の状態が使われる。
105 .\"O .SH "RETURN VALUE"
106 .SH 返り値
107 .\"O The
108 .\"O .BR wcrtomb ()
109 .\"O function returns the number of
110 .\"O bytes that have been or would
111 .\"O have been written to the byte array at \fIs\fP.
112 .\"O If \fIwc\fP can not be
113 .\"O represented as a multibyte sequence (according to the current locale),
114 .\"O .I (size_t)\ \-1
115 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
116 .BR wcrtomb ()
117 関数は、\fIs\fP が指すバイト列に書き込まれたバイト数、あ
118 るいは書き込まれたであろうバイト数を返す。\fIwc\fP を(現在のロケールに
119 従って)マルチバイト列で表現できなければ、
120 .I (size_t)\ \-1
121 が返され、 \fIerrno\fP に \fBEILSEQ\fP が設定される。
122 .\"O .SH "CONFORMING TO"
123 .SH 準拠
124 C99.
125 .\"O .SH NOTES
126 .SH 注意
127 .\"O The behavior of
128 .\"O .BR wcrtomb ()
129 .\"O depends on the
130 .\"O .B LC_CTYPE
131 .\"O category of the
132 .\"O current locale.
133 .BR wcrtomb ()
134 の動作は、現在のロケールの
135 .B LC_CTYPE
136 カテゴリに依存する。
137 .PP
138 .\"O Passing NULL as \fIps\fP is not multithread safe.
139 \fIps\fP に NULL を渡した際の動作はマルチスレッドセーフでない。
140 .\"O .SH "SEE ALSO"
141 .SH 関連項目
142 .BR wcsrtombs (3)