File: mbsinit.3

package info (click to toggle)
manpages-ja 0.5.0.0.20210215%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 28,568 kB
  • sloc: perl: 161; makefile: 58
file content (77 lines) | stat: -rw-r--r-- 3,897 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
.\" 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.
.\" %%%LICENSE_END
.\"
.\" 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
.\"
.\"*******************************************************************
.\"
.\" This file was generated with po4a. Translate the source file.
.\"
.\"*******************************************************************
.\"
.\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
.\"         all rights reserved.
.\" Translated Tue Jan 11 00:56:13 JST 2000
.\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\"
.TH MBSINIT 3 2014\-03\-18 GNU "Linux Programmer's Manual"
.SH 名前
mbsinit \- 初期シフト状態かどうかを検査する
.SH 書式
.nf
\fB#include <wchar.h>\fP
.sp
\fBint mbsinit(const mbstate_t *\fP\fIps\fP\fB);\fP
.fi
.SH 説明
文字をマルチバイト表現とワイド文字表現の間で変換する場合には \fImbstate_t\fP 型の変換状態を使用する。文字列の変換は有限状態マシン
を使用する。いくらかの文字の変換を完了した後に、残りの文字を処理する ために状態を保存しておく必要があるかもしれない。このような変換状態は
ISO\-2022 や UTF\-7 のような符号を扱うのに必要とされる。
.PP
初期状態とは文字列の変換を開始する時の状態である。状態には二種類が 存在し、一つは \fBmbsrtowcs\fP(3)  のようなマルチバイトをワイド文字に
変換する関数で使用される。もう一つは \fBwcsrtombs\fP(3)  のような ワイド文字をマルチバイトに変換する関数で使用される。しかし両方とも
\fImbstate_t\fP に格納され、初期状態として同じ表現を持つ。
.PP
8ビット符号においては全ての状態は初期状態と等価である。 UTF\-8, EUC\-*, BIG5, SJIS のような多バイト符号においてワイド文字から
多バイト文字への変換関数は非初期状態にはならない。 しかし \fBmbrtowc\fP(3)  のような多バイト文字からワイド文字への変換関数では
文字の解釈の途中で非初期状態となる場合がある。
.PP
初期状態の \fImbstate_t\fP を作成する方法の一つは、それをゼロに設定することである:
.nf

    mbstate_t state;
    memset(&state,0,sizeof(mbstate_t));
.fi
.PP
Linux においては以下の方法でも同様であるが、コンパイラーの警告が 生成されるかもしれない。
.nf

    mbstate_t state = { 0 };
.fi
.PP
\fBmbsinit\fP()  は \fI*ps\fP が初期状態に一致するかどうかを検査する。
.SH 返り値
\fBmbsinit\fP()  は \fI*ps\fP が初期状態の場合や NULL の場合には ゼロ以外を返す。それ以外の場合にはゼロを返す。
.SH 属性
.SS "マルチスレッディング (pthreads(7) 参照)"
関数 \fBmbsinit\fP() はスレッドセーフである。
.SH 準拠
C99.
.SH 注意
\fBmbsinit\fP()  の動作は現在のロケールの \fBLC_CTYPE\fP カテゴリーに依存している。
.SH 関連項目
\fBmbrlen\fP(3), \fBmbrtowc\fP(3), \fBwcrtomb\fP(3), \fBmbsrtowcs\fP(3), \fBwcsrtombs\fP(3)
.SH この文書について
この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。