OSDN Git Service

899ebab0bbd365dd59c8543496d1a79d3a32a2b8
[linuxjm/LDP_man-pages.git] / draft / man3 / mbsinit.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 .\" 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>
18 .\"
19 .\"WORD:        initial shift state             初期シフト状態
20 .\"
21 .TH MBSINIT 3  2000-11-20 "GNU" "Linux Programmer's Manual"
22 .\"O .SH NAME
23 .SH 名前
24 .\"O mbsinit \- test for initial shift state
25 mbsinit \- 初期シフト状態かどうかを検査する
26 .\"O .SH SYNOPSIS
27 .SH 書式
28 .nf
29 .B #include <wchar.h>
30 .sp
31 .BI "int mbsinit(const mbstate_t *" ps );
32 .fi
33 .\"O .SH DESCRIPTION
34 .SH 説明
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 のような符号を扱うのに必要とされる。
47 .PP
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 初期状態とは文字列の変換を開始する時の状態である。状態には二種類が
58 存在し、一つは
59 .BR mbsrtowcs (3)
60 のようなマルチバイトをワイド文字に
61 変換する関数で使用される。もう一つは
62 .BR wcsrtombs (3)
63 のような
64 ワイド文字をマルチバイトに変換する関数で使用される。しかし両方とも
65 \fImbstate_t\fP に格納され、初期状態として同じ表現を持つ。
66 .PP
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
71 .\"O .BR mbrtowc (3)
72 .\"O do
73 .\"O produce non-initial states when interrupted in the middle of a character.
74 8ビット符号においては全ての状態は初期状態と等価である。
75 UTF-8, EUC-*, BIG5, SJIS のような多バイト符号においてワイド文字から
76 多バイト文字への変換関数は非初期状態にはならない。
77 しかし
78 .BR mbrtowc (3)
79 のような多バイト文字からワイド文字への変換関数では
80 文字の解釈の途中で非初期状態となる場合がある。
81 .PP
82 .\"O One possible way to create an
83 .\"O .I mbstate_t
84 .\"O in initial
85 .\"O state is to set it to zero:
86 初期状態の
87 .I mbstate_t
88 を作成する方法の一つは、それをゼロに設定することである:
89 .nf
90
91     mbstate_t state;
92     memset(&state,0,sizeof(mbstate_t));
93 .fi
94 .PP
95 .\"O On Linux, the following works as well, but might generate compiler warnings:
96 Linux においては以下の方法でも同様であるが、コンパイラーの警告が
97 生成されるかもしれない。
98 .nf
99
100     mbstate_t state = { 0 };
101 .fi
102 .PP
103 .\"O The function
104 .\"O .BR mbsinit ()
105 .\"O tests whether \fI*ps\fP corresponds to an
106 .\"O initial state.
107 .BR mbsinit ()
108 は \fI*ps\fP が初期状態に一致するかどうかを検査する。
109 .\"O .SH "RETURN VALUE"
110 .SH 返り値
111 .\"O .BR mbsinit ()
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.
115 .BR mbsinit ()
116 は \fI*ps\fP が初期状態の場合や NULL ポインターの場合には
117 ゼロ以外を返す。それ以外の場合にはゼロを返す。
118 .\"O .SH "CONFORMING TO"
119 .SH 準拠
120 C99.
121 .\"O .SH NOTES
122 .SH 注意
123 .\"O The behavior of
124 .\"O .BR mbsinit ()
125 .\"O depends on the
126 .\"O .B LC_CTYPE
127 .\"O category of the
128 .\"O current locale.
129 .BR mbsinit ()
130 の動作は現在のロケールの
131 .B LC_CTYPE
132 カテゴリに依存している。
133 .\"O .SH "SEE ALSO"
134 .SH 関連項目
135 .BR mbsrtowcs (3),
136 .BR wcsrtombs (3)