other.h revision 77683534
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 2677683534Smrg#include "config.h" /* include this, for self-contained headers */ 2777683534Smrg 2877683534Smrg#ifndef GCC_UNUSED 2977683534Smrg#define GCC_UNUSED /* ARGSUSED */ 3077683534Smrg#endif 3177683534Smrg 3277683534Smrg#include <X11/fonts/fontenc.h> 3377683534Smrg 3477683534Smrg#define UChar(n) ((unsigned char)(n)) 35a8fdb4bcSmrg 36a8fdb4bcSmrgtypedef struct { 37a8fdb4bcSmrg FontMapPtr mapping; 38a8fdb4bcSmrg FontMapReversePtr reverse; 39a8fdb4bcSmrg int buf; 40a8fdb4bcSmrg} aux_gbk; 41a8fdb4bcSmrg 42a8fdb4bcSmrgtypedef struct { 43a8fdb4bcSmrg unsigned char buf[4]; 44a8fdb4bcSmrg int buf_ptr, len; 45a8fdb4bcSmrg} aux_utf8; 46a8fdb4bcSmrg 47a8fdb4bcSmrgtypedef struct { 48a8fdb4bcSmrg FontMapPtr x0208mapping; 49a8fdb4bcSmrg FontMapPtr x0201mapping; 50a8fdb4bcSmrg FontMapReversePtr x0208reverse; 51a8fdb4bcSmrg FontMapReversePtr x0201reverse; 52a8fdb4bcSmrg int buf; 53a8fdb4bcSmrg} aux_sjis; 54a8fdb4bcSmrg 55a8fdb4bcSmrgtypedef struct { 56a8fdb4bcSmrg FontMapPtr mapping; 57a8fdb4bcSmrg FontMapReversePtr reverse; 58a8fdb4bcSmrg int buf; 59a8fdb4bcSmrg} aux_hkscs; 60a8fdb4bcSmrg 61a8fdb4bcSmrgtypedef struct { 6277683534Smrg FontMapPtr cs0_mapping; /* gb18030.2000-0 */ 6377683534Smrg FontMapReversePtr cs0_reverse; 64a8fdb4bcSmrg 6577683534Smrg FontMapPtr cs1_mapping; /* gb18030.2000-1 */ 6677683534Smrg FontMapReversePtr cs1_reverse; 67a8fdb4bcSmrg 6877683534Smrg int linear; /* set to '1' if stack_gb18030 linearized a 4bytes seq */ 6977683534Smrg int buf[3]; 7077683534Smrg int buf_ptr; 71a8fdb4bcSmrg} aux_gb18030; 72a8fdb4bcSmrg 73a8fdb4bcSmrgtypedef union { 74a8fdb4bcSmrg aux_gbk gbk; 75a8fdb4bcSmrg aux_utf8 utf8; 76a8fdb4bcSmrg aux_sjis sjis; 77a8fdb4bcSmrg aux_hkscs hkscs; 78a8fdb4bcSmrg aux_gb18030 gb18030; 79a8fdb4bcSmrg} OtherState, *OtherStatePtr; 80a8fdb4bcSmrg 81a8fdb4bcSmrgint init_gbk(OtherStatePtr); 82a8fdb4bcSmrgunsigned int mapping_gbk(unsigned int, OtherStatePtr); 83a8fdb4bcSmrgunsigned int reverse_gbk(unsigned int, OtherStatePtr); 8477683534Smrgint stack_gbk(unsigned, OtherStatePtr); 85a8fdb4bcSmrg 86a8fdb4bcSmrgint init_utf8(OtherStatePtr); 87a8fdb4bcSmrgunsigned int mapping_utf8(unsigned int, OtherStatePtr); 88a8fdb4bcSmrgunsigned int reverse_utf8(unsigned int, OtherStatePtr); 8977683534Smrgint stack_utf8(unsigned, OtherStatePtr); 90a8fdb4bcSmrg 91a8fdb4bcSmrgint init_sjis(OtherStatePtr); 92a8fdb4bcSmrgunsigned int mapping_sjis(unsigned int, OtherStatePtr); 93a8fdb4bcSmrgunsigned int reverse_sjis(unsigned int, OtherStatePtr); 9477683534Smrgint stack_sjis(unsigned, OtherStatePtr); 95a8fdb4bcSmrg 96a8fdb4bcSmrgint init_hkscs(OtherStatePtr); 97a8fdb4bcSmrgunsigned int mapping_hkscs(unsigned int, OtherStatePtr); 98a8fdb4bcSmrgunsigned int reverse_hkscs(unsigned int, OtherStatePtr); 9977683534Smrgint stack_hkscs(unsigned, OtherStatePtr); 100a8fdb4bcSmrg 101a8fdb4bcSmrgint init_gb18030(OtherStatePtr); 102a8fdb4bcSmrgunsigned int mapping_gb18030(unsigned int, OtherStatePtr); 103a8fdb4bcSmrgunsigned int reverse_gb18030(unsigned int, OtherStatePtr); 10477683534Smrgint stack_gb18030(unsigned, OtherStatePtr); 105a8fdb4bcSmrg 10677683534Smrg#endif /* LUIT_OTHER_H */ 107