OSDN Git Service

13dcd5112ab8225b7636158cb0d447365dbfaaac
[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  2011-09-28 "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 null wide character (L\(aq\\0\(aq),
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 に含まれている文字を NULL ワイド文字 (L\(aq\\0\(aq) に置き換えること
85 によってトークンを 0 で終端させる。さらに \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)