aboutsummaryrefslogtreecommitdiffstats
path: root/native/src/debug.h
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-02-18 17:50:58 +0900
committerJean Chalard <jchalard@google.com>2011-02-22 15:27:06 +0900
commita5d58497018f465080f08fbbfed35de883bc8be3 (patch)
treebbddfeca6083af2cda1bc069de6abefcbfec53d1 /native/src/debug.h
parent050c0462dc2ada5a5afecec5b6745693c5066b85 (diff)
downloadlatinime-a5d58497018f465080f08fbbfed35de883bc8be3.tar.gz
latinime-a5d58497018f465080f08fbbfed35de883bc8be3.tar.xz
latinime-a5d58497018f465080f08fbbfed35de883bc8be3.zip
Force autocorrection of matching words with different accents.
When entering a word without accents the user expects the system to add accents automatically if there is no other matching word. This patch ensures the accented version is promoted accordingly and autocorrection really takes place. Issue: 3400015 Change-Id: I8cd3db5bf131ec6844b26abecc1ecbd1d6269df4
Diffstat (limited to 'native/src/debug.h')
-rw-r--r--native/src/debug.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/native/src/debug.h b/native/src/debug.h
new file mode 100644
index 000000000..e5572e1a5
--- /dev/null
+++ b/native/src/debug.h
@@ -0,0 +1,58 @@
+/*
+**
+** Copyright 2011, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#ifndef LATINIME_DEBUG_H
+#define LATINIME_DEBUG_H
+
+#include "defines.h"
+
+static inline unsigned char* convertToUnibyteString(unsigned short* input, unsigned char* output,
+ const unsigned int length) {
+ int i = 0;
+ for (; i <= length && input[i] != 0; ++i)
+ output[i] = input[i] & 0xFF;
+ output[i] = 0;
+ return output;
+}
+static inline unsigned char* convertToUnibyteStringAndReplaceLastChar(unsigned short* input,
+ unsigned char* output, const unsigned int length, unsigned char c) {
+ int i = 0;
+ for (; i <= length && input[i] != 0; ++i)
+ output[i] = input[i] & 0xFF;
+ output[i-1] = c;
+ output[i] = 0;
+ return output;
+}
+static inline void LOGI_S16(unsigned short* string, const unsigned int length) {
+ unsigned char tmp_buffer[length];
+ convertToUnibyteString(string, tmp_buffer, length);
+ LOGI(">> %s", tmp_buffer);
+ // The log facility is throwing out log that comes too fast. The following
+ // is a dirty way of slowing down processing so that we can see all log.
+ // TODO : refactor this in a blocking log or something.
+ // usleep(10);
+}
+static inline void LOGI_S16_PLUS(unsigned short* string, const unsigned int length,
+ unsigned char c) {
+ unsigned char tmp_buffer[length+1];
+ convertToUnibyteStringAndReplaceLastChar(string, tmp_buffer, length, c);
+ LOGI(">> %s", tmp_buffer);
+ // Likewise
+ // usleep(10);
+}
+
+#endif // LATINIME_DEBUG_H