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:22 JST 2000
17 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
20 .TH MBLEN 3 1999-07-25 "GNU" "Linux Programmer's Manual"
23 .\"O mblen \- determine number of bytes in next multibyte character
24 mblen \- ¼¡¤Î¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤Î¥Ð¥¤¥È¿ô¤òÊÖ¤¹
28 .B #include <stdlib.h>
30 .BI "int mblen(const char *" s ", size_t " n );
34 .\"O If \fIs\fP is not a NULL pointer, the
36 .\"O function inspects at most
37 .\"O \fIn\fP bytes of the multibyte string starting at \fIs\fP and extracts the
38 .\"O next complete multibyte character.
39 .\"O It uses a static anonymous shift state only
43 .\"O If the multibyte character is not the null wide
44 .\"O character, it returns the number of bytes that were consumed from \fIs\fP.
45 .\"O If the multibyte character is the null wide character, it returns 0.
46 \fIs\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¡¼¤Ç¤Ê¤±¤ì¤Ð¡¢
48 ´Ø¿ô¤Ï \fIs\fP ¤«¤é»Ï¤Þ¤ëºÇÂç \fIn\fP ¥Ð¥¤¥È¤Î¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó¤ò¸¡ºº¤·¤Æ¡¢
49 ¼¡¤Î´°Á´¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò¼è¤ê½Ð¤¹¡£¤³¤ì¤Ë¤Ï
51 ´Ø¿ô¤Î¤ß¤¬»ÈÍѤ¹¤ëÀÅŪ¤Ç̾Á°¤Î¤Ê¤¤¥·¥Õ¥È¾õÂÖ¤¬»ÈÍѤµ¤ì¤ë¡£
52 ¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤¬¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ç¤Ê¤±¤ì¤Ð \fIs\fP ¤«¤é¾ÃÈñ¤µ¤ì¤ë
53 ¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤¬¥Ê¥ë¥ï¥¤¥Éʸ»ú¤Ê¤é¤Ð 0 ¤òÊÖ¤¹¡£
55 .\"O If the \fIn\fP bytes starting at \fIs\fP do not contain a complete multibyte
59 .\"O This can happen even if
60 .\"O \fIn\fP is greater than or equal to \fIMB_CUR_MAX\fP,
61 .\"O if the multibyte string contains redundant shift sequences.
62 \fIs\fP ¤«¤é»Ï¤Þ¤ë \fIn\fP ¥Ð¥¤¥È¤¬´°Á´¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò´Þ¤ó¤Ç
65 ¤Ï \-1 ¤òÊÖ¤¹¡£¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎó
66 ¤Ë¾éĹ¤Ê¥·¥Õ¥È¥·¡¼¥±¥ó¥¹¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤È¡¢
67 \fIn\fP ¤¬ \fIMB_CUR_MAX\fP °Ê¾å¤Î¾ì¹ç¤Ë¤â
68 ¤³¤Î¤è¤¦¤Ê¤³¤È¤¬µ¯¤³¤ê¤¨¤ë¡£
70 .\"O If the multibyte string starting at \fIs\fP contains an invalid multibyte
71 .\"O sequence before the next complete character,
73 .\"O also returns \-1.
74 \fIs\fP ¤«¤é»Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»úÎ󤬼¡¤Î´°Á´¤Êʸ»ú¤ÎÁ°¤Ë
75 ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ò´Þ¤ó¤Ç¤¤¤ë¾ì¹ç¤Ë¤â¡¢
79 .\"O If \fIs\fP is a NULL pointer, the
82 .\" The Dinkumware doc and the Single UNIX specification say this, but
83 .\" glibc doesn't implement this.
84 .\"O resets the shift state, only known to this function, to the initial state, and
85 .\"O returns nonzero if the encoding has nontrivial shift state, or zero if the
86 .\"O encoding is stateless.
87 \fIs\fP ¤¬ NULL ¥Ý¥¤¥ó¥¿¡¼¤Ê¤é¤Ð¡¢
90 »ÈÍѤ¹¤ë¥·¥Õ¥È¾õÂÖ¤ò½é´ü²½¾õÂÖ¤ËÌᤷ¡¢¥·¥Õ¥È¾õÂÖ¤ò»ÈÍѤ·¤¿Ê¸»úÉä¹æ¤Î¾ì¹ç¤Ë
91 ¤Ï¥¼¥í°Ê³°¤ò¡¢Ê¸»úÉä¹æ¤¬¥·¥Õ¥È¾õÂÖ¤ò»ý¤¿¤Ê¤¤¾ì¹ç¤Ë¤Ï¥¼¥í¤òÊÖ¤¹¡£
92 .\"O .SH "RETURN VALUE"
96 .\"O function returns the number of
97 .\"O bytes parsed from the multibyte
98 .\"O sequence starting at \fIs\fP, if a non-null wide character was recognized.
99 .\"O It returns 0, if a null wide character was recognized.
100 .\"O It returns \-1, if an
101 .\"O invalid multibyte sequence was encountered or if it couldn't parse a complete
102 .\"O multibyte character.
104 ´Ø¿ô¤Ï \fIs\fP ¤«¤é»Ï¤Þ¤ë¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤ò¸¡ºº¤·¤Æ
105 ¥Ê¥ë¥ï¥¤¥Éʸ»ú°Ê³°¤ò³Îǧ¤·¤¿¾ì¹ç¤Ë¤Ï¤½¤Î¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
106 ¥Ê¥ë¥ï¥¤¥Éʸ»ú¤ò³Îǧ¤·¤¿¾ì¹ç¤Ë¤Ï¥¼¥í¤òÊÖ¤¹¡£ÉÔÀµ¤Ê¥Þ¥ë¥Á¥Ð¥¤¥ÈÎó¤Ë
107 Áø¶ø¤·¤¿¾ì¹ç¤ä´°Á´¤Ê¥Þ¥ë¥Á¥Ð¥¤¥Èʸ»ú¤ò²òÀϤǤ¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï \-1 ¤òÊÖ¤¹¡£
108 .\"O .SH "CONFORMING TO"
118 .\"O \"O current locale.
120 ¤ÎÆ°ºî¤Ï¸½ºß¤Î¥í¥±¡¼¥ë¤Î
122 ¥«¥Æ¥´¥ê¤Ë°Í¸¤·¤Æ¤¤¤ë¡£
126 .\"O provides a better interface to the same
129 ´Ø¿ô¤ÏƱ¤¸µ¡Ç½¤Î¤è¤êÎɤ¤¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤òÄ󶡤¹¤ë¡£