aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2018-05-27 12:12:06 +0300
committerMitch Curtis <mitch.curtis@qt.io>2018-08-06 08:20:01 +0000
commit59208edaaf40be982904a6c8cad4eab2d14f938e (patch)
treea613276e1f785e6cd82d019f01dbe478c7cebc5d /src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
parent263a16009e8d08004a546954cd7b2671c26fab9e (diff)
Modularize virtual keyboard and add an extension interface
With the extension interface it is possible to add new input method and/or languages without recompiling the Qt Virtual Keyboard plugin itself. The existing input methods are now isolated into plugins. So installing a new input method is a matter of copying the corresponding extension plugin to the plugins/virtualkeyboard directory (and any collateral required by the extension plugin itself). This change also renames the HunspellInputMethod to DefaultInputMethod. This change is necessary because some other extension plugin may want to provide the default input method instead. Implementation plan =================== [x] Create virtualkeyboard-private module [x] Create plugin library [x] Define interface for input method plugin [x] Define interface for keyboard layouts [x] Move existing input methods and layouts to plugins [x] HangulInputMethod [x] HunspellInputMethod [x] Maybe create a private library for sharing between HunspellInputMethod and LipiInputMethod [x] LipiInputMethod [x] OpenWnnInputMethod [x] PinyinInputMethod [x] T9WriteInputMethod [x] TCInputMethod [o] Rename some C++ classes (too generic name?) [x] Think again replacing the QtVirtualKeyboard namespace [x] Update documentation [x] General instructions for creating a plugin [x] For the C++ interfaces too (previously removed) [ChangeLog][Important Behavior Changes] Introduce an extension interface for the virtual keyboard. All the current input methods and some special keyboard layouts (e.g. Hunspell, OpenWnn, etc.) have been moved to extensions. The extension interface allows third party to create a new input method without having to modify or rebuild the virtual keyboard. In addition, this change makes it possible to add features and languages independently by copying the desired extension to the system. [ChangeLog][Important Behavior Changes] Introduce a virtualkeyboard module, which can be linked against an extension plugin. This module provides the C++ API necessary for creating an input method. [ChangeLog][Important Behavior Changes] Wrap the entire virtual keyboard API into Qt namespace (e.g. QT_BEGIN_NAMESPACE/QT_END_NAMESPACE). Task-number: QTBUG-57602 Change-Id: I449f4429109f596a7a1df7517c81f97d4aada27c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h')
-rw-r--r--src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
new file mode 100644
index 00000000..87553a00
--- /dev/null
+++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_ext.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2008-2012 OMRON SOFTWARE Co., Ltd.
+ *
+ * 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 _NJ_EXTERN_H_
+#define _NJ_EXTERN_H_
+
+
+#define NJ_MAX_CHAR_LEN 2
+
+#define NJ_CHAR_IS_EQUAL(a, b) \
+ ( (((NJ_UINT8*)(a))[0] == ((NJ_UINT8*)(b))[0]) && (((NJ_UINT8*)(a))[1] == ((NJ_UINT8*)(b))[1]) )
+
+#define NJ_CHAR_IS_LESSEQ(a, b) \
+ ( (((NJ_UINT8*)(a))[0] < ((NJ_UINT8*)(b))[0]) || \
+ ((((NJ_UINT8*)(a))[0] == ((NJ_UINT8*)(b))[0]) && (((NJ_UINT8*)(a))[1] <= ((NJ_UINT8*)(b))[1])) )
+
+#define NJ_CHAR_IS_MOREEQ(a, b) \
+ ( (((NJ_UINT8*)(a))[0] > ((NJ_UINT8*)(b))[0]) || \
+ ((((NJ_UINT8*)(a))[0] == ((NJ_UINT8*)(b))[0]) && (((NJ_UINT8*)(a))[1] >= ((NJ_UINT8*)(b))[1])) )
+
+#define NJ_CHAR_DIFF(a, b) \
+ ((NJ_INT16) \
+ ( (((NJ_UINT8*)(a))[0] == ((NJ_UINT8*)(b))[0]) \
+ ? (((NJ_UINT8*)(a))[1] - ((NJ_UINT8*)(b))[1]) \
+ : (((NJ_UINT8*)(a))[0] - ((NJ_UINT8*)(b))[0]) ) \
+ )
+
+#define NJ_CHAR_COPY(dst, src) \
+ { \
+ ((NJ_UINT8*)(dst))[0] = ((NJ_UINT8*)(src))[0]; \
+ ((NJ_UINT8*)(dst))[1] = ((NJ_UINT8*)(src))[1]; \
+ }
+
+#define NJ_CHAR_STRLEN_IS_0(c) (*(c) == NJ_CHAR_NUL)
+
+#define NJ_CHAR_ILLEGAL_DIC_YINDEX(size) ((size) != 2)
+
+
+#define NJ_CHAR_LEN(s) \
+ ( (NJ_CHAR_IS_MOREEQ((s), "\xD8\x00") && NJ_CHAR_IS_LESSEQ((s), "\xDB\xFF")) \
+ ? ( (*((s)+1) == NJ_CHAR_NUL) ? 1 : 2) \
+ : 1)
+
+#define UTL_CHAR(s) 1
+
+
+#define NJ_GET_DIC_INFO(dicinfo) ((NJ_UINT8)((dicinfo)->type))
+
+#define NJ_GET_DIC_TYPE_EX(type, handle) \
+ NJ_GET_DIC_TYPE((handle))
+
+
+#define GET_BITFIELD_16(data, pos, width) \
+ ((NJ_UINT16)(((NJ_UINT16)(data) >> (16 - (pos) - (width))) & \
+ ((NJ_UINT16)0xffff >> (16 - (width) ))))
+
+#define GET_BITFIELD_32(data, pos, width) \
+ ((NJ_UINT32)(((NJ_UINT32)(data) >> (32 - (pos) - (width))) & ((NJ_UINT32)0xffffffff >> (32 - (width)))))
+
+#define GET_BIT_TO_BYTE(bit) ((NJ_UINT8)(((bit) + 7) >> 3))
+
+
+#define INIT_KEYWORD_IN_NJ_DIC_SET(x) \
+ { (x)->keyword[0] = NJ_CHAR_NUL; (x)->keyword[1] = NJ_CHAR_NUL; }
+
+#define GET_ERR_FUNCVAL(errval) \
+ ((NJ_UINT16)(((NJ_UINT16)(errval) & 0x007F) << 8))
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern NJ_INT16 njd_get_word_data(NJ_CLASS *iwnn, NJ_DIC_SET *dicset, NJ_SEARCH_LOCATION_SET *loctset, NJ_UINT16 dic_idx, NJ_WORD *word);
+extern NJ_INT16 njd_get_stroke(NJ_CLASS *iwnn, NJ_RESULT *result,
+ NJ_CHAR *stroke, NJ_UINT16 size);
+extern NJ_INT16 njd_get_candidate(NJ_CLASS *iwnn, NJ_RESULT *result,
+ NJ_CHAR *candidate, NJ_UINT16 size);
+extern NJ_INT16 njd_init_search_location_set(NJ_SEARCH_LOCATION_SET* loctset);
+extern NJ_INT16 njd_init_word(NJ_WORD* word);
+
+extern NJ_INT16 njd_b_search_word(NJ_SEARCH_CONDITION *con,
+ NJ_SEARCH_LOCATION_SET *loctset);
+extern NJ_INT16 njd_b_get_word(NJ_SEARCH_LOCATION_SET *loctset, NJ_WORD *word);
+extern NJ_INT16 njd_b_get_candidate(NJ_WORD *word, NJ_CHAR *candidate,
+ NJ_UINT16 size);
+extern NJ_INT16 njd_b_get_stroke(NJ_WORD *word, NJ_CHAR *stroke, NJ_UINT16 size);
+
+extern NJ_INT16 njd_f_search_word(NJ_SEARCH_CONDITION *con,
+ NJ_SEARCH_LOCATION_SET *loctset);
+extern NJ_INT16 njd_f_get_word(NJ_SEARCH_LOCATION_SET *loctset, NJ_WORD *word);
+extern NJ_INT16 njd_f_get_stroke(NJ_WORD *word, NJ_CHAR *stroke,
+ NJ_UINT16 size);
+extern NJ_INT16 njd_f_get_candidate(NJ_WORD *word, NJ_CHAR *candidate,
+ NJ_UINT16 size);
+
+extern NJ_INT16 njd_l_search_word(NJ_CLASS *iwnn, NJ_SEARCH_CONDITION *con,
+ NJ_SEARCH_LOCATION_SET *loctset, NJ_UINT8 comp_flg);
+extern NJ_INT16 njd_l_add_word(NJ_CLASS *iwnn, NJ_LEARN_WORD_INFO *word,
+ NJ_UINT8 connect, NJ_UINT8 type,
+ NJ_UINT8 undo, NJ_UINT8 dictype);
+
+extern NJ_INT16 njd_l_delete_word(NJ_CLASS *iwnn, NJ_SEARCH_LOCATION *loc);
+extern NJ_INT16 njd_l_get_word(NJ_CLASS *iwnn, NJ_SEARCH_LOCATION_SET *loctset, NJ_WORD *word);
+extern NJ_INT16 njd_l_get_stroke(NJ_CLASS *iwnn, NJ_WORD *word,
+ NJ_CHAR *stroke, NJ_UINT16 size);
+extern NJ_INT16 njd_l_get_candidate(NJ_CLASS *iwnn, NJ_WORD *word,
+ NJ_CHAR *candidate, NJ_UINT16 size);
+extern NJ_INT16 njd_l_undo_learn(NJ_CLASS *iwnn, NJ_UINT16 undo_count);
+extern NJ_INT16 njd_l_check_dic(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle);
+extern NJ_INT16 njd_l_init_area(NJ_DIC_HANDLE handle);
+extern NJ_INT16 njd_l_make_space(NJ_CLASS *iwnn, NJ_UINT16 count, NJ_UINT8 mode);
+extern NJ_INT16 njd_l_get_relational_word(NJ_CLASS *iwnn, NJ_SEARCH_LOCATION *loc,
+ NJ_WORD *word, NJ_DIC_FREQ *mdic_freq);
+extern NJ_INT16 njd_l_check_word_connect(NJ_CLASS *iwnn, NJ_WORD *word);
+extern NJ_INT16 njd_l_get_ext_word_data(NJ_CLASS *iwnn, NJ_WORD *word, NJ_UINT16 *hinsi, NJ_UINT8 *len);
+extern NJ_INT16 njd_l_mld_op_commit(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle);
+extern NJ_INT16 njd_l_mld_op_commit_to_top(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle);
+extern NJ_INT16 njd_l_mld_op_commit_cancel(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle);
+extern NJ_INT16 njd_l_mld_op_get_space(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle);
+
+extern NJ_INT16 njd_r_get_hinsi(NJ_DIC_HANDLE rule, NJ_UINT8 type);
+extern NJ_INT16 njd_r_get_connect(NJ_DIC_HANDLE rule,
+ NJ_UINT16 hinsi, NJ_UINT8 type,
+ NJ_UINT8 **connect);
+extern NJ_INT16 njd_r_get_count(NJ_DIC_HANDLE rule,
+ NJ_UINT16 *fcount, NJ_UINT16 *rcount);
+
+extern NJ_UINT16 nje_check_string(NJ_CHAR *s, NJ_UINT16 max_len);
+extern NJ_UINT8 nje_get_top_char_type(NJ_CHAR *s);
+extern NJ_INT16 nje_convert_kata_to_hira(NJ_CHAR *kata, NJ_CHAR *hira, NJ_UINT16 len, NJ_UINT16 max_len, NJ_UINT8 type);
+extern NJ_INT16 nje_convert_hira_to_kata(NJ_CHAR *hira, NJ_CHAR *kata, NJ_UINT16 len);
+
+extern NJ_INT16 njd_connect_test(NJ_SEARCH_CONDITION *con, NJ_UINT16 hinsiF, NJ_UINT16 hinsiR);
+
+extern NJ_CHAR *nj_strcpy(NJ_CHAR *dst, NJ_CHAR *src);
+extern NJ_CHAR *nj_strncpy(NJ_CHAR *dst, NJ_CHAR *src, NJ_UINT16 n);
+extern NJ_UINT16 nj_strlen(NJ_CHAR *c);
+extern NJ_INT16 nj_strcmp(NJ_CHAR *s1, NJ_CHAR *s2);
+extern NJ_INT16 nj_strncmp(NJ_CHAR *s1, NJ_CHAR *s2, NJ_UINT16 n);
+extern NJ_UINT16 nj_charlen(NJ_CHAR *c);
+extern NJ_INT16 nj_charncmp(NJ_CHAR *s1, NJ_CHAR *s2, NJ_UINT16 n);
+extern NJ_CHAR *nj_charncpy(NJ_CHAR *dst, NJ_CHAR *src, NJ_UINT16 n);
+extern NJ_UINT8 *nj_memcpy(NJ_UINT8 *dst, NJ_UINT8 *src, NJ_UINT16 n);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif