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