1 /*
2  * $Id: sdefine.h,v 1.2 2001/06/14 18:16:17 ura 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 1991, 1992 by Massachusetts Institute of Technology
14  *
15  * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.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, or (at your option)
20  * 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 GNU Emacs; see the file COPYING.  If not, write to the
29  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30  *
31  * Commentary:
32  *
33  * Change log:
34  *
35  * Last modified date: 8,Feb.1999
36  *
37  * Code:
38  *
39  */
40 /*      Version 4.0
41  */
42 /*************************
43  * define of standard i/o
44  *************************/
45 
46 #ifndef _SDEFINE_H_
47 #define _SDEFINE_H_
48 
49 #ifndef MAXNAMLEN
50 #define MAXNAMLEN       62
51 #endif
52 #ifndef MAXPATHLEN
53 #define MAXPATHLEN      255
54 #endif
55 
56 #ifndef MAX_CHARSET
57 #define MAX_CHARSET     4
58 #endif
59 #ifndef MAX_ESCAPELEN
60 #define MAX_ESCAPELEN   4
61 #endif
62 #ifndef MAX_ESCSLIST
63 #define MAX_ESCSLIST    4
64 #endif
65 
66 #ifndef SS2
67 #define SS2     0x8e
68 #endif
69 #ifndef SS3
70 #define SS3     0x8f
71 #endif
72 #ifndef XK_Eisuu_Lock
73 #define XK_Eisuu_Lock   0xFF2E
74 #endif
75 
76 #define PENDING_WCHAR   0x7e7e7e7e
77 
78 #define MAXCHG 80               /* maximum character can be converted   */
79 
80 #define MAX_PORT_NUMBER         8
81 #ifdef  CALLBACKS
82 #define MAX_SUPPORT_STYLE       7
83 #else /* CALLBACKS */
84 #define MAX_SUPPORT_STYLE       3
85 #endif /* CALLBACKS */
86 
87 #define MAX_ICHI_LINES  40
88 #define MAX_ICHI_COLUMNS        400
89 #define MAX_PAGE_LINES  10
90 
91 #define SPACING         4
92 
93 #define MAX_BUTTON      5
94 
95 #define MAX_LANGS       8       /* Max number of languages */
96 #define MAXFONTNMLEN    128     /* Max length of font name */
97 #define IN_BORDER       2
98 #define MAX_FUNC_STACK  32
99 
100 #define BUF_ALLOC_SIZE  128
101 
102 #define DEFAULT_BORDER_WIDTH    4
103 
104 #define TBL_CNT 10              /* key_table no kazu */
105 #define ONE_CHAR_TBL 10         /* number of table for one alphabet */
106 
107 #define TBL_SIZE 256
108 
109 #define MAX_CVT_ENTRY_CNT       256
110 
111 #define ESCAPE_CHAR(c)  (((c) < ' ') || ((c) == 127))
112 #define NORMAL_CHAR(c)  (((c) >= ' ') && ((c) < 127))
113 #define NOT_NORMAL_CHAR(c)      (((c) >= 128) && ((c) < 160))
114 #define ONEBYTE_CHAR(c)         (!((c) & ~0xff))        /* added by Nide */
115 
116 #define KANJI_CHAR(c)           (((c) >= 256 ) && ((c) & 0xff00) != 0x8e00)
117 
118 #define zenkaku(x)(KANJI_CHAR(x) || ESCAPE_CHAR(x))
119 #define hankaku(x) (!zenkaku(x))
120 #define ZENKAKU_HYOUJI(x)     zenkaku(x)
121         /* CHANGE AFTERWARD TO BE ABLE TO TREAT hakaku katakana. */
122 
123 #define MAX_VAL(a , b) (((int)(a) > (int)(b))?(a) : (b))
124 #define MIN_VAL(a , b) (((int)(a) <= (int)(b))?(a) : (b))
125 
126 #define numeric(x)      (((x >= S_NUM)&&(x <= E_NUM))? True : NIL)
127 #define ISKUTENCODE(x)  ((x) == 0xa1a3)
128 
129 #define XOR(a , b)      ((a&(~b)) | ((~a)&b))
130 
131 #ifdef  XJUTIL
132 #define MAX_ICHIRAN_KOSU 36
133 #define JISHO_PRIO_DEFAULT      5
134 
135 struct jisho_
136 {
137   char name[1024];
138   char hname[1024];
139   int dict_no;
140   int prio;
141   int rdonly;
142 };
143 #endif /* XJUTIL */
144 
145 struct kansuu
146 {                               /* kansuu_hyo no entry */
147   char *kansuumei;
148   char *comment;
149   int romkan_flag;
150   int (*func[TBL_CNT]) ();
151   char key_binded;
152 };
153 
154 #define MHL0 5
155 
156 #define MAX_HISTORY 10
157 
158 #ifdef  XJUTIL
159 #define UNDER_LINE_MODE         (0x02 | 0x08 | 0x20)
160 #endif /* XJUTIL */
161 
162 #define OPT_RKFILE              0x01
163 #define OPT_WNNKEY              0x02
164 #define OPT_WAKING_UP_MODE      0x04
165 
166 #define rkfile_defined_by_option        (defined_by_option & OPT_RKFILE)
167 #define uumkey_defined_by_option        (defined_by_option & OPT_WNNKEY)
168 
169 /*
170   GETOPT string & ALL OPTIONS string for configuration.
171   see each config.h for detail.
172   NOTE: WHEN YOU MODIFY THESE, YOU ALSO MODIFY do_opt[] ARRAY AND
173   ALL config.h!!!!
174  */
175 
176 #define LANG_JP         "ja_JP.ujis"
177 #define LANG_CN         "zh_CN.ugb"
178 #define LANG_KR         "ko_KR.euc"
179 #define LANG_TW         "zh_TW.big5"
180 #define LANG_DE         "de_DE.ct"
181 #define LANG_LN         "lt_LN.bit8"
182 #ifdef  JAPANESE
183 #define DEFAULT_LANG    LANG_JP
184 #else /* JAPANESE */
185 #ifdef  CHINESE
186 #ifdef  TAIWANESE
187 #define DEFAULT_LANG    LANG_TW
188 #else /* TAIWANESE */
189 #define DEFAULT_LANG    LANG_CN
190 #endif /* TAIWANESE */
191 #else /* CHINESE */
192 #ifdef  KOREAN
193 #define DEFAULT_LANG    LANG_KR
194 #else /* KOREAN */
195 #ifdef  LATIN
196 #define DEFAULT_LANG    LANG_LN
197 #else /* LATIN */
198 #define DEFAULT_LANG    LANG_JP
199 #endif /* LATIN */
200 #endif /* KOREAN */
201 #endif /* CHINESE */
202 #endif /* JAPANESE */
203 
204 #define XIM_INPUTMETHOD "_XWNMO"
205 #define XIM_JUTIL       "_XIM_JUTIL"
206 #define XIM_RCENV       "XIMRC"
207 #define USR_XIMRC       "/.ximrc"
208 #define XIMRCFILE       "/ximrc"
209 #define CVTKEYFILE      "/cvt_xim_tbl"
210 #define CVTFUNFILE      "/cvt_fun_tbl"
211 #define CVTMETAFILE     "/cvt_meta_tbl"
212 #define XIMMSGFILE      "xim.msg"
213 #define DEF_LANG_FOR_XIMMSGFILE         "C"
214 #define XIM_CONFIG_FILE "/ximconf"
215 #define DEFAULT_FONTSET_NAME    "-*--14-*"
216 #define DEFAULT_WORLD_LOCALE    "wr_WR.ct"
217 
218 #define CWNN_PINYIN     0
219 #define CWNN_ZHUYIN     1
220 
221 #define NYUURYOKU       0x01
222 #define SENTAKU         0x02
223 #define JIKOUHO         0x04
224 #define KUTEN_IN        0x08
225 #define JIS_IN          0x10
226 
227 #define REV_FLAG        (1<<0)
228 #define BOLD_FLAG       (1<<1)
229 #define UNDER_FLAG      (1<<2)
230 
231 #define MessageOnly     0
232 #define YesMessage      1
233 #define YesNoMessage    2
234 
235 #define CANCEL_W        0
236 #define DELETE_W        1
237 #define EXEC_W          1
238 #define USE_W           2
239 #define MOUSE_W         2
240 #define NEXT_W          3
241 #define BACK_W          4
242 
243 #define BoxForeground   (1<<0)
244 #define BoxBackground   (1<<1)
245 #define BoxBorderPixel  (1<<2)
246 #define BoxAll          (BoxForeground|BoxBackground|BoxBorderPixel)
247 
248 #ifndef XJUTIL
249 #define XEVENT_TYPE     1
250 #if defined(X11R5) || defined(BC_X11R5)
251 #define REQUEST_TYPE    2
252 #endif
253 #ifndef X11R5
254 #define REQUEST_TYPE_XIM 22
255 #endif /* !X11R5 */
256 #if defined(XJPLIB) && defined(XJPLIB_DIRECT)
257 #define XJP_DIRECT_TYPE 3
258 #endif /* defined(XJPLIB) && defined(XJPLIB_DIRECT) */
259 
260 #define IsPreeditArea(xc)       (xc->input_style & XIMPreeditArea)
261 #define IsPreeditCallbacks(xc)  (xc->input_style & XIMPreeditCallbacks)
262 #define IsPreeditPosition(xc)   (xc->input_style & XIMPreeditPosition)
263 #define IsPreeditNothing(xc)    (xc->input_style & XIMPreeditNothing)
264 #define IsPreeditNone(xc)       (xc->input_style & XIMPreeditNone)
265 #define IsStatusArea(xc)        (xc->input_style & XIMStatusArea)
266 #define IsStatusCallbacks(xc)   (xc->input_style & XIMStatusCallbacks)
267 #define IsStatusNothing(xc)     (xc->input_style & XIMStatusNothing)
268 #define IsStatusNone(xc)        (xc->input_style & XIMStatusNone)
269 
270 #define SUPPORT_STYLE_1         (XIMPreeditArea | XIMStatusArea)
271 #define SUPPORT_STYLE_2         (XIMPreeditPosition | XIMStatusArea)
272 #define SUPPORT_STYLE_3         (XIMPreeditNothing | XIMStatusNothing)
273 #ifdef  CALLBACKS
274 #define SUPPORT_STYLE_4         (XIMPreeditCallbacks | XIMStatusArea)
275 #define SUPPORT_STYLE_5         (XIMPreeditArea | XIMStatusCallbacks)
276 #define SUPPORT_STYLE_6         (XIMPreeditPosition | XIMStatusCallbacks)
277 #define SUPPORT_STYLE_7         (XIMPreeditCallbacks | XIMStatusCallbacks)
278 #endif /* CALLBACKS */
279 
280 /* Change mask */
281 #define ChClientWindow          (1 << 0)
282 #define ChFocusWindow           (1 << 1)
283 #define ChPreeditLocation       (1 << 2)
284 #define ChPreeditSize           (1 << 3)
285 #define ChPreColormap           (1 << 4)
286 #define ChPreStdColormap        (1 << 5)
287 #define ChPreForeground         (1 << 6)
288 #define ChPreBackground         (1 << 7)
289 #define ChPreBackgroundPixmap   (1 << 8)
290 #define ChPreFontSet            (1 << 9)
291 #define ChPreLineSpace          (1 << 10)
292 #define ChPreCursor             (1 << 11)
293 #define ChStatusLocation        (1 << 12)
294 #define ChStatusSize            (1 << 13)
295 #define ChStColormap            (1 << 14)
296 #define ChStStdColormap         (1 << 15)
297 #define ChStForeground          (1 << 16)
298 #define ChStBackground          (1 << 17)
299 #define ChStBackgroundPixmap    (1 << 18)
300 #define ChStFontSet             (1 << 19)
301 #define ChStLineSpace           (1 << 20)
302 #define ChStCursor              (1 << 21)
303 
304 #define ChPreeditAttributes     (ChPreeditLocation | ChPreeditSize |\
305                                  ChPreColormap | ChPreStdColormap | \
306                                  ChPreForeground | ChPreBackground | \
307                                  ChPreBackgroundPixmap | ChPreFontSet | \
308                                  ChPreLineSpace | ChPreCursor)
309 #define ChStatusAttributes      (ChStatusLocation | ChStatusSize |\
310                                  ChStColormap | ChStStdColormap | \
311                                  ChStForeground | ChStBackground | \
312                                  ChStBackgroundPixmap | ChStFontSet | \
313                                  ChStLineSpace | ChStCursor)
314 
315 #define BadIC                   1
316 #define BadStyle                2
317 #define BadClientWindow         3
318 #define BadFocusWindow          4
319 #define BadLanguage             5
320 #define BadSpotLocation         6
321 #define BadFontSet              7
322 #define AllocError              8
323 #define BadSomething            9
324 
325 #define XWNMO_KILL              9000
326 #define XWNMO_KILL_OK           9001
327 #define XWNMO_KILL_NG           9002
328 #endif /* !XJUTIL */
329 
330 #if defined(USING_XJUTIL) || defined(XJUTIL)
331 #define XJUTIL_NAME             "xjutil"
332 
333 #define XJUTIL_START_PRO        "_XJUTIL_START_PRO_"
334 #define XJUTIL_ENV_PRO          "_XJUTIL_ENV_PRO_"
335 
336 #define DIC_ADD         1
337 #define DIC_KENSAKU     2
338 #define DIC_ICHIRAN     3
339 #define DIC_PARAM       4
340 #define DIC_INFO        5
341 #define DIC_FZK         6
342 #define DIC_TOUROKU     7
343 
344 #define DIC_KILL        999
345 #define DIC_START       1000
346 #define DIC_START_ER    1001
347 #define DIC_FONTSET_ER  1002
348 #define DIC_END         1003
349 
350 #endif /* USING_XJUTIL */
351 
352 #ifdef  XJUTIL
353 #define MAX_KEY_BUTTON  6
354 #define MAX_JU_BUTTON   2
355 
356 #define TEXT_WIDTH      60
357 
358 #define ICHIRAN_MODE    1
359 #define JUTIL_MODE      2
360 
361 #define MESSAGE0        (-1)
362 #define MESSAGE1        0
363 #define MESSAGE2        1
364 #define MESSAGE3        2
365 #define MESSAGE4        3
366 
367 #define CANCEL          1
368 #define KANJI_IN_START  2
369 #define KANJI_IN_END    3
370 #define YOMI_IN         4
371 #define HINSI_IN        5
372 #define JISHO_IN        6
373 #define EXECUTE         7
374 #define TOUROKU_GO      8
375 #endif /* XJUTIL */
376 #endif /* _SDEFINE_H_ */
377