OSDN Git Service

(split) LDP_man-pages: release ioctl.2 [JM:00378]
[linuxjm/LDP_man-pages.git] / draft / man3 / mbsnrtowcs.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 .\"
13 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
14 .\"         all rights reserved.
15 .\" Translated Tue Jan 11 00:56:10 JST 2000
16 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
17 .\"
18 .TH MBSNRTOWCS 3  2010-09-15 "GNU" "Linux Programmer's Manual"
19 .\"O .SH NAME
20 .SH Ì¾Á°
21 .\"O mbsnrtowcs \- convert a multibyte string to a wide-character string
22 mbsnrtowcs \- ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ò¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹¤¹¤ë
23 .\"O .SH SYNOPSIS
24 .SH ½ñ¼°
25 .nf
26 .B #include <wchar.h>
27 .sp
28 .BI "size_t mbsnrtowcs(wchar_t *" dest ", const char **" src ,
29 .BI "                  size_t " nms ", size_t " len ", mbstate_t *" ps );
30 .fi
31 .sp
32 .in -4n
33 .\"O Feature Test Macro Requirements for glibc (see
34 .\"O .BR feature_test_macros (7)):
35 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
36 .RB ( feature_test_macros (7)
37 »²¾È):
38 .in
39 .sp
40 .BR mbsnrtowcs ():
41 .PD 0
42 .ad l
43 .RS 4
44 .TP 4
45 .\"O Since glibc 2.10:
46 glibc 2.10 °Ê¹ß:
47 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
48 .TP
49 .\"O Before glibc 2.10:
50 glibc 2.10 ¤è¤êÁ°:
51 _GNU_SOURCE
52 .RE
53 .ad
54 .PD
55 .\"O .SH DESCRIPTION
56 .SH ÀâÌÀ
57 .\"O The
58 .\"O .BR mbsnrtowcs ()
59 .\"O function is like the
60 .\"O .BR mbsrtowcs (3)
61 .\"O function, except that
62 .\"O the number of bytes to be converted, starting at \fI*src\fP, is limited to
63 .\"O \fInms\fP.
64 .BR mbsnrtowcs ()
65 ´Ø¿ô¤Ï
66 .BR mbsrtowcs (3)
67 ´Ø¿ô¤Ë»÷¤Æ¤¤¤ë¤¬
68 ÊÑ´¹¤¹¤ë¥Ð¥¤¥È¿ô¤¬ \fI*src\fP ¤«¤é»Ï¤Þ¤ë \fInms\fP ¥Ð¥¤¥È¤ËÀ©¸Â¤µ¤ì¤Æ¤¤¤ë
69 ÅÀ¤¬°Û¤Ê¤Ã¤Æ¤¤¤ë¡£
70 .PP
71 .\"O If \fIdest\fP is not a NULL pointer, the
72 .\"O .BR mbsnrtowcs ()
73 .\"O function converts at
74 .\"O most \fInms\fP bytes from the
75 .\"O multibyte string \fI*src\fP to a wide-character string starting at \fIdest\fP.
76 .\"O At most \fIlen\fP wide characters are written to \fIdest\fP.
77 .\"O The shift state
78 .\"O \fI*ps\fP is updated.
79 .\"O The conversion is effectively performed by repeatedly
80 .\"O calling
81 .\"O .I "mbrtowc(dest, *src, n, ps)"
82 .\"O where \fIn\fP is some
83 .\"O positive number, as long as this call succeeds, and then incrementing
84 .\"O \fIdest\fP by one and \fI*src\fP by the number of bytes consumed.
85 .\"O The
86 .\"O conversion can stop for three reasons:
87 \fIdest\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¡¼¤Ç¤Ê¤±¤ì¤Ð
88 .BR mbsnrtowcs ()
89 ´Ø¿ô¤Ï
90 \fI*src\fP ¤«¤é¤Î¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ÎºÇÂç \fInms\fP ¤Þ¤Ç¤ò
91 \fIdest\fP ¤«¤é¤Î¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹¤¹¤ë¡£
92 ºÇÂç \fIlen\fP Ê¸»ú¤Î¥ï¥¤¥Éʸ»ú¤¬ \fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤ë¡£
93 Ʊ»þ¤Ë¥·¥Õ¥È¾õÂÖ \fI*ps\fP ¤ò¹¹¿·¤¹¤ë¡£
94 ÊÑ´¹¤Ï
95 .I "mbrtowc(dest, *src, n, ps)"
96 ¤ò¡¢¤³¤Î¸Æ¤Ó½Ð¤·¤¬À®¸ù¤¹¤ë¸Â¤ê¡¢·«¤êÊÖ¤·¼Â¹Ô¤·¤¿¤Î¤È¼Â¼ÁŪ¤ËƱÍͤǤ¢¤ë¡£
97 ¤³¤³¤Ç¤Î \fIn\fP ¤ÏÀµ¤Î¿ô¤Ç¤¢¤ê¡¢·«¤êÊÖ¤·¤´¤È¤Ë \fIdest\fP ¤¬ 1 Áý²Ã¤µ¤»¤é¤ì¡¢
98 \fI*src\fP ¤¬¾ÃÈñ¤·¤¿¥Ð¥¤¥È¿ô¤À¤±Áý²Ã¤µ¤»¤é¤ì¤ë¡£ÊÑ´¹¤Ï°Ê²¼¤Î»°¤Ä¤Î
99 ¤¤¤º¤ì¤«¤Î¾ò·ï¤ÇÄä»ß¤¹¤ë:
100 .IP 1. 3
101 .\"O An invalid multibyte sequence has been encountered.
102 .\"O In this case \fI*src\fP
103 .\"O is left pointing to the invalid multibyte sequence,
104 .\"O .I (size_t)\ \-1
105 .\"O is returned,
106 .\"O and \fIerrno\fP is set to \fBEILSEQ\fP.
107 ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¡£¤³¤Î¾ì¹ç¤Ë¤Ï \fI*src\fP ¤ÏÉÔÀµ¤Ê
108 ¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ò»Ø¤¹¤è¤¦¤Ë¤·¤Æ¡¢
109 .I (size_t)\ \-1
110 ¤òÊÖ¤·¡¢\fIerrno\fP ¤Ë \fBEILSEQ\fP ¤òÀßÄꤹ¤ë¡£
111 .IP 2.
112 .\"O The \fInms\fP limit forces a stop,
113 .\"O or \fIlen\fP non-L\(aq\\0\(aq wide characters
114 .\"O have been stored at \fIdest\fP.
115 .\"O In this case \fI*src\fP is left pointing to the
116 .\"O next multibyte sequence to be converted, and the number of wide characters
117 .\"O written to \fIdest\fP is returned.
118 \fInms\fP À©¸Â¤Ë¤è¤Ã¤Æ¶¯À©Åª¤ËÄä»ß¤¹¤ë¤«¡¢\fIlen\fP Ê¸»ú¤Î L\(aq\\0\(aq °Ê³°¤Î
119 ¥ï¥¤¥Éʸ»ú¤ò \fIdest\fP ¤Ë³ÊǼ¤·¤¿¾ì¹ç¡£¤³¤Î¾ì¹ç¤Ï \fI*src\fP ¤Ï
120 ¼¡¤ËÊÑ´¹¤µ¤ì¤ë¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ò»Ø¤¹¤è¤¦¤Ë¤·¤Æ¡¢\fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿
121 ¥ï¥¤¥Éʸ»ú¤Î¿ô¤òÊÖ¤¹¡£
122 .IP 3.
123 .\"O The multibyte string has been completely converted, including the
124 .\"O terminating \(aq\\0\(aq
125 .\"O (which has the side effect of bringing back \fI*ps\fP to the
126 .\"O initial state).
127 .\"O In this case \fI*src\fP is set to NULL, and the number of wide
128 .\"O characters written to \fIdest\fP,
129 .\"O excluding the terminating L\(aq\\0\(aq character,
130 .\"O is returned.
131 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎ󤬽ªÃ¼¤Î \(aq\\0\(aq ¤Þ¤Ç´Þ¤á¤Æ´°Á´¤ËÊÑ´¹¤µ¤ì¤¿¾ì¹ç¡£
132 (¤³¤Î»þ¡¢ÉûºîÍѤȤ·¤Æ \fI*ps\fP ¤¬½é´ü¾õÂÖ¤ËÌᤵ¤ì¤ë¡£)
133 ¤³¤Î¾ì¹ç¤Ï \fI*src\fP ¤Ë¤Ï NULL ¤¬ÀßÄꤵ¤ì¡¢½ªÃ¼¤Î L\(aq\\0\(aq Ê¸»ú¤ò½ü¤¤¤Æ
134 \fIdest\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤¿Ê¸»ú¿ô¤òÊÖ¤¹¡£
135 .PP
136 .\"O If \fIdest\fP is NULL, \fIlen\fP is ignored, and the conversion proceeds as
137 .\"O above, except that the converted wide characters
138 .\"O are not written out to memory,
139 .\"O and that no destination length limit exists.
140 \fIdest\fP ¤¬ NULL ¤Î¾ì¹ç¡¢\fIlen\fP ¤Ï̵»ë¤µ¤ì¡¢¾åµ­¤ÈƱÍͤÎÊÑ´¹¤¬
141 ¹Ô¤ï¤ì¤ë¤¬¡¢ÊÑ´¹¤µ¤ì¤¿¥ï¥¤¥Éʸ»ú¤Ï¥á¥â¥ê¤Ë½ñ¤­¹þ¤Þ¤ì¤º¡¢ÊÑ´¹Àè¤Î¾å¸Â
142 ¤¬Â¸ºß¤·¤Ê¤¤¡£
143 .PP
144 .\"O In both of the above cases, if \fIps\fP is a NULL pointer, a static anonymous
145 .\"O state only known to the mbsnrtowcs function is used instead.
146 ¾åµ­¤Î¤É¤Á¤é¤Î¾ì¹ç¤Ç¤â¡¢\fIps\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¡¼¤Ê¤é¤Ð¡¢Âå¤ê¤Ë
147 mbsnrtowcs ´Ø¿ô¤Î¤ß¤¬»ÈÍѤ¹¤ëÀÅŪ¤Ç̾Á°¤Î¤Ê¤¤¾õÂÖ¤¬»ÈÍѤµ¤ì¤ë¡£
148 .PP
149 .\"O The programmer must ensure that there is room for at least \fIlen\fP wide
150 .\"O characters at \fIdest\fP.
151 ¥×¥í¥°¥é¥Þ¡¼¤Ï \fIdest\fP ¤ËºÇÄã¤Ç¤â \fIlen\fP ¥ï¥¤¥Éʸ»ú¤ò½ñ¤­¹þ¤à¤³
152 ¤È¤¬¤Ç¤­¤ë¶õ´Ö¤¬¤¢¤ë¤³¤È¤òÊݾڤ·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
153 .\"O .SH "RETURN VALUE"
154 .SH ÊÖ¤êÃÍ
155 .\"O The
156 .\"O .BR mbsnrtowcs ()
157 .\"O function returns the number of wide characters
158 .\"O that make up the converted part of the wide-character string,
159 .\"O not including the terminating null wide character.
160 .\"O If an invalid multibyte sequence was
161 .\"O encountered,
162 .\"O .I (size_t)\ \-1
163 .\"O is returned, and \fIerrno\fP set to \fBEILSEQ\fP.
164 .BR mbsnrtowcs ()
165 ´Ø¿ô¤Ï¥ï¥¤¥Éʸ»úÎó¤ËÊÑ´¹´°Î»¤·¤¿¥ï¥¤¥Éʸ»ú¤Î¿ô¤òÊÖ¤¹¡£
166 ½ªÃ¼¤Î¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ï´Þ¤Þ¤Ê¤¤¡£ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ËÁø¶ø¤·¤¿¾ì¹ç¤Ë¤Ï
167 .I (size_t)\ \-1
168 ¤òÊÖ¤·¡¢\fIerrno\fP ¤Ë \fBEILSEQ\fP ¤òÀßÄꤹ¤ë¡£
169 .\"O .SH "CONFORMING TO"
170 .SH ½àµò
171 .\"O This function is a GNU extension.
172 ¤³¤Î´Ø¿ô¤Ï GNU ¤Î³ÈÄ¥¤Ç¤¢¤ë¡£
173 .\"O .SH NOTES
174 .SH Ãí°Õ
175 .\"O The behavior of
176 .\"O .BR mbsnrtowcs ()
177 .\"O depends on the
178 .\"O .B LC_CTYPE
179 .\"O category of the
180 .\"O current locale.
181 .BR mbsnrtowcs ()
182 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
183 .B LC_CTYPE
184 ¥«¥Æ¥´¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë¡£
185 .PP
186 .\"O Passing NULL as \fIps\fP is not multithread safe.
187 \fIps\fP ¤È¤·¤Æ NULL ¤òÅϤ¹¤³¤È¤Ï¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¤Ç¤Ï°ÂÁ´¤Ç¤Ê¤¤¡£
188 .\"O .SH "SEE ALSO"
189 .SH ´ØÏ¢¹àÌÜ
190 .BR iconv (3),
191 .BR mbsrtowcs (3)