1 /*
2  *  commonhd.h,v 1.9 2002/05/05 05:13:08 hiroo Exp
3  *  Canna: $Id: commonhd.h,v 1.6 2003/02/01 20:16:33 aida_s Exp $
4  */
5 
6 /*
7  * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
8  * This file is part of FreeWnn.
9  *
10  * Copyright Kyoto University Research Institute for Mathematical Sciences
11  *                 1987, 1988, 1989, 1990, 1991, 1992
12  * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
13  * Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
14  * Copyright FreeWnn Project 1999, 2000, 2001, 2002
15  *
16  * Maintainer:  FreeWnn Project   <freewnn@tomo.gr.jp>
17  *
18  * This program is free software; you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation; either version 2 of the License, or
21  * (at your option) any later version.
22  *
23  * This program is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with this program; if not, write to the Free Software
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
31  */
32 
33 #ifndef WNN_COMMONHD_H
34 #define WNN_COMMONHD_H
35 
36 /****************
37  * Common header
38  ****************/
39 #include <stdio.h>
40 
41 #define JSERVER_VERSION 0x4200  /* minor version */
42 #define _SERVER_VERSION "FreeWnn 1.1.0 pl20"
43 
44 #ifndef JS
45 typedef unsigned int UINT;
46 typedef unsigned char UCHAR;
47 #ifndef w_char
48 # define w_char unsigned short
49 #endif /* w_char */
50 #endif /*JS */
51 
52 #ifdef TAIWANESE
53 #ifndef CHINESE
54 #define CHINESE
55 #endif
56 #endif
57 
58 #ifdef  CHINESE
59 #define CONVERT_from_TOP
60 #define CONVERT_by_STROKE       /* ɮ��(Bi Xing) */
61 #define CONVERT_with_SiSheng    /* ����(Si Sheng) */
62 #define NO_FZK                  /* ��°��ϡ��ʤ� */
63 #define NO_KANA                 /* �Ҥ餬��(�ɤߤ�Ʊ������)�ϡ��ʤ� */
64 #endif
65 
66 #ifdef KOREAN
67 #define CONVERT_from_TOP
68 #define NO_FZK
69 #endif
70 
71 #ifdef luna
72 #ifdef uniosu
73 # ifndef        SYSVR2
74 #  define       SYSVR2
75 # endif
76 # ifndef        TERMINFO
77 #  define       TERMINFO
78 # endif
79 #else /* if defined(MACH) || defined(uniosb) */
80 # ifndef        BSD42
81 #  define       BSD42
82 # endif
83 # ifndef        BSD43
84 #  define       BSD43
85 # endif
86 #  if defined(luna68k)
87 #   ifndef      BSD44
88 #    define     BSD44
89 #   endif
90 #  endif /* defined(luna68k) */
91 # ifndef        TERMCAP
92 #  define       TERMCAP
93 # endif
94 #endif
95 #else /* defined(luna) */
96 #if defined(sun) && !defined(SVR4)
97 # ifndef        BSD42
98 #  define       BSD42
99 # endif
100 # ifndef        TERMCAP
101 #  define       TERMCAP
102 # endif
103 #else /* sun else */
104 #if defined(DGUX) || defined(linux)
105 # ifndef        SYSVR2
106 #  define       SYSVR2
107 # endif
108 # ifndef        TERMCAP
109 #  define       TERMCAP
110 # endif
111 #else
112 #if defined(SVR4) || defined(hpux) || defined(SYSV) || defined(USG)
113 # ifndef        SYSVR2
114 #  define       SYSVR2
115 # endif
116 # ifndef        TERMINFO
117 #  define       TERMINFO
118 # endif
119 # ifdef sun
120 #  define SOLARIS
121 # endif
122 #else
123 # ifndef        BSD43
124 #  define       BSD43
125 # endif
126 # ifndef        BSD42
127 #  define       BSD42
128 # endif
129 # ifndef        TERMCAP
130 #  define       TERMCAP
131 # endif
132 #endif /* defined(SVR4) || defined(hpux) || defined(SYSV) || defined(USG) */
133 #endif /* DGUX */
134 #endif /* sun */
135 #endif /* luna */
136 
137 #ifdef CONFIG_TERMINFO
138 # undef TERMCAP
139 # undef TERMINFO
140 # ifdef HAVE_TERMINFO
141 #  define TERMINFO
142 # else
143 #  define TERMCAP
144 # endif
145 #endif
146 
147 #if defined(SVR4) || defined(hpux)
148 #ifndef F_OK
149 #define F_OK    0
150 #endif
151 #ifndef R_OK
152 #define R_OK    4
153 #endif
154 #endif
155 
156 #define MAXBUNSETSU     80
157 #define LIMITBUNSETSU   400
158 #define MAXJIKOUHO      400
159 
160 #define J_IUJIS 0
161 #define J_EUJIS 1
162 #define J_JIS   2
163 #define J_SJIS  3
164 
165 #define C_IUGB  0
166 #define C_EUGB  1
167 
168 #define C_ICNS11643  0
169 #define C_ECNS11643  1
170 #define C_BIG5  2
171 
172 #define K_IUKSC 0
173 #define K_EUKSC 1
174 #define K_KSC   2
175 
176 #ifndef True
177 #define True    1
178 #endif
179 #ifndef False
180 #define False   0
181 #endif
182 
183 #define KANJI(x)        ((x) & 0x80)
184 
185 
186 #define Ctrl(X)         ((X) & 0x1f)
187 
188 #define NEWLINE         Ctrl('J')
189 #define CR              Ctrl('M')
190 #define ESC             '\033'
191 
192 #ifdef luna
193 #ifdef uniosu
194 #define RUBOUT          0x08    /* BS */
195 #else
196 #define RUBOUT          '\177'
197 #endif
198 #else
199 #define RUBOUT          '\177'
200 #endif
201 #define SPACE           ' '
202 
203 
204 #define JSPACE          0xa1a1
205 #ifdef KOREAN
206 #define BAR             0xA1aa  /* ��   */
207 #else
208 #define BAR             0xA1BC  /* ��   */
209 #endif
210 #define KUTEN_NUM       0xA1A3  /* ��   */
211 #define TOUTEN_NUM      0xA1A2  /* ��   */
212 #define S_NUM           0xA3B0  /* ��   */
213 #define E_NUM           0xA3B9  /* ��   */
214 #ifdef KOREAN
215 #define S_HIRA          0xAAA1  /* ��   */
216 #define E_HIRA          0xAAF3  /* ��   */
217 #define S_KATA          0xABA1  /* ��   */
218 #define E_KATA          0xABF6  /* ��   */
219 #else
220 #define S_HIRA          0xA4A1  /* ��   */
221 #define E_HIRA          0xA4F3  /* ��   */
222 #define S_KATA          0xA5A1  /* ��   */
223 #define E_KATA          0xA5F6  /* ��   */
224 #endif
225 #define S_HANKATA       0x00A1  /* ��   */
226 #define E_HANKATA       0x00DF  /* ��    */
227 
228 #ifdef KOREAN
229 #define S_JUMO          0xa4a1  /* �� */
230 #define E_JUMO          0xa4fe  /* �� */
231 #define S_HANGUL        0xb0a1  /* �� */
232 #define E_HANGUL        0xc8fe  /* �� */
233 #define S_HANJA         0xcaa1  /* ʡ */
234 #define E_HANJA         0xfdfe  /* �� */
235 
236 #define ishanja(x)      ((unsigned)((x) - S_HANJA) <= (E_HANJA - S_HANJA))
237 #define ishangul(x)     ((unsigned)((x) - S_HANGUL) <= (E_HANGUL - S_HANGUL))
238 #endif
239 
240 #define HIRAP(X) ((X) >= S_HIRA && (X) <= E_HIRA)
241 #define KATAP(X) (((X) >= S_KATA && (X) <= E_KATA) || ((X) == BAR))
242 #define ASCIIP(X) ((X) < 0x7f)
243 #define KANJIP(X) (!(HIRAP(X) || KATAP(X) || ASCIIP(X)))
244 
245 #define YOMICHAR(X) ((HIRAP(X)) || \
246                      ('0'<=(X)&&'9'>=(X)) || \
247                      ('A'<=(X)&&'Z'>=(X)) || \
248                      ('a'<=(X)&&'z'>=(X)) || \
249                      (BAR == X) \
250                     )
251 #define HIRA_OF(X) ((KATAP(X) && !(BAR == (X)))? ((X) & ~0x0100) : (X))
252 
253 #ifdef  CONVERT_by_STROKE
254 # define Q_MARK         '?'
255 #endif /* CONVERT_by_STROKE */
256 
257 #define LENGTHYOMI      256     /* jisho ni touroku suru yomi no nagasa */
258 #define LENGTHKANJI     256     /* jisho ni touroku suru kanji no nagasa */
259 #define LENGTHBUNSETSU  264     /* ʸ��κ���Ĺ */
260 #define LENGTHCONV      512     /* �Ѵ���ǽ����ʸ���� */
261 
262 #define JISHOKOSUU     20
263 
264 #define DIC_RDONLY 1            /* �����꡼�ɡ�����꡼�Ǥ��롣 */
265 
266 
267 /* ʣ���Υե�����ˤޤ����ä��Ѥ����Ƥ���Хåե������������ */
268 #define EXPAND_PATH_LENGTH 256  /* expand_expr()���Ѥ���Хåե��Υ����� */
269 
270 
271 #define WNN_FILE_STRING "�ף��Υե�����"
272 #define WNN_FILE_STRING_LEN 16
273 
274 
275 #define F_STAMP_NUM 64
276 #define FILE_ALREADY_READ -2
277 #define FILE_NOT_READ -3
278 
279 /*      file ID */
280 
281 #endif  /* WNN_COMMONHD_H */
282