diff options
Diffstat (limited to 'src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include')
6 files changed, 881 insertions, 0 deletions
diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_dic.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_dic.h new file mode 100644 index 00000000..47b54acd --- /dev/null +++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_dic.h @@ -0,0 +1,80 @@ +/* + * 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_DIC_H_ +#define _NJ_DIC_H_ + +#define NJ_DIC_TYPE_JIRITSU 0x00000000 +#define NJ_DIC_TYPE_FZK 0x00000001 +#define NJ_DIC_TYPE_TANKANJI 0x00000002 +#define NJ_DIC_TYPE_CUSTOM_COMPRESS 0x00000003 +#define NJ_DIC_TYPE_STDFORE 0x00000004 +#define NJ_DIC_TYPE_FORECONV 0x00000005 +#define NJ_DIC_TYPE_YOMINASHI 0x00010000 +#define NJ_DIC_TYPE_CUSTOM_INCOMPRESS 0x00020002 +#define NJ_DIC_TYPE_USER 0x80030000 +#define NJ_DIC_TYPE_RULE 0x000F0000 + +#define NJ_HINSI_V2_F 0 +#define NJ_HINSI_SUUJI_B 14 +#define NJ_HINSI_BUNTOU_B 3 +#define NJ_HINSI_TANKANJI_F 4 +#define NJ_HINSI_TANKANJI_B 5 +#define NJ_HINSI_MEISI_F 6 +#define NJ_HINSI_MEISI_B 7 +#define NJ_HINSI_JINMEI_F 8 +#define NJ_HINSI_JINMEI_B 9 +#define NJ_HINSI_CHIMEI_F 10 +#define NJ_HINSI_CHIMEI_B 11 +#define NJ_HINSI_KIGOU_F 12 +#define NJ_HINSI_KIGOU_B 13 +#define NJ_HINSI_V1_F 15 +#define NJ_HINSI_V3_F 16 +#define NJ_RULE_TYPE_BTOF 0 +#define NJ_RULE_TYPE_FTOB 1 + +#define NJD_SAME_INDEX_LIMIT 50 + +#define NJ_INT16_READ(in) \ + (((((NJ_INT16)((in)[0])) << 8) & 0xff00U) + ((in)[1] & 0xffU)) + +#define NJ_INT32_READ(in) \ + (((((NJ_INT32)((in)[0])) << 24) & 0xff000000) | \ + ((((NJ_INT32)((in)[1])) << 16) & 0xff0000) | \ + ((((NJ_INT32)((in)[2])) << 8) & 0xff00) | \ + ((((NJ_INT32)((in)[3])) ) & 0xff)) + +#define NJ_INT32_WRITE(to, from)\ + {(to)[0]=(NJ_UINT8)(((from)>>24) & 0x000000ff);\ + (to)[1]=(NJ_UINT8)(((from)>>16) & 0x000000ff);\ + (to)[2]=(NJ_UINT8)(((from)>>8) & 0x000000ff);\ + (to)[3]=(NJ_UINT8)((from) & 0x000000ff);} + +#define NJ_INT16_WRITE(to, from)\ + {(to)[0]=(NJ_UINT8)(((from)>>8) & 0x00ff);\ + (to)[1]=(NJ_UINT8)((from) & 0x00ff);} + +#define NJ_GET_MAX_YLEN(h) ((NJ_INT16)(NJ_INT16_READ((h)+0x16)/sizeof(NJ_CHAR))) + +#define NJ_GET_MAX_KLEN(h) ((NJ_INT16)(NJ_INT16_READ((h)+0x1A)/sizeof(NJ_CHAR))) + +#define NJ_GET_DIC_TYPE(h) ((NJ_UINT32)(NJ_INT32_READ((h)+8))) + +#define F_HINSI_SET_CNT(h) ((NJ_UINT16)(NJ_INT16_READ((h)+0x1C))) +#define B_HINSI_SET_CNT(h) ((NJ_UINT16)(NJ_INT16_READ((h)+0x1E))) + + +#endif diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_err.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_err.h new file mode 100644 index 00000000..3b4010ca --- /dev/null +++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_err.h @@ -0,0 +1,121 @@ +/* + * 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_ERR_H_ +#define _NJ_ERR_H_ + +#define NJ_ERR_CODE_MASK (0x7F00) +#define NJ_ERR_FUNC_MASK (0x00FF) + +#define NJ_GET_ERR_CODE(x) ((x) & NJ_ERR_CODE_MASK) +#define NJ_GET_ERR_FUNC(x) ((x) & NJ_ERR_FUNC_MASK) + +#define NJ_SET_ERR_VAL(x, y) ((NJ_INT16)((x) | (y) | 0x8000)) + +#define NJ_ERR_PARAM_DIC_NULL (0x0000) +#define NJ_ERR_PARAM_YOMI_NULL (0x0100) +#define NJ_ERR_PARAM_YOMI_SIZE (0x0200) +#define NJ_ERR_PARAM_RESULT_NULL (0x0500) +#define NJ_ERR_YOMI_TOO_LONG (0x0600) +#define NJ_ERR_NO_RULEDIC (0x0800) +#define NJ_ERR_PARAM_OPERATION (0x0900) +#define NJ_ERR_PARAM_MODE (0x0A00) +#define NJ_ERR_PARAM_KANJI_NULL (0x0B00) +#define NJ_ERR_CANDIDATE_TOO_LONG (0x0C00) +#define NJ_ERR_PARAM_CURSOR_NULL (0x0D00) +#define NJ_ERR_DIC_TYPE_INVALID (0x0E00) +#define NJ_ERR_DIC_HANDLE_NULL (0x0F00) +#define NJ_ERR_FORMAT_INVALID (0x1000) +#define NJ_ERR_NO_CANDIDATE_LIST (0x1100) +#define NJ_ERR_AREASIZE_INVALID (0x1300) +#define NJ_ERR_BUFFER_NOT_ENOUGH (0x1400) +#define NJ_ERR_HINSI_GROUP_INVALID (0x1500) +#define NJ_ERR_CREATE_TYPE_INVALID (0x1600) +#define NJ_ERR_WORD_INFO_NULL (0x1700) +#define NJ_ERR_DIC_NOT_FOUND (0x1800) +#define NJ_ERR_CANNOT_GET_QUE (0x1900) +#define NJ_ERR_INVALID_FLAG (0x1A00) +#define NJ_ERR_INVALID_RESULT (0x1B00) +#define NJ_ERR_INTERNAL (0x1D00) +#define NJ_ERR_USER_YOMI_INVALID (0x1E00) +#define NJ_ERR_USER_KOUHO_INVALID (0x1F00) +#define NJ_ERR_USER_DIC_FULL (0x2000) +#define NJ_ERR_SAME_WORD (0x2100) +#define NJ_ERR_DIC_BROKEN (0x2200) +#define NJ_ERR_WORD_NOT_FOUND (0x2400) +#define NJ_ERR_DIC_VERSION_INVALID (0x2A00) +#define NJ_ERR_DIC_FREQ_INVALID (0x2B00) +#define NJ_ERR_CACHE_NOT_ENOUGH (0x2C00) +#define NJ_ERR_CACHE_BROKEN (0x2D00) +#define NJ_ERR_PARAM_ENV_NULL (0x2E00) +#define NJ_ERR_PARAM_ILLEGAL_CHAR_LEN (0x3200) + + +#define NJ_FUNC_NJD_B_GET_CANDIDATE (0x0010) +#define NJ_FUNC_NJD_B_GET_STROKE (0x0061) +#define NJ_FUNC_NJD_B_SEARCH_WORD (0x0062) + +#define NJ_FUNC_NJD_F_GET_WORD (0x0011) +#define NJ_FUNC_NJD_F_GET_STROKE (0x0012) +#define NJ_FUNC_NJD_F_GET_CANDIDATE (0x0013) +#define NJ_FUNC_NJD_L_DELETE_WORD (0x0014) +#define NJ_FUNC_NJD_L_ADD_WORD (0x0015) +#define NJ_FUNC_NJD_L_UNDO_LEARN (0x0016) +#define NJ_FUNC_DELETE_INDEX (0x0017) +#define NJ_FUNC_INSERT_INDEX (0x0018) +#define NJ_FUNC_QUE_STRCMP_COMPLETE_WITH_HYOUKI (0x0019) +#define NJ_FUNC_NJD_L_GET_WORD (0x001B) +#define NJ_FUNC_NJD_L_GET_CANDIDATE (0x001C) +#define NJ_FUNC_NJD_L_GET_STROKE (0x001D) +#define NJ_FUNC_QUE_STRCMP_FORWARD (0x001E) +#define NJ_FUNC_NJD_L_CHECK_DIC (0x001F) +#define NJ_FUNC_SEARCH_RANGE_BY_YOMI (0x0020) +#define NJ_FUNC_STR_QUE_CMP (0x0021) +#define NJ_FUNC_WRITE_LEARN_DATA (0x0022) +#define NJ_FUNC_NJD_R_CHECK_GROUP (0x0064) + +#define NJ_FUNC_CHECK_SEARCH_CURSOR (0x0023) +#define NJ_FUNC_GET_WORD_AND_SEARCH_NEXT_WORD (0x0024) + +#define NJ_FUNC_NJD_GET_WORD_DATA (0x0025) +#define NJ_FUNC_NJD_GET_WORD (0x0027) +#define NJ_FUNC_NJD_CHECK_DIC (0x0028) + +#define NJ_FUNC_NJ_CREATE_DIC (0x0029) +#define NJ_FUNC_NJD_GET_STROKE (0x002A) +#define NJ_FUNC_NJD_GET_CANDIDATE (0x002B) +#define NJ_FUNC_NJ_SEARCH_WORD (0x002C) +#define NJ_FUNC_NJ_GET_WORD (0x002D) +#define NJ_FUNC_NJ_ADD_WORD (0x002E) +#define NJ_FUNC_NJ_DELETE_WORD (0x002F) +#define NJ_FUNC_NJ_CHECK_DIC (0x0030) +#define NJ_FUNC_NJD_L_MAKE_SPACE (0x0053) +#define NJ_FUNC_SEARCH_RANGE_BY_YOMI_MULTI (0x0054) +#define NJ_FUNC_NJD_L_GET_RELATIONAL_WORD (0x0055) +#define NJ_FUNC_QUE_STRCMP_INCLUDE (0x0056) +#define NJ_FUNC_IS_CONTINUED (0x0057) +#define NJ_FUNC_CONTINUE_CNT (0x0058) + +#define NJ_FUNC_SEARCH_WORD (0x003C) + +#define NJ_FUNC_NJ_SELECT (0x0040) +#define NJ_FUNC_NJ_INIT (0x0041) +#define NJ_FUNC_NJ_GET_CANDIDATE (0x0042) +#define NJ_FUNC_NJ_GET_STROKE (0x0043) + +#define NJ_FUNC_NJ_MANAGE_LEARNDIC (0x0093) + +#endif 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 diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_lib.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_lib.h new file mode 100644 index 00000000..3334d1fc --- /dev/null +++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/nj_lib.h @@ -0,0 +1,363 @@ +/* + * 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. + */ + +#define NJ_VERSION "iWnn Version 1.1.2" + +#ifndef _NJ_LIB_H_ +#define _NJ_LIB_H_ + +typedef signed char NJ_INT8; +typedef unsigned char NJ_UINT8; +typedef signed short NJ_INT16; +typedef unsigned short NJ_UINT16; +typedef signed long NJ_INT32; +typedef unsigned long NJ_UINT32; + +typedef unsigned short NJ_CHAR; + +#define NJ_CHAR_NUL 0x0000 + +#define NJ_TERM_LEN 1 +#define NJ_TERM_SIZE (NJ_TERM_LEN) + +#ifndef NULL +#define NULL 0 +#endif + +#ifdef NJ_STACK_CHECK_FILE +typedef NJ_VOID VOID; +#endif + +#ifndef NJ_CHAR_WAVE_DASH_BIG +#define NJ_CHAR_WAVE_DASH_BIG 0xFF5E +#endif +#ifndef NJ_CHAR_WAVE_DASH_SMALL +#define NJ_CHAR_WAVE_DASH_SMALL 0x007E +#endif + +typedef NJ_INT16 NJ_HINDO; + +#define NJ_INDEX_SIZE 2 + +#define NJ_LEARN_DIC_HEADER_SIZE 72 + +#ifndef NJ_MAX_DIC +#define NJ_MAX_DIC 20 +#endif + +#ifndef NJ_MAX_CHARSET +#define NJ_MAX_CHARSET 200 +#endif + +#ifndef NJ_SEARCH_CACHE_SIZE +#define NJ_SEARCH_CACHE_SIZE 200 +#endif + +#ifndef NJ_CACHE_VIEW_CNT +#define NJ_CACHE_VIEW_CNT 2 +#endif + + +#ifndef NJ_MAX_RESULT_LEN +#define NJ_MAX_RESULT_LEN 50 +#endif + +#ifndef NJ_MAX_LEN +#define NJ_MAX_LEN 50 +#endif + +#ifndef NJ_MAX_KEYWORD +#define NJ_MAX_KEYWORD (NJ_MAX_RESULT_LEN + NJ_TERM_LEN) +#endif + +#ifndef NJ_MAX_PHRASE +#define NJ_MAX_PHRASE NJ_MAX_LEN +#endif + +#ifndef NJ_MAX_PHR_CONNECT +#define NJ_MAX_PHR_CONNECT 5 +#endif + +#ifndef NJ_MAX_USER_LEN +#define NJ_MAX_USER_LEN 50 +#endif + +#ifndef NJ_MAX_USER_KOUHO_LEN +#define NJ_MAX_USER_KOUHO_LEN 50 +#endif + +#ifndef NJ_MAX_USER_COUNT +#define NJ_MAX_USER_COUNT 100 +#endif + +#define NJ_USER_QUE_SIZE (((NJ_MAX_USER_LEN + NJ_MAX_USER_KOUHO_LEN) * sizeof(NJ_CHAR)) + 5) +#define NJ_USER_DIC_SIZE ((NJ_USER_QUE_SIZE + NJ_INDEX_SIZE + NJ_INDEX_SIZE) * NJ_MAX_USER_COUNT + NJ_INDEX_SIZE + NJ_INDEX_SIZE + NJ_LEARN_DIC_HEADER_SIZE + 4) + +typedef NJ_UINT8 * NJ_DIC_HANDLE; + +typedef struct { + NJ_UINT16 base; + NJ_UINT16 high; +} NJ_DIC_FREQ; + +typedef struct { + NJ_UINT32 current; + NJ_UINT32 top; + NJ_UINT32 bottom; + NJ_UINT8 *node; + NJ_UINT8 *now; + NJ_UINT16 idx_no; +} NJ_CACHE_INFO; + +typedef struct { + NJ_UINT8 statusFlg; +#define NJ_STATUSFLG_CACHEOVER ((NJ_UINT8)0x01) +#define NJ_STATUSFLG_AIMAI ((NJ_UINT8)0x02) +#define NJ_STATUSFLG_HINDO ((NJ_UINT8)0x04) + NJ_UINT8 viewCnt; + NJ_UINT16 keyPtr[NJ_MAX_KEYWORD]; + NJ_CACHE_INFO storebuff[NJ_SEARCH_CACHE_SIZE]; +} NJ_SEARCH_CACHE; + +#define NJ_GET_CACHEOVER_FROM_SCACHE(s) ((s)->statusFlg & NJ_STATUSFLG_CACHEOVER) +#define NJ_GET_AIMAI_FROM_SCACHE(s) ((s)->statusFlg & NJ_STATUSFLG_AIMAI) +#define NJ_SET_CACHEOVER_TO_SCACHE(s) ((s)->statusFlg |= NJ_STATUSFLG_CACHEOVER) +#define NJ_SET_AIMAI_TO_SCACHE(s) ((s)->statusFlg |= NJ_STATUSFLG_AIMAI) +#define NJ_UNSET_CACHEOVER_TO_SCACHE(s) ((s)->statusFlg &= ~NJ_STATUSFLG_CACHEOVER) +#define NJ_UNSET_AIMAI_TO_SCACHE(s) ((s)->statusFlg &= ~NJ_STATUSFLG_AIMAI) + + +typedef struct { + NJ_UINT8 type; +#define NJ_DIC_H_TYPE_NORMAL 0x00 + NJ_UINT8 limit; + + NJ_DIC_HANDLE handle; + +#define NJ_MODE_TYPE_MAX 1 + + NJ_DIC_FREQ dic_freq[NJ_MODE_TYPE_MAX]; +#define NJ_MODE_TYPE_HENKAN 0 + + NJ_SEARCH_CACHE * srhCache; +} NJ_DIC_INFO; + + +typedef struct { + NJ_DIC_INFO dic[NJ_MAX_DIC]; + NJ_DIC_HANDLE rHandle[NJ_MODE_TYPE_MAX]; + + + NJ_UINT16 mode; +#define NJ_CACHE_MODE_NONE 0x0000 +#define NJ_CACHE_MODE_VALID 0x0001 + + + NJ_CHAR keyword[NJ_MAX_KEYWORD]; +} NJ_DIC_SET; + +typedef struct { + NJ_UINT16 charset_count; + NJ_CHAR *from[NJ_MAX_CHARSET]; + NJ_CHAR *to[NJ_MAX_CHARSET]; +} NJ_CHARSET; + + +typedef struct { + + NJ_UINT8 operation; +#define NJ_CUR_OP_COMP 0 +#define NJ_CUR_OP_FORE 1 +#define NJ_CUR_OP_LINK 2 + + NJ_UINT8 mode; +#define NJ_CUR_MODE_FREQ 0 +#define NJ_CUR_MODE_YOMI 1 + + NJ_DIC_SET *ds; + + struct { + NJ_UINT8 *fore; + NJ_UINT16 foreSize; + NJ_UINT16 foreFlag; + NJ_UINT8 *rear; + NJ_UINT16 rearSize; + NJ_UINT16 rearFlag; + NJ_UINT8 *yominasi_fore; + } hinsi; + + NJ_CHAR *yomi; + NJ_UINT16 ylen; + NJ_UINT16 yclen; + NJ_CHAR *kanji; + + NJ_CHARSET *charset; + +} NJ_SEARCH_CONDITION; + +typedef struct { + NJ_DIC_HANDLE handle; + NJ_UINT32 current; + NJ_UINT32 top; + NJ_UINT32 bottom; + NJ_UINT32 relation[NJ_MAX_PHR_CONNECT]; + NJ_UINT8 current_cache; + NJ_UINT8 current_info; + NJ_UINT8 status; + NJ_UINT8 type; +} NJ_SEARCH_LOCATION; + +typedef struct { + NJ_HINDO cache_freq; + NJ_DIC_FREQ dic_freq; + NJ_SEARCH_LOCATION loct; +} NJ_SEARCH_LOCATION_SET; + +typedef struct { + NJ_SEARCH_CONDITION cond; + NJ_SEARCH_LOCATION_SET loctset[NJ_MAX_DIC]; +} NJ_CURSOR; + + +typedef struct { + NJ_UINT8 hinsi_group; +#define NJ_HINSI_MEISI 0 +#define NJ_HINSI_JINMEI 1 +#define NJ_HINSI_MEISI_NO_CONJ 2 +#define NJ_HINSI_CHIMEI 2 +#define NJ_HINSI_KIGOU 3 + + NJ_CHAR yomi[NJ_MAX_LEN + NJ_TERM_LEN]; + NJ_CHAR kouho[NJ_MAX_RESULT_LEN + NJ_TERM_LEN]; + + + struct { + NJ_UINT16 yomi_len; + NJ_UINT16 kouho_len; + NJ_UINT32 hinsi; + NJ_UINT32 attr; + NJ_INT16 freq; + } stem; + + + struct { + NJ_UINT16 yomi_len; + NJ_UINT16 kouho_len; + NJ_UINT32 hinsi; + NJ_INT16 freq; + } fzk; + + NJ_INT16 connect; + +} NJ_WORD_INFO; + +typedef struct { + NJ_CHAR *yomi; + + + struct NJ_STEM { + NJ_UINT16 info1; + NJ_UINT16 info2; + NJ_HINDO hindo; + NJ_SEARCH_LOCATION loc; + NJ_UINT8 type; + } stem; + + + struct NJ_FZK { + NJ_UINT16 info1; + NJ_UINT16 info2; + NJ_HINDO hindo; + } fzk; +} NJ_WORD; + +#define NJ_GET_FPOS_FROM_STEM(s) ((NJ_UINT16)((s)->stem.info1 >> 7)) +#define NJ_GET_BPOS_FROM_STEM(s) ((NJ_UINT16)((s)->stem.info2 >> 7)) + + +#define NJ_SET_FPOS_TO_STEM(s,v) ((s)->stem.info1 = ((s)->stem.info1 & 0x007F) | (NJ_UINT16)((v) << 7)) +#define NJ_GET_YLEN_FROM_STEM(s) ((NJ_UINT8)((s)->stem.info1 & 0x7F)) +#define NJ_GET_KLEN_FROM_STEM(s) ((NJ_UINT8)((s)->stem.info2 & 0x7F)) +#define NJ_SET_YLEN_TO_STEM(s,v) ((s)->stem.info1 = ((s)->stem.info1 & 0xFF80) | (NJ_UINT16)((v) & 0x7F)) +#define NJ_SET_BPOS_TO_STEM(s,v) ((s)->stem.info2 = ((s)->stem.info2 & 0x007F) | (NJ_UINT16)((v) << 7)) +#define NJ_SET_KLEN_TO_STEM(s,v) ((s)->stem.info2 = ((s)->stem.info2 & 0xFF80) | (NJ_UINT16)((v) & 0x7F)) + +#define NJ_GET_YLEN_FROM_FZK(f) ((NJ_UINT8)((f)->fzk.info1 & 0x7F)) +#define NJ_GET_BPOS_FROM_FZK(f) ((NJ_UINT16)((f)->fzk.info2 >> 7)) + +typedef struct { + + NJ_UINT16 operation_id; +#define NJ_OP_MASK 0x000f +#define NJ_GET_RESULT_OP(id) ((id) & NJ_OP_MASK) +#define NJ_OP_SEARCH 0x0000 + +#define NJ_FUNC_MASK 0x00f0 +#define NJ_GET_RESULT_FUNC(id) ((id) & NJ_FUNC_MASK) +#define NJ_FUNC_SEARCH 0x0000 + +#define NJ_DIC_MASK 0xf000 +#define NJ_GET_RESULT_DIC(id) ((id) & 0xF000) +#define NJ_DIC_STATIC 0x1000 +#define NJ_DIC_CUSTOMIZE 0x2000 +#define NJ_DIC_LEARN 0x3000 +#define NJ_DIC_USER 0x4000 + + + NJ_WORD word; +} NJ_RESULT; + +typedef struct { + NJ_UINT16 mode; +#define NJ_DEFAULT_MODE (NJ_NO_RENBUN|NJ_NO_TANBUN|NJ_RELATION_ON|NJ_YOMINASI_ON) + NJ_UINT16 forecast_learn_limit; +#define NJ_DEFAULT_FORECAST_LEARN_LIMIT 30 + NJ_UINT16 forecast_limit; +#define NJ_DEFAULT_FORECAST_LIMIT 100 + NJ_UINT8 char_min; +#define NJ_DEFAULT_CHAR_MIN 0 + NJ_UINT8 char_max; +#define NJ_DEFAULT_CHAR_MAX NJ_MAX_LEN +} NJ_ANALYZE_OPTION; + +#define NJ_STATE_MAX_FREQ 1000 +#define NJ_STATE_MIN_FREQ 0 + +#include "njx_lib.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define NJ_EXTERN extern + +NJ_EXTERN NJ_INT16 njx_get_stroke(NJ_CLASS *iwnn, NJ_RESULT *result, NJ_CHAR *buf, NJ_UINT16 buf_size); +NJ_EXTERN NJ_INT16 njx_get_candidate(NJ_CLASS *iwnn, NJ_RESULT *result, NJ_CHAR *buf, NJ_UINT16 buf_size); +NJ_EXTERN NJ_INT16 njx_search_word(NJ_CLASS *iwnn, NJ_CURSOR *cursor); +NJ_EXTERN NJ_INT16 njx_get_word(NJ_CLASS *iwnn, NJ_CURSOR *cursor, NJ_RESULT *result); +NJ_EXTERN NJ_INT16 njx_check_dic(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle, NJ_UINT8 restore, NJ_UINT32 size); +NJ_EXTERN NJ_INT16 njx_add_word(NJ_CLASS *iwnn, NJ_WORD_INFO *word, NJ_UINT8 type, NJ_UINT8 connect); +NJ_EXTERN NJ_INT16 njx_delete_word(NJ_CLASS *iwnn, NJ_RESULT *result); +NJ_EXTERN NJ_INT16 njx_create_dic(NJ_CLASS *iwnn, NJ_DIC_HANDLE handle, NJ_INT8 type, NJ_UINT32 size); + +NJ_EXTERN NJ_INT16 njx_init(NJ_CLASS *iwnn); +NJ_EXTERN NJ_INT16 njx_select(NJ_CLASS *iwnn, NJ_RESULT *r_result); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njd.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njd.h new file mode 100644 index 00000000..937a009b --- /dev/null +++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njd.h @@ -0,0 +1,67 @@ +/* + * 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 _NJD_H_ +#define _NJD_H_ + +#define NJ_ST_SEARCH_NO_INIT 1 +#define NJ_ST_SEARCH_READY 2 +#define NJ_ST_SEARCH_END 3 +#define NJ_ST_SEARCH_END_EXT 4 + +#define NJ_DIC_FMT_KANAKAN 0x0 + +#define NJ_DIC_ID_LEN (4) +#define NJ_DIC_IDENTIFIER 0x4e4a4443 +#define NJ_DIC_COMMON_HEADER_SIZE 0x001C +#define NJ_DIC_POS_DATA_SIZE 0x0c +#define NJ_DIC_POS_EXT_SIZE 0x10 +#define NJ_DIC_VERSION1 0x00010000 +#define NJ_DIC_VERSION2 0x00020000 +#define NJ_DIC_VERSION3 0x00030000 +#define NJ_DIC_VERSION2_1 0x00020001 + +#define ADD_WORD_DIC_TYPE_USER 0 +#define ADD_WORD_DIC_TYPE_LEARN 1 + +#define DIC_FREQ_BASE 0 +#define DIC_FREQ_HIGH 1000 + +#define LEARN_DIC_QUE_SIZE 32 +#define LEARN_DIC_EXT_QUE_SIZE 6 + + +#define NJ_GET_DIC_VER(h) NJ_INT32_READ((h)+4) + + +#define GET_LOCATION_STATUS(x) ((NJ_UINT8)((x)&0x0f)) + +#define GET_LOCATION_OPERATION(x) ((NJ_UINT8)(((x) >> 4)&0x0f)) + +#define SET_LOCATION_OPERATION(ope) ((NJ_UINT16)((ope) << 4)) + + +#define NJ_GET_DIC_FMT(h) ((NJ_UINT8)((*((h)+0x1C)) & 0x03)) + + +#define CALCULATE_HINDO(freq, base, high, div) \ + ((NJ_HINDO)((((freq) * ((high) - (base))) / (div)) + (base))) + +#define NORMALIZE_HINDO(freq, max, min) \ + (((freq) < (min)) ? (min) : (((freq) > (max)) ? (max) : (freq))) + + +#endif diff --git a/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njx_lib.h b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njx_lib.h new file mode 100644 index 00000000..91755e70 --- /dev/null +++ b/src/plugins/openwnn/3rdparty/openwnn/wnnDictionary/include/njx_lib.h @@ -0,0 +1,88 @@ +/* + * 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 _NJX_LIB_H_ +#define _NJX_LIB_H_ + + +#define NJD_MAX_CONNECT_CNT 6 + +typedef struct { + NJ_UINT16 f_hinsi; + NJ_UINT16 b_hinsi; + NJ_UINT8 yomi_len; + NJ_UINT8 hyouki_len; + NJ_CHAR yomi[NJ_MAX_LEN +NJ_TERM_LEN]; + NJ_CHAR hyouki[NJ_MAX_RESULT_LEN + NJ_TERM_LEN]; + NJ_UINT16 stem_b_hinsi; + NJ_UINT8 fzk_yomi_len; +} NJ_LEARN_WORD_INFO; + + +typedef struct word_que { + NJ_UINT16 entry; + NJ_UINT8 type; + NJ_UINT16 mae_hinsi; + NJ_UINT16 ato_hinsi; + NJ_UINT8 yomi_len; + NJ_UINT8 hyouki_len; + NJ_UINT8 yomi_byte; + NJ_UINT8 hyouki_byte; + NJ_UINT8 next_flag; +} NJ_WQUE; + + +typedef struct { + NJ_LEARN_WORD_INFO selection_data; + NJ_UINT8 count; +} NJ_PREVIOUS_SELECTION_INFO; + +typedef struct { + + + + + NJ_WQUE que_tmp; + + + + + + NJ_PREVIOUS_SELECTION_INFO previous_selection; + + + + + + NJ_CHAR learn_string_tmp[NJ_MAX_RESULT_LEN + NJ_TERM_LEN]; + + NJ_CHAR muhenkan_tmp[NJ_MAX_RESULT_LEN + NJ_TERM_LEN]; + + + + + NJ_DIC_SET dic_set; + + struct { + NJ_UINT8 commit_status; + NJ_UINT16 save_top; + NJ_UINT16 save_bottom; + NJ_UINT16 save_count; + } learndic_status; + +} NJ_CLASS; + +#endif |