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*/
2277683534Smrg
2377683534Smrg#ifndef LUIT_OTHER_H
2477683534Smrg#define LUIT_OTHER_H 1
2577683534Smrg
267d8f46f5Smrg#ifdef HAVE_CONFIG_H
2777683534Smrg#include "config.h"		/* include this, for self-contained headers */
287d8f46f5Smrg#endif
2977683534Smrg
3077683534Smrg#ifndef GCC_UNUSED
3177683534Smrg#define GCC_UNUSED		/* ARGSUSED */
3277683534Smrg#endif
3377683534Smrg
3477683534Smrg#include <X11/fonts/fontenc.h>
3577683534Smrg
3677683534Smrg#define UChar(n) ((unsigned char)(n))
37a8fdb4bcSmrg
38a8fdb4bcSmrgtypedef struct {
39a8fdb4bcSmrg    FontMapPtr mapping;
40a8fdb4bcSmrg    FontMapReversePtr reverse;
41a8fdb4bcSmrg    int buf;
42a8fdb4bcSmrg} aux_gbk;
43a8fdb4bcSmrg
44a8fdb4bcSmrgtypedef struct {
45a8fdb4bcSmrg    unsigned char buf[4];
46a8fdb4bcSmrg    int buf_ptr, len;
47a8fdb4bcSmrg} aux_utf8;
48a8fdb4bcSmrg
49a8fdb4bcSmrgtypedef struct {
50a8fdb4bcSmrg    FontMapPtr x0208mapping;
51a8fdb4bcSmrg    FontMapPtr x0201mapping;
52a8fdb4bcSmrg    FontMapReversePtr x0208reverse;
53a8fdb4bcSmrg    FontMapReversePtr x0201reverse;
54a8fdb4bcSmrg    int buf;
55a8fdb4bcSmrg} aux_sjis;
56a8fdb4bcSmrg
57a8fdb4bcSmrgtypedef struct {
58a8fdb4bcSmrg    FontMapPtr mapping;
59a8fdb4bcSmrg    FontMapReversePtr reverse;
60a8fdb4bcSmrg    int buf;
61a8fdb4bcSmrg} aux_hkscs;
62a8fdb4bcSmrg
63a8fdb4bcSmrgtypedef struct {
6477683534Smrg    FontMapPtr cs0_mapping;	/* gb18030.2000-0 */
6577683534Smrg    FontMapReversePtr cs0_reverse;
66a8fdb4bcSmrg
6777683534Smrg    FontMapPtr cs1_mapping;	/* gb18030.2000-1 */
6877683534Smrg    FontMapReversePtr cs1_reverse;
69a8fdb4bcSmrg
7077683534Smrg    int linear;			/* set to '1' if stack_gb18030 linearized a 4bytes seq */
7177683534Smrg    int buf[3];
7277683534Smrg    int buf_ptr;
73a8fdb4bcSmrg} aux_gb18030;
74a8fdb4bcSmrg
75a8fdb4bcSmrgtypedef union {
76a8fdb4bcSmrg    aux_gbk gbk;
77a8fdb4bcSmrg    aux_utf8 utf8;
78a8fdb4bcSmrg    aux_sjis sjis;
79a8fdb4bcSmrg    aux_hkscs hkscs;
80a8fdb4bcSmrg    aux_gb18030 gb18030;
81a8fdb4bcSmrg} OtherState, *OtherStatePtr;
82a8fdb4bcSmrg
83a8fdb4bcSmrgint init_gbk(OtherStatePtr);
84a8fdb4bcSmrgunsigned int mapping_gbk(unsigned int, OtherStatePtr);
85a8fdb4bcSmrgunsigned int reverse_gbk(unsigned int, OtherStatePtr);
8677683534Smrgint stack_gbk(unsigned, OtherStatePtr);
87a8fdb4bcSmrg
88a8fdb4bcSmrgint init_utf8(OtherStatePtr);
89a8fdb4bcSmrgunsigned int mapping_utf8(unsigned int, OtherStatePtr);
90a8fdb4bcSmrgunsigned int reverse_utf8(unsigned int, OtherStatePtr);
9177683534Smrgint stack_utf8(unsigned, OtherStatePtr);
92a8fdb4bcSmrg
93a8fdb4bcSmrgint init_sjis(OtherStatePtr);
94a8fdb4bcSmrgunsigned int mapping_sjis(unsigned int, OtherStatePtr);
95a8fdb4bcSmrgunsigned int reverse_sjis(unsigned int, OtherStatePtr);
9677683534Smrgint stack_sjis(unsigned, OtherStatePtr);
97a8fdb4bcSmrg
98a8fdb4bcSmrgint init_hkscs(OtherStatePtr);
99a8fdb4bcSmrgunsigned int mapping_hkscs(unsigned int, OtherStatePtr);
100a8fdb4bcSmrgunsigned int reverse_hkscs(unsigned int, OtherStatePtr);
10177683534Smrgint stack_hkscs(unsigned, OtherStatePtr);
102a8fdb4bcSmrg
103a8fdb4bcSmrgint init_gb18030(OtherStatePtr);
104a8fdb4bcSmrgunsigned int mapping_gb18030(unsigned int, OtherStatePtr);
105a8fdb4bcSmrgunsigned int reverse_gb18030(unsigned int, OtherStatePtr);
10677683534Smrgint stack_gb18030(unsigned, OtherStatePtr);
107a8fdb4bcSmrg
10877683534Smrg#endif /* LUIT_OTHER_H */
109