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 #ifdef CANNA_MULE
|
|
497 unsigned char cbuf[4096];
|
|
498 #endif
|
|
499
|
|
500 CHECK_STRING (str);
|
448
|
501 ksv.buffer = (unsigned char *) key_buffer;
|
428
|
502 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
503 #ifndef CANNA_MULE
|
|
504 ks.echoStr = XSTRING_DATA (str);
|
|
505 ks.length = XSTRING_LENGTH (str);
|
|
506 #else /* CANNA_MULE */
|
|
507 m2c (XSTRING_DATA (str), XSTRING_LENGTH (str), cbuf);
|
|
508 ks.echoStr = cbuf;
|
|
509 ks.length = strlen (cbuf);
|
|
510 #endif /* CANNA_MULE */
|
|
511 ksv.ks = &ks;
|
|
512 len = jrKanjiControl (0, KC_DEFINEKANJI, (char *)&ksv);
|
793
|
513 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
514 }
|
|
515
|
|
516 DEFUN ("canna-set-width", Fcanna_set_width, 1, 1, 0, /*
|
|
517 Set status-line width information, which is used to display
|
|
518 kanji candidates.
|
|
519 */
|
|
520 (num))
|
|
521 {
|
|
522 CHECK_INT (num);
|
|
523
|
|
524 jrKanjiControl (0, KC_SETWIDTH, (char *) XINT (num));
|
|
525 return Qnil;
|
|
526 }
|
|
527
|
|
528 DEFUN ("canna-change-mode", Fcanna_change_mode, 1, 1, 0, /*
|
|
529 Change Japanese pre-edit mode.
|
|
530 */
|
|
531 (num))
|
|
532 {
|
|
533 jrKanjiStatusWithValue ksv;
|
|
534 jrKanjiStatus ks;
|
|
535
|
|
536 CHECK_INT (num);
|
|
537
|
448
|
538 ksv.buffer = (unsigned char *) key_buffer;
|
428
|
539 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
540 ksv.ks = &ks;
|
|
541 ksv.val = XINT (num);
|
|
542 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv);
|
793
|
543 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
544 }
|
|
545
|
442
|
546 static Lisp_Object
|
428
|
547 CANNA_mode_keys (void)
|
|
548 {
|
|
549 #define CANNAWORKBUFSIZE 32
|
|
550 char xxx[CANNAWORKBUFSIZE];
|
|
551 Lisp_Object val;
|
|
552 int i, n;
|
|
553
|
|
554 n = jrKanjiControl (0, KC_MODEKEYS, xxx);
|
|
555 val = Qnil;
|
|
556 for (i = n ; i > 0 ;)
|
|
557 {
|
|
558 --i;
|
|
559 /* !!#### something fucked here */
|
|
560 val = Fcons (make_char ((int)(0xFF & (unsigned char) xxx[i])), val);
|
|
561 }
|
|
562 return val;
|
|
563 }
|
|
564
|
|
565 DEFUN ("canna-store-yomi", Fcanna_store_yomi, 1, 2, 0, /*
|
|
566 Store yomi characters as a YOMI of kana-to-kanji conversion.
|
|
567 */
|
|
568 (yomi, roma))
|
|
569 {
|
|
570 jrKanjiStatusWithValue ksv;
|
|
571 jrKanjiStatus ks;
|
|
572
|
|
573 CHECK_STRING (yomi);
|
|
574 #ifndef CANNA_MULE
|
448
|
575 strncpy (key_buffer, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi));
|
428
|
576 ks.length = XSTRING_LENGTH (yomi);
|
448
|
577 key_buffer[ks.length] = '\0';
|
428
|
578 #else /* CANNA_MULE */
|
448
|
579 m2c (XSTRING_DATA (yomi), XSTRING_LENGTH (yomi), key_buffer);
|
|
580 ks.length = strlen (key_buffer);
|
428
|
581 #endif /* CANNA_MULE */
|
|
582
|
|
583 if (NILP (roma))
|
|
584 {
|
|
585 ks.mode = 0;
|
|
586 }
|
|
587 else
|
|
588 {
|
|
589 CHECK_STRING (roma);
|
|
590
|
|
591 #ifndef CANNA_MULE
|
448
|
592 strncpy (key_buffer + XSTRING_LENGTH (yomi) + 1, XSTRING_DATA (roma),
|
428
|
593 XSTRING_LENGTH (roma));
|
448
|
594 key_buffer[XSTRING_LENGTH (yomi) + 1 + XSTRING_LENGTH (roma)] = '\0';
|
|
595 ks.mode = (unsigned char *)(key_buffer + XSTRING_LENGTH (yomi) + 1);
|
428
|
596 #else /* CANNA_MULE */
|
448
|
597 ks.mode = (unsigned char *)(key_buffer + ks.length + 1);
|
428
|
598 m2c (XSTRING_DATA (roma), XSTRING_LENGTH (roma), ks.mode);
|
|
599 #endif /* CANNA_MULE */
|
|
600 }
|
|
601
|
448
|
602 ks.echoStr = (unsigned char *) key_buffer;
|
|
603 ksv.buffer = (unsigned char *) key_buffer; /* ÊÖÃÍÍÑ (return value) */
|
428
|
604 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
605 ksv.ks = &ks;
|
|
606
|
|
607 jrKanjiControl (0, KC_STOREYOMI, (char *)&ksv);
|
|
608
|
448
|
609 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
610 }
|
|
611
|
|
612 DEFUN ("canna-do-function", Fcanna_do_function, 1, 2, 0, /*
|
|
613 Do specified function at current mode.
|
|
614 */
|
|
615 (num, ch))
|
|
616 {
|
|
617 jrKanjiStatusWithValue ksv;
|
|
618 jrKanjiStatus ks;
|
|
619
|
|
620 CHECK_INT (num);
|
|
621
|
|
622 if (NILP (ch))
|
|
623 {
|
448
|
624 *key_buffer = '@';
|
428
|
625 }
|
|
626 else
|
|
627 {
|
|
628 CHECK_CHAR (ch);
|
448
|
629 *key_buffer = XCHAR (ch);
|
428
|
630 }
|
|
631
|
448
|
632 ksv.buffer = (unsigned char *) key_buffer;
|
428
|
633 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
634 ksv.ks = &ks;
|
|
635 ksv.val = XINT (num);
|
|
636 jrKanjiControl (0, KC_DO, (char *) &ksv);
|
793
|
637 return storeResults (key_buffer, ksv.val, ksv.ks);
|
428
|
638 }
|
|
639
|
|
640 DEFUN ("canna-parse", Fcanna_parse, 1, 1, 0, /*
|
|
641 Parse customize string.
|
|
642 */
|
|
643 (str))
|
|
644 {
|
|
645 Lisp_Object val;
|
|
646 unsigned char **p;
|
|
647 int n;
|
|
648
|
|
649 CHECK_STRING (str);
|
|
650
|
|
651 #ifndef CANNA_MULE
|
448
|
652 strncpy (key_buffer, XSTRING_DATA (str), XSTRING_LENGTH (str));
|
|
653 key_buffer[XSTRING_LENGTH (str)] = '\0';
|
428
|
654 #else /* CANNA_MULE */
|
448
|
655 m2c (XSTRING_DATA (str), XSTRING_LENGTH (str), key_buffer);
|
428
|
656 #endif /* CANNA_MULE */
|
448
|
657 p = (unsigned char**) key_buffer;
|
428
|
658 n = jrKanjiControl (0, KC_PARSE, (char *) &p);
|
|
659 val = Qnil;
|
|
660 while (n > 0)
|
|
661 {
|
|
662 n--;
|
|
663 val = Fcons (make_string (p[n], strlen (p[n])), val);
|
|
664 }
|
|
665 return val;
|
|
666 }
|
|
667
|
|
668 DEFUN ("canna-query-mode", Fcanna_query_mode, 0, 0, 0, /*
|
|
669 Get current mode string.
|
|
670 */
|
|
671 ())
|
|
672 {
|
|
673 unsigned char buf[256];
|
|
674
|
|
675 jrKanjiControl (0, KC_QUERYMODE, buf);
|
|
676 return make_string (buf, strlen (buf));
|
|
677 }
|
|
678
|
|
679 /*
|
|
680 * Functions following this line are for KKCP interface compatible
|
|
681 * library. These functions may be used by MILK system.
|
|
682 */
|
|
683
|
|
684 #define RKBUFSIZE 1024
|
|
685
|
|
686 static unsigned char yomibuf[RKBUFSIZE];
|
|
687 static short kugiri[RKBUFSIZE / 2];
|
|
688
|
|
689 static int
|
|
690 confirmContext (void)
|
|
691 {
|
|
692 if (IRCP_context < 0)
|
|
693 {
|
|
694 int context;
|
|
695
|
|
696 if ((context = jrKanjiControl (0, KC_GETCONTEXT, (char *) 0)) == -1)
|
|
697 {
|
|
698 return 0;
|
|
699 }
|
|
700 IRCP_context = context;
|
|
701 }
|
|
702 return 1;
|
|
703 }
|
|
704
|
|
705 static int
|
|
706 byteLen (int bun, int len)
|
|
707 {
|
|
708 int i = 0, offset = 0, ch;
|
|
709
|
|
710 if (0 <= bun && bun < RKBUFSIZE)
|
|
711 {
|
|
712 offset = kugiri[bun];
|
|
713 }
|
|
714
|
|
715 while (len-- > 0 && (ch = (int) yomibuf[offset + i]))
|
|
716 {
|
|
717 i++;
|
|
718 if (ch & 0x80)
|
|
719 {
|
|
720 i++;
|
|
721 }
|
|
722 }
|
|
723 return i;
|
|
724 }
|
|
725
|
|
726 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /*
|
442
|
727 Return the result of kana-to-kanji conversion.
|
|
728 Clause separator is set.
|
428
|
729 */
|
|
730 (yomi))
|
|
731 {
|
|
732 int nbun;
|
|
733
|
|
734 CHECK_STRING (yomi);
|
|
735 if (confirmContext () == 0)
|
|
736 {
|
|
737 return Qnil;
|
|
738 }
|
|
739 #ifndef CANNA_MULE
|
|
740 strncpy (yomibuf, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi));
|
|
741 yomibuf[XSTRING_LENGTH (yomi)] = '\0';
|
|
742 nbun = RkBgnBun (IRCP_context, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi),
|
|
743 (RK_XFER << RK_XFERBITS) | RK_KFER);
|
|
744 #else /* CANNA_MULE */
|
|
745 m2c (XSTRING_DATA (yomi), XSTRING_LENGTH (yomi), yomibuf);
|
|
746 nbun = RkBgnBun (IRCP_context, (char *) yomibuf, strlen (yomibuf),
|
|
747 (RK_XFER << RK_XFERBITS) | RK_KFER);
|
|
748 #endif /* CANNA_MULE */
|
|
749
|
|
750 return kanjiYomiList (IRCP_context, nbun);
|
|
751 }
|
|
752
|
|
753 static Lisp_Object
|
|
754 kanjiYomiList (int context, int nbun)
|
|
755 {
|
|
756 Lisp_Object val, res = Qnil;
|
|
757 unsigned char RkBuf[RKBUFSIZE];
|
|
758 int len, i, total;
|
|
759
|
|
760 for (i = nbun ; i > 0 ; )
|
|
761 {
|
|
762 i--;
|
|
763 RkGoTo (context, i);
|
|
764 len = RkGetKanji (context, RkBuf, RKBUFSIZE);
|
|
765 val = make_string (RkBuf, len);
|
|
766 len = RkGetYomi (context, RkBuf, RKBUFSIZE);
|
|
767 res = Fcons (Fcons (val, make_string (RkBuf, len)), res);
|
|
768 if (i < RKBUFSIZE / 2)
|
|
769 {
|
|
770 kugiri[i] = len;
|
|
771 }
|
|
772 }
|
|
773 for (i = 0, total = 0 ; i < nbun ; i++)
|
|
774 {
|
|
775 int temp = kugiri[i];
|
|
776 kugiri[i] = total;
|
|
777 total += temp;
|
|
778 }
|
|
779 return res;
|
|
780 }
|
|
781
|
|
782 DEFUN ("canna-henkan-next", Fcanna_henkan_next, 1, 1, 0, /*
|
442
|
783 Return the list of candidates.
|
428
|
784 */
|
|
785 (bunsetsu))
|
|
786 {
|
|
787 int i, slen, len;
|
|
788 unsigned char *p, RkBuf[RKBUFSIZE];
|
|
789 Lisp_Object res = Qnil, endp;
|
|
790
|
|
791 CHECK_INT (bunsetsu);
|
|
792 if (confirmContext () == 0)
|
|
793 {
|
|
794 return Qnil;
|
|
795 }
|
|
796 RkGoTo (IRCP_context, XINT (bunsetsu));
|
|
797 len = RkGetKanjiList (IRCP_context, RkBuf, RKBUFSIZE);
|
|
798 p = RkBuf;
|
|
799 for (i = 0 ; i < len ; i++)
|
|
800 {
|
|
801 slen = strlen (p);
|
|
802 if (NILP(res))
|
|
803 {
|
|
804 endp = res = Fcons (make_string (p, slen), Qnil);
|
|
805 }
|
|
806 else
|
|
807 {
|
442
|
808 endp = XCDR (res) = Fcons (make_string (p, slen), Qnil);
|
428
|
809 }
|
|
810 p += slen + 1;
|
|
811 }
|
|
812 return res;
|
|
813 }
|
|
814
|
|
815 DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, 2, 2, 0, /*
|
442
|
816 Specify the length of a clause.
|
428
|
817 */
|
|
818 (bunsetsu, bunlen))
|
|
819 {
|
|
820 int nbun, len;
|
|
821
|
|
822 CHECK_INT (bunsetsu);
|
|
823 CHECK_INT (bunlen);
|
|
824
|
|
825 nbun = XINT (bunsetsu);
|
|
826 if (confirmContext () == 0)
|
|
827 {
|
|
828 return Qnil;
|
|
829 }
|
|
830 RkGoTo (IRCP_context, nbun);
|
|
831 len = byteLen (nbun, XINT (bunlen));
|
|
832 return kanjiYomiList (IRCP_context, RkResize (IRCP_context, len));
|
|
833 }
|
|
834
|
|
835 DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, 2, 2, 0, /*
|
442
|
836 Select a candidate.
|
428
|
837 */
|
|
838 (bun, kouho))
|
|
839 {
|
|
840 int nbun, nkouho;
|
|
841
|
|
842 if (confirmContext () == 0)
|
|
843 {
|
|
844 return Qnil;
|
|
845 }
|
|
846 nbun = XINT(bun);
|
|
847 RkGoTo (IRCP_context, nbun);
|
|
848
|
|
849 nkouho = XINT(kouho);
|
|
850 RkXfer (IRCP_context, nkouho);
|
|
851 return Qt;
|
|
852 }
|
|
853
|
|
854 DEFUN ("canna-henkan-end", Fcanna_henkan_end, 0, 0, 0, /*
|
442
|
855 End conversion.
|
428
|
856 */
|
|
857 ())
|
|
858 {
|
|
859 if (confirmContext () == 0)
|
|
860 {
|
|
861 return Qnil;
|
|
862 }
|
448
|
863 RkEndBun (IRCP_context, 1); /* ³Ø½¬¤Ï¤¤¤Ä¤Ç¤â¹Ô¤Ã¤ÆÎɤ¤¤â¤Î¤Ê¤Î¤«¡©
|
|
864 (is it OK to invoke learning function
|
|
865 at arbitrary times?) */
|
428
|
866 return Qt;
|
|
867 }
|
|
868
|
|
869 DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, 0, 0, 0, /*
|
442
|
870 Quit conversion.
|
428
|
871 */
|
|
872 ())
|
|
873 {
|
|
874 if (confirmContext () == 0)
|
|
875 {
|
|
876 return Qnil;
|
|
877 }
|
|
878 RkEndBun (IRCP_context, 0);
|
|
879 return Qt;
|
|
880 }
|
|
881
|
|
882 /* variables below this line is constants of Canna */
|
|
883
|
458
|
884 static Fixnum canna_mode_AlphaMode;
|
|
885 static Fixnum canna_mode_EmptyMode;
|
|
886 static Fixnum canna_mode_KigoMode;
|
|
887 static Fixnum canna_mode_YomiMode;
|
|
888 static Fixnum canna_mode_JishuMode;
|
|
889 static Fixnum canna_mode_TankouhoMode;
|
|
890 static Fixnum canna_mode_IchiranMode;
|
|
891 static Fixnum canna_mode_YesNoMode;
|
|
892 static Fixnum canna_mode_OnOffMode;
|
428
|
893 #ifdef CANNA_MODE_AdjustBunsetsuMode
|
458
|
894 static Fixnum canna_mode_AdjustBunsetsuMode;
|
428
|
895 #endif
|
|
896 #ifdef CANNA_MODE_ChikujiYomiMode
|
458
|
897 static Fixnum canna_mode_ChikujiYomiMode;
|
|
898 static Fixnum canna_mode_ChikujiTanMode;
|
428
|
899 #endif
|
|
900
|
458
|
901 static Fixnum canna_mode_HenkanMode;
|
428
|
902 #ifdef CANNA_MODE_HenkanNyuryokuMode
|
458
|
903 static Fixnum canna_mode_HenkanNyuryokuMode;
|
428
|
904 #endif
|
|
905 #ifdef CANNA_MODE_ZenHiraHenkanMode
|
458
|
906 static Fixnum canna_mode_ZenHiraHenkanMode;
|
428
|
907 #ifdef CANNA_MODE_HanHiraHenkanMode
|
458
|
908 static Fixnum canna_mode_HanHiraHenkanMode;
|
428
|
909 #endif
|
458
|
910 static Fixnum canna_mode_ZenKataHenkanMode;
|
|
911 static Fixnum canna_mode_HanKataHenkanMode;
|
|
912 static Fixnum canna_mode_ZenAlphaHenkanMode;
|
|
913 static Fixnum canna_mode_HanAlphaHenkanMode;
|
428
|
914 #endif
|
458
|
915 static Fixnum canna_mode_ZenHiraKakuteiMode;
|
428
|
916 #ifdef CANNA_MODE_HanHiraKakuteiMode
|
458
|
917 static Fixnum canna_mode_HanHiraKakuteiMode;
|
428
|
918 #endif
|
458
|
919 static Fixnum canna_mode_ZenKataKakuteiMode;
|
|
920 static Fixnum canna_mode_HanKataKakuteiMode;
|
|
921 static Fixnum canna_mode_ZenAlphaKakuteiMode;
|
|
922 static Fixnum canna_mode_HanAlphaKakuteiMode;
|
|
923 static Fixnum canna_mode_HexMode;
|
|
924 static Fixnum canna_mode_BushuMode;
|
|
925 static Fixnum canna_mode_ExtendMode;
|
|
926 static Fixnum canna_mode_RussianMode;
|
|
927 static Fixnum canna_mode_GreekMode;
|
|
928 static Fixnum canna_mode_LineMode;
|
|
929 static Fixnum canna_mode_ChangingServerMode;
|
|
930 static Fixnum canna_mode_HenkanMethodMode;
|
|
931 static Fixnum canna_mode_DeleteDicMode;
|
|
932 static Fixnum canna_mode_TourokuMode;
|
|
933 static Fixnum canna_mode_TourokuEmptyMode;
|
|
934 static Fixnum canna_mode_TourokuHinshiMode;
|
|
935 static Fixnum canna_mode_TourokuDicMode;
|
|
936 static Fixnum canna_mode_QuotedInsertMode;
|
|
937 static Fixnum canna_mode_BubunMuhenkanMode;
|
|
938 static Fixnum canna_mode_MountDicMode;
|
428
|
939
|
458
|
940 static Fixnum canna_fn_SelfInsert;
|
|
941 static Fixnum canna_fn_FunctionalInsert;
|
|
942 static Fixnum canna_fn_QuotedInsert;
|
|
943 static Fixnum canna_fn_JapaneseMode;
|
|
944 static Fixnum canna_fn_AlphaMode;
|
|
945 static Fixnum canna_fn_HenkanNyuryokuMode;
|
|
946 static Fixnum canna_fn_Forward;
|
|
947 static Fixnum canna_fn_Backward;
|
|
948 static Fixnum canna_fn_Next;
|
|
949 static Fixnum canna_fn_Prev;
|
|
950 static Fixnum canna_fn_BeginningOfLine;
|
|
951 static Fixnum canna_fn_EndOfLine;
|
|
952 static Fixnum canna_fn_DeleteNext;
|
|
953 static Fixnum canna_fn_DeletePrevious;
|
|
954 static Fixnum canna_fn_KillToEndOfLine;
|
|
955 static Fixnum canna_fn_Henkan;
|
|
956 static Fixnum canna_fn_Kakutei;
|
|
957 static Fixnum canna_fn_Extend;
|
|
958 static Fixnum canna_fn_Shrink;
|
428
|
959 #ifdef CANNA_FN_AdjustBunsetsu
|
458
|
960 static Fixnum canna_fn_AdjustBunsetsu;
|
428
|
961 #endif
|
458
|
962 static Fixnum canna_fn_Quit;
|
|
963 static Fixnum canna_fn_ConvertAsHex;
|
|
964 static Fixnum canna_fn_ConvertAsBushu;
|
|
965 static Fixnum canna_fn_KouhoIchiran;
|
|
966 static Fixnum canna_fn_BubunMuhenkan;
|
|
967 static Fixnum canna_fn_Zenkaku;
|
|
968 static Fixnum canna_fn_Hankaku;
|
|
969 static Fixnum canna_fn_ToUpper;
|
|
970 static Fixnum canna_fn_Capitalize;
|
|
971 static Fixnum canna_fn_ToLower;
|
|
972 static Fixnum canna_fn_Hiragana;
|
|
973 static Fixnum canna_fn_Katakana;
|
|
974 static Fixnum canna_fn_Romaji;
|
428
|
975 #ifdef CANNA_FN_BaseHiragana
|
458
|
976 static Fixnum canna_fn_BaseHiragana;
|
|
977 static Fixnum canna_fn_BaseKatakana;
|
|
978 static Fixnum canna_fn_BaseEisu;
|
|
979 static Fixnum canna_fn_BaseZenkaku;
|
|
980 static Fixnum canna_fn_BaseHankaku;
|
|
981 static Fixnum canna_fn_BaseKana;
|
|
982 static Fixnum canna_fn_BaseKakutei;
|
|
983 static Fixnum canna_fn_BaseHenkan;
|
|
984 static Fixnum canna_fn_BaseHiraKataToggle;
|
|
985 static Fixnum canna_fn_BaseZenHanToggle;
|
|
986 static Fixnum canna_fn_BaseKanaEisuToggle;
|
|
987 static Fixnum canna_fn_BaseKakuteiHenkanToggle;
|
|
988 static Fixnum canna_fn_BaseRotateForward;
|
|
989 static Fixnum canna_fn_BaseRotateBackward;
|
428
|
990 #endif
|
458
|
991 static Fixnum canna_fn_ExtendMode;
|
|
992 static Fixnum canna_fn_Touroku;
|
|
993 static Fixnum canna_fn_HexMode;
|
|
994 static Fixnum canna_fn_BushuMode;
|
|
995 static Fixnum canna_fn_KigouMode;
|
428
|
996 #ifdef CANNA_FN_Mark
|
458
|
997 static Fixnum canna_fn_Mark;
|
428
|
998 #endif
|
|
999 #ifdef CANNA_FN_TemporalMode
|
458
|
1000 static Fixnum canna_fn_TemporalMode;
|
428
|
1001 #endif
|
|
1002
|
458
|
1003 static Fixnum canna_key_Nfer;
|
|
1004 static Fixnum canna_key_Xfer;
|
|
1005 static Fixnum canna_key_Up;
|
|
1006 static Fixnum canna_key_Left;
|
|
1007 static Fixnum canna_key_Right;
|
|
1008 static Fixnum canna_key_Down;
|
|
1009 static Fixnum canna_key_Insert;
|
|
1010 static Fixnum canna_key_Rollup;
|
|
1011 static Fixnum canna_key_Rolldown;
|
|
1012 static Fixnum canna_key_Home;
|
|
1013 static Fixnum canna_key_Help;
|
|
1014 static Fixnum canna_key_KP_Key;
|
|
1015 static Fixnum canna_key_Shift_Nfer;
|
|
1016 static Fixnum canna_key_Shift_Xfer;
|
|
1017 static Fixnum canna_key_Shift_Up;
|
|
1018 static Fixnum canna_key_Shift_Left;
|
|
1019 static Fixnum canna_key_Shift_Right;
|
|
1020 static Fixnum canna_key_Shift_Down;
|
|
1021 static Fixnum canna_key_Cntrl_Nfer;
|
|
1022 static Fixnum canna_key_Cntrl_Xfer;
|
|
1023 static Fixnum canna_key_Cntrl_Up;
|
|
1024 static Fixnum canna_key_Cntrl_Left;
|
|
1025 static Fixnum canna_key_Cntrl_Right;
|
|
1026 static Fixnum canna_key_Cntrl_Down;
|
428
|
1027
|
|
1028 Lisp_Object VCANNA; /* by MORIOKA Tomohiko <morioka@jaist.ac.jp>
|
|
1029 1996/6/7 */
|
|
1030
|
|
1031 void
|
|
1032 syms_of_mule_canna (void)
|
|
1033 {
|
|
1034 DEFSUBR (Fcanna_key_proc);
|
|
1035 DEFSUBR (Fcanna_initialize);
|
|
1036 DEFSUBR (Fcanna_finalize);
|
|
1037 DEFSUBR (Fcanna_touroku_string);
|
|
1038 DEFSUBR (Fcanna_set_width);
|
|
1039 DEFSUBR (Fcanna_change_mode);
|
|
1040 DEFSUBR (Fcanna_store_yomi);
|
|
1041 DEFSUBR (Fcanna_do_function);
|
|
1042 DEFSUBR (Fcanna_parse);
|
|
1043 DEFSUBR (Fcanna_query_mode);
|
|
1044 DEFSUBR (Fcanna_set_bunsetsu);
|
|
1045
|
|
1046 DEFSUBR (Fcanna_henkan_begin);
|
|
1047 DEFSUBR (Fcanna_henkan_next);
|
|
1048 DEFSUBR (Fcanna_bunsetu_henkou);
|
|
1049 DEFSUBR (Fcanna_henkan_kakutei);
|
|
1050 DEFSUBR (Fcanna_henkan_end);
|
|
1051 DEFSUBR (Fcanna_henkan_quit);
|
|
1052 }
|
|
1053
|
|
1054 void
|
|
1055 vars_of_mule_canna (void)
|
|
1056 {
|
|
1057 DEFVAR_LISP ("CANNA", &VCANNA); /* hir@nec, 1992.5.21 */
|
|
1058 VCANNA = Qt; /* hir@nec, 1992.5.21 */
|
|
1059
|
|
1060 DEFVAR_LISP ("canna-kakutei-string", &Vcanna_kakutei_string /*
|
|
1061
|
|
1062 */ );
|
|
1063 Vcanna_kakutei_string = Qnil;
|
|
1064
|
|
1065 DEFVAR_LISP ("canna-kakutei-yomi", &Vcanna_kakutei_yomi /*
|
|
1066
|
|
1067 */ );
|
|
1068 Vcanna_kakutei_yomi = Qnil;
|
|
1069
|
|
1070 DEFVAR_LISP ("canna-kakutei-romaji", &Vcanna_kakutei_romaji /*
|
|
1071
|
|
1072 */ );
|
|
1073 Vcanna_kakutei_romaji = Qnil;
|
|
1074
|
|
1075 DEFVAR_LISP ("canna-henkan-string", &Vcanna_henkan_string /*
|
|
1076
|
|
1077 */ );
|
|
1078 Vcanna_henkan_string = Qnil;
|
|
1079
|
|
1080 DEFVAR_INT ("canna-henkan-length", &canna_henkan_length /*
|
|
1081
|
|
1082 */ );
|
|
1083 canna_henkan_length = 0;
|
|
1084
|
|
1085 DEFVAR_INT ("canna-henkan-revpos", &canna_henkan_revPos /*
|
|
1086
|
|
1087 */ );
|
|
1088 canna_henkan_revPos = 0;
|
|
1089
|
|
1090 DEFVAR_INT ("canna-henkan-revlen", &canna_henkan_revLen /*
|
|
1091
|
|
1092 */ );
|
|
1093 canna_henkan_revLen = 0;
|
|
1094
|
|
1095 DEFVAR_LISP ("canna-ichiran-string", &Vcanna_ichiran_string /*
|
|
1096
|
|
1097 */ );
|
|
1098 Vcanna_ichiran_string = Qnil;
|
|
1099
|
|
1100 DEFVAR_INT ("canna-ichiran-length", &canna_ichiran_length /*
|
|
1101
|
|
1102 */ );
|
|
1103 canna_ichiran_length = 0;
|
|
1104
|
|
1105 DEFVAR_INT ("canna-ichiran-revpos", &canna_ichiran_revPos /*
|
|
1106
|
|
1107 */ );
|
|
1108 canna_ichiran_revPos = 0;
|
|
1109
|
|
1110 DEFVAR_INT ("canna-ichiran-revlen", &canna_ichiran_revLen /*
|
|
1111
|
|
1112 */ );
|
|
1113 canna_ichiran_revLen = 0;
|
|
1114
|
|
1115 DEFVAR_LISP ("canna-mode-string", &Vcanna_mode_string /*
|
|
1116
|
|
1117 */ );
|
|
1118 Vcanna_mode_string = Qnil;
|
|
1119
|
|
1120 DEFVAR_BOOL ("canna-empty-info", &canna_empty_info /*
|
|
1121 For canna
|
|
1122 */ );
|
|
1123 canna_empty_info = 0;
|
|
1124
|
|
1125 DEFVAR_BOOL ("canna-through-info", &canna_through_info /*
|
|
1126 For canna
|
|
1127 */ );
|
|
1128 canna_through_info = 0;
|
|
1129
|
|
1130 DEFVAR_BOOL ("canna-underline", &canna_underline /*
|
|
1131 For canna
|
|
1132 */ );
|
|
1133 canna_underline = 0;
|
|
1134
|
|
1135 DEFVAR_BOOL ("canna-inhibit-hankakukana", &canna_inhibit_hankakukana /*
|
|
1136 For canna
|
|
1137 */ );
|
|
1138 canna_inhibit_hankakukana = 0;
|
|
1139
|
|
1140 DEFVAR_INT ("canna-mode-alpha-mode", &canna_mode_AlphaMode /*
|
|
1141
|
|
1142 */ );
|
|
1143 canna_mode_AlphaMode = IROHA_MODE_AlphaMode;
|
|
1144
|
|
1145 DEFVAR_INT ("canna-mode-empty-mode", &canna_mode_EmptyMode /*
|
|
1146
|
|
1147 */ );
|
|
1148 canna_mode_EmptyMode = IROHA_MODE_EmptyMode;
|
|
1149
|
|
1150 DEFVAR_INT ("canna-mode-kigo-mode", &canna_mode_KigoMode /*
|
|
1151
|
|
1152 */ );
|
|
1153 canna_mode_KigoMode = IROHA_MODE_KigoMode;
|
|
1154
|
|
1155 DEFVAR_INT ("canna-mode-yomi-mode", &canna_mode_YomiMode /*
|
|
1156
|
|
1157 */ );
|
|
1158 canna_mode_YomiMode = IROHA_MODE_YomiMode;
|
|
1159
|
|
1160 DEFVAR_INT ("canna-mode-jishu-mode", &canna_mode_JishuMode /*
|
|
1161
|
|
1162 */ );
|
|
1163 canna_mode_JishuMode = IROHA_MODE_JishuMode;
|
|
1164
|
|
1165 DEFVAR_INT ("canna-mode-tankouho-mode", &canna_mode_TankouhoMode /*
|
|
1166
|
|
1167 */ );
|
|
1168 canna_mode_TankouhoMode = IROHA_MODE_TankouhoMode;
|
|
1169
|
|
1170 DEFVAR_INT ("canna-mode-ichiran-mode", &canna_mode_IchiranMode /*
|
|
1171
|
|
1172 */ );
|
|
1173 canna_mode_IchiranMode = IROHA_MODE_IchiranMode;
|
|
1174
|
|
1175 DEFVAR_INT ("canna-mode-yes-no-mode", &canna_mode_YesNoMode /*
|
|
1176
|
|
1177 */ );
|
|
1178 canna_mode_YesNoMode = IROHA_MODE_YesNoMode;
|
|
1179
|
|
1180 DEFVAR_INT ("canna-mode-on-off-mode", &canna_mode_OnOffMode /*
|
|
1181
|
|
1182 */ );
|
|
1183 canna_mode_OnOffMode = IROHA_MODE_OnOffMode;
|
|
1184
|
|
1185 #ifdef CANNA_MODE_AdjustBunsetsuMode
|
|
1186 DEFVAR_INT ("canna-mode-adjust-bunsetsu-mode",
|
|
1187 &canna_mode_AdjustBunsetsuMode /*
|
|
1188
|
|
1189 */ );
|
|
1190 canna_mode_AdjustBunsetsuMode = CANNA_MODE_AdjustBunsetsuMode;
|
|
1191 #endif
|
|
1192 #ifdef CANNA_MODE_ChikujiYomiMode
|
|
1193 DEFVAR_INT ("canna-mode-chikuji-yomi-mode", &canna_mode_ChikujiYomiMode /*
|
|
1194
|
|
1195 */ );
|
|
1196 canna_mode_ChikujiYomiMode = CANNA_MODE_ChikujiYomiMode;
|
|
1197
|
|
1198 DEFVAR_INT ("canna-mode-chikuji-bunsetsu-mode",
|
|
1199 &canna_mode_ChikujiTanMode /*
|
|
1200
|
|
1201 */ );
|
|
1202 canna_mode_ChikujiTanMode = CANNA_MODE_ChikujiTanMode;
|
|
1203 #endif
|
|
1204
|
|
1205 DEFVAR_INT ("canna-mode-henkan-mode", &canna_mode_HenkanMode /*
|
|
1206
|
|
1207 */ );
|
|
1208 canna_mode_HenkanMode = IROHA_MODE_HenkanMode;
|
|
1209
|
|
1210 #ifdef CANNA_MODE_HenkanNyuryokuMode
|
|
1211 DEFVAR_INT ("canna-mode-henkan-nyuuryoku-mode",
|
|
1212 &canna_mode_HenkanNyuryokuMode /*
|
|
1213
|
|
1214 */ );
|
|
1215 canna_mode_HenkanNyuryokuMode = CANNA_MODE_HenkanNyuryokuMode;
|
|
1216 #endif
|
|
1217 #ifdef CANNA_MODE_ZenHiraHenkanMode
|
|
1218 DEFVAR_INT ("canna-mode-zen-hira-henkan-mode",
|
|
1219 &canna_mode_ZenHiraHenkanMode /*
|
|
1220
|
|
1221 */ );
|
|
1222 canna_mode_ZenHiraHenkanMode = CANNA_MODE_ZenHiraHenkanMode;
|
|
1223 #ifdef CANNA_MODE_HanHiraHenkanMode
|
|
1224 DEFVAR_INT ("canna-mode-han-hira-henkan-mode",
|
|
1225 &canna_mode_HanHiraHenkanMode /*
|
|
1226
|
|
1227 */ );
|
|
1228 canna_mode_HanHiraHenkanMode = CANNA_MODE_HanHiraHenkanMode;
|
|
1229 #endif
|
|
1230 DEFVAR_INT ("canna-mode-zen-kata-henkan-mode",
|
|
1231 &canna_mode_ZenKataHenkanMode /*
|
|
1232
|
|
1233 */ );
|
|
1234 canna_mode_ZenKataHenkanMode = CANNA_MODE_ZenKataHenkanMode;
|
|
1235
|
|
1236 DEFVAR_INT ("canna-mode-han-kata-henkan-mode",
|
|
1237 &canna_mode_HanKataHenkanMode /*
|
|
1238
|
|
1239 */ );
|
|
1240 canna_mode_HanKataHenkanMode = CANNA_MODE_HanKataHenkanMode;
|
|
1241
|
|
1242 DEFVAR_INT ("canna-mode-zen-alpha-henkan-mode",
|
|
1243 &canna_mode_ZenAlphaHenkanMode /*
|
|
1244
|
|
1245 */ );
|
|
1246 canna_mode_ZenAlphaHenkanMode = CANNA_MODE_ZenAlphaHenkanMode;
|
|
1247
|
|
1248 DEFVAR_INT ("canna-mode-han-alpha-henkan-mode",
|
|
1249 &canna_mode_HanAlphaHenkanMode /*
|
|
1250
|
|
1251 */ );
|
|
1252 canna_mode_HanAlphaHenkanMode = CANNA_MODE_HanAlphaHenkanMode;
|
|
1253 #endif
|
|
1254 DEFVAR_INT ("canna-mode-zen-hira-kakutei-mode",
|
|
1255 &canna_mode_ZenHiraKakuteiMode /*
|
|
1256
|
|
1257 */ );
|
|
1258 canna_mode_ZenHiraKakuteiMode = IROHA_MODE_ZenHiraKakuteiMode;
|
|
1259 #ifdef CANNA_MODE_HanHiraKakuteiMode
|
|
1260 DEFVAR_INT ("canna-mode-han-hira-kakutei-mode",
|
|
1261 &canna_mode_HanHiraKakuteiMode /*
|
|
1262
|
|
1263 */ );
|
|
1264 canna_mode_HanHiraKakuteiMode = CANNA_MODE_HanHiraKakuteiMode;
|
|
1265 #endif
|
|
1266 DEFVAR_INT ("canna-mode-zen-kata-kakutei-mode",
|
|
1267 &canna_mode_ZenKataKakuteiMode /*
|
|
1268
|
|
1269 */ );
|
|
1270 canna_mode_ZenKataKakuteiMode = IROHA_MODE_ZenKataKakuteiMode;
|
|
1271
|
|
1272 DEFVAR_INT ("canna-mode-han-kata-kakutei-mode",
|
|
1273 &canna_mode_HanKataKakuteiMode /*
|
|
1274
|
|
1275 */ );
|
|
1276 canna_mode_HanKataKakuteiMode = IROHA_MODE_HanKataKakuteiMode;
|
|
1277
|
|
1278 DEFVAR_INT ("canna-mode-zen-alpha-kakutei-mode",
|
|
1279 &canna_mode_ZenAlphaKakuteiMode /*
|
|
1280
|
|
1281 */ );
|
|
1282 canna_mode_ZenAlphaKakuteiMode = IROHA_MODE_ZenAlphaKakuteiMode;
|
|
1283
|
|
1284 DEFVAR_INT ("canna-mode-han-alpha-kakutei-mode",
|
|
1285 &canna_mode_HanAlphaKakuteiMode /*
|
|
1286
|
|
1287 */ );
|
|
1288 canna_mode_HanAlphaKakuteiMode = IROHA_MODE_HanAlphaKakuteiMode;
|
|
1289
|
|
1290 DEFVAR_INT ("canna-mode-hex-mode", &canna_mode_HexMode /*
|
|
1291
|
|
1292 */ );
|
|
1293 canna_mode_HexMode = IROHA_MODE_HexMode;
|
|
1294
|
|
1295 DEFVAR_INT ("canna-mode-bushu-mode", &canna_mode_BushuMode /*
|
|
1296
|
|
1297 */ );
|
|
1298 canna_mode_BushuMode = IROHA_MODE_BushuMode;
|
|
1299
|
|
1300 DEFVAR_INT ("canna-mode-extend-mode", &canna_mode_ExtendMode /*
|
|
1301
|
|
1302 */ );
|
|
1303 canna_mode_ExtendMode = IROHA_MODE_ExtendMode;
|
|
1304
|
|
1305 DEFVAR_INT ("canna-mode-russian-mode", &canna_mode_RussianMode /*
|
|
1306
|
|
1307 */ );
|
|
1308 canna_mode_RussianMode = IROHA_MODE_RussianMode;
|
|
1309
|
|
1310 DEFVAR_INT ("canna-mode-greek-mode", &canna_mode_GreekMode /*
|
|
1311
|
|
1312 */ );
|
|
1313 canna_mode_GreekMode = IROHA_MODE_GreekMode;
|
|
1314
|
|
1315 DEFVAR_INT ("canna-mode-line-mode", &canna_mode_LineMode /*
|
|
1316
|
|
1317 */ );
|
|
1318 canna_mode_LineMode = IROHA_MODE_LineMode;
|
|
1319
|
|
1320 DEFVAR_INT ("canna-mode-changing-server-mode",
|
|
1321 &canna_mode_ChangingServerMode /*
|
|
1322
|
|
1323 */ );
|
|
1324 canna_mode_ChangingServerMode = IROHA_MODE_ChangingServerMode;
|
|
1325
|
|
1326 DEFVAR_INT ("canna-mode-henkan-method-mode",
|
|
1327 &canna_mode_HenkanMethodMode /*
|
|
1328
|
|
1329 */ );
|
|
1330 canna_mode_HenkanMethodMode = IROHA_MODE_HenkanMethodMode;
|
|
1331
|
|
1332 DEFVAR_INT ("canna-mode-delete-dic-mode", &canna_mode_DeleteDicMode /*
|
|
1333
|
|
1334 */ );
|
|
1335 canna_mode_DeleteDicMode = IROHA_MODE_DeleteDicMode;
|
|
1336
|
|
1337 DEFVAR_INT ("canna-mode-touroku-mode", &canna_mode_TourokuMode /*
|
|
1338
|
|
1339 */ );
|
|
1340 canna_mode_TourokuMode = IROHA_MODE_TourokuMode;
|
|
1341
|
|
1342 DEFVAR_INT ("canna-mode-touroku-empty-mode",
|
|
1343 &canna_mode_TourokuEmptyMode /*
|
|
1344
|
|
1345 */ );
|
|
1346 canna_mode_TourokuEmptyMode = IROHA_MODE_TourokuEmptyMode;
|
|
1347
|
|
1348 DEFVAR_INT ("canna-mode-touroku-hinshi-mode",
|
|
1349 &canna_mode_TourokuHinshiMode /*
|
|
1350
|
|
1351 */ );
|
|
1352 canna_mode_TourokuHinshiMode = IROHA_MODE_TourokuHinshiMode;
|
|
1353
|
|
1354 DEFVAR_INT ("canna-mode-touroku-dic-mode", &canna_mode_TourokuDicMode /*
|
|
1355
|
|
1356 */ );
|
|
1357 canna_mode_TourokuDicMode = IROHA_MODE_TourokuDicMode;
|
|
1358
|
|
1359 DEFVAR_INT ("canna-mode-quoted-insert-mode",
|
|
1360 &canna_mode_QuotedInsertMode /*
|
|
1361
|
|
1362 */ );
|
|
1363 canna_mode_QuotedInsertMode = IROHA_MODE_QuotedInsertMode;
|
|
1364
|
|
1365 DEFVAR_INT ("canna-mode-bubun-muhenkan-mode",
|
|
1366 &canna_mode_BubunMuhenkanMode /*
|
|
1367
|
|
1368 */ );
|
|
1369 canna_mode_BubunMuhenkanMode = IROHA_MODE_BubunMuhenkanMode;
|
|
1370
|
|
1371 DEFVAR_INT ("canna-mode-mount-dic-mode", &canna_mode_MountDicMode /*
|
|
1372
|
|
1373 */ );
|
|
1374 canna_mode_MountDicMode = IROHA_MODE_MountDicMode;
|
|
1375
|
|
1376 DEFVAR_INT ("canna-func-self-insert", &canna_fn_SelfInsert /*
|
|
1377
|
|
1378 */ );
|
|
1379 canna_fn_SelfInsert = IROHA_FN_SelfInsert;
|
|
1380
|
|
1381 DEFVAR_INT ("canna-func-functional-insert", &canna_fn_FunctionalInsert /*
|
|
1382
|
|
1383 */ );
|
|
1384 canna_fn_FunctionalInsert = IROHA_FN_FunctionalInsert;
|
|
1385
|
|
1386 DEFVAR_INT ("canna-func-quoted-insert", &canna_fn_QuotedInsert /*
|
|
1387
|
|
1388 */ );
|
|
1389 canna_fn_QuotedInsert = IROHA_FN_QuotedInsert;
|
|
1390
|
|
1391 DEFVAR_INT ("canna-func-japanese-mode", &canna_fn_JapaneseMode /*
|
|
1392
|
|
1393 */ );
|
|
1394 canna_fn_JapaneseMode = IROHA_FN_JapaneseMode;
|
|
1395
|
|
1396 DEFVAR_INT ("canna-func-alpha-mode", &canna_fn_AlphaMode /*
|
|
1397
|
|
1398 */ );
|
|
1399 canna_fn_AlphaMode = IROHA_FN_AlphaMode;
|
|
1400
|
|
1401 DEFVAR_INT ("canna-func-henkan-nyuryoku-mode",
|
|
1402 &canna_fn_HenkanNyuryokuMode /*
|
|
1403
|
|
1404 */ );
|
|
1405 canna_fn_HenkanNyuryokuMode = IROHA_FN_HenkanNyuryokuMode;
|
|
1406
|
|
1407 DEFVAR_INT ("canna-func-forward", &canna_fn_Forward /*
|
|
1408
|
|
1409 */ );
|
|
1410 canna_fn_Forward = IROHA_FN_Forward;
|
|
1411
|
|
1412 DEFVAR_INT ("canna-func-backward", &canna_fn_Backward /*
|
|
1413
|
|
1414 */ );
|
|
1415 canna_fn_Backward = IROHA_FN_Backward;
|
|
1416
|
|
1417 DEFVAR_INT ("canna-func-next", &canna_fn_Next /*
|
|
1418
|
|
1419 */ );
|
|
1420 canna_fn_Next = IROHA_FN_Next;
|
|
1421
|
|
1422 DEFVAR_INT ("canna-func-previous", &canna_fn_Prev /*
|
|
1423
|
|
1424 */ );
|
|
1425 canna_fn_Prev = IROHA_FN_Prev;
|
|
1426
|
|
1427 DEFVAR_INT ("canna-func-beginning-of-line", &canna_fn_BeginningOfLine /*
|
|
1428
|
|
1429 */ );
|
|
1430 canna_fn_BeginningOfLine = IROHA_FN_BeginningOfLine;
|
|
1431
|
|
1432 DEFVAR_INT ("canna-func-end-of-line", &canna_fn_EndOfLine /*
|
|
1433
|
|
1434 */ );
|
|
1435 canna_fn_EndOfLine = IROHA_FN_EndOfLine;
|
|
1436
|
|
1437 DEFVAR_INT ("canna-func-delete-next", &canna_fn_DeleteNext /*
|
|
1438
|
|
1439 */ );
|
|
1440 canna_fn_DeleteNext = IROHA_FN_DeleteNext;
|
|
1441
|
460
|
1442 DEFVAR_INT ("canna-func-delete-previous", &canna_fn_DeletePrevious /*
|
428
|
1443
|
|
1444 */ );
|
|
1445 canna_fn_DeletePrevious = IROHA_FN_DeletePrevious;
|
|
1446
|
|
1447 DEFVAR_INT ("canna-func-kill-to-end-of-line", &canna_fn_KillToEndOfLine /*
|
|
1448
|
|
1449 */ );
|
|
1450 canna_fn_KillToEndOfLine = IROHA_FN_KillToEndOfLine;
|
|
1451
|
|
1452 DEFVAR_INT ("canna-func-henkan", &canna_fn_Henkan /*
|
|
1453
|
|
1454 */ );
|
|
1455 canna_fn_Henkan = IROHA_FN_Henkan;
|
|
1456
|
|
1457 DEFVAR_INT ("canna-func-kakutei", &canna_fn_Kakutei /*
|
|
1458
|
|
1459 */ );
|
|
1460 canna_fn_Kakutei = IROHA_FN_Kakutei;
|
|
1461
|
|
1462 DEFVAR_INT ("canna-func-extend", &canna_fn_Extend /*
|
|
1463
|
|
1464 */ );
|
|
1465 canna_fn_Extend = IROHA_FN_Extend;
|
|
1466
|
|
1467 DEFVAR_INT ("canna-func-shrink", &canna_fn_Shrink /*
|
|
1468
|
|
1469 */ );
|
|
1470 canna_fn_Shrink = IROHA_FN_Shrink;
|
|
1471
|
|
1472 #ifdef CANNA_FN_AdjustBunsetsu
|
|
1473 DEFVAR_INT ("canna-func-adjust-bunsetsu", &canna_fn_AdjustBunsetsu /*
|
|
1474
|
|
1475 */ );
|
|
1476 canna_fn_AdjustBunsetsu = CANNA_FN_AdjustBunsetsu;
|
|
1477 #endif
|
|
1478 DEFVAR_INT ("canna-func-quit", &canna_fn_Quit /*
|
|
1479
|
|
1480 */ );
|
|
1481 canna_fn_Quit = IROHA_FN_Quit;
|
|
1482
|
|
1483 DEFVAR_INT ("canna-func-convert-as-hex", &canna_fn_ConvertAsHex /*
|
|
1484
|
|
1485 */ );
|
|
1486 canna_fn_ConvertAsHex = IROHA_FN_ConvertAsHex;
|
|
1487
|
|
1488 DEFVAR_INT ("canna-func-convert-as-bushu", &canna_fn_ConvertAsBushu /*
|
|
1489
|
|
1490 */ );
|
|
1491 canna_fn_ConvertAsBushu = IROHA_FN_ConvertAsBushu;
|
|
1492
|
|
1493 DEFVAR_INT ("canna-func-kouho-ichiran", &canna_fn_KouhoIchiran /*
|
|
1494
|
|
1495 */ );
|
|
1496 canna_fn_KouhoIchiran = IROHA_FN_KouhoIchiran;
|
|
1497
|
|
1498 DEFVAR_INT ("canna-func-bubun-muhenkan", &canna_fn_BubunMuhenkan /*
|
|
1499
|
|
1500 */ );
|
|
1501 canna_fn_BubunMuhenkan = IROHA_FN_BubunMuhenkan;
|
|
1502
|
|
1503 DEFVAR_INT ("canna-func-zenkaku", &canna_fn_Zenkaku /*
|
|
1504
|
|
1505 */ );
|
|
1506 canna_fn_Zenkaku = IROHA_FN_Zenkaku;
|
|
1507
|
|
1508 DEFVAR_INT ("canna-func-hankaku", &canna_fn_Hankaku /*
|
|
1509
|
|
1510 */ );
|
|
1511 canna_fn_Hankaku = IROHA_FN_Hankaku;
|
|
1512
|
|
1513 DEFVAR_INT ("canna-func-to-upper", &canna_fn_ToUpper /*
|
|
1514
|
|
1515 */ );
|
|
1516 canna_fn_ToUpper = IROHA_FN_ToUpper;
|
|
1517
|
|
1518 DEFVAR_INT ("canna-func-capitalize", &canna_fn_Capitalize /*
|
|
1519
|
|
1520 */ );
|
|
1521 canna_fn_Capitalize = IROHA_FN_Capitalize;
|
|
1522
|
|
1523 DEFVAR_INT ("canna-func-to-lower", &canna_fn_ToLower /*
|
|
1524
|
|
1525 */ );
|
|
1526 canna_fn_ToLower = IROHA_FN_ToLower;
|
|
1527
|
|
1528 DEFVAR_INT ("canna-func-hiragana", &canna_fn_Hiragana /*
|
|
1529
|
|
1530 */ );
|
|
1531 canna_fn_Hiragana = IROHA_FN_Hiragana;
|
|
1532
|
|
1533 DEFVAR_INT ("canna-func-katakana", &canna_fn_Katakana /*
|
|
1534
|
|
1535 */ );
|
|
1536 canna_fn_Katakana = IROHA_FN_Katakana;
|
|
1537
|
|
1538 DEFVAR_INT ("canna-func-romaji", &canna_fn_Romaji /*
|
|
1539
|
|
1540 */ );
|
|
1541 canna_fn_Romaji = IROHA_FN_Romaji;
|
|
1542
|
|
1543 #ifdef CANNA_FN_BaseHiragana
|
|
1544 DEFVAR_INT ("canna-func-base-hiragana", &canna_fn_BaseHiragana /*
|
|
1545
|
|
1546 */ );
|
|
1547 canna_fn_BaseHiragana = CANNA_FN_BaseHiragana;
|
|
1548
|
|
1549 DEFVAR_INT ("canna-func-base-katakana", &canna_fn_BaseKatakana /*
|
|
1550
|
|
1551 */ );
|
|
1552 canna_fn_BaseKatakana = CANNA_FN_BaseKatakana;
|
|
1553
|
|
1554 DEFVAR_INT ("canna-func-base-eisu", &canna_fn_BaseEisu /*
|
|
1555
|
|
1556 */ );
|
|
1557 canna_fn_BaseEisu = CANNA_FN_BaseEisu;
|
|
1558
|
|
1559 DEFVAR_INT ("canna-func-base-zenkaku", &canna_fn_BaseZenkaku /*
|
|
1560
|
|
1561 */ );
|
|
1562 canna_fn_BaseZenkaku = CANNA_FN_BaseZenkaku;
|
|
1563
|
|
1564 DEFVAR_INT ("canna-func-base-hankaku", &canna_fn_BaseHankaku /*
|
|
1565
|
|
1566 */ );
|
|
1567 canna_fn_BaseHankaku = CANNA_FN_BaseHankaku;
|
|
1568
|
|
1569 DEFVAR_INT ("canna-func-base-kana", &canna_fn_BaseKana /*
|
|
1570
|
|
1571 */ );
|
|
1572 canna_fn_BaseKana = CANNA_FN_BaseKana;
|
|
1573
|
|
1574 DEFVAR_INT ("canna-func-base-kakutei", &canna_fn_BaseKakutei /*
|
|
1575
|
|
1576 */ );
|
|
1577 canna_fn_BaseKakutei = CANNA_FN_BaseKakutei;
|
|
1578
|
|
1579 DEFVAR_INT ("canna-func-base-henkan", &canna_fn_BaseHenkan /*
|
|
1580
|
|
1581 */ );
|
|
1582 canna_fn_BaseHenkan = CANNA_FN_BaseHenkan;
|
|
1583
|
|
1584 DEFVAR_INT ("canna-func-base-hiragana-katakana-toggle",
|
|
1585 &canna_fn_BaseHiraKataToggle /*
|
|
1586
|
|
1587 */ );
|
|
1588 canna_fn_BaseHiraKataToggle = CANNA_FN_BaseHiraKataToggle;
|
|
1589
|
|
1590 DEFVAR_INT ("canna-func-base-zenkaku-hankaku-toggle",
|
|
1591 &canna_fn_BaseZenHanToggle /*
|
|
1592
|
|
1593 */ );
|
|
1594 canna_fn_BaseZenHanToggle = CANNA_FN_BaseZenHanToggle;
|
|
1595
|
|
1596 DEFVAR_INT ("canna-func-base-kana-eisu-toggle",
|
|
1597 &canna_fn_BaseKanaEisuToggle /*
|
|
1598
|
|
1599 */ );
|
|
1600 canna_fn_BaseKanaEisuToggle = CANNA_FN_BaseKanaEisuToggle;
|
|
1601
|
|
1602 DEFVAR_INT ("canna-func-base-kakutei-henkan-toggle",
|
|
1603 &canna_fn_BaseKakuteiHenkanToggle /*
|
|
1604
|
|
1605 */ );
|
|
1606 canna_fn_BaseKakuteiHenkanToggle = CANNA_FN_BaseKakuteiHenkanToggle;
|
|
1607
|
|
1608 DEFVAR_INT ("canna-func-base-rotate-forward",
|
|
1609 &canna_fn_BaseRotateForward /*
|
|
1610
|
|
1611 */ );
|
|
1612 canna_fn_BaseRotateForward = CANNA_FN_BaseRotateForward;
|
|
1613
|
|
1614 DEFVAR_INT ("canna-func-base-rotate-backward",
|
|
1615 &canna_fn_BaseRotateBackward /*
|
|
1616
|
|
1617 */ );
|
|
1618 canna_fn_BaseRotateBackward = CANNA_FN_BaseRotateBackward;
|
|
1619
|
|
1620 #endif
|
|
1621 DEFVAR_INT ("canna-func-extend-mode", &canna_fn_ExtendMode /*
|
|
1622
|
|
1623 */ );
|
|
1624 canna_fn_ExtendMode = IROHA_FN_ExtendMode;
|
|
1625
|
|
1626 DEFVAR_INT ("canna-func-touroku", &canna_fn_Touroku /*
|
|
1627
|
|
1628 */ );
|
|
1629 canna_fn_Touroku = IROHA_FN_Touroku;
|
|
1630
|
|
1631 DEFVAR_INT ("canna-func-hex-mode", &canna_fn_HexMode /*
|
|
1632
|
|
1633 */ );
|
|
1634 canna_fn_HexMode = IROHA_FN_HexMode;
|
|
1635
|
|
1636 DEFVAR_INT ("canna-func-bushu-mode", &canna_fn_BushuMode /*
|
|
1637
|
|
1638 */ );
|
|
1639 canna_fn_BushuMode = IROHA_FN_BushuMode;
|
|
1640
|
|
1641 DEFVAR_INT ("canna-func-kigo-mode", &canna_fn_KigouMode /*
|
|
1642
|
|
1643 */ );
|
|
1644 canna_fn_KigouMode = IROHA_FN_KigouMode;
|
|
1645
|
|
1646 #ifdef CANNA_FN_Mark
|
|
1647 DEFVAR_INT ("canna-func-mark", &canna_fn_Mark /*
|
|
1648
|
|
1649 */ );
|
|
1650 canna_fn_Mark = CANNA_FN_Mark;
|
|
1651 #endif
|
|
1652 #ifdef CANNA_FN_TemporalMode
|
|
1653 DEFVAR_INT ("canna-func-temporal-mode", &canna_fn_TemporalMode /*
|
|
1654
|
|
1655 */ );
|
|
1656 canna_fn_TemporalMode = CANNA_FN_TemporalMode;
|
|
1657 #endif
|
|
1658
|
|
1659 DEFVAR_INT ("canna-key-nfer", &canna_key_Nfer /*
|
|
1660
|
|
1661 */ );
|
|
1662 canna_key_Nfer = IROHA_KEY_Nfer;
|
|
1663
|
|
1664 DEFVAR_INT ("canna-key-xfer", &canna_key_Xfer /*
|
|
1665
|
|
1666 */ );
|
|
1667 canna_key_Xfer = IROHA_KEY_Xfer;
|
|
1668
|
|
1669 DEFVAR_INT ("canna-key-up", &canna_key_Up /*
|
|
1670
|
|
1671 */ );
|
|
1672 canna_key_Up = IROHA_KEY_Up;
|
|
1673
|
|
1674 DEFVAR_INT ("canna-key-left", &canna_key_Left /*
|
|
1675
|
|
1676 */ );
|
|
1677 canna_key_Left = IROHA_KEY_Left;
|
|
1678
|
|
1679 DEFVAR_INT ("canna-key-right", &canna_key_Right /*
|
|
1680
|
|
1681 */ );
|
|
1682 canna_key_Right = IROHA_KEY_Right;
|
|
1683
|
|
1684 DEFVAR_INT ("canna-key-down", &canna_key_Down /*
|
|
1685
|
|
1686 */ );
|
|
1687 canna_key_Down = IROHA_KEY_Down;
|
|
1688
|
|
1689 DEFVAR_INT ("canna-key-insert", &canna_key_Insert /*
|
|
1690
|
|
1691 */ );
|
|
1692 canna_key_Insert = IROHA_KEY_Insert;
|
|
1693
|
|
1694 DEFVAR_INT ("canna-key-rollup", &canna_key_Rollup /*
|
|
1695
|
|
1696 */ );
|
|
1697 canna_key_Rollup = IROHA_KEY_Rollup;
|
|
1698
|
|
1699 DEFVAR_INT ("canna-key-rolldown", &canna_key_Rolldown /*
|
|
1700
|
|
1701 */ );
|
|
1702 canna_key_Rolldown = IROHA_KEY_Rolldown;
|
|
1703
|
|
1704 DEFVAR_INT ("canna-key-home", &canna_key_Home /*
|
|
1705
|
|
1706 */ );
|
|
1707 canna_key_Home = IROHA_KEY_Home;
|
|
1708
|
|
1709 DEFVAR_INT ("canna-key-help", &canna_key_Help /*
|
|
1710
|
|
1711 */ );
|
|
1712 canna_key_Help = IROHA_KEY_Help;
|
|
1713
|
|
1714 DEFVAR_INT ("canna-key-kp-key", &canna_key_KP_Key /*
|
|
1715
|
|
1716 */ );
|
|
1717 canna_key_KP_Key = IROHA_KEY_KP_Key;
|
|
1718
|
|
1719 DEFVAR_INT ("canna-key-shift-nfer", &canna_key_Shift_Nfer /*
|
|
1720
|
|
1721 */ );
|
|
1722 canna_key_Shift_Nfer = IROHA_KEY_Shift_Nfer;
|
|
1723
|
|
1724 DEFVAR_INT ("canna-key-shift-xfer", &canna_key_Shift_Xfer /*
|
|
1725
|
|
1726 */ );
|
|
1727 canna_key_Shift_Xfer = IROHA_KEY_Shift_Xfer;
|
|
1728
|
|
1729 DEFVAR_INT ("canna-key-shift-up", &canna_key_Shift_Up /*
|
|
1730
|
|
1731 */ );
|
|
1732 canna_key_Shift_Up = IROHA_KEY_Shift_Up;
|
|
1733
|
|
1734 DEFVAR_INT ("canna-key-shift-left", &canna_key_Shift_Left /*
|
|
1735
|
|
1736 */ );
|
|
1737 canna_key_Shift_Left = IROHA_KEY_Shift_Left;
|
|
1738
|
|
1739 DEFVAR_INT ("canna-key-shift-right", &canna_key_Shift_Right /*
|
|
1740
|
|
1741 */ );
|
|
1742 canna_key_Shift_Right = IROHA_KEY_Shift_Right;
|
|
1743
|
|
1744 DEFVAR_INT ("canna-key-shift-down", &canna_key_Shift_Down /*
|
|
1745
|
|
1746 */ );
|
|
1747 canna_key_Shift_Down = IROHA_KEY_Shift_Down;
|
|
1748
|
|
1749 DEFVAR_INT ("canna-key-control-nfer", &canna_key_Cntrl_Nfer /*
|
|
1750
|
|
1751 */ );
|
|
1752 canna_key_Cntrl_Nfer = IROHA_KEY_Cntrl_Nfer;
|
|
1753
|
|
1754 DEFVAR_INT ("canna-key-control-xfer", &canna_key_Cntrl_Xfer /*
|
|
1755
|
|
1756 */ );
|
|
1757 canna_key_Cntrl_Xfer = IROHA_KEY_Cntrl_Xfer;
|
|
1758
|
|
1759 DEFVAR_INT ("canna-key-control-up", &canna_key_Cntrl_Up /*
|
|
1760
|
|
1761 */ );
|
|
1762 canna_key_Cntrl_Up = IROHA_KEY_Cntrl_Up;
|
|
1763
|
|
1764 DEFVAR_INT ("canna-key-control-left", &canna_key_Cntrl_Left /*
|
|
1765
|
|
1766 */ );
|
|
1767 canna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left;
|
|
1768
|
|
1769 DEFVAR_INT ("canna-key-control-right", &canna_key_Cntrl_Right /*
|
|
1770
|
|
1771 */ );
|
|
1772 canna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right;
|
|
1773
|
|
1774 DEFVAR_INT ("canna-key-control-down", &canna_key_Cntrl_Down /*
|
|
1775
|
|
1776 */ );
|
|
1777 canna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down;
|
|
1778
|
|
1779 Fprovide(intern("CANNA"));
|
|
1780 }
|
|
1781
|
|
1782 #ifdef CANNA_MULE
|
|
1783 /* To handle MULE internal code and EUC.
|
|
1784 I assume CANNA can handle only Japanese EUC. */
|
|
1785
|
|
1786 /* EUC multibyte string to MULE internal string */
|
|
1787
|
|
1788 static void
|
442
|
1789 c2mu (unsigned char *cp, int l, unsigned char *mp)
|
428
|
1790 {
|
442
|
1791 unsigned char ch, *ep = cp+l;
|
428
|
1792
|
|
1793 while ((cp < ep) && (ch = *cp))
|
|
1794 {
|
|
1795 if ((unsigned char) ch == ISO_CODE_SS2)
|
|
1796 {
|
|
1797 *mp++ = LEADING_BYTE_KATAKANA_JISX0201;
|
|
1798 cp++;
|
|
1799 }
|
|
1800 else if ((unsigned char) ch == ISO_CODE_SS3)
|
|
1801 {
|
|
1802 *mp++ = LEADING_BYTE_JAPANESE_JISX0212;
|
|
1803 cp++;
|
|
1804 *mp++ = *cp++;
|
|
1805 }
|
|
1806 else if (ch & 0x80)
|
|
1807 {
|
|
1808 *mp++ = LEADING_BYTE_JAPANESE_JISX0208;
|
|
1809 *mp++ = *cp++;
|
|
1810 }
|
|
1811 *mp++ = *cp++;
|
|
1812 }
|
|
1813 *mp = 0;
|
|
1814 }
|
|
1815
|
|
1816 /* MULE internal string to EUC multibyte string */
|
|
1817
|
|
1818 static void
|
|
1819 m2c (unsigned char *mp, int l, unsigned char *cp)
|
|
1820 {
|
|
1821 unsigned char ch, *ep = mp + l;
|
|
1822
|
|
1823 while ((mp < ep) && (ch = *mp++))
|
|
1824 {
|
|
1825 switch (ch)
|
|
1826 {
|
|
1827 case LEADING_BYTE_KATAKANA_JISX0201:
|
|
1828 *cp++ = ISO_CODE_SS2;
|
|
1829 *cp++ = *mp++;
|
|
1830 break;
|
|
1831 case LEADING_BYTE_JAPANESE_JISX0212:
|
|
1832 *cp++ = ISO_CODE_SS3;
|
|
1833 case LEADING_BYTE_JAPANESE_JISX0208:
|
|
1834 *cp++ = *mp++;
|
|
1835 *cp++ = *mp++;
|
|
1836 break;
|
|
1837 default:
|
|
1838 *cp++ = ch;
|
|
1839 break;
|
|
1840 }
|
|
1841 }
|
|
1842 *cp = 0;
|
|
1843 }
|
|
1844
|
|
1845 #undef make_string
|
|
1846
|
|
1847 /* make_string after converting EUC string to MULE internal string */
|
|
1848 static Lisp_Object
|
|
1849 mule_make_string (unsigned char *p, int l)
|
|
1850 {
|
|
1851 unsigned char cbuf[4096];
|
|
1852
|
|
1853 c2mu (p,l,cbuf);
|
|
1854 return (make_string (cbuf,strlen (cbuf)));
|
|
1855 }
|
|
1856
|
|
1857 /* return the MULE internal string length of EUC string */
|
|
1858 /* Modified by sb to return a character count not byte count. */
|
|
1859 static int
|
|
1860 mule_strlen (unsigned char *p, int l)
|
|
1861 {
|
|
1862 unsigned char ch, *cp = p;
|
|
1863 int len = 0;
|
|
1864
|
|
1865 while ((cp < p + l) && (ch = *cp))
|
|
1866 {
|
|
1867 if ((unsigned char) ch == ISO_CODE_SS2)
|
|
1868 {
|
|
1869 len++;
|
|
1870 cp += 2;
|
|
1871 }
|
|
1872 else if ((unsigned char) ch == ISO_CODE_SS3)
|
|
1873 {
|
|
1874 len++;
|
|
1875 cp += 3;
|
|
1876 }
|
|
1877 else if (ch & 0x80)
|
|
1878 {
|
|
1879 len++;
|
|
1880 cp += 2;
|
|
1881 }
|
|
1882 else
|
|
1883 {
|
|
1884 len++;
|
|
1885 cp++;
|
|
1886 }
|
|
1887 }
|
|
1888 return (len);
|
|
1889 }
|
|
1890
|
|
1891 /* count number of characters */
|
|
1892 static void
|
458
|
1893 count_char (unsigned char *p, int len, int pos, int rev,
|
|
1894 Fixnum *clen, Fixnum *cpos, Fixnum *crev)
|
428
|
1895 {
|
|
1896 unsigned char *q = p;
|
|
1897
|
|
1898 *clen = *cpos = *crev = 0;
|
|
1899 if (len == 0) return;
|
|
1900 while (q < p + pos)
|
|
1901 {
|
|
1902 (*clen)++;
|
|
1903 (*cpos)++;
|
|
1904 if (*q++ & 0x80) q++;
|
|
1905 }
|
|
1906 while (q < p + pos + rev)
|
|
1907 {
|
|
1908 (*clen)++;
|
|
1909 (*crev)++;
|
|
1910 if (*q++ & 0x80) q++;
|
|
1911 }
|
|
1912 while (q < p + len)
|
|
1913 {
|
|
1914 (*clen)++;
|
|
1915 if (*q++ & 0x80) q++;
|
|
1916 }
|
|
1917 }
|
|
1918 #endif /* CANNA_MULE */
|