diff options
| author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-07 08:15:33 -0300 |
|---|---|---|
| committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-07 09:23:59 -0300 |
| commit | 998541eb043b3effe28a238dd583fe845ce1ba1d (patch) | |
| tree | 0ef75b91e4602b169aae261879e7656959c1245d /src | |
| parent | 477031c03b2c525b117fae8a9b61c98245a06908 (diff) | |
| download | rneovim-998541eb043b3effe28a238dd583fe845ce1ba1d.tar.gz rneovim-998541eb043b3effe28a238dd583fe845ce1ba1d.tar.bz2 rneovim-998541eb043b3effe28a238dd583fe845ce1ba1d.zip | |
Remove hangul input support
Vim [documentation](http://vimdoc.sourceforge.net/htmldoc/hangulin.html), says
that hangul support is scheduled to be removed. I think it's safe to say we
don't want to support a feature even vim is considering removing.
Everything still compiles even after removing the header, so it's not being
used.
Before doing the initial import to neovim's repository, I had to tweak this
module to make it compile for terminal. It was a mistake that is now being
corrected.
Diffstat (limited to 'src')
| -rw-r--r-- | src/hangulin.c | 1495 | ||||
| -rw-r--r-- | src/hangulin.h | 12 |
2 files changed, 0 insertions, 1507 deletions
diff --git a/src/hangulin.c b/src/hangulin.c deleted file mode 100644 index 74972d23e2..0000000000 --- a/src/hangulin.c +++ /dev/null @@ -1,1495 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved by Bram Moolenaar - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. - */ - -#include "vim.h" -#include "hangulin.h" -#include "message.h" -#include "misc1.h" -#include "screen.h" -#include "term.h" -#include "ui.h" -#include "os/os.h" - -#ifndef HANGUL_DEFAULT_KEYBOARD -# define HANGUL_DEFAULT_KEYBOARD 3 -#endif - -#define AUTOMATA_NEW 0 -#define AUTOMATA_CORRECT 1 -#define AUTOMATA_SPECIAL 2 -#define AUTOMATA_CORRECT_NEW 3 -#define AUTOMATA_ERROR 4 -#define AUTOMATA_NULL 5 - -#define F_F 0x1 /* 초성 (initial sound) */ -#define F_M 0x2 /* 중성 (medial vowel) */ -#define F_L 0x4 /* 종성 (final consonant) */ -#define F_A 0x8 /* ASCII */ -#define F_NULL 1 -#define M_NULL 2 -#define L_NULL 1 - -static int hangul_input_state = 0; -static int f=F_NULL, m=M_NULL, l=L_NULL; -static int sp=0; -static char_u stack[20] = {0}; -static int last_l = -1, last_ll = -1; -static int hangul_keyboard_type = HANGUL_DEFAULT_KEYBOARD; - -static void convert_ks_to_3(const char_u *src, int *fp, int *mp, int *lp); -static int convert_3_to_ks(int fv, int mv, int lv, char_u *des); -static int hangul_automata2(char_u *buf, unsigned int *c); -static int hangul_automata3(char_u *buf, unsigned int *c); - -#define push(x) {stack[ sp++ ] = *(x); stack[sp++] = *((x)+1); } -#define pop(x) {*((x) + 1) = stack[--sp]; *(x) = stack[--sp]; } -#define query(x) {*((x) + 1) = stack[sp - 1]; *(x) = stack[sp - 2]; } - -#define convert_3_to_code convert_3_to_ks - - -/**********************************************************************/ -/****** 3 벌식자판을 위한 루틴 (Routines for 3 bulsik keyboard) ******/ -/**********************************************************************/ - -/* 3 벌식에서 자판 변환 (3 bulsik keyboard conversion) */ - -static char_u value_table_for_3[] = -{ - 24, '"', '#', '$', '%', '&', /* ! " # $ % & */ - 18, '(', ')', '*', '+', ',', /* ' ( ) * + , */ - '-', '.', 13, 17, 29, 22, /* - . / 0 1 2 */ - 19, 19, 26, 5, 12, 28, /* 3 4 5 6 7 8 */ - 20, ':', 9, '2', '=', '3', /* 9 : ; < = > */ - '?', '@', 8, '!', 11, 10, /* ? @ A B C D */ - 26, 3, '/', 39, '8', '4', /* E F G H I J */ - '5', '6', '1', '0', '9', '>', /* K L M N O P */ - 28, 6, 7, ';', '7', 16, /* Q R S T U V */ - 27, 20, '<', 25, '[', 92, /* W X Y Z [ \ */ - ']', '^', '_', '`', 23, 20, /* ] ^ _ ` a b */ - 10, 29, 11, 3, 27, 4, /* c d e f g h */ - 8, 13, 2, 14, 20, 11, /* i j k l m n */ - 16, 19, 21, 4, 5, 7, /* o p q r s t */ - 5, 13, 9, 2, 7, 17, /* u v w x y z */ -}; - -static short_u kind_table_for_3[] = -{ - F_L, F_A, F_A, F_A, F_A, F_A, /* ! " # $ % & */ - F_F, F_A, F_A, F_A, F_A, F_A, /* ' ( ) * + , */ - F_A, F_A, F_M, F_F, F_L, F_L, /* - . / 0 1 2 */ - F_L, F_M, F_M, F_M, F_M, F_M, /* 3 4 5 6 7 8 */ - F_M, F_A, F_F, F_A, F_A, F_A, /* 9 : ; < = > */ - F_A, F_A, F_L, F_A, F_L, F_L, /* ? @ A B C D */ - F_L, F_L, F_A, F_A, F_A, F_A, /* E F G H I J */ - F_A, F_A, F_A, F_A, F_A, F_A, /* K L M N O P */ - F_L, F_M, F_L, F_A, F_A, F_L, /* Q R S T U V */ - F_L, F_L, F_A, F_L, F_A, F_A, /* W X Y Z [ \ */ - F_A, F_A, F_A, F_A, F_L, F_M, /* ] ^ _ ` a b */ - F_M, F_M, F_M, F_M, F_M, F_F, /* c d e f g h */ - F_F, F_F, F_F, F_F, F_F, F_F, /* i j k l m n */ - F_F, F_F, F_L, F_M, F_L, F_M, /* o p q r s t */ - F_F, F_M, F_L, F_L, F_F, F_L, /* u v w x y z */ -}; - -/* 3 벌식에서 (현재초성, 입력영문) -> 복합초성 처리 - * 3 bulsik: (current initial sound, input english) -> compound initial sound. - */ - -static int comfcon3(int v, int c) -{ - if (v == 2 && c == 2) - return 3; - if (v == 5 && c == 5) - return 6; - if (v == 9 && c == 9) - return 10; - if (v == 11 && c == 11) - return 12; - if (v == 14 && c == 14) - return 15; - return 0; -} - -/* 3 벌식에서 (현재모음, 입력 영문) -> 복합 모음 처리 - * 3 bulsik: (current vowel, input english) -> compound vowel. - */ - -static int comvow3(int v, int c) -{ - switch (v) { - case 13: /* ㅗ */ - switch (c) { - case 3: /* ㅗㅏ */ - return 14; - case 4: /* ㅗㅐ */ - return 15; - case 29: /* ㅗㅣ */ - return 18; - } - break; - - case 20: /* ㅜ */ - switch (c) { - case 7: /* ㅜㅓ */ - return 21; - case 10: /* ㅜㅔ */ - return 22; - case 29: /* ㅜㅣ */ - return 23; - } - break; - - /* 3 벌식 자판은 ㅡㅣ 가 있으므로 ... */ - } - return 0; -} - -/* 3 벌식에서 (현재 받침, 영문자 입력) -> 받침 - * 3 bulsik: (current prop(?), input english) -> prop(?). - * I want to say, the 'prop' is similar to 'final consonant', but not vowel. - * (I cannot find the real english from my dictionary. Sorry!) - * VIM: V = initial sound, I = medial vowel, M = final consonant. - */ - -static int comcon3(int k, int c) -{ - switch (k) { - case 2: /* ㄱ */ - switch (c) { - case 2: - return 3; /* ㄱㄱ */ - case 21: - return 4; /* ㄱㅅ */ - } - break; - - case 5: /* ㄴ */ - switch (c) { - case 24: /* ㄴㅈ */ - return 6; - case 29: - return 7; /* ㄴㅎ */ - } - break; - - case 9: /* ㄹ */ - switch (c) { - case 2: /* ㄹㄱ */ - return 10; - case 17: /* ㄹㅁ */ - return 11; - case 19: /* ㄹㅂ */ - return 12; - case 21: /* ㄹㅅ */ - return 13; - case 27: /* ㄹㅌ */ - return 14; - case 28: /* ㄹㅍ */ - return 15; - case 29: /* ㄹㅎ */ - return 16; - } - break; - - case 19: - switch (c) { - case 21: /* ㅂㅅ */ - return 20; - } - break; - } - return 0; -} - -/**********************************************************************/ -/****** 2 벌식자판을 위한 루틴 (Routines for 2 bulsik keyboard) ******/ -/**********************************************************************/ - -static int kind_table_for_2(int c) -{ - static char_u table[] = - { - /* a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s */ - 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, - /* t, u, v, w, x, y, z */ - 0, 1, 0, 0, 0, 1, 0 - }; - - if (c <= 'Z') - c -= 'A'; - else - c -= 'a'; - - return table[c]; -} - -/* 2 벌식에서 영문자 -> 조합형 초성 변환 - * (2 bulsik: conversion english char. to initial sound of compound type) - * 결과: 초성이 아니면 0 (If it is not initial sound, return 0). - */ -static int fcon(int c) -{ - static char_u table[] = - { - /*E */ 6, /*F */ 0, /*G */ 0, /*H */ 0, /*I */ 0, /*J */ 0, /*K */ 0, - /*L */ 0, /*M */ 0, /*N */ 0, /*O */ 0, /*P */ 0, /*Q */ 10, /*R */ 3, - /*S */ 0, /*T */ 12, /*U */ 0, /*V */ 0, /*W */ 15, /*X */ 0, /*Y */ 0, - /*Z */ 0, /*[ */ 0, /*\ */ 0, /*] */ 0, /*^ */ 0, /*_ */ 0, /*` */ 0, - /*a */ 8, /*b */ 0, /*c */ 16, /*d */ 13, /*e */ 5, /*f */ 7, /*g */ 20, - /*h */ 0, /*i */ 0, /*j */ 0, /*k */ 0, /*l */ 0, /*m */ 0, /*n */ 0, - /*o */ 0, /*p */ 0, /*q */ 9, /*r */ 2, /*s */ 4, /*t */ 11, /*u */ 0, - /*v */ 19, /*w */ 14, /*x */ 18, /*y */ 0, /*z */ 17 - }; - - if (c < 'E' || c > 'z') - return 0; - return table[c - 'E']; -} - -/* 2 벌식에서 영문자 -> 중성 변환 - * (2 bulsik: conversion english char. to medial vowel) - * 결과: 중성이 아니면 0 (If it is not medial vowel, return 0). - */ -static int vow(int c) -{ - static char_u table[] = - { - /*O */ 6, /*P */ 12, /*Q */ 0, /*R */ 0, /*S */ 0, /*T */ 0, /*U */ 0, - /*V */ 0, /*W */ 0, /*X */ 0, /*Y */ 0, /*Z */ 0, /*[ */ 0, /*\ */ 0, - /*] */ 0, /*^ */ 0, /*_ */ 0, /*` */ 0, /*a */ 0, /*b */ 26, /*c */ 0, - /*d */ 0, /*e */ 0, /*f */ 0, /*g */ 0, /*h */ 13, /*i */ 5, /*j */ 7, - /*k */ 3, /*l */ 29, /*m */ 27, /*n */ 20, /*o */ 4, /*p */ 10, /*q */ 0, - /*r */ 0, /*s */ 0, /*t */ 0, /*u */ 11, /*v */ 0, /*w */ 0, /*x */ 0, - /*y */ 19 - }; - - if (c < 'O' || c > 'y') - return 0; - return table[c - 'O']; -} - -/* 2벌식에서 영문자 -> 받침 변환 - * (2 bulsik: conversion english char. to prop) - * 결과: 받침이 아니면 0 (If not prop, return 0) - */ -static int lcon(int c) -{ - static char_u table[] = - { - /*R */ 3, /*S */ 0, /*T */ 22, /*U */ 0, /*V */ 0, /*W */ 0, /*X */ 0, - /*Y */ 0, /*Z */ 0, /*[ */ 0, /*\ */ 0, /*] */ 0, /*^ */ 0, /*_ */ 0, - /*` */ 0, /*a */ 17, /*b */ 0, /*c */ 25, /*d */ 23, /*e */ 8, /*f */ 9, - /*g */ 29, /*h */ 0, /*i */ 0, /*j */ 0, /*k */ 0, /*l */ 0, /*m */ 0, - /*n */ 0, /*o */ 0, /*p */ 0, /*q */ 19, /*r */ 2, /*s */ 5, /*t */ 21, - /*u */ 0, /*v */ 28, /*w */ 24, /*x */ 27, /*y */ 0, /*z */ 26 - }; - - if (c < 'R' || c > 'z') - return 0; - return table[c - 'R']; -} - -/* 2 벌식에서 (현재 받침, 영문자 입력) -> 받침 변환 - * (2 bulsik: conversion (curr. prop, input english) to prop) - */ - -static int comcon2(int k, int c) -{ - switch (k) { - case 2: /* ㄱ */ - switch (c) { - case 't': - return 4; /* ㄱㅅ */ - } - break; - - case 5: /* ㄴ */ - switch (c) { - case 'w': /* ㄴㅈ */ - return 6; - case 'g': /* ㄴㅎ */ - return 7; - } - break; - - case 9: /* ㄹ */ - switch (c) { - case 'r': /* ㄹㄱ */ - return 10; - case 'a': /* ㄹㅁ */ - return 11; - case 'q': /* ㄹㅂ */ - return 12; - case 't': /* ㄹㅅ */ - return 13; - case 'x': /* ㄹㅌ */ - return 14; - case 'v': /* ㄹㅍ */ - return 15; - case 'g': /* ㄹㅎ */ - return 16; - } - break; - - case 19: /* ㅂ */ - switch (c) { - case 't': /* ㅂㅅ */ - return 20; - } - break; - } - return 0; -} - -/* 2벌식에서 (현재 중성, 영문 입력) -> 중성 변환 - * (2 bulsik: conversion (curr. medial vowel, input english) to medial - * vowel) - */ - -static int comvow2(int v, int c) -{ - switch (v) { - case 13: /* ㅗ */ - switch (c) { - case 'k': /* ㅗㅏ */ - return 14; - case 'o': /* ㅗㅐ */ - return 15; - case 'l': /* ㅗㅣ */ - return 18; - } - break; - - case 20: /* ㅜ */ - switch (c) { - case 'j': /* ㅜㅓ */ - return 21; - case 'p': /* ㅜㅔ */ - return 22; - case 'l': /* ㅜㅣ */ - return 23; - } - break; - - case 27: /* ㅡ */ - switch (c) { - case 'l': /* ㅡㅣ */ - return 28; - } - break; - } - return 0; -} - -int hangul_input_state_get(void) { - return hangul_input_state; -} - -void hangul_input_state_set(int state) -{ - hangul_input_state = state; - hangul_input_clear(); -} - -int im_get_status(void) { - return hangul_input_state_get(); -} - -void hangul_input_state_toggle(void) { - if (hangul_input_state_get()) { - hangul_input_state_set(0); - if (composing_hangul) { - push_raw_key(composing_hangul_buffer, 2); - composing_hangul = 0; - } - } else - hangul_input_state_set(1); - - if (showmode()) { - setcursor(); - out_flush(); - } - -} - -static int hangul_automata2(char_u *buf, int_u *c) -{ - int t,t2; - - if (*c == BS) { - if (sp == 0) - return AUTOMATA_SPECIAL; - else if (sp < 4) { - hangul_input_clear(); - return AUTOMATA_NULL; - } - pop(buf); - query(buf); - convert_ks_to_3(buf, &f, &m, &l); - last_l = last_ll; - last_ll = -1; - return AUTOMATA_CORRECT; - } - if ((!(*c >= 'A' && *c <= 'Z')) && (!(*c >= 'a' && *c <= 'z'))) { - hangul_input_clear(); - return AUTOMATA_SPECIAL; - } - t = *c; - switch (kind_table_for_2(t)) { - case 0: /* 자음 (consonant) */ - if (f == F_NULL) { - if (m != M_NULL) - hangul_input_clear(); - f = fcon(t); - convert_3_to_code(f, M_NULL, L_NULL, buf); - push(buf); - last_ll = last_l = -1; - return AUTOMATA_NEW; - } - if (m == M_NULL) - return AUTOMATA_ERROR; - if (l == L_NULL) { - t2 = lcon(t); - if (!t2) { /* 받침으로 적합하지않다 (cannot use it as a prop) */ - hangul_input_clear(); - last_ll = last_l = -1; - f = fcon(t); - convert_3_to_code(f, m, l, buf); - push(buf); - return AUTOMATA_NEW; - } - if (2 == convert_3_to_code(f, m, t2, buf)) { - last_ll = -1; - last_l = t; - l = t2; - push(buf); - return AUTOMATA_CORRECT; - } else { /* 받침으로 쓰려하였으나 code에 없는 글자이다 */ - /* cannot find such a prop in the code table */ - last_ll = last_l = -1; - hangul_input_clear(); - f = fcon(t); - convert_3_to_code(f, m, l, buf); - push(buf); - return AUTOMATA_NEW; - } - } - /* 초 중 종성이 모두 갖추어져 있다 - * I have all the 'initial sound' and 'medial vowel' and 'final - * consonant'. - */ - t2 = comcon2(l, t); - if (t2) { - if (2 == convert_3_to_code(f, m, t2, buf)) { - l = t2; - last_ll = last_l; - last_l = t; - push(buf); - return AUTOMATA_CORRECT; - } - } - last_ll = last_l = -1; - hangul_input_clear(); - f = fcon(t); - convert_3_to_code(f, m, l, buf); - push(buf); - return AUTOMATA_NEW; - - case 1: - if (f == F_NULL) { - hangul_input_clear(); - m = vow(t); - convert_3_to_code (f, m, L_NULL, buf); - push (buf); - last_ll = last_l = -1; - return AUTOMATA_NEW; - } - if (m == M_NULL) { - m = vow(t); - if (2 == convert_3_to_code(f, m, L_NULL, buf)) { - last_ll = last_l = -1; - push(buf); - return AUTOMATA_CORRECT; - } - m = M_NULL; - return AUTOMATA_ERROR; - } - if (l == L_NULL) { - t2 = comvow2(m, t); - if (t2) { - if (2 != convert_3_to_code(f, t2, L_NULL, buf)) - return AUTOMATA_ERROR; - - m = t2; - push(buf); - last_ll = last_l = -1; - return AUTOMATA_CORRECT; - } - return AUTOMATA_ERROR; - } - pop(buf); - pop(buf); - sp = 0; - if (last_l == -1) { - /* 음... 이게 필요하나?? (Hmm... Is it needed?) */ - convert_ks_to_3(buf, &f, &m, &l); - } else { - char_u tmp[3]; - f = fcon(last_l); - convert_3_to_code (f, M_NULL, L_NULL, tmp); - push (tmp); - } - m = vow(t); - l = L_NULL; - convert_3_to_code(f, m, l, buf + 2); - push(buf + 2); - return AUTOMATA_CORRECT_NEW; - - default: - EMSG(_("E256: Hangul automata ERROR")); - break; - } - return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */ -} - -static int hangul_automata3(char_u *buf, int_u *c) -{ - int t, t2; - - if (*c >= '!' && *c <= 'z') { - *c -= '!'; - t = value_table_for_3[*c]; - switch (kind_table_for_3[*c]) { - case F_F: /* 초성문자 (char. of an initial sound) */ - if (m != M_NULL || sp == 0) { - /* 초성이 비었거나 다음 글자 모으기 시작 - * Empty 'initial sound', so starting automata. - */ - hangul_input_clear(); - f = t; - convert_3_to_code(f, M_NULL, L_NULL, buf); - push(buf); - return AUTOMATA_NEW; - } - if ((t2 = comfcon3(f,t)) != 0) { /* 복자음 (double? consonant) */ - f=t2; - convert_3_to_code(f, M_NULL, L_NULL, buf); - push(buf); - return AUTOMATA_CORRECT; - } - return AUTOMATA_ERROR; - - case F_M: /* 모음 (vowel) */ - if (m == M_NULL) { - if (2 != convert_3_to_code(f, t, L_NULL,buf)) - return AUTOMATA_ERROR; - - m = t; - push(buf); - if (f == F_NULL) - return AUTOMATA_NEW; - else - return AUTOMATA_CORRECT; - } - if ((t2 = comvow3(m,t))) { /* 복모음 (a diphthong) */ - m = t2; - convert_3_to_code(f, m, L_NULL, buf); - push(buf); - return AUTOMATA_CORRECT; - } - return AUTOMATA_ERROR; - - case F_L: /* 받침 (prop?) */ - if (m == M_NULL) - return AUTOMATA_ERROR; /* 중성없는 종성 */ - if (l == L_NULL) { - if (2 != convert_3_to_code(f, m, t, buf)) { - l = L_NULL; - return AUTOMATA_ERROR; - } - push(buf); - l = t; - return AUTOMATA_CORRECT; - } - if ((t2 = comcon3(l,t)) != 0) { /* 복 받침 ?? (double prop?) */ - if (2 != convert_3_to_code(f, m, t2, buf)) - return AUTOMATA_ERROR; - - push(buf); - l = t2; - return AUTOMATA_CORRECT; - } - return AUTOMATA_ERROR; - - case F_A: /* 특수문자나 숫자 (special char. or number) */ - hangul_input_clear(); - *c = t; - return AUTOMATA_SPECIAL; - } - } - if (*c == BS) { - if (sp >= 4) { - pop(buf); - pop(buf); - convert_ks_to_3(buf, &f, &m, &l); - push(buf); - return AUTOMATA_CORRECT; - } else if (sp == 0) { - return AUTOMATA_SPECIAL; - } else { - hangul_input_clear(); - return AUTOMATA_NULL; - } - } - hangul_input_clear(); - return AUTOMATA_SPECIAL; -} - -void hangul_keyboard_set(void) { - int keyboard; - const char *s; - - hangul_input_clear(); - - if ((s = mch_getenv("VIM_KEYBOARD")) == NULL) - s = mch_getenv("HANGUL_KEYBOARD_TYPE"); - - if (s) { - if (*s == '2') - keyboard = 2; - else - keyboard = 3; - hangul_keyboard_type = keyboard; - } -} - -int hangul_input_process(char_u *s, int len) -{ - int n; - unsigned int c; - char_u hanbuf[20]; - - if (len == 1) - /* normal key press */ - c = *s; - else if (len == 3 && s[0] == CSI && s[1] == 'k' && s[2] == 'b') { - /* backspace */ - if (composing_hangul) - c = Ctrl_H; - else - return len; - } else { - if (composing_hangul) - push_raw_key(composing_hangul_buffer, 2); - hangul_input_clear(); - composing_hangul = 0; - return len; - } - - if (hangul_keyboard_type == 2) - n = hangul_automata2(hanbuf, &c); - else - n = hangul_automata3(hanbuf, &c); - - if (n == AUTOMATA_CORRECT) { - STRNCPY(composing_hangul_buffer, hanbuf, 2); - return 0; - } else if (n == AUTOMATA_NEW) { - if (composing_hangul) - push_raw_key(composing_hangul_buffer, 2); - STRNCPY(composing_hangul_buffer, hanbuf, 2); - composing_hangul = 1; - return 0; - } else if (n == AUTOMATA_CORRECT_NEW) { - if (composing_hangul) - push_raw_key(hanbuf, 2); - STRNCPY(composing_hangul_buffer, hanbuf+2, 2); - composing_hangul = 1; - return 0; - } else if (n == AUTOMATA_NULL) { - composing_hangul = 0; - - return 0; - } else if (n == AUTOMATA_SPECIAL) { - if (composing_hangul) { - push_raw_key(composing_hangul_buffer, 2); - composing_hangul = 0; - } - *s = c; - return 1; - } else if (n == AUTOMATA_ERROR) { - vim_beep(); - return 0; - } - return len; -} - -void hangul_input_clear(void) { - sp = 0; - f = F_NULL; - m = M_NULL; - l = L_NULL; -} - -#define han_index(h, l) (((h)-0xb0)*(0xff-0xa1)+((l)-0xa1)) - -static const char_u ks_table1[][3] = -{ - { 2, 3, 1}, { 2, 3, 2}, { 2, 3, 5}, { 2, 3, 8}, - { 2, 3, 9}, { 2, 3, 10}, { 2, 3, 11}, { 2, 3, 17}, - { 2, 3, 19}, { 2, 3, 20}, { 2, 3, 21}, { 2, 3, 22}, - { 2, 3, 23}, { 2, 3, 24}, { 2, 3, 25}, { 2, 3, 27}, - { 2, 3, 28}, { 2, 3, 29}, { 2, 4, 1}, { 2, 4, 2}, - { 2, 4, 5}, { 2, 4, 9}, { 2, 4, 17}, { 2, 4, 19}, - { 2, 4, 21}, { 2, 4, 22}, { 2, 4, 23}, { 2, 5, 1}, - { 2, 5, 2}, { 2, 5, 5}, { 2, 5, 9}, { 2, 5, 21}, - { 2, 5, 23}, { 2, 6, 1}, { 2, 6, 5}, { 2, 6, 9}, - { 2, 7, 1}, { 2, 7, 2}, { 2, 7, 5}, { 2, 7, 8}, - { 2, 7, 9}, { 2, 7, 11}, { 2, 7, 17}, { 2, 7, 19}, - { 2, 7, 21}, { 2, 7, 22}, { 2, 7, 23}, { 2, 7, 24}, - { 2, 7, 27}, { 2, 7, 28}, { 2, 7, 29}, { 2, 10, 1}, - { 2, 10, 5}, { 2, 10, 9}, { 2, 10, 17}, { 2, 10, 19}, - { 2, 10, 21}, { 2, 10, 22}, { 2, 10, 23}, { 2, 11, 1}, - { 2, 11, 2}, { 2, 11, 3}, { 2, 11, 5}, { 2, 11, 8}, - { 2, 11, 9}, { 2, 11, 17}, { 2, 11, 19}, { 2, 11, 21}, - { 2, 11, 22}, { 2, 11, 23}, { 2, 11, 27}, { 2, 12, 1}, - { 2, 12, 5}, { 2, 12, 9}, { 2, 12, 19}, { 2, 12, 21}, - { 2, 13, 1}, { 2, 13, 2}, { 2, 13, 5}, { 2, 13, 8}, - { 2, 13, 9}, { 2, 13, 11}, { 2, 13, 13}, { 2, 13, 16}, - { 2, 13, 17}, { 2, 13, 19}, { 2, 13, 21}, { 2, 13, 23}, - { 2, 13, 24}, { 2, 14, 1}, { 2, 14, 2}, { 2, 14, 5}, - { 2, 14, 9}, { 2, 14, 11}, { 2, 14, 17}, { 2, 14, 19}, - { 2, 14, 21}, { 2, 14, 23}, { 2, 15, 1}, { 2, 15, 5}, - { 2, 15, 9}, { 2, 15, 19}, { 2, 15, 22}, { 2, 15, 23}, - { 2, 18, 1}, { 2, 18, 2}, { 2, 18, 5}, { 2, 18, 9}, - { 2, 18, 17}, { 2, 18, 19}, { 2, 18, 21}, { 2, 18, 23}, - { 2, 19, 1}, { 2, 19, 5}, { 2, 19, 9}, { 2, 19, 19}, - { 2, 19, 21}, { 2, 20, 1}, { 2, 20, 2}, { 2, 20, 5}, - { 2, 20, 8}, { 2, 20, 9}, { 2, 20, 10}, { 2, 20, 11}, - { 2, 20, 16}, { 2, 20, 17}, { 2, 20, 19}, { 2, 20, 21}, - { 2, 20, 23}, { 2, 20, 24}, { 2, 21, 1}, { 2, 21, 2}, - { 2, 21, 5}, { 2, 21, 9}, { 2, 21, 22}, { 2, 21, 23}, - { 2, 22, 1}, { 2, 22, 21}, { 2, 23, 1}, { 2, 23, 2}, - { 2, 23, 5}, { 2, 23, 9}, { 2, 23, 17}, { 2, 23, 19}, - { 2, 23, 21}, { 2, 26, 1}, { 2, 26, 5}, { 2, 26, 9}, - { 2, 27, 1}, { 2, 27, 2}, { 2, 27, 5}, { 2, 27, 8}, - { 2, 27, 9}, { 2, 27, 10}, { 2, 27, 17}, { 2, 27, 19}, - { 2, 27, 21}, { 2, 27, 23}, { 2, 28, 1}, { 2, 29, 1}, - { 2, 29, 2}, { 2, 29, 5}, { 2, 29, 8}, { 2, 29, 9}, - { 2, 29, 11}, { 2, 29, 17}, { 2, 29, 19}, { 2, 29, 21}, - { 2, 29, 23}, { 2, 29, 24}, { 2, 29, 28}, { 3, 3, 1}, - { 3, 3, 2}, { 3, 3, 3}, { 3, 3, 5}, { 3, 3, 9}, - { 3, 3, 11}, { 3, 3, 17}, { 3, 3, 19}, { 3, 3, 21}, - { 3, 3, 22}, { 3, 3, 23}, { 3, 3, 27}, { 3, 4, 1}, - { 3, 4, 2}, { 3, 4, 5}, { 3, 4, 9}, { 3, 4, 17}, - { 3, 4, 19}, { 3, 4, 21}, { 3, 4, 22}, { 3, 4, 23}, - { 3, 5, 1}, { 3, 5, 2}, { 3, 5, 9}, { 3, 7, 1}, - { 3, 7, 2}, { 3, 7, 3}, { 3, 7, 5}, { 3, 7, 9}, - { 3, 7, 17}, { 3, 7, 19}, { 3, 7, 21}, { 3, 7, 22}, - { 3, 7, 23}, { 3, 10, 1}, { 3, 10, 2}, { 3, 10, 5}, - { 3, 10, 17}, { 3, 10, 21}, { 3, 10, 23}, { 3, 11, 1}, - { 3, 11, 5}, { 3, 11, 9}, { 3, 11, 21}, { 3, 11, 22}, - { 3, 11, 27}, { 3, 12, 1}, { 3, 13, 1}, { 3, 13, 2}, - { 3, 13, 5}, { 3, 13, 7}, { 3, 13, 9}, { 3, 13, 17}, - { 3, 13, 19}, { 3, 13, 21}, { 3, 13, 23}, { 3, 13, 24}, - { 3, 13, 25}, { 3, 14, 1}, { 3, 14, 2}, { 3, 14, 9}, - { 3, 14, 22}, { 3, 14, 23}, { 3, 15, 1}, { 3, 15, 2}, - { 3, 15, 23}, { 3, 18, 1}, { 3, 18, 5}, { 3, 18, 9}, - { 3, 18, 17}, { 3, 18, 19}, { 3, 18, 23}, { 3, 19, 1}, - { 3, 20, 1}, { 3, 20, 2}, { 3, 20, 5}, { 3, 20, 9}, - { 3, 20, 16}, { 3, 20, 17}, { 3, 20, 19}, { 3, 20, 21}, - { 3, 20, 23}, { 3, 20, 24}, { 3, 21, 1}, { 3, 21, 9}, - { 3, 21, 22}, { 3, 21, 23}, { 3, 22, 1}, { 3, 22, 2}, - { 3, 22, 5}, { 3, 22, 9}, { 3, 22, 17}, { 3, 22, 19}, - { 3, 22, 22}, { 3, 23, 1}, { 3, 23, 5}, { 3, 23, 9}, - { 3, 23, 17}, { 3, 23, 19}, { 3, 26, 1}, { 3, 27, 1}, - { 3, 27, 2}, { 3, 27, 5}, { 3, 27, 7}, { 3, 27, 9}, - { 3, 27, 11}, { 3, 27, 16}, { 3, 27, 17}, { 3, 27, 19}, - { 3, 27, 21}, { 3, 27, 23}, { 3, 27, 27}, { 3, 29, 1}, - { 3, 29, 2}, { 3, 29, 5}, { 3, 29, 9}, { 3, 29, 17}, - { 3, 29, 19}, { 3, 29, 21}, { 3, 29, 23}, { 4, 3, 1}, - { 4, 3, 2}, { 4, 3, 3}, { 4, 3, 5}, { 4, 3, 8}, - { 4, 3, 9}, { 4, 3, 10}, { 4, 3, 11}, { 4, 3, 17}, - { 4, 3, 19}, { 4, 3, 21}, { 4, 3, 22}, { 4, 3, 23}, - { 4, 3, 24}, { 4, 3, 25}, { 4, 3, 27}, { 4, 3, 29}, - { 4, 4, 1}, { 4, 4, 2}, { 4, 4, 5}, { 4, 4, 9}, - { 4, 4, 17}, { 4, 4, 19}, { 4, 4, 21}, { 4, 4, 22}, - { 4, 4, 23}, { 4, 5, 1}, { 4, 5, 2}, { 4, 5, 5}, - { 4, 5, 9}, { 4, 5, 17}, { 4, 5, 23}, { 4, 7, 1}, - { 4, 7, 2}, { 4, 7, 4}, { 4, 7, 5}, { 4, 7, 9}, - { 4, 7, 11}, { 4, 7, 12}, { 4, 7, 17}, { 4, 7, 19}, - { 4, 7, 21}, { 4, 7, 22}, { 4, 7, 23}, { 4, 7, 29}, - { 4, 10, 1}, { 4, 10, 2}, { 4, 10, 5}, { 4, 10, 9}, - { 4, 10, 17}, { 4, 10, 19}, { 4, 10, 21}, { 4, 10, 22}, - { 4, 10, 23}, { 4, 11, 1}, { 4, 11, 2}, { 4, 11, 5}, - { 4, 11, 9}, { 4, 11, 17}, { 4, 11, 19}, { 4, 11, 22}, - { 4, 11, 23}, { 4, 11, 26}, { 4, 12, 1}, { 4, 12, 5}, - { 4, 13, 1}, { 4, 13, 2}, { 4, 13, 5}, { 4, 13, 9}, - { 4, 13, 11}, { 4, 13, 17}, { 4, 13, 19}, { 4, 13, 21}, - { 4, 13, 23}, { 4, 13, 28}, { 4, 13, 29}, { 4, 14, 1}, - { 4, 14, 5}, { 4, 14, 9}, { 4, 14, 22}, { 4, 18, 1}, - { 4, 18, 5}, { 4, 18, 9}, { 4, 18, 17}, { 4, 18, 19}, - { 4, 18, 21}, { 4, 19, 1}, { 4, 19, 2}, { 4, 19, 5}, - { 4, 19, 9}, { 4, 19, 19}, { 4, 19, 21}, { 4, 19, 23}, - { 4, 20, 1}, { 4, 20, 2}, { 4, 20, 5}, { 4, 20, 8}, - { 4, 20, 9}, { 4, 20, 17}, { 4, 20, 19}, { 4, 20, 21}, - { 4, 20, 23}, { 4, 21, 1}, { 4, 21, 22}, { 4, 22, 1}, - { 4, 23, 1}, { 4, 23, 5}, { 4, 23, 9}, { 4, 23, 17}, - { 4, 23, 19}, { 4, 26, 1}, { 4, 26, 2}, { 4, 26, 9}, - { 4, 26, 17}, { 4, 26, 19}, { 4, 26, 23}, { 4, 27, 1}, - { 4, 27, 2}, { 4, 27, 5}, { 4, 27, 9}, { 4, 27, 10}, - { 4, 27, 11}, { 4, 27, 17}, { 4, 27, 19}, { 4, 27, 21}, - { 4, 27, 23}, { 4, 27, 24}, { 4, 27, 28}, { 4, 28, 1}, - { 4, 28, 5}, { 4, 28, 9}, { 4, 29, 1}, { 4, 29, 2}, - { 4, 29, 5}, { 4, 29, 9}, { 4, 29, 11}, { 4, 29, 17}, - { 4, 29, 19}, { 4, 29, 21}, { 4, 29, 23}, { 4, 29, 28}, - { 5, 3, 1}, { 5, 3, 2}, { 5, 3, 3}, { 5, 3, 5}, - { 5, 3, 8}, { 5, 3, 9}, { 5, 3, 10}, { 5, 3, 11}, - { 5, 3, 12}, { 5, 3, 16}, { 5, 3, 17}, { 5, 3, 19}, - { 5, 3, 21}, { 5, 3, 22}, { 5, 3, 23}, { 5, 3, 24}, - { 5, 3, 25}, { 5, 3, 29}, { 5, 4, 1}, { 5, 4, 2}, - { 5, 4, 5}, { 5, 4, 9}, { 5, 4, 17}, { 5, 4, 19}, - { 5, 4, 21}, { 5, 4, 22}, { 5, 4, 23}, { 5, 5, 1}, - { 5, 7, 1}, { 5, 7, 2}, { 5, 7, 3}, { 5, 7, 5}, - { 5, 7, 8}, { 5, 7, 9}, { 5, 7, 11}, { 5, 7, 12}, - { 5, 7, 17}, { 5, 7, 19}, { 5, 7, 21}, { 5, 7, 23}, - { 5, 7, 25}, { 5, 7, 28}, { 5, 10, 1}, { 5, 10, 2}, - { 5, 10, 5}, { 5, 10, 9}, { 5, 10, 17}, { 5, 10, 19}, - { 5, 10, 21}, { 5, 10, 22}, { 5, 10, 23}, { 5, 11, 1}, - { 5, 11, 5}, { 5, 11, 9}, { 5, 11, 22}, { 5, 11, 23}, - { 5, 12, 1}, { 5, 12, 5}, { 5, 13, 1}, { 5, 13, 2}, - { 5, 13, 5}, { 5, 13, 8}, { 5, 13, 9}, { 5, 13, 11}, - { 5, 13, 13}, { 5, 13, 17}, { 5, 13, 19}, { 5, 13, 21}, - { 5, 13, 23}, { 5, 13, 25}, { 5, 13, 27}, { 5, 14, 1}, - { 5, 14, 5}, { 5, 14, 9}, { 5, 15, 1}, { 5, 15, 22}, - { 5, 18, 1}, { 5, 18, 5}, { 5, 18, 9}, { 5, 18, 17}, - { 5, 18, 19}, { 5, 18, 21}, { 5, 19, 1}, { 5, 20, 1}, - { 5, 20, 2}, { 5, 20, 5}, { 5, 20, 9}, { 5, 20, 17}, - { 5, 20, 19}, { 5, 20, 21}, { 5, 20, 23}, { 5, 21, 1}, - { 5, 21, 22}, { 5, 22, 1}, { 5, 22, 23}, { 5, 23, 1}, - { 5, 23, 5}, { 5, 23, 9}, { 5, 23, 19}, { 5, 23, 21}, - { 5, 23, 23}, { 5, 26, 1}, { 5, 26, 5}, { 5, 26, 9}, - { 5, 26, 17}, { 5, 26, 23}, { 5, 27, 1}, { 5, 27, 2}, - { 5, 27, 5}, { 5, 27, 8}, { 5, 27, 9}, { 5, 27, 11}, - { 5, 27, 17}, { 5, 27, 19}, { 5, 27, 21}, { 5, 27, 23}, - { 5, 28, 1}, { 5, 29, 1}, { 5, 29, 2}, { 5, 29, 5}, - { 5, 29, 8}, { 5, 29, 9}, { 5, 29, 17}, { 5, 29, 19}, - { 5, 29, 21}, { 5, 29, 22}, { 5, 29, 23}, { 5, 29, 24}, - { 6, 3, 1}, { 6, 3, 2}, { 6, 3, 5}, { 6, 3, 9}, - { 6, 3, 17}, { 6, 3, 19}, { 6, 3, 21}, { 6, 3, 22}, - { 6, 3, 23}, { 6, 3, 29}, { 6, 4, 1}, { 6, 4, 2}, - { 6, 4, 5}, { 6, 4, 9}, { 6, 4, 17}, { 6, 4, 19}, - { 6, 4, 21}, { 6, 4, 22}, { 6, 4, 23}, { 6, 7, 1}, - { 6, 7, 2}, { 6, 7, 5}, { 6, 7, 9}, { 6, 7, 11}, - { 6, 7, 12}, { 6, 7, 17}, { 6, 7, 19}, { 6, 7, 21}, - { 6, 7, 22}, { 6, 7, 23}, { 6, 7, 29}, { 6, 10, 1}, - { 6, 10, 2}, { 6, 10, 5}, { 6, 10, 9}, { 6, 10, 17}, - { 6, 10, 19}, { 6, 10, 21}, { 6, 10, 22}, { 6, 10, 23}, - { 6, 11, 1}, { 6, 11, 22}, { 6, 13, 1}, { 6, 13, 2}, - { 6, 13, 5}, { 6, 13, 9}, { 6, 13, 23}, { 6, 14, 1}, - { 6, 14, 9}, { 6, 15, 1}, { 6, 18, 1}, { 6, 18, 5}, - { 6, 20, 1}, { 6, 20, 2}, { 6, 20, 5}, { 6, 20, 9}, - { 6, 20, 16}, { 6, 20, 17}, { 6, 20, 23}, { 6, 22, 1}, - { 6, 23, 1}, { 6, 23, 5}, { 6, 23, 9}, { 6, 23, 17}, - { 6, 23, 19}, { 6, 23, 23}, { 6, 27, 1}, { 6, 27, 2}, - { 6, 27, 5}, { 6, 27, 8}, { 6, 27, 9}, { 6, 27, 17}, - { 6, 27, 19}, { 6, 27, 21}, { 6, 28, 1}, { 6, 28, 5}, - { 6, 28, 9}, { 6, 28, 17}, { 6, 28, 19}, { 6, 29, 1}, - { 6, 29, 5}, { 6, 29, 9}, { 6, 29, 17}, { 6, 29, 19}, - { 6, 29, 21}, { 6, 29, 23}, { 7, 3, 1}, { 7, 3, 2}, - { 7, 3, 5}, { 7, 3, 9}, { 7, 3, 17}, { 7, 3, 19}, - { 7, 3, 21}, { 7, 3, 22}, { 7, 3, 23}, { 7, 3, 24}, - { 7, 3, 28}, { 7, 3, 29}, { 7, 4, 1}, { 7, 4, 2}, - { 7, 4, 5}, { 7, 4, 9}, { 7, 4, 17}, { 7, 4, 19}, - { 7, 4, 21}, { 7, 4, 22}, { 7, 4, 23}, { 7, 5, 1}, - { 7, 5, 2}, { 7, 5, 5}, { 7, 5, 21}, { 7, 5, 23}, - { 7, 7, 1}, { 7, 7, 2}, { 7, 7, 5}, { 7, 7, 9}, - { 7, 7, 17}, { 7, 7, 19}, { 7, 7, 21}, { 7, 7, 22}, - { 7, 7, 23}, { 7, 7, 29}, { 7, 10, 1}, { 7, 10, 2}, - { 7, 10, 5}, { 7, 10, 9}, { 7, 10, 17}, { 7, 10, 19}, - { 7, 10, 21}, { 7, 10, 23}, { 7, 11, 1}, { 7, 11, 2}, - { 7, 11, 5}, { 7, 11, 9}, { 7, 11, 17}, { 7, 11, 19}, - { 7, 11, 21}, { 7, 11, 22}, { 7, 11, 23}, { 7, 12, 1}, - { 7, 12, 5}, { 7, 12, 19}, { 7, 12, 21}, { 7, 13, 1}, - { 7, 13, 2}, { 7, 13, 5}, { 7, 13, 9}, { 7, 13, 17}, - { 7, 13, 19}, { 7, 13, 21}, { 7, 13, 23}, { 7, 14, 1}, - { 7, 14, 5}, { 7, 14, 23}, { 7, 15, 22}, { 7, 18, 1}, - { 7, 18, 5}, { 7, 18, 9}, { 7, 18, 17}, { 7, 18, 19}, - { 7, 18, 21}, { 7, 18, 23}, { 7, 19, 1}, { 7, 19, 5}, - { 7, 19, 9}, { 7, 19, 19}, { 7, 19, 21}, { 7, 19, 23}, - { 7, 20, 1}, { 7, 20, 2}, { 7, 20, 5}, { 7, 20, 9}, - { 7, 20, 17}, { 7, 20, 19}, { 7, 20, 21}, { 7, 20, 23}, - { 7, 21, 1}, { 7, 21, 22}, { 7, 22, 1}, { 7, 23, 1}, - { 7, 23, 2}, { 7, 23, 5}, { 7, 23, 9}, { 7, 23, 17}, - { 7, 23, 21}, { 7, 23, 23}, { 7, 26, 1}, { 7, 26, 2}, - { 7, 26, 5}, { 7, 26, 9}, { 7, 26, 17}, { 7, 26, 19}, - { 7, 26, 21}, { 7, 26, 23}, { 7, 27, 1}, { 7, 27, 2}, - { 7, 27, 5}, { 7, 27, 9}, { 7, 27, 17}, { 7, 27, 19}, - { 7, 27, 21}, { 7, 27, 23}, { 7, 27, 24}, { 7, 27, 27}, - { 7, 27, 28}, { 7, 29, 1}, { 7, 29, 2}, { 7, 29, 5}, - { 7, 29, 9}, { 7, 29, 17}, { 7, 29, 19}, { 7, 29, 21}, - { 7, 29, 23}, { 8, 3, 1}, { 8, 3, 2}, { 8, 3, 5}, - { 8, 3, 7}, { 8, 3, 8}, { 8, 3, 9}, { 8, 3, 10}, - { 8, 3, 11}, { 8, 3, 17}, { 8, 3, 19}, { 8, 3, 21}, - { 8, 3, 23}, { 8, 3, 24}, { 8, 3, 27}, { 8, 3, 29}, - { 8, 4, 1}, { 8, 4, 2}, { 8, 4, 5}, { 8, 4, 9}, - { 8, 4, 17}, { 8, 4, 19}, { 8, 4, 21}, { 8, 4, 22}, - { 8, 4, 23}, { 8, 4, 24}, { 8, 5, 1}, { 8, 5, 2}, - { 8, 5, 9}, { 8, 5, 23}, { 8, 7, 1}, { 8, 7, 2}, - { 8, 7, 5}, { 8, 7, 9}, { 8, 7, 11}, { 8, 7, 17}, - { 8, 7, 19}, { 8, 7, 21}, { 8, 7, 23}, { 8, 7, 24}, - { 8, 7, 29}, { 8, 10, 1}, { 8, 10, 2}, { 8, 10, 5}, - { 8, 10, 9}, { 8, 10, 17}, { 8, 10, 19}, { 8, 10, 21}, - { 8, 10, 22}, { 8, 10, 23}, { 8, 11, 1}, { 8, 11, 2}, - { 8, 11, 5}, { 8, 11, 9}, { 8, 11, 21}, { 8, 11, 22}, - { 8, 11, 23}, { 8, 11, 25}, { 8, 12, 1}, { 8, 13, 1}, - { 8, 13, 2}, { 8, 13, 4}, { 8, 13, 5}, { 8, 13, 9}, - { 8, 13, 11}, { 8, 13, 17}, { 8, 13, 19}, { 8, 13, 21}, - { 8, 13, 23}, { 8, 14, 1}, { 8, 14, 5}, { 8, 14, 22}, - { 8, 14, 23}, { 8, 18, 1}, { 8, 18, 5}, { 8, 18, 9}, - { 8, 18, 19}, { 8, 18, 21}, { 8, 18, 23}, { 8, 19, 1}, - { 8, 19, 5}, { 8, 19, 9}, { 8, 19, 19}, { 8, 19, 21}, - { 8, 20, 1}, { 8, 20, 2}, { 8, 20, 3}, { 8, 20, 5}, - { 8, 20, 8}, { 8, 20, 9}, { 8, 20, 10}, { 8, 20, 11}, - { 8, 20, 17}, { 8, 20, 19}, { 8, 20, 21}, { 8, 20, 23}, - { 8, 20, 27}, { 8, 20, 29}, { 8, 21, 1}, { 8, 21, 5}, - { 8, 21, 9}, { 8, 21, 19}, { 8, 21, 21}, { 8, 22, 1}, - { 8, 23, 1}, { 8, 23, 5}, { 8, 23, 9}, { 8, 26, 1}, - { 8, 26, 5}, { 8, 26, 9}, { 8, 26, 17}, { 8, 26, 21}, - { 8, 27, 1}, { 8, 27, 5}, { 8, 27, 9}, { 8, 27, 17}, - { 8, 27, 21}, { 8, 29, 1}, { 8, 29, 2}, { 8, 29, 5}, - { 8, 29, 8}, { 8, 29, 9} |