1 /*
2  *  $Id: commonhd.h,v 1.11 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, 2001, 2002
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_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 pl21"
43 
44 #include "wnnerror.h"
45 
46 #ifndef JS
47 typedef unsigned int UINT;
48 typedef unsigned char UCHAR;
49 #ifndef w_char
50 # define w_char unsigned short
51 #endif /* w_char */
52 #endif /*JS */
53 
54 #ifdef TAIWANESE
55 #ifndef CHINESE
56 #define CHINESE
57 #endif
58 #endif
59 
60 #ifdef  CHINESE
61 #define CONVERT_from_TOP
62 #define CONVERT_by_STROKE       /* ɮ��(Bi Xing) */
63 #define CONVERT_with_SiSheng    /* ����(Si Sheng) */
64 #define NO_FZK                  /* ��°��ϡ��ʤ� */
65 #define NO_KANA                 /* �Ҥ餬��(�ɤߤ�Ʊ������)�ϡ��ʤ� */
66 #endif
67 
68 #ifdef KOREAN
69 #define CONVERT_from_TOP
70 #define NO_FZK
71 #endif
72 
73 #ifdef luna
74 #ifdef uniosu
75 # ifndef        SYSVR2
76 #  define       SYSVR2
77 # endif
78 # ifndef        TERMINFO
79 #  define       TERMINFO
80 # endif
81 #else /* if defined(MACH) || defined(uniosb) */
82 # ifndef        BSD42
83 #  define       BSD42
84 # endif
85 # ifndef        BSD43
86 #  define       BSD43
87 # endif
88 #  if defined(luna68k)
89 #   ifndef      BSD44
90 #    define     BSD44
91 #   endif
92 #  endif /* defined(luna68k) */
93 # ifndef        TERMCAP
94 #  define       TERMCAP
95 # endif
96 #endif
97 #else /* defined(luna) */
98 #if defined(sun) && !defined(SVR4)
99 # ifndef        BSD42
100 #  define       BSD42
101 # endif
102 # ifndef        TERMCAP
103 #  define       TERMCAP
104 # endif
105 #else /* sun else */
106 #if defined(DGUX) || defined(linux)
107 # ifndef        SYSVR2
108 #  define       SYSVR2
109 # endif
110 # ifndef        TERMCAP
111 #  define       TERMCAP
112 # endif
113 #else
114 #if defined(SVR4) || defined(hpux)
115 # ifndef        SYSVR2
116 #  define       SYSVR2
117 # endif
118 # ifndef        TERMINFO
119 #  define       TERMINFO
120 # endif
121 # ifdef sun
122 #  define SOLARIS
123 # endif
124 #else
125 # ifndef        BSD43
126 #  define       BSD43
127 # endif
128 # ifndef        BSD42
129 #  define       BSD42
130 # endif
131 # ifndef        TERMCAP
132 #  define       TERMCAP
133 # endif
134 #endif /* defined(SVR4) || defined(hpux) */
135 #endif /* DGUX */
136 #endif /* sun */
137 #endif /* luna */
138 
139 #if defined(SVR4) || defined(hpux)
140 #ifndef F_OK
141 #define F_OK    0
142 #endif
143 #ifndef R_OK
144 #define R_OK    4
145 #endif
146 #endif
147 
148 #define MAXBUNSETSU     80
149 #define LIMITBUNSETSU   400
150 #define MAXJIKOUHO      400
151 
152 #define J_IUJIS 0
153 #define J_EUJIS 1
154 #define J_JIS   2
155 #define J_SJIS  3
156 
157 #define C_IUGB  0
158 #define C_EUGB  1
159 
160 #define C_ICNS11643  0
161 #define C_ECNS11643  1
162 #define C_BIG5  2
163 
164 #define K_IUKSC 0
165 #define K_EUKSC 1
166 #define K_KSC   2
167 
168 #ifndef True
169 #define True    1
170 #endif
171 #ifndef False
172 #define False   0
173 #endif
174 
175 #define KANJI(x)        ((x) & 0x80)
176 
177 
178 #define Ctrl(X)         ((X) & 0x1f)
179 
180 #define NEWLINE         Ctrl('J')
181 #define CR              Ctrl('M')
182 #define ESC             '\033'
183 
184 #ifdef luna
185 #ifdef uniosu
186 #define RUBOUT          0x08    /* BS */
187 #else
188 #define RUBOUT          '\177'
189 #endif
190 #else
191 #define RUBOUT          '\177'
192 #endif
193 #define SPACE           ' '
194 
195 
196 #define JSPACE          0xa1a1
197 #ifdef KOREAN
198 #define BAR             0xA1aa  /* ��   */
199 #else
200 #define BAR             0xA1BC  /* ��   */
201 #endif
202 #define KUTEN_NUM       0xA1A3  /* ��   */
203 #define TOUTEN_NUM      0xA1A2  /* ��   */
204 #define S_NUM           0xA3B0  /* ��   */
205 #define E_NUM           0xA3B9  /* ��   */
206 #ifdef KOREAN
207 #define S_HIRA          0xAAA1  /* ��   */
208 #define E_HIRA          0xAAF3  /* ��   */
209 #define S_KATA          0xABA1  /* ��   */
210 #define E_KATA          0xABF6  /* ��   */
211 #else
212 #define S_HIRA          0xA4A1  /* ��   */
213 #define E_HIRA          0xA4F3  /* ��   */
214 #define S_KATA          0xA5A1  /* ��   */
215 #define E_KATA          0xA5F6  /* ��   */
216 #endif
217 #define S_HANKATA       0x00A1  /* ��   */
218 #define E_HANKATA       0x00DF  /* ��    */
219 
220 #ifdef KOREAN
221 #define S_JUMO          0xa4a1  /* �� */
222 #define E_JUMO          0xa4fe  /* �� */
223 #define S_HANGUL        0xb0a1  /* �� */
224 #define E_HANGUL        0xc8fe  /* �� */
225 #define S_HANJA         0xcaa1  /* ʡ */
226 #define E_HANJA         0xfdfe  /* �� */
227 
228 #define ishanja(x)      ((unsigned)((x) - S_HANJA) <= (E_HANJA - S_HANJA))
229 #define ishangul(x)     ((unsigned)((x) - S_HANGUL) <= (E_HANGUL - S_HANGUL))
230 #endif
231 
232 #define HIRAP(X) ((X) >= S_HIRA && (X) <= E_HIRA)
233 #define KATAP(X) (((X) >= S_KATA && (X) <= E_KATA) || ((X) == BAR))
234 #define ASCIIP(X) ((X) < 0x7f)
235 #define KANJIP(X) (!(HIRAP(X) || KATAP(X) || ASCIIP(X)))
236 
237 #define YOMICHAR(X) ((HIRAP(X)) || \
238                      ('0'<=(X)&&'9'>=(X)) || \
239                      ('A'<=(X)&&'Z'>=(X)) || \
240                      ('a'<=(X)&&'z'>=(X)) || \
241                      (BAR == X) \
242                     )
243 #define HIRA_OF(X) ((KATAP(X) && !(BAR == (X)))? ((X) & ~0x0100) : (X))
244 
245 #ifdef  CONVERT_by_STROKE
246 # define Q_MARK         '?'
247 #endif /* CONVERT_by_STROKE */
248 
249 #define LENGTHYOMI      256     /* jisho ni touroku suru yomi no nagasa */
250 #define LENGTHKANJI     256     /* jisho ni touroku suru kanji no nagasa */
251 #define LENGTHBUNSETSU  264     /* ʸ��κ���Ĺ */
252 #define LENGTHCONV      512     /* �Ѵ���ǽ����ʸ���� */
253 
254 #define JISHOKOSUU     20
255 
256 #define DIC_RDONLY 1            /* �����꡼�ɡ�����꡼�Ǥ��롣 */
257 
258 
259 /* ʣ���Υե�����ˤޤ����ä��Ѥ����Ƥ���Хåե������������ */
260 #define EXPAND_PATH_LENGTH 256  /* expand_expr()���Ѥ���Хåե��Υ����� */
261 
262 
263 #define WNN_FILE_STRING "�ף��Υե�����"
264 #define WNN_FILE_STRING_LEN 16
265 
266 
267 #define F_STAMP_NUM 64
268 #define FILE_ALREADY_READ -2
269 #define FILE_NOT_READ -3
270 
271 /*      file ID */
272 
273 #endif  /* WNN_COMMONHD_H */
274