aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/defines.h')
-rw-r--r--native/src/defines.h57
1 files changed, 33 insertions, 24 deletions
diff --git a/native/src/defines.h b/native/src/defines.h
index 00cbb6c9e..a516190af 100644
--- a/native/src/defines.h
+++ b/native/src/defines.h
@@ -18,18 +18,7 @@
#ifndef LATINIME_DEFINES_H
#define LATINIME_DEFINES_H
-#ifdef FLAG_DBG
-#include <cutils/log.h>
-#ifndef LOG_TAG
-#define LOG_TAG "LatinIME: "
-#endif
-#define DEBUG_DICT true
-#define DEBUG_DICT_FULL false
-#define DEBUG_SHOW_FOUND_WORD DEBUG_DICT_FULL
-#define DEBUG_NODE DEBUG_DICT_FULL
-#define DEBUG_TRACE DEBUG_DICT_FULL
-#define DEBUG_PROXIMITY_INFO true
-
+#ifdef FLAG_DO_PROFILE
// Profiler
#include <time.h>
#define PROF_BUF_SIZE 100
@@ -76,16 +65,7 @@ static void prof_out(void) {
}
}
-#else // FLAG_DBG
-#define LOGE
-#define LOGI
-#define DEBUG_DICT false
-#define DEBUG_DICT_FULL false
-#define DEBUG_SHOW_FOUND_WORD false
-#define DEBUG_NODE false
-#define DEBUG_TRACE false
-#define DEBUG_PROXIMITY_INFO false
-
+#else // FLAG_DO_PROFILE
#define PROF_BUF_SIZE 0
#define PROF_RESET
#define PROF_COUNT(prof_buf_id)
@@ -97,6 +77,30 @@ static void prof_out(void) {
#define PROF_CLOCKOUT(prof_buf_id)
#define PROF_OUTALL
+#endif // FLAG_DO_PROFILE
+
+#ifdef FLAG_DBG
+#include <cutils/log.h>
+#ifndef LOG_TAG
+#define LOG_TAG "LatinIME: "
+#endif
+#define DEBUG_DICT true
+#define DEBUG_DICT_FULL false
+#define DEBUG_SHOW_FOUND_WORD DEBUG_DICT_FULL
+#define DEBUG_NODE DEBUG_DICT_FULL
+#define DEBUG_TRACE DEBUG_DICT_FULL
+#define DEBUG_PROXIMITY_INFO true
+
+#else // FLAG_DBG
+#define LOGE(fmt, ...)
+#define LOGI(fmt, ...)
+#define DEBUG_DICT false
+#define DEBUG_DICT_FULL false
+#define DEBUG_SHOW_FOUND_WORD false
+#define DEBUG_NODE false
+#define DEBUG_TRACE false
+#define DEBUG_PROXIMITY_INFO false
+
#endif // FLAG_DBG
#ifndef U_SHORT_MAX
@@ -126,8 +130,11 @@ static void prof_out(void) {
#define FLAG_BIGRAM_FREQ 0x7F
#define DICTIONARY_VERSION_MIN 200
+// TODO: remove this constant when the switch to the new dict format is over
#define DICTIONARY_HEADER_SIZE 2
+#define NEW_DICTIONARY_HEADER_SIZE 5
#define NOT_VALID_WORD -99
+#define NOT_A_CHARACTER -1
#define KEYCODE_SPACE ' '
@@ -138,12 +145,14 @@ static void prof_out(void) {
#define SUGGEST_WORDS_WITH_SPACE_PROXIMITY true
// The following "rate"s are used as a multiplier before dividing by 100, so they are in percent.
-#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 70
-#define WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE 80
+#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_RATE 80
+#define WORDS_WITH_MISSING_CHARACTER_DEMOTION_START_POS_10X 12
+#define WORDS_WITH_MISSING_SPACE_CHARACTER_DEMOTION_RATE 67
#define WORDS_WITH_EXCESSIVE_CHARACTER_DEMOTION_RATE 75
#define WORDS_WITH_EXCESSIVE_CHARACTER_OUT_OF_PROXIMITY_DEMOTION_RATE 75
#define WORDS_WITH_TRANSPOSED_CHARACTERS_DEMOTION_RATE 60
#define FULL_MATCHED_WORDS_PROMOTION_RATE 120
+#define WORDS_WITH_PROXIMITY_CHARACTER_DEMOTION_RATE 90
// This should be greater than or equal to MAX_WORD_LENGTH defined in BinaryDictionary.java
// This is only used for the size of array. Not to be used in c functions.