aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/xlibi18n/lcUniConv
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 12:38:10 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 12:38:10 +0000
commitc87efef42f76c2ff0dcfad2842ab369beffd21de (patch)
tree0ded972bd95879c77ed8fae6c84d0657fbdba660 /libX11/src/xlibi18n/lcUniConv
parent1dad159fe09ac3a88b21b98544880e5ecc0e8d54 (diff)
downloadvcxsrv-c87efef42f76c2ff0dcfad2842ab369beffd21de.tar.gz
vcxsrv-c87efef42f76c2ff0dcfad2842ab369beffd21de.tar.bz2
vcxsrv-c87efef42f76c2ff0dcfad2842ab369beffd21de.zip
Added libX11-1.2.2.tar.gz.
Diffstat (limited to 'libX11/src/xlibi18n/lcUniConv')
-rw-r--r--libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c47
-rw-r--r--libX11/src/xlibi18n/lcUniConv/ksc5601.h12
2 files changed, 53 insertions, 6 deletions
diff --git a/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c b/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c
index f3cc1e0e4..971314476 100644
--- a/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c
+++ b/libX11/src/xlibi18n/lcUniConv/cjk_tab_to_h.c
@@ -18,6 +18,8 @@
* ./cjk_tab_to_h BIG5 big5 > big5.h < BIG5.TXT
*
* ./cjk_tab_to_h JOHAB johab > johab.h < JOHAB.TXT
+ *
+ * ./cjk_tab_to_h BIG5HKSCS-0 big5hkscs >big5hkscs.h < BIG5HKSCS.TXT
*/
#include <stdio.h>
@@ -892,6 +894,49 @@ static void do_big5 (const char* name)
invert(&enc); output_uni2charset_sparse(name,&enc);
}
+/* Big5-HKSCS specifics */
+
+static int row_byte_big5hkscs (int row) {
+ return 0x81+row;
+}
+static int col_byte_big5hkscs (int col) {
+ return (col >= 0x3f ? 0x62 : 0x40) + col;
+}
+static int byte_row_big5hkscs (int byte) {
+ if (byte >= 0x81 && byte < 0xff)
+ return byte-0x81;
+ else
+ return -1;
+}
+static int byte_col_big5hkscs (int byte) {
+ if (byte >= 0x40 && byte < 0x7f)
+ return byte-0x40;
+ else if (byte >= 0xa1 && byte < 0xff)
+ return byte-0x62;
+ else
+ return -1;
+}
+
+static void do_big5hkscs (const char* name)
+{
+ Encoding enc;
+
+ enc.rows = 126;
+ enc.cols = 157;
+ enc.row_byte = row_byte_big5hkscs;
+ enc.col_byte = col_byte_big5hkscs;
+ enc.byte_row = byte_row_big5hkscs;
+ enc.byte_col = byte_col_big5hkscs;
+ enc.check_row_expr = "%1$s >= 0x81 && %1$s < 0xff";
+ enc.check_col_expr = "(%1$s >= 0x40 && %1$s < 0x7f) || (%1$s >= 0xa1 && %1$s < 0xff)";
+ enc.byte_row_expr = "%1$s - 0x81";
+ enc.byte_col_expr = "%1$s - (%1$s >= 0xa1 ? 0x62 : 0x40)";
+
+ read_table(&enc);
+ output_charset2uni(name,&enc);
+ invert(&enc); output_uni2charset_sparse(name,&enc);
+}
+
/* Johab Hangul specifics */
static int row_byte_johab_hangul (int row) {
@@ -1014,6 +1059,8 @@ int main (int argc, char *argv[])
do_ksc5601(name);
else if (!strcmp(name,"big5") || !strcmp(name,"cp950ext"))
do_big5(name);
+ else if (!strcmp(name,"big5hkscs"))
+ do_big5hkscs(name);
else if (!strcmp(name,"johab_hangul"))
do_johab_hangul(name);
else if (!strcmp(name,"cp932ext"))
diff --git a/libX11/src/xlibi18n/lcUniConv/ksc5601.h b/libX11/src/xlibi18n/lcUniConv/ksc5601.h
index 7e2a4623e..1b5c62d07 100644
--- a/libX11/src/xlibi18n/lcUniConv/ksc5601.h
+++ b/libX11/src/xlibi18n/lcUniConv/ksc5601.h
@@ -2968,17 +2968,17 @@ ksc5601_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
const Summary16 *summary = NULL;
if (wc < 0x0460)
summary = &ksc5601_uni2indx_page00[(wc>>4)];
- else if (wc >= 0x2000 && wc < 0x2670)
+ else if (wc >= 0x2000 && wc < 0x2670) /* General Punctuation (2000, 206F) */
summary = &ksc5601_uni2indx_page20[(wc>>4)-0x200];
- else if (wc >= 0x3000 && wc < 0x33e0)
+ else if (wc >= 0x3000 && wc < 0x33e0) /* CJK Symbols and Punctuation (3000, 303F) */
summary = &ksc5601_uni2indx_page30[(wc>>4)-0x300];
- else if (wc >= 0x4e00 && wc < 0x9fa0)
+ else if (wc >= 0x4e00 && wc < 0x9fa0) /* CJK Unified Ideographs (4E00, 9FFF) */
summary = &ksc5601_uni2indx_page4e[(wc>>4)-0x4e0];
- else if (wc >= 0xac00 && wc < 0xd7a0)
+ else if (wc >= 0xac00 && wc < 0xd7a0) /* Hangul Syllables (AC00, D7AF) 11183 */
summary = &ksc5601_uni2indx_pageac[(wc>>4)-0xac0];
- else if (wc >= 0xf900 && wc < 0xfa10)
+ else if (wc >= 0xf900 && wc < 0xfa10) /* CJK Compatibility Ideographs (F900, FAFF) */
summary = &ksc5601_uni2indx_pagef9[(wc>>4)-0xf90];
- else if (wc >= 0xff00 && wc < 0xfff0)
+ else if (wc >= 0xff00 && wc < 0xfff0) /* Halfwidth and Fullwidth Forms (FF00, FFEF) */
summary = &ksc5601_uni2indx_pageff[(wc>>4)-0xff0];
if (summary) {
unsigned short used = summary->used;