From e5037c59a3701030a8012a6d03a214f7dabb2824 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 18 Aug 2016 10:01:41 +0900 Subject: [PATCH] Fix coding rule Change-Id: Ifada3114b56e36ff5fe4a7a74ec10d2b24420e13 --- src/sdk/cji.cpp | 41 +++++++++++------------------------------ src/sdk/cji.h | 8 +------- src/sdk/sdk.cpp | 6 ++---- 3 files changed, 14 insertions(+), 41 deletions(-) diff --git a/src/sdk/cji.cpp b/src/sdk/cji.cpp index 88aaa33..0491650 100644 --- a/src/sdk/cji.cpp +++ b/src/sdk/cji.cpp @@ -26,8 +26,8 @@ static MAKECODE g_makecode_backup; static AUTOMATA_HISTORY_INFO g_AH_Stack[MAX_AUTOMATA_HISTORY_LENGTH]; // Automata History Stack static AUTOMATA_HISTORY_INFO g_AH_Stack_backup[MAX_AUTOMATA_HISTORY_LENGTH]; // Automata History Stack -static int g_AH_Stack_ptr=0; -static int g_AH_Stack_ptr_backup=0; +static int g_AH_Stack_ptr = 0; +static int g_AH_Stack_ptr_backup = 0; #ifndef TRUE #define TRUE 1 @@ -118,10 +118,10 @@ int CJI_Automata(int p_isJAEUM, short p_SIPKey, MADECODE *p_madecode) p_LastSIPKey = SIPKEY_ERROR; } - if(p_SIPKey == (short)SIPKEY_ERROR) { + if (p_SIPKey == (short)SIPKEY_ERROR) { return ACTION_ERROR_KEY(p_SIPKey, p_madecode); } - if(p_SIPKey == (short)SIPKEY_BACKSPACE) { + if (p_SIPKey == (short)SIPKEY_BACKSPACE) { return ACTION_BACKSPACE_KEY(p_SIPKey, p_madecode); } @@ -130,7 +130,6 @@ int CJI_Automata(int p_isJAEUM, short p_SIPKey, MADECODE *p_madecode) pushEnvToAutomataHistoryStack(current_state, g_makecode); //현재 오토마타 환경을 Stack에 저장하고 Next State로 이동한다. switch (current_state) { - case EMPTY_STATE : //current_State 가 EMPTY_STATE 일 경우 if (p_isJAEUM == TRUE) { //입력문자가 자음이면 current_state = CHO_STATE; //NEXT_STATE로 CHO_STATE를 Setting @@ -377,7 +376,6 @@ void ACTION_EMPTY_2_CHO(short p_SIPKey, MADECODE *p_madecode) void ACTION_CHO_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < 3); //천지인만 허용 @@ -420,7 +418,6 @@ void ACTION_CHO_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) void ACTION_CHO_JUNG_2_CHO_JUNG(short p_SIPKey, short p_jung_idx, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_jung_idx >= 0 && p_jung_idx < JUNG_TABLE_SIZE); @@ -476,7 +473,6 @@ void ACTION_CHO_JUNG_2_CHO_JUNG(short p_SIPKey, short p_jung_idx, MADECODE *p_ma void ACTION_CHO_JUNG_2_CHO(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < CHO_TABLE_SIZE); @@ -543,9 +539,10 @@ void ACTION_CHO_JUNG_2_CHO_JUNG_SINGLEJONG(short p_SIPKey, MADECODE *p_madecode) bool ACTION_ERROR_KEY(short p_SIPKey, MADECODE *p_madecode) { bool ret = FALSE; - if(current_state != EMPTY_STATE) { + if (current_state != EMPTY_STATE) { ret = TRUE; } + p_madecode->size = g_makecode.size; p_madecode->ucode[0] = g_makecode.ucode[0]; p_madecode->ucode[1] = g_makecode.ucode[1]; @@ -557,7 +554,7 @@ bool ACTION_ERROR_KEY(short p_SIPKey, MADECODE *p_madecode) bool ACTION_BACKSPACE_KEY(short p_SIPKey, MADECODE *p_madecode) { - switch(current_state) { + switch (current_state) { case EMPTY_STATE: { return FALSE; @@ -580,10 +577,10 @@ bool ACTION_BACKSPACE_KEY(short p_SIPKey, MADECODE *p_madecode) case CHO_JUNG_STATE: case NOCHO_JUNG_ERROR_STATE: { - if(BS_MOEUMInfo_Automata[g_makecode.jung_idx] != EMPTY_CODE) { + if (BS_MOEUMInfo_Automata[g_makecode.jung_idx] != EMPTY_CODE) { g_makecode.jung_idx = BS_MOEUMInfo_Automata[g_makecode.jung_idx]; g_makecode.size = 1; //조합중인 코드 사이즈 1 - if(current_state == CHO_JUNG_STATE) { + if (current_state == CHO_JUNG_STATE) { g_makecode.ucode[0] = getUnicodeWithCHO_JUNG(g_makecode.cho_idx, g_makecode.jung_idx); //조합중인 글자의 유니코드 } else { /* NOCHO_JUNG_ERROR_STATE */ g_makecode.ucode[0] = JUNGUnicodeTable[g_makecode.jung_idx] + COMPENSATE_VALUE_FOR_JUNGUCODE; //조합중인 글자의 유니코드 @@ -650,7 +647,6 @@ void ACTION_CHO_JUNG_2_CHO_JUNG_CHO(short p_SIPKey, MADECODE *p_madecode) void ACTION_CHO_JUNG_CHO_2_CHO(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < CHO_TABLE_SIZE); @@ -675,7 +671,6 @@ void ACTION_CHO_JUNG_CHO_2_CHO(short p_SIPKey, MADECODE *p_madecode) /* Post Condition */ ASSERT(g_makecode.cho_idx >= 0 && g_makecode.cho_idx < CHO_TABLE_SIZE); #endif // CJI_DEBUG - } /** @@ -689,7 +684,6 @@ void ACTION_CHO_JUNG_CHO_2_CHO(short p_SIPKey, MADECODE *p_madecode) void ACTION_CHO_JUNG_CHO_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < CHO_TABLE_SIZE); @@ -719,10 +713,8 @@ void ACTION_CHO_JUNG_CHO_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) /* Post Condition */ ASSERT(g_makecode.cho_idx >= 0 && g_makecode.cho_idx < CHO_TABLE_SIZE); #endif // CJI_DEBUG - } - /** * ACTION_CHO_JUNG_SINGLEJONG_2_CHO_JUNG_SINGLEJONG_CHO : CHO_JUNG_SINGLEJONG_STATE에서 CHO_JUNG_SINGLEJONG_CHO_STATE로 갈때 처리 - 초성 입력이지만 조합 완료시키지 않음 * - 입력 @@ -772,7 +764,6 @@ void ACTION_CHO_JUNG_SINGLEJONG_2_CHO_JUNG_SINGLEJONG_CHO(short p_SIPKey, MADECO void ACTION_CHO_JUNG_SINGLEJONG_CHO_2_CHO(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < CHO_TABLE_SIZE); @@ -797,7 +788,6 @@ void ACTION_CHO_JUNG_SINGLEJONG_CHO_2_CHO(short p_SIPKey, MADECODE *p_madecode) /* Post Condition */ ASSERT(g_makecode.cho_idx >= 0 && g_makecode.cho_idx < CHO_TABLE_SIZE); #endif // CJI_DEBUG - } /** @@ -811,7 +801,6 @@ void ACTION_CHO_JUNG_SINGLEJONG_CHO_2_CHO(short p_SIPKey, MADECODE *p_madecode) void ACTION_CHO_JUNG_SINGLEJONG_CHO_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < CHO_TABLE_SIZE); @@ -863,7 +852,6 @@ void ACTION_CHO_JUNG_SINGLEJONG_CHO_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madec void ACTION_CHO_JUNG_SINGLEJONG_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < 3); //천지인 @@ -920,8 +908,6 @@ void ACTION_CHO_JUNG_SINGLEJONG_2_CHO_JUNG(short p_SIPKey, MADECODE *p_madecode) void ACTION_CHO_JUNG_SINGLEJONG_2_CHO(short p_SIPKey, MADECODE *p_madecode) { - - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_SIPKey >= 0 && p_SIPKey < CHO_TABLE_SIZE); @@ -1099,7 +1085,6 @@ short getUnicodeWithCHO_JUNG(short p_cho_idx, short p_jung_idx) #endif // CJI_DEBUG return (((p_cho_idx * 21) + p_jung_idx - 2) * 28) + 0xAC00; - } /** @@ -1115,10 +1100,8 @@ short getUnicodeWithCHO_JUNG_JONG(short p_cho_idx, short p_jung_idx, short p_jon #endif // CJI_DEBUG return (((p_cho_idx * 21) + p_jung_idx - 2) * 28) + (p_jong_idx + 1) + 0xAC00; - } - /** * 종성과 입력된 키가 결합한 이중 자음의 인덱스를 가져온다. * 종성과 입력된 SIPKey가 결합되어 이중자음을 생성할 때 사용 : Sparse Matrix 이나 프로그램으로 해결 @@ -1417,7 +1400,7 @@ void ACTION_ERROR_CHO_JUNG_2_NOCHO_JUNG(short p_SIPKey, MADECODE *p_madecode) #endif // CJI_DEBUG // 조합완료 문자만들기 - if(g_makecode.jung_idx == CHUN_MOEUM_AUTOMATA_INDEX || g_makecode.jung_idx == CHUN_CHUN_MOEUM_AUTOMATA_INDEX) { // "." 이거나 ".." 인 경우 처리 + if (g_makecode.jung_idx == CHUN_MOEUM_AUTOMATA_INDEX || g_makecode.jung_idx == CHUN_CHUN_MOEUM_AUTOMATA_INDEX) { // "." 이거나 ".." 인 경우 처리 p_madecode->size = 2; //조합 완료된 글자의 코드 사이즈 2 p_madecode->ucode[0] = HCJAMOUnicodeTable[CHO2HCJAMOTable[g_makecode.cho_idx]]; //조합 완료된 글자의 유니코드 p_madecode->ucode[1] = JUNGUnicodeTable[g_makecode.jung_idx]; //조합 완료된 글자의 유니코드 @@ -1432,7 +1415,7 @@ void ACTION_ERROR_CHO_JUNG_2_NOCHO_JUNG(short p_SIPKey, MADECODE *p_madecode) g_makecode.cho_idx = EMPTY_CODE; //초성은 비어있음 g_makecode.jong_idx = EMPTY_CODE; //종성은 비어있음 g_makecode.size = 1; //조합중인 코드 사이즈 1 - if(g_makecode.jung_idx == CHUN_MOEUM_AUTOMATA_INDEX || g_makecode.jung_idx == CHUN_CHUN_MOEUM_AUTOMATA_INDEX) { // "." 이거나 ".." 인 경우 처리 + if (g_makecode.jung_idx == CHUN_MOEUM_AUTOMATA_INDEX || g_makecode.jung_idx == CHUN_CHUN_MOEUM_AUTOMATA_INDEX) { // "." 이거나 ".." 인 경우 처리 g_makecode.size = 1; //조합중인 글자의 코드 사이즈 2 g_makecode.ucode[0] = JUNGUnicodeTable[g_makecode.jung_idx]; //조합중인 글자의 유니코드 } else { @@ -1704,7 +1687,6 @@ void initAutomataHistoryStack() */ void pushEnvToAutomataHistoryStack(int p_state, MAKECODE p_tmp_makecode) { - #ifdef CJI_DEBUG /* Pre Condition */ ASSERT(p_state > EMPTY_STATE); @@ -1765,7 +1747,6 @@ void popFromAutomataHistoryStack() #endif // CJI_DEBUG return; - } /** diff --git a/src/sdk/cji.h b/src/sdk/cji.h index feb0b32..f9aa734 100644 --- a/src/sdk/cji.h +++ b/src/sdk/cji.h @@ -184,10 +184,8 @@ extern "C"{ 0x1173, /* 20 ㅡ */ 0x1174, /* 21 ㅢ */ 0x1175, /* 22 ㅣ */ - }; - /** * 모음 오토마타 * - 현재 모음과 입력된 모음(천지인)이 결합하여 생성되는 모음의 index를 표시 @@ -234,10 +232,9 @@ extern "C"{ /* 20 ㅡ */ {15, COMBINATION_FAIL, 21, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, 21, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL}, /* 21 ㅢ */ {COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL}, /* 22 ㅣ */ {2, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL, COMBINATION_FAIL}, -/* 23 EMPTY */ {0, 20, 22, 2, 4, 6, 8, 10, 14, 15, 19, 20, 22, 3, 7, 5, 9,}, +/* 23 EMPTY */ {0, 20, 22, 2, 4, 6, 8, 10, 14, 15, 19, 20, 22, 3, 7, 5, 9, }, }; - /** * 종성의 Unicode 값 정의 */ @@ -310,10 +307,8 @@ extern "C"{ {INVALID, INVALID}, /* 24 ㅌ */ {INVALID, INVALID}, /* 25 ㅍ */ {INVALID, INVALID}, /* 26 ㅎ */ - }; - /** * HCJAMO(Hangul Compatibility Jamo) Unicode Table * - 초성이나 중성, 종성등이 조합되지 않고 단독으로 쓰일 때는 Unicode Hangul Compatibility Jamo 를 사용해야 한다. @@ -354,7 +349,6 @@ extern "C"{ 0x314C, /* 27 ㅌ */ 0x314D, /* 28 ㅍ */ 0x314E, /* 29 ㅎ */ - }; /** diff --git a/src/sdk/sdk.cpp b/src/sdk/sdk.cpp index 9036aaa..e7a305c 100644 --- a/src/sdk/sdk.cpp +++ b/src/sdk/sdk.cpp @@ -133,8 +133,7 @@ int iconv_string(const char *from, const char *to, const char *src, char *dst, s /* for 2-byte code incompleteness */ inptr++; inleftsize--; - } - else if (errno == EINVAL) { /* incomplete char, need readin more codes */ + } else if (errno == EINVAL) { /* incomplete char, need readin more codes */ fprintf(stderr, "iconv_str: incomplete char or shift sequence\n"); if (inleftsize <= 2) { *outptr = '?'; @@ -321,8 +320,7 @@ SCLEventReturnType CSDKISE::on_event_key_clicked(SclUIEventDesc event_desc) if (event_desc.key_event == MVK_BackSpace) { if (process_korean_automata(false, SIPKEY_BACKSPACE)) ret = SCL_EVENT_DONE; - } - else { + } else { if (process_korean_automata(false, SIPKEY_ERROR)) ret = SCL_EVENT_DONE; } -- 2.7.4