.\" Copyright (c) Bruno Haible .\" .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" References consulted: .\" GNU glibc-2 source code and manual .\" Dinkumware C library reference http://www.dinkumware.com/ .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html .\" ISO/IEC 9899:1999 .\" .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya .\" all rights reserved. .\" Translated Tue Jan 11 00:56:13 JST 2000 .\" by HANATAKA Shinya .\" .\"WORD: initial shift state 初期シフト状態 .\" .TH MBSINIT 3 2000-11-20 "GNU" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O mbsinit \- test for initial shift state mbsinit \- 初期シフト状態かどうかを検査する .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "int mbsinit(const mbstate_t *" ps ); .fi .\"O .SH DESCRIPTION .SH 説明 .\"O Character conversion between the multibyte representation and the wide .\"O character representation uses conversion state, of type \fImbstate_t\fP. .\"O Conversion of a string uses a finite-state machine; when it is interrupted .\"O after the complete conversion of a number of characters, it may need to .\"O save a state for processing the remaining characters. .\"O Such a conversion .\"O state is needed for the sake of encodings such as ISO-2022 and UTF-7. 文字をマルチバイト表現とワイド文字表現の間で変換する場合には \fImbstate_t\fP 型の変換状態を使用する。文字列の変換は有限状態マシン を使用する。いくらかの文字の変換を完了した後に、残りの文字を処理する ために状態を保存しておく必要があるかもしれない。このような変換状態は ISO-2022 や UTF-7 のような符号を扱うのに必要とされる。 .PP .\"O The initial state is the state at the beginning of conversion of a string. .\"O There are two kinds of state: The one used by multibyte to wide character .\"O conversion functions, such as .\"O .BR mbsrtowcs (3), .\"O and the one used by wide .\"O character to multibyte conversion functions, such as .\"O .BR wcsrtombs (3), .\"O but they both fit in a \fImbstate_t\fP, and they both have the same .\"O representation for an initial state. 初期状態とは文字列の変換を開始する時の状態である。状態には二種類が 存在し、一つは .BR mbsrtowcs (3) のようなマルチバイトをワイド文字に 変換する関数で使用される。もう一つは .BR wcsrtombs (3) のような ワイド文字をマルチバイトに変換する関数で使用される。しかし両方とも \fImbstate_t\fP に格納され、初期状態として同じ表現を持つ。 .PP .\"O For 8-bit encodings, all states are equivalent to the initial state. .\"O For multibyte encodings like UTF-8, EUC-*, BIG5 or SJIS, the wide character .\"O to multibyte conversion functions never produce non-initial states, but the .\"O multibyte to wide-character conversion functions like .\"O .BR mbrtowc (3) .\"O do .\"O produce non-initial states when interrupted in the middle of a character. 8ビット符号においては全ての状態は初期状態と等価である。 UTF-8, EUC-*, BIG5, SJIS のような多バイト符号においてワイド文字から 多バイト文字への変換関数は非初期状態にはならない。 しかし .BR mbrtowc (3) のような多バイト文字からワイド文字への変換関数では 文字の解釈の途中で非初期状態となる場合がある。 .PP .\"O One possible way to create an .\"O .I mbstate_t .\"O in initial .\"O state is to set it to zero: 初期状態の .I mbstate_t を作成する方法の一つは、それをゼロに設定することである: .nf mbstate_t state; memset(&state,0,sizeof(mbstate_t)); .fi .PP .\"O On Linux, the following works as well, but might generate compiler warnings: Linux においては以下の方法でも同様であるが、コンパイラーの警告が 生成されるかもしれない。 .nf mbstate_t state = { 0 }; .fi .PP .\"O The function .\"O .BR mbsinit () .\"O tests whether \fI*ps\fP corresponds to an .\"O initial state. .BR mbsinit () は \fI*ps\fP が初期状態に一致するかどうかを検査する。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O .BR mbsinit () .\"O returns nonzero if \fI*ps\fP is an initial state, or if .\"O \fIps\fP is a null pointer. .\"O Otherwise it returns 0. .BR mbsinit () は \fI*ps\fP が初期状態の場合や NULL ポインターの場合には ゼロ以外を返す。それ以外の場合にはゼロを返す。 .\"O .SH "CONFORMING TO" .SH 準拠 C99. .\"O .SH NOTES .SH 注意 .\"O The behavior of .\"O .BR mbsinit () .\"O depends on the .\"O .B LC_CTYPE .\"O category of the .\"O current locale. .BR mbsinit () の動作は現在のロケールの .B LC_CTYPE カテゴリに依存している。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR mbsrtowcs (3), .BR wcsrtombs (3)