0
|
1 /*
|
|
2 * $Id: sdefine.h,v 1.4 2006/03/04 19:01:46 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, 2006
|
|
14 *
|
|
15 * Maintainer: FreeWnn Project
|
|
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 standard i/o
|
|
34 *************************/
|
|
35
|
|
36 #ifdef HAVE_CONFIG_H
|
|
37 # include <config.h>
|
|
38 #endif
|
|
39
|
|
40 #include "commonhd.h"
|
|
41
|
|
42 /* ncurses' term.h defines them to either 0 or 1! */
|
|
43 #ifndef HAVE_TERMIOS_H
|
|
44 # define DONT_HAVE_TERMIOS_H
|
|
45 #endif
|
|
46 #ifndef HAVE_TERMIO_H
|
|
47 # define DONT_HAVE_TERMIO_H
|
|
48 #endif
|
|
49 #ifndef HAVE_SYS_TERMIO_H
|
|
50 # define DONT_HAVE_SYS_TERMIO_H
|
|
51 #endif
|
|
52 #ifndef HAVE_SGTTY_H
|
|
53 # define DONT_HAVE_SGTTY_H
|
|
54 #endif
|
|
55
|
|
56 #if defined(HAVE_TERMINFO)
|
|
57 # if defined(HAVE_CURSES_H)
|
|
58 # include <curses.h>
|
|
59 # elif defined(HAVE_NCURSES_H)
|
|
60 # include <ncurses.h>
|
|
61 # else
|
|
62 # error "no terminfo header"
|
|
63 # endif /* HAVE_CURSES_H */
|
|
64 # ifdef HAVE_TERM_H
|
|
65 # include <term.h>
|
|
66 # endif
|
|
67 #else /* HAVE_TERMINFO */
|
|
68 # if defined(HAVE_TERMCAP_H)
|
|
69 # include <termcap.h>
|
|
70 # endif /* HAVE_TERMCAP_H */
|
|
71 #endif /* HAVE_TERMINFO */
|
|
72
|
|
73 #ifdef DONT_HAVE_TERMIOS_H
|
|
74 # undef HAVE_TERMIOS_H
|
|
75 # undef DONT_HAVE_TERMIOS_H
|
|
76 #endif
|
|
77 #ifdef DONT_HAVE_TERMIO_H
|
|
78 # undef HAVE_TERMIO_H
|
|
79 # undef DONT_HAVE_TERMIO_H
|
|
80 #endif
|
|
81 #ifdef DONT_HAVE_SYS_TERMIO_H
|
|
82 # undef HAVE_SYS_TERMIO_H
|
|
83 # undef DONT_HAVE_SYS_TERMIO_H
|
|
84 #endif
|
|
85 #ifdef DONT_HAVE_SGTTY_H
|
|
86 # undef HAVE_SGTTY_H
|
|
87 # undef DONT_HAVE_SGTTY_H
|
|
88 #endif
|
|
89
|
|
90 #ifdef HAVE_KILLPG
|
|
91 # define KILLPG(pgrp, sig) killpg(pgrp, sig)
|
|
92 #else
|
|
93 # define KILLPG(pgrp, sig) kill(-(pgrp), sig)
|
|
94 #endif /* HAVE_KILLPG */
|
|
95
|
|
96 #if defined(HAVE_GETPGID) /* SVR4 and most modern systems */
|
|
97 # define GETPGID(pid) getpgid(pid)
|
|
98 #elif defined(HAVE_GETPGRP) && !defined(GETPGRP_VOID) /* 4.3BSD */
|
|
99 # define GETPGID(pid) getpgrp(pid)
|
|
100 #elif defined(uniosu)
|
|
101 # define GETPGID(pid) ngetpgrp(pid)
|
|
102 #else
|
|
103 /* no way to get process group id */
|
|
104 #endif /* GETPGID */
|
|
105
|
|
106 #if defined(HAVE_GETPGRP)
|
|
107 # if defined(GETPGRP_VOID)
|
|
108 # define GETMYPGRP() getpgrp() /* SYSV, POSIX */
|
|
109 # else
|
|
110 # define GETMYPGRP() getpgrp(0)
|
|
111 # endif /* !GETPGRP_VOID */
|
|
112 #elif defined(GETPGID)
|
|
113 # define GETMYPGRP() GETPGID(getpid())
|
|
114 #else
|
|
115 /* probably some build error occured */
|
|
116 # error "don't know how to get my process group id"
|
|
117 #endif /* GETMYPGRP */
|
|
118
|
|
119 #define MAXCHG 80 /* 解析可能文字数 */
|
|
120 /*漢字バッファ(次候補、単語検索など)の大きさ */
|
|
121 #define MAX_ICHIRAN_KOSU 36 /* 一覧表示字の表示個数 */
|
|
122 #define MAXWORDS MAXJIKOUHO /* 単語検索での検索語数 */
|
|
123 #define NBUN 2 /* n文節解析 */
|
|
124 #define JISHO_PRIO_DEFAULT 5 /*辞書プライオリティのデフォルト値 */
|
|
125
|
|
126 /* 評価関数の係数 */
|
|
127 #define HINDOVAL 3
|
|
128 #define LENGTHVAL 100
|
|
129 #define JIRITUGOVAL 1
|
|
130 #define FLAGVAL 200 /*今使ったよビットの係数 */
|
|
131 #define JISHOPRIOVAL 5
|
|
132
|
|
133 #define TBL_CNT 10 /* key_table no kazu */
|
|
134 /* Two tables are add. one is for selecting zenkouho's, and the other is jisho-ichiran. */
|
|
135 /* One more table is add, which is used in inspect */
|
|
136 /* Deleted table[7] because those are for Wnn3 */
|
|
137 #define TBL_SIZE 256
|
|
138
|
|
139 #define ESCAPE_CHAR(c) (((c) < ' ') || ((c) == 127))
|
|
140 #define NORMAL_CHAR(c) (((c) >= ' ') && ((c) < 127))
|
|
141 #define NOT_NORMAL_CHAR(c) (((c) >= 128) && ((c) < 160))
|
|
142 #define ONEBYTE_CHAR(c) (!((c) & ~0xff)) /* added by Nide */
|
|
143 /*
|
|
144 #define NISEMONO(c) ((c) & 0x80000000)
|
|
145 #define HONMONO(c) (!NISEMONO(c))
|
|
146 #define KANJI_CHAR(c) ((c) >= 256 )
|
|
147 */
|
|
148 #define KANJI_CHAR(c) (((c) >= 256 ) && ((c) & 0xff00) != 0x8e00)
|
|
149
|
|
150 #define zenkaku(x)(KANJI_CHAR(x) || ESCAPE_CHAR(x))
|
|
151 #define hankaku(x) (!zenkaku(x))
|
|
152 #define ZENKAKU_HYOUJI(x) zenkaku(x)
|
|
153 /* CHANGE AFTERWARD TO BE ABLE TO TREAT hakaku katakana. */
|
|
154
|
|
155 #ifndef min
|
|
156 #define max(a , b) (((a) > (b))?(a) : (b))
|
|
157 #define min(a , b) (((a) <= (b))?(a) : (b))
|
|
158 #endif
|
|
159
|
|
160 #define numeric(x) (((x >= S_NUM)&&(x <= E_NUM))? True : False)
|
|
161 #define ISKUTENCODE(x) ((x) == 0xa1a3)
|
|
162
|
|
163 struct jisho_
|
|
164 { /* 辞書管理用structure */
|
|
165 char name[1024];
|
|
166 char hname[1024]; /* 頻度ファイル名 */
|
|
167 int dict_no; /* server が返してくる辞書ナンバー */
|
|
168 int prio;
|
|
169 int rdonly;
|
|
170 };
|
|
171
|
|
172 struct kansuu
|
|
173 { /* kansuu_hyo no entry */
|
|
174 char *kansuumei;
|
|
175 char *comment;
|
|
176 int romkan_flag; /* Clear Romkan or Not. */
|
|
177 int (*func[TBL_CNT]) ();
|
|
178 };
|
|
179
|
|
180 #ifndef w_char
|
|
181 #define w_char unsigned short
|
|
182 #endif
|
|
183
|
|
184 #define printf PRINTF
|
|
185 #define fprintf FPRINTF
|
|
186 #define remove REMOVE
|
|
187
|
|
188 #define throw_c(col) throw_col((col) + disp_mode_length)
|
|
189
|
|
190 #define MAX_HISTORY 10
|
|
191
|
|
192
|
|
193 #define flush() fflush(stdout)
|
|
194 #define print_msg(X) {push_cursor();throw_c(0); clr_line();printf(X);flush();pop_cursor();}
|
|
195 #define print_msg_getc(X) {push_cursor();throw_c(0); clr_line();printf(X);flush();keyin();pop_cursor();}
|
|
196
|
|
197
|
|
198 #define UNDER_LINE_MODE (0x02 | 0x08 | 0x20)
|
|
199
|
|
200 #define OPT_CONVKEY 0x01
|
|
201 #define OPT_RKFILE 0x02
|
|
202 #define OPT_WNNKEY 0x04
|
|
203 #define OPT_FLOW_CTRL 0x08
|
|
204 #define OPT_WAKING_UP_MODE 0x10
|
|
205 #define OPT_VERBOSE 0x20
|
|
206
|
|
207 #define convkey_defined_by_option (defined_by_option & OPT_CONVKEY)
|
|
208 #define rkfile_defined_by_option (defined_by_option & OPT_RKFILE)
|
|
209 #define uumkey_defined_by_option (defined_by_option & OPT_WNNKEY)
|
|
210 #define verbose_option (defined_by_option & OPT_VERBOSE)
|
|
211
|
|
212 /*
|
|
213 #define char_len(X)((hankaku(X))? 1 : 2)
|
|
214 */
|
|
215
|
|
216 /*
|
|
217 GETOPT string & ALL OPTIONS string for configuration.
|
|
218 see each config.h for detail.
|
|
219 NOTE: WHEN YOU MODIFY THESE, YOU ALSO MODIFY do_opt[] ARRAY AND
|
|
220 ALL config.h!!!!
|
|
221 */
|
|
222
|
|
223 #define GETOPTSTR "hHPxXk:c:r:l:D:n:v"
|
|
224 #define ALL_OPTIONS "hHujsUJSPxXkcrlDnvbtBT"
|
|
225 #define OPTIONS "hHPxXkcrlDnv"
|
|
226
|
|
227 /* for message file */
|
|
228 #include "msg.h"
|
|
229 #define MSG_GET(no) msg_get(cd, no, NULL, NULL)
|
|
230
|
|
231 #define CWNN_PINYIN 0
|
|
232 #define CWNN_ZHUYIN 1
|
|
233
|
|
234 #define print_out_func (f_table->print_out_function)
|
|
235 #define input_func (f_table->input_function)
|
|
236 #define call_t_redraw_move_func (f_table->call_t_redraw_move_function)
|
|
237 #define call_t_redraw_move_1_func (f_table->call_t_redraw_move_1_function)
|
|
238 #define call_t_redraw_move_2_func (f_table->call_t_redraw_move_2_function)
|
|
239 #define call_t_print_l_func (f_table->call_t_print_l_function)
|
|
240 #define redraw_when_chmsig_func (f_table->redraw_when_chmsig_function)
|
|
241 #define char_len_func (f_table->char_len_function)
|
|
242 #define char_q_len_func (f_table->char_q_len_function)
|
|
243 #define t_redraw_move_func (f_table->t_redraw_move_function)
|
|
244 #define t_print_l_func (f_table->t_print_l_function)
|
|
245 #define c_top_func (f_table->c_top_function)
|
|
246 #define c_end_func (f_table->c_end_function)
|
|
247 #define c_end_nobi_func (f_table->c_end_nobi_function)
|
|
248 #define call_redraw_line_func (f_table->call_redraw_line_function)
|
|
249 #define hani_settei_func (f_table->hani_settei_function)
|
|
250 #define errorkeyin_func (f_table->errorkeyin_function)
|
|
251 #define call_jl_yomi_len_func (f_table->call_jl_yomi_len_function)
|
|
252
|
|
253 #define env_normal (cur_normal_env->env)
|
|
254 #define env_reverse (cur_reverse_env->env)
|
|
255
|
|
256 #define envrcname (cur_normal_env->envrc_name)
|
|
257 #define reverse_envrcname (cur_reverse_env->envrc_name)
|
|
258
|
|
259 #define env_name_s (cur_normal_env->env_name_str)
|
|
260 #define reverse_env_name_s (cur_reverse_env->env_name_str)
|
|
261
|
|
262 #define servername (cur_normal_env->host_name)
|
|
263 #define reverse_servername (cur_reverse_env->host_name)
|
|
264
|
|
265 #define normal_sticky (cur_normal_env->sticky)
|
|
266 #define reverse_sticky (cur_reverse_env->sticky)
|