The Android Open Source Project | 053d509 | 2009-03-15 21:40:26 -0700 | [diff] [blame] | 1 | /* |
Junichi Monma | 59aefa2 | 2012-04-24 16:13:54 +0900 | [diff] [blame] | 2 | * Copyright (C) 2008-2012 OMRON SOFTWARE Co., Ltd. |
The Android Open Source Project | 053d509 | 2009-03-15 21:40:26 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #ifndef _OPENWNNJNI_H |
| 17 | #define _OPENWNNJNI_H |
| 18 | |
| 19 | /** |
| 20 | * Error codes |
| 21 | */ |
| 22 | #define NJ_FUNC_JNI_CONVERT_STR_TO_NJC (0x00FE) |
| 23 | #define NJ_FUNC_JNI_CONVERT_NJC_TO_STR (0x00FD) |
| 24 | #define NJ_FUNC_JNI_FREE_WNNWORK (0x00FC) |
| 25 | #define NJ_FUNC_JNI_CLEAR_DICTIONARY_PARAMETERS (0x00FB) |
| 26 | #define NJ_FUNC_JNI_SET_DICTIONARY_PARAMETERS (0x00FA) |
| 27 | #define NJ_FUNC_JNI_SEARCH_WORD (0x00F9) |
| 28 | #define NJ_FUNC_JNI_GET_WORD (0x00F8) |
| 29 | #define NJ_FUNC_JNI_GET_FREQUENCY (0x00F7) |
| 30 | #define NJ_FUNC_JNI_SET_APPROX_PATTERN (0x00F6) |
| 31 | #define NJ_FUNC_JNI_GET_LEFT_PART_OF_SPEECH (0x00F5) |
| 32 | #define NJ_FUNC_JNI_GET_RIGHT_PART_OF_SPEECH (0x00F4) |
| 33 | #define NJ_FUNC_JNI_SET_LEFT_PART_OF_SPEECH (0x00F3) |
| 34 | #define NJ_FUNC_JNI_SET_RIGHT_PART_OF_SPEECH (0x00F2) |
| 35 | #define NJ_FUNC_JNI_SET_STROKE (0x00F1) |
| 36 | #define NJ_FUNC_JNI_SET_CANDIDATE (0x00F0) |
| 37 | #define NJ_FUNC_JNI_SELECT_WORD (0x00EF) |
| 38 | #define NJ_FUNC_JNI_GET_LEFT_PART_OF_SPEECH_SPECIFIED_TYPE (0x00EE) |
| 39 | #define NJ_FUNC_JNI_GET_RIGHT_PART_OF_SPEECH_SPECIFIED_TYPE (0x00ED) |
| 40 | #define NJ_FUNC_JNI_GET_NUMBER_OF_LEFT_POS (0x00EC) |
| 41 | #define NJ_FUNC_JNI_GET_NUMBER_OF_RIGHT_POS (0x00EB) |
| 42 | |
| 43 | #define NJ_ERR_JNI_FUNC_FAILED (0x7E00) |
| 44 | #define NJ_ERR_ALLOC_FAILED (0x7D00) |
| 45 | #define NJ_ERR_NOT_ALLOCATED (0x7C00) |
| 46 | #define NJ_ERR_INVALID_PARAM (0x7B00) |
| 47 | #define NJ_ERR_APPROX_PATTERN_IS_FULL (0x7A00) |
| 48 | |
| 49 | /** |
| 50 | * Structure of internal work area |
| 51 | */ |
| 52 | #define NJ_MAX_CHARSET_FROM_LEN 1 |
| 53 | #define NJ_MAX_CHARSET_TO_LEN 3 |
| 54 | #define NJ_APPROXSTORE_SIZE (NJ_MAX_CHARSET_FROM_LEN + NJ_TERM_LEN + NJ_MAX_CHARSET_TO_LEN + NJ_TERM_LEN) |
| 55 | |
| 56 | |
| 57 | #define NJ_JNI_FLAG_NONE (0x00) |
| 58 | #define NJ_JNI_FLAG_ENABLE_CURSOR (0x01) |
| 59 | #define NJ_JNI_FLAG_ENABLE_RESULT (0x02) |
| 60 | |
| 61 | typedef struct { |
| 62 | void* dicLibHandle; |
| 63 | NJ_DIC_HANDLE dicHandle[ NJ_MAX_DIC ]; |
| 64 | NJ_UINT32 dicSize[ NJ_MAX_DIC ]; |
| 65 | NJ_UINT8 dicType[ NJ_MAX_DIC ]; |
| 66 | NJ_CHAR keyString[ NJ_MAX_LEN + NJ_TERM_LEN ]; |
| 67 | NJ_RESULT result; |
| 68 | NJ_CURSOR cursor; |
| 69 | NJ_SEARCH_CACHE srhCache[ NJ_MAX_DIC ]; |
| 70 | NJ_DIC_SET dicSet; |
| 71 | NJ_CLASS wnnClass; |
| 72 | NJ_CHARSET approxSet; |
| 73 | NJ_CHAR approxStr[ NJ_MAX_CHARSET * NJ_APPROXSTORE_SIZE ]; |
| 74 | NJ_CHAR previousStroke[ NJ_MAX_LEN + NJ_TERM_LEN ]; |
| 75 | NJ_CHAR previousCandidate[ NJ_MAX_RESULT_LEN + NJ_TERM_LEN ]; |
| 76 | NJ_UINT8 flag; |
| 77 | } NJ_JNIWORK; |
| 78 | |
| 79 | /** |
| 80 | * Predefined approx patterns |
| 81 | */ |
| 82 | typedef struct { |
| 83 | int size; |
| 84 | NJ_UINT8* from; |
| 85 | NJ_UINT8* to; |
| 86 | } PREDEF_APPROX_PATTERN; |
| 87 | |
| 88 | #endif /* _OPENWNNJNI_H */ |