other.h revision a8fdb4bc
1a8fdb4bcSmrg/*
2a8fdb4bcSmrgCopyright (c) 2002 by Tomohiro KUBOTA
3a8fdb4bcSmrg
4a8fdb4bcSmrgPermission is hereby granted, free of charge, to any person obtaining a copy
5a8fdb4bcSmrgof this software and associated documentation files (the "Software"), to deal
6a8fdb4bcSmrgin the Software without restriction, including without limitation the rights
7a8fdb4bcSmrgto use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8a8fdb4bcSmrgcopies of the Software, and to permit persons to whom the Software is
9a8fdb4bcSmrgfurnished to do so, subject to the following conditions:
10a8fdb4bcSmrg
11a8fdb4bcSmrgThe above copyright notice and this permission notice shall be included in
12a8fdb4bcSmrgall copies or substantial portions of the Software.
13a8fdb4bcSmrg
14a8fdb4bcSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15a8fdb4bcSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16a8fdb4bcSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17a8fdb4bcSmrgAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18a8fdb4bcSmrgLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19a8fdb4bcSmrgOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20a8fdb4bcSmrgTHE SOFTWARE.
21a8fdb4bcSmrg*/
22a8fdb4bcSmrg/* $XFree86: xc/programs/luit/other.h,v 1.1 2002/10/17 01:06:09 dawes Exp $ */
23a8fdb4bcSmrg
24a8fdb4bcSmrgtypedef struct {
25a8fdb4bcSmrg    FontMapPtr mapping;
26a8fdb4bcSmrg    FontMapReversePtr reverse;
27a8fdb4bcSmrg    int buf;
28a8fdb4bcSmrg} aux_gbk;
29a8fdb4bcSmrg
30a8fdb4bcSmrgtypedef struct {
31a8fdb4bcSmrg    unsigned char buf[4];
32a8fdb4bcSmrg    int buf_ptr, len;
33a8fdb4bcSmrg} aux_utf8;
34a8fdb4bcSmrg
35a8fdb4bcSmrgtypedef struct {
36a8fdb4bcSmrg    FontMapPtr x0208mapping;
37a8fdb4bcSmrg    FontMapPtr x0201mapping;
38a8fdb4bcSmrg    FontMapReversePtr x0208reverse;
39a8fdb4bcSmrg    FontMapReversePtr x0201reverse;
40a8fdb4bcSmrg    int buf;
41a8fdb4bcSmrg} aux_sjis;
42a8fdb4bcSmrg
43a8fdb4bcSmrgtypedef struct {
44a8fdb4bcSmrg    FontMapPtr mapping;
45a8fdb4bcSmrg    FontMapReversePtr reverse;
46a8fdb4bcSmrg    int buf;
47a8fdb4bcSmrg} aux_hkscs;
48a8fdb4bcSmrg
49a8fdb4bcSmrgtypedef struct {
50a8fdb4bcSmrg    FontMapPtr          cs0_mapping;    /* gb18030.2000-0 */
51a8fdb4bcSmrg    FontMapReversePtr   cs0_reverse;
52a8fdb4bcSmrg
53a8fdb4bcSmrg    FontMapPtr          cs1_mapping;    /* gb18030.2000-1 */
54a8fdb4bcSmrg    FontMapReversePtr   cs1_reverse;
55a8fdb4bcSmrg
56a8fdb4bcSmrg    int     linear;     /* set to '1' if stack_gb18030 linearized a 4bytes seq */
57a8fdb4bcSmrg    int     buf[3];
58a8fdb4bcSmrg    int     buf_ptr;
59a8fdb4bcSmrg} aux_gb18030;
60a8fdb4bcSmrg
61a8fdb4bcSmrgtypedef union {
62a8fdb4bcSmrg    aux_gbk gbk;
63a8fdb4bcSmrg    aux_utf8 utf8;
64a8fdb4bcSmrg    aux_sjis sjis;
65a8fdb4bcSmrg    aux_hkscs hkscs;
66a8fdb4bcSmrg    aux_gb18030 gb18030;
67a8fdb4bcSmrg} OtherState, *OtherStatePtr;
68a8fdb4bcSmrg
69a8fdb4bcSmrgint init_gbk(OtherStatePtr);
70a8fdb4bcSmrgunsigned int mapping_gbk(unsigned int, OtherStatePtr);
71a8fdb4bcSmrgunsigned int reverse_gbk(unsigned int, OtherStatePtr);
72a8fdb4bcSmrgint stack_gbk(unsigned char, OtherStatePtr);
73a8fdb4bcSmrg
74a8fdb4bcSmrgint init_utf8(OtherStatePtr);
75a8fdb4bcSmrgunsigned int mapping_utf8(unsigned int, OtherStatePtr);
76a8fdb4bcSmrgunsigned int reverse_utf8(unsigned int, OtherStatePtr);
77a8fdb4bcSmrgint stack_utf8(unsigned char, OtherStatePtr);
78a8fdb4bcSmrg
79a8fdb4bcSmrgint init_sjis(OtherStatePtr);
80a8fdb4bcSmrgunsigned int mapping_sjis(unsigned int, OtherStatePtr);
81a8fdb4bcSmrgunsigned int reverse_sjis(unsigned int, OtherStatePtr);
82a8fdb4bcSmrgint stack_sjis(unsigned char, OtherStatePtr);
83a8fdb4bcSmrg
84a8fdb4bcSmrgint init_hkscs(OtherStatePtr);
85a8fdb4bcSmrgunsigned int mapping_hkscs(unsigned int, OtherStatePtr);
86a8fdb4bcSmrgunsigned int reverse_hkscs(unsigned int, OtherStatePtr);
87a8fdb4bcSmrgint stack_hkscs(unsigned char, OtherStatePtr);
88a8fdb4bcSmrg
89a8fdb4bcSmrgint init_gb18030(OtherStatePtr);
90a8fdb4bcSmrgunsigned int mapping_gb18030(unsigned int, OtherStatePtr);
91a8fdb4bcSmrgunsigned int reverse_gb18030(unsigned int, OtherStatePtr);
92a8fdb4bcSmrgint stack_gb18030(unsigned char, OtherStatePtr);
93a8fdb4bcSmrg
94