0
|
1 /*
|
|
2 * $Id: key_bind.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, 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 #include <stdio.h>
|
|
43 #include <pwd.h>
|
|
44 #include "commonhd.h"
|
|
45 #include "config.h"
|
|
46 #include "sdefine.h"
|
|
47 #ifdef XJUTIL
|
|
48 #include "xjutil.h"
|
|
49 #include "sxheader.h"
|
|
50 #include "xext.h"
|
|
51 #else /* XJUTIL */
|
|
52 #include "xim.h"
|
|
53 #include "sheader.h"
|
|
54 #include "ext.h"
|
|
55 #endif /* XJUTIL */
|
|
56
|
|
57 extern char *getenv ();
|
|
58 #ifdef XJUTIL
|
|
59 static struct kansuu kansuu_hyo[] = {
|
|
60 {"send_string", "send what is in the buffer to pty.", 0,
|
|
61 NULL, NULL, NULL, NULL, NULL,
|
|
62 NULL, NULL, NULL, NULL, NULL,
|
|
63 '\0'},
|
|
64 {"forward_char", "cursor wo hitotu maeni susumeru.", 1,
|
|
65 NULL, forward_char, NULL, NULL, NULL,
|
|
66 forward_char, forward_char, NULL, NULL, NULL,
|
|
67 '\0'},
|
|
68 {"backward_char", "cursor wo hitotu usironi susumeru.", 1,
|
|
69 NULL, backward_c, NULL, NULL, NULL,
|
|
70 backward_char, backward_char, NULL, NULL, NULL,
|
|
71 '\0'},
|
|
72 {"goto_top_of_line", "", 1,
|
|
73 NULL, c_top, NULL, NULL, NULL,
|
|
74 c_top, c_top, NULL, NULL, NULL,
|
|
75 '\0'},
|
|
76 {"goto_end_of_line", "", 1,
|
|
77 NULL, c_end, c_end_nobi, NULL, NULL,
|
|
78 c_end, c_end, NULL, NULL, NULL,
|
|
79 '\0'},
|
|
80 {"delete_char_at_cursor", "", 1,
|
|
81 NULL, delete_c, NULL, NULL, NULL,
|
|
82 t_delete_char, t_delete_char, NULL, NULL, NULL,
|
|
83 '\0'},
|
|
84 {"kaijo", "", 0,
|
|
85 NULL, NULL, NULL, NULL, NULL,
|
|
86 NULL, NULL, NULL, NULL, NULL,
|
|
87 '\0'},
|
|
88 {"henkan", "", 1,
|
|
89 NULL, NULL, NULL, NULL, NULL,
|
|
90 NULL, NULL, NULL, NULL, NULL,
|
|
91 '\0'},
|
|
92 {"tan_henkan", "", 1,
|
|
93 NULL, NULL, NULL, NULL, NULL,
|
|
94 NULL, NULL, NULL, NULL, NULL,
|
|
95 '\0'},
|
|
96 {"tan_henkan_dai", "", 1,
|
|
97 NULL, NULL, NULL, NULL, NULL,
|
|
98 NULL, NULL, NULL, NULL, NULL,
|
|
99 '\0'},
|
|
100 {"jikouho", "", 0,
|
|
101 NULL, NULL, NULL, NULL, NULL,
|
|
102 NULL, NULL, NULL, NULL, NULL,
|
|
103 '\0'},
|
|
104 {"zenkouho", "", 0,
|
|
105 NULL, NULL, NULL, NULL, NULL,
|
|
106 NULL, NULL, NULL, NULL, NULL,
|
|
107 '\0'},
|
|
108 {"jikouho_dai", "", 0,
|
|
109 NULL, NULL, NULL, NULL, NULL,
|
|
110 NULL, NULL, NULL, NULL, NULL,
|
|
111 '\0'},
|
|
112 {"zenkouho_dai", "", 0,
|
|
113 NULL, NULL, NULL, NULL, NULL,
|
|
114 NULL, NULL, NULL, NULL, NULL,
|
|
115 '\0'},
|
|
116 {"select_jikouho", "", 0,
|
|
117 NULL, NULL, NULL, NULL, NULL,
|
|
118 NULL, NULL, NULL, NULL, NULL,
|
|
119 '\0'},
|
|
120 {"select_jikouho_dai", "", 0,
|
|
121 NULL, NULL, NULL, NULL, NULL,
|
|
122 NULL, NULL, NULL, NULL, NULL,
|
|
123 '\0'},
|
|
124 {"kill", "", 1,
|
|
125 NULL, kill_c, NULL, NULL, NULL,
|
|
126 t_kill, t_kill, NULL, NULL, NULL,
|
|
127 '\0'},
|
|
128 {"yank", "", 1,
|
|
129 NULL, NULL, NULL, NULL, NULL,
|
|
130 NULL, NULL, NULL, NULL, NULL,
|
|
131 '\0'},
|
|
132 {"yank_e", "", 1,
|
|
133 NULL, NULL, NULL, NULL, NULL,
|
|
134 NULL, NULL, NULL, NULL, NULL,
|
|
135 '\0'},
|
|
136 {"bunsetu_nobasi", "", 0,
|
|
137 NULL, NULL, NULL, NULL, NULL,
|
|
138 NULL, NULL, NULL, NULL, NULL,
|
|
139 '\0'},
|
|
140 {"bunsetu_chijime", "", 0,
|
|
141 NULL, NULL, NULL, NULL, NULL,
|
|
142 NULL, NULL, NULL, NULL, NULL,
|
|
143 '\0'},
|
|
144 {"jisho_utility", "", 0,
|
|
145 NULL, NULL, NULL, NULL, NULL,
|
|
146 NULL, NULL, NULL, NULL, NULL,
|
|
147 '\0'},
|
|
148 {"jisho_utility_e", "", 0,
|
|
149 NULL, NULL, NULL, NULL, NULL,
|
|
150 NULL, NULL, NULL, NULL, NULL,
|
|
151 '\0'},
|
|
152 {"touroku", "", 1,
|
|
153 NULL, NULL, NULL, NULL, NULL,
|
|
154 NULL, NULL, NULL, NULL, NULL,
|
|
155 '\0'},
|
|
156 {"touroku_e", "", 1,
|
|
157 NULL, NULL, NULL, NULL, NULL,
|
|
158 NULL, NULL, NULL, NULL, NULL,
|
|
159 '\0'},
|
|
160 {"kakutei", "", 1,
|
|
161 NULL, NULL, NULL, NULL, NULL,
|
|
162 NULL, NULL, NULL, NULL, NULL,
|
|
163 '\0'},
|
|
164 {"sainyuuryoku", "", 1,
|
|
165 NULL, NULL, NULL, NULL, NULL,
|
|
166 NULL, NULL, NULL, NULL, NULL,
|
|
167 '\0'},
|
|
168 {"sainyuuryoku_e", "", 1,
|
|
169 NULL, NULL, NULL, NULL, NULL,
|
|
170 NULL, NULL, NULL, NULL, NULL,
|
|
171 '\0'},
|
|
172 {"kuten", "", 0,
|
|
173 NULL, kuten, NULL, NULL, NULL,
|
|
174 kuten, kuten, NULL, NULL, NULL,
|
|
175 '\0'},
|
|
176 {"kuten_e", "", 0,
|
|
177 NULL, kuten, NULL, kuten, NULL,
|
|
178 kuten, kuten, NULL, NULL, NULL,
|
|
179 '\0'},
|
|
180 {"jis", "", 0,
|
|
181 NULL, jis, NULL, NULL, NULL,
|
|
182 jis, jis, NULL, NULL, NULL,
|
|
183 '\0'},
|
|
184 {"jis_e", "", 0,
|
|
185 NULL, jis, NULL, jis, NULL,
|
|
186 jis, jis, NULL, NULL, NULL,
|
|
187 '\0'},
|
|
188 {"redraw_line", "", 1,
|
|
189 NULL, NULL, NULL, NULL, NULL,
|
|
190 NULL, NULL, NULL, NULL, NULL,
|
|
191 '\0'},
|
|
192 {"redraw_line_e", "", 1,
|
|
193 NULL, NULL, NULL, NULL, NULL,
|
|
194 NULL, NULL, NULL, NULL, NULL,
|
|
195 '\0'},
|
|
196 {"previous_history_e", "", 1,
|
|
197 NULL, NULL, NULL, NULL, NULL,
|
|
198 NULL, NULL, NULL, NULL, NULL,
|
|
199 '\0'},
|
|
200 {"previous_history", "", 1,
|
|
201 NULL, NULL, NULL, NULL, NULL,
|
|
202 NULL, NULL, NULL, NULL, NULL,
|
|
203 '\0'},
|
|
204 {"next_history_e", "", 1,
|
|
205 NULL, NULL, NULL, NULL, NULL,
|
|
206 NULL, NULL, NULL, NULL, NULL,
|
|
207 '\0'},
|
|
208 {"next_history", "", 1,
|
|
209 NULL, NULL, NULL, NULL, NULL,
|
|
210 NULL, NULL, NULL, NULL, NULL,
|
|
211 '\0'},
|
|
212 {"touroku_mark_set", "", 0,
|
|
213 NULL, NULL, NULL, NULL, NULL,
|
|
214 t_markset, NULL, NULL, NULL, NULL,
|
|
215 '\0'},
|
|
216 {"touroku_return", "", 0,
|
|
217 NULL, NULL, NULL, NULL, NULL,
|
|
218 NULL, t_ret, NULL, NULL, NULL,
|
|
219 '\0'},
|
|
220 {"quit", "", 0,
|
|
221 NULL, NULL, NULL, NULL, quit_select,
|
|
222 t_quit, t_quit, quit_select, quit_select, quit_select,
|
|
223 '\0'},
|
|
224 {"touroku_jump_forward", "", 0,
|
|
225 NULL, NULL, NULL, NULL, NULL,
|
|
226 NULL, t_jmp_forward, NULL, NULL, NULL,
|
|
227 '\0'},
|
|
228 {"touroku_jump_backward", "", 0,
|
|
229 NULL, NULL, NULL, NULL, NULL,
|
|
230 NULL, t_jmp_backward, NULL, NULL, NULL,
|
|
231 '\0'},
|
|
232 {"change_to_insert_mode", "", 0,
|
|
233 NULL, NULL, NULL, NULL, NULL,
|
|
234 NULL, NULL, NULL, NULL, NULL,
|
|
235 '\0'},
|
|
236 {"quote_e", "", 0,
|
|
237 NULL, quote, NULL, quote, NULL,
|
|
238 NULL, NULL, NULL, NULL, NULL,
|
|
239 '\0'},
|
|
240 {"quote", "", 0,
|
|
241 NULL, quote, NULL, NULL, NULL,
|
|
242 NULL, NULL, NULL, NULL, NULL,
|
|
243 '\0'},
|
|
244 {"send_ascii_char", "", 0,
|
|
245 NULL, NULL, NULL, NULL, NULL,
|
|
246 NULL, NULL, NULL, NULL, NULL,
|
|
247 '\0'},
|
|
248 {"toggle_send_ascii_char", "", 0,
|
|
249 NULL, NULL, NULL, NULL, NULL,
|
|
250 NULL, NULL, NULL, NULL, NULL,
|
|
251 '\0'},
|
|
252 {"not_send_ascii_char", "", 0,
|
|
253 NULL, NULL, NULL, NULL, NULL,
|
|
254 NULL, NULL, NULL, NULL, NULL,
|
|
255 '\0'},
|
|
256 {"pop_send_ascii_char", "", 0,
|
|
257 NULL, NULL, NULL, NULL, NULL,
|
|
258 NULL, NULL, NULL, NULL, NULL,
|
|
259 '\0'},
|
|
260 {"quote_send_ascii_char", "", 0,
|
|
261 NULL, NULL, NULL, NULL, NULL,
|
|
262 NULL, NULL, NULL, NULL, NULL,
|
|
263 '\0'},
|
|
264 {"select_select", "", 0,
|
|
265 NULL, NULL, NULL, NULL, select_select,
|
|
266 NULL, NULL, kworddel_op, select_select, select_select,
|
|
267 '\0'},
|
|
268 {"lineend_select", "", 0,
|
|
269 NULL, NULL, NULL, NULL, lineend_select,
|
|
270 NULL, NULL, NULL, NULL, NULL,
|
|
271 '\0'},
|
|
272 {"linestart_select", "", 0,
|
|
273 NULL, NULL, NULL, NULL, linestart_select,
|
|
274 NULL, NULL, NULL, NULL, NULL,
|
|
275 '\0'},
|
|
276 {"previous_select", "", 0,
|
|
277 NULL, NULL, NULL, NULL, xw_previous_select,
|
|
278 NULL, NULL, xw_previous_select, xw_previous_select,
|
|
279 xw_previous_message,
|
|
280 '\0'},
|
|
281 {"next_select", "", 0,
|
|
282 NULL, NULL, NULL, NULL, xw_next_select,
|
|
283 NULL, NULL, xw_next_select, xw_next_select, xw_next_message,
|
|
284 '\0'},
|
|
285 {"backward_select", "", 0,
|
|
286 NULL, NULL, NULL, NULL, backward_select,
|
|
287 NULL, NULL, NULL, NULL, NULL,
|
|
288 '\0'},
|
|
289 {"forward_select", "", 0,
|
|
290 NULL, NULL, NULL, NULL, forward_select,
|
|
291 NULL, NULL, NULL, NULL, NULL,
|
|
292 '\0'},
|
|
293 {"reconnect_jserver", "", 0,
|
|
294 reconnect_server, reconnect_server, reconnect_server, reconnect_server,
|
|
295 reconnect_server,
|
|
296 reconnect_server, reconnect_server, reconnect_server, reconnect_server,
|
|
297 reconnect_server,
|
|
298 '\0'},
|
|
299 {"henkan_on", "", 0,
|
|
300 NULL, NULL, NULL, NULL, NULL,
|
|
301 NULL, NULL, NULL, NULL, NULL,
|
|
302 '\0'},
|
|
303 {"inspect", "", 0,
|
|
304 NULL, NULL, NULL, NULL, NULL,
|
|
305 NULL, NULL, NULL, NULL, NULL,
|
|
306 '\0'},
|
|
307 {"sakujo_kouho", "", 0,
|
|
308 NULL, NULL, NULL, NULL, NULL,
|
|
309 NULL, NULL, NULL, NULL, NULL,
|
|
310 '\0'},
|
|
311 {"nobi_henkan_dai", "", 0,
|
|
312 NULL, NULL, NULL, NULL, NULL,
|
|
313 NULL, NULL, NULL, NULL, NULL,
|
|
314 '\0'},
|
|
315 {"nobi_henkan", "", 0,
|
|
316 NULL, NULL, NULL, NULL, NULL,
|
|
317 NULL, NULL, NULL, NULL, NULL,
|
|
318 '\0'},
|
|
319 {"del_entry", "", 0,
|
|
320 NULL, NULL, NULL, NULL, NULL,
|
|
321 NULL, NULL, kworddel, kdicdel, NULL,
|
|
322 '\0'},
|
|
323 {"use_entry", "", 0,
|
|
324 NULL, NULL, NULL, NULL, NULL,
|
|
325 NULL, NULL, kworduse, kdicuse, NULL,
|
|
326 '\0'},
|
|
327 {"com_entry", "", 0,
|
|
328 NULL, NULL, NULL, NULL, NULL,
|
|
329 NULL, NULL, kwordcom, kdiccom, NULL,
|
|
330 '\0'},
|
|
331 {"kana_henkan", "", 1,
|
|
332 NULL, NULL, NULL, NULL, NULL,
|
|
333 NULL, NULL, NULL, NULL, NULL,
|
|
334 '\0'},
|
|
335 {"hindo_set", "", 0,
|
|
336 NULL, NULL, NULL, NULL, NULL,
|
|
337 NULL, NULL, kwordhindo, NULL, NULL,
|
|
338 '\0'},
|
|
339 {"ima_bit", "", 0,
|
|
340 NULL, NULL, NULL, NULL, NULL,
|
|
341 NULL, NULL, kwordima, NULL, NULL,
|
|
342 '\0'},
|
|
343 {"change_locale", "", 0,
|
|
344 NULL, NULL, NULL, NULL, NULL,
|
|
345 NULL, NULL, NULL, NULL, NULL,
|
|
346 '\0'},
|
|
347 {"change_locale_ct", "", 0,
|
|
348 NULL, NULL, NULL, NULL, NULL,
|
|
349 NULL, NULL, NULL, NULL, NULL,
|
|
350 '\0'}
|
|
351 };
|
|
352 #else /* XJUTIL */
|
|
353 extern int lang_c ();
|
|
354 extern int lang_ct ();
|
|
355 static struct kansuu kansuu_hyo[] = {
|
|
356 {"send_string", "send what is in the buffer to pty.", 0,
|
|
357 send_string, send_string, send_string, NULL, NULL,
|
|
358 NULL, NULL, NULL, NULL, NULL,
|
|
359 '\0'},
|
|
360 {"forward_char", "cursor wo hitotu maeni susumeru.", 1,
|
|
361 forward_bunsetsu, forward_char, henkan_forward, NULL, NULL,
|
|
362 forward_char, forward_char, NULL, NULL, NULL,
|
|
363 '\0'},
|
|
364 {"backward_char", "cursor wo hitotu usironi susumeru.", 1,
|
|
365 backward_bunsetsu, backward_c, henkan_backward, NULL, NULL,
|
|
366 backward_char, backward_char, NULL, NULL, NULL,
|
|
367 '\0'},
|
|
368 {"goto_top_of_line", "", 1,
|
|
369 top_bunsetsu, c_top, jmptijime, NULL, NULL,
|
|
370 c_top, c_top, NULL, NULL, NULL,
|
|
371 '\0'},
|
|
372 {"goto_end_of_line", "", 1,
|
|
373 end_bunsetsu, c_end, c_end_nobi, NULL, NULL,
|
|
374 c_end, c_end, NULL, NULL, NULL,
|
|
375 '\0'},
|
|
376 {"delete_char_at_cursor", "", 1,
|
|
377 NULL, delete_c, NULL, NULL, NULL,
|
|
378 t_delete_char, t_delete_char, NULL, NULL, NULL,
|
|
379 '\0'},
|
|
380 {"kaijo", "", 0,
|
|
381 kaijo, NULL, kaijo, NULL, NULL,
|
|
382 NULL, NULL, NULL, NULL, NULL,
|
|
383 '\0'},
|
|
384 {"henkan", "", 1,
|
|
385 NULL, ren_henkan, NULL, NULL, NULL,
|
|
386 NULL, NULL, NULL, NULL, NULL,
|
|
387 '\0'},
|
|
388 {"tan_henkan", "", 1,
|
|
389 NULL, tan_henkan, NULL, NULL, NULL,
|
|
390 NULL, NULL, NULL, NULL, NULL,
|
|
391 '\0'},
|
|
392 {"tan_henkan_dai", "", 1,
|
|
393 NULL, tan_henkan_dai, NULL, NULL, NULL,
|
|
394 NULL, NULL, NULL, NULL, NULL,
|
|
395 '\0'},
|
|
396 {"jikouho", "", 0,
|
|
397 jikouho_c, NULL, NULL, NULL, NULL,
|
|
398 NULL, NULL, NULL, NULL, NULL,
|
|
399 '\0'},
|
|
400 {"zenkouho", "", 0,
|
|
401 zenkouho_c, NULL, NULL, NULL, NULL,
|
|
402 NULL, NULL, NULL, NULL, NULL,
|
|
403 '\0'},
|
|
404 {"jikouho_dai", "", 0,
|
|
405 jikouho_dai_c, NULL, NULL, NULL, NULL,
|
|
406 NULL, NULL, NULL, NULL, NULL,
|
|
407 '\0'},
|
|
408 {"zenkouho_dai", "", 0,
|
|
409 zenkouho_dai_c, NULL, NULL, NULL, NULL,
|
|
410 NULL, NULL, NULL, NULL, NULL,
|
|
411 '\0'},
|
|
412 {"select_jikouho", "", 0,
|
|
413 select_jikouho, NULL, NULL, NULL, NULL,
|
|
414 NULL, NULL, NULL, NULL, NULL,
|
|
415 '\0'},
|
|
416 {"select_jikouho_dai", "", 0,
|
|
417 select_jikouho_dai, NULL, NULL, NULL, NULL,
|
|
418 NULL, NULL, NULL, NULL, NULL,
|
|
419 '\0'},
|
|
420 {"kill", "", 1,
|
|
421 NULL, kill_c, NULL, NULL, NULL,
|
|
422 t_kill, t_kill, NULL, NULL, NULL,
|
|
423 '\0'},
|
|
424 {"yank", "", 1,
|
|
425 NULL, yank_c, NULL, NULL, NULL,
|
|
426 t_yank, t_yank, NULL, NULL, NULL,
|
|
427 '\0'},
|
|
428 {"yank_e", "", 1,
|
|
429 NULL, yank_c, NULL, yank_c, NULL,
|
|
430 t_yank, t_yank, NULL, NULL, NULL,
|
|
431 '\0'},
|
|
432 {"bunsetu_nobasi", "", 0,
|
|
433 enlarge_bunsetsu, NULL, forward, NULL, NULL,
|
|
434 NULL, NULL, NULL, NULL, NULL,
|
|
435 '\0'},
|
|
436 {"bunsetu_chijime", "", 0,
|
|
437 smallen_bunsetsu, NULL, tijime, NULL, NULL,
|
|
438 NULL, NULL, NULL, NULL, NULL,
|
|
439 '\0'},
|
|
440 {"jisho_utility", "", 0,
|
|
441 jutil_c, jutil_c, jutil_c, NULL, NULL,
|
|
442 NULL, NULL, NULL, NULL, NULL,
|
|
443 '\0'},
|
|
444 {"jisho_utility_e", "", 0,
|
|
445 jutil_c, jutil_c, jutil_c, jutil_c, NULL,
|
|
446 NULL, NULL, NULL, NULL, NULL,
|
|
447 '\0'},
|
|
448 {"touroku", "", 1,
|
|
449 touroku_c, touroku_c, touroku_c, NULL, NULL,
|
|
450 NULL, NULL, NULL, NULL, NULL,
|
|
451 '\0'},
|
|
452 {"touroku_e", "", 1,
|
|
453 touroku_c, touroku_c, touroku_c, touroku_c, NULL,
|
|
454 NULL, NULL, NULL, NULL, NULL,
|
|
455 '\0'},
|
|
456 {"kakutei", "", 1,
|
|
457 kakutei, kakutei, kakutei, NULL, NULL,
|
|
458 NULL, NULL, NULL, NULL, NULL,
|
|
459 '\0'},
|
|
460 {"sainyuuryoku", "", 1,
|
|
461 NULL, remember_me, NULL, NULL, NULL,
|
|
462 NULL, NULL, NULL, NULL, NULL,
|
|
463 '\0'},
|
|
464 {"sainyuuryoku_e", "", 1,
|
|
465 NULL, remember_me, NULL, remember_me, NULL,
|
|
466 NULL, NULL, NULL, NULL, NULL,
|
|
467 '\0'},
|
|
468 {"kuten", "", 0,
|
|
469 NULL, kuten, NULL, NULL, NULL,
|
|
470 kuten, kuten, NULL, NULL, NULL,
|
|
471 '\0'},
|
|
472 {"kuten_e", "", 0,
|
|
473 NULL, kuten, NULL, kuten, NULL,
|
|
474 kuten, kuten, NULL, NULL, NULL,
|
|
475 '\0'},
|
|
476 {"jis", "", 0,
|
|
477 NULL, jis, NULL, NULL, NULL,
|
|
478 jis, jis, NULL, NULL, NULL,
|
|
479 '\0'},
|
|
480 {"jis_e", "", 0,
|
|
481 NULL, jis, NULL, jis, NULL,
|
|
482 jis, jis, NULL, NULL, NULL,
|
|
483 '\0'},
|
|
484 {"redraw_line", "", 1,
|
|
485 reset_line, reset_line, reset_line, NULL, reset_line,
|
|
486 reset_line, reset_line, NULL, NULL, NULL,
|
|
487 '\0'},
|
|
488 {"redraw_line_e", "", 1,
|
|
489 reset_line, reset_line, reset_line, reset_line, reset_line,
|
|
490 reset_line, reset_line, NULL, NULL, NULL,
|
|
491 '\0'},
|
|
492 {"previous_history_e", "", 1,
|
|
493 NULL, previous_history, NULL, previous_history, NULL,
|
|
494 NULL, NULL, NULL, NULL, NULL,
|
|
495 '\0'},
|
|
496 {"previous_history", "", 1,
|
|
497 NULL, previous_history, NULL, NULL, NULL,
|
|
498 NULL, NULL, NULL, NULL, NULL,
|
|
499 '\0'},
|
|
500 {"next_history_e", "", 1,
|
|
501 NULL, next_history, NULL, next_history, NULL,
|
|
502 NULL, NULL, NULL, NULL, NULL,
|
|
503 '\0'},
|
|
504 {"next_history", "", 1,
|
|
505 NULL, next_history, NULL, NULL, NULL,
|
|
506 NULL, NULL, NULL, NULL, NULL,
|
|
507 '\0'},
|
|
508 /*{ "touroku_mark_set", "", 0,
|
|
509 NULL, NULL, NULL, NULL, NULL,
|
|
510 t_markset, NULL, NULL, NULL, NULL,
|
|
511 '\0'}, */
|
|
512 {"touroku_mark_set", "", 0,
|
|
513 NULL, NULL, NULL, NULL, NULL,
|
|
514 NULL, NULL, NULL, NULL, NULL,
|
|
515 '\0'},
|
|
516 {"touroku_return", "", 0,
|
|
517 NULL, NULL, NULL, NULL, NULL,
|
|
518 NULL, t_ret, NULL, NULL, NULL,
|
|
519 '\0'},
|
|
520 {"quit", "", 0,
|
|
521 NULL, NULL, NULL, NULL, quit_select,
|
|
522 t_quit, t_quit, NULL, NULL, quit_select,
|
|
523 '\0'},
|
|
524 {"touroku_jump_forward", "", 0,
|
|
525 NULL, NULL, NULL, NULL, NULL,
|
|
526 NULL, t_jmp_forward, NULL, NULL, NULL,
|
|
527 '\0'},
|
|
528 {"touroku_jump_backward", "", 0,
|
|
529 NULL, NULL, NULL, NULL, NULL,
|
|
530 NULL, t_jmp_backward, NULL, NULL, NULL,
|
|
531 '\0'},
|
|
532 {"change_to_insert_mode", "", 0,
|
|
533 insert_it_as_yomi, NULL, NULL, NULL, NULL,
|
|
534 NULL, NULL, NULL, NULL, NULL,
|
|
535 '\0'},
|
|
536 {"quote_e", "", 0,
|
|
537 NULL, quote, NULL, quote, NULL,
|
|
538 NULL, NULL, NULL, NULL, NULL,
|
|
539 '\0'},
|
|
540 {"quote", "", 0,
|
|
541 NULL, quote, NULL, NULL, NULL,
|
|
542 NULL, NULL, NULL, NULL, NULL,
|
|
543 '\0'},
|
|
544 {"send_ascii_char", "", 0,
|
|
545 send_ascii, send_ascii, send_ascii, send_ascii, send_ascii,
|
|
546 send_ascii, send_ascii, send_ascii, send_ascii, send_ascii,
|
|
547 '\0'},
|
|
548 {"toggle_send_ascii_char", "", 0,
|
|
549 toggle_send_ascii, toggle_send_ascii, toggle_send_ascii, toggle_send_ascii,
|
|
550 toggle_send_ascii,
|
|
551 toggle_send_ascii, toggle_send_ascii, toggle_send_ascii, toggle_send_ascii,
|
|
552 toggle_send_ascii,
|
|
553 '\0'},
|
|
554 {"not_send_ascii_char", "", 0,
|
|
555 not_send_ascii, not_send_ascii, not_send_ascii, not_send_ascii, not_send_ascii,
|
|
556 not_send_ascii, not_send_ascii, not_send_ascii, not_send_ascii, not_send_ascii,
|
|
557 '\0'},
|
|
558 {"pop_send_ascii_char", "", 0,
|
|
559 pop_send_ascii, pop_send_ascii, pop_send_ascii, pop_send_ascii, pop_send_ascii,
|
|
560 pop_send_ascii, pop_send_ascii, pop_send_ascii, pop_send_ascii, pop_send_ascii,
|
|
561 '\0'},
|
|
562 {"quote_send_ascii_char", "", 0,
|
|
563 NULL, NULL, NULL, quote_send_ascii_e, NULL,
|
|
564 NULL, NULL, NULL, NULL, NULL,
|
|
565 '\0'},
|
|
566 {"select_select", "", 0,
|
|
567 NULL, NULL, NULL, NULL, select_select,
|
|
568 NULL, NULL, NULL, NULL, select_select,
|
|
569 '\0'},
|
|
570 {"lineend_select", "", 0,
|
|
571 NULL, NULL, NULL, NULL, lineend_select,
|
|
572 NULL, NULL, NULL, NULL, NULL,
|
|
573 '\0'},
|
|
574 {"linestart_select", "", 0,
|
|
575 NULL, NULL, NULL, NULL, linestart_select,
|
|
576 NULL, NULL, NULL, NULL, NULL,
|
|
577 '\0'},
|
|
578 /*{ "previous_select", "", 0,
|
|
579 NULL, NULL, NULL, NULL, previous_select,
|
|
580 NULL, NULL, NULL, NULL, previous_select,
|
|
581 '\0'},*/
|
|
582 {"previous_select", "", 0,
|
|
583 NULL, NULL, NULL, NULL, previous_select,
|
|
584 NULL, NULL, NULL, NULL, xw_back_inspect,
|
|
585 '\0'},
|
|
586 /*{ "next_select", "", 0,
|
|
587 NULL, NULL, NULL, NULL, next_select,
|
|
588 NULL, NULL, NULL, NULL, NULL,
|
|
589 '\0'},*/
|
|
590 {"next_select", "", 0,
|
|
591 NULL, NULL, NULL, NULL, next_select,
|
|
592 NULL, NULL, NULL, NULL, xw_next_inspect,
|
|
593 '\0'},
|
|
594 {"backward_select", "", 0,
|
|
595 NULL, NULL, NULL, NULL, backward_select,
|
|
596 NULL, NULL, NULL, NULL, NULL,
|
|
597 '\0'},
|
|
598 {"forward_select", "", 0,
|
|
599 NULL, NULL, NULL, NULL, forward_select,
|
|
600 NULL, NULL, NULL, NULL, NULL,
|
|
601 '\0'},
|
|
602 {"reconnect_jserver", "", 0,
|
|
603 reconnect_server, reconnect_server, reconnect_server, reconnect_server,
|
|
604 reconnect_server,
|
|
605 reconnect_server, reconnect_server, reconnect_server, reconnect_server,
|
|
606 reconnect_server,
|
|
607 '\0'},
|
|
608 {"henkan_on", "", 0,
|
|
609 henkan_off, henkan_off, henkan_off, henkan_off, henkan_off,
|
|
610 henkan_off, henkan_off, henkan_off, henkan_off, henkan_off,
|
|
611 '\0'},
|
|
612 {"inspect", "", 0,
|
|
613 inspect_kouho, NULL, NULL, NULL, NULL,
|
|
614 NULL, NULL, NULL, NULL, NULL,
|
|
615 '\0'},
|
|
616 {"sakujo_kouho", "", 0,
|
|
617 sakujo_kouho, NULL, NULL, NULL, NULL,
|
|
618 NULL, NULL, NULL, NULL, NULL,
|
|
619 '\0'},
|
|
620 {"nobi_henkan_dai", "", 0,
|
|
621 NULL, NULL, nobi_henkan_dai, NULL, NULL,
|
|
622 NULL, NULL, NULL, NULL, NULL,
|
|
623 '\0'},
|
|
624 {"nobi_henkan", "", 0,
|
|
625 NULL, NULL, nobi_henkan, NULL, NULL,
|
|
626 NULL, NULL, NULL, NULL, NULL,
|
|
627 '\0'},
|
|
628 {"del_entry", "", 0,
|
|
629 NULL, NULL, NULL, NULL, NULL,
|
|
630 NULL, NULL, NULL, NULL, inspectdel,
|
|
631 '\0'},
|
|
632 {"use_entry", "", 0,
|
|
633 NULL, NULL, NULL, NULL, NULL,
|
|
634 NULL, NULL, NULL, NULL, inspectuse,
|
|
635 '\0'},
|
|
636 {"com_entry", "", 0,
|
|
637 NULL, NULL, NULL, NULL, NULL,
|
|
638 NULL, NULL, NULL, NULL, NULL,
|
|
639 '\0'},
|
|
640 {"kana_henkan", "", 1,
|
|
641 NULL, kankana_ren_henkan, NULL, NULL, NULL,
|
|
642 NULL, NULL, NULL, NULL, NULL,
|
|
643 '\0'},
|
|
644 {"hindo_set", "", 0,
|
|
645 NULL, NULL, NULL, NULL, NULL,
|
|
646 NULL, NULL, NULL, NULL, NULL,
|
|
647 '\0'},
|
|
648 {"ima_bit", "", 0,
|
|
649 NULL, NULL, NULL, NULL, NULL,
|
|
650 NULL, NULL, NULL, NULL, NULL,
|
|
651 '\0'},
|
|
652 {"change_locale", "", 0,
|
|
653 lang_c, lang_c, lang_c, lang_c, lang_c,
|
|
654 lang_c, lang_c, lang_c, lang_c, lang_c,
|
|
655 '\0'},
|
|
656 {"change_locale_ct", "", 0,
|
|
657 lang_ct, lang_ct, lang_ct, lang_ct, lang_ct,
|
|
658 lang_ct, lang_ct, lang_ct, lang_ct, lang_ct,
|
|
659 '\0'}
|
|
660 };
|
|
661 #endif /* XJUTIL */
|
|
662
|
|
663 int kansuu_hyo_entry_suu = sizeof (kansuu_hyo) / sizeof (struct kansuu);
|
|
664
|
|
665 /** argument expansion. */
|
|
666 static int
|
|
667 expand_argument (st)
|
|
668 char *st;
|
|
669 {
|
|
670 int num;
|
|
671
|
|
672 if (*st == '^')
|
|
673 {
|
|
674 num = (*(st + 1)) & 0x1f;
|
|
675 }
|
|
676 else if (*st == '0' || *st == '\\')
|
|
677 {
|
|
678 if (*(st + 1) == 'x' || *(st + 1) == 'X')
|
|
679 {
|
|
680 sscanf (st + 2, "%x", &num);
|
|
681 }
|
|
682 else
|
|
683 {
|
|
684 sscanf (st, "%o", &num);
|
|
685 }
|
|
686 }
|
|
687 else if (!('0' <= *st && *st <= '9'))
|
|
688 {
|
|
689 return (-1);
|
|
690 }
|
|
691 else
|
|
692 {
|
|
693 num = atoi (st);
|
|
694 }
|
|
695 if (num >= TBL_SIZE)
|
|
696 {
|
|
697 print_out1 ("In uumkey file, you can only bind a function to code less than %d.", (char *) TBL_SIZE);
|
|
698 return (-1);
|
|
699 }
|
|
700 return (num);
|
|
701 }
|
|
702
|
|
703 static void
|
|
704 remove_key_bind (p)
|
|
705 register struct kansuu *p;
|
|
706 {
|
|
707 register int tbl;
|
|
708 register int com;
|
|
709 #ifdef XJUTIL
|
|
710 #define MTABLE main_table
|
|
711 #else
|
|
712 #define MTABLE (m_table->m_table)
|
|
713 register MainTable *m_table;
|
|
714
|
|
715 m_table = c_c->m_table;
|
|
716 #endif
|
|
717
|
|
718 for (tbl = 0; tbl < TBL_CNT; tbl++)
|
|
719 {
|
|
720 if (p->func[tbl] != NULL)
|
|
721 {
|
|
722 for (com = 0; com < TBL_SIZE; com++)
|
|
723 {
|
|
724 if (MTABLE[tbl][com] == p->func[tbl])
|
|
725 {
|
|
726 MTABLE[tbl][com] = (int (*)()) 0;
|
|
727 MTABLE[tbl][com] = 0;
|
|
728 }
|
|
729 }
|
|
730 }
|
|
731 }
|
|
732 }
|
|
733
|
|
734 static struct kansuu *
|
|
735 find_entry (com_name, tbl)
|
|
736 char *com_name;
|
|
737 struct kansuu **tbl;
|
|
738 {
|
|
739 register int k;
|
|
740 register struct kansuu **p;
|
|
741
|
|
742 p = tbl + ((com_name[0] - 'a') * ONE_CHAR_TBL);
|
|
743 for (k = 0; k < ONE_CHAR_TBL && *p; k++, p++)
|
|
744 {
|
|
745 if (strcmp (com_name, (*p)->kansuumei) == 0)
|
|
746 {
|
|
747 if ((*p)->key_binded)
|
|
748 {
|
|
749 return (*p);
|
|
750 }
|
|
751 }
|
|
752 }
|
|
753 return (NULL);
|
|
754 }
|
|
755
|
|
756 int
|
|
757 expand_expr (s, lang)
|
|
758 char *s, *lang;
|
|
759 {
|
|
760 char tmp[EXPAND_PATH_LENGTH];
|
|
761 register char *p, *s1;
|
|
762 int noerr, expandsuc;
|
|
763 struct passwd *u;
|
|
764 extern struct passwd *getpwnam ();
|
|
765
|
|
766 if (*s != '~' && *s != '@')
|
|
767 {
|
|
768 strcpy (tmp, s);
|
|
769 *s = '\0';
|
|
770 noerr = 1;
|
|
771 }
|
|
772 else
|
|
773 {
|
|
774 if ((int) strlen (s) >= EXPAND_PATH_LENGTH)
|
|
775 return (-1);
|
|
776
|
|
777 s1 = s;
|
|
778 if (NULL != (p = index (++s1, '/')))
|
|
779 {
|
|
780 strcpy (tmp, p);
|
|
781 *p = '\0';
|
|
782 }
|
|
783 else
|
|
784 *tmp = '\0';
|
|
785 if (*s == '~')
|
|
786 {
|
|
787 if (*s1)
|
|
788 {
|
|
789 noerr = expandsuc = (NULL != (u = getpwnam (s1)) && (int) (strlen (p = u->pw_dir) + strlen (tmp)) < EXPAND_PATH_LENGTH);
|
|
790 }
|
|
791 else
|
|
792 {
|
|
793 noerr = expandsuc = (NULL != (p = getenv ("HOME")) && (int) (strlen (p) + strlen (tmp)) < EXPAND_PATH_LENGTH);
|
|
794 }
|
|
795 }
|
|
796 else
|
|
797 { /* then, *s must be '@' */
|
|
798 if (!strcmp (s1, "HOME"))
|
|
799 {
|
|
800 noerr = expandsuc = (NULL != (p = getenv ("HOME")) && (int) (strlen (p) + strlen (tmp)) < EXPAND_PATH_LENGTH);
|
|
801 }
|
|
802 else if (!strcmp (s1, "LIBDIR"))
|
|
803 {
|
|
804 noerr = expandsuc = ((int) (strlen (p = LIBDIR) + strlen (tmp)) < EXPAND_PATH_LENGTH);
|
|
805 }
|
|
806 else if (!strcmp (s1, "LANG"))
|
|
807 {
|
|
808 noerr = expandsuc = ((int) (strlen (p = lang) + strlen (tmp)) < EXPAND_PATH_LENGTH);
|
|
809 }
|
|
810 else
|
|
811 { /* @HOME, @LIBDIR igai ha kaenai */
|
|
812 noerr = 1;
|
|
813 expandsuc = 0;
|
|
814 }
|
|
815 }
|
|
816 if (expandsuc)
|
|
817 strcpy (s, p);
|
|
818 }
|
|
819
|
|
820 if (noerr)
|
|
821 {
|
|
822 int len = strlen ("@USR");
|
|
823 int len1 = strlen ("@LANG");
|
|
824 p = tmp;
|
|
825 for (; *p; p++)
|
|
826 {
|
|
827 if (!strncmp (p, "@USR", len))
|
|
828 {
|
|
829 if ((int) (strlen (username) + strlen (p) + strlen (s) - len) < EXPAND_PATH_LENGTH)
|
|
830 {
|
|
831 strcat (s, username);
|
|
832 p += len - 1;
|
|
833 }
|
|
834 else
|
|
835 {
|
|
836 return (-1);
|
|
837 }
|
|
838 }
|
|
839 else if (!strncmp (p, "@LANG", len1))
|
|
840 {
|
|
841 if ((int) (strlen (lang) + strlen (p) + strlen (s) - len) < EXPAND_PATH_LENGTH)
|
|
842 {
|
|
843 strcat (s, lang);
|
|
844 p += len1 - 1;
|
|
845 }
|
|
846 else
|
|
847 {
|
|
848 return (-1);
|
|
849 }
|
|
850 }
|
|
851 else
|
|
852 {
|
|
853 strncat (s, p, 1);
|
|
854 }
|
|
855 }
|
|
856 }
|
|
857 return (noerr ? 0 : -1);
|
|
858 }
|
|
859
|
|
860 static int
|
|
861 key_binding (file_name, lang)
|
|
862 char *file_name;
|
|
863 char *lang;
|
|
864 {
|
|
865 register int k, kk;
|
|
866 FILE *fp, *fopen ();
|
|
867 char func_name[64];
|
|
868 int com_cnt;
|
|
869 int com_num;
|
|
870 char buf[256];
|
|
871 char com_name[16][EXPAND_PATH_LENGTH];
|
|
872 int lc = 0;
|
|
873 int tbl;
|
|
874 register struct kansuu **one_char_tbl, **p, *pp;
|
|
875
|
|
876 if ((fp = fopen (file_name, "r")) == NULL)
|
|
877 {
|
|
878 print_out1 ("Key_binding file \"%s\" doesn't exist.", file_name);
|
|
879 return (-1);
|
|
880 }
|
|
881 if (!(p = (struct kansuu **) Calloc (ONE_CHAR_TBL * ('z' - 'a' + 1), sizeof (struct kansuu *))))
|
|
882 {
|
|
883 malloc_error ("allocation of work area for key binding");
|
|
884 fclose (fp);
|
|
885 return (-1);
|
|
886 }
|
|
887 one_char_tbl = p;
|
|
888 for (k = 0; k < kansuu_hyo_entry_suu; k++)
|
|
889 {
|
|
890 p = one_char_tbl + ((kansuu_hyo[k].kansuumei[0] - 'a') * ONE_CHAR_TBL);
|
|
891 for (kk = 0; *p && kk < ONE_CHAR_TBL; kk++, p++);
|
|
892 if (kk == ONE_CHAR_TBL)
|
|
893 {
|
|
894 print_out ("work area for key binding overflowed");
|
|
895 Free (one_char_tbl);
|
|
896 fclose (fp);
|
|
897 return (-1);
|
|
898 }
|
|
899 *p = &kansuu_hyo[k];
|
|
900 }
|
|
901
|
|
902 for (tbl = 0; tbl < TBL_CNT; tbl++)
|
|
903 {
|
|
904 romkan_clear_tbl[tbl][rubout_code] = 0;
|
|
905 }
|
|
906 main_table[1][rubout_code] = rubout_c;
|
|
907 main_table[5][rubout_code] = t_rubout;
|
|
908 main_table[6][rubout_code] = t_rubout;
|
|
909
|
|
910 lc = 0;
|
|
911 while (fgets (buf, 256, fp))
|
|
912 {
|
|
913 lc += 1;
|
|
914 if ((*buf == ';') || (*buf == ':') || (*buf == '\n'))
|
|
915 continue;
|
|
916 if ((com_cnt = sscanf (buf, "%s %s %s %s %s %s %s %s %s %s %s",
|
|
917 func_name, com_name[0], com_name[1], com_name[2], com_name[3], com_name[4], com_name[5], com_name[6], com_name[7], com_name[8], com_name[9])) < 2)
|
|
918 {
|
|
919 print_out2 ("In uumkey file \"%s\", Line %d is illegal.", file_name, (char *) lc);
|
|
920 continue; /* every command needs at least 1 argument. */
|
|
921 }
|
|
922
|
|
923 if (strcmp (func_name, "include") == 0)
|
|
924 {
|
|
925 if (0 != expand_expr (com_name[0], lang))
|
|
926 {
|
|
927 print_out3 ("In uumkey file \"%s\", %s %s.", file_name, com_name[0], msg_get (cd, 22, default_message[22], lang));
|
|
928 }
|
|
929 key_binding (com_name[0], lang);
|
|
930 }
|
|
931 else if (strcmp (func_name, "unset") == 0)
|
|
932 {
|
|
933 if ((pp = find_entry (com_name[0], one_char_tbl)) != NULL)
|
|
934 {
|
|
935 pp->key_binded = 0;
|
|
936 remove_key_bind (pp);
|
|
937 }
|
|
938 else if (strcmp (com_name[0], "quote_keyin") == 0)
|
|
939 {
|
|
940 #ifndef XJUTIL
|
|
941 quote_code = -1;
|
|
942 #endif /* !XJUTIL */
|
|
943 }
|
|
944 }
|
|
945 else if (strcmp (func_name, "quote_keyin") == 0)
|
|
946 {
|
|
947 #ifndef XJUTIL
|
|
948 if ((com_num = expand_argument (com_name[0])) < 0)
|
|
949 {
|
|
950 print_out3 ("In uumkey file \"%s\",%s is an inappropriate code for %s.", file_name, com_name[0], func_name);
|
|
951 fflush (stderr);
|
|
952 }
|
|
953 else
|
|
954 quote_code = com_num;
|
|
955 #endif /* !XJUTIL */
|
|
956 }
|
|
957 else
|
|
958 {
|
|
959 p = one_char_tbl + ((func_name[0] - 'a') * ONE_CHAR_TBL);
|
|
960 for (k = 0; k < ONE_CHAR_TBL && *p; k++, p++)
|
|
961 {
|
|
962 if (strcmp (func_name, (*p)->kansuumei) == 0)
|
|
963 { /*found! */
|
|
964 if ((*p)->key_binded)
|
|
965 remove_key_bind (*p);
|
|
966 (*p)->key_binded = (char) 1;
|
|
967 for (kk = 0; kk < com_cnt - 1; kk++)
|
|
968 {
|
|
969 com_num = expand_argument (com_name[kk]);
|
|
970 if (com_num < 0)
|
|
971 {
|
|
972 print_out3 ("In uumkey file \"%s\",%s is an inappropriate code for %s.", file_name, com_name[kk], func_name);
|
|
973 fflush (stderr);
|
|
974 }
|
|
975 else
|
|
976 {
|
|
977 for (tbl = 0; tbl < TBL_CNT; tbl++)
|
|
978 {
|
|
979 if ((main_table[tbl][com_num] != NULL) && ((*p)->func[tbl] != NULL))
|
|
980 {
|
|
981 print_out7 ("In uumkey file \"%s\", %s(0x%x)%s at line %d (%s)(table No. %d).",
|
|
982 file_name, (char *) com_name[kk], (char *) com_num, (char *) msg_get (cd, 23, default_message[23], lang), (char *) lc, (*p)->kansuumei, (char *) tbl);
|
|
983 main_table[tbl][com_num] = (*p)->func[tbl];
|
|
984 romkan_clear_tbl[tbl][com_num] = (*p)->romkan_flag;
|
|
985 }
|
|
986 else if ((*p)->func[tbl] != NULL)
|
|
987 {
|
|
988 main_table[tbl][com_num] = (*p)->func[tbl];
|
|
989 romkan_clear_tbl[tbl][com_num] = (*p)->romkan_flag;
|
|
990 }
|
|
991 }
|
|
992 }
|
|
993 }
|
|
994 break;
|
|
995 } /* end of routine when command is founded. */
|
|
996 } /* loop while command is founded */
|
|
997 if (k == ONE_CHAR_TBL || !*p)
|
|
998 {
|
|
999 print_out2 ("In uumkey file \"%s\", unknown entry name %s.", file_name, func_name);
|
|
1000 }
|
|
1001 }
|
|
1002 }
|
|
1003 fclose (fp);
|
|
1004 Free (one_char_tbl);
|
|
1005 return (0);
|
|
1006 }
|
|
1007
|
|
1008 int
|
|
1009 init_key_table (lang)
|
|
1010 char *lang;
|
|
1011 {
|
|
1012 FILE *fp = NULL, *fopen ();
|
|
1013 char file_name[PATHNAMELEN];
|
|
1014 int j, k;
|
|
1015 extern int fclose ();
|
|
1016
|
|
1017 #ifdef XJUTIL
|
|
1018 if (uumkey_name && *uumkey_name)
|
|
1019 strcpy (file_name, uumkey_name);
|
|
1020 if ((fp = fopen (file_name, "r")) != NULL)
|
|
1021 {
|
|
1022 fclose (fp);
|
|
1023 }
|
|
1024 else
|
|
1025 {
|
|
1026 print_out2 ("%s %s", msg_get (cd, 72, default_message[72], lang), CPFILE);
|
|
1027 return (-1);
|
|
1028 }
|
|
1029 #else /* XJUTIL */
|
|
1030 /* from uumrc */
|
|
1031 if (uumkeyname != NULL && uumkeyname[0] != '\0')
|
|
1032 {
|
|
1033 strcpy (file_name, uumkeyname);
|
|
1034 if (fp = fopen (file_name, "r"))
|
|
1035 fclose (fp);
|
|
1036 }
|
|
1037 if (!fp)
|
|
1038 {
|
|
1039 if (strcpy (file_name, LIBDIR), strcat (file_name, "/"), strcat (file_name, lang), strcat (file_name, CPFILE), (fp = fopen (file_name, "r")) != NULL)
|
|
1040 {
|
|
1041 /* default */
|
|
1042 if (!(uumkeyname = alloc_and_copy (file_name)))
|
|
1043 {
|
|
1044 return (-1);
|
|
1045 }
|
|
1046 fclose (fp);
|
|
1047 }
|
|
1048 }
|
|
1049 if (!fp)
|
|
1050 {
|
|
1051 print_out2 ("%s %s", msg_get (cd, 21, default_message[21], lang), CPFILE);
|
|
1052 return (-1);
|
|
1053 }
|
|
1054
|
|
1055 if (!(c_c->m_table = (MainTable *) Malloc (sizeof (MainTable))))
|
|
1056 {
|
|
1057 malloc_error ("allocation of buffer for key binding");
|
|
1058 return (-1);
|
|
1059 }
|
|
1060 c_c->m_table->re_count = 1;
|
|
1061 #endif /* XJUTIL */
|
|
1062 for (j = 0; j < TBL_CNT; j++)
|
|
1063 {
|
|
1064 for (k = 0; k < TBL_SIZE; k++)
|
|
1065 {
|
|
1066 main_table[j][k] = (int (*)()) 0;
|
|
1067 }
|
|
1068 if (j < 3)
|
|
1069 {
|
|
1070 main_table[j][NEWLINE] = (int (*)()) 0;
|
|
1071 main_table[j][CR] = (int (*)()) 0;
|
|
1072 }
|
|
1073 }
|
|
1074 if (key_binding (file_name, lang) == -1)
|
|
1075 return (-1);
|
|
1076 return (0);
|
|
1077 }
|
|
1078
|
|
1079 /*
|
|
1080 Local Variables:
|
|
1081 eval: (setq kanji-flag t)
|
|
1082 eval: (setq kanji-fileio-code 0)
|
|
1083 eval: (mode-line-kanji-code-update)
|
|
1084 End:
|
|
1085 */
|