0
|
1 /*
|
|
2 * $Id: jdata.h,v 1.5 2005/04/10 15:26:37 aonoto Exp $
|
|
3 */
|
|
4
|
|
5 /*
|
|
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
|
|
7 * This file is part of FreeWnn.
|
|
8 *
|
|
9 * Copyright Kyoto University Research Institute for Mathematical Sciences
|
|
10 * 1987, 1988, 1989, 1990, 1991, 1992
|
|
11 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
|
|
12 * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
|
|
13 * Copyright FreeWnn Project 1999, 2000
|
|
14 *
|
|
15 * Maintainer: FreeWnn Project <freewnn@tomo.gr.jp>
|
|
16 *
|
|
17 * This library is free software; you can redistribute it and/or
|
|
18 * modify it under the terms of the GNU Lesser General Public
|
|
19 * License as published by the Free Software Foundation; either
|
|
20 * version 2 of the License, or (at your option) any later version.
|
|
21 *
|
|
22 * This library is distributed in the hope that it will be useful,
|
|
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
25 * Lesser General Public License for more details.
|
|
26 *
|
|
27 * You should have received a copy of the GNU Lesser General Public
|
|
28 * License along with this library; if not, write to the
|
|
29 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
30 * Boston, MA 02111-1307, USA.
|
|
31 */
|
|
32
|
|
33 #ifndef WNN_JDATA_H
|
|
34 #define WNN_JDATA_H
|
|
35
|
|
36 #ifndef JS
|
|
37 struct jdata
|
|
38 {
|
|
39 int kanji1;
|
|
40 short kanji2; /* */
|
|
41 short which; /* gyaku henkan? */
|
|
42 int serial; /* index is a serial number of the first
|
|
43 entry which is stored in this entry */
|
|
44 int kosuu; /* this means the number of elements in this
|
|
45 entry */
|
|
46 int jishono; /* jishono in which these entries are stored */
|
|
47 struct jdata *jptr; /* pointer to another jdata which
|
|
48 points out a jdata of the same yomi
|
|
49 but (always)different jishono */
|
|
50 unsigned short *hinsi;
|
|
51 #ifdef CONVERT_with_SiSheng /* Don't warry. Only use in server and jutil */
|
|
52 /* It's only use CWNN : 四声 */
|
|
53 unsigned short *sisheng;
|
|
54 unsigned short sisheng_int;
|
|
55 #endif
|
|
56 UCHAR *hindo; /* 頻度 */
|
|
57 UCHAR *hindo_in; /* 内部頻度 */
|
|
58 };
|
|
59 #endif /* JS */
|
|
60
|
|
61 struct JT
|
|
62 {
|
|
63 unsigned int total; /* トータル頻度 */
|
|
64 int gosuu;
|
|
65 char hpasswd[WNN_PASSWD_LEN];
|
|
66 int syurui;
|
|
67
|
|
68 int maxcomment;
|
|
69 int maxhinsi_list;
|
|
70 int maxserial;
|
|
71 int maxtable; /* For UD Dic */
|
|
72 int maxhontai; /* For UD Dic and Static Dic */
|
|
73 int maxkanji;
|
|
74 int maxri1[2]; /* For Rev Dic */
|
|
75 int maxri2; /* For Rev Dic, is equal to maxserial */
|
|
76
|
|
77
|
|
78 w_char *comment;
|
|
79 w_char *hinsi_list;
|
|
80
|
|
81 UCHAR *hindo; /* 頻度 */
|
|
82 #ifdef CONVERT_with_SiSheng /* Don't warry. Only use in server and jutil */
|
|
83 /* It's only use CWNN : 四声 */
|
|
84 unsigned short *sisheng;
|
|
85 unsigned short sisheng_int;
|
|
86 #endif
|
|
87 unsigned short *hinsi; /* bunpou data is stored here */
|
|
88 UCHAR *kanji; /* kanji data is stored here */
|
|
89 struct uind1 *table; /* anothe tablefile for user jisho */
|
|
90 UCHAR *hontai; /* the tablefile (index-file) */
|
|
91 struct rind1 *ri1[2]; /* For Rev Dic */
|
|
92 struct rind2 *ri2; /* For Rev Dic */
|
|
93
|
|
94 short dirty;
|
|
95 short hdirty;
|
|
96
|
|
97 /* ここから4つは、 登録可能辞書、逆変換可能辞書にのみ関係する */
|
|
98 int bufsize_kanji; /* 漢字領域の大きさ */
|
|
99 int bufsize_serial; /* 文法、頻度領域の大きさ */
|
|
100 int bufsize_hontai; /* インデックス(hontai)の領域の大きさ */
|
|
101 int bufsize_table; /* インデックス(table)の領域の大きさ */
|
|
102 int bufsize_ri1[2]; /* 逆変換可能辞書の table の領域の大きさ */
|
|
103
|
|
104 /* hinsi_list wo kakunou suru */
|
|
105 int maxnode;
|
|
106 struct wnn_hinsi_node *node;
|
|
107 #ifdef CONVERT_by_STROKE /* Don't warry. Only use in server and jutil */
|
|
108 /* Used for Bixing dic */
|
|
109 struct b_node *bind; /* index for yomi <--> kanji search */
|
|
110 int max_bnode; /* Max num of tuple */
|
|
111 int bufsize_bnode; /* BUFFER size of the b_node */
|
|
112 #endif
|
|
113 };
|
|
114
|
|
115 struct HJT
|
|
116 {
|
|
117 struct wnn_file_uniq dic_file_uniq;
|
|
118 int maxcomment;
|
|
119 int maxserial;
|
|
120
|
|
121 w_char *comment;
|
|
122 UCHAR *hindo;
|
|
123
|
|
124 short hdirty;
|
|
125 int bufsize_serial;
|
|
126 };
|
|
127
|
|
128
|
|
129 /*
|
|
130 * structures concerning UD dicts
|
|
131 */
|
|
132
|
|
133 #define AL_INT(x) ((unsigned long)((char *)(x) + 3) & ((unsigned long)~0x3))
|
|
134
|
|
135
|
|
136 #define ENDPTR 0 /* The end of (int) pointer list in uind2->next */
|
|
137 #define RD_ENDPTR 0xffffffff /* The end of (int) pointer list in rind2->next */
|
|
138
|
|
139 struct uind1
|
|
140 {
|
|
141 int pter1; /* pointer to uind1 */
|
|
142 int pter; /* pinter to uind2 */
|
|
143 unsigned int yomi1;
|
|
144 unsigned int yomi2;
|
|
145 };
|
|
146
|
|
147 struct uind2
|
|
148 {
|
|
149 int next; /* pointer to uind2 */
|
|
150 int serial;
|
|
151 int kanjipter;
|
|
152 w_char kosuu;
|
|
153 w_char yomi[1]; /* actually it is variable length */
|
|
154 };
|
|
155
|
|
156 /* MAXTABLE MAX... ha user file no ookisani kuwaete touroku no tame
|
|
157 ni totteoku ookisa*/
|
|
158 #define MAXTABLE 100 /* you can touroku MAXTABLE element without
|
|
159 realloc the jisho */
|
|
160 #define MAXHONTAI MAXTABLE * 4 * 4
|
|
161 #define MAXKANJI MAXTABLE * 10
|
|
162 #define MAXSERIAL MAXTABLE
|
|
163 #define MAXBIND MAXTABLE * 4
|
|
164 /*
|
|
165 * structures concerning REV dicts.
|
|
166 */
|
|
167
|
|
168 struct rind1
|
|
169 {
|
|
170 int pter1; /* pointer to rind1 */
|
|
171 int pter; /* pinter to rind2 */
|
|
172 };
|
|
173
|
|
174 struct rind2
|
|
175 {
|
|
176 int next[2]; /* pointer to rind2 */
|
|
177 int kanjipter;
|
|
178 };
|
|
179
|
|
180 /*
|
|
181 * Reverse Dict ni kansite, dotira wo hikuka?
|
|
182 */
|
|
183
|
|
184 #define D_YOMI 0
|
|
185 #define D_KANJI 1
|
|
186
|
|
187 #define KANJI_str1(pter, which) (((which) == D_YOMI)?((w_char *)((pter) + 2)):\
|
|
188 ((w_char *)((pter) + 2) + Strlen((w_char *)((pter) + 2)) + 1))
|
|
189
|
|
190 #define KANJI_str(p, which) ((*((p) + 1) & FORWARDED)? \
|
|
191 KANJI_str1(((*(w_char *)((p) + 2)) << 16 | (*(w_char *)((p) + 4))) \
|
|
192 + (p),which): \
|
|
193 KANJI_str1((p), which))
|
|
194
|
|
195 #define Get_kanji_len(pter, which) (Strlen(KANJI_str(pter, which)))
|
|
196
|
|
197 /*
|
|
198 * structures concerning SD dicts.
|
|
199 */
|
|
200
|
|
201 #define ST_NORMAL 1
|
|
202 #define ST_NOENT 2
|
|
203 #define ST_NOPTER 3
|
|
204 #define ST_SMALL 4
|
|
205 #define ST_TABLE 5
|
|
206
|
|
207 /*
|
|
208 *Concerning HINSI. But these may not be used.
|
|
209 */
|
|
210
|
|
211 #define SAKUJO_HINSI 0xfffe /* sakujo sareta tango no hinsi */
|
|
212 #define NANDEMO_EEYO 0xfffd /* nandemo maeni koreru to iu hinsi */
|
|
213
|
|
214 /*
|
|
215 *Concerning KANJI and COMMENT.
|
|
216 */
|
|
217
|
|
218 #define HAS_YOMI 1
|
|
219 #define HAS_COMMENT 2
|
|
220 #define FORWARDED 4
|
|
221
|
|
222 /* #define SEPARATE_CHAR '\0'*/
|
|
223 /* Choose character which do not appear as the first byte of w_char */
|
|
224
|
|
225 #define DIC_YOMI_CHAR 1
|
|
226 #define DIC_COMMENT_CHAR 2
|
|
227
|
|
228
|
|
229 #define DIC_HIRAGANA "\\y"
|
|
230 #define DIC_KATAKANA "\\k"
|
|
231
|
|
232 /*#define DIC_HANKAKU "\\h" *//* 半角 *//* 読みのまま */
|
|
233 #define DIC_ZENKAKU "\\z" /* 全角 */ /* 123 */
|
|
234 #define DIC_NUM_KAN "\\chan" /* 漢数字 */ /* 一二三 */
|
|
235 #define DIC_NUM_KANSUUJI "\\chas" /* 漢数字 */ /* 百二十三 */
|
|
236 #define DIC_NUM_KANOLD "\\chao" /* 漢数字 */ /* 壱百弐拾参 */
|
|
237 #define DIC_NUM_HANCAN "\\nhc" /* 半角数字 */ /* 1,234 */
|
|
238 #define DIC_NUM_ZENCAN "\\nzc" /* 全角数字 */ /* 1,234 */
|
|
239 #define DIC_HEX "\\X" /* \Xa4a2 */
|
|
240 #define DIC_HEXc "\\x" /* \xa4a2 */
|
|
241 #define DIC_OCT "\\0" /* \040 */
|
|
242 #define DIC_ESC "\\\\" /* \\ = \ */
|
|
243
|
|
244 #ifdef notuse
|
|
245 /* 英数 */
|
|
246 #define WNN_ALP_HAN -4 /* 半角 */ /* 読みのまま */
|
|
247 #define WNN_ALP_ZEN -30 /* 全角 */
|
|
248 /* 記号 */
|
|
249 #define WNN_KIG_HAN -5 /* 半角 */ /* 読みのまま */
|
|
250 #define WNN_KIG_JIS -40 /* 全角(JIS) */
|
|
251 #define WNN_KIG_ASC -41 /* 全角(ASC) */
|
|
252 #endif
|
|
253
|
|
254 #ifdef CONVERT_by_STROKE
|
|
255 struct b_node
|
|
256 {
|
|
257 short pter; /* Point to Indix-2 */
|
|
258 short pter_son; /* Ptr to first son */
|
|
259 short pter_next; /* Ptr to next brother */
|
|
260 };
|
|
261
|
|
262 struct b_koho
|
|
263 {
|
|
264 struct b_koho *previou;
|
|
265 int value;
|
|
266 w_char *p_yomi;
|
|
267 w_char *p_kanji;
|
|
268 unsigned short *p_hinsi;
|
|
269 UCHAR *p_hindo;
|
|
270 int serial;
|
|
271 int dic_no;
|
|
272 };
|
|
273 #endif /* CONVERT_by_STROKE */
|
|
274
|
|
275
|
|
276 #endif /* WNN_JDATA_H */
|