diff options
Diffstat (limited to 'native/jni/src/defines.h')
-rw-r--r-- | native/jni/src/defines.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h index 484fc6bde..28661ab20 100644 --- a/native/jni/src/defines.h +++ b/native/jni/src/defines.h @@ -83,12 +83,38 @@ static inline void dumpWordInt(const int *word, const int length) { AKLOGI("i[ %s ]", charBuf); } +#ifndef __ANDROID__ +#define ASSERT(success) do { if(!success) { showStackTrace(); assert(success);};} while (0) +#define SHOW_STACK_TRACE do { showStackTrace(); } while (0) + +#include <execinfo.h> +#include <stdlib.h> +static inline void showStackTrace() { + void *callstack[128]; + int i, frames = backtrace(callstack, 128); + char **strs = backtrace_symbols(callstack, frames); + for (i = 0; i < frames; ++i) { + if (i == 0) { + AKLOGI("=== Trace ==="); + continue; + } + AKLOGI("%s", strs[i]); + } + free(strs); +} +#else +#define ASSERT(success) +#define SHOW_STACK_TRACE +#endif + #else #define AKLOGE(fmt, ...) #define AKLOGI(fmt, ...) #define DUMP_RESULT(words, frequencies, maxWordCount, maxWordLength) #define DUMP_WORD(word, length) #define DUMP_WORD_INT(word, length) +#define ASSERT(success) +#define SHOW_STACK_TRACE #endif #ifdef FLAG_DO_PROFILE @@ -294,12 +320,13 @@ static inline void prof_out(void) { #define MAX_SPACES_INTERNAL 16 +// Max Distance between point to key +#define MAX_POINT_TO_KEY_LENGTH 10000000 + // TODO: Reduce this constant if possible; check the maximum number of digraphs in the same // word in the dictionary for languages with digraphs, like German and French #define DEFAULT_MAX_DIGRAPH_SEARCH_DEPTH 5 -// Minimum suggest depth for one word for all cases except for missing space suggestions. -#define MIN_SUGGEST_DEPTH 1 #define MIN_USER_TYPED_LENGTH_FOR_MULTIPLE_WORD_SUGGESTION 3 #define MIN_USER_TYPED_LENGTH_FOR_EXCESSIVE_CHARACTER_SUGGESTION 3 |