diff options
author | Choe Hwanjin <choe.hwanjin@gmail.com> | 2022-09-18 14:00:56 +0900 |
---|---|---|
committer | Choe Hwanjin <choe.hwanjin@gmail.com> | 2022-09-18 14:00:56 +0900 |
commit | 970cec2a8c9be7f2bdfb3de2090162be3f277914 (patch) | |
tree | 892f2a907cc566a928a5eb9c725952b2a85820db /hangul/hangulkeyboard.c | |
parent | a3d8eb6167cb92fe9d192402bb9b8dbe20ff7e26 (diff) | |
download | libhangul-970cec2a8c9be7f2bdfb3de2090162be3f277914.tar.gz |
keyboard: Add hangul_ic_switch_keyboard_table() apikeyboard
HangulKeyboard is support 4 keycode-to-char mapping table.
A new api hangul_ic_switch_keyboard_table() changes the
current mapping table according to the specified table id.
Change tableid to table_id for varible name consistency.
Diffstat (limited to 'hangul/hangulkeyboard.c')
-rw-r--r-- | hangul/hangulkeyboard.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/hangul/hangulkeyboard.c b/hangul/hangulkeyboard.c index 11354d8..1d23ed3 100644 --- a/hangul/hangulkeyboard.c +++ b/hangul/hangulkeyboard.c @@ -427,18 +427,18 @@ hangul_keyboard_set_name(HangulKeyboard* keyboard, const char* name) } ucschar -hangul_keyboard_get_mapping(const HangulKeyboard* keyboard, int tableid, unsigned key) +hangul_keyboard_get_mapping(const HangulKeyboard* keyboard, int table_id, unsigned key) { if (keyboard == NULL) return 0; - if (tableid >= countof(keyboard->table)) - return 0; + if (table_id >= countof(keyboard->table)) + return 0; if (key >= HANGUL_KEYBOARD_TABLE_SIZE) return 0; - ucschar* table = keyboard->table[tableid]; + ucschar* table = keyboard->table[table_id]; if (table == NULL) return 0; @@ -446,18 +446,18 @@ hangul_keyboard_get_mapping(const HangulKeyboard* keyboard, int tableid, unsigne } static void -hangul_keyboard_set_mapping(HangulKeyboard *keyboard, int tableid, unsigned key, ucschar value) +hangul_keyboard_set_mapping(HangulKeyboard *keyboard, int table_id, unsigned key, ucschar value) { if (keyboard == NULL) return; - if (tableid >= countof(keyboard->table)) - return; + if (table_id >= countof(keyboard->table)) + return; if (key >= HANGUL_KEYBOARD_TABLE_SIZE) return; - if (keyboard->table[tableid] == NULL) { + if (keyboard->table[table_id] == NULL) { ucschar* new_table = malloc(sizeof(ucschar) * HANGUL_KEYBOARD_TABLE_SIZE); if (new_table == NULL) return; @@ -466,10 +466,10 @@ hangul_keyboard_set_mapping(HangulKeyboard *keyboard, int tableid, unsigned key, for (i = 0; i < HANGUL_KEYBOARD_TABLE_SIZE; ++i) { new_table[i] = 0; } - keyboard->table[tableid] = new_table; + keyboard->table[table_id] = new_table; } - ucschar* table = keyboard->table[tableid]; + ucschar* table = keyboard->table[table_id]; table[key] = value; } |