diff options
author | Choe Hwanjin <choe.hwanjin@gmail.com> | 2006-03-12 14:53:25 +0900 |
---|---|---|
committer | Choe Hwanjin <choe.hwanjin@gmail.com> | 2006-03-12 14:53:25 +0900 |
commit | c223fea59cdd7456e314dcabd47447ef4bfbfe75 (patch) | |
tree | 611a2793a9aaeb27d854c0a1ea7683fff2fe6cea | |
parent | 32592a4dbbc0fb034c06927cb60496b5ecc7e856 (diff) | |
download | libhangul-c223fea59cdd7456e314dcabd47447ef4bfbfe75.tar.gz |
hangul_ic_dvorak_to_qwerty() 추가
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@65 8f00fcd2-89fc-0310-932e-b01be5b65e01
-rw-r--r-- | hangul/hangul.h | 1 | ||||
-rw-r--r-- | hangul/hangulinputcontext.c | 106 |
2 files changed, 107 insertions, 0 deletions
diff --git a/hangul/hangul.h b/hangul/hangul.h index a92e821..3007fe3 100644 --- a/hangul/hangul.h +++ b/hangul/hangul.h @@ -90,6 +90,7 @@ void hangul_ic_reset(HangulInputContext *hic); void hangul_ic_flush(HangulInputContext *hic); bool hangul_ic_backspace(HangulInputContext *hic); bool hangul_ic_is_empty(HangulInputContext *hic); +int hangul_ic_dvorak_to_qwerty(int qwerty); void hangul_ic_set_output_mode(HangulInputContext *hic, int mode); void hangul_ic_set_keyboard(HangulInputContext *hic, diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c index 9b7fecd..d075e9f 100644 --- a/hangul/hangulinputcontext.c +++ b/hangul/hangulinputcontext.c @@ -689,6 +689,112 @@ hangul_ic_backspace(HangulInputContext *hic) return ret; } +int +hangul_ic_dvorak_to_qwerty(int qwerty) +{ + static const int table[] = { + '!', /* ! */ + 'Q', /* " */ + '#', /* # */ + '$', /* $ */ + '%', /* % */ + '&', /* & */ + 'q', /* ' */ + '(', /* ( */ + ')', /* ) */ + '*', /* * */ + '}', /* + */ + 'w', /* , */ + '\'', /* - */ + 'e', /* . */ + '[', /* / */ + '0', /* 0 */ + '1', /* 1 */ + '2', /* 2 */ + '3', /* 3 */ + '4', /* 4 */ + '5', /* 5 */ + '6', /* 6 */ + '7', /* 7 */ + '8', /* 8 */ + '9', /* 9 */ + 'Z', /* : */ + 'z', /* ; */ + 'W', /* < */ + ']', /* = */ + 'E', /* > */ + '{', /* ? */ + '@', /* @ */ + 'A', /* A */ + 'N', /* B */ + 'I', /* C */ + 'H', /* D */ + 'D', /* E */ + 'Y', /* F */ + 'U', /* G */ + 'J', /* H */ + 'G', /* I */ + 'C', /* J */ + 'V', /* K */ + 'P', /* L */ + 'M', /* M */ + 'L', /* N */ + 'S', /* O */ + 'R', /* P */ + 'X', /* Q */ + 'O', /* R */ + ':', /* S */ + 'K', /* T */ + 'F', /* U */ + '>', /* V */ + '<', /* W */ + 'B', /* X */ + 'T', /* Y */ + '?', /* Z */ + '-', /* [ */ + '\\', /* \ */ + '=', /* ] */ + '^', /* ^ */ + '"', /* _ */ + '`', /* ` */ + 'a', /* a */ + 'n', /* b */ + 'i', /* c */ + 'h', /* d */ + 'd', /* e */ + 'y', /* f */ + 'u', /* g */ + 'j', /* h */ + 'g', /* i */ + 'c', /* j */ + 'v', /* k */ + 'p', /* l */ + 'm', /* m */ + 'l', /* n */ + 's', /* o */ + 'r', /* p */ + 'x', /* q */ + 'o', /* r */ + ';', /* s */ + 'k', /* t */ + 'f', /* u */ + '.', /* v */ + ',', /* w */ + 'b', /* x */ + 't', /* y */ + '/', /* z */ + '_', /* { */ + '|', /* | */ + '+', /* } */ + '~' /* ~ */ + }; + + if (qwerty >= '!' && qwerty <= '~') + return table[qwerty - '!']; + + return qwerty; +} + bool hangul_ic_is_empty(HangulInputContext *hic) { |