From 840c16f4a673beb3b33bc62759fae46ea887f3d2 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 8 Apr 2014 13:39:11 +0800 Subject: rename some public enums --- src/storage/chewing_large_table.cpp | 40 ++++++++++++++++++------------------- src/storage/pinyin_parser2.cpp | 8 ++++---- src/storage/pinyin_parser2.h | 20 +++++++++---------- src/storage/zhuyin_custom2.h | 32 ++++++++++++++--------------- tests/lookup/test_pinyin_lookup.cpp | 3 +-- 5 files changed, 51 insertions(+), 52 deletions(-) diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp index e611dab..c86e759 100644 --- a/src/storage/chewing_large_table.cpp +++ b/src/storage/chewing_large_table.cpp @@ -156,29 +156,29 @@ int ChewingBitmapIndexLevel::initial_level_search (int phrase_length, const ChewingKey & first_key = keys[0]; switch(first_key.m_initial) { - MATCH(PINYIN_AMB_C_CH, CHEWING_C, CHEWING_CH); - MATCH(PINYIN_AMB_C_CH, CHEWING_CH, CHEWING_C); - MATCH(PINYIN_AMB_Z_ZH, CHEWING_Z, CHEWING_ZH); - MATCH(PINYIN_AMB_Z_ZH, CHEWING_ZH, CHEWING_Z); - MATCH(PINYIN_AMB_S_SH, CHEWING_S, CHEWING_SH); - MATCH(PINYIN_AMB_S_SH, CHEWING_SH, CHEWING_S); - MATCH(PINYIN_AMB_L_R, CHEWING_R, CHEWING_L); - MATCH(PINYIN_AMB_L_N, CHEWING_N, CHEWING_L); - MATCH(PINYIN_AMB_F_H, CHEWING_F, CHEWING_H); - MATCH(PINYIN_AMB_F_H, CHEWING_H, CHEWING_F); - MATCH(PINYIN_AMB_G_K, CHEWING_G, CHEWING_K); - MATCH(PINYIN_AMB_G_K, CHEWING_K, CHEWING_G); + MATCH(ZHUYIN_AMB_C_CH, CHEWING_C, CHEWING_CH); + MATCH(ZHUYIN_AMB_C_CH, CHEWING_CH, CHEWING_C); + MATCH(ZHUYIN_AMB_Z_ZH, CHEWING_Z, CHEWING_ZH); + MATCH(ZHUYIN_AMB_Z_ZH, CHEWING_ZH, CHEWING_Z); + MATCH(ZHUYIN_AMB_S_SH, CHEWING_S, CHEWING_SH); + MATCH(ZHUYIN_AMB_S_SH, CHEWING_SH, CHEWING_S); + MATCH(ZHUYIN_AMB_L_R, CHEWING_R, CHEWING_L); + MATCH(ZHUYIN_AMB_L_N, CHEWING_N, CHEWING_L); + MATCH(ZHUYIN_AMB_F_H, CHEWING_F, CHEWING_H); + MATCH(ZHUYIN_AMB_F_H, CHEWING_H, CHEWING_F); + MATCH(ZHUYIN_AMB_G_K, CHEWING_G, CHEWING_K); + MATCH(ZHUYIN_AMB_G_K, CHEWING_K, CHEWING_G); case CHEWING_L: { result |= middle_and_final_level_search (CHEWING_L, phrase_length, keys, ranges); - if (m_options & PINYIN_AMB_L_N) + if (m_options & ZHUYIN_AMB_L_N) result |= middle_and_final_level_search (CHEWING_N, phrase_length, keys,ranges); - if (m_options & PINYIN_AMB_L_R) + if (m_options & ZHUYIN_AMB_L_R) result |= middle_and_final_level_search (CHEWING_R, phrase_length, keys, ranges); return result; @@ -246,12 +246,12 @@ int ChewingBitmapIndexLevel::middle_and_final_level_search } } - MATCH(PINYIN_AMB_AN_ANG, CHEWING_AN, CHEWING_ANG); - MATCH(PINYIN_AMB_AN_ANG, CHEWING_ANG, CHEWING_AN); - MATCH(PINYIN_AMB_EN_ENG, CHEWING_EN, CHEWING_ENG); - MATCH(PINYIN_AMB_EN_ENG, CHEWING_ENG, CHEWING_EN); - MATCH(PINYIN_AMB_IN_ING, PINYIN_IN, PINYIN_ING); - MATCH(PINYIN_AMB_IN_ING, PINYIN_ING, PINYIN_IN); + MATCH(ZHUYIN_AMB_AN_ANG, CHEWING_AN, CHEWING_ANG); + MATCH(ZHUYIN_AMB_AN_ANG, CHEWING_ANG, CHEWING_AN); + MATCH(ZHUYIN_AMB_EN_ENG, CHEWING_EN, CHEWING_ENG); + MATCH(ZHUYIN_AMB_EN_ENG, CHEWING_ENG, CHEWING_EN); + MATCH(ZHUYIN_AMB_IN_ING, PINYIN_IN, PINYIN_ING); + MATCH(ZHUYIN_AMB_IN_ING, PINYIN_ING, PINYIN_IN); default: { diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp index 6fe8a19..9fabd8a 100644 --- a/src/storage/pinyin_parser2.cpp +++ b/src/storage/pinyin_parser2.cpp @@ -554,7 +554,7 @@ static int search_chewing_symbols2(const chewing_symbol_item_t * symbol_table, bool ChewingSimpleParser2::parse_one_key(pinyin_option_t options, ChewingKey & key, const char * str, int len) const { - options &= ~PINYIN_AMB_ALL; + options &= ~ZHUYIN_AMB_ALL; unsigned char tone = CHEWING_ZERO_TONE; int symbols_len = len; @@ -611,7 +611,7 @@ bool ChewingDiscreteParser2::parse_one_key(pinyin_option_t options, if (0 == len) return false; - options &= ~PINYIN_AMB_ALL; + options &= ~ZHUYIN_AMB_ALL; int index = 0; const char * initial = ""; @@ -843,7 +843,7 @@ bool ChewingDaChenCP26Parser2::parse_one_key(pinyin_option_t options, if (0 == len) return false; - options &= ~PINYIN_AMB_ALL; + options &= ~ZHUYIN_AMB_ALL; const char * initial = ""; const char * middle = ""; @@ -1164,7 +1164,7 @@ ChewingDirectParser2::ChewingDirectParser2 (){ bool ChewingDirectParser2::parse_one_key(pinyin_option_t options, ChewingKey & key, const char *str, int len) const { - options &= ~PINYIN_AMB_ALL; + options &= ~ZHUYIN_AMB_ALL; unsigned char tone = CHEWING_ZERO_TONE; if (0 == len) diff --git a/src/storage/pinyin_parser2.h b/src/storage/pinyin_parser2.h index 82edbb6..0fbfb54 100644 --- a/src/storage/pinyin_parser2.h +++ b/src/storage/pinyin_parser2.h @@ -267,37 +267,37 @@ inline int pinyin_compare_initial2(pinyin_option_t options, if (lhs == rhs) return 0; - if ((options & PINYIN_AMB_C_CH) && + if ((options & ZHUYIN_AMB_C_CH) && ((lhs == CHEWING_C && rhs == CHEWING_CH) || (lhs == CHEWING_CH && rhs == CHEWING_C))) return 0; - if ((options & PINYIN_AMB_S_SH) && + if ((options & ZHUYIN_AMB_S_SH) && ((lhs == CHEWING_S && rhs == CHEWING_SH) || (lhs == CHEWING_SH && rhs == CHEWING_S))) return 0; - if ((options & PINYIN_AMB_Z_ZH) && + if ((options & ZHUYIN_AMB_Z_ZH) && ((lhs == CHEWING_Z && rhs == CHEWING_ZH) || (lhs == CHEWING_ZH && rhs == CHEWING_Z))) return 0; - if ((options & PINYIN_AMB_F_H) && + if ((options & ZHUYIN_AMB_F_H) && ((lhs == CHEWING_F && rhs == CHEWING_H) || (lhs == CHEWING_H && rhs == CHEWING_F))) return 0; - if ((options & PINYIN_AMB_L_N) && + if ((options & ZHUYIN_AMB_L_N) && ((lhs == CHEWING_L && rhs == CHEWING_N) || (lhs == CHEWING_N && rhs == CHEWING_L))) return 0; - if ((options & PINYIN_AMB_L_R) && + if ((options & ZHUYIN_AMB_L_R) && ((lhs == CHEWING_L && rhs == CHEWING_R) || (lhs == CHEWING_R && rhs == CHEWING_L))) return 0; - if ((options & PINYIN_AMB_G_K) && + if ((options & ZHUYIN_AMB_G_K) && ((lhs == CHEWING_G && rhs == CHEWING_K) || (lhs == CHEWING_K && rhs == CHEWING_G))) return 0; @@ -329,17 +329,17 @@ inline int pinyin_compare_middle_and_final2(pinyin_option_t options, if (middle_diff) return middle_diff; - if ((options & PINYIN_AMB_AN_ANG) && + if ((options & ZHUYIN_AMB_AN_ANG) && ((final_lhs == CHEWING_AN && final_rhs == CHEWING_ANG) || (final_lhs == CHEWING_ANG && final_rhs == CHEWING_AN))) return 0; - if ((options & PINYIN_AMB_EN_ENG) && + if ((options & ZHUYIN_AMB_EN_ENG) && ((final_lhs == CHEWING_EN && final_rhs == CHEWING_ENG) || (final_lhs == CHEWING_ENG && final_rhs == CHEWING_EN))) return 0; - if ((options & PINYIN_AMB_IN_ING) && + if ((options & ZHUYIN_AMB_IN_ING) && ((final_lhs == PINYIN_IN && final_rhs == PINYIN_ING) || (final_lhs == PINYIN_ING && final_rhs == PINYIN_IN))) return 0; diff --git a/src/storage/zhuyin_custom2.h b/src/storage/zhuyin_custom2.h index 671a137..1b1fd26 100644 --- a/src/storage/zhuyin_custom2.h +++ b/src/storage/zhuyin_custom2.h @@ -27,9 +27,9 @@ G_BEGIN_DECLS /** - * PinyinTableFlag: + * ZhuyinTableFlag: */ -enum PinyinTableFlag{ +enum ZhuyinTableFlag{ IS_BOPOMOFO = 1U << 1, IS_PINYIN = 1U << 2, PINYIN_INCOMPLETE = 1U << 3, @@ -43,23 +43,23 @@ enum PinyinTableFlag{ }; /** - * PinyinAmbiguity2: + * ZhuyinAmbiguity2: * - * The enums of pinyin ambiguities. + * The enums of zhuyin ambiguities. * */ -enum PinyinAmbiguity2{ - PINYIN_AMB_C_CH = 1U << 12, - PINYIN_AMB_S_SH = 1U << 13, - PINYIN_AMB_Z_ZH = 1U << 14, - PINYIN_AMB_F_H = 1U << 15, - PINYIN_AMB_G_K = 1U << 16, - PINYIN_AMB_L_N = 1U << 17, - PINYIN_AMB_L_R = 1U << 18, - PINYIN_AMB_AN_ANG = 1U << 19, - PINYIN_AMB_EN_ENG = 1U << 20, - PINYIN_AMB_IN_ING = 1U << 21, - PINYIN_AMB_ALL = 0x3FFU << 12 +enum ZhuyinAmbiguity2{ + ZHUYIN_AMB_C_CH = 1U << 12, + ZHUYIN_AMB_S_SH = 1U << 13, + ZHUYIN_AMB_Z_ZH = 1U << 14, + ZHUYIN_AMB_F_H = 1U << 15, + ZHUYIN_AMB_G_K = 1U << 16, + ZHUYIN_AMB_L_N = 1U << 17, + ZHUYIN_AMB_L_R = 1U << 18, + ZHUYIN_AMB_AN_ANG = 1U << 19, + ZHUYIN_AMB_EN_ENG = 1U << 20, + ZHUYIN_AMB_IN_ING = 1U << 21, + ZHUYIN_AMB_ALL = 0x3FFU << 12 }; /** diff --git a/tests/lookup/test_pinyin_lookup.cpp b/tests/lookup/test_pinyin_lookup.cpp index da29e0f..a37c8d4 100644 --- a/tests/lookup/test_pinyin_lookup.cpp +++ b/tests/lookup/test_pinyin_lookup.cpp @@ -36,8 +36,7 @@ int main( int argc, char * argv[]){ exit(ENOENT); } - pinyin_option_t options = - USE_TONE | PINYIN_AMB_ALL; + pinyin_option_t options = USE_TONE; FacadeChewingTable largetable; MemoryChunk * chunk = new MemoryChunk; -- cgit