OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / wcstok.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 Sat Oct 23 17:53:50 JST 1999
16 .\"           by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
17 .\"
18 .TH WCSTOK 3 1999-07-25 "GNU" "Linux Programmer's Manual"
19 .\"O .SH NAME
20 .SH Ì¾Á°
21 .\"O wcstok \- split wide-character string into tokens
22 wcstok \- ¥ï¥¤¥Éʸ»úʸ»úÎó¤ò¥È¡¼¥¯¥ó¤Ëʬ³ä¤¹¤ë
23 .\"O .SH SYNOPSIS
24 .SH ½ñ¼°
25 .nf
26 .B #include <wchar.h>
27 .sp
28 .BI "wchar_t *wcstok(wchar_t *" wcs ", const wchar_t *" delim \
29 ", wchar_t **" ptr );
30 .fi
31 .\"O .SH DESCRIPTION
32 .SH ÀâÌÀ
33 .\"O The
34 .\"O .BR wcstok ()
35 .\"O function is the wide-character equivalent of the
36 .\"O .BR strtok (3)
37 .\"O function,
38 .\"O with an added argument to make it multithread-safe. It can be used
39 .\"O to split a wide-character string \fIwcs\fP into tokens, where a token is
40 .\"O defined as a substring not containing any wide-characters from \fIdelim\fP.
41 .BR wcstok ()
42 ´Ø¿ô¤Ï¡¢
43 .BR strtok (3)
44 ´Ø¿ô¤ËÂбþ¤¹¤ë¥ï¥¤¥Éʸ»ú´Ø¿ô¤Ë¡¢
45 ¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤ÎÆ°ºî¤ò¤µ¤»¤ë¤¿¤á¤Î°ú¤­¿ô¤òÄɲä·¤¿¤â¤Î¤Ç¤¢¤ë¡£
46 ¤³¤Î´Ø¿ô¤òÍѤ¤¤Æ¡¢¥ï¥¤¥Éʸ»úʸ»úÎó \fIwcs\fP ¤ò¥È¡¼¥¯¥ó¤Ëʬ²ò¤¹¤ë¤³¤È
47 ¤¬¤Ç¤­¤ë¡£¤³¤³¤Ç¡¢¥È¡¼¥¯¥ó¤Ï \fIdelim\fP ¤ËÎóµó¤µ¤ì¤Æ¤¤¤ëʸ»ú¤ò´Þ¤Þ¤Ê
48 ¤¤Éôʬʸ»úÎó¤È¤·¤ÆÄêµÁ¤µ¤ì¤ë¡£
49 .PP
50 .\"O The search starts at \fIwcs\fP, if \fIwcs\fP is not NULL,
51 .\"O or at \fI*ptr\fP, if \fIwcs\fP is NULL.
52 .\"O First, any delimiter wide-characters are skipped, that is, the
53 .\"O pointer is advanced beyond any wide-characters which occur in \fIdelim\fP.
54 ¸¡º÷¤Ï \fIwcs\fP ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð \fIwcs\fP ¤«¤é³«»Ï¤µ¤ì¡¢\fIwcs\fP
55 ¤¬ NULL ¤Ê¤é¤Ð \fI*ptr\fP ¤«¤é³«»Ï¤µ¤ì¤ë¡£¤Þ¤º¡¢Á´¤Æ¤Î¶èÀÚ¤ê¥ï¥¤¥Éʸ»ú
56 ¤¬¥¹¥­¥Ã¥×¤µ¤ì¤ë¡£¤Ä¤Þ¤ê¡¢\fIdelim\fP ¤Ë´Þ¤Þ¤ì¤ë¥ï¥¤¥Éʸ»ú¤òĶ¤¨¤ë¤è¤¦
57 ¤Ë¥Ý¥¤¥ó¥¿¤¬Á°¤Ë¿Ê¤á¤é¤ì¤ë¡£
58 .\"O If the end of the wide-character string is now reached,
59 .\"O .BR wcstok ()
60 .\"O returns NULL, to indicate that no tokens
61 .\"O were found, and stores an appropriate value in \fI*ptr\fP,
62 .\"O so that subsequent calls to
63 .\"O .BR wcstok ()
64 .\"O will continue to return NULL.
65 .\"O Otherwise, the
66 .\"O .BR wcstok ()
67 .\"O function recognizes the beginning of a token
68 .\"O and returns a pointer to it, but before doing that, it zero-terminates the
69 .\"O token by replacing the next wide-character which occurs in \fIdelim\fP with
70 .\"O a L\(aq\\0\(aq character,
71 .\"O and it updates \fI*ptr\fP so that subsequent calls will
72 .\"O continue searching after the end of recognized token.
73 ¥ï¥¤¥Éʸ»úʸ»úÎó¤Î½ª¤ï¤ê¤Ë㤷¤¿¤é¡¢
74 .BR wcstok ()
75 ¤Ï NULL ¤òÊÖ¤·¤Æ
76 ¥È¡¼¥¯¥ó¤¬Á´¤¯¸«¤Ä¤«¤é¤Ê¤«¤Ã¤¿¤³¤È¤ò¼¨¤·¡¢¤³¤Î¸å¤Ë
77 .BR wcstok ()
78 ¤ò¸Æ¤Ó
79 ½Ð¤·¤Æ¤â NULL ¤¬ÊÖ¤µ¤ì¤ë¤è¤¦¤Ë \fI*ptr\fP ¤ËŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¡£¤½¤ì
80 °Ê³°¤Î¾ì¹ç¤Ë¤Ï¡¢
81 .BR wcstok ()
82 ´Ø¿ô¤Ï¥È¡¼¥¯¥ó¤ÎÀèƬ¤ò¼±Ê̤·¡¢¤³¤ì¤ò»Ø¤¹
83 ¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¤¿¤À¤·¤³¤ì¤ò¹Ô¤¦Á°¤Ë¡¢¥È¡¼¥¯¥ó¤Î¸å¤Ë¤¢¤ë¡¢\fIdelim\fP
84 ¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ëʸ»ú¤ò L\(aq\\0\(aq ¤ËÃÖ¤­´¹¤¨¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥È¡¼¥¯¥ó¤ò 0 ¤Ç
85 ½ªÃ¼¤µ¤»¤ë¡£¤µ¤é¤Ë \fI*ptr\fP ¤ò¹¹¿·¤·¡¢¸å¤Ç
86 .BR wcstok ()
87 ¤ò¸Æ¤Ó½Ð¤·¤¿
88 ºÝ¤Ë¡¢¼±Ê̤µ¤ì¤¿¥È¡¼¥¯¥ó¤Î³¤­¤«¤é¸¡º÷¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¡£
89 .\"O .SH "RETURN VALUE"
90 .SH ÊÖ¤êÃÍ
91 .\"O The
92 .\"O .BR wcstok ()
93 .\"O function returns a pointer to the next token,
94 .\"O or NULL if no further token was found.
95 .BR wcstok ()
96 ´Ø¿ô¤Ï¼¡¤Î¥È¡¼¥¯¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¥È¡¼¥¯¥ó¤¬¸«¤Ä¤«¤é
97 ¤Ê¤±¤ì¤Ð NULL ¤òÊÖ¤¹¡£
98 .\"O .SH "CONFORMING TO"
99 .SH ½àµò
100 C99.
101 .\"O .SH NOTES
102 .SH Ãí°Õ
103 .\"O The original \fIwcs\fP wide-character string is destructively modified during
104 .\"O the operation.
105 ´Ø¿ô¤ËÍ¿¤¨¤¿¥ï¥¤¥Éʸ»úÎó \fIwcs\fP ¤Ï¡¢´Ø¿ô¤ÎÆ°ºî¤Ë¤è¤Ã¤Æ´°Á´¤Ë½ñ¤­´¹
106 ¤¨¤é¤ì¤ë¡£
107 .\"O .SH EXAMPLE
108 .SH Îã
109 .\"O The following code loops over the tokens contained in a wide-character string.
110 °Ê²¼¤Î¥³¡¼¥É¤Ï¡¢¥ï¥¤¥Éʸ»úʸ»úÎó¤Ë´Þ¤Þ¤ì¤ë¥È¡¼¥¯¥ó¤ò¼è¤ê½Ð¤·¤Ê¤¬¤é
111 ¥ë¡¼¥×¤¹¤ë¡£
112 .sp
113 .nf
114 wchar_t *wcs = ...;
115 wchar_t *token;
116 wchar_t *state;
117 for (token = wcstok(wcs, " \\t\\n", &state);
118     token != NULL;
119     token = wcstok(NULL, " \\t\\n", &state)) {
120     ...
121 }
122 .fi
123 .\"O .SH "SEE ALSO"
124 .SH ´ØÏ¢¹àÌÜ
125 .BR strtok (3),
126 .BR wcschr (3)