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