aboutsummaryrefslogtreecommitdiffstats
path: root/native/jni/src
diff options
context:
space:
mode:
authorSatoshi Kataoka <satok@google.com>2012-09-10 19:13:26 +0900
committerSatoshi Kataoka <satok@google.com>2012-09-10 19:36:38 +0900
commitd45c0faec365064d3ca94dc606309386e94ce7ba (patch)
tree6db8fda35adf36ca1dd0b36178be7a8acb6bcf71 /native/jni/src
parent23a57eafbbe9eaf8c9f898869872da6f5717af16 (diff)
downloadlatinime-d45c0faec365064d3ca94dc606309386e94ce7ba.tar.gz
latinime-d45c0faec365064d3ca94dc606309386e94ce7ba.tar.xz
latinime-d45c0faec365064d3ca94dc606309386e94ce7ba.zip
Add debug utils for geometric input
Change-Id: If01bd5593cfc7428572aa43253d6d72409ac6b8e
Diffstat (limited to 'native/jni/src')
-rw-r--r--native/jni/src/defines.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/native/jni/src/defines.h b/native/jni/src/defines.h
index 83fc73cde..95a90275d 100644
--- a/native/jni/src/defines.h
+++ b/native/jni/src/defines.h
@@ -31,6 +31,9 @@
dumpResult(words, frequencies, maxWordCount, maxWordLength); } while (0)
#define DUMP_WORD(word, length) do { dumpWord(word, length); } while (0)
#define DUMP_WORD_INT(word, length) do { dumpWordInt(word, length); } while (0)
+// TODO: INTS_TO_CHARS
+#define SHORTS_TO_CHARS(input, length, output) do { \
+ shortArrayToCharArray(input, length, output); } while (0)
static inline void dumpWordInfo(const unsigned short *word, const int length,
const int rank, const int frequency) {
@@ -87,6 +90,21 @@ static inline void dumpWordInt(const int *word, const int length) {
AKLOGI("i[ %s ]", charBuf);
}
+// TODO: Change this to intArrayToCharArray
+static inline void shortArrayToCharArray(
+ const unsigned short *input, const int length, char *output) {
+ int i = 0;
+ for (;i < length; ++i) {
+ const unsigned short c = input[i];
+ if (c == 0) {
+ break;
+ }
+ // static_cast only for debugging
+ output[i] = static_cast<char>(c);
+ }
+ output[i] = 0;
+}
+
#ifndef __ANDROID__
#include <cassert>
#include <execinfo.h>
@@ -122,6 +140,8 @@ static inline void showStackTrace() {
#define DUMP_WORD_INT(word, length)
#define ASSERT(success)
#define SHOW_STACK_TRACE
+// TODO: INTS_TO_CHARS
+#define SHORTS_TO_CHARS(input, length, output)
#endif
#ifdef FLAG_DO_PROFILE