|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 #ifndef __UCONV_TIL_H__ |
|
6 #define __UCONV_TIL_H__ |
|
7 |
|
8 #include "prcpucfg.h" |
|
9 |
|
10 |
|
11 /*=====================================*/ |
|
12 #define PACK(h,l) (int16_t)(( (h) << 8) | (l)) |
|
13 |
|
14 #if defined(IS_LITTLE_ENDIAN) |
|
15 #define ShiftInCell(sub,len,min,max) \ |
|
16 PACK(len,sub), PACK(max,min) |
|
17 #define ShiftOutCell(sub,len,minh,minl,maxh,maxl) \ |
|
18 PACK(len,sub), PACK(minl,minh), PACK(maxl,maxh) |
|
19 #else |
|
20 #define ShiftInCell(sub,len,min,max) \ |
|
21 PACK(sub,len), PACK(min, max) |
|
22 #define ShiftOutCell(sub,len,minh,minl,maxh,maxl) \ |
|
23 PACK(sub,len), PACK(minh,minl), PACK(maxh,maxl) |
|
24 #endif |
|
25 |
|
26 typedef enum { |
|
27 u1ByteCharset = 0, |
|
28 u2BytesCharset, |
|
29 u2BytesGRCharset, |
|
30 u2BytesGRPrefix8FCharset, |
|
31 u2BytesGRPrefix8EA2Charset, |
|
32 u2BytesGRPrefix8EA3Charset, |
|
33 u2BytesGRPrefix8EA4Charset, |
|
34 u2BytesGRPrefix8EA5Charset, |
|
35 u2BytesGRPrefix8EA6Charset, |
|
36 u2BytesGRPrefix8EA7Charset, |
|
37 uDecomposedHangulCharset, |
|
38 uJohabHangulCharset, |
|
39 uJohabSymbolCharset, |
|
40 u4BytesGB18030Charset, |
|
41 u2BytesGR128Charset, |
|
42 uMultibytesCharset, |
|
43 uNumOfCharsetType = uMultibytesCharset |
|
44 } uScanClassID; |
|
45 |
|
46 typedef enum { |
|
47 u1ByteChar = 0, |
|
48 u2BytesChar, |
|
49 u2BytesGRChar, |
|
50 u1BytePrefix8EChar, /* Used by JIS0201 GR in EUC_JP */ |
|
51 uNumOfCharType |
|
52 } uScanSubClassID; |
|
53 |
|
54 typedef struct { |
|
55 unsigned char classID; |
|
56 unsigned char reserveLen; |
|
57 unsigned char shiftin_Min; |
|
58 unsigned char shiftin_Max; |
|
59 } uShiftInCell; |
|
60 |
|
61 typedef struct { |
|
62 int16_t numOfItem; |
|
63 uShiftInCell shiftcell[1]; |
|
64 } uShiftInTableMutable; |
|
65 |
|
66 typedef const uShiftInTableMutable uShiftInTable; |
|
67 |
|
68 typedef struct { |
|
69 unsigned char classID; |
|
70 unsigned char reserveLen; |
|
71 unsigned char shiftout_MinHB; |
|
72 unsigned char shiftout_MinLB; |
|
73 unsigned char shiftout_MaxHB; |
|
74 unsigned char shiftout_MaxLB; |
|
75 } uShiftOutCell; |
|
76 |
|
77 typedef struct { |
|
78 int16_t numOfItem; |
|
79 uShiftOutCell shiftcell[1]; |
|
80 } uShiftOutTableMutable; |
|
81 |
|
82 typedef const uShiftOutTableMutable uShiftOutTable; |
|
83 |
|
84 |
|
85 /*=====================================*/ |
|
86 |
|
87 typedef struct { |
|
88 unsigned char min; |
|
89 unsigned char max; |
|
90 } uRange; |
|
91 |
|
92 /*=====================================*/ |
|
93 |
|
94 typedef uint16_t* uMappingTableMutable; |
|
95 typedef const uint16_t uMappingTable; |
|
96 |
|
97 #endif |
|
98 |