1 /*
2  * Copyright (C) 2008-2012  OMRON SOFTWARE Co., Ltd.
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 
17 #ifndef _NJ_DIC_H_
18 #define _NJ_DIC_H_
19 
20 #define NJ_DIC_TYPE_JIRITSU                     0x00000000
21 #define NJ_DIC_TYPE_FZK                         0x00000001
22 #define NJ_DIC_TYPE_TANKANJI                    0x00000002
23 #define NJ_DIC_TYPE_CUSTOM_COMPRESS             0x00000003
24 #define NJ_DIC_TYPE_STDFORE                     0x00000004
25 #define NJ_DIC_TYPE_FORECONV                    0x00000005
26 #define NJ_DIC_TYPE_YOMINASHI                   0x00010000
27 #define NJ_DIC_TYPE_CUSTOM_INCOMPRESS           0x00020002
28 #define NJ_DIC_TYPE_USER                        0x80030000
29 #define NJ_DIC_TYPE_RULE                        0x000F0000
30 
31 #define NJ_HINSI_V2_F            0
32 #define NJ_HINSI_SUUJI_B        14
33 #define NJ_HINSI_BUNTOU_B        3
34 #define NJ_HINSI_TANKANJI_F      4
35 #define NJ_HINSI_TANKANJI_B      5
36 #define NJ_HINSI_MEISI_F         6
37 #define NJ_HINSI_MEISI_B         7
38 #define NJ_HINSI_JINMEI_F        8
39 #define NJ_HINSI_JINMEI_B        9
40 #define NJ_HINSI_CHIMEI_F       10
41 #define NJ_HINSI_CHIMEI_B       11
42 #define NJ_HINSI_KIGOU_F        12
43 #define NJ_HINSI_KIGOU_B        13
44 #define NJ_HINSI_V1_F           15
45 #define NJ_HINSI_V3_F           16
46 #define NJ_RULE_TYPE_BTOF       0
47 #define NJ_RULE_TYPE_FTOB       1
48 
49 #define NJD_SAME_INDEX_LIMIT    50
50 
51 #define NJ_INT16_READ(in)                                               \
52     (((((NJ_INT16)((in)[0])) << 8) & 0xff00U) + ((in)[1] & 0xffU))
53 
54 #define NJ_INT32_READ(in)                                               \
55     (((((NJ_INT32)((in)[0])) << 24) & 0xff000000) |                     \
56      ((((NJ_INT32)((in)[1])) << 16) &   0xff0000) |                     \
57      ((((NJ_INT32)((in)[2])) <<  8) &     0xff00) |                     \
58      ((((NJ_INT32)((in)[3]))      ) &       0xff))
59 
60 #define NJ_INT32_WRITE(to, from)\
61         {(to)[0]=(NJ_UINT8)(((from)>>24) & 0x000000ff);\
62          (to)[1]=(NJ_UINT8)(((from)>>16) & 0x000000ff);\
63          (to)[2]=(NJ_UINT8)(((from)>>8) & 0x000000ff);\
64          (to)[3]=(NJ_UINT8)((from) & 0x000000ff);}
65 
66 #define NJ_INT16_WRITE(to, from)\
67         {(to)[0]=(NJ_UINT8)(((from)>>8) & 0x00ff);\
68          (to)[1]=(NJ_UINT8)((from) & 0x00ff);}
69 
70 #define NJ_GET_MAX_YLEN(h) ((NJ_INT16)(NJ_INT16_READ((h)+0x16)/sizeof(NJ_CHAR)))
71 
72 #define NJ_GET_MAX_KLEN(h) ((NJ_INT16)(NJ_INT16_READ((h)+0x1A)/sizeof(NJ_CHAR)))
73 
74 #define NJ_GET_DIC_TYPE(h) ((NJ_UINT32)(NJ_INT32_READ((h)+8)))
75 
76 #define F_HINSI_SET_CNT(h) ((NJ_UINT16)(NJ_INT16_READ((h)+0x1C)))
77 #define B_HINSI_SET_CNT(h) ((NJ_UINT16)(NJ_INT16_READ((h)+0x1E)))
78 
79 
80 #endif
81