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