static char jamo_index1[]= { /* 0:fill, 2:¤¡, ... */ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static char jamo_index2[]= { /* 0:fill 1:¤¿, ... */ 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 6, 7, 8, 9, 10, 11, 0, 0, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 21, 0, 0 }; static char jamo_index3[]= { /* 0:fill, 2:¤¡, ... */ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 0 }; #define JOHAB_MODE 0 int convert_3_to_jo844(f, m, l, des) int f, m, l; int *des; { #undef JOHAB_8_4_4 #define JOHAB_32_11_11 #ifdef JOHAB_32_11_11 #define JOHAB_KIND_LCON 32 #define JOHAB_KIND_MVOW 11 #define JOHAB_KIND_FCON 11 #define JOHAB_FONT_LCON 0x100 #define JOHAB_FONT_MVOW 0x100 #define JOHAB_FONT_FCON 0x100 #define JOHAB_BASE_LCON 0x1000 #define JOHAB_BASE_MVOW 0x3000 #define JOHAB_BASE_FCON 0x4000 #endif // JOHAB_32_11_11 #ifdef JOHAB_8_4_4 #define JOHAB_KIND_LCON 8 #define JOHAB_KIND_MVOW 4 #define JOHAB_KIND_FCON 4 #define JOHAB_FONT_LCON 20 #define JOHAB_FONT_MVOW 22 #define JOHAB_FONT_FCON 28 #define JOHAB_BASE_LCON 0 #define JOHAB_BASE_MVOW JOHAB_FONT_LCON*JOHAB_KIND_LCON+JOHAB_BASE_LCON #define JOHAB_BASE_FCON JOHAB_FONT_MVOW*JOHAB_KIND_MVOW+JOHAB_BASE_MVOW #endif // JOHAB_8_4_4 #ifdef JOHAB_32_11_11 #define FCON_BY_LCON 1 #define VOW_KIND 8 /* Áß¼ºÀÇ ¸ð¾ç Á¾·ù¸¦ 8°³·Î ³ª´® */ /* ÀÌ ¸ð¾çÀÇ °³¼ö´ë·Î Ãʼº ¹ú¼ö°¡ ÀÖ´Ù */ /* µû¶ó¼­, ¹ÞħÀÌ ¾øÀ» ¶§, Ãʼº ¹ú ¼ö 8°³ */ // static char lcon_by_vow[]= { // 0, // 0, 1, 0, 1, 0, 1, 0, 1, 2, 3, // 4, 3, 2, 5, 6, 7, 6, 5, 2, 3, // 0 // }; static char lcon_by_vow_0_fcon[] = { 0, /* ±âº» Áß¼º¹ú */ 0, /* ¤¿ */ 1, /* ¤À */ 0, /* ¤Á */ 1, /* ¤Â */ 0, /* ¤Ã */ 1, /* ¤Ä */ 0, /* ¤Å */ 1, /* ¤Æ */ 2, /* ¤Ç */ 3, /* ¤È */ 4, /* ¤É */ 3, /* ¤Ê */ 2, /* ¤Ë */ 5, /* ¤Ì */ 6, /* ¤Í */ 7, /* ¤Î */ 6, /* ¤Ï */ 5, /* ¤Ð */ 2, /* ¤Ñ */ 3, /* ¤Ò */ 0, /* ¤Ó */ 0 /* */ }; // static char fcon_by_vow_0_fcon[]= { // 0, // 0, 1, 0, 1, 2, 1, 2, 1, 3, 7, // 7, 7, 3, 5, 7, 7, 7, 5, 3, 7, // 0 // }; static char lcon_by_vow_1_fcon[] = { 0, /* ±âº» Áß¼º¹ú */ 8, /* ¤¿ */ 9, /* ¤À */ 8, /* ¤Á */ 9, /* ¤Â */ 8, /* ¤Ã */ 9, /* ¤Ä */ 8, /* ¤Å */ 9, /* ¤Æ */ 10, /* ¤Ç */ 11, /* ¤È */ 12, /* ¤É */ 11, /* ¤Ê */ 10, /* ¤Ë */ 13, /* ¤Ì */ 14, /* ¤Í */ 15, /* ¤Î */ 14, /* ¤Ï */ 13, /* ¤Ð */ 10, /* ¤Ñ */ 11, /* ¤Ò */ 8, /* ¤Ó */ 0 /* */ }; static char fcon_by_vow[] = { 0, /* ±âº» Áß¼º¹ú */ 0, /* ¤¿ */ 1, /* ¤À */ 0, /* ¤Á */ 1, /* ¤Â */ 2, /* ¤Ã */ 1, /* ¤Ä */ 2, /* ¤Å */ 1, /* ¤Æ */ 3, /* ¤Ç */ 7, /* ¤È */ 9, /* ¤É */ 7, /* ¤Ê */ 3, /* ¤Ë */ 5, /* ¤Ì */ 7, /* ¤Í */ 9, /* ¤Î */ 7, /* ¤Ï */ 5, /* ¤Ð */ 3, /* ¤Ñ */ 7, /* ¤Ò */ 0, /* ¤Ó */ 0 /* */ }; static char vow_by_lcon[] = { /* ÃʼºÀÌ [¤¡,¤»] [¤©,¤º,¤¼,¤¾] ÀÏ ¶§¿¡ µû¶ó¼­ Áß¼º ºÐ·ù */ 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 2, 0, 2, 0 }; static char vow_by_fcon[] = { 0, 2, 2, 2, 5, 2, 2, 2, 8, 8, 8, 8, 8, 8, 8, 8, 2, 2, 2, 2, 2, 2, 2, 8, 2, 8, 2, 8, 0, 0, 0 }; /* Á¾¼ºÀÇ Á¾·ù´Â ¾øÀ» °æ¿ì±îÁö ÇÕÇØ¼­ 4Á¾·ù */ static char lcon_by_fcon[] = { 0, /* ±âº» */ 0, /* ¤¡ */ 0, /* ¤¡¤¡ */ 0, /* ¤¡¤µ */ 0, /* ¤¤ */ 0, /* ¤¤¤¸ */ 0, /* ¤¤¤¾ */ 0, /* ¤§ */ 8, /* ¤© */ 8, /* ¤©¤¡ */ 8, /* ¤©¤± */ 8, /* ¤©¤² */ 8, /* ¤©¤µ */ 8, /* ¤©¤¼ */ 8, /* ¤©¤½ */ 8, /* ¤©¤¾ */ 0, /* ¤± */ 0, /* ¤² */ 0, /* ¤²¤µ */ 0, /* ¤µ */ 0, /* ¤µ¤µ */ 0, /* ¤· */ 0, /* ¤¸ */ 8, /* ¤º */ 0, /* ¤» */ 8, /* ¤¼ */ 0, /* ¤½ */ 8, /* ¤¾ */ 0 /* */ }; /* static char lcon_by_fcon[] = { 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 0, 8, 0, 0, 0 }; */ static char fcon_by_lcon[] = { 0, /* default */ 0, /* ¤¡ */ 0, /* ¤¢ */ 0, /* ¤¤ */ 0, /* ¤§ */ 0, /* ¤¨ */ 1, /* ¤© */ 0, /* ¤± */ 0, /* ¤² */ 0, /* ¤³ */ 0, /* ¤µ */ 0, /* ¤¶ */ 0, /* ¤· */ 0, /* ¤¸ */ 0, /* ¤¹ */ 1, /* ¤º */ 0, /* ¤» */ 1, /* ¤¼ */ 0, /* ¤½ */ 1, /* ¤¾ */ 0 /* */ }; #endif #ifdef JOHAB_8_4_4 #define FCON_BY_LCON 0 #define VOW_KIND 5 static char lcon_by_vow_0_fcon[]= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 1, 2, 4, 4, 4, 2, 1, 3, 0 }; static char lcon_by_vow_1_fcon[]= { 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 7, 7, 7, 6, 6, 7, 7, 7, 6, 6, 7, 5, }; static char vow_by_lcon[] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 }; static char vow_by_fcon[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0 }; static char fcon_by_vow[]= { 0, 0, 2, 0, 2, 1, 2, 1, 2, 3, 0, 2, 1, 3, 3, 1, 2, 1, 3, 3, 1, 1 }; #endif unsigned h1, h2, h3, type1, type2, type3; int ind; int i=0; int show_mode=JOHAB_MODE; if (f==0xff || f < 1 || f > 20 || m < 2 || m > 29 || l < 1 || l > 29) { des[0] = 0; /* °ø¹é */ return 1; } h1 = jamo_index1[f]; h2 = jamo_index2[m]; h3 = jamo_index3[l]; /* ÃʼºÁ¾·ù : Áß¼ºµû¶ó/Á¾¼ºµû¶ó */ type1 = (h3||show_mode) ? lcon_by_vow_1_fcon[h2] + lcon_by_fcon[h3]: lcon_by_vow_0_fcon[h2]; /* Áß¼ºÁ¾·ù : Á¾¼ºÀÌ ÀÖÀ¸¸é ÃʼºÀÌ [¤¡¤»][¤©¤º¤¼¤¾][ÀϹÝ]À¸·Î ³ª´©°í, Á¾¼ºÀÌ ¾øÀ¸¸é Ãʼº¿¡ µû¶ó [¤¡¤»][ÀϹÝ]À¸·Î ³ª´©°í. */ type2 = h3 ? vow_by_lcon[h1] + vow_by_fcon[h3]: (vow_by_lcon[h1] == 1 ? vow_by_lcon[h1]:0); // Á¾¼ºÀÌ ÀÖÀ» °æ¿ì, ÃʼºÀÌ ¤¡,ÀϹÝ,¤© ¿¡ ´ëÇØ // Á¾¼ºÀÌ ¾øÀ» °æ¿ì, ÃʼºÀÌ ¤¡ ÀÏ °æ¿ì¸¸, /* type2 = ((h3||show_mode) ? vow_by_fcon[h3]+vow_by_lcon[h1]// + // (((h1==8||h1==9) && vow_kind[h2]) ? 2:0) // for º¼,»Ê : vow_by_lcon[h1]&0x01); */ /* Á¾¼ºÁ¾·ù : ¤© ¤º ¤¼ ¤¾ */ type3 = fcon_by_vow[h2] + ((fcon_by_vow[h2] > 2) ? fcon_by_lcon[h1]:0); // Áß¼ºÀÌ ¤Ã¤¿¤Ä¤Æ µîÀÏ °æ¿ì´Â ¤©,¤¡ ÀÇ ÃʼºÀ» ±¸ºÐ ¾ÈÇÑ´Ù /* type3 = fcon_by_vow[h2] + ((h1 ==6||h1 ==15 || h1==17 || h1==19) && (h2 >= 9 && h2 <=20) ? FCON_BY_LCON:0); */ // printf("h1:%d h2:%d h3:%d\n",h1,h2,h3); // printf("t1:%d t2:%d t3:%d\n",type1,type2,type3); i = 0; if (h1) { ind = type1 * JOHAB_FONT_LCON + JOHAB_BASE_LCON + h1; des[i++] = ind; } if (h2) { ind = type2 * JOHAB_FONT_MVOW + JOHAB_BASE_MVOW + h2; des[i++] = ind; } if (h3) { ind = type3 * JOHAB_FONT_FCON + JOHAB_BASE_FCON + h3; des[i++] = ind; } else if (show_mode) { des[i++] = 0; } if (f != 1 && m == 2 && l == 1) { des[i++] = 0; } return i; }