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