0
|
1 /*
|
|
2 * $Id: ddefine.h,v 1.7 2003/05/11 18:29:19 hiroo 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, 2003
|
|
14 *
|
|
15 * Maintainer: FreeWnn Project <freewnn@tomo.gr.jp>
|
|
16 *
|
|
17 * This program is free software; you can redistribute it and/or modify
|
|
18 * it under the terms of the GNU General Public License as published by
|
|
19 * the Free Software Foundation; either version 2 of the License, or
|
|
20 * (at your option) any later version.
|
|
21 *
|
|
22 * This program 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
|
|
25 * GNU General Public License for more details.
|
|
26 *
|
|
27 * You should have received a copy of the GNU General Public License
|
|
28 * along with this program; if not, write to the Free Software
|
|
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
30 */
|
|
31
|
|
32 /************************
|
|
33 * define of daemon
|
|
34 ************************/
|
|
35
|
|
36 #ifndef JSERVER_DDEFINE_H
|
|
37 #define JSERVER_DDEFINE_H 1
|
|
38
|
|
39 #include <ctype.h>
|
|
40
|
|
41 #define SIZE_JISHOTABLE 1000
|
|
42 #define SIZE_JISHOHEAP 2000
|
|
43
|
|
44 #define KANGO_HINSI_MX 256 /* ´´¸ì¤ÎÉÊ»ì¿ô¤ÎºÇÂç¿ô */
|
|
45 #define KANGO_VECT_L (KANGO_HINSI_MX+8*4-1)/(8*4) /* ´´¸ìÀܳ¥Ù¥¯¥¿¤ÎŤµ */
|
|
46 #define FZKVECT_L 5 /* ÉÕ°¸ì¥Ù¥¯¥¿¤ÎŤµ */
|
|
47 #define VECT_L KANGO_VECT_L + FZKVECT_L /* Àܳ¥Ù¥¯¥¿¤ÎŤµ */
|
|
48
|
|
49 struct fzkkouho
|
|
50 { /* used in reffering to fuzokugo jouhou
|
|
51 fuzokugo jouhou is stored using this struct */
|
|
52 int offset;
|
|
53 int vector[KANGO_VECT_L]; /* ´´¸ì½ªÃ¼¥Ù¥¯¥¿ */
|
|
54 };
|
|
55
|
|
56 /* macro C(i , j) is useful for finding a pointer which points out
|
|
57 the first jishoentry whose yomi starts at i and endes at j
|
|
58 which returns NULL if there is no entry which matches this
|
|
59 */
|
|
60
|
|
61 #define C(i,j) (j > maxj[i] ? (struct jdata *)NULL : *(jmtp[i] + (j - i)))
|
|
62
|
|
63
|
|
64 /* #define FZKIBNO 10 */
|
|
65 #define FZKIBNO 5
|
|
66
|
|
67 /* ÉÕ°¸ì²òÀÏ·ë²Ì */
|
|
68 struct ICHBNP
|
|
69 {
|
|
70 struct ICHBNP *next_p;
|
|
71 struct fzkkouho fzkib[FZKIBNO]; /* vec ¤Î²òÀÏ·ë²Ì */
|
|
72 struct fzkkouho fzkib1[FZKIBNO]; /* vec1 ¤Î²òÀÏ·ë²Ì */
|
|
73 };
|
|
74 /* ¼Â¤Ï¡¢fzkib1->offset ¤Ï¡¢¤´¤ß¤¬Æþ¤Ã¤Æ¤¤¤ë */
|
|
75
|
|
76 #define SV_KOSUU 3
|
|
77
|
|
78 #define UJIS_A 0xa3c1 /* £Á */
|
|
79 #define UJIS_Z 0xa3da /* £Ú */
|
|
80 #define UJIS_a 0xa3e1 /* £á */
|
|
81 #define UJIS_z 0xa3fa /* £ú */
|
|
82 #ifdef CHINESE
|
|
83 #define UJIS_comma 0xa3ac /* ¡¤ */
|
|
84 #define S_PAREN 0xa1ae /* ¡Æ */
|
|
85 #define E_PAREN 0xa1bf /* ¡Û */
|
|
86 #else
|
|
87 # ifdef KOREAN
|
|
88 #define UJIS_comma 0xa3ac /* ¡¤ */
|
|
89 #define S_PAREN 0xa1ae /* ¡Æ */
|
|
90 #define E_PAREN 0xa1bd /* ¡Û */
|
|
91 # else
|
|
92 #define UJIS_comma 0xa1a4 /* ¡¤ */
|
|
93 #define S_PAREN 0xa1c6 /* ¡Æ */
|
|
94 #define E_PAREN 0xa1db /* ¡Û */
|
|
95 # endif
|
|
96 #endif /* CHINESE */
|
|
97 /*
|
|
98 #define isdigit(x) ((unsigned)((x) - '0') <= ('9' - '0'))
|
|
99 #define isalpha(x) ((unsigned)((x) - 'A') <= ('Z' - 'A') || \
|
|
100 (unsigned)((x) - 'a') <= ('z' - 'a'))
|
|
101 #define isalnum(x) (isalpha(x) || isdigit(x))
|
|
102 */
|
|
103 #ifdef isspace
|
|
104 # undef isspace /* ctype.h ¤Î isspace() ¤Ï»È¤ï¤Ê¤¤ */
|
|
105 #endif
|
|
106 #define isspace(x) (((x) == ' ') || ((x) == 0x09))
|
|
107 #define isjspace(x) ((x) == 0xa1a1)
|
|
108 #define isparen_s(x) (/* (x) == '\"' || */ (x) == '`' || \
|
|
109 /* ³«³ç¸Ì */ (x) == '(' || (x) == '<' || \
|
|
110 (x) == '[' || (x) == '{')
|
|
111 #define isparen_e(x) ((x) == '\"' || (x) == '\'' || \
|
|
112 /* Êijç¸Ì */ (x) == ')' || (x) == '>' || \
|
|
113 (x) == ']' || (x) == '}')
|
|
114
|
|
115 #define isjdigit(x) ((unsigned)((x) - S_NUM) <= (E_NUM - S_NUM))
|
|
116 #define isjalpha(x) ((unsigned)((x) - UJIS_A) <= (UJIS_Z - UJIS_A) || \
|
|
117 (unsigned)((x) - UJIS_a) <= (UJIS_z - UJIS_a))
|
|
118 #define isjalnum(x) (isjalpha(x) || isjdigit(x))
|
|
119 #define isjhira(x) ((unsigned)((x) - S_HIRA) <= (E_HIRA - S_HIRA))
|
|
120 #define isjkata(x) ((unsigned)((x) - S_KATA) <= (E_KATA - S_KATA))
|
|
121 #define isj1bytekana(x) ((unsigned)((x) - S_HANKATA) <= (E_HANKATA - S_HANKATA))
|
|
122 # define S_KANJI 0xb0a1 /* 16¶è */
|
|
123 # define E_KANJI 0xfefe /* 94¶è */
|
|
124 #ifdef CHINESE
|
|
125 # define S_HANJI 0x20a1 /* 16¶è */
|
|
126 # define E_HANJI 0x7efe /* 94¶è */
|
|
127 #define isjkanji(x) (((unsigned)((x) - S_KANJI) <= (E_KANJI - S_KANJI)) || \
|
|
128 ((unsigned)((x) - S_HANJI) <= (E_HANJI - S_HANJI)))
|
|
129 #define isjparen(x) ((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN) || \
|
|
130 (x)==0xa3a8 || (x)==0xa3a9 || \
|
|
131 (x)==0xa3bc || (x)==0xa3be || \
|
|
132 (x)==0xa3db || (x)==0xa3dd || \
|
|
133 (x)==0xa3fb || (x)==0xa3fd )
|
|
134 /* for ( ) < > [ ] { } */
|
|
135 #define isjparen_s(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \
|
|
136 (((x) & 0x01) == 0) || \
|
|
137 (x)==0xa3a8 || (x)==0xa3bc || \
|
|
138 (x)==0xa3db || (x)==0xa3fb )
|
|
139
|
|
140 #define isjparen_e(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \
|
|
141 (((x) & 0x01) == 1) || \
|
|
142 (x)==0xa3a9 || (x)==0xa3be || \
|
|
143 (x)==0xa3dd || (x)==0xa3fd )
|
|
144 #else
|
|
145 # ifdef KOREAN
|
|
146 #define S_HANJA 0xcaa1 /* Ê¡ */
|
|
147 #define E_HANJA 0xfdfe /* ýþ */
|
|
148 #define isjkanji(x) ((unsigned)((x) - S_HANJA) <= (E_HANJA - S_HANJA))
|
|
149 #define isjparen(x) ((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN) || \
|
|
150 (x)==0xa3a8 || (x) ==0xa3a9 || \
|
|
151 (x)==0xa3bc || (x) ==0xa3be || \
|
|
152 (x)==0xa3db || (x) ==0xa3dd || \
|
|
153 (x)==0xa3fb || (x) ==0xa3fc )
|
|
154 #define isjparen_s(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \
|
|
155 (((x) & 0x01) == 0) || \
|
|
156 (x)==0xa3a8 || (x)==0xa3bc || \
|
|
157 (x)==0xa3db || (x)==0xa3fb)
|
|
158 #define isjparen_e(x) (((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN)) && \
|
|
159 (((x) & 0x01) == 1) || \
|
|
160 (x) ==0xa3a9 || (x) ==0xa3be || \
|
|
161 (x) ==0xa3dd || (x) ==0xa3fc )
|
|
162 #define ishangul(x) ((unsigned)((x) - S_HANGUL) <= (E_HANGUL - S_HANGUL))
|
|
163 # else /* JAPANESE */
|
|
164 #define isjkanji(x) ((unsigned)((x) - S_KANJI) <= (E_KANJI - S_KANJI))
|
|
165 #define isjparen(x) ((unsigned)((x) - S_PAREN) <= (E_PAREN - S_PAREN))
|
|
166 #define isjparen_s(x) (isjparen(x) && (((x) & 0x01) == 0))
|
|
167 #define isjparen_e(x) (isjparen(x) && ((x) & 0x01))
|
|
168 # endif /* KOREAN */
|
|
169 #endif /* CHINESE */
|
|
170
|
|
171 #define UJIS_DKT 0xa1ab /* ¡« */
|
|
172 #define UJIS_HDK 0xa1ac /* ¡¬ */
|
|
173
|
|
174 #define BAR_CODE(x) ((x) == BAR)
|
|
175 #define TOKU(x) (((x) == UJIS_DKT) || ((x) == UJIS_HDK))
|
|
176
|
|
177 #define TOKUSYU(x) (TOKU(x) || isjkata(x) || isj1bytekana(x))
|
|
178 /* this resembles macro before */
|
|
179
|
|
180 #define kuten(x) (((x)==KUTEN_NUM)? True:False)
|
|
181 #define touten(x) (((x)==TOUTEN_NUM)? True:False)
|
|
182
|
|
183 struct SYO_BNSETSU
|
|
184 {
|
|
185 struct SYO_BNSETSU *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
186 struct SYO_BNSETSU *parent; /* °ì¤ÄÁ°¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
187 short j_c; /* ´´¸ì top index */
|
|
188 short i_jc; /* ´´¸ì end index */
|
|
189 short bend_m; /* ¾®Ê¸Àá end char index */
|
|
190 int v_jc; /* ¤³¤ÎʸÀá¤Îɾ²ÁÃÍ */
|
|
191 int son_v; /* ¤³¤Î¾®Ê¸Àá¤Þ¤Ç¤Îɾ²ÁÃͤιç·× */
|
|
192 struct jdata *jentptr; /* ¼½ñ¥Ç¡¼¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
193 int t_jc; /* Éʻ졢ÉÑÅÙ¾ðÊó¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */
|
|
194 int kangovect; /* Àܳ¥Ù¥¯¥È¥ë¥Æ¡¼¥Ö¥ë¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */
|
|
195 int hinsi_fk; /* ´´¸ì¤ÎÉÊ»ìNo.(Ê£¹çÉÊ»ì¤ò´Þ¤à) */
|
|
196 short kbcnt; /* ÂçʸÀáÃæ¤Ç²¿¾®Ê¸ÀáÌܤ« */
|
|
197 short reference; /* ¤³¤Î¾®Ê¸Àá¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¿ô */
|
|
198 short status; /* Á°¤ÎʸÀá¤ÈÀܳ¤Ç¤¤ë¤« */
|
|
199 short status_bkwd; /* ¸å¤ÎʸÀá¤È¤ÈÀܳ¤Ç¤¤ë¤« */
|
|
200 };
|
|
201
|
|
202 struct BZD
|
|
203 {
|
|
204 struct BZD *lnk_br; /* ¾¤ÎÂçʸÀá¸õÊä */
|
|
205 struct BZD *lnk_son; /* ¼¡¤ÎÂçʸÀá¤Ø¤Î pointer */
|
|
206 short j_c; /* ´´¸ì top index */
|
|
207 short bend_m; /* ¤³¤ÎÂçʸÀá¤Î end char index */
|
|
208 int v_jc; /* ¤³¤ÎÂçʸÀá¤Îɾ²ÁÃÍ */
|
|
209 int son_v; /* ¼¡¤ÎÂçʸÀá¤Îɾ²ÁÃÍ */
|
|
210 struct SYO_BNSETSU *sbn; /* ÀèƬ¤Î¾®Ê¸Àá */
|
|
211 short sbn_cnt; /* ¤³¤ÎÂçʸÀá¤ò¹½À®¤¹¤ë¾®Ê¸Àá¤Î¿ô */
|
|
212 short kbcnt; /* ¤³¤ÎÂçʸÀá¤ÎÁ°¤Ë²¿Ê¸Àá²òÀϤ·¤¿¤« */
|
|
213 };
|
|
214
|
|
215 struct JKT_SONE
|
|
216 {
|
|
217 struct JKT_SONE *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
218 short i_jc; /* ´´¸ì end index */
|
|
219 short v_jc; /* ¤³¤ÎʸÀá¤Îɾ²ÁÃÍ */
|
|
220 struct jdata *jentptr; /* ¼½ñ¥Ç¡¼¥¿¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
221 int t_jc; /* Éʻ졢ÉÑÅÙ¾ðÊó¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */
|
|
222 int hinsi_fk; /* ´´¸ì¤ÎÉÊ»ìNo.(Ê£¹çÉÊ»ì¤ò´Þ¤à) */
|
|
223 short status_bkwd; /* ¸å¤ÎʸÀá¤È¤ÈÀܳ¤Ç¤¤ë¤« */
|
|
224 };
|
|
225
|
|
226 struct JKT_SBN
|
|
227 {
|
|
228 struct JKT_SBN *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
229 struct JKT_SBN *parent; /* °ì¤ÄÁ°¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
230 short j_c; /* ´´¸ì top index */
|
|
231 short bend_m; /* ¾®Ê¸Àá end char index */
|
|
232 struct JKT_SONE *sbn; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
233 int kangovect; /* Àܳ¥Ù¥¯¥È¥ë¥Æ¡¼¥Ö¥ë¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */
|
|
234 short kbcnt; /* ÂçʸÀáÃæ¤Ç²¿¾®Ê¸ÀáÌܤ« */
|
|
235 short reference; /* ¤³¤Î¾®Ê¸Àá¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¿ô */
|
|
236 short status; /* Á°¤ÎʸÀá¤ÈÀܳ¤Ç¤¤ë¤« */
|
|
237 };
|
|
238
|
|
239 struct JKT_DBN
|
|
240 {
|
|
241 struct JKT_DBN *lnk_br; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
242 short j_c; /* ´´¸ì top index */
|
|
243 short bend_m; /* ¾®Ê¸Àá end char index */
|
|
244 struct JKT_SBN *sbn; /* ¾¤Î¾®Ê¸Àá¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
245 int v_jc; /* ºÇÂçɾ²Á¤Îɾ²ÁÃÍ */
|
|
246 short sbn_cnt; /* ¤³¤ÎÂçʸÀá¤ò¹½À®¤¹¤ë¾®Ê¸Àá¤Î¿ô */
|
|
247 };
|
|
248
|
|
249 struct DSD_SBN
|
|
250 {
|
|
251 short bun_m; /* ¸õÊäʸÀá¤Î end char index */
|
|
252 short bun_jc; /* ¸õÊäʸÀá¤Î top char index */
|
|
253 short i_jc; /* ¸õÊäʸÀá¤Î¼«Î©¸ì end char index */
|
|
254 struct jdata *jentptr; /* ¸õÊäʸÀá¤Î¼½ñ entry pointer */
|
|
255 int t_jc; /* ¸õÊ伫Ω¸ì¤ÎÉÊ»ì & ÉÑÅÙ index */
|
|
256 int hinsi; /* ÉÊ»ì */
|
|
257 int kangovect; /* Àܳ¥Ù¥¯¥È¥ë¥Æ¡¼¥Ö¥ë¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹ */
|
|
258 int v_jc; /* ¾®Ê¸Àá¤Îɾ²ÁÃÍ */
|
|
259 short status; /* Á°¤ÎʸÀá¤ÈÀܳ¤Ç¤¤ë¤« */
|
|
260 short status_bkwd; /* ¸å¤ÎʸÀá¤È¤ÈÀܳ¤Ç¤¤ë¤« */
|
|
261 };
|
|
262
|
|
263 struct DSD_DBN
|
|
264 {
|
|
265 short bun_m; /* ¸õÊäʸÀá¤Î end char index */
|
|
266 short bun_jc; /* ¸õÊäʸÀá¤Î top char index */
|
|
267 struct DSD_SBN *sbn; /* ¾®Ê¸Àá²òÀÏ·ë²Ì¤Ø¤Î¥Ý¥¤¥ó¥¿ */
|
|
268 short sbncnt; /* ¾®Ê¸Àá¿ô (¼¡¸õÊä¤Î¾ì¹ç¤Ï¡¢¼¡¸õÊä¿ô)
|
|
269 DSD_SBN¤Ï¡¢*sbn ¤«¤é sbncnt ¤À¤±¤¢¤ë */
|
|
270 int v_jc; /* ÂçʸÀá¤Îɾ²ÁÃÍ */
|
|
271 };
|
|
272
|
|
273 #ifdef nodef /* move to jslib.h */
|
|
274 /* µ¿»÷ʸÀá¤ÎľÁ°¤ËÁªÂò¤·¤¿¸õÊä */
|
|
275 #define HIRAGANA -1 /* ¤Ò¤é¤¬¤Ê */ /* ÆÉ¤ß¤Î¤Þ¤Þ */
|
|
276 #define KATAKANA -11 /* ¥«¥¿¥«¥Ê */
|
|
277 /* ¿ô»ú */
|
|
278 #define NUM_HAN -2 /* Ⱦ³Ñ¿ô»ú */ /* ÆÉ¤ß¤Î¤Þ¤Þ */
|
|
279 #define NUM_ZEN -12 /* Á´³Ñ¿ô»ú */ /* £±£²£³ */
|
|
280 #define NUM_KAN -13 /* ´Á¿ô»ú */ /* °ìÆó»° */
|
|
281 #define NUM_KANSUUJI -15 /* ´Á¿ô»ú */ /* É´Æó½½»° */
|
|
282 #define NUM_KANOLD -16 /* ´Á¿ô»ú */ /* °íÉ´Æõ½¦»² */
|
|
283 #define NUM_HANCAN -17 /* Ⱦ³Ñ¿ô»ú */ /* 1,234 */
|
|
284 #define NUM_ZENCAN -18 /* Á´³Ñ¿ô»ú */ /* £±¡¤£²£³£´ */
|
|
285 /* 񥨓 */
|
|
286 #define ALP_HAN -4 /* Ⱦ³Ñ */ /* ÆÉ¤ß¤Î¤Þ¤Þ */
|
|
287 #define ALP_ZEN -30 /* Á´³Ñ */
|
|
288 /* µ¹æ */
|
|
289 #define KIG_HAN -5 /* Ⱦ³Ñ */ /* ÆÉ¤ß¤Î¤Þ¤Þ */
|
|
290 #define KIG_JIS -40 /* Á´³Ñ(JIS) */
|
|
291 #define KIG_ASC -41 /* Á´³Ñ(ASC) */
|
|
292 #endif
|
|
293
|
|
294 #define YES 1
|
|
295 #define NO 0
|
|
296 #define UN_KNOWN -1
|
|
297
|
|
298 #define NOTHING 0
|
|
299
|
|
300 #endif /* JSERVER_DDEFINE_H */
|