aboutsummaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
Diffstat (limited to 'native')
-rw-r--r--native/jni/Android.mk49
-rw-r--r--native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp6
-rw-r--r--native/jni/src/dictionary.h4
-rw-r--r--native/jni/src/gesture/impl/gesture_decoder_impl.cpp21
-rw-r--r--native/jni/src/gesture/impl/gesture_decoder_impl.h2
-rw-r--r--native/jni/src/gesture/impl/header/nothing.h23
-rw-r--r--native/jni/src/gesture/impl/incremental_decoder_impl.cpp21
-rw-r--r--native/jni/src/gesture/impl/token_beam_impl.cpp21
-rw-r--r--native/jni/src/gesture/impl/token_beam_impl.h30
-rw-r--r--native/jni/src/gesture/impl/token_impl.cpp21
-rw-r--r--native/jni/src/gesture/impl/token_impl.h30
-rw-r--r--native/jni/src/gesture/incremental_decoder_interface.h2
12 files changed, 218 insertions, 12 deletions
diff --git a/native/jni/Android.mk b/native/jni/Android.mk
index a6bb48752..237f19d45 100644
--- a/native/jni/Android.mk
+++ b/native/jni/Android.mk
@@ -24,10 +24,10 @@ FLAG_DO_PROFILE ?= false
include $(CLEAR_VARS)
LATIN_IME_SRC_DIR := src
+LATIN_IME_SRC_FULLPATH_DIR := $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)/gesture
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(LATIN_IME_SRC_DIR)/gesture/impl
+LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) \
+ $(addprefix $(LATIN_IME_SRC_FULLPATH_DIR)/, gesture gesture/impl)
LOCAL_CFLAGS += -Werror -Wall
@@ -76,12 +76,50 @@ LOCAL_C_INCLUDES += external/stlport/stlport bionic
endif
include $(BUILD_STATIC_LIBRARY)
+######################################
+include $(CLEAR_VARS)
+
+LOCAL_C_INCLUDES += $(LATIN_IME_SRC_FULLPATH_DIR) \
+ $(addprefix $(LATIN_IME_SRC_FULLPATH_DIR)/, gesture gesture/impl gesture/impl/header)
+
+LOCAL_CFLAGS += -Werror -Wall
+
+# To suppress compiler warnings for unused variables/functions used for debug features etc.
+LOCAL_CFLAGS += -Wno-unused-parameter -Wno-unused-function
+LATIN_IME_GESTURE_IMPL_SRC_FILES := \
+ gesture/impl/gesture_decoder_impl.cpp \
+ gesture/impl/incremental_decoder_impl.cpp \
+ gesture/impl/token_beam_impl.cpp \
+ gesture/impl/token_impl.cpp
+
+LOCAL_SRC_FILES := $(addprefix $(LATIN_IME_SRC_DIR)/,$(LATIN_IME_GESTURE_IMPL_SRC_FILES))
+
+ifeq ($(FLAG_DO_PROFILE), true)
+ $(warning Making profiling version of native library)
+ LOCAL_CFLAGS += -DFLAG_DO_PROFILE
+else # FLAG_DO_PROFILE
+ifeq ($(FLAG_DBG), true)
+ $(warning Making debug version of native library)
+ LOCAL_CFLAGS += -DFLAG_DBG
+endif # FLAG_DBG
+endif # FLAG_DO_PROFILE
+
+LOCAL_MODULE := libjni_latinime_gesture_impl_static
+LOCAL_MODULE_TAGS := optional
+
+ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
+include external/stlport/libstlport.mk
+else # In the NDK build system
+LOCAL_C_INCLUDES += external/stlport/stlport bionic
+endif
+
+include $(BUILD_STATIC_LIBRARY)
######################################
include $(CLEAR_VARS)
# All code in LOCAL_WHOLE_STATIC_LIBRARIES will be built into this shared library.
-LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_static
+LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_static libjni_latinime_gesture_impl_static
ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system
LOCAL_SHARED_LIBRARIES := libstlport
@@ -111,5 +149,6 @@ include $(BUILD_SHARED_LIBRARY)
#################### Clean up the tmp vars
LATIN_IME_CORE_SRC_FILES :=
LATIN_IME_JNI_SRC_FILES :=
+LATIN_IME_GESTURE_IMPL_SRC_FILES :=
LATIN_IME_SRC_DIR :=
-TARGETING_UNBUNDLED_FROYO :=
+LATIN_IME_SRC_FULLPATH_DIR :=
diff --git a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
index 3fa45da55..bee0662ee 100644
--- a/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
+++ b/native/jni/com_android_inputmethod_latin_BinaryDictionary.cpp
@@ -129,7 +129,7 @@ static jlong latinime_BinaryDictionary_open(JNIEnv *env, jobject object,
static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object, jlong dict,
jlong proximityInfo, jintArray xCoordinatesArray, jintArray yCoordinatesArray,
jintArray timesArray, jintArray pointerIdArray, jintArray inputArray, jint arraySize,
- jint commitPoint, jboolean isGesture, jint dicTypeId,
+ jint commitPoint, jboolean isGesture,
jintArray prevWordForBigrams, jboolean useFullEditDistance, jcharArray outputArray,
jintArray frequencyArray, jintArray spaceIndexArray) {
Dictionary *dictionary = (Dictionary*) dict;
@@ -148,7 +148,7 @@ static int latinime_BinaryDictionary_getSuggestions(JNIEnv *env, jobject object,
jsize prevWordLength = prevWordChars ? env->GetArrayLength(prevWordForBigrams) : 0;
int count = dictionary->getSuggestions(pInfo, xCoordinates, yCoordinates, times, pointerIds,
inputCodes, arraySize, prevWordChars, prevWordLength, commitPoint, isGesture,
- dicTypeId, useFullEditDistance, (unsigned short*) outputChars,
+ useFullEditDistance, (unsigned short*) outputChars,
frequencies, spaceIndices);
if (prevWordChars) {
env->ReleaseIntArrayElements(prevWordForBigrams, prevWordChars, JNI_ABORT);
@@ -260,7 +260,7 @@ void releaseDictBuf(void* dictBuf, const size_t length, int fd) {
static JNINativeMethod sMethods[] = {
{"openNative", "(Ljava/lang/String;JJIIII)J", (void*)latinime_BinaryDictionary_open},
{"closeNative", "(J)V", (void*)latinime_BinaryDictionary_close},
- {"getSuggestionsNative", "(JJ[I[I[I[I[IIIZI[IZ[C[I[I)I",
+ {"getSuggestionsNative", "(JJ[I[I[I[I[IIIZ[IZ[C[I[I)I",
(void*) latinime_BinaryDictionary_getSuggestions},
{"getFrequencyNative", "(J[II)I", (void*)latinime_BinaryDictionary_getFrequency},
{"isValidBigramNative", "(J[I[I)Z", (void*)latinime_BinaryDictionary_isValidBigram},
diff --git a/native/jni/src/dictionary.h b/native/jni/src/dictionary.h
index 708cb0909..8b4769431 100644
--- a/native/jni/src/dictionary.h
+++ b/native/jni/src/dictionary.h
@@ -36,14 +36,14 @@ class Dictionary {
int getSuggestions(ProximityInfo *proximityInfo, int *xcoordinates, int *ycoordinates,
int *times, int *pointerIds, int *codes, int codesSize, int *prevWordChars,
- int prevWordLength, int commitPoint, bool isGesture, int dicTypeId,
+ int prevWordLength, int commitPoint, bool isGesture,
bool useFullEditDistance, unsigned short *outWords,
int *frequencies, int *spaceIndices) {
int result = 0;
if (isGesture) {
mGestureDecoder->setPrevWord(prevWordChars, prevWordLength);
result = mGestureDecoder->getSuggestions(proximityInfo, xcoordinates, ycoordinates,
- times, pointerIds, codes, codesSize, commitPoint, dicTypeId == 1 /* main */,
+ times, pointerIds, codes, codesSize, commitPoint,
outWords, frequencies, spaceIndices);
} else {
std::map<int, int> bigramMap;
diff --git a/native/jni/src/gesture/impl/gesture_decoder_impl.cpp b/native/jni/src/gesture/impl/gesture_decoder_impl.cpp
new file mode 100644
index 000000000..59937a4d8
--- /dev/null
+++ b/native/jni/src/gesture/impl/gesture_decoder_impl.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "gesture_decoder_impl.h"
+
+namespace latinime {
+};
+// namespace latinime
diff --git a/native/jni/src/gesture/impl/gesture_decoder_impl.h b/native/jni/src/gesture/impl/gesture_decoder_impl.h
index be4e8b3c2..0ca89941c 100644
--- a/native/jni/src/gesture/impl/gesture_decoder_impl.h
+++ b/native/jni/src/gesture/impl/gesture_decoder_impl.h
@@ -30,7 +30,7 @@ class GestureDecoderImpl : public IncrementalDecoder {
}
int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
- int *pointerIds, int *codes, int inputSize, int commitPoint, bool isMainDict,
+ int *pointerIds, int *codes, int inputSize, int commitPoint,
unsigned short *outWords, int *frequencies, int *outputIndices) {
return 0;
}
diff --git a/native/jni/src/gesture/impl/header/nothing.h b/native/jni/src/gesture/impl/header/nothing.h
new file mode 100644
index 000000000..c9d8645c9
--- /dev/null
+++ b/native/jni/src/gesture/impl/header/nothing.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2012 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_NOTHING_H
+#define LATINIME_NOTHING_H
+
+namespace latinime {
+} // namespace latinime
+
+#endif // LATINIME_NOTHING_H
diff --git a/native/jni/src/gesture/impl/incremental_decoder_impl.cpp b/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
new file mode 100644
index 000000000..b7e8b3bd1
--- /dev/null
+++ b/native/jni/src/gesture/impl/incremental_decoder_impl.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "incremental_decoder_impl.h"
+
+namespace latinime {
+};
+// namespace latinime
diff --git a/native/jni/src/gesture/impl/token_beam_impl.cpp b/native/jni/src/gesture/impl/token_beam_impl.cpp
new file mode 100644
index 000000000..b2b73c25c
--- /dev/null
+++ b/native/jni/src/gesture/impl/token_beam_impl.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "token_beam_impl.h"
+
+namespace latinime {
+};
+// namespace latinime
diff --git a/native/jni/src/gesture/impl/token_beam_impl.h b/native/jni/src/gesture/impl/token_beam_impl.h
new file mode 100644
index 000000000..332505697
--- /dev/null
+++ b/native/jni/src/gesture/impl/token_beam_impl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 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_TOKEN_BEAM_IMPL_H
+#define LATINIME_TOKEN_BEAM_IMPL_H
+
+#include "defines.h"
+
+namespace latinime {
+
+class TokenBeamImpl {
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TokenBeamImpl);
+};
+} // namespace latinime
+
+#endif // LATINIME_TOKEN_BEAM_IMPL_H
diff --git a/native/jni/src/gesture/impl/token_impl.cpp b/native/jni/src/gesture/impl/token_impl.cpp
new file mode 100644
index 000000000..c7efeb188
--- /dev/null
+++ b/native/jni/src/gesture/impl/token_impl.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+#include "token_impl.h"
+
+namespace latinime {
+};
+// namespace latinime
diff --git a/native/jni/src/gesture/impl/token_impl.h b/native/jni/src/gesture/impl/token_impl.h
new file mode 100644
index 000000000..0ed7d0020
--- /dev/null
+++ b/native/jni/src/gesture/impl/token_impl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 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_TOKEN_IMPL_H
+#define LATINIME_TOKEN_IMPL_H
+
+#include "defines.h"
+
+namespace latinime {
+
+struct TokenImpl {
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TokenImpl);
+};
+} // namespace latinime
+
+#endif // LATINIME_TOKEN_IMPL_H
diff --git a/native/jni/src/gesture/incremental_decoder_interface.h b/native/jni/src/gesture/incremental_decoder_interface.h
index c5404a40c..565f89c90 100644
--- a/native/jni/src/gesture/incremental_decoder_interface.h
+++ b/native/jni/src/gesture/incremental_decoder_interface.h
@@ -28,7 +28,7 @@ class IncrementalDecoderInterface {
public:
virtual int getSuggestions(ProximityInfo *pInfo, int *inputXs, int *inputYs, int *times,
- int *pointerIds, int *codes, int inputSize, int commitPoint, bool isMainDict,
+ int *pointerIds, int *codes, int inputSize, int commitPoint,
unsigned short *outWords, int *frequencies, int *outputIndices) = 0;
virtual void reset() = 0;
virtual void setDict(const UnigramDictionary *dict, const BigramDictionary *bigram,