70
|
1 /* CANNA interface
|
|
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
|
|
25 /* #### The comments in this file are mostly in EUC-formatted Japanese.
|
|
26 It would be ***soooo*** much nicer if someone could translate
|
|
27 them ... */
|
|
28
|
|
29 /*
|
|
30
|
114
|
31 Authors: Akira Kon (kon@uxd.fc.nec.co.jp)
|
|
32 Ichiro Hirakura (hirakura@uxd.fc.nec.co.jp)
|
70
|
33
|
|
34 Functions defined in this file are
|
|
35
|
|
36 (canna-key-proc key)
|
|
37 key: single STRING
|
|
38 RETURNS:
|
|
39 Length of converted string if no error occurs.
|
|
40 Error string if error occurs.
|
|
41 DESCRIPTION:
|
|
42 Convert a key input to a set of strings. The
|
|
43 strings contain both well-formed string and a
|
|
44 intermediate result to show the translation
|
|
45 information to a user. converted strings are
|
|
46 stored in specific variables.
|
|
47
|
|
48 (canna-initialize)
|
|
49 RETURNS:
|
|
50 List of the following things:
|
|
51 - list of keys to toggle Japanese-mode
|
|
52 - error message
|
|
53 - list of warning messages
|
|
54 DESCRIPTION:
|
|
55 Initialize ``canna'', which is a kana-to-kanji
|
|
56 converter for GNU Emacs. The first arg
|
|
57 specifies if inserting space character between
|
|
58 BUNSETSU when candidates are displayed. The
|
|
59 second arg specifies server. The third arg
|
|
60 specifies a file which will be used as a
|
|
61 customization description. If nil is
|
|
62 specified for each arg, the default value will
|
|
63 be used.
|
|
64
|
|
65 (canna-finalize)
|
|
66 RETURNS:
|
|
67 list of warning messages
|
|
68 DESCRIPTION:
|
|
69 finalize ``canna'', which is a kana-to-kanji
|
|
70 converter for GNU Emacs. This cause to write
|
|
71 miscellaneous informations to kana-to-kanji
|
|
72 dictionary.
|
|
73
|
|
74 (canna-touroku-string string)
|
|
75 string:
|
|
76 String to register to a dictionary.
|
|
77 RETURNS:
|
|
78 The same thing returns as canna-key-proc does.
|
|
79 DESCRIPTION:
|
|
80 Register Kanji words into kana-to-kanji
|
|
81 conversion dictionary.
|
|
82
|
|
83 (canna-set-width width)
|
|
84 width:
|
|
85 Column width of the place where the candidates
|
|
86 of kana-to-kanji conversion will be shown.
|
|
87 RETURNS:
|
|
88 nil
|
|
89 DESCRIPTION:
|
|
90 Set status-line width information, which is
|
|
91 used to display kanji candidates.
|
|
92
|
|
93 (canna-change-mode num)
|
|
94 num:
|
|
95 The mode number of Canna.
|
|
96 RETURNS:
|
|
97 The same thing returns as canna-key-proc does.
|
|
98 DESCRIPTION:
|
|
99 Change Japanese pre-edit mode.
|
|
100
|
|
101 (canna-store-yomi yomi roma)
|
|
102 yomi:
|
|
103 ``Yomi'' to be stored.
|
|
104 roma:
|
|
105 ``Romaji'' which corresponds to the ``Yomi''.
|
|
106 RETURNS:
|
|
107 The same thing returns as canna-key-proc does.
|
|
108 DESCRIPTION:
|
|
109 Store yomi characters as a YOMI of
|
|
110 kana-to-kanji conversion.
|
|
111
|
|
112 (canna-do-function num ch)
|
|
113 num:
|
|
114 A function number to be called.
|
|
115 ch:
|
|
116 A character will be specified in order to feed
|
|
117 the character to the function if the function
|
|
118 needs a input character.
|
|
119 RETURNS:
|
|
120 The same thing returns as canna-key-proc does.
|
|
121 DESCRIPTION:
|
|
122 Do specified function at current mode.
|
|
123
|
|
124 (canna-parse string)
|
|
125 string:
|
|
126 To be parsed.
|
|
127 RETURNS:
|
|
128 List of warning messages.
|
|
129 DESCRIPTION:
|
|
130 Parse customize string.
|
|
131
|
|
132 (canna-query-mode)
|
|
133 RETURNS:
|
|
134 A string which indicate the current mode.
|
|
135 DESCRIPTION:
|
|
136 Get current mode string.
|
|
137
|
|
138 Functions below are used for KKCP compatible library. These
|
|
139 functions provides a base kana-to-kanji conversion system for EGG.
|
|
140 These functions may be used when users want to change the engine
|
|
141 from Wnn to Canna without changing user interface of Japanese input.
|
|
142
|
|
143 (canna-henkan-begin)
|
|
144 (canna-henkan-next)
|
|
145 (canna-bunsetu-henkou)
|
|
146 (canna-henkan-kakutei)
|
|
147 (canna-henkan-end)
|
|
148 (canna-henkan-quit)
|
|
149
|
|
150 */
|
|
151
|
|
152 #include <config.h>
|
|
153 #include "lisp.h"
|
|
154
|
|
155 #include "buffer.h"
|
|
156 #include "mule-coding.h"
|
|
157
|
|
158 #ifdef CANNA2
|
|
159 #define IROHA_BC
|
|
160 #include "canna/jrkanji.h"
|
|
161 #include "canna/RK.h"
|
|
162 #else /* !CANNA2 */
|
|
163 #include "iroha/jrkanji.h"
|
|
164 #include "iroha/RK.h"
|
|
165 #endif /* !CANNA2 */
|
|
166 extern char *jrKanjiError;
|
|
167
|
|
168 #define KEYTOSTRSIZE 2048
|
|
169 static unsigned char buf[KEYTOSTRSIZE];
|
|
170 static char **warning;
|
|
171
|
|
172 static int Vcanna_empty_info, Vcanna_through_info;
|
|
173 static int Vcanna_underline;
|
|
174 static int Vcanna_inhibit_hankakukana;
|
|
175
|
|
176 static Lisp_Object Vcanna_kakutei_string;
|
|
177 static Lisp_Object Vcanna_kakutei_yomi;
|
|
178 static Lisp_Object Vcanna_kakutei_romaji;
|
|
179 static Lisp_Object Vcanna_henkan_string;
|
|
180 static int Vcanna_henkan_length;
|
|
181 static int Vcanna_henkan_revPos;
|
|
182 static int Vcanna_henkan_revLen;
|
|
183 static Lisp_Object Vcanna_ichiran_string;
|
|
184 static int Vcanna_ichiran_length;
|
|
185 static int Vcanna_ichiran_revPos;
|
|
186 static int Vcanna_ichiran_revLen;
|
|
187 static Lisp_Object Vcanna_mode_string;
|
|
188
|
|
189 static int IRCP_context;
|
|
190
|
|
191 static Lisp_Object storeResults (unsigned char *, int, jrKanjiStatus *);
|
|
192 static Lisp_Object kanjiYomiList (int, int);
|
|
193
|
|
194 #ifdef CANNA_MULE
|
|
195 static void m2c (unsigned char *, int, unsigned char *);
|
|
196 static Lisp_Object mule_make_string (unsigned char *, int);
|
|
197 static mule_strlen (unsigned char *, int);
|
|
198 static count_char (unsigned char *,int, int, int, int *, int *, int *);
|
|
199 #define make_string mule_make_string
|
|
200 #endif
|
|
201
|
|
202 /* Lisp functions definition */
|
|
203
|
|
204 DEFUN ("canna-key-proc", Fcanna_key_proc, 1, 1, 0, /*
|
|
205 Translate a key input to a set of strings. The strings contain both
|
|
206 well-formed string and intermediate result to show the translation
|
|
207 information to a user. Converted strings are stored in specific
|
|
208 variables.
|
|
209 */
|
|
210 (ch))
|
|
211 {
|
|
212 jrKanjiStatus ks;
|
|
213 int len;
|
|
214
|
98
|
215 CHECK_CHAR_COERCE_INT (ch);
|
70
|
216 len = jrKanjiString (0, XCHAR (ch), buf, KEYTOSTRSIZE, &ks);
|
|
217 return storeResults (buf, len, &ks);
|
|
218 }
|
|
219
|
|
220 static Lisp_Object
|
|
221 storeResults (unsigned char *buf, int len, jrKanjiStatus *ks)
|
|
222 {
|
|
223 Lisp_Object val = Qnil;
|
|
224
|
|
225 if (len < 0)
|
|
226 { /* Error detected */
|
|
227 val = make_string ((unsigned char*) jrKanjiError, strlen (jrKanjiError));
|
|
228 }
|
|
229 else
|
|
230 {
|
|
231 /* ³ÎÄꤷ¤¿Ê¸»úÎó */
|
|
232 Vcanna_kakutei_string = make_string (buf, len);
|
|
233 val = make_int (len);
|
|
234 /* ³ÎÄꤷ¤¿Ê¸»úÎó¤ÎÆɤߤξðÊó... */
|
|
235 Vcanna_kakutei_yomi = Vcanna_kakutei_romaji = Qnil;
|
|
236 if (ks->info & KanjiYomiInfo)
|
|
237 {
|
|
238 unsigned char *p = buf + len + 1;
|
|
239 int yomilen = strlen (p);
|
|
240
|
|
241 if (len + yomilen + 1 < KEYTOSTRSIZE)
|
|
242 {
|
|
243 int yomilen2;
|
|
244
|
|
245 Vcanna_kakutei_yomi = make_string (p, yomilen); /* ÆÉ¤ß */
|
|
246 p += yomilen + 1;
|
|
247 yomilen2 = strlen (p);
|
|
248 if (len + yomilen + yomilen2 + 2 < KEYTOSTRSIZE)
|
|
249 {
|
|
250 Vcanna_kakutei_romaji = make_string (p, yomilen2); /* ¥í¡¼¥Þ»ú */
|
|
251 }
|
|
252 }
|
|
253 }
|
|
254
|
|
255
|
|
256 /* ¸õÊäɽ¼¨¤Îʸ»úÎó¤Ç¤¹¡£*/
|
|
257 Vcanna_henkan_string = Qnil;
|
|
258 if (ks->length >= 0)
|
|
259 {
|
|
260 Vcanna_henkan_string = make_string (ks->echoStr, ks->length);
|
|
261 #ifndef CANNA_MULE
|
|
262 Vcanna_henkan_length = ks->length;
|
|
263 Vcanna_henkan_revPos = ks->revPos;
|
|
264 Vcanna_henkan_revLen = ks->revLen;
|
|
265 #else /* CANNA_MULE */
|
|
266 if (Vcanna_underline)
|
|
267 {
|
|
268 Vcanna_henkan_length = mule_strlen (ks->echoStr,ks->length);
|
|
269 Vcanna_henkan_revPos = mule_strlen (ks->echoStr,ks->revPos);
|
|
270 Vcanna_henkan_revLen = mule_strlen (ks->echoStr+ks->revPos,ks->revLen);
|
|
271 }
|
|
272 else
|
|
273 {
|
|
274 count_char (ks->echoStr, ks->length, ks->revPos, ks->revLen,
|
|
275 &Vcanna_henkan_length, &Vcanna_henkan_revPos,
|
|
276 &Vcanna_henkan_revLen);
|
|
277 }
|
|
278 #endif /* CANNA_MULE */
|
|
279 }
|
|
280
|
|
281 /* °ìÍ÷¤Î¾ðÊó */
|
|
282 Vcanna_ichiran_string = Qnil;
|
|
283 if (ks->info & KanjiGLineInfo && ks->gline.length >= 0)
|
|
284 {
|
|
285 Vcanna_ichiran_string = make_string (ks->gline.line, ks->gline.length);
|
|
286 #ifndef CANNA_MULE
|
|
287 Vcanna_ichiran_length = ks->gline.length;
|
|
288 Vcanna_ichiran_revPos = ks->gline.revPos;
|
|
289 Vcanna_ichiran_revLen = ks->gline.revLen;
|
|
290 #else /* CANNA_MULE */
|
|
291 count_char (ks->gline.line, ks->gline.length,
|
|
292 ks->gline.revPos, ks->gline.revLen, &Vcanna_ichiran_length,
|
|
293 &Vcanna_ichiran_revPos, &Vcanna_ichiran_revLen);
|
|
294 #endif /* CANNA_MULE */
|
|
295 }
|
|
296
|
|
297 /* ¥â¡¼¥É¤Î¾ðÊó */
|
|
298 Vcanna_mode_string = Qnil;
|
|
299 if (ks->info & KanjiModeInfo)
|
|
300 {
|
|
301 Vcanna_mode_string = make_string (ks->mode, strlen (ks->mode));
|
|
302 }
|
|
303
|
|
304 /* ¤½¤Î¾¤Î¾ðÊó */
|
|
305 Vcanna_empty_info = (ks->info & KanjiEmptyInfo) ? 1 : 0;
|
|
306 Vcanna_through_info = (ks->info & KanjiThroughInfo) ? 1 : 0;
|
|
307 }
|
|
308
|
|
309 return val;
|
|
310 }
|
|
311
|
|
312 DEFUN ("canna-set-bunsetsu-kugiri", Fcanna_set_bunsetsu, 0, 1, 0, /*
|
|
313 This function sets the clause separator.
|
|
314 If non-nil value is specified, the white space separator will be used.
|
|
315 No separator will be used otherwise.
|
|
316 */
|
|
317 (num))
|
|
318 {
|
|
319 int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© */
|
|
320
|
|
321 kugiri = NILP (num) ? 0 : 1;
|
|
322
|
|
323 jrKanjiControl (0, KC_SETBUNSETSUKUGIRI, (char *) kugiri);
|
|
324 }
|
|
325
|
98
|
326 /* For whatever reason, calling Fding directly from libCanna loses */
|
|
327 static void call_Fding()
|
|
328 {
|
|
329 extern Lisp_Object Fding();
|
|
330
|
|
331 (void)Fding(Qnil, Qnil, Qnil);
|
|
332 }
|
|
333
|
70
|
334 DEFUN ("canna-initialize", Fcanna_initialize, 0, 3, 0, /*
|
|
335 Initialize ``canna'', which is a kana-to-kanji converter for GNU Emacs.
|
|
336 The first arg specifies if inserting space character between BUNSETSU when
|
|
337 candidates are displayed.
|
|
338 The second arg specifies server.
|
|
339 The third arg specifies a file which will be used as a customization
|
|
340 description.
|
|
341 If nil is specified for each arg, the default value will be used.
|
|
342 */
|
|
343 (num, server, rcfile))
|
|
344 {
|
|
345 Lisp_Object val;
|
|
346 int res;
|
|
347 unsigned char **p, **q;
|
|
348
|
|
349 int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© */
|
|
350
|
|
351 IRCP_context = -1;
|
|
352
|
|
353 if (NILP (num))
|
|
354 {
|
|
355 kugiri = 1;
|
|
356 }
|
|
357 else
|
|
358 {
|
|
359 CHECK_INT (num);
|
|
360 kugiri = XINT (num);
|
|
361 kugiri = (kugiri == 1) ? 1 : 0;
|
|
362 }
|
|
363
|
|
364 if (NILP (server))
|
|
365 {
|
|
366 jrKanjiControl (0, KC_SETSERVERNAME, (char *) 0);
|
|
367 }
|
|
368 else
|
|
369 {
|
|
370 char servername[256];
|
|
371
|
|
372 CHECK_STRING (server);
|
|
373 strncpy (servername, XSTRING (server)->_data, XSTRING (server)->_size);
|
|
374 servername[XSTRING (server)->_size] = '\0';
|
|
375 jrKanjiControl (0, KC_SETSERVERNAME, servername);
|
|
376 }
|
|
377
|
|
378 if (NILP (rcfile))
|
|
379 {
|
|
380 jrKanjiControl (0, KC_SETINITFILENAME, (char *) 0);
|
|
381 }
|
|
382 else
|
|
383 {
|
|
384 char rcname[256];
|
|
385
|
|
386 CHECK_STRING (rcfile);
|
|
387 strncpy (rcname, XSTRING (rcfile)->_data, XSTRING (rcfile)->_size);
|
|
388 rcname[XSTRING (rcfile)->_size] = '\0';
|
|
389 jrKanjiControl (0, KC_SETINITFILENAME, rcname);
|
|
390 }
|
|
391
|
|
392 warning = (char **) 0;
|
|
393 #ifdef nec_ews_svr4
|
|
394 stop_polling ();
|
|
395 #endif /* nec_ews_svr4 */
|
|
396 res = jrKanjiControl (0, KC_INITIALIZE, (char *)&warning);
|
|
397 #ifdef nec_ews_svr4
|
|
398 start_polling ();
|
|
399 #endif /* nec_ews_svr4 */
|
|
400 val = Qnil;
|
|
401 if (warning)
|
|
402 {
|
|
403 for (p = q = (unsigned char **) warning ; *q ; q++)
|
|
404 ;
|
|
405 while (p < q)
|
|
406 {
|
|
407 q--;
|
|
408 val = Fcons (make_string (*q, strlen (*q)), val);
|
|
409 }
|
|
410 }
|
|
411 val = Fcons (val, Qnil);
|
|
412
|
|
413 if (res == -1)
|
|
414 {
|
|
415 val = Fcons (make_string ((unsigned char*) jrKanjiError,
|
|
416 strlen (jrKanjiError)), val);
|
|
417 /* ¥¤¥Ë¥·¥ã¥é¥¤¥º¤Ç¼ºÇÔ¤·¤¿¾ì¹ç¡£ */
|
|
418 return Fcons (Qnil, val);
|
|
419 }
|
|
420 else
|
|
421 {
|
98
|
422 extern void (*jrBeepFunc)();
|
|
423 Lisp_Object CANNA_mode_keys ();
|
70
|
424
|
98
|
425 jrBeepFunc = call_Fding;
|
70
|
426
|
|
427 #ifdef KC_SETAPPNAME
|
|
428 #ifndef CANNA_MULE
|
|
429 wcKanjiControl (0, KC_SETAPPNAME, "nemacs");
|
|
430 #else /* CANNA_MULE */
|
|
431 wcKanjiControl (0, KC_SETAPPNAME, "mule");
|
|
432 #endif /* CANNA_MULE */
|
|
433 #endif /* KC_SETAPPNAME */
|
|
434
|
|
435 jrKanjiControl (0, KC_SETBUNSETSUKUGIRI, (char *) kugiri);
|
|
436 jrKanjiControl (0, KC_SETWIDTH, (char *) 78);
|
|
437 #ifndef CANNA_MULE
|
|
438 jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1);
|
|
439 #else
|
|
440 /* mule ¤À¤Ã¤¿¤éȾ³Ñ¥«¥¿¥«¥Ê¤â»È¤¨¤ë */
|
|
441 if (Vcanna_inhibit_hankakukana)
|
|
442 jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1);
|
|
443 #endif
|
|
444 jrKanjiControl (0, KC_YOMIINFO, (char *) 2); /* ¢¨£²: ¥í¡¼¥Þ»ú¤Þ¤ÇÊÖ¤¹ */
|
|
445 val = Fcons (Qnil, val);
|
|
446 return Fcons (CANNA_mode_keys (), val);
|
|
447 }
|
|
448 }
|
|
449
|
|
450 DEFUN ("canna-finalize", Fcanna_finalize, 0, 0, 0, /*
|
|
451 finalize ``canna'', which is a kana-to-kanji converter for GNU Emacs.
|
|
452 This cause to write miscellaneous informations to kana-to-kanji dictionary.
|
|
453 */
|
|
454 ())
|
|
455 {
|
|
456 Lisp_Object val;
|
|
457 unsigned char **p;
|
|
458
|
|
459 jrKanjiControl (0, KC_FINALIZE, (char *)&warning);
|
|
460
|
|
461 val = Qnil;
|
|
462 if (warning)
|
|
463 {
|
|
464 for (p = (unsigned char**) warning ; *p ; p++)
|
|
465 {
|
|
466 val = Fcons (make_string (*p, strlen (*p)), val);
|
|
467 }
|
|
468 }
|
|
469 val = Fcons (val, Qnil);
|
|
470 IRCP_context = -1;
|
|
471 return val;
|
|
472 }
|
|
473
|
|
474 DEFUN ("canna-touroku-string", Fcanna_touroku_string, 1, 1, 0, /*
|
|
475 Register Kanji words into kana-to-kanji conversion dictionary.
|
|
476 */
|
|
477 (str))
|
|
478 {
|
|
479 jrKanjiStatusWithValue ksv;
|
|
480 jrKanjiStatus ks;
|
|
481 int len;
|
|
482 Lisp_Object val;
|
|
483 #ifdef CANNA_MULE
|
|
484 unsigned char cbuf[4096];
|
|
485 #endif
|
|
486
|
|
487 CHECK_STRING (str);
|
|
488 ksv.buffer = (unsigned char *) buf;
|
|
489 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
490 #ifndef CANNA_MULE
|
|
491 ks.echoStr = XSTRING (str)->_data;
|
|
492 ks.length = XSTRING (str)->_size;
|
|
493 #else /* CANNA_MULE */
|
|
494 m2c (XSTRING (str)->_data, XSTRING (str)->_size, cbuf);
|
|
495 ks.echoStr = cbuf;
|
|
496 ks.length = strlen (cbuf);
|
|
497 #endif /* CANNA_MULE */
|
|
498 ksv.ks = &ks;
|
|
499 len = jrKanjiControl (0, KC_DEFINEKANJI, (char *)&ksv);
|
|
500 val = storeResults (buf, ksv.val, ksv.ks);
|
|
501 return val;
|
|
502 }
|
|
503
|
|
504 DEFUN ("canna-set-width", Fcanna_set_width, 1, 1, 0, /*
|
|
505 Set status-line width information, which is used to display
|
|
506 kanji candidates.
|
|
507 */
|
|
508 (num))
|
|
509 {
|
|
510 CHECK_INT (num);
|
|
511
|
|
512 jrKanjiControl (0, KC_SETWIDTH, (char *) XINT (num));
|
|
513 return Qnil;
|
|
514 }
|
|
515
|
|
516 DEFUN ("canna-change-mode", Fcanna_change_mode, 1, 1, 0, /*
|
|
517 Change Japanese pre-edit mode.
|
|
518 */
|
|
519 (num))
|
|
520 {
|
|
521 jrKanjiStatusWithValue ksv;
|
|
522 jrKanjiStatus ks;
|
|
523 Lisp_Object val;
|
|
524
|
|
525 CHECK_INT (num);
|
|
526
|
|
527 ksv.buffer = (unsigned char *) buf;
|
|
528 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
529 ksv.ks = &ks;
|
|
530 ksv.val = XINT (num);
|
|
531 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv);
|
|
532 val = storeResults (buf, ksv.val, ksv.ks);
|
|
533 return val;
|
|
534 }
|
|
535
|
|
536 Lisp_Object
|
|
537 CANNA_mode_keys (void)
|
|
538 {
|
|
539 #define CANNAWORKBUFSIZE 32
|
|
540 char xxx[CANNAWORKBUFSIZE];
|
|
541 Lisp_Object val;
|
|
542 int i, n;
|
|
543
|
|
544 n = jrKanjiControl (0, KC_MODEKEYS, xxx);
|
|
545 val = Qnil;
|
|
546 for (i = n ; i > 0 ;)
|
|
547 {
|
|
548 --i;
|
|
549 /* !!#### something fucked here */
|
|
550 val = Fcons (make_char ((int)(0xFF & (unsigned char) xxx[i])), val);
|
|
551 }
|
|
552 return val;
|
|
553 }
|
|
554
|
|
555 DEFUN ("canna-store-yomi", Fcanna_store_yomi, 1, 2, 0, /*
|
|
556 Store yomi characters as a YOMI of kana-to-kanji conversion.
|
|
557 */
|
|
558 (yomi, roma))
|
|
559 {
|
|
560 jrKanjiStatusWithValue ksv;
|
|
561 jrKanjiStatus ks;
|
|
562
|
|
563 CHECK_STRING (yomi);
|
|
564 #ifndef CANNA_MULE
|
|
565 strncpy (buf, XSTRING (yomi)->_data, XSTRING (yomi)->_size);
|
|
566 ks.length = XSTRING (yomi)->_size;
|
|
567 buf[ks.length] = '\0';
|
|
568 #else /* CANNA_MULE */
|
|
569 m2c (XSTRING (yomi)->_data, XSTRING (yomi)->_size, buf);
|
|
570 ks.length = strlen (buf);
|
|
571 #endif /* CANNA_MULE */
|
|
572
|
|
573 if (NILP (roma))
|
|
574 {
|
|
575 ks.mode = 0;
|
|
576 }
|
|
577 else
|
|
578 {
|
|
579 CHECK_STRING (roma);
|
|
580
|
|
581 #ifndef CANNA_MULE
|
|
582 strncpy (buf + XSTRING (yomi)->_size + 1, XSTRING (roma)->_data,
|
|
583 XSTRING (roma)->_size);
|
|
584 buf[XSTRING (yomi)->_size + 1 + XSTRING (roma)->_size] = '\0';
|
|
585 ks.mode = (unsigned char *)(buf + XSTRING (yomi)->_size + 1);
|
|
586 #else /* CANNA_MULE */
|
|
587 ks.mode = (unsigned char *)(buf + ks.length + 1);
|
|
588 m2c (XSTRING (roma)->_data, XSTRING (roma)->_size, ks.mode);
|
|
589 #endif /* CANNA_MULE */
|
|
590 }
|
|
591
|
|
592 ks.echoStr = (unsigned char *) buf;
|
|
593 ksv.buffer = (unsigned char *) buf; /* ÊÖÃÍÍÑ */
|
|
594 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
595 ksv.ks = &ks;
|
|
596
|
|
597 jrKanjiControl (0, KC_STOREYOMI, (char *)&ksv);
|
|
598
|
|
599 return storeResults (buf, ksv.val, ksv.ks);
|
|
600 }
|
|
601
|
|
602 DEFUN ("canna-do-function", Fcanna_do_function, 1, 2, 0, /*
|
|
603 Do specified function at current mode.
|
|
604 */
|
|
605 (num, ch))
|
|
606 {
|
|
607 jrKanjiStatusWithValue ksv;
|
|
608 jrKanjiStatus ks;
|
|
609 Lisp_Object val;
|
|
610
|
|
611 CHECK_INT (num);
|
|
612
|
|
613 if (NILP (ch))
|
|
614 {
|
|
615 *buf = '@';
|
|
616 }
|
|
617 else
|
|
618 {
|
|
619 CHECK_CHAR (ch);
|
|
620 *buf = XCHAR (ch);
|
|
621 }
|
|
622
|
|
623 ksv.buffer = (unsigned char *) buf;
|
|
624 ksv.bytes_buffer = KEYTOSTRSIZE;
|
|
625 ksv.ks = &ks;
|
|
626 ksv.val = XINT (num);
|
|
627 jrKanjiControl (0, KC_DO, (char *) &ksv);
|
|
628 val = storeResults (buf, ksv.val, ksv.ks);
|
|
629 return val;
|
|
630 }
|
|
631
|
|
632 DEFUN ("canna-parse", Fcanna_parse, 1, 1, 0, /*
|
|
633 Parse customize string.
|
|
634 */
|
|
635 (str))
|
|
636 {
|
|
637 jrKanjiStatusWithValue ksv;
|
|
638 jrKanjiStatus ks;
|
|
639 Lisp_Object val;
|
|
640 unsigned char **p;
|
|
641 int n;
|
|
642
|
|
643 CHECK_STRING (str);
|
|
644
|
|
645 #ifndef CANNA_MULE
|
|
646 strncpy (buf, XSTRING (str)->_data, XSTRING (str)->_size);
|
|
647 buf[XSTRING (str)->_size] = '\0';
|
|
648 #else /* CANNA_MULE */
|
|
649 m2c (XSTRING (str)->_data, XSTRING (str)->_size, buf);
|
|
650 #endif /* CANNA_MULE */
|
|
651 p = (unsigned char**) buf;
|
|
652 n = jrKanjiControl (0, KC_PARSE, (char *) &p);
|
|
653 val = Qnil;
|
|
654 while (n > 0)
|
|
655 {
|
|
656 n--;
|
|
657 val = Fcons (make_string (p[n], strlen (p[n])), val);
|
|
658 }
|
|
659 return val;
|
|
660 }
|
|
661
|
|
662 DEFUN ("canna-query-mode", Fcanna_query_mode, 0, 0, 0, /*
|
|
663 Get current mode string.
|
|
664 */
|
|
665 ())
|
|
666 {
|
|
667 unsigned char buf[256];
|
|
668
|
|
669 jrKanjiControl (0, KC_QUERYMODE, buf);
|
|
670 return make_string (buf, strlen (buf));
|
|
671 }
|
|
672
|
|
673 /*
|
|
674 * Functions following this line are for KKCP interface compatible
|
|
675 * library. These functions may be used by MILK system.
|
|
676 */
|
|
677
|
|
678 #define RKBUFSIZE 1024
|
|
679
|
|
680 static unsigned char yomibuf[RKBUFSIZE];
|
|
681 static short kugiri[RKBUFSIZE / 2];
|
|
682
|
|
683 static int
|
|
684 confirmContext (void)
|
|
685 {
|
|
686 if (IRCP_context < 0)
|
|
687 {
|
|
688 int context;
|
|
689
|
|
690 if ((context = jrKanjiControl (0, KC_GETCONTEXT, (char *) 0)) == -1)
|
|
691 {
|
|
692 return 0;
|
|
693 }
|
|
694 IRCP_context = context;
|
|
695 }
|
|
696 return 1;
|
|
697 }
|
|
698
|
|
699 static int
|
|
700 byteLen (int bun, int len)
|
|
701 {
|
|
702 int i = 0, offset = 0, ch;
|
|
703
|
|
704 if (0 <= bun && bun < RKBUFSIZE)
|
|
705 {
|
|
706 offset = kugiri[bun];
|
|
707 }
|
|
708
|
|
709 while (len-- > 0 && (ch = (int) yomibuf[offset + i]))
|
|
710 {
|
|
711 i++;
|
|
712 if (ch & 0x80)
|
|
713 {
|
|
714 i++;
|
|
715 }
|
|
716 }
|
|
717 return i;
|
|
718 }
|
|
719
|
|
720 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /*
|
|
721 ¤«¤Ê´Á»úÊÑ´¹¤·¤¿·ë²Ì¤òÊÖ´Ô¤¹¤ë¡£Ê¸ÀáÀڤ꤬¤·¤Æ¤¢¤ë¡£
|
|
722 */
|
|
723 (yomi))
|
|
724 {
|
|
725 int nbun;
|
|
726 Lisp_Object res;
|
|
727
|
|
728 CHECK_STRING (yomi);
|
|
729 if (confirmContext () == 0)
|
|
730 {
|
|
731 return Qnil;
|
|
732 }
|
|
733 #ifndef CANNA_MULE
|
|
734 strncpy (yomibuf, XSTRING (yomi)->_data, XSTRING (yomi)->_size);
|
|
735 yomibuf[XSTRING (yomi)->_size] = '\0';
|
|
736 nbun = RkBgnBun (IRCP_context, XSTRING (yomi)->_data, XSTRING (yomi)->_size,
|
|
737 (RK_XFER << RK_XFERBITS) | RK_KFER);
|
|
738 #else /* CANNA_MULE */
|
|
739 m2c (XSTRING (yomi)->_data, XSTRING (yomi)->_size, yomibuf);
|
|
740 nbun = RkBgnBun (IRCP_context, (char *) yomibuf, strlen (yomibuf),
|
|
741 (RK_XFER << RK_XFERBITS) | RK_KFER);
|
|
742 #endif /* CANNA_MULE */
|
|
743
|
|
744 return kanjiYomiList (IRCP_context, nbun);
|
|
745 }
|
|
746
|
|
747 static Lisp_Object
|
|
748 kanjiYomiList (int context, int nbun)
|
|
749 {
|
|
750 Lisp_Object val, res = Qnil;
|
|
751 unsigned char RkBuf[RKBUFSIZE];
|
|
752 int len, i, total;
|
|
753
|
|
754 for (i = nbun ; i > 0 ; )
|
|
755 {
|
|
756 i--;
|
|
757 RkGoTo (context, i);
|
|
758 len = RkGetKanji (context, RkBuf, RKBUFSIZE);
|
|
759 val = make_string (RkBuf, len);
|
|
760 len = RkGetYomi (context, RkBuf, RKBUFSIZE);
|
|
761 res = Fcons (Fcons (val, make_string (RkBuf, len)), res);
|
|
762 if (i < RKBUFSIZE / 2)
|
|
763 {
|
|
764 kugiri[i] = len;
|
|
765 }
|
|
766 }
|
|
767 for (i = 0, total = 0 ; i < nbun ; i++)
|
|
768 {
|
|
769 int temp = kugiri[i];
|
|
770 kugiri[i] = total;
|
|
771 total += temp;
|
|
772 }
|
|
773 return res;
|
|
774 }
|
|
775
|
|
776 DEFUN ("canna-henkan-next", Fcanna_henkan_next, 1, 1, 0, /*
|
|
777 ¸õÊä°ìÍ÷¤òµá¤á¤ë¡£
|
|
778 */
|
|
779 (bunsetsu))
|
|
780 {
|
|
781 int i, nbun, slen, len;
|
|
782 unsigned char *p, RkBuf[RKBUFSIZE];
|
|
783 Lisp_Object res = Qnil, endp;
|
|
784
|
|
785 CHECK_INT (bunsetsu);
|
|
786 if (confirmContext () == 0)
|
|
787 {
|
|
788 return Qnil;
|
|
789 }
|
|
790 RkGoTo (IRCP_context, XINT (bunsetsu));
|
|
791 len = RkGetKanjiList (IRCP_context, RkBuf, RKBUFSIZE);
|
|
792 p = RkBuf;
|
|
793 for (i = 0 ; i < len ; i++)
|
|
794 {
|
|
795 slen = strlen (p);
|
80
|
796 if (NILP(res))
|
70
|
797 {
|
|
798 endp = res = Fcons (make_string (p, slen), Qnil);
|
|
799 }
|
|
800 else
|
|
801 {
|
|
802 endp = XCONS (endp)->cdr = Fcons (make_string (p, slen), Qnil);
|
|
803 }
|
|
804 p += slen + 1;
|
|
805 }
|
|
806 return res;
|
|
807 }
|
|
808
|
|
809 DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, 2, 2, 0, /*
|
|
810 ʸÀá¤ÎŤµ¤ò»ØÄꤹ¤ë¡£
|
|
811 */
|
|
812 (bunsetsu, bunlen))
|
|
813 {
|
|
814 int nbun, len;
|
|
815
|
|
816 CHECK_INT (bunsetsu);
|
|
817 CHECK_INT (bunlen);
|
|
818
|
|
819 nbun = XINT (bunsetsu);
|
|
820 if (confirmContext () == 0)
|
|
821 {
|
|
822 return Qnil;
|
|
823 }
|
|
824 RkGoTo (IRCP_context, nbun);
|
|
825 len = byteLen (nbun, XINT (bunlen));
|
|
826 return kanjiYomiList (IRCP_context, RkResize (IRCP_context, len));
|
|
827 }
|
|
828
|
|
829 DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, 2, 2, 0, /*
|
|
830 ¸õÊäÁªÂò¡£
|
|
831 */
|
|
832 (bun, kouho))
|
|
833 {
|
98
|
834 int nbun, nkouho;
|
|
835
|
70
|
836 if (confirmContext () == 0)
|
|
837 {
|
|
838 return Qnil;
|
|
839 }
|
98
|
840 nbun = XINT(bun);
|
|
841 RkGoTo (IRCP_context, nbun);
|
|
842
|
|
843 nkouho = XINT(kouho);
|
|
844 RkXfer (IRCP_context, nkouho);
|
70
|
845 return Qt;
|
|
846 }
|
|
847
|
|
848 DEFUN ("canna-henkan-end", Fcanna_henkan_end, 0, 0, 0, /*
|
|
849 ÊÑ´¹½ªÎ»¡£
|
|
850 */
|
|
851 ())
|
|
852 {
|
|
853 if (confirmContext () == 0)
|
|
854 {
|
|
855 return Qnil;
|
|
856 }
|
|
857 RkEndBun (IRCP_context, 1); /* ³Ø½¬¤Ï¤¤¤Ä¤Ç¤â¹Ô¤Ã¤ÆÎɤ¤¤â¤Î¤Ê¤Î¤«¡© */
|
|
858 return Qt;
|
|
859 }
|
|
860
|
|
861 DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, 0, 0, 0, /*
|
|
862 ÊÑ´¹½ªÎ»¡£
|
|
863 */
|
|
864 ())
|
|
865 {
|
|
866 if (confirmContext () == 0)
|
|
867 {
|
|
868 return Qnil;
|
|
869 }
|
|
870 RkEndBun (IRCP_context, 0);
|
|
871 return Qt;
|
|
872 }
|
|
873
|
|
874 /* variables below this line is constants of Canna */
|
|
875
|
|
876 static int Vcanna_mode_AlphaMode = IROHA_MODE_AlphaMode;
|
|
877 static int Vcanna_mode_EmptyMode = IROHA_MODE_EmptyMode;
|
|
878 static int Vcanna_mode_KigoMode = IROHA_MODE_KigoMode;
|
|
879 static int Vcanna_mode_YomiMode = IROHA_MODE_YomiMode;
|
|
880 static int Vcanna_mode_JishuMode = IROHA_MODE_JishuMode;
|
|
881 static int Vcanna_mode_TankouhoMode = IROHA_MODE_TankouhoMode;
|
|
882 static int Vcanna_mode_IchiranMode = IROHA_MODE_IchiranMode;
|
|
883 static int Vcanna_mode_YesNoMode = IROHA_MODE_YesNoMode;
|
|
884 static int Vcanna_mode_OnOffMode = IROHA_MODE_OnOffMode;
|
|
885 #ifdef CANNA_MODE_AdjustBunsetsuMode
|
|
886 static int Vcanna_mode_AdjustBunsetsuMode = CANNA_MODE_AdjustBunsetsuMode;
|
|
887 #endif
|
|
888 #ifdef CANNA_MODE_ChikujiYomiMode
|
|
889 static int Vcanna_mode_ChikujiYomiMode = CANNA_MODE_ChikujiYomiMode;
|
|
890 static int Vcanna_mode_ChikujiTanMode = CANNA_MODE_ChikujiTanMode;
|
|
891 #endif
|
|
892
|
|
893 static int Vcanna_mode_HenkanMode = IROHA_MODE_HenkanMode;
|
|
894 #ifdef CANNA_MODE_HenkanNyuryokuMode
|
|
895 static int Vcanna_mode_HenkanNyuryokuMode = CANNA_MODE_HenkanNyuryokuMode;
|
|
896 #endif
|
|
897 #ifdef CANNA_MODE_ZenHiraHenkanMode
|
|
898 static int Vcanna_mode_ZenHiraHenkanMode = CANNA_MODE_ZenHiraHenkanMode;
|
|
899 #ifdef CANNA_MODE_HanHiraHenkanMode
|
|
900 static int Vcanna_mode_HanHiraHenkanMode = CANNA_MODE_HanHiraHenkanMode;
|
|
901 #endif
|
|
902 static int Vcanna_mode_ZenKataHenkanMode = CANNA_MODE_ZenKataHenkanMode;
|
|
903 static int Vcanna_mode_HanKataHenkanMode = CANNA_MODE_HanKataHenkanMode;
|
|
904 static int Vcanna_mode_ZenAlphaHenkanMode = CANNA_MODE_ZenAlphaHenkanMode;
|
|
905 static int Vcanna_mode_HanAlphaHenkanMode = CANNA_MODE_HanAlphaHenkanMode;
|
|
906 #endif
|
|
907 static int Vcanna_mode_ZenHiraKakuteiMode = IROHA_MODE_ZenHiraKakuteiMode;
|
|
908 #ifdef CANNA_MODE_HanHiraKakuteiMode
|
|
909 static int Vcanna_mode_HanHiraKakuteiMode = CANNA_MODE_HanHiraKakuteiMode;
|
|
910 #endif
|
|
911 static int Vcanna_mode_ZenKataKakuteiMode = IROHA_MODE_ZenKataKakuteiMode;
|
|
912 static int Vcanna_mode_HanKataKakuteiMode = IROHA_MODE_HanKataKakuteiMode;
|
|
913 static int Vcanna_mode_ZenAlphaKakuteiMode = IROHA_MODE_ZenAlphaKakuteiMode;
|
|
914 static int Vcanna_mode_HanAlphaKakuteiMode = IROHA_MODE_HanAlphaKakuteiMode;
|
|
915 static int Vcanna_mode_HexMode = IROHA_MODE_HexMode;
|
|
916 static int Vcanna_mode_BushuMode = IROHA_MODE_BushuMode;
|
|
917 static int Vcanna_mode_ExtendMode = IROHA_MODE_ExtendMode;
|
|
918 static int Vcanna_mode_RussianMode = IROHA_MODE_RussianMode;
|
|
919 static int Vcanna_mode_GreekMode = IROHA_MODE_GreekMode;
|
|
920 static int Vcanna_mode_LineMode = IROHA_MODE_LineMode;
|
|
921 static int Vcanna_mode_ChangingServerMode = IROHA_MODE_ChangingServerMode;
|
|
922 static int Vcanna_mode_HenkanMethodMode = IROHA_MODE_HenkanMethodMode;
|
|
923 static int Vcanna_mode_DeleteDicMode = IROHA_MODE_DeleteDicMode;
|
|
924 static int Vcanna_mode_TourokuMode = IROHA_MODE_TourokuMode;
|
|
925 static int Vcanna_mode_TourokuEmptyMode = IROHA_MODE_TourokuEmptyMode;
|
|
926 static int Vcanna_mode_TourokuHinshiMode = IROHA_MODE_TourokuHinshiMode;
|
|
927 static int Vcanna_mode_TourokuDicMode = IROHA_MODE_TourokuDicMode;
|
|
928 static int Vcanna_mode_QuotedInsertMode = IROHA_MODE_QuotedInsertMode;
|
|
929 static int Vcanna_mode_BubunMuhenkanMode = IROHA_MODE_BubunMuhenkanMode;
|
|
930 static int Vcanna_mode_MountDicMode = IROHA_MODE_MountDicMode;
|
|
931
|
|
932 static int Vcanna_fn_SelfInsert = IROHA_FN_SelfInsert;
|
|
933 static int Vcanna_fn_FunctionalInsert = IROHA_FN_FunctionalInsert;
|
|
934 static int Vcanna_fn_QuotedInsert = IROHA_FN_QuotedInsert;
|
|
935 static int Vcanna_fn_JapaneseMode = IROHA_FN_JapaneseMode;
|
|
936 static int Vcanna_fn_AlphaMode = IROHA_FN_AlphaMode;
|
|
937 static int Vcanna_fn_HenkanNyuryokuMode = IROHA_FN_HenkanNyuryokuMode;
|
|
938 static int Vcanna_fn_Forward = IROHA_FN_Forward;
|
|
939 static int Vcanna_fn_Backward = IROHA_FN_Backward;
|
|
940 static int Vcanna_fn_Next = IROHA_FN_Next;
|
|
941 static int Vcanna_fn_Prev = IROHA_FN_Prev;
|
|
942 static int Vcanna_fn_BeginningOfLine = IROHA_FN_BeginningOfLine;
|
|
943 static int Vcanna_fn_EndOfLine = IROHA_FN_EndOfLine;
|
|
944 static int Vcanna_fn_DeleteNext = IROHA_FN_DeleteNext;
|
|
945 static int Vcanna_fn_DeletePrevious = IROHA_FN_DeletePrevious;
|
|
946 static int Vcanna_fn_KillToEndOfLine = IROHA_FN_KillToEndOfLine;
|
|
947 static int Vcanna_fn_Henkan = IROHA_FN_Henkan;
|
|
948 static int Vcanna_fn_Kakutei = IROHA_FN_Kakutei;
|
|
949 static int Vcanna_fn_Extend = IROHA_FN_Extend;
|
|
950 static int Vcanna_fn_Shrink = IROHA_FN_Shrink;
|
|
951 #ifdef CANNA_FN_AdjustBunsetsu
|
|
952 static int Vcanna_fn_AdjustBunsetsu = CANNA_FN_AdjustBunsetsu;
|
|
953 #endif
|
|
954 static int Vcanna_fn_Quit = IROHA_FN_Quit;
|
|
955 static int Vcanna_fn_ConvertAsHex = IROHA_FN_ConvertAsHex;
|
|
956 static int Vcanna_fn_ConvertAsBushu = IROHA_FN_ConvertAsBushu;
|
|
957 static int Vcanna_fn_KouhoIchiran = IROHA_FN_KouhoIchiran;
|
|
958 static int Vcanna_fn_BubunMuhenkan = IROHA_FN_BubunMuhenkan;
|
|
959 static int Vcanna_fn_Zenkaku = IROHA_FN_Zenkaku;
|
|
960 static int Vcanna_fn_Hankaku = IROHA_FN_Hankaku;
|
|
961 static int Vcanna_fn_ToUpper = IROHA_FN_ToUpper;
|
|
962 static int Vcanna_fn_Capitalize = IROHA_FN_Capitalize;
|
|
963 static int Vcanna_fn_ToLower = IROHA_FN_ToLower;
|
|
964 static int Vcanna_fn_Hiragana = IROHA_FN_Hiragana;
|
|
965 static int Vcanna_fn_Katakana = IROHA_FN_Katakana;
|
|
966 static int Vcanna_fn_Romaji = IROHA_FN_Romaji;
|
|
967 #ifdef CANNA_FN_BaseHiragana
|
|
968 static int Vcanna_fn_BaseHiragana = CANNA_FN_BaseHiragana;
|
|
969 static int Vcanna_fn_BaseKatakana = CANNA_FN_BaseKatakana;
|
|
970 static int Vcanna_fn_BaseEisu = CANNA_FN_BaseEisu;
|
|
971 static int Vcanna_fn_BaseZenkaku = CANNA_FN_BaseZenkaku;
|
|
972 static int Vcanna_fn_BaseHankaku = CANNA_FN_BaseHankaku;
|
|
973 static int Vcanna_fn_BaseKana = CANNA_FN_BaseKana;
|
|
974 static int Vcanna_fn_BaseKakutei = CANNA_FN_BaseKakutei;
|
|
975 static int Vcanna_fn_BaseHenkan = CANNA_FN_BaseHenkan;
|
|
976 static int Vcanna_fn_BaseHiraKataToggle = CANNA_FN_BaseHiraKataToggle;
|
|
977 static int Vcanna_fn_BaseZenHanToggle = CANNA_FN_BaseZenHanToggle;
|
|
978 static int Vcanna_fn_BaseKanaEisuToggle = CANNA_FN_BaseKanaEisuToggle;
|
|
979 static int Vcanna_fn_BaseKakuteiHenkanToggle =
|
|
980 CANNA_FN_BaseKakuteiHenkanToggle;
|
|
981 static int Vcanna_fn_BaseRotateForward = CANNA_FN_BaseRotateForward;
|
|
982 static int Vcanna_fn_BaseRotateBackward = CANNA_FN_BaseRotateBackward;
|
|
983 #endif
|
|
984 static int Vcanna_fn_ExtendMode = IROHA_FN_ExtendMode;
|
|
985 static int Vcanna_fn_Touroku = IROHA_FN_Touroku;
|
|
986 static int Vcanna_fn_HexMode = IROHA_FN_HexMode;
|
|
987 static int Vcanna_fn_BushuMode = IROHA_FN_BushuMode;
|
|
988 static int Vcanna_fn_KigouMode = IROHA_FN_KigouMode;
|
|
989 #ifdef CANNA_FN_Mark
|
|
990 static int Vcanna_fn_Mark = CANNA_FN_Mark;
|
|
991 #endif
|
|
992 #ifdef CANNA_FN_TemporalMode
|
|
993 static int Vcanna_fn_TemporalMode = CANNA_FN_TemporalMode;
|
|
994 #endif
|
|
995
|
|
996 static int Vcanna_key_Nfer = IROHA_KEY_Nfer;
|
|
997 static int Vcanna_key_Xfer = IROHA_KEY_Xfer;
|
|
998 static int Vcanna_key_Up = IROHA_KEY_Up;
|
|
999 static int Vcanna_key_Left = IROHA_KEY_Left;
|
|
1000 static int Vcanna_key_Right = IROHA_KEY_Right;
|
|
1001 static int Vcanna_key_Down = IROHA_KEY_Down;
|
|
1002 static int Vcanna_key_Insert = IROHA_KEY_Insert;
|
|
1003 static int Vcanna_key_Rollup = IROHA_KEY_Rollup;
|
|
1004 static int Vcanna_key_Rolldown = IROHA_KEY_Rolldown;
|
|
1005 static int Vcanna_key_Home = IROHA_KEY_Home;
|
|
1006 static int Vcanna_key_Help = IROHA_KEY_Help;
|
|
1007 static int Vcanna_key_KP_Key = IROHA_KEY_KP_Key;
|
|
1008 static int Vcanna_key_Shift_Nfer = IROHA_KEY_Shift_Nfer;
|
|
1009 static int Vcanna_key_Shift_Xfer = IROHA_KEY_Shift_Xfer;
|
|
1010 static int Vcanna_key_Shift_Up = IROHA_KEY_Shift_Up;
|
|
1011 static int Vcanna_key_Shift_Left = IROHA_KEY_Shift_Left;
|
|
1012 static int Vcanna_key_Shift_Right = IROHA_KEY_Shift_Right;
|
|
1013 static int Vcanna_key_Shift_Down = IROHA_KEY_Shift_Down;
|
|
1014 static int Vcanna_key_Cntrl_Nfer = IROHA_KEY_Cntrl_Nfer;
|
|
1015 static int Vcanna_key_Cntrl_Xfer = IROHA_KEY_Cntrl_Xfer;
|
|
1016 static int Vcanna_key_Cntrl_Up = IROHA_KEY_Cntrl_Up;
|
|
1017 static int Vcanna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left;
|
|
1018 static int Vcanna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right;
|
|
1019 static int Vcanna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down;
|
|
1020
|
|
1021 Lisp_Object VCANNA; /* by MORIOKA Tomohiko <morioka@jaist.ac.jp>
|
|
1022 1996/6/7 */
|
|
1023
|
|
1024 void
|
|
1025 syms_of_mule_canna (void)
|
|
1026 {
|
|
1027 DEFVAR_LISP ("CANNA", &VCANNA); /* hir@nec, 1992.5.21 */
|
|
1028 VCANNA = Qt; /* hir@nec, 1992.5.21 */
|
|
1029
|
|
1030 DEFSUBR (Fcanna_key_proc);
|
|
1031 DEFSUBR (Fcanna_initialize);
|
|
1032 DEFSUBR (Fcanna_finalize);
|
|
1033 DEFSUBR (Fcanna_touroku_string);
|
|
1034 DEFSUBR (Fcanna_set_width);
|
|
1035 DEFSUBR (Fcanna_change_mode);
|
|
1036 DEFSUBR (Fcanna_store_yomi);
|
|
1037 DEFSUBR (Fcanna_do_function);
|
|
1038 DEFSUBR (Fcanna_parse);
|
|
1039 DEFSUBR (Fcanna_query_mode);
|
|
1040 DEFSUBR (Fcanna_set_bunsetsu);
|
|
1041
|
|
1042 DEFSUBR (Fcanna_henkan_begin);
|
|
1043 DEFSUBR (Fcanna_henkan_next);
|
|
1044 DEFSUBR (Fcanna_bunsetu_henkou);
|
|
1045 DEFSUBR (Fcanna_henkan_kakutei);
|
|
1046 DEFSUBR (Fcanna_henkan_end);
|
|
1047 DEFSUBR (Fcanna_henkan_quit);
|
|
1048 }
|
|
1049
|
|
1050 void
|
|
1051 vars_of_mule_canna (void)
|
|
1052 {
|
|
1053 DEFVAR_LISP ("canna-kakutei-string", &Vcanna_kakutei_string /*
|
|
1054
|
|
1055 */ );
|
|
1056 DEFVAR_LISP ("canna-kakutei-yomi", &Vcanna_kakutei_yomi /*
|
|
1057
|
|
1058 */ );
|
|
1059 DEFVAR_LISP ("canna-kakutei-romaji", &Vcanna_kakutei_romaji /*
|
|
1060
|
|
1061 */ );
|
|
1062 DEFVAR_LISP ("canna-henkan-string", &Vcanna_henkan_string /*
|
|
1063
|
|
1064 */ );
|
|
1065 DEFVAR_INT ("canna-henkan-length", &Vcanna_henkan_length /*
|
|
1066
|
|
1067 */ );
|
|
1068 DEFVAR_INT ("canna-henkan-revpos", &Vcanna_henkan_revPos /*
|
|
1069
|
|
1070 */ );
|
|
1071 DEFVAR_INT ("canna-henkan-revlen", &Vcanna_henkan_revLen /*
|
|
1072
|
|
1073 */ );
|
|
1074 DEFVAR_LISP ("canna-ichiran-string", &Vcanna_ichiran_string /*
|
|
1075
|
|
1076 */ );
|
|
1077 DEFVAR_INT ("canna-ichiran-length", &Vcanna_ichiran_length /*
|
|
1078
|
|
1079 */ );
|
|
1080 DEFVAR_INT ("canna-ichiran-revpos", &Vcanna_ichiran_revPos /*
|
|
1081
|
|
1082 */ );
|
|
1083 DEFVAR_INT ("canna-ichiran-revlen", &Vcanna_ichiran_revLen /*
|
|
1084
|
|
1085 */ );
|
|
1086 DEFVAR_LISP ("canna-mode-string", &Vcanna_mode_string /*
|
|
1087
|
|
1088 */ );
|
|
1089
|
|
1090 DEFVAR_BOOL ("canna-empty-info", &Vcanna_empty_info /*
|
|
1091 For canna
|
|
1092 */ );
|
|
1093 DEFVAR_BOOL ("canna-through-info", &Vcanna_through_info /*
|
|
1094 For canna
|
|
1095 */ );
|
|
1096 DEFVAR_BOOL ("canna-underline", &Vcanna_underline /*
|
|
1097 For canna
|
|
1098 */ );
|
|
1099 DEFVAR_BOOL ("canna-inhibit-hankakukana", &Vcanna_inhibit_hankakukana /*
|
|
1100 For canna
|
|
1101 */ );
|
|
1102
|
|
1103 DEFVAR_INT ("canna-mode-alpha-mode", &Vcanna_mode_AlphaMode /*
|
|
1104
|
|
1105 */ );
|
|
1106 DEFVAR_INT ("canna-mode-empty-mode", &Vcanna_mode_EmptyMode /*
|
|
1107
|
|
1108 */ );
|
|
1109 DEFVAR_INT ("canna-mode-kigo-mode", &Vcanna_mode_KigoMode /*
|
|
1110
|
|
1111 */ );
|
|
1112 DEFVAR_INT ("canna-mode-yomi-mode", &Vcanna_mode_YomiMode /*
|
|
1113
|
|
1114 */ );
|
|
1115 DEFVAR_INT ("canna-mode-jishu-mode", &Vcanna_mode_JishuMode /*
|
|
1116
|
|
1117 */ );
|
|
1118 DEFVAR_INT ("canna-mode-tankouho-mode", &Vcanna_mode_TankouhoMode /*
|
|
1119
|
|
1120 */ );
|
|
1121 DEFVAR_INT ("canna-mode-ichiran-mode", &Vcanna_mode_IchiranMode /*
|
|
1122
|
|
1123 */ );
|
|
1124 DEFVAR_INT ("canna-mode-yes-no-mode", &Vcanna_mode_YesNoMode /*
|
|
1125
|
|
1126 */ );
|
|
1127 DEFVAR_INT ("canna-mode-on-off-mode", &Vcanna_mode_OnOffMode /*
|
|
1128
|
|
1129 */ );
|
|
1130 #ifdef CANNA_MODE_AdjustBunsetsuMode
|
|
1131 DEFVAR_INT ("canna-mode-adjust-bunsetsu-mode",
|
|
1132 &Vcanna_mode_AdjustBunsetsuMode /*
|
|
1133
|
|
1134 */ );
|
|
1135 #endif
|
|
1136 #ifdef CANNA_MODE_ChikujiYomiMode
|
|
1137 DEFVAR_INT ("canna-mode-chikuji-yomi-mode", &Vcanna_mode_ChikujiYomiMode /*
|
|
1138
|
|
1139 */ );
|
|
1140 DEFVAR_INT ("canna-mode-chikuji-bunsetsu-mode",
|
|
1141 &Vcanna_mode_ChikujiTanMode /*
|
|
1142
|
|
1143 */ );
|
|
1144 #endif
|
|
1145
|
|
1146 DEFVAR_INT ("canna-mode-henkan-mode", &Vcanna_mode_HenkanMode /*
|
|
1147
|
|
1148 */ );
|
|
1149 #ifdef CANNA_MODE_HenkanNyuryokuMode
|
|
1150 DEFVAR_INT ("canna-mode-henkan-nyuuryoku-mode",
|
|
1151 &Vcanna_mode_HenkanNyuryokuMode /*
|
|
1152
|
|
1153 */ );
|
|
1154 #endif
|
|
1155 #ifdef CANNA_MODE_ZenHiraHenkanMode
|
|
1156 DEFVAR_INT ("canna-mode-zen-hira-henkan-mode",
|
|
1157 &Vcanna_mode_ZenHiraHenkanMode /*
|
|
1158
|
|
1159 */ );
|
|
1160 #ifdef CANNA_MODE_HanHiraHenkanMode
|
|
1161 DEFVAR_INT ("canna-mode-han-hira-henkan-mode",
|
|
1162 &Vcanna_mode_HanHiraHenkanMode /*
|
|
1163
|
|
1164 */ );
|
|
1165 #endif
|
|
1166 DEFVAR_INT ("canna-mode-zen-kata-henkan-mode",
|
|
1167 &Vcanna_mode_ZenKataHenkanMode /*
|
|
1168
|
|
1169 */ );
|
|
1170 DEFVAR_INT ("canna-mode-han-kata-henkan-mode",
|
|
1171 &Vcanna_mode_HanKataHenkanMode /*
|
|
1172
|
|
1173 */ );
|
|
1174 DEFVAR_INT ("canna-mode-zen-alpha-henkan-mode",
|
|
1175 &Vcanna_mode_ZenAlphaHenkanMode /*
|
|
1176
|
|
1177 */ );
|
|
1178 DEFVAR_INT ("canna-mode-han-alpha-henkan-mode",
|
|
1179 &Vcanna_mode_HanAlphaHenkanMode /*
|
|
1180
|
|
1181 */ );
|
|
1182 #endif
|
|
1183 DEFVAR_INT ("canna-mode-zen-hira-kakutei-mode",
|
|
1184 &Vcanna_mode_ZenHiraKakuteiMode /*
|
|
1185
|
|
1186 */ );
|
|
1187 #ifdef CANNA_MODE_HanHiraKakuteiMode
|
|
1188 DEFVAR_INT ("canna-mode-han-hira-kakutei-mode",
|
|
1189 &Vcanna_mode_HanHiraKakuteiMode /*
|
|
1190
|
|
1191 */ );
|
|
1192 #endif
|
|
1193 DEFVAR_INT ("canna-mode-zen-kata-kakutei-mode",
|
|
1194 &Vcanna_mode_ZenKataKakuteiMode /*
|
|
1195
|
|
1196 */ );
|
|
1197 DEFVAR_INT ("canna-mode-han-kata-kakutei-mode",
|
|
1198 &Vcanna_mode_HanKataKakuteiMode /*
|
|
1199
|
|
1200 */ );
|
|
1201 DEFVAR_INT ("canna-mode-zen-alpha-kakutei-mode",
|
|
1202 &Vcanna_mode_ZenAlphaKakuteiMode /*
|
|
1203
|
|
1204 */ );
|
|
1205 DEFVAR_INT ("canna-mode-han-alpha-kakutei-mode",
|
|
1206 &Vcanna_mode_HanAlphaKakuteiMode /*
|
|
1207
|
|
1208 */ );
|
|
1209 DEFVAR_INT ("canna-mode-hex-mode", &Vcanna_mode_HexMode /*
|
|
1210
|
|
1211 */ );
|
|
1212 DEFVAR_INT ("canna-mode-bushu-mode", &Vcanna_mode_BushuMode /*
|
|
1213
|
|
1214 */ );
|
|
1215 DEFVAR_INT ("canna-mode-extend-mode", &Vcanna_mode_ExtendMode /*
|
|
1216
|
|
1217 */ );
|
|
1218 DEFVAR_INT ("canna-mode-russian-mode", &Vcanna_mode_RussianMode /*
|
|
1219
|
|
1220 */ );
|
|
1221 DEFVAR_INT ("canna-mode-greek-mode", &Vcanna_mode_GreekMode /*
|
|
1222
|
|
1223 */ );
|
|
1224 DEFVAR_INT ("canna-mode-line-mode", &Vcanna_mode_LineMode /*
|
|
1225
|
|
1226 */ );
|
|
1227 DEFVAR_INT ("canna-mode-changing-server-mode",
|
|
1228 &Vcanna_mode_ChangingServerMode /*
|
|
1229
|
|
1230 */ );
|
|
1231 DEFVAR_INT ("canna-mode-henkan-method-mode",
|
|
1232 &Vcanna_mode_HenkanMethodMode /*
|
|
1233
|
|
1234 */ );
|
|
1235 DEFVAR_INT ("canna-mode-delete-dic-mode", &Vcanna_mode_DeleteDicMode /*
|
|
1236
|
|
1237 */ );
|
|
1238 DEFVAR_INT ("canna-mode-touroku-mode", &Vcanna_mode_TourokuMode /*
|
|
1239
|
|
1240 */ );
|
|
1241 DEFVAR_INT ("canna-mode-touroku-empty-mode",
|
|
1242 &Vcanna_mode_TourokuEmptyMode /*
|
|
1243
|
|
1244 */ );
|
|
1245 DEFVAR_INT ("canna-mode-touroku-hinshi-mode",
|
|
1246 &Vcanna_mode_TourokuHinshiMode /*
|
|
1247
|
|
1248 */ );
|
|
1249 DEFVAR_INT ("canna-mode-touroku-dic-mode", &Vcanna_mode_TourokuDicMode /*
|
|
1250
|
|
1251 */ );
|
|
1252 DEFVAR_INT ("canna-mode-quoted-insert-mode",
|
|
1253 &Vcanna_mode_QuotedInsertMode /*
|
|
1254
|
|
1255 */ );
|
|
1256 DEFVAR_INT ("canna-mode-bubun-muhenkan-mode",
|
|
1257 &Vcanna_mode_BubunMuhenkanMode /*
|
|
1258
|
|
1259 */ );
|
|
1260 DEFVAR_INT ("canna-mode-mount-dic-mode", &Vcanna_mode_MountDicMode /*
|
|
1261
|
|
1262 */ );
|
|
1263
|
|
1264 DEFVAR_INT ("canna-func-self-insert", &Vcanna_fn_SelfInsert /*
|
|
1265
|
|
1266 */ );
|
|
1267 DEFVAR_INT ("canna-func-functional-insert", &Vcanna_fn_FunctionalInsert /*
|
|
1268
|
|
1269 */ );
|
|
1270 DEFVAR_INT ("canna-func-quoted-insert", &Vcanna_fn_QuotedInsert /*
|
|
1271
|
|
1272 */ );
|
|
1273 DEFVAR_INT ("canna-func-japanese-mode", &Vcanna_fn_JapaneseMode /*
|
|
1274
|
|
1275 */ );
|
|
1276 DEFVAR_INT ("canna-func-alpha-mode", &Vcanna_fn_AlphaMode /*
|
|
1277
|
|
1278 */ );
|
|
1279 DEFVAR_INT ("canna-func-henkan-nyuryoku-mode",
|
|
1280 &Vcanna_fn_HenkanNyuryokuMode /*
|
|
1281
|
|
1282 */ );
|
|
1283 DEFVAR_INT ("canna-func-forward", &Vcanna_fn_Forward /*
|
|
1284
|
|
1285 */ );
|
|
1286 DEFVAR_INT ("canna-func-backward", &Vcanna_fn_Backward /*
|
|
1287
|
|
1288 */ );
|
|
1289 DEFVAR_INT ("canna-func-next", &Vcanna_fn_Next /*
|
|
1290
|
|
1291 */ );
|
|
1292 DEFVAR_INT ("canna-func-previous", &Vcanna_fn_Prev /*
|
|
1293
|
|
1294 */ );
|
|
1295 DEFVAR_INT ("canna-func-beginning-of-line", &Vcanna_fn_BeginningOfLine /*
|
|
1296
|
|
1297 */ );
|
|
1298 DEFVAR_INT ("canna-func-end-of-line", &Vcanna_fn_EndOfLine /*
|
|
1299
|
|
1300 */ );
|
|
1301 DEFVAR_INT ("canna-func-delete-next", &Vcanna_fn_DeleteNext /*
|
|
1302
|
|
1303 */ );
|
|
1304 DEFVAR_INT ("canna-func-delete_previous", &Vcanna_fn_DeletePrevious /*
|
|
1305
|
|
1306 */ );
|
|
1307 DEFVAR_INT ("canna-func-kill-to-end-of-line", &Vcanna_fn_KillToEndOfLine /*
|
|
1308
|
|
1309 */ );
|
|
1310 DEFVAR_INT ("canna-func-henkan", &Vcanna_fn_Henkan /*
|
|
1311
|
|
1312 */ );
|
|
1313 DEFVAR_INT ("canna-func-kakutei", &Vcanna_fn_Kakutei /*
|
|
1314
|
|
1315 */ );
|
|
1316 DEFVAR_INT ("canna-func-extend", &Vcanna_fn_Extend /*
|
|
1317
|
|
1318 */ );
|
|
1319 DEFVAR_INT ("canna-func-shrink", &Vcanna_fn_Shrink /*
|
|
1320
|
|
1321 */ );
|
|
1322 #ifdef CANNA_FN_AdjustBunsetsu
|
|
1323 DEFVAR_INT ("canna-func-adjust-bunsetsu", &Vcanna_fn_AdjustBunsetsu /*
|
|
1324
|
|
1325 */ );
|
|
1326 #endif
|
|
1327 DEFVAR_INT ("canna-func-quit", &Vcanna_fn_Quit /*
|
|
1328
|
|
1329 */ );
|
|
1330 DEFVAR_INT ("canna-func-convert-as-hex", &Vcanna_fn_ConvertAsHex /*
|
|
1331
|
|
1332 */ );
|
|
1333 DEFVAR_INT ("canna-func-convert-as-bushu", &Vcanna_fn_ConvertAsBushu /*
|
|
1334
|
|
1335 */ );
|
|
1336 DEFVAR_INT ("canna-func-kouho-ichiran", &Vcanna_fn_KouhoIchiran /*
|
|
1337
|
|
1338 */ );
|
|
1339 DEFVAR_INT ("canna-func-bubun-muhenkan", &Vcanna_fn_BubunMuhenkan /*
|
|
1340
|
|
1341 */ );
|
|
1342 DEFVAR_INT ("canna-func-zenkaku", &Vcanna_fn_Zenkaku /*
|
|
1343
|
|
1344 */ );
|
|
1345 DEFVAR_INT ("canna-func-hankaku", &Vcanna_fn_Hankaku /*
|
|
1346
|
|
1347 */ );
|
|
1348 DEFVAR_INT ("canna-func-to-upper", &Vcanna_fn_ToUpper /*
|
|
1349
|
|
1350 */ );
|
|
1351 DEFVAR_INT ("canna-func-capitalize", &Vcanna_fn_Capitalize /*
|
|
1352
|
|
1353 */ );
|
|
1354 DEFVAR_INT ("canna-func-to-lower", &Vcanna_fn_ToLower /*
|
|
1355
|
|
1356 */ );
|
|
1357 DEFVAR_INT ("canna-func-hiragana", &Vcanna_fn_Hiragana /*
|
|
1358
|
|
1359 */ );
|
|
1360 DEFVAR_INT ("canna-func-katakana", &Vcanna_fn_Katakana /*
|
|
1361
|
|
1362 */ );
|
|
1363 DEFVAR_INT ("canna-func-romaji", &Vcanna_fn_Romaji /*
|
|
1364
|
|
1365 */ );
|
|
1366 #ifdef CANNA_FN_BaseHiragana
|
|
1367 DEFVAR_INT ("canna-func-base-hiragana", &Vcanna_fn_BaseHiragana /*
|
|
1368
|
|
1369 */ );
|
|
1370 DEFVAR_INT ("canna-func-base-katakana", &Vcanna_fn_BaseKatakana /*
|
|
1371
|
|
1372 */ );
|
|
1373 DEFVAR_INT ("canna-func-base-eisu", &Vcanna_fn_BaseEisu /*
|
|
1374
|
|
1375 */ );
|
|
1376 DEFVAR_INT ("canna-func-base-zenkaku", &Vcanna_fn_BaseZenkaku /*
|
|
1377
|
|
1378 */ );
|
|
1379 DEFVAR_INT ("canna-func-base-hankaku", &Vcanna_fn_BaseHankaku /*
|
|
1380
|
|
1381 */ );
|
|
1382 DEFVAR_INT ("canna-func-base-kana", &Vcanna_fn_BaseKana /*
|
|
1383
|
|
1384 */ );
|
|
1385 DEFVAR_INT ("canna-func-base-kakutei", &Vcanna_fn_BaseKakutei /*
|
|
1386
|
|
1387 */ );
|
|
1388 DEFVAR_INT ("canna-func-base-henkan", &Vcanna_fn_BaseHenkan /*
|
|
1389
|
|
1390 */ );
|
|
1391 DEFVAR_INT ("canna-func-base-hiragana-katakana-toggle",
|
|
1392 &Vcanna_fn_BaseHiraKataToggle /*
|
|
1393
|
|
1394 */ );
|
|
1395 DEFVAR_INT ("canna-func-base-zenkaku-hankaku-toggle",
|
|
1396 &Vcanna_fn_BaseZenHanToggle /*
|
|
1397
|
|
1398 */ );
|
|
1399 DEFVAR_INT ("canna-func-base-kana-eisu-toggle",
|
|
1400 &Vcanna_fn_BaseKanaEisuToggle /*
|
|
1401
|
|
1402 */ );
|
|
1403 DEFVAR_INT ("canna-func-base-kakutei-henkan-toggle",
|
|
1404 &Vcanna_fn_BaseKakuteiHenkanToggle /*
|
|
1405
|
|
1406 */ );
|
|
1407 DEFVAR_INT ("canna-func-base-rotate-forward",
|
|
1408 &Vcanna_fn_BaseRotateForward /*
|
|
1409
|
|
1410 */ );
|
|
1411 DEFVAR_INT ("canna-func-base-rotate-backward",
|
|
1412 &Vcanna_fn_BaseRotateBackward /*
|
|
1413
|
|
1414 */ );
|
|
1415 #endif
|
|
1416 DEFVAR_INT ("canna-func-extend-mode", &Vcanna_fn_ExtendMode /*
|
|
1417
|
|
1418 */ );
|
|
1419 DEFVAR_INT ("canna-func-touroku", &Vcanna_fn_Touroku /*
|
|
1420
|
|
1421 */ );
|
|
1422 DEFVAR_INT ("canna-func-hex-mode", &Vcanna_fn_HexMode /*
|
|
1423
|
|
1424 */ );
|
|
1425 DEFVAR_INT ("canna-func-bushu-mode", &Vcanna_fn_BushuMode /*
|
|
1426
|
|
1427 */ );
|
|
1428 DEFVAR_INT ("canna-func-kigo-mode", &Vcanna_fn_KigouMode /*
|
|
1429
|
|
1430 */ );
|
|
1431 #ifdef CANNA_FN_Mark
|
|
1432 DEFVAR_INT ("canna-func-mark", &Vcanna_fn_Mark /*
|
|
1433
|
|
1434 */ );
|
|
1435 #endif
|
|
1436 #ifdef CANNA_FN_TemporalMode
|
|
1437 DEFVAR_INT ("canna-func-temporal-mode", &Vcanna_fn_TemporalMode /*
|
|
1438
|
|
1439 */ );
|
|
1440 #endif
|
|
1441
|
|
1442 DEFVAR_INT ("canna-key-nfer", &Vcanna_key_Nfer /*
|
|
1443
|
|
1444 */ );
|
|
1445 DEFVAR_INT ("canna-key-xfer", &Vcanna_key_Xfer /*
|
|
1446
|
|
1447 */ );
|
|
1448 DEFVAR_INT ("canna-key-up", &Vcanna_key_Up /*
|
|
1449
|
|
1450 */ );
|
|
1451 DEFVAR_INT ("canna-key-left", &Vcanna_key_Left /*
|
|
1452
|
|
1453 */ );
|
|
1454 DEFVAR_INT ("canna-key-right", &Vcanna_key_Right /*
|
|
1455
|
|
1456 */ );
|
|
1457 DEFVAR_INT ("canna-key-down", &Vcanna_key_Down /*
|
|
1458
|
|
1459 */ );
|
|
1460 DEFVAR_INT ("canna-key-insert", &Vcanna_key_Insert /*
|
|
1461
|
|
1462 */ );
|
|
1463 DEFVAR_INT ("canna-key-rollup", &Vcanna_key_Rollup /*
|
|
1464
|
|
1465 */ );
|
|
1466 DEFVAR_INT ("canna-key-rolldown", &Vcanna_key_Rolldown /*
|
|
1467
|
|
1468 */ );
|
|
1469 DEFVAR_INT ("canna-key-home", &Vcanna_key_Home /*
|
|
1470
|
|
1471 */ );
|
|
1472 DEFVAR_INT ("canna-key-help", &Vcanna_key_Help /*
|
|
1473
|
|
1474 */ );
|
|
1475 DEFVAR_INT ("canna-key-kp-key", &Vcanna_key_KP_Key /*
|
|
1476
|
|
1477 */ );
|
|
1478 DEFVAR_INT ("canna-key-shift-nfer", &Vcanna_key_Shift_Nfer /*
|
|
1479
|
|
1480 */ );
|
|
1481 DEFVAR_INT ("canna-key-shift-xfer", &Vcanna_key_Shift_Xfer /*
|
|
1482
|
|
1483 */ );
|
|
1484 DEFVAR_INT ("canna-key-shift-up", &Vcanna_key_Shift_Up /*
|
|
1485
|
|
1486 */ );
|
|
1487 DEFVAR_INT ("canna-key-shift-left", &Vcanna_key_Shift_Left /*
|
|
1488
|
|
1489 */ );
|
|
1490 DEFVAR_INT ("canna-key-shift-right", &Vcanna_key_Shift_Right /*
|
|
1491
|
|
1492 */ );
|
|
1493 DEFVAR_INT ("canna-key-shift-down", &Vcanna_key_Shift_Down /*
|
|
1494
|
|
1495 */ );
|
|
1496 DEFVAR_INT ("canna-key-control-nfer", &Vcanna_key_Cntrl_Nfer /*
|
|
1497
|
|
1498 */ );
|
|
1499 DEFVAR_INT ("canna-key-control-xfer", &Vcanna_key_Cntrl_Xfer /*
|
|
1500
|
|
1501 */ );
|
|
1502 DEFVAR_INT ("canna-key-control-up", &Vcanna_key_Cntrl_Up /*
|
|
1503
|
|
1504 */ );
|
|
1505 DEFVAR_INT ("canna-key-control-left", &Vcanna_key_Cntrl_Left /*
|
|
1506
|
|
1507 */ );
|
|
1508 DEFVAR_INT ("canna-key-control-right", &Vcanna_key_Cntrl_Right /*
|
|
1509
|
|
1510 */ );
|
|
1511 DEFVAR_INT ("canna-key-control-down", &Vcanna_key_Cntrl_Down /*
|
|
1512
|
|
1513 */ );
|
|
1514 }
|
|
1515
|
|
1516 #ifdef CANNA_MULE
|
|
1517 /* To handle MULE internal code and EUC.
|
|
1518 I assume CANNA can handle only Japanese EUC. */
|
|
1519
|
|
1520 /* EUC multibyte string to MULE internal string */
|
|
1521
|
|
1522 static void
|
|
1523 c2mu (char *cp, int l, char *mp)
|
|
1524 {
|
|
1525 char ch, *ep = cp+l;
|
|
1526
|
|
1527 while ((cp < ep) && (ch = *cp))
|
|
1528 {
|
|
1529 if ((unsigned char) ch == ISO_CODE_SS2)
|
|
1530 {
|
74
|
1531 *mp++ = LEADING_BYTE_KATAKANA_JISX0201;
|
70
|
1532 cp++;
|
|
1533 }
|
|
1534 else if ((unsigned char) ch == ISO_CODE_SS3)
|
|
1535 {
|
|
1536 *mp++ = LEADING_BYTE_JAPANESE_JISX0212;
|
|
1537 cp++;
|
|
1538 *mp++ = *cp++;
|
|
1539 }
|
|
1540 else if (ch & 0x80)
|
|
1541 {
|
|
1542 *mp++ = LEADING_BYTE_JAPANESE_JISX0208;
|
|
1543 *mp++ = *cp++;
|
|
1544 }
|
|
1545 *mp++ = *cp++;
|
|
1546 }
|
|
1547 *mp = 0;
|
|
1548 }
|
|
1549
|
|
1550 /* MULE internal string to EUC multibyte string */
|
|
1551
|
|
1552 static void
|
|
1553 m2c (unsigned char *mp, int l, unsigned char *cp)
|
|
1554 {
|
|
1555 unsigned char ch, *ep = mp + l;;
|
|
1556
|
|
1557 while ((mp < ep) && (ch = *mp++))
|
|
1558 {
|
|
1559 switch (ch)
|
|
1560 {
|
74
|
1561 case LEADING_BYTE_KATAKANA_JISX0201:
|
70
|
1562 *cp++ = ISO_CODE_SS2;
|
|
1563 *cp++ = *mp++;
|
|
1564 break;
|
|
1565 case LEADING_BYTE_JAPANESE_JISX0212:
|
|
1566 *cp++ = ISO_CODE_SS3;
|
|
1567 case LEADING_BYTE_JAPANESE_JISX0208:
|
|
1568 *cp++ = *mp++;
|
|
1569 *cp++ = *mp++;
|
|
1570 break;
|
|
1571 default:
|
|
1572 *cp++ = ch;
|
|
1573 break;
|
|
1574 }
|
|
1575 }
|
|
1576 *cp = 0;
|
|
1577 }
|
|
1578
|
|
1579 #undef make_string
|
|
1580
|
|
1581 /* make_string after converting EUC string to MULE internal string */
|
|
1582 static Lisp_Object
|
|
1583 mule_make_string (unsigned char *p, int l)
|
|
1584 {
|
|
1585 unsigned char cbuf[4096];
|
|
1586
|
|
1587 c2mu (p,l,cbuf);
|
|
1588 return (make_string (cbuf,strlen (cbuf)));
|
|
1589 }
|
|
1590
|
|
1591 /* return the MULE internal string length of EUC string */
|
116
|
1592 /* Modified by sb to return a character count not byte count. */
|
70
|
1593 static int
|
|
1594 mule_strlen (unsigned char *p, int l)
|
|
1595 {
|
|
1596 unsigned char ch, *cp = p;
|
|
1597 int len = 0;
|
|
1598
|
|
1599 while ((cp < p + l) && (ch = *cp))
|
|
1600 {
|
|
1601 if ((unsigned char) ch == ISO_CODE_SS2)
|
|
1602 {
|
116
|
1603 len++;
|
70
|
1604 cp += 2;
|
|
1605 }
|
|
1606 else if ((unsigned char) ch == ISO_CODE_SS3)
|
|
1607 {
|
116
|
1608 len++;
|
70
|
1609 cp += 3;
|
|
1610 }
|
|
1611 else if (ch & 0x80)
|
|
1612 {
|
116
|
1613 len++;
|
70
|
1614 cp += 2;
|
|
1615 }
|
|
1616 else
|
|
1617 {
|
|
1618 len++;
|
|
1619 cp++;
|
|
1620 }
|
|
1621 }
|
|
1622 return (len);
|
|
1623 }
|
|
1624
|
|
1625 /* count number of characters */
|
|
1626 static
|
|
1627 count_char (unsigned char *p, int len, int pos, int rev, int *clen, int *cpos,
|
|
1628 int *crev)
|
|
1629 {
|
|
1630 unsigned char *q = p;
|
|
1631
|
|
1632 *clen = *cpos = *crev = 0;
|
|
1633 if (len == 0) return;
|
|
1634 while (q < p + pos)
|
|
1635 {
|
|
1636 (*clen)++;
|
|
1637 (*cpos)++;
|
|
1638 if (*q++ & 0x80) q++;
|
|
1639 }
|
|
1640 while (q < p + pos + rev)
|
|
1641 {
|
|
1642 (*clen)++;
|
|
1643 (*crev)++;
|
|
1644 if (*q++ & 0x80) q++;
|
|
1645 }
|
|
1646 while (q < p + len)
|
|
1647 {
|
|
1648 (*clen)++;
|
|
1649 if (*q++ & 0x80) q++;
|
|
1650 }
|
|
1651 }
|
|
1652 #endif /* CANNA_MULE */
|