0
|
1 /*
|
|
2 * $Id: jutil.c,v 1.2 2001/06/14 18:16:16 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 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 /* jisho utility routine for otasuke (user interface) process */
|
|
43
|
|
44 #include <stdio.h>
|
|
45 #include "commonhd.h"
|
|
46 #include "sdefine.h"
|
|
47 #include "xim.h"
|
|
48 #include "sheader.h"
|
|
49 #include "ext.h"
|
|
50
|
|
51 typedef struct _msg_fun
|
|
52 {
|
|
53 char *msg;
|
|
54 int (*fun) ();
|
|
55 }
|
|
56 msg_fun;
|
|
57
|
|
58 static msg_fun message1[] = {
|
|
59 #ifdef USING_XJUTIL
|
|
60 {"", jishoadd},
|
|
61 {"", select_one_dict9},
|
|
62 {"", touroku},
|
|
63 {"", kensaku},
|
|
64 {"", paramchg},
|
|
65 #endif /* USING_XJUTIL */
|
|
66 {"", dicsv}
|
|
67 #ifdef USING_XJUTIL
|
|
68 , {"", dicinfoout},
|
|
69 {"", fuzoku_set}
|
|
70 #endif /* USING_XJUTIL */
|
|
71 };
|
|
72
|
|
73 int
|
|
74 jutil (in)
|
|
75 int in;
|
|
76 {
|
|
77 static int last = 3;
|
|
78 static int c, ret;
|
|
79 static int k;
|
|
80 static char *buf[sizeof (message1) / sizeof (msg_fun)];
|
|
81 static WnnClientRec *c_c_sv = 0;
|
|
82 static jutil_step = 0;
|
|
83 static char *lang;
|
|
84
|
|
85 if (c_c_sv != 0 && c_c != c_c_sv)
|
|
86 {
|
|
87 ring_bell ();
|
|
88 return (0);
|
|
89 }
|
|
90 if (jutil_step == 0)
|
|
91 {
|
|
92 c_c_sv = c_c;
|
|
93 lang = cur_lang->lang;
|
|
94 #ifdef USING_XJUTIL
|
|
95 for (k = 0; k < (sizeof (message1) / sizeof (msg_fun)); k++)
|
|
96 {
|
|
97 buf[k] = msg_get (cd, 43 + k, default_message[43 + k], lang);
|
|
98 }
|
|
99 #else /* USING_XJUTIL */
|
|
100 buf[0] = msg_get (cd, 48, default_message[48], lang);
|
|
101 #endif /* USING_XJUTIL */
|
|
102 jutil_step++;
|
|
103 }
|
|
104 if (jutil_step == 1)
|
|
105 {
|
|
106 c = xw_select_one_element (buf, sizeof (message1) / sizeof (msg_fun), last, msg_get (cd, 20, default_message[20], lang), SENTAKU, main_table[4], in);
|
|
107 if (c == BUFFER_IN_CONT)
|
|
108 {
|
|
109 return (BUFFER_IN_CONT);
|
|
110 }
|
|
111 if (c == -1 || c == -3)
|
|
112 {
|
|
113 c_c_sv = 0;
|
|
114 jutil_step = 0;
|
|
115 return (0);
|
|
116 }
|
|
117 jutil_step++;
|
|
118 last = c;
|
|
119 }
|
|
120 if (jutil_step == 2)
|
|
121 {
|
|
122 ret = (*message1[c].fun) ();
|
|
123 if (ret == BUFFER_IN_CONT)
|
|
124 {
|
|
125 return (BUFFER_IN_CONT);
|
|
126 }
|
|
127 }
|
|
128 c_c_sv = 0;
|
|
129 jutil_step = 0;
|
|
130 return (0);
|
|
131 }
|
|
132
|
|
133 #ifdef USING_XJUTIL
|
|
134 int
|
|
135 paramchg ()
|
|
136 {
|
|
137 xw_paramchg ();
|
|
138 return (0);
|
|
139 }
|
|
140 #endif /* USING_XJUTIL */
|
|
141
|
|
142 int
|
|
143 dicsv ()
|
|
144 {
|
|
145 if (jl_dic_save_all (bun_data_) == -1)
|
|
146 {
|
|
147 errorkeyin ();
|
|
148 }
|
|
149 else
|
|
150 {
|
|
151 print_msg_getc ("%s", msg_get (cd, 0, default_message[0], cur_lang));
|
|
152 }
|
|
153 return (0);
|
|
154 }
|
|
155
|
|
156
|
|
157 #ifdef USING_XJUTIL
|
|
158 int
|
|
159 dicinfoout ()
|
|
160 {
|
|
161 xw_dicinfoout ();
|
|
162 return (0);
|
|
163 }
|
|
164
|
|
165 int
|
|
166 select_one_dict9 ()
|
|
167 {
|
|
168 xw_select_one_dict9 ();
|
|
169 return (0);
|
|
170 }
|
|
171
|
|
172 int
|
|
173 fuzoku_set ()
|
|
174 {
|
|
175 xw_fuzoku_set ();
|
|
176 return (0);
|
|
177 }
|
|
178
|
|
179 int
|
|
180 jishoadd ()
|
|
181 {
|
|
182 xw_jishoadd ();
|
|
183 return (0);
|
|
184 }
|
|
185
|
|
186 int
|
|
187 kensaku ()
|
|
188 {
|
|
189 xw_kensaku ();
|
|
190 return (0);
|
|
191 }
|
|
192
|
|
193 #endif /* USING_XJUTIL */
|