1 /*======================================================================*\ 2 |* Editor mined, definitions *| 3 |* CJK character set <-> Unicode mapping tables *| 4 \*======================================================================*/ 5 6 /* disable CJK encodings on VAX (VMS) and MSDOS */ 7 #if defined (msdos) || defined (VAX) 8 #define noCJKcharmaps 9 #endif 10 11 12 #define use_CJKcharmaps 13 14 #if defined (noCJKcharmaps) || defined (NOCJK) 15 #undef use_CJKcharmaps 16 #endif 17 18 19 /*======================================================================*\ 20 constants 21 \*======================================================================*/ 22 23 #define arrlen(arr) (sizeof (arr) / sizeof (* arr)) 24 25 /** 26 1 byte tags for 2 Unicode character mappings of certain CJK characters; 27 check consistency with: 28 * list uni2_accents in charcode.c 29 * special handling in function iswide 30 */ 31 #define uni2tag_shift 16 32 #define jis2_0x309A 0x80 << uni2tag_shift 33 #define jis2_0x0300 0x81 << uni2tag_shift 34 #define jis2_0x0301 0x82 << uni2tag_shift 35 #define jis2_0x02E5 0x83 << uni2tag_shift 36 #define jis2_0x02E9 0x84 << uni2tag_shift 37 #define hkscs2_0x0304 0x85 << uni2tag_shift 38 #define hkscs2_0x030C 0x86 << uni2tag_shift 39 #define ambiguous 0x88 << uni2tag_shift 40 #undef ambiguous /* not yet implemented */ 41 #define ambiguous 0 42 43 44 #define split_map_entries 45 46 47 /*======================================================================*\ 48 table entry type 49 \*======================================================================*/ 50 51 struct encoding_table_entry { 52 #ifdef split_map_entries 53 unsigned char cjk_ext; 54 unsigned char unicode_high; 55 unsigned short cjk_base; 56 unsigned short unicode_low; 57 #else 58 unsigned int cjk; 59 unsigned int unicode; 60 #endif 61 }; 62 63 64 /*======================================================================*\ 65 table entry macros 66 \*======================================================================*/ 67 68 #ifdef split_map_entries 69 /** 70 For compact representation of encoding mapping tables, the following 71 mappings are used: 72 Unicode table entry 73 XXYYZZ XX, YYZZ 74 75 2 * Unicode special table entry (for JIS) 76 00YYZZ 00yyzz xx, YYZZ (xx >= 80, indicates 2nd char - one of 77 0x309A, 0x0300, 0x0301, 0x02E5, 0x02E9) 78 79 CJK (GB18030) table entry 80 XXYY FF, XXYY 81 XX31YY32 12, YYXX 82 83 CJK (other) table entry 84 XXYY 00, XXYY 85 8FXXYY 8F, XXYY 86 8EXXYYZZ XX, YYZZ (XX >= 90) 87 */ 88 #define map(cjk, unicode) {(cjk >> 16) & 0xFF, (unicode) >> 16, cjk & 0xFFFF, (unicode) & 0xFFFF}, 89 #define mapgbshort(cjk, unicode) {0xFF, (unicode) >> 16, cjk, (unicode) & 0xFFFF}, 90 #define mapgblong(cjk, unicode) {((cjk >> 12) & 0xF0) | (cjk & 0x0F), (unicode) >> 16, (cjk & 0xFF00) | (cjk >> 24), (unicode) & 0xFFFF}, 91 #else 92 #define map(cjk, unicode) {cjk, unicode}, 93 #define mapgb(cjk, unicode) {cjk, unicode}, 94 #endif 95 96 97 /*======================================================================*\ 98 |* end *| 99 \*======================================================================*/ 100