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:13 JST 2000
17 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
19 .\"WORD: initial shift state 初期シフト状態
21 .TH MBSINIT 3 2000-11-20 "GNU" "Linux Programmer's Manual"
24 .\"O mbsinit \- test for initial shift state
25 mbsinit \- 初期シフト状態かどうかを検査する
31 .BI "int mbsinit(const mbstate_t *" ps );
35 .\"O Character conversion between the multibyte representation and the wide
36 .\"O character representation uses conversion state, of type \fImbstate_t\fP.
37 .\"O Conversion of a string uses a finite-state machine; when it is interrupted
38 .\"O after the complete conversion of a number of characters, it may need to
39 .\"O save a state for processing the remaining characters.
40 .\"O Such a conversion
41 .\"O state is needed for the sake of encodings such as ISO-2022 and UTF-7.
42 文字をマルチバイト表現とワイド文字表現の間で変換する場合には
43 \fImbstate_t\fP 型の変換状態を使用する。文字列の変換は有限状態マシン
44 を使用する。いくらかの文字の変換を完了した後に、残りの文字を処理する
45 ために状態を保存しておく必要があるかもしれない。このような変換状態は
46 ISO-2022 や UTF-7 のような符号を扱うのに必要とされる。
48 .\"O The initial state is the state at the beginning of conversion of a string.
49 .\"O There are two kinds of state: The one used by multibyte to wide character
50 .\"O conversion functions, such as
51 .\"O .BR mbsrtowcs (3),
52 .\"O and the one used by wide
53 .\"O character to multibyte conversion functions, such as
54 .\"O .BR wcsrtombs (3),
55 .\"O but they both fit in a \fImbstate_t\fP, and they both have the same
56 .\"O representation for an initial state.
57 初期状態とは文字列の変換を開始する時の状態である。状態には二種類が
64 ワイド文字をマルチバイトに変換する関数で使用される。しかし両方とも
65 \fImbstate_t\fP に格納され、初期状態として同じ表現を持つ。
67 .\"O For 8-bit encodings, all states are equivalent to the initial state.
68 .\"O For multibyte encodings like UTF-8, EUC-*, BIG5 or SJIS, the wide character
69 .\"O to multibyte conversion functions never produce non-initial states, but the
70 .\"O multibyte to wide-character conversion functions like
73 .\"O produce non-initial states when interrupted in the middle of a character.
74 8ビット符号においては全ての状態は初期状態と等価である。
75 UTF-8, EUC-*, BIG5, SJIS のような多バイト符号においてワイド文字から
76 多バイト文字への変換関数は非初期状態にはならない。
79 のような多バイト文字からワイド文字への変換関数では
80 文字の解釈の途中で非初期状態となる場合がある。
82 .\"O One possible way to create an
85 .\"O state is to set it to zero:
88 を作成する方法の一つは、それをゼロに設定することである:
92 memset(&state,0,sizeof(mbstate_t));
95 .\"O On Linux, the following works as well, but might generate compiler warnings:
96 Linux においては以下の方法でも同様であるが、コンパイラーの警告が
100 mbstate_t state = { 0 };
105 .\"O tests whether \fI*ps\fP corresponds to an
108 は \fI*ps\fP が初期状態に一致するかどうかを検査する。
109 .\"O .SH "RETURN VALUE"
112 .\"O returns nonzero if \fI*ps\fP is an initial state, or if
113 .\"O \fIps\fP is a NULL pointer.
114 .\"O Otherwise it returns 0.
116 は \fI*ps\fP が初期状態の場合や NULL ポインターの場合には
117 ゼロ以外を返す。それ以外の場合にはゼロを返す。
118 .\"O .SH "CONFORMING TO"