442
|
1 /* CANNA interface -*- coding: euc-jp -*-
|
428
|
2
|
|
3 Copyright (C) 1995 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
5
|
|
6 This file is part of XEmacs.
|
|
7
|
|
8 XEmacs is free software; you can redistribute it and/or modify it
|
|
9 under the terms of the GNU General Public License as published by the
|
|
10 Free Software Foundation; either version 2, or (at your option) any
|
|
11 later version.
|
|
12
|
|
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
16 for more details.
|
|
17
|
|
18 You should have received a copy of the GNU General Public License
|
|
19 along with XEmacs; see the file COPYING. If not, write to
|
|
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 Boston, MA 02111-1307, USA. */
|
|
22
|
|
23 /* Synched up with: Mule 2.3. Not in FSF. */
|
|
24
|
448
|
25 /* Japanese comments were translated 2000-12-06 by Stephen Turnbull
|
|
26 <stephen@xemacs.org>. I haven't verified that the Japanese comments
|
|
27 were correct. YMMV, NO WARRANTY, not even the implied warranty of
|
|
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (^^;;; as the
|
|
29 Japanese say. */
|
428
|
30
|
|
31 /*
|
|
32
|
|
33 Authors: Akira Kon (kon@uxd.fc.nec.co.jp)
|
|
34 Ichiro Hirakura (hirakura@uxd.fc.nec.co.jp)
|
|
35
|
|
36 Functions defined in this file are
|
|
37
|
|
38 (canna-key-proc key)
|
|
39 key: single STRING
|
|
40 RETURNS:
|
|
41 Length of converted string if no error occurs.
|
|
42 Error string if error occurs.
|
|
43 DESCRIPTION:
|
|
44 Convert a key input to a set of strings. The
|
|
45 strings contain both well-formed string and a
|
|
46 intermediate result to show the translation
|
|
47 information to a user. converted strings are
|
|
48 stored in specific variables.
|
|
49
|
|
50 (canna-initialize)
|
|
51 RETURNS:
|
|
52 List of the following things:
|
|
53 - list of keys to toggle Japanese-mode
|
|
54 - error message
|
|
55 - list of warning messages
|
|
56 DESCRIPTION:
|
|
57 Initialize ``canna'', which is a kana-to-kanji
|
613
|
58 converter for XEmacs. The first arg
|
428
|
59 specifies if inserting space character between
|
|
60 BUNSETSU when candidates are displayed. The
|
|
61 second arg specifies server. The third arg
|
|
62 specifies a file which will be used as a
|
|
63 customization description. If nil is
|
|
64 specified for each arg, the default value will
|
|
65 be used.
|
|
66
|
|
67 (canna-finalize)
|
|
68 RETURNS:
|
|
69 list of warning messages
|
|
70 DESCRIPTION:
|
|
71 finalize ``canna'', which is a kana-to-kanji
|
613
|
72 converter for XEmacs. This cause to write
|
428
|
73 miscellaneous informations to kana-to-kanji
|
|
74 dictionary.
|
|
75
|
|
76 (canna-touroku-string string)
|
|
77 string:
|
|
78 String to register to a dictionary.
|
|
79 RETURNS:
|
|
80 The same thing returns as canna-key-proc does.
|
|
81 DESCRIPTION:
|
|
82 Register Kanji words into kana-to-kanji
|
|
83 conversion dictionary.
|
|
84
|
|
85 (canna-set-width width)
|
|
86 width:
|
|
87 Column width of the place where the candidates
|
|
88 of kana-to-kanji conversion will be shown.
|
|
89 RETURNS:
|
|
90 nil
|
|
91 DESCRIPTION:
|
|
92 Set status-line width information, which is
|
|
93 used to display kanji candidates.
|
|
94
|
|
95 (canna-change-mode num)
|
|
96 num:
|
|
97 The mode number of Canna.
|
|
98 RETURNS:
|
|
99 The same thing returns as canna-key-proc does.
|
|
100 DESCRIPTION:
|
|
101 Change Japanese pre-edit mode.
|
|
102
|
|
103 (canna-store-yomi yomi roma)
|
|
104 yomi:
|
|
105 ``Yomi'' to be stored.
|
|
106 roma:
|
|
107 ``Romaji'' which corresponds to the ``Yomi''.
|
|
108 RETURNS:
|
|
109 The same thing returns as canna-key-proc does.
|
|
110 DESCRIPTION:
|
|
111 Store yomi characters as a YOMI of
|
|
112 kana-to-kanji conversion.
|
|
113
|
|
114 (canna-do-function num ch)
|
|
115 num:
|
|
116 A function number to be called.
|
|
117 ch:
|
|
118 A character will be specified in order to feed
|
|
119 the character to the function if the function
|
|
120 needs a input character.
|
|
121 RETURNS:
|
|
122 The same thing returns as canna-key-proc does.
|
|
123 DESCRIPTION:
|
|
124 Do specified function at current mode.
|
|
125
|
|
126 (canna-parse string)
|
|
127 string:
|
|
128 To be parsed.
|
|
129 RETURNS:
|
|
130 List of warning messages.
|
|
131 DESCRIPTION:
|
|
132 Parse customize string.
|
|
133
|
|
134 (canna-query-mode)
|
|
135 RETURNS:
|
|
136 A string which indicate the current mode.
|
|
137 DESCRIPTION:
|
|
138 Get current mode string.
|
|
139
|
|
140 Functions below are used for KKCP compatible library. These
|
|
141 functions provides a base kana-to-kanji conversion system for EGG.
|
|
142 These functions may be used when users want to change the engine
|
|
143 from Wnn to Canna without changing user interface of Japanese input.
|
|
144
|
|
145 (canna-henkan-begin)
|
|
146 (canna-henkan-next)
|
|
147 (canna-bunsetu-henkou)
|
|
148 (canna-henkan-kakutei)
|
|
149 (canna-henkan-end)
|
|
150 (canna-henkan-quit)
|
|
151
|
|
152 */
|
|
153
|
|
154 #include <config.h>
|
|
155 #include "lisp.h"
|
|
156
|
|
157 #include "buffer.h"
|
|
158 #include "file-coding.h"
|
|
159
|
|
160 #ifdef CANNA2
|
|
161 #define IROHA_BC
|
|
162 #include "canna/jrkanji.h"
|
|
163 #include "canna/RK.h"
|
|
164 #else /* !CANNA2 */
|
|
165 #include "iroha/jrkanji.h"
|
|
166 #include "iroha/RK.h"
|
|
167 #endif /* !CANNA2 */
|
|
168 extern char *jrKanjiError;
|
|
169
|
448
|
170 /* #### is this global really necessary? */
|
428
|
171 #define KEYTOSTRSIZE 2048
|
448
|
172 static unsigned char key_buffer[KEYTOSTRSIZE];
|
428
|
173 static char **warning;
|
|
174
|
|
175 static int canna_empty_info, canna_through_info;
|
|
176 static int canna_underline;
|
|
177 static int canna_inhibit_hankakukana;
|
|
178
|
|
179 static Lisp_Object Vcanna_kakutei_string;
|
|
180 static Lisp_Object Vcanna_kakutei_yomi;
|
|
181 static Lisp_Object Vcanna_kakutei_romaji;
|
|
182 static Lisp_Object Vcanna_henkan_string;
|
458
|
183 static Fixnum canna_henkan_length;
|
|
184 static Fixnum canna_henkan_revPos;
|
|
185 static Fixnum canna_henkan_revLen;
|
428
|
186 static Lisp_Object Vcanna_ichiran_string;
|
458
|
187 static Fixnum canna_ichiran_length;
|
|
188 static Fixnum canna_ichiran_revPos;
|
|
189 static Fixnum canna_ichiran_revLen;
|
428
|
190 static Lisp_Object Vcanna_mode_string;
|
|
191
|
|
192 static int IRCP_context;
|
|
193
|
|
194 static Lisp_Object storeResults (unsigned char *, int, jrKanjiStatus *);
|
|
195 static Lisp_Object kanjiYomiList (int, int);
|
442
|
196 static Lisp_Object CANNA_mode_keys (void);
|
428
|
197
|
|
198 #ifdef CANNA_MULE
|
|
199 static void m2c (unsigned char *, int, unsigned char *);
|
|
200 static Lisp_Object mule_make_string (unsigned char *, int);
|
|
201 static int mule_strlen (unsigned char *, int);
|
458
|
202 static void count_char (unsigned char *,int, int, int, Fixnum *, Fixnum *, Fixnum *);
|
428
|
203 #define make_string mule_make_string
|
|
204 #endif
|
|
205
|
|
206 /* Lisp functions definition */
|
|
207
|
|
208 DEFUN ("canna-key-proc", Fcanna_key_proc, 1, 1, 0, /*
|
|
209 Translate a key input to a set of strings. The strings contain both
|
|
210 well-formed string and intermediate result to show the translation
|
|
211 information to a user. Converted strings are stored in specific
|
|
212 variables.
|
|
213 */
|
|
214 (ch))
|
|
215 {
|
|
216 jrKanjiStatus ks;
|
|
217 int len;
|
|
218
|
|
219 CHECK_CHAR_COERCE_INT (ch);
|
448
|
220 len = jrKanjiString (0, XCHAR (ch), key_buffer, KEYTOSTRSIZE, &ks);
|
|
221 return storeResults (key_buffer, len, &ks);
|
428
|
222 }
|
|
223
|
|
224 static Lisp_Object
|
|
225 storeResults (unsigned char *buf, int len, jrKanjiStatus *ks)
|
|
226 {
|
|
227 Lisp_Object val = Qnil;
|
|
228
|
|
229 if (len < 0)
|
|
230 { /* Error detected */
|
|
231 val = make_string ((unsigned char*) jrKanjiError, strlen (jrKanjiError));
|
|
232 }
|
|
233 else
|
|
234 {
|
448
|
235 /* ³ÎÄꤷ¤¿Ê¸»úÎó (the confirmed string) */
|
428
|
236 Vcanna_kakutei_string = make_string (buf, len);
|
|
237 val = make_int (len);
|
448
|
238 /* ³ÎÄꤷ¤¿Ê¸»úÎó¤ÎÆɤߤξðÊó...
|
|
239 (info about the reading of the confirmed string) */
|
428
|
240 Vcanna_kakutei_yomi = Vcanna_kakutei_romaji = Qnil;
|
|
241 if (ks->info & KanjiYomiInfo)
|
|
242 {
|
|
243 unsigned char *p = buf + len + 1;
|
|
244 int yomilen = strlen (p);
|
|
245
|
|
246 if (len + yomilen + 1 < KEYTOSTRSIZE)
|
|
247 {
|
|
248 int yomilen2;
|
|
249
|
448
|
250 Vcanna_kakutei_yomi = make_string (p, yomilen); /* Æɤß
|
|
251 (reading) */
|
428
|
252 p += yomilen + 1;
|
|
253 yomilen2 = strlen (p);
|
|
254 if (len + yomilen + yomilen2 + 2 < KEYTOSTRSIZE)
|
|
255 {
|
448
|
256 Vcanna_kakutei_romaji = make_string (p, yomilen2);
|
|
257 /* ¥í¡¼¥Þ»ú (romanization) */
|
428
|
258 }
|
|
259 }
|
|
260 }
|
|
261
|
|
262
|
448
|
263 /* ¸õÊäɽ¼¨¤Îʸ»úÎó¤Ç¤¹¡£
|
|
264 (string for displaying candidate translations) */
|
428
|
265 Vcanna_henkan_string = Qnil;
|
|
266 if (ks->length >= 0)
|
|
267 {
|
|
268 Vcanna_henkan_string = make_string (ks->echoStr, ks->length);
|
|
269 #ifndef CANNA_MULE
|
|
270 canna_henkan_length = ks->length;
|
|
271 canna_henkan_revPos = ks->revPos;
|
|
272 canna_henkan_revLen = ks->revLen;
|
|
273 #else /* CANNA_MULE */
|
|
274 if (canna_underline)
|
|
275 {
|
|
276 canna_henkan_length = mule_strlen (ks->echoStr,ks->length);
|
|
277 canna_henkan_revPos = mule_strlen (ks->echoStr,ks->revPos);
|
448
|
278 canna_henkan_revLen = mule_strlen (ks->echoStr+ks->revPos,
|
|
279 ks->revLen);
|
428
|
280 }
|
|
281 else
|
|
282 {
|
|
283 count_char (ks->echoStr, ks->length, ks->revPos, ks->revLen,
|
|
284 &canna_henkan_length, &canna_henkan_revPos,
|
|
285 &canna_henkan_revLen);
|
|
286 }
|
|
287 #endif /* CANNA_MULE */
|
|
288 }
|
|
289
|
448
|
290 /* °ìÍ÷¤Î¾ðÊó (information about the echo area menu) */
|
428
|
291 Vcanna_ichiran_string = Qnil;
|
|
292 if (ks->info & KanjiGLineInfo && ks->gline.length >= 0)
|
|
293 {
|
448
|
294 Vcanna_ichiran_string = make_string (ks->gline.line,
|
|
295 ks->gline.length);
|
428
|
296 #ifndef CANNA_MULE
|
|
297 canna_ichiran_length = ks->gline.length;
|
|
298 canna_ichiran_revPos = ks->gline.revPos;
|
|
299 canna_ichiran_revLen = ks->gline.revLen;
|
|
300 #else /* CANNA_MULE */
|
|
301 count_char (ks->gline.line, ks->gline.length,
|
448
|
302 ks->gline.revPos, ks->gline.revLen,
|
|
303 &canna_ichiran_length,
|
428
|
304 &canna_ichiran_revPos, &canna_ichiran_revLen);
|
|
305 #endif /* CANNA_MULE */
|
|
306 }
|
|
307
|
448
|
308 /* ¥â¡¼¥É¤Î¾ðÊó (mode information) */
|
428
|
309 Vcanna_mode_string = Qnil;
|
|
310 if (ks->info & KanjiModeInfo)
|
|
311 {
|
|
312 Vcanna_mode_string = make_string (ks->mode, strlen (ks->mode));
|
|
313 }
|
|
314
|
448
|
315 /* ¤½¤Î¾¤Î¾ðÊó (other information) */
|
428
|
316 canna_empty_info = (ks->info & KanjiEmptyInfo) ? 1 : 0;
|
|
317 canna_through_info = (ks->info & KanjiThroughInfo) ? 1 : 0;
|
|
318 }
|
|
319
|
|
320 return val;
|
|
321 }
|
|
322
|
|
323 DEFUN ("canna-set-bunsetsu-kugiri", Fcanna_set_bunsetsu, 0, 1, 0, /*
|
|
324 This function sets the clause separator.
|
|
325 If non-nil value is specified, the white space separator will be used.
|
|
326 No separator will be used otherwise.
|
|
327 */
|
|
328 (num))
|
|
329 {
|
448
|
330 int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© (display clause separator?) */
|
428
|
331
|
|
332 kugiri = NILP (num) ? 0 : 1;
|
|
333
|
|
334 jrKanjiControl (0, KC_SETBUNSETSUKUGIRI, (char *) kugiri);
|
|
335
|
|
336 return Qnil;
|
|
337 }
|
|
338
|
|
339 /* For whatever reason, calling Fding directly from libCanna loses */
|
442
|
340 static void
|
|
341 call_Fding (void)
|
428
|
342 {
|
|
343 Fding (Qnil, Qnil, Qnil);
|
|
344 }
|
|
345
|
|
346 DEFUN ("canna-initialize", Fcanna_initialize, 0, 3, 0, /*
|
613
|
347 Initialize ``canna'', which is a kana-to-kanji converter for XEmacs.
|
428
|
348 The first arg specifies if inserting space character between BUNSETSU when
|
|
349 candidates are displayed.
|
|
350 The second arg specifies server.
|
|
351 The third arg specifies a file which will be used as a customization
|
|
352 description.
|
|
353 If nil is specified for each arg, the default value will be used.
|
|
354 */
|
|
355 (num, server, rcfile))
|
|
356 {
|
|
357 Lisp_Object val;
|
|
358 int res;
|
|
359 unsigned char **p, **q;
|
|
360
|
448
|
361 int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© (display clause separator?) */
|
428
|
362
|
|
363 IRCP_context = -1;
|
|
364
|
|
365 if (NILP (num))
|
|
366 {
|
|
367 kugiri = 1;
|
|
368 }
|
|
369 else
|
|
370 {
|
|
371 CHECK_INT (num);
|
|
372 kugiri = XINT (num);
|
|
373 kugiri = (kugiri == 1) ? 1 : 0;
|
|
374 }
|
|
375
|
|
376 if (NILP (server))
|
|
377 {
|
|
378 jrKanjiControl (0, KC_SETSERVERNAME, (char *) 0);
|
|
379 }
|
|
380 else
|
|
381 {
|
|
382 char servername[256];
|
|
383
|
|
384 CHECK_STRING (server);
|
|
385 strncpy (servername, XSTRING_DATA (server), XSTRING_LENGTH (server));
|
|
386 servername[XSTRING_LENGTH (server)] = '\0';
|
|
387 jrKanjiControl (0, KC_SETSERVERNAME, servername);
|
|
388 }
|
|
389
|
|
390 if (NILP (rcfile))
|
|
391 {
|
|
392 jrKanjiControl (0, KC_SETINITFILENAME, (char *) 0);
|
|
393 }
|
|
394 else
|
|
395 {
|
|
396 char rcname[256];
|
|
397
|
|
398 CHECK_STRING (rcfile);
|
|
399 strncpy (rcname, XSTRING_DATA (rcfile), XSTRING_LENGTH (rcfile));
|
|
400 rcname[XSTRING_LENGTH (rcfile)] = '\0';
|
|
401 jrKanjiControl (0, KC_SETINITFILENAME, rcname);
|
|
402 }
|
|
403
|
|
404 warning = (char **) 0;
|
|
405 #ifdef nec_ews_svr4
|
|
406 stop_polling ();
|
|
407 #endif /* nec_ews_svr4 */
|
|
408 res = jrKanjiControl (0, KC_INITIALIZE, (char *)&warning);
|
|
409 #ifdef nec_ews_svr4
|
|
410 start_polling ();
|
|
411 #endif /* nec_ews_svr4 */
|
|
412 val = Qnil;
|
|
413 if (warning)
|
|
414 {
|
|
415 for (p = q = (unsigned char **) warning ; *q ; q++)
|
|
416 ;
|
|
417 while (p < q)
|
|
418 {
|
|
419 q--;
|
|
420 val = Fcons (make_string (*q, strlen (*q)), val);
|
|
421 }
|
|
422 }
|
|
423 val = Fcons (val, Qnil);
|
|
424
|
|
425 if (res == -1)
|
|
426 {
|
|
427 val = Fcons (make_string ((unsigned char*) jrKanjiError,
|
|
428 strlen (jrKanjiError)), val);
|
448
|
429 /* ¥¤¥Ë¥·¥ã¥é¥¤¥º¤Ç¼ºÇÔ¤·¤¿¾ì¹ç¡£ (on initialization failure) */
|
428
|
430 return Fcons (Qnil, val);
|
|
431 }
|
|
432 else
|
|
433 {
|
442
|
434 extern void (*jrBeepFunc) (void);
|
428
|
435
|
|
436 jrBeepFunc = call_Fding;
|
|
437
|
|
438 #ifdef KC_SETAPPNAME
|
|
439 #ifndef CANNA_MULE
|
|
440 wcKanjiControl (0, KC_SETAPPNAME, "nemacs");
|
|
441 #else /* CANNA_MULE */
|
|
442 wcKanjiControl (0, KC_SETAPPNAME, "mule");
|
|
443 #endif /* CANNA_MULE */
|
|
444 #endif /* KC_SETAPPNAME */
|
|
445
|
|
446 jrKanjiControl (0, KC_SETBUNSETSUKUGIRI, (char *) kugiri);
|
|
447 jrKanjiControl (0, KC_SETWIDTH, (char *) 78);
|
|
448 #ifndef CANNA_MULE
|
|
449 jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1);
|
|
450 #else
|
448
|
451 /* mule ¤À¤Ã¤¿¤éȾ³Ñ¥«¥¿¥«¥Ê¤â»È¤¨¤ë
|
|
452 (Mule can use half-width katakana) */
|
428
|
453 if (canna_inhibit_hankakukana)
|
|
454 jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1);
|
|
455 #endif
|
448
|
456 jrKanjiControl (0, KC_YOMIINFO, (char *) 2); /* ¢¨£²: ¥í¡¼¥Þ»ú¤Þ¤ÇÊÖ¤¹
|
|
457 (*2: return to
|
|
458 romanized form) */
|
428
|
459 val = Fcons (Qnil, val);
|
|
460 return Fcons (CANNA_mode_keys (), val);
|
|
461 }
|
|
462 }
|
|
463
|
|
464 DEFUN ("canna-finalize", Fcanna_finalize, 0, 0, 0, /*
|
613
|
465 finalize ``canna'', which is a kana-to-kanji converter for XEmacs.
|
428
|
466 This cause to write miscellaneous informations to kana-to-kanji dictionary.
|
|
467 */
|
|
468 ())
|
|
469 {
|
|
470 Lisp_Object val;
|
|
471 unsigned char **p;
|
|
472
|
|
473 jrKanjiControl (0, KC_FINALIZE, (char *)&warning);
|
|
474
|
|
475 val = Qnil;
|
|
476 if (warning)
|
|
477 {
|
|
478 for (p = (unsigned char**) warning ; *p ; p++)
|
|
479 {
|
|
480 val = Fcons (make_string (*p, strlen (*p)), val);
|
|
481 }
|
|
482 }
|
|
483 val = Fcons (val, Qnil);
|
|
484 IRCP_context = -1;
|
|
485 return val;
|
|
486 }
|
|
487
|
|
488 DEFUN ("canna-touroku-string", Fcanna_touroku_string, 1, 1, 0, /*
|
|
489 Register Kanji words into kana-to-kanji conversion dictionary.
|
|
490 */
|
|
491 (str))
|
|
492 {
|
|
493 jrKanjiStatusWithValue ksv;
|
|
494 jrKanjiStatus ks;
|
|
495 int len;
|
|
496 Lisp_Object val;
|
|
497 #ifdef CANNA_MULE
|
|
498 unsigned char cbuf[4096];
|
|
499 #endif
|
|
500
|
|
501 CHECK_STRING (str);
|
448
|
502 ksv.buffer = (unsigned char *) key_buffer;
|
428
|
503 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
504 #ifndef CANNA_MULE
|
|
505 ks.echoStr = XSTRING_DATA (str);
|
|
506 ks.length = XSTRING_LENGTH (str);
|
|
507 #else /* CANNA_MULE */
|
|
508 m2c (XSTRING_DATA (str), XSTRING_LENGTH (str), cbuf);
|
|
509 ks.echoStr = cbuf;
|
|
510 ks.length = strlen (cbuf);
|
|
511 #endif /* CANNA_MULE */
|
|
512 ksv.ks = &ks;
|
|
513 len = jrKanjiControl (0, KC_DEFINEKANJI, (char *)&ksv);
|
793
|
514 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
515 }
|
|
516
|
|
517 DEFUN ("canna-set-width", Fcanna_set_width, 1, 1, 0, /*
|
|
518 Set status-line width information, which is used to display
|
|
519 kanji candidates.
|
|
520 */
|
|
521 (num))
|
|
522 {
|
|
523 CHECK_INT (num);
|
|
524
|
|
525 jrKanjiControl (0, KC_SETWIDTH, (char *) XINT (num));
|
|
526 return Qnil;
|
|
527 }
|
|
528
|
|
529 DEFUN ("canna-change-mode", Fcanna_change_mode, 1, 1, 0, /*
|
|
530 Change Japanese pre-edit mode.
|
|
531 */
|
|
532 (num))
|
|
533 {
|
|
534 jrKanjiStatusWithValue ksv;
|
|
535 jrKanjiStatus ks;
|
|
536 Lisp_Object val;
|
|
537
|
|
538 CHECK_INT (num);
|
|
539
|
448
|
540 ksv.buffer = (unsigned char *) key_buffer;
|
428
|
541 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
542 ksv.ks = &ks;
|
|
543 ksv.val = XINT (num);
|
|
544 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv);
|
793
|
545 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
546 }
|
|
547
|
442
|
548 static Lisp_Object
|
428
|
549 CANNA_mode_keys (void)
|
|
550 {
|
|
551 #define CANNAWORKBUFSIZE 32
|
|
552 char xxx[CANNAWORKBUFSIZE];
|
|
553 Lisp_Object val;
|
|
554 int i, n;
|
|
555
|
|
556 n = jrKanjiControl (0, KC_MODEKEYS, xxx);
|
|
557 val = Qnil;
|
|
558 for (i = n ; i > 0 ;)
|
|
559 {
|
|
560 --i;
|
|
561 /* !!#### something fucked here */
|
|
562 val = Fcons (make_char ((int)(0xFF & (unsigned char) xxx[i])), val);
|
|
563 }
|
|
564 return val;
|
|
565 }
|
|
566
|
|
567 DEFUN ("canna-store-yomi", Fcanna_store_yomi, 1, 2, 0, /*
|
|
568 Store yomi characters as a YOMI of kana-to-kanji conversion.
|
|
569 */
|
|
570 (yomi, roma))
|
|
571 {
|
|
572 jrKanjiStatusWithValue ksv;
|
|
573 jrKanjiStatus ks;
|
|
574
|
|
575 CHECK_STRING (yomi);
|
|
576 #ifndef CANNA_MULE
|
448
|
577 strncpy (key_buffer, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi));
|
428
|
578 ks.length = XSTRING_LENGTH (yomi);
|
448
|
579 key_buffer[ks.length] = '\0';
|
428
|
580 #else /* CANNA_MULE */
|
448
|
581 m2c (XSTRING_DATA (yomi), XSTRING_LENGTH (yomi), key_buffer);
|
|
582 ks.length = strlen (key_buffer);
|
428
|
583 #endif /* CANNA_MULE */
|
|
584
|
|
585 if (NILP (roma))
|
|
586 {
|
|
587 ks.mode = 0;
|
|
588 }
|
|
589 else
|
|
590 {
|
|
591 CHECK_STRING (roma);
|
|
592
|
|
593 #ifndef CANNA_MULE
|
448
|
594 strncpy (key_buffer + XSTRING_LENGTH (yomi) + 1, XSTRING_DATA (roma),
|
428
|
595 XSTRING_LENGTH (roma));
|
448
|
596 key_buffer[XSTRING_LENGTH (yomi) + 1 + XSTRING_LENGTH (roma)] = '\0';
|
|
597 ks.mode = (unsigned char *)(key_buffer + XSTRING_LENGTH (yomi) + 1);
|
428
|
598 #else /* CANNA_MULE */
|
448
|
599 ks.mode = (unsigned char *)(key_buffer + ks.length + 1);
|
428
|
600 m2c (XSTRING_DATA (roma), XSTRING_LENGTH (roma), ks.mode);
|
|
601 #endif /* CANNA_MULE */
|
|
602 }
|
|
603
|
448
|
604 ks.echoStr = (unsigned char *) key_buffer;
|
|
605 ksv.buffer = (unsigned char *) key_buffer; /* ÊÖÃÍÍÑ (return value) */
|
428
|
606 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
607 ksv.ks = &ks;
|
|
608
|
|
609 jrKanjiControl (0, KC_STOREYOMI, (char *)&ksv);
|
|
610
|
448
|
611 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
612 }
|
|
613
|
|
614 DEFUN ("canna-do-function", Fcanna_do_function, 1, 2, 0, /*
|
|
615 Do specified function at current mode.
|
|
616 */
|
|
617 (num, ch))
|
|
618 {
|
|
619 jrKanjiStatusWithValue ksv;
|
|
620 jrKanjiStatus ks;
|
|
621 Lisp_Object val;
|
|
622
|
|
623 CHECK_INT (num);
|
|
624
|
|
625 if (NILP (ch))
|
|
626 {
|
448
|
627 *key_buffer = '@';
|
428
|
628 }
|
|
629 else
|
|
630 {
|
|
631 CHECK_CHAR (ch);
|
448
|
632 *key_buffer = XCHAR (ch);
|
428
|
633 }
|
|
634
|
448
|
635 ksv.buffer = (unsigned char *) key_buffer;
|
428
|
636 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
637 ksv.ks = &ks;
|
|
638 ksv.val = XINT (num);
|
|
639 jrKanjiControl (0, KC_DO, (char *) &ksv);
|
793
|
640 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
641 }
|
|
642
|
|
643 DEFUN ("canna-parse", Fcanna_parse, 1, 1, 0, /*
|
|
644 Parse customize string.
|
|
645 */
|
|
646 (str))
|
|
647 {
|
|
648 Lisp_Object val;
|
|
649 unsigned char **p;
|
|
650 int n;
|
|
651
|
|
652 CHECK_STRING (str);
|
|
653
|
|
654 #ifndef CANNA_MULE
|
448
|
655 strncpy (key_buffer, XSTRING_DATA (str), XSTRING_LENGTH (str));
|
|
656 key_buffer[XSTRING_LENGTH (str)] = '\0';
|
428
|
657 #else /* CANNA_MULE */
|
448
|
658 m2c (XSTRING_DATA (str), XSTRING_LENGTH (str), key_buffer);
|
428
|
659 #endif /* CANNA_MULE */
|
448
|
660 p = (unsigned char**) key_buffer;
|
428
|
661 n = jrKanjiControl (0, KC_PARSE, (char *) &p);
|
|
662 val = Qnil;
|
|
663 while (n > 0)
|
|
664 {
|
|
665 n--;
|
|
666 val = Fcons (make_string (p[n], strlen (p[n])), val);
|
|
667 }
|
|
668 return val;
|
|
669 }
|
|
670
|
|
671 DEFUN ("canna-query-mode", Fcanna_query_mode, 0, 0, 0, /*
|
|
672 Get current mode string.
|
|
673 */
|
|
674 ())
|
|
675 {
|
|
676 unsigned char buf[256];
|
|
677
|
|
678 jrKanjiControl (0, KC_QUERYMODE, buf);
|
|
679 return make_string (buf, strlen (buf));
|
|
680 }
|
|
681
|
|
682 /*
|
|
683 * Functions following this line are for KKCP interface compatible
|
|
684 * library. These functions may be used by MILK system.
|
|
685 */
|
|
686
|
|
687 #define RKBUFSIZE 1024
|
|
688
|
|
689 static unsigned char yomibuf[RKBUFSIZE];
|
|
690 static short kugiri[RKBUFSIZE / 2];
|
|
691
|
|
692 static int
|
|
693 confirmContext (void)
|
|
694 {
|
|
695 if (IRCP_context < 0)
|
|
696 {
|
|
697 int context;
|
|
698
|
|
699 if ((context = jrKanjiControl (0, KC_GETCONTEXT, (char *) 0)) == -1)
|
|
700 {
|
|
701 return 0;
|
|
702 }
|
|
703 IRCP_context = context;
|
|
704 }
|
|
705 return 1;
|
|
706 }
|
|
707
|
|
708 static int
|
|
709 byteLen (int bun, int len)
|
|
710 {
|
|
711 int i = 0, offset = 0, ch;
|
|
712
|
|
713 if (0 <= bun && bun < RKBUFSIZE)
|
|
714 {
|
|
715 offset = kugiri[bun];
|
|
716 }
|
|
717
|
|
718 while (len-- > 0 && (ch = (int) yomibuf[offset + i]))
|
|
719 {
|
|
720 i++;
|
|
721 if (ch & 0x80)
|
|
722 {
|
|
723 i++;
|
|
724 }
|
|
725 }
|
|
726 return i;
|
|
727 }
|
|
728
|
|
729 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /*
|
442
|
730 Return the result of kana-to-kanji conversion.
|
|
731 Clause separator is set.
|
428
|
732 */
|
|
733 (yomi))
|
|
734 {
|
|
735 int nbun;
|
|
736
|
|
737 CHECK_STRING (yomi);
|
|
738 if (confirmContext () == 0)
|
|
739 {
|
|
740 return Qnil;
|
|
741 }
|
|
742 #ifndef CANNA_MULE
|
|
743 strncpy (yomibuf, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi));
|
|
744 yomibuf[XSTRING_LENGTH (yomi)] = '\0';
|
|
745 nbun = RkBgnBun (IRCP_context, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi),
|
|
746 (RK_XFER << RK_XFERBITS) | RK_KFER);
|
|
747 #else /* CANNA_MULE */
|
|
748 m2c (XSTRING_DATA (yomi), XSTRING_LENGTH (yomi), yomibuf);
|
|
749 nbun = RkBgnBun (IRCP_context, (char *) yomibuf, strlen (yomibuf),
|
|
750 (RK_XFER << RK_XFERBITS) | RK_KFER);
|
|
751 #endif /* CANNA_MULE */
|
|
752
|
|
753 return kanjiYomiList (IRCP_context, nbun);
|
|
754 }
|
|
755
|
|
756 static Lisp_Object
|
|
757 kanjiYomiList (int context, int nbun)
|
|
758 {
|
|
759 Lisp_Object val, res = Qnil;
|
|
760 unsigned char RkBuf[RKBUFSIZE];
|
|
761 int len, i, total;
|
|
762
|
|
763 for (i = nbun ; i > 0 ; )
|
|
764 {
|
|
765 i--;
|
|
766 RkGoTo (context, i);
|
|
767 len = RkGetKanji (context, RkBuf, RKBUFSIZE);
|
|
768 val = make_string (RkBuf, len);
|
|
769 len = RkGetYomi (context, RkBuf, RKBUFSIZE);
|
|
770 res = Fcons (Fcons (val, make_string (RkBuf, len)), res);
|
|
771 if (i < RKBUFSIZE / 2)
|
|
772 {
|
|
773 kugiri[i] = len;
|
|
774 }
|
|
775 }
|
|
776 for (i = 0, total = 0 ; i < nbun ; i++)
|
|
777 {
|
|
778 int temp = kugiri[i];
|
|
779 kugiri[i] = total;
|
|
780 total += temp;
|
|
781 }
|
|
782 return res;
|
|
783 }
|
|
784
|
|
785 DEFUN ("canna-henkan-next", Fcanna_henkan_next, 1, 1, 0, /*
|
442
|
786 Return the list of candidates.
|
428
|
787 */
|
|
788 (bunsetsu))
|
|
789 {
|
|
790 int i, slen, len;
|
|
791 unsigned char *p, RkBuf[RKBUFSIZE];
|
|
792 Lisp_Object res = Qnil, endp;
|
|
793
|
|
794 CHECK_INT (bunsetsu);
|
|
795 if (confirmContext () == 0)
|
|
796 {
|
|
797 return Qnil;
|
|
798 }
|
|
799 RkGoTo (IRCP_context, XINT (bunsetsu));
|
|
800 len = RkGetKanjiList (IRCP_context, RkBuf, RKBUFSIZE);
|
|
801 p = RkBuf;
|
|
802 for (i = 0 ; i < len ; i++)
|
|
803 {
|
|
804 slen = strlen (p);
|
|
805 if (NILP(res))
|
|
806 {
|
|
807 endp = res = Fcons (make_string (p, slen), Qnil);
|
|
808 }
|
|
809 else
|
|
810 {
|
442
|
811 endp = XCDR (res) = Fcons (make_string (p, slen), Qnil);
|
428
|
812 }
|
|
813 p += slen + 1;
|
|
814 }
|
|
815 return res;
|
|
816 }
|
|
817
|
|
818 DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, 2, 2, 0, /*
|
442
|
819 Specify the length of a clause.
|
428
|
820 */
|
|
821 (bunsetsu, bunlen))
|
|
822 {
|
|
823 int nbun, len;
|
|
824
|
|
825 CHECK_INT (bunsetsu);
|
|
826 CHECK_INT (bunlen);
|
|
827
|
|
828 nbun = XINT (bunsetsu);
|
|
829 if (confirmContext () == 0)
|
|
830 {
|
|
831 return Qnil;
|
|
832 }
|
|
833 RkGoTo (IRCP_context, nbun);
|
|
834 len = byteLen (nbun, XINT (bunlen));
|
|
835 return kanjiYomiList (IRCP_context, RkResize (IRCP_context, len));
|
|
836 }
|
|
837
|
|
838 DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, 2, 2, 0, /*
|
442
|
839 Select a candidate.
|
428
|
840 */
|
|
841 (bun, kouho))
|
|
842 {
|
|
843 int nbun, nkouho;
|
|
844
|
|
845 if (confirmContext () == 0)
|
|
846 {
|
|
847 return Qnil;
|
|
848 }
|
|
849 nbun = XINT(bun);
|
|
850 RkGoTo (IRCP_context, nbun);
|
|
851
|
|
852 nkouho = XINT(kouho);
|
|
853 RkXfer (IRCP_context, nkouho);
|
|
854 return Qt;
|
|
855 }
|
|
856
|
|
857 DEFUN ("canna-henkan-end", Fcanna_henkan_end, 0, 0, 0, /*
|
442
|
858 End conversion.
|
428
|
859 */
|
|
860 ())
|
|
861 {
|
|
862 if (confirmContext () == 0)
|
|
863 {
|
|
864 return Qnil;
|
|
865 }
|
448
|
866 RkEndBun (IRCP_context, 1); /* ³Ø½¬¤Ï¤¤¤Ä¤Ç¤â¹Ô¤Ã¤ÆÎɤ¤¤â¤Î¤Ê¤Î¤«¡©
|
|
867 (is it OK to invoke learning function
|
|
868 at arbitrary times?) */
|
428
|
869 return Qt;
|
|
870 }
|
|
871
|
|
872 DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, 0, 0, 0, /*
|
442
|
873 Quit conversion.
|
428
|
874 */
|
|
875 ())
|
|
876 {
|
|
877 if (confirmContext () == 0)
|
|
878 {
|
|
879 return Qnil;
|
|
880 }
|
|
881 RkEndBun (IRCP_context, 0);
|
|
882 return Qt;
|
|
883 }
|
|
884
|
|
885 /* variables below this line is constants of Canna */
|
|
886
|
458
|
887 static Fixnum canna_mode_AlphaMode;
|
|
888 static Fixnum canna_mode_EmptyMode;
|
|
889 static Fixnum canna_mode_KigoMode;
|
|
890 static Fixnum canna_mode_YomiMode;
|
|
891 static Fixnum canna_mode_JishuMode;
|
|
892 static Fixnum canna_mode_TankouhoMode;
|
|
893 static Fixnum canna_mode_IchiranMode;
|
|
894 static Fixnum canna_mode_YesNoMode;
|
|
895 static Fixnum canna_mode_OnOffMode;
|
428
|
896 #ifdef CANNA_MODE_AdjustBunsetsuMode
|
458
|
897 static Fixnum canna_mode_AdjustBunsetsuMode;
|
428
|
898 #endif
|
|
899 #ifdef CANNA_MODE_ChikujiYomiMode
|
458
|
900 static Fixnum canna_mode_ChikujiYomiMode;
|
|
901 static Fixnum canna_mode_ChikujiTanMode;
|
428
|
902 #endif
|
|
903
|
458
|
904 static Fixnum canna_mode_HenkanMode;
|
428
|
905 #ifdef CANNA_MODE_HenkanNyuryokuMode
|
458
|
906 static Fixnum canna_mode_HenkanNyuryokuMode;
|
428
|
907 #endif
|
|
908 #ifdef CANNA_MODE_ZenHiraHenkanMode
|
458
|
909 static Fixnum canna_mode_ZenHiraHenkanMode;
|
428
|
910 #ifdef CANNA_MODE_HanHiraHenkanMode
|
458
|
911 static Fixnum canna_mode_HanHiraHenkanMode;
|
428
|
912 #endif
|
458
|
913 static Fixnum canna_mode_ZenKataHenkanMode;
|
|
914 static Fixnum canna_mode_HanKataHenkanMode;
|
|
915 static Fixnum canna_mode_ZenAlphaHenkanMode;
|
|
916 static Fixnum canna_mode_HanAlphaHenkanMode;
|
428
|
917 #endif
|
458
|
918 static Fixnum canna_mode_ZenHiraKakuteiMode;
|
428
|
919 #ifdef CANNA_MODE_HanHiraKakuteiMode
|
458
|
920 static Fixnum canna_mode_HanHiraKakuteiMode;
|
428
|
921 #endif
|
458
|
922 static Fixnum canna_mode_ZenKataKakuteiMode;
|
|
923 static Fixnum canna_mode_HanKataKakuteiMode;
|
|
924 static Fixnum canna_mode_ZenAlphaKakuteiMode;
|
|
925 static Fixnum canna_mode_HanAlphaKakuteiMode;
|
|
926 static Fixnum canna_mode_HexMode;
|
|
927 static Fixnum canna_mode_BushuMode;
|
|
928 static Fixnum canna_mode_ExtendMode;
|
|
929 static Fixnum canna_mode_RussianMode;
|
|
930 static Fixnum canna_mode_GreekMode;
|
|
931 static Fixnum canna_mode_LineMode;
|
|
932 static Fixnum canna_mode_ChangingServerMode;
|
|
933 static Fixnum canna_mode_HenkanMethodMode;
|
|
934 static Fixnum canna_mode_DeleteDicMode;
|
|
935 static Fixnum canna_mode_TourokuMode;
|
|
936 static Fixnum canna_mode_TourokuEmptyMode;
|
|
937 static Fixnum canna_mode_TourokuHinshiMode;
|
|
938 static Fixnum canna_mode_TourokuDicMode;
|
|
939 static Fixnum canna_mode_QuotedInsertMode;
|
|
940 static Fixnum canna_mode_BubunMuhenkanMode;
|
|
941 static Fixnum canna_mode_MountDicMode;
|
428
|
942
|
458
|
943 static Fixnum canna_fn_SelfInsert;
|
|
944 static Fixnum canna_fn_FunctionalInsert;
|
|
945 static Fixnum canna_fn_QuotedInsert;
|
|
946 static Fixnum canna_fn_JapaneseMode;
|
|
947 static Fixnum canna_fn_AlphaMode;
|
|
948 static Fixnum canna_fn_HenkanNyuryokuMode;
|
|
949 static Fixnum canna_fn_Forward;
|
|
950 static Fixnum canna_fn_Backward;
|
|
951 static Fixnum canna_fn_Next;
|
|
952 static Fixnum canna_fn_Prev;
|
|
953 static Fixnum canna_fn_BeginningOfLine;
|
|
954 static Fixnum canna_fn_EndOfLine;
|
|
955 static Fixnum canna_fn_DeleteNext;
|
|
956 static Fixnum canna_fn_DeletePrevious;
|
|
957 static Fixnum canna_fn_KillToEndOfLine;
|
|
958 static Fixnum canna_fn_Henkan;
|
|
959 static Fixnum canna_fn_Kakutei;
|
|
960 static Fixnum canna_fn_Extend;
|
|
961 static Fixnum canna_fn_Shrink;
|
428
|
962 #ifdef CANNA_FN_AdjustBunsetsu
|
458
|
963 static Fixnum canna_fn_AdjustBunsetsu;
|
428
|
964 #endif
|
458
|
965 static Fixnum canna_fn_Quit;
|
|
966 static Fixnum canna_fn_ConvertAsHex;
|
|
967 static Fixnum canna_fn_ConvertAsBushu;
|
|
968 static Fixnum canna_fn_KouhoIchiran;
|
|
969 static Fixnum canna_fn_BubunMuhenkan;
|
|
970 static Fixnum canna_fn_Zenkaku;
|
|
971 static Fixnum canna_fn_Hankaku;
|
|
972 static Fixnum canna_fn_ToUpper;
|
|
973 static Fixnum canna_fn_Capitalize;
|
|
974 static Fixnum canna_fn_ToLower;
|
|
975 static Fixnum canna_fn_Hiragana;
|
|
976 static Fixnum canna_fn_Katakana;
|
|
977 static Fixnum canna_fn_Romaji;
|
428
|
978 #ifdef CANNA_FN_BaseHiragana
|
458
|
979 static Fixnum canna_fn_BaseHiragana;
|
|
980 static Fixnum canna_fn_BaseKatakana;
|
|
981 static Fixnum canna_fn_BaseEisu;
|
|
982 static Fixnum canna_fn_BaseZenkaku;
|
|
983 static Fixnum canna_fn_BaseHankaku;
|
|
984 static Fixnum canna_fn_BaseKana;
|
|
985 static Fixnum canna_fn_BaseKakutei;
|
|
986 static Fixnum canna_fn_BaseHenkan;
|
|
987 static Fixnum canna_fn_BaseHiraKataToggle;
|
|
988 static Fixnum canna_fn_BaseZenHanToggle;
|
|
989 static Fixnum canna_fn_BaseKanaEisuToggle;
|
|
990 static Fixnum canna_fn_BaseKakuteiHenkanToggle;
|
|
991 static Fixnum canna_fn_BaseRotateForward;
|
|
992 static Fixnum canna_fn_BaseRotateBackward;
|
428
|
993 #endif
|
458
|
994 static Fixnum canna_fn_ExtendMode;
|
|
995 static Fixnum canna_fn_Touroku;
|
|
996 static Fixnum canna_fn_HexMode;
|
|
997 static Fixnum canna_fn_BushuMode;
|
|
998 static Fixnum canna_fn_KigouMode;
|
428
|
999 #ifdef CANNA_FN_Mark
|
458
|
1000 static Fixnum canna_fn_Mark;
|
428
|
1001 #endif
|
|
1002 #ifdef CANNA_FN_TemporalMode
|
458
|
1003 static Fixnum canna_fn_TemporalMode;
|
428
|
1004 #endif
|
|
1005
|
458
|
1006 static Fixnum canna_key_Nfer;
|
|
1007 static Fixnum canna_key_Xfer;
|
|
1008 static Fixnum canna_key_Up;
|
|
1009 static Fixnum canna_key_Left;
|
|
1010 static Fixnum canna_key_Right;
|
|
1011 static Fixnum canna_key_Down;
|
|
1012 static Fixnum canna_key_Insert;
|
|
1013 static Fixnum canna_key_Rollup;
|
|
1014 static Fixnum canna_key_Rolldown;
|
|
1015 static Fixnum canna_key_Home;
|
|
1016 static Fixnum canna_key_Help;
|
|
1017 static Fixnum canna_key_KP_Key;
|
|
1018 static Fixnum canna_key_Shift_Nfer;
|
|
1019 static Fixnum canna_key_Shift_Xfer;
|
|
1020 static Fixnum canna_key_Shift_Up;
|
|
1021 static Fixnum canna_key_Shift_Left;
|
|
1022 static Fixnum canna_key_Shift_Right;
|
|
1023 static Fixnum canna_key_Shift_Down;
|
|
1024 static Fixnum canna_key_Cntrl_Nfer;
|
|
1025 static Fixnum canna_key_Cntrl_Xfer;
|
|
1026 static Fixnum canna_key_Cntrl_Up;
|
|
1027 static Fixnum canna_key_Cntrl_Left;
|
|
1028 static Fixnum canna_key_Cntrl_Right;
|
|
1029 static Fixnum canna_key_Cntrl_Down;
|
428
|
1030
|
|
1031 Lisp_Object VCANNA; /* by MORIOKA Tomohiko <morioka@jaist.ac.jp>
|
|
1032 1996/6/7 */
|
|
1033
|
|
1034 void
|
|
1035 syms_of_mule_canna (void)
|
|
1036 {
|
|
1037 DEFSUBR (Fcanna_key_proc);
|
|
1038 DEFSUBR (Fcanna_initialize);
|
|
1039 DEFSUBR (Fcanna_finalize);
|
|
1040 DEFSUBR (Fcanna_touroku_string);
|
|
1041 DEFSUBR (Fcanna_set_width);
|
|
1042 DEFSUBR (Fcanna_change_mode);
|
|
1043 DEFSUBR (Fcanna_store_yomi);
|
|
1044 DEFSUBR (Fcanna_do_function);
|
|
1045 DEFSUBR (Fcanna_parse);
|
|
1046 DEFSUBR (Fcanna_query_mode);
|
|
1047 DEFSUBR (Fcanna_set_bunsetsu);
|
|
1048
|
|
1049 DEFSUBR (Fcanna_henkan_begin);
|
|
1050 DEFSUBR (Fcanna_henkan_next);
|
|
1051 DEFSUBR (Fcanna_bunsetu_henkou);
|
|
1052 DEFSUBR (Fcanna_henkan_kakutei);
|
|
1053 DEFSUBR (Fcanna_henkan_end);
|
|
1054 DEFSUBR (Fcanna_henkan_quit);
|
|
1055 }
|
|
1056
|
|
1057 void
|
|
1058 vars_of_mule_canna (void)
|
|
1059 {
|
|
1060 DEFVAR_LISP ("CANNA", &VCANNA); /* hir@nec, 1992.5.21 */
|
|
1061 VCANNA = Qt; /* hir@nec, 1992.5.21 */
|
|
1062
|
|
1063 DEFVAR_LISP ("canna-kakutei-string", &Vcanna_kakutei_string /*
|
|
1064
|
|
1065 */ );
|
|
1066 Vcanna_kakutei_string = Qnil;
|
|
1067
|
|
1068 DEFVAR_LISP ("canna-kakutei-yomi", &Vcanna_kakutei_yomi /*
|
|
1069
|
|
1070 */ );
|
|
1071 Vcanna_kakutei_yomi = Qnil;
|
|
1072
|
|
1073 DEFVAR_LISP ("canna-kakutei-romaji", &Vcanna_kakutei_romaji /*
|
|
1074
|
|
1075 */ );
|
|
1076 Vcanna_kakutei_romaji = Qnil;
|
|
1077
|
|
1078 DEFVAR_LISP ("canna-henkan-string", &Vcanna_henkan_string /*
|
|
1079
|
|
1080 */ );
|
|
1081 Vcanna_henkan_string = Qnil;
|
|
1082
|
|
1083 DEFVAR_INT ("canna-henkan-length", &canna_henkan_length /*
|
|
1084
|
|
1085 */ );
|
|
1086 canna_henkan_length = 0;
|
|
1087
|
|
1088 DEFVAR_INT ("canna-henkan-revpos", &canna_henkan_revPos /*
|
|
1089
|
|
1090 */ );
|
|
1091 canna_henkan_revPos = 0;
|
|
1092
|
|
1093 DEFVAR_INT ("canna-henkan-revlen", &canna_henkan_revLen /*
|
|
1094
|
|
1095 */ );
|
|
1096 canna_henkan_revLen = 0;
|
|
1097
|
|
1098 DEFVAR_LISP ("canna-ichiran-string", &Vcanna_ichiran_string /*
|
|
1099
|
|
1100 */ );
|
|
1101 Vcanna_ichiran_string = Qnil;
|
|
1102
|
|
1103 DEFVAR_INT ("canna-ichiran-length", &canna_ichiran_length /*
|
|
1104
|
|
1105 */ );
|
|
1106 canna_ichiran_length = 0;
|
|
1107
|
|
1108 DEFVAR_INT ("canna-ichiran-revpos", &canna_ichiran_revPos /*
|
|
1109
|
|
1110 */ );
|
|
1111 canna_ichiran_revPos = 0;
|
|
1112
|
|
1113 DEFVAR_INT ("canna-ichiran-revlen", &canna_ichiran_revLen /*
|
|
1114
|
|
1115 */ );
|
|
1116 canna_ichiran_revLen = 0;
|
|
1117
|
|
1118 DEFVAR_LISP ("canna-mode-string", &Vcanna_mode_string /*
|
|
1119
|
|
1120 */ );
|
|
1121 Vcanna_mode_string = Qnil;
|
|
1122
|
|
1123 DEFVAR_BOOL ("canna-empty-info", &canna_empty_info /*
|
|
1124 For canna
|
|
1125 */ );
|
|
1126 canna_empty_info = 0;
|
|
1127
|
|
1128 DEFVAR_BOOL ("canna-through-info", &canna_through_info /*
|
|
1129 For canna
|
|
1130 */ );
|
|
1131 canna_through_info = 0;
|
|
1132
|
|
1133 DEFVAR_BOOL ("canna-underline", &canna_underline /*
|
|
1134 For canna
|
|
1135 */ );
|
|
1136 canna_underline = 0;
|
|
1137
|
|
1138 DEFVAR_BOOL ("canna-inhibit-hankakukana", &canna_inhibit_hankakukana /*
|
|
1139 For canna
|
|
1140 */ );
|
|
1141 canna_inhibit_hankakukana = 0;
|
|
1142
|
|
1143 DEFVAR_INT ("canna-mode-alpha-mode", &canna_mode_AlphaMode /*
|
|
1144
|
|
1145 */ );
|
|
1146 canna_mode_AlphaMode = IROHA_MODE_AlphaMode;
|
|
1147
|
|
1148 DEFVAR_INT ("canna-mode-empty-mode", &canna_mode_EmptyMode /*
|
|
1149
|
|
1150 */ );
|
|
1151 canna_mode_EmptyMode = IROHA_MODE_EmptyMode;
|
|
1152
|
|
1153 DEFVAR_INT ("canna-mode-kigo-mode", &canna_mode_KigoMode /*
|
|
1154
|
|
1155 */ );
|
|
1156 canna_mode_KigoMode = IROHA_MODE_KigoMode;
|
|
1157
|
|
1158 DEFVAR_INT ("canna-mode-yomi-mode", &canna_mode_YomiMode /*
|
|
1159
|
|
1160 */ );
|
|
1161 canna_mode_YomiMode = IROHA_MODE_YomiMode;
|
|
1162
|
|
1163 DEFVAR_INT ("canna-mode-jishu-mode", &canna_mode_JishuMode /*
|
|
1164
|
|
1165 */ );
|
|
1166 canna_mode_JishuMode = IROHA_MODE_JishuMode;
|
|
1167
|
|
1168 DEFVAR_INT ("canna-mode-tankouho-mode", &canna_mode_TankouhoMode /*
|
|
1169
|
|
1170 */ );
|
|
1171 canna_mode_TankouhoMode = IROHA_MODE_TankouhoMode;
|
|
1172
|
|
1173 DEFVAR_INT ("canna-mode-ichiran-mode", &canna_mode_IchiranMode /*
|
|
1174
|
|
1175 */ );
|
|
1176 canna_mode_IchiranMode = IROHA_MODE_IchiranMode;
|
|
1177
|
|
1178 DEFVAR_INT ("canna-mode-yes-no-mode", &canna_mode_YesNoMode /*
|
|
1179
|
|
1180 */ );
|
|
1181 canna_mode_YesNoMode = IROHA_MODE_YesNoMode;
|
|
1182
|
|
1183 DEFVAR_INT ("canna-mode-on-off-mode", &canna_mode_OnOffMode /*
|
|
1184
|
|
1185 */ );
|
|
1186 canna_mode_OnOffMode = IROHA_MODE_OnOffMode;
|
|
1187
|
|
1188 #ifdef CANNA_MODE_AdjustBunsetsuMode
|
|
1189 DEFVAR_INT ("canna-mode-adjust-bunsetsu-mode",
|
|
1190 &canna_mode_AdjustBunsetsuMode /*
|
|
1191
|
|
1192 */ );
|
|
1193 canna_mode_AdjustBunsetsuMode = CANNA_MODE_AdjustBunsetsuMode;
|
|
1194 #endif
|
|
1195 #ifdef CANNA_MODE_ChikujiYomiMode
|
|
1196 DEFVAR_INT ("canna-mode-chikuji-yomi-mode", &canna_mode_ChikujiYomiMode /*
|
|
1197
|
|
1198 */ );
|
|
1199 canna_mode_ChikujiYomiMode = CANNA_MODE_ChikujiYomiMode;
|
|
1200
|
|
1201 DEFVAR_INT ("canna-mode-chikuji-bunsetsu-mode",
|
|
1202 &canna_mode_ChikujiTanMode /*
|
|
1203
|
|
1204 */ );
|
|
1205 canna_mode_ChikujiTanMode = CANNA_MODE_ChikujiTanMode;
|
|
1206 #endif
|
|
1207
|
|
1208 DEFVAR_INT ("canna-mode-henkan-mode", &canna_mode_HenkanMode /*
|
|
1209
|
|
1210 */ );
|
|
1211 canna_mode_HenkanMode = IROHA_MODE_HenkanMode;
|
|
1212
|
|
1213 #ifdef CANNA_MODE_HenkanNyuryokuMode
|
|
1214 DEFVAR_INT ("canna-mode-henkan-nyuuryoku-mode",
|
|
1215 &canna_mode_HenkanNyuryokuMode /*
|
|
1216
|
|
1217 */ );
|
|
1218 canna_mode_HenkanNyuryokuMode = CANNA_MODE_HenkanNyuryokuMode;
|
|
1219 #endif
|
|
1220 #ifdef CANNA_MODE_ZenHiraHenkanMode
|
|
1221 DEFVAR_INT ("canna-mode-zen-hira-henkan-mode",
|
|
1222 &canna_mode_ZenHiraHenkanMode /*
|
|
1223
|
|
1224 */ );
|
|
1225 canna_mode_ZenHiraHenkanMode = CANNA_MODE_ZenHiraHenkanMode;
|
|
1226 #ifdef CANNA_MODE_HanHiraHenkanMode
|
|
1227 DEFVAR_INT ("canna-mode-han-hira-henkan-mode",
|
|
1228 &canna_mode_HanHiraHenkanMode /*
|
|
1229
|
|
1230 */ );
|
|
1231 canna_mode_HanHiraHenkanMode = CANNA_MODE_HanHiraHenkanMode;
|
|
1232 #endif
|
|
1233 DEFVAR_INT ("canna-mode-zen-kata-henkan-mode",
|
|
1234 &canna_mode_ZenKataHenkanMode /*
|
|
1235
|
|
1236 */ );
|
|
1237 canna_mode_ZenKataHenkanMode = CANNA_MODE_ZenKataHenkanMode;
|
|
1238
|
|
1239 DEFVAR_INT ("canna-mode-han-kata-henkan-mode",
|
|
1240 &canna_mode_HanKataHenkanMode /*
|
|
1241
|
|
1242 */ );
|
|
1243 canna_mode_HanKataHenkanMode = CANNA_MODE_HanKataHenkanMode;
|
|
1244
|
|
1245 DEFVAR_INT ("canna-mode-zen-alpha-henkan-mode",
|
|
1246 &canna_mode_ZenAlphaHenkanMode /*
|
|
1247
|
|
1248 */ );
|
|
1249 canna_mode_ZenAlphaHenkanMode = CANNA_MODE_ZenAlphaHenkanMode;
|
|
1250
|
|
1251 DEFVAR_INT ("canna-mode-han-alpha-henkan-mode",
|
|
1252 &canna_mode_HanAlphaHenkanMode /*
|
|
1253
|
|
1254 */ );
|
|
1255 canna_mode_HanAlphaHenkanMode = CANNA_MODE_HanAlphaHenkanMode;
|
|
1256 #endif
|
|
1257 DEFVAR_INT ("canna-mode-zen-hira-kakutei-mode",
|
|
1258 &canna_mode_ZenHiraKakuteiMode /*
|
|
1259
|
|
1260 */ );
|
|
1261 canna_mode_ZenHiraKakuteiMode = IROHA_MODE_ZenHiraKakuteiMode;
|
|
1262 #ifdef CANNA_MODE_HanHiraKakuteiMode
|
|
1263 DEFVAR_INT ("canna-mode-han-hira-kakutei-mode",
|
|
1264 &canna_mode_HanHiraKakuteiMode /*
|
|
1265
|
|
1266 */ );
|
|
1267 canna_mode_HanHiraKakuteiMode = CANNA_MODE_HanHiraKakuteiMode;
|
|
1268 #endif
|
|
1269 DEFVAR_INT ("canna-mode-zen-kata-kakutei-mode",
|
|
1270 &canna_mode_ZenKataKakuteiMode /*
|
|
1271
|
|
1272 */ );
|
|
1273 canna_mode_ZenKataKakuteiMode = IROHA_MODE_ZenKataKakuteiMode;
|
|
1274
|
|
1275 DEFVAR_INT ("canna-mode-han-kata-kakutei-mode",
|
|
1276 &canna_mode_HanKataKakuteiMode /*
|
|
1277
|
|
1278 */ );
|
|
1279 canna_mode_HanKataKakuteiMode = IROHA_MODE_HanKataKakuteiMode;
|
|
1280
|
|
1281 DEFVAR_INT ("canna-mode-zen-alpha-kakutei-mode",
|
|
1282 &canna_mode_ZenAlphaKakuteiMode /*
|
|
1283
|
|
1284 */ );
|
|
1285 canna_mode_ZenAlphaKakuteiMode = IROHA_MODE_ZenAlphaKakuteiMode;
|
|
1286
|
|
1287 DEFVAR_INT ("canna-mode-han-alpha-kakutei-mode",
|
|
1288 &canna_mode_HanAlphaKakuteiMode /*
|
|
1289
|
|
1290 */ );
|
|
1291 canna_mode_HanAlphaKakuteiMode = IROHA_MODE_HanAlphaKakuteiMode;
|
|
1292
|
|
1293 DEFVAR_INT ("canna-mode-hex-mode", &canna_mode_HexMode /*
|
|
1294
|
|
1295 */ );
|
|
1296 canna_mode_HexMode = IROHA_MODE_HexMode;
|
|
1297
|
|
1298 DEFVAR_INT ("canna-mode-bushu-mode", &canna_mode_BushuMode /*
|
|
1299
|
|
1300 */ );
|
|
1301 canna_mode_BushuMode = IROHA_MODE_BushuMode;
|
|
1302
|
|
1303 DEFVAR_INT ("canna-mode-extend-mode", &canna_mode_ExtendMode /*
|
|
1304
|
|
1305 */ );
|
|
1306 canna_mode_ExtendMode = IROHA_MODE_ExtendMode;
|
|
1307
|
|
1308 DEFVAR_INT ("canna-mode-russian-mode", &canna_mode_RussianMode /*
|
|
1309
|
|
1310 */ );
|
|
1311 canna_mode_RussianMode = IROHA_MODE_RussianMode;
|
|
1312
|
|
1313 DEFVAR_INT ("canna-mode-greek-mode", &canna_mode_GreekMode /*
|
|
1314
|
|
1315 */ );
|
|
1316 canna_mode_GreekMode = IROHA_MODE_GreekMode;
|
|
1317
|
|
1318 DEFVAR_INT ("canna-mode-line-mode", &canna_mode_LineMode /*
|
|
1319
|
|
1320 */ );
|
|
1321 canna_mode_LineMode = IROHA_MODE_LineMode;
|
|
1322
|
|
1323 DEFVAR_INT ("canna-mode-changing-server-mode",
|
|
1324 &canna_mode_ChangingServerMode /*
|
|
1325
|
|
1326 */ );
|
|
1327 canna_mode_ChangingServerMode = IROHA_MODE_ChangingServerMode;
|
|
1328
|
|
1329 DEFVAR_INT ("canna-mode-henkan-method-mode",
|
|
1330 &canna_mode_HenkanMethodMode /*
|
|
1331
|
|
1332 */ );
|
|
1333 canna_mode_HenkanMethodMode = IROHA_MODE_HenkanMethodMode;
|
|
1334
|
|
1335 DEFVAR_INT ("canna-mode-delete-dic-mode", &canna_mode_DeleteDicMode /*
|
|
1336
|
|
1337 */ );
|
|
1338 canna_mode_DeleteDicMode = IROHA_MODE_DeleteDicMode;
|
|
1339
|
|
1340 DEFVAR_INT ("canna-mode-touroku-mode", &canna_mode_TourokuMode /*
|
|
1341
|
|
1342 */ );
|
|
1343 canna_mode_TourokuMode = IROHA_MODE_TourokuMode;
|
|
1344
|
|
1345 DEFVAR_INT ("canna-mode-touroku-empty-mode",
|
|
1346 &canna_mode_TourokuEmptyMode /*
|
|
1347
|
|
1348 */ );
|
|
1349 canna_mode_TourokuEmptyMode = IROHA_MODE_TourokuEmptyMode;
|
|
1350
|
|
1351 DEFVAR_INT ("canna-mode-touroku-hinshi-mode",
|
|
1352 &canna_mode_TourokuHinshiMode /*
|
|
1353
|
|
1354 */ );
|
|
1355 canna_mode_TourokuHinshiMode = IROHA_MODE_TourokuHinshiMode;
|
|
1356
|
|
1357 DEFVAR_INT ("canna-mode-touroku-dic-mode", &canna_mode_TourokuDicMode /*
|
|
1358
|
|
1359 */ );
|
|
1360 canna_mode_TourokuDicMode = IROHA_MODE_TourokuDicMode;
|
|
1361
|
|
1362 DEFVAR_INT ("canna-mode-quoted-insert-mode",
|
|
1363 &canna_mode_QuotedInsertMode /*
|
|
1364
|
|
1365 */ );
|
|
1366 canna_mode_QuotedInsertMode = IROHA_MODE_QuotedInsertMode;
|
|
1367
|
|
1368 DEFVAR_INT ("canna-mode-bubun-muhenkan-mode",
|
|
1369 &canna_mode_BubunMuhenkanMode /*
|
|
1370
|
|
1371 */ );
|
|
1372 canna_mode_BubunMuhenkanMode = IROHA_MODE_BubunMuhenkanMode;
|
|
1373
|
|
1374 DEFVAR_INT ("canna-mode-mount-dic-mode", &canna_mode_MountDicMode /*
|
|
1375
|
|
1376 */ );
|
|
1377 canna_mode_MountDicMode = IROHA_MODE_MountDicMode;
|
|
1378
|
|
1379 DEFVAR_INT ("canna-func-self-insert", &canna_fn_SelfInsert /*
|
|
1380
|
|
1381 */ );
|
|
1382 canna_fn_SelfInsert = IROHA_FN_SelfInsert;
|
|
1383
|
|
1384 DEFVAR_INT ("canna-func-functional-insert", &canna_fn_FunctionalInsert /*
|
|
1385
|
|
1386 */ );
|
|
1387 canna_fn_FunctionalInsert = IROHA_FN_FunctionalInsert;
|
|
1388
|
|
1389 DEFVAR_INT ("canna-func-quoted-insert", &canna_fn_QuotedInsert /*
|
|
1390
|
|
1391 */ );
|
|
1392 canna_fn_QuotedInsert = IROHA_FN_QuotedInsert;
|
|
1393
|
|
1394 DEFVAR_INT ("canna-func-japanese-mode", &canna_fn_JapaneseMode /*
|
|
1395
|
|
1396 */ );
|
|
1397 canna_fn_JapaneseMode = IROHA_FN_JapaneseMode;
|
|
1398
|
|
1399 DEFVAR_INT ("canna-func-alpha-mode", &canna_fn_AlphaMode /*
|
|
1400
|
|
1401 */ );
|
|
1402 canna_fn_AlphaMode = IROHA_FN_AlphaMode;
|
|
1403
|
|
1404 DEFVAR_INT ("canna-func-henkan-nyuryoku-mode",
|
|
1405 &canna_fn_HenkanNyuryokuMode /*
|
|
1406
|
|
1407 */ );
|
|
1408 canna_fn_HenkanNyuryokuMode = IROHA_FN_HenkanNyuryokuMode;
|
|
1409
|
|
1410 DEFVAR_INT ("canna-func-forward", &canna_fn_Forward /*
|
|
1411
|
|
1412 */ );
|
|
1413 canna_fn_Forward = IROHA_FN_Forward;
|
|
1414
|
|
1415 DEFVAR_INT ("canna-func-backward", &canna_fn_Backward /*
|
|
1416
|
|
1417 */ );
|
|
1418 canna_fn_Backward = IROHA_FN_Backward;
|
|
1419
|
|
1420 DEFVAR_INT ("canna-func-next", &canna_fn_Next /*
|
|
1421
|
|
1422 */ );
|
|
1423 canna_fn_Next = IROHA_FN_Next;
|
|
1424
|
|
1425 DEFVAR_INT ("canna-func-previous", &canna_fn_Prev /*
|
|
1426
|
|
1427 */ );
|
|
1428 canna_fn_Prev = IROHA_FN_Prev;
|
|
1429
|
|
1430 DEFVAR_INT ("canna-func-beginning-of-line", &canna_fn_BeginningOfLine /*
|
|
1431
|
|
1432 */ );
|
|
1433 canna_fn_BeginningOfLine = IROHA_FN_BeginningOfLine;
|
|
1434
|
|
1435 DEFVAR_INT ("canna-func-end-of-line", &canna_fn_EndOfLine /*
|
|
1436
|
|
1437 */ );
|
|
1438 canna_fn_EndOfLine = IROHA_FN_EndOfLine;
|
|
1439
|
|
1440 DEFVAR_INT ("canna-func-delete-next", &canna_fn_DeleteNext /*
|
|
1441
|
|
1442 */ );
|
|
1443 canna_fn_DeleteNext = IROHA_FN_DeleteNext;
|
|
1444
|
460
|
1445 DEFVAR_INT ("canna-func-delete-previous", &canna_fn_DeletePrevious /*
|
428
|
1446
|
|
1447 */ );
|
|
1448 canna_fn_DeletePrevious = IROHA_FN_DeletePrevious;
|
|
1449
|
|
1450 DEFVAR_INT ("canna-func-kill-to-end-of-line", &canna_fn_KillToEndOfLine /*
|
|
1451
|
|
1452 */ );
|
|
1453 canna_fn_KillToEndOfLine = IROHA_FN_KillToEndOfLine;
|
|
1454
|
|
1455 DEFVAR_INT ("canna-func-henkan", &canna_fn_Henkan /*
|
|
1456
|
|
1457 */ );
|
|
1458 canna_fn_Henkan = IROHA_FN_Henkan;
|
|
1459
|
|
1460 DEFVAR_INT ("canna-func-kakutei", &canna_fn_Kakutei /*
|
|
1461
|
|
1462 */ );
|
|
1463 canna_fn_Kakutei = IROHA_FN_Kakutei;
|
|
1464
|
|
1465 DEFVAR_INT ("canna-func-extend", &canna_fn_Extend /*
|
|
1466
|
|
1467 */ );
|
|
1468 canna_fn_Extend = IROHA_FN_Extend;
|
|
1469
|
|
1470 DEFVAR_INT ("canna-func-shrink", &canna_fn_Shrink /*
|
|
1471
|
|
1472 */ );
|
|
1473 canna_fn_Shrink = IROHA_FN_Shrink;
|
|
1474
|
|
1475 #ifdef CANNA_FN_AdjustBunsetsu
|
|
1476 DEFVAR_INT ("canna-func-adjust-bunsetsu", &canna_fn_AdjustBunsetsu /*
|
|
1477
|
|
1478 */ );
|
|
1479 canna_fn_AdjustBunsetsu = CANNA_FN_AdjustBunsetsu;
|
|
1480 #endif
|
|
1481 DEFVAR_INT ("canna-func-quit", &canna_fn_Quit /*
|
|
1482
|
|
1483 */ );
|
|
1484 canna_fn_Quit = IROHA_FN_Quit;
|
|
1485
|
|
1486 DEFVAR_INT ("canna-func-convert-as-hex", &canna_fn_ConvertAsHex /*
|
|
1487
|
|
1488 */ );
|
|
1489 canna_fn_ConvertAsHex = IROHA_FN_ConvertAsHex;
|
|
1490
|
|
1491 DEFVAR_INT ("canna-func-convert-as-bushu", &canna_fn_ConvertAsBushu /*
|
|
1492
|
|
1493 */ );
|
|
1494 canna_fn_ConvertAsBushu = IROHA_FN_ConvertAsBushu;
|
|
1495
|
|
1496 DEFVAR_INT ("canna-func-kouho-ichiran", &canna_fn_KouhoIchiran /*
|
|
1497
|
|
1498 */ );
|
|
1499 canna_fn_KouhoIchiran = IROHA_FN_KouhoIchiran;
|
|
1500
|
|
1501 DEFVAR_INT ("canna-func-bubun-muhenkan", &canna_fn_BubunMuhenkan /*
|
|
1502
|
|
1503 */ );
|
|
1504 canna_fn_BubunMuhenkan = IROHA_FN_BubunMuhenkan;
|
|
1505
|
|
1506 DEFVAR_INT ("canna-func-zenkaku", &canna_fn_Zenkaku /*
|
|
1507
|
|
1508 */ );
|
|
1509 canna_fn_Zenkaku = IROHA_FN_Zenkaku;
|
|
1510
|
|
1511 DEFVAR_INT ("canna-func-hankaku", &canna_fn_Hankaku /*
|
|
1512
|
|
1513 */ );
|
|
1514 canna_fn_Hankaku = IROHA_FN_Hankaku;
|
|
1515
|
|
1516 DEFVAR_INT ("canna-func-to-upper", &canna_fn_ToUpper /*
|
|
1517
|
|
1518 */ );
|
|
1519 canna_fn_ToUpper = IROHA_FN_ToUpper;
|
|
1520
|
|
1521 DEFVAR_INT ("canna-func-capitalize", &canna_fn_Capitalize /*
|
|
1522
|
|
1523 */ );
|
|
1524 canna_fn_Capitalize = IROHA_FN_Capitalize;
|
|
1525
|
|
1526 DEFVAR_INT ("canna-func-to-lower", &canna_fn_ToLower /*
|
|
1527
|
|
1528 */ );
|
|
1529 canna_fn_ToLower = IROHA_FN_ToLower;
|
|
1530
|
|
1531 DEFVAR_INT ("canna-func-hiragana", &canna_fn_Hiragana /*
|
|
1532
|
|
1533 */ );
|
|
1534 canna_fn_Hiragana = IROHA_FN_Hiragana;
|
|
1535
|
|
1536 DEFVAR_INT ("canna-func-katakana", &canna_fn_Katakana /*
|
|
1537
|
|
1538 */ );
|
|
1539 canna_fn_Katakana = IROHA_FN_Katakana;
|
|
1540
|
|
1541 DEFVAR_INT ("canna-func-romaji", &canna_fn_Romaji /*
|
|
1542
|
|
1543 */ );
|
|
1544 canna_fn_Romaji = IROHA_FN_Romaji;
|
|
1545
|
|
1546 #ifdef CANNA_FN_BaseHiragana
|
|
1547 DEFVAR_INT ("canna-func-base-hiragana", &canna_fn_BaseHiragana /*
|
|
1548
|
|
1549 */ );
|
|
1550 canna_fn_BaseHiragana = CANNA_FN_BaseHiragana;
|
|
1551
|
|
1552 DEFVAR_INT ("canna-func-base-katakana", &canna_fn_BaseKatakana /*
|
|
1553
|
|
1554 */ );
|
|
1555 canna_fn_BaseKatakana = CANNA_FN_BaseKatakana;
|
|
1556
|
|
1557 DEFVAR_INT ("canna-func-base-eisu", &canna_fn_BaseEisu /*
|
|
1558
|
|
1559 */ );
|
|
1560 canna_fn_BaseEisu = CANNA_FN_BaseEisu;
|
|
1561
|
|
1562 DEFVAR_INT ("canna-func-base-zenkaku", &canna_fn_BaseZenkaku /*
|
|
1563
|
|
1564 */ );
|
|
1565 canna_fn_BaseZenkaku = CANNA_FN_BaseZenkaku;
|
|
1566
|
|
1567 DEFVAR_INT ("canna-func-base-hankaku", &canna_fn_BaseHankaku /*
|
|
1568
|
|
1569 */ );
|
|
1570 canna_fn_BaseHankaku = CANNA_FN_BaseHankaku;
|
|
1571
|
|
1572 DEFVAR_INT ("canna-func-base-kana", &canna_fn_BaseKana /*
|
|
1573
|
|
1574 */ );
|
|
1575 canna_fn_BaseKana = CANNA_FN_BaseKana;
|
|
1576
|
|
1577 DEFVAR_INT ("canna-func-base-kakutei", &canna_fn_BaseKakutei /*
|
|
1578
|
|
1579 */ );
|
|
1580 canna_fn_BaseKakutei = CANNA_FN_BaseKakutei;
|
|
1581
|
|
1582 DEFVAR_INT ("canna-func-base-henkan", &canna_fn_BaseHenkan /*
|
|
1583
|
|
1584 */ );
|
|
1585 canna_fn_BaseHenkan = CANNA_FN_BaseHenkan;
|
|
1586
|
|
1587 DEFVAR_INT ("canna-func-base-hiragana-katakana-toggle",
|
|
1588 &canna_fn_BaseHiraKataToggle /*
|
|
1589
|
|
1590 */ );
|
|
1591 canna_fn_BaseHiraKataToggle = CANNA_FN_BaseHiraKataToggle;
|
|
1592
|
|
1593 DEFVAR_INT ("canna-func-base-zenkaku-hankaku-toggle",
|
|
1594 &canna_fn_BaseZenHanToggle /*
|
|
1595
|
|
1596 */ );
|
|
1597 canna_fn_BaseZenHanToggle = CANNA_FN_BaseZenHanToggle;
|
|
1598
|
|
1599 DEFVAR_INT ("canna-func-base-kana-eisu-toggle",
|
|
1600 &canna_fn_BaseKanaEisuToggle /*
|
|
1601
|
|
1602 */ );
|
|
1603 canna_fn_BaseKanaEisuToggle = CANNA_FN_BaseKanaEisuToggle;
|
|
1604
|
|
1605 DEFVAR_INT ("canna-func-base-kakutei-henkan-toggle",
|
|
1606 &canna_fn_BaseKakuteiHenkanToggle /*
|
|
1607
|
|
1608 */ );
|
|
1609 canna_fn_BaseKakuteiHenkanToggle = CANNA_FN_BaseKakuteiHenkanToggle;
|
|
1610
|
|
1611 DEFVAR_INT ("canna-func-base-rotate-forward",
|
|
1612 &canna_fn_BaseRotateForward /*
|
|
1613
|
|
1614 */ );
|
|
1615 canna_fn_BaseRotateForward = CANNA_FN_BaseRotateForward;
|
|
1616
|
|
1617 DEFVAR_INT ("canna-func-base-rotate-backward",
|
|
1618 &canna_fn_BaseRotateBackward /*
|
|
1619
|
|
1620 */ );
|
|
1621 canna_fn_BaseRotateBackward = CANNA_FN_BaseRotateBackward;
|
|
1622
|
|
1623 #endif
|
|
1624 DEFVAR_INT ("canna-func-extend-mode", &canna_fn_ExtendMode /*
|
|
1625
|
|
1626 */ );
|
|
1627 canna_fn_ExtendMode = IROHA_FN_ExtendMode;
|
|
1628
|
|
1629 DEFVAR_INT ("canna-func-touroku", &canna_fn_Touroku /*
|
|
1630
|
|
1631 */ );
|
|
1632 canna_fn_Touroku = IROHA_FN_Touroku;
|
|
1633
|
|
1634 DEFVAR_INT ("canna-func-hex-mode", &canna_fn_HexMode /*
|
|
1635
|
|
1636 */ );
|
|
1637 canna_fn_HexMode = IROHA_FN_HexMode;
|
|
1638
|
|
1639 DEFVAR_INT ("canna-func-bushu-mode", &canna_fn_BushuMode /*
|
|
1640
|
|
1641 */ );
|
|
1642 canna_fn_BushuMode = IROHA_FN_BushuMode;
|
|
1643
|
|
1644 DEFVAR_INT ("canna-func-kigo-mode", &canna_fn_KigouMode /*
|
|
1645
|
|
1646 */ );
|
|
1647 canna_fn_KigouMode = IROHA_FN_KigouMode;
|
|
1648
|
|
1649 #ifdef CANNA_FN_Mark
|
|
1650 DEFVAR_INT ("canna-func-mark", &canna_fn_Mark /*
|
|
1651
|
|
1652 */ );
|
|
1653 canna_fn_Mark = CANNA_FN_Mark;
|
|
1654 #endif
|
|
1655 #ifdef CANNA_FN_TemporalMode
|
|
1656 DEFVAR_INT ("canna-func-temporal-mode", &canna_fn_TemporalMode /*
|
|
1657
|
|
1658 */ );
|
|
1659 canna_fn_TemporalMode = CANNA_FN_TemporalMode;
|
|
1660 #endif
|
|
1661
|
|
1662 DEFVAR_INT ("canna-key-nfer", &canna_key_Nfer /*
|
|
1663
|
|
1664 */ );
|
|
1665 canna_key_Nfer = IROHA_KEY_Nfer;
|
|
1666
|
|
1667 DEFVAR_INT ("canna-key-xfer", &canna_key_Xfer /*
|
|
1668
|
|
1669 */ );
|
|
1670 canna_key_Xfer = IROHA_KEY_Xfer;
|
|
1671
|
|
1672 DEFVAR_INT ("canna-key-up", &canna_key_Up /*
|
|
1673
|
|
1674 */ );
|
|
1675 canna_key_Up = IROHA_KEY_Up;
|
|
1676
|
|
1677 DEFVAR_INT ("canna-key-left", &canna_key_Left /*
|
|
1678
|
|
1679 */ );
|
|
1680 canna_key_Left = IROHA_KEY_Left;
|
|
1681
|
|
1682 DEFVAR_INT ("canna-key-right", &canna_key_Right /*
|
|
1683
|
|
1684 */ );
|
|
1685 canna_key_Right = IROHA_KEY_Right;
|
|
1686
|
|
1687 DEFVAR_INT ("canna-key-down", &canna_key_Down /*
|
|
1688
|
|
1689 */ );
|
|
1690 canna_key_Down = IROHA_KEY_Down;
|
|
1691
|
|
1692 DEFVAR_INT ("canna-key-insert", &canna_key_Insert /*
|
|
1693
|
|
1694 */ );
|
|
1695 canna_key_Insert = IROHA_KEY_Insert;
|
|
1696
|
|
1697 DEFVAR_INT ("canna-key-rollup", &canna_key_Rollup /*
|
|
1698
|
|
1699 */ );
|
|
1700 canna_key_Rollup = IROHA_KEY_Rollup;
|
|
1701
|
|
1702 DEFVAR_INT ("canna-key-rolldown", &canna_key_Rolldown /*
|
|
1703
|
|
1704 */ );
|
|
1705 canna_key_Rolldown = IROHA_KEY_Rolldown;
|
|
1706
|
|
1707 DEFVAR_INT ("canna-key-home", &canna_key_Home /*
|
|
1708
|
|
1709 */ );
|
|
1710 canna_key_Home = IROHA_KEY_Home;
|
|
1711
|
|
1712 DEFVAR_INT ("canna-key-help", &canna_key_Help /*
|
|
1713
|
|
1714 */ );
|
|
1715 canna_key_Help = IROHA_KEY_Help;
|
|
1716
|
|
1717 DEFVAR_INT ("canna-key-kp-key", &canna_key_KP_Key /*
|
|
1718
|
|
1719 */ );
|
|
1720 canna_key_KP_Key = IROHA_KEY_KP_Key;
|
|
1721
|
|
1722 DEFVAR_INT ("canna-key-shift-nfer", &canna_key_Shift_Nfer /*
|
|
1723
|
|
1724 */ );
|
|
1725 canna_key_Shift_Nfer = IROHA_KEY_Shift_Nfer;
|
|
1726
|
|
1727 DEFVAR_INT ("canna-key-shift-xfer", &canna_key_Shift_Xfer /*
|
|
1728
|
|
1729 */ );
|
|
1730 canna_key_Shift_Xfer = IROHA_KEY_Shift_Xfer;
|
|
1731
|
|
1732 DEFVAR_INT ("canna-key-shift-up", &canna_key_Shift_Up /*
|
|
1733
|
|
1734 */ );
|
|
1735 canna_key_Shift_Up = IROHA_KEY_Shift_Up;
|
|
1736
|
|
1737 DEFVAR_INT ("canna-key-shift-left", &canna_key_Shift_Left /*
|
|
1738
|
|
1739 */ );
|
|
1740 canna_key_Shift_Left = IROHA_KEY_Shift_Left;
|
|
1741
|
|
1742 DEFVAR_INT ("canna-key-shift-right", &canna_key_Shift_Right /*
|
|
1743
|
|
1744 */ );
|
|
1745 canna_key_Shift_Right = IROHA_KEY_Shift_Right;
|
|
1746
|
|
1747 DEFVAR_INT ("canna-key-shift-down", &canna_key_Shift_Down /*
|
|
1748
|
|
1749 */ );
|
|
1750 canna_key_Shift_Down = IROHA_KEY_Shift_Down;
|
|
1751
|
|
1752 DEFVAR_INT ("canna-key-control-nfer", &canna_key_Cntrl_Nfer /*
|
|
1753
|
|
1754 */ );
|
|
1755 canna_key_Cntrl_Nfer = IROHA_KEY_Cntrl_Nfer;
|
|
1756
|
|
1757 DEFVAR_INT ("canna-key-control-xfer", &canna_key_Cntrl_Xfer /*
|
|
1758
|
|
1759 */ );
|
|
1760 canna_key_Cntrl_Xfer = IROHA_KEY_Cntrl_Xfer;
|
|
1761
|
|
1762 DEFVAR_INT ("canna-key-control-up", &canna_key_Cntrl_Up /*
|
|
1763
|
|
1764 */ );
|
|
1765 canna_key_Cntrl_Up = IROHA_KEY_Cntrl_Up;
|
|
1766
|
|
1767 DEFVAR_INT ("canna-key-control-left", &canna_key_Cntrl_Left /*
|
|
1768
|
|
1769 */ );
|
|
1770 canna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left;
|
|
1771
|
|
1772 DEFVAR_INT ("canna-key-control-right", &canna_key_Cntrl_Right /*
|
|
1773
|
|
1774 */ );
|
|
1775 canna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right;
|
|
1776
|
|
1777 DEFVAR_INT ("canna-key-control-down", &canna_key_Cntrl_Down /*
|
|
1778
|
|
1779 */ );
|
|
1780 canna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down;
|
|
1781
|
|
1782 Fprovide(intern("CANNA"));
|
|
1783 }
|
|
1784
|
|
1785 #ifdef CANNA_MULE
|
|
1786 /* To handle MULE internal code and EUC.
|
|
1787 I assume CANNA can handle only Japanese EUC. */
|
|
1788
|
|
1789 /* EUC multibyte string to MULE internal string */
|
|
1790
|
|
1791 static void
|
442
|
1792 c2mu (unsigned char *cp, int l, unsigned char *mp)
|
428
|
1793 {
|
442
|
1794 unsigned char ch, *ep = cp+l;
|
428
|
1795
|
|
1796 while ((cp < ep) && (ch = *cp))
|
|
1797 {
|
|
1798 if ((unsigned char) ch == ISO_CODE_SS2)
|
|
1799 {
|
|
1800 *mp++ = LEADING_BYTE_KATAKANA_JISX0201;
|
|
1801 cp++;
|
|
1802 }
|
|
1803 else if ((unsigned char) ch == ISO_CODE_SS3)
|
|
1804 {
|
|
1805 *mp++ = LEADING_BYTE_JAPANESE_JISX0212;
|
|
1806 cp++;
|
|
1807 *mp++ = *cp++;
|
|
1808 }
|
|
1809 else if (ch & 0x80)
|
|
1810 {
|
|
1811 *mp++ = LEADING_BYTE_JAPANESE_JISX0208;
|
|
1812 *mp++ = *cp++;
|
|
1813 }
|
|
1814 *mp++ = *cp++;
|
|
1815 }
|
|
1816 *mp = 0;
|
|
1817 }
|
|
1818
|
|
1819 /* MULE internal string to EUC multibyte string */
|
|
1820
|
|
1821 static void
|
|
1822 m2c (unsigned char *mp, int l, unsigned char *cp)
|
|
1823 {
|
|
1824 unsigned char ch, *ep = mp + l;
|
|
1825
|
|
1826 while ((mp < ep) && (ch = *mp++))
|
|
1827 {
|
|
1828 switch (ch)
|
|
1829 {
|
|
1830 case LEADING_BYTE_KATAKANA_JISX0201:
|
|
1831 *cp++ = ISO_CODE_SS2;
|
|
1832 *cp++ = *mp++;
|
|
1833 break;
|
|
1834 case LEADING_BYTE_JAPANESE_JISX0212:
|
|
1835 *cp++ = ISO_CODE_SS3;
|
|
1836 case LEADING_BYTE_JAPANESE_JISX0208:
|
|
1837 *cp++ = *mp++;
|
|
1838 *cp++ = *mp++;
|
|
1839 break;
|
|
1840 default:
|
|
1841 *cp++ = ch;
|
|
1842 break;
|
|
1843 }
|
|
1844 }
|
|
1845 *cp = 0;
|
|
1846 }
|
|
1847
|
|
1848 #undef make_string
|
|
1849
|
|
1850 /* make_string after converting EUC string to MULE internal string */
|
|
1851 static Lisp_Object
|
|
1852 mule_make_string (unsigned char *p, int l)
|
|
1853 {
|
|
1854 unsigned char cbuf[4096];
|
|
1855
|
|
1856 c2mu (p,l,cbuf);
|
|
1857 return (make_string (cbuf,strlen (cbuf)));
|
|
1858 }
|
|
1859
|
|
1860 /* return the MULE internal string length of EUC string */
|
|
1861 /* Modified by sb to return a character count not byte count. */
|
|
1862 static int
|
|
1863 mule_strlen (unsigned char *p, int l)
|
|
1864 {
|
|
1865 unsigned char ch, *cp = p;
|
|
1866 int len = 0;
|
|
1867
|
|
1868 while ((cp < p + l) && (ch = *cp))
|
|
1869 {
|
|
1870 if ((unsigned char) ch == ISO_CODE_SS2)
|
|
1871 {
|
|
1872 len++;
|
|
1873 cp += 2;
|
|
1874 }
|
|
1875 else if ((unsigned char) ch == ISO_CODE_SS3)
|
|
1876 {
|
|
1877 len++;
|
|
1878 cp += 3;
|
|
1879 }
|
|
1880 else if (ch & 0x80)
|
|
1881 {
|
|
1882 len++;
|
|
1883 cp += 2;
|
|
1884 }
|
|
1885 else
|
|
1886 {
|
|
1887 len++;
|
|
1888 cp++;
|
|
1889 }
|
|
1890 }
|
|
1891 return (len);
|
|
1892 }
|
|
1893
|
|
1894 /* count number of characters */
|
|
1895 static void
|
458
|
1896 count_char (unsigned char *p, int len, int pos, int rev,
|
|
1897 Fixnum *clen, Fixnum *cpos, Fixnum *crev)
|
428
|
1898 {
|
|
1899 unsigned char *q = p;
|
|
1900
|
|
1901 *clen = *cpos = *crev = 0;
|
|
1902 if (len == 0) return;
|
|
1903 while (q < p + pos)
|
|
1904 {
|
|
1905 (*clen)++;
|
|
1906 (*cpos)++;
|
|
1907 if (*q++ & 0x80) q++;
|
|
1908 }
|
|
1909 while (q < p + pos + rev)
|
|
1910 {
|
|
1911 (*clen)++;
|
|
1912 (*crev)++;
|
|
1913 if (*q++ & 0x80) q++;
|
|
1914 }
|
|
1915 while (q < p + len)
|
|
1916 {
|
|
1917 (*clen)++;
|
|
1918 if (*q++ & 0x80) q++;
|
|
1919 }
|
|
1920 }
|
|
1921 #endif /* CANNA_MULE */
|