1 /* -*- c-basic-offset:2; tab-width:2; indent-tabs-mode:nil -*- */
2
3 #include "ef_ko_kr_map.h"
4
5 #include "ef_iso2022_intern.h"
6 #include "ef_ucs4_map.h"
7 #include "ef_ucs4_ksc5601.h"
8 #include "ef_ucs4_uhc.h"
9 #include "ef_ucs4_johab.h"
10 #include "ef_tblfunc_loader.h"
11
12 /*
13 * johab <=> ucs4 conversion is so simple without conversion table that
14 * ucs4 -> johab conversion is done first of all.
15 */
16 static ef_map_ucs4_to_func_t map_ucs4_to_funcs[] = {
17 ef_map_ucs4_to_johab, ef_map_ucs4_to_ksc5601_1987, ef_map_ucs4_to_uhc,
18
19 };
20
21 /* --- global functions --- */
22
ef_map_ucs4_to_ko_kr(ef_char_t * kokr,ef_char_t * ucs4)23 int ef_map_ucs4_to_ko_kr(ef_char_t *kokr, ef_char_t *ucs4) {
24 return ef_map_ucs4_to_with_funcs(kokr, ucs4, map_ucs4_to_funcs,
25 sizeof(map_ucs4_to_funcs) / sizeof(map_ucs4_to_funcs[0]));
26 }
27
ef_map_uhc_to_ksc5601_1987(ef_char_t * ksc,ef_char_t * uhc)28 int ef_map_uhc_to_ksc5601_1987(ef_char_t *ksc, ef_char_t *uhc) {
29 if (0xa1 <= uhc->ch[0] && uhc->ch[0] <= 0xfe && 0xa1 <= uhc->ch[1] && uhc->ch[1] <= 0xfe) {
30 ksc->ch[0] = UNMAP_FROM_GR(uhc->ch[0]);
31 ksc->ch[1] = UNMAP_FROM_GR(uhc->ch[1]);
32 ksc->size = 2;
33 ksc->cs = KSC5601_1987;
34
35 return 1;
36 } else {
37 return 0;
38 }
39 }
40
ef_map_ksc5601_1987_to_uhc(ef_char_t * uhc,ef_char_t * ksc)41 int ef_map_ksc5601_1987_to_uhc(ef_char_t *uhc, ef_char_t *ksc) {
42 uhc->ch[0] = MAP_TO_GR(ksc->ch[0]);
43 uhc->ch[1] = MAP_TO_GR(ksc->ch[1]);
44 uhc->size = 2;
45 uhc->cs = UHC;
46
47 return 1;
48 }
49
50 #ifdef NO_DYNAMIC_LOAD_TABLE
51
52 #include "../module/ef_uhc_johab.c"
53
54 #else
55
56 ef_map_func2(kokr, ef_map_johab_to_uhc)
57
58 ef_map_func2(kokr, ef_map_uhc_to_johab)
59
60 #endif
61