Loading native/jni/Android.mk +15 −13 Original line number Diff line number Diff line Loading @@ -50,11 +50,18 @@ LATIN_IME_CORE_SRC_FILES := \ proximity_info.cpp \ proximity_info_state.cpp \ unigram_dictionary.cpp \ gesture/build_check.cpp gesture/incremental_decoder_interface.cpp 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 := \ $(LATIN_IME_JNI_SRC_FILES) \ $(addprefix $(LATIN_IME_SRC_DIR)/,$(LATIN_IME_CORE_SRC_FILES)) $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_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) Loading @@ -79,21 +86,16 @@ 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_C_INCLUDES = $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/gesture 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)) LOCAL_SRC_FILES := \ $(LATIN_IME_JNI_SRC_FILES) \ $(addprefix $(LATIN_IME_SRC_DIR)/,$(LATIN_IME_CORE_SRC_FILES)) ifeq ($(FLAG_DO_PROFILE), true) $(warning Making profiling version of native library) Loading @@ -105,7 +107,7 @@ ifeq ($(FLAG_DBG), true) endif # FLAG_DBG endif # FLAG_DO_PROFILE LOCAL_MODULE := libjni_latinime_gesture_impl_static LOCAL_MODULE := libjni_latinime_common_static LOCAL_MODULE_TAGS := optional ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system Loading @@ -119,7 +121,7 @@ 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 libjni_latinime_gesture_impl_static LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_static ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system LOCAL_SHARED_LIBRARIES := libstlport Loading native/jni/src/dictionary.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "binary_format.h" #include "defines.h" #include "dictionary.h" #include "incremental_decoder_interface.h" namespace latinime { Loading @@ -43,7 +44,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier, fullWordMultiplier, maxWordLength, maxWords, options); mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength); mGestureDecoder = new GestureDecoder(maxWordLength, maxWords); mGestureDecoder = IncrementalDecoderInterface::getGestureDecoderInstance(maxWordLength, maxWords); mGestureDecoder->setDict(mUnigramDictionary, mBigramDictionary, mDict + headerSize /* dict root */, 0 /* root pos */); } Loading @@ -51,6 +53,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, Dictionary::~Dictionary() { delete mUnigramDictionary; delete mBigramDictionary; delete mGestureDecoder; } int Dictionary::getFrequency(const int32_t *word, int length) const { Loading native/jni/src/dictionary.h +2 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ #include "bigram_dictionary.h" #include "char_utils.h" #include "defines.h" #include "gesture/gesture_decoder.h" #include "incremental_decoder_interface.h" #include "proximity_info.h" #include "unigram_dictionary.h" #include "words_priority_queue_pool.h" Loading Loading @@ -87,7 +87,7 @@ class Dictionary { const UnigramDictionary *mUnigramDictionary; const BigramDictionary *mBigramDictionary; GestureDecoder *mGestureDecoder; IncrementalDecoderInterface *mGestureDecoder; }; // public static utility methods Loading native/jni/src/gesture/gesture_decoder.hdeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line /* * 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_GESTURE_DECODER_H #define LATINIME_GESTURE_DECODER_H #include "defines.h" #include "gesture_decoder_impl.h" namespace latinime { class GestureDecoder : public GestureDecoderImpl { public: GestureDecoder(int maxWordLength, int maxWords) : GestureDecoderImpl(maxWordLength, maxWords) { } private: DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoder); }; } // namespace latinime #endif // LATINIME_INCREMENTAL_DECODER_H native/jni/src/gesture/impl/gesture_decoder_impl.cpp +20 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,26 @@ */ #include "gesture_decoder_impl.h" #include "incremental_decoder_interface.h" namespace latinime { // A factory method for GestureDecoderImpl static IncrementalDecoderInterface *getDecoderInstance(int maxWordLength, int maxWords) { return new GestureDecoderImpl(maxWordLength, maxWords); } // An ad-hoc internal class to register the factory method defined above class GestureDecoderFactoryRegisterer { public: GestureDecoderFactoryRegisterer() { IncrementalDecoderInterface::setGestureDecoderFactoryMethod(getDecoderInstance); } private: DISALLOW_COPY_AND_ASSIGN(GestureDecoderFactoryRegisterer); }; // namespace latinime // To invoke the GestureDecoderFactoryRegisterer constructor in the global constructor // Not sure, but can be static? GestureDecoderFactoryRegisterer gestureDecoderFactoryRegisterer; } // namespace latinime Loading
native/jni/Android.mk +15 −13 Original line number Diff line number Diff line Loading @@ -50,11 +50,18 @@ LATIN_IME_CORE_SRC_FILES := \ proximity_info.cpp \ proximity_info_state.cpp \ unigram_dictionary.cpp \ gesture/build_check.cpp gesture/incremental_decoder_interface.cpp 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 := \ $(LATIN_IME_JNI_SRC_FILES) \ $(addprefix $(LATIN_IME_SRC_DIR)/,$(LATIN_IME_CORE_SRC_FILES)) $(addprefix $(LATIN_IME_SRC_DIR)/, $(LATIN_IME_CORE_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) Loading @@ -79,21 +86,16 @@ 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_C_INCLUDES = $(LATIN_IME_SRC_FULLPATH_DIR) $(LATIN_IME_SRC_FULLPATH_DIR)/gesture 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)) LOCAL_SRC_FILES := \ $(LATIN_IME_JNI_SRC_FILES) \ $(addprefix $(LATIN_IME_SRC_DIR)/,$(LATIN_IME_CORE_SRC_FILES)) ifeq ($(FLAG_DO_PROFILE), true) $(warning Making profiling version of native library) Loading @@ -105,7 +107,7 @@ ifeq ($(FLAG_DBG), true) endif # FLAG_DBG endif # FLAG_DO_PROFILE LOCAL_MODULE := libjni_latinime_gesture_impl_static LOCAL_MODULE := libjni_latinime_common_static LOCAL_MODULE_TAGS := optional ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system Loading @@ -119,7 +121,7 @@ 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 libjni_latinime_gesture_impl_static LOCAL_WHOLE_STATIC_LIBRARIES := libjni_latinime_static ifdef HISTORICAL_NDK_VERSIONS_ROOT # In the platform build system LOCAL_SHARED_LIBRARIES := libstlport Loading
native/jni/src/dictionary.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "binary_format.h" #include "defines.h" #include "dictionary.h" #include "incremental_decoder_interface.h" namespace latinime { Loading @@ -43,7 +44,8 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, mUnigramDictionary = new UnigramDictionary(mDict + headerSize, typedLetterMultiplier, fullWordMultiplier, maxWordLength, maxWords, options); mBigramDictionary = new BigramDictionary(mDict + headerSize, maxWordLength); mGestureDecoder = new GestureDecoder(maxWordLength, maxWords); mGestureDecoder = IncrementalDecoderInterface::getGestureDecoderInstance(maxWordLength, maxWords); mGestureDecoder->setDict(mUnigramDictionary, mBigramDictionary, mDict + headerSize /* dict root */, 0 /* root pos */); } Loading @@ -51,6 +53,7 @@ Dictionary::Dictionary(void *dict, int dictSize, int mmapFd, int dictBufAdjust, Dictionary::~Dictionary() { delete mUnigramDictionary; delete mBigramDictionary; delete mGestureDecoder; } int Dictionary::getFrequency(const int32_t *word, int length) const { Loading
native/jni/src/dictionary.h +2 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ #include "bigram_dictionary.h" #include "char_utils.h" #include "defines.h" #include "gesture/gesture_decoder.h" #include "incremental_decoder_interface.h" #include "proximity_info.h" #include "unigram_dictionary.h" #include "words_priority_queue_pool.h" Loading Loading @@ -87,7 +87,7 @@ class Dictionary { const UnigramDictionary *mUnigramDictionary; const BigramDictionary *mBigramDictionary; GestureDecoder *mGestureDecoder; IncrementalDecoderInterface *mGestureDecoder; }; // public static utility methods Loading
native/jni/src/gesture/gesture_decoder.hdeleted 100644 → 0 +0 −37 Original line number Diff line number Diff line /* * 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_GESTURE_DECODER_H #define LATINIME_GESTURE_DECODER_H #include "defines.h" #include "gesture_decoder_impl.h" namespace latinime { class GestureDecoder : public GestureDecoderImpl { public: GestureDecoder(int maxWordLength, int maxWords) : GestureDecoderImpl(maxWordLength, maxWords) { } private: DISALLOW_IMPLICIT_CONSTRUCTORS(GestureDecoder); }; } // namespace latinime #endif // LATINIME_INCREMENTAL_DECODER_H
native/jni/src/gesture/impl/gesture_decoder_impl.cpp +20 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,26 @@ */ #include "gesture_decoder_impl.h" #include "incremental_decoder_interface.h" namespace latinime { // A factory method for GestureDecoderImpl static IncrementalDecoderInterface *getDecoderInstance(int maxWordLength, int maxWords) { return new GestureDecoderImpl(maxWordLength, maxWords); } // An ad-hoc internal class to register the factory method defined above class GestureDecoderFactoryRegisterer { public: GestureDecoderFactoryRegisterer() { IncrementalDecoderInterface::setGestureDecoderFactoryMethod(getDecoderInstance); } private: DISALLOW_COPY_AND_ASSIGN(GestureDecoderFactoryRegisterer); }; // namespace latinime // To invoke the GestureDecoderFactoryRegisterer constructor in the global constructor // Not sure, but can be static? GestureDecoderFactoryRegisterer gestureDecoderFactoryRegisterer; } // namespace latinime