Mercurial > hg > xemacs-beta
annotate modules/canna/canna_api.c @ 5201:11ed8768ac4f
attempt to fix errors in canna_api.c
-------------------- ChangeLog entries follow: --------------------
modules/ChangeLog addition:
2010-04-12 Ben Wing <ben@xemacs.org>
* canna/canna_api.c:
* canna/canna_api.c (Fcanna_henkan_begin):
Fixes for errors reported in smoketest build.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 12 Apr 2010 01:35:56 -0500 |
parents | c0934cef10c6 |
children | 308d34e9f07d |
rev | line source |
---|---|
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
1 /* CANNA interface -*- coding: utf-8 -*- |
3010 | 2 |
3 Copyright (C) 1995 Free Software Foundation, Inc. | |
4 Copyright (C) 1995 Sun Microsystems, Inc. | |
5201
11ed8768ac4f
attempt to fix errors in canna_api.c
Ben Wing <ben@xemacs.org>
parents:
4993
diff
changeset
|
5 Copyright (C) 2005, 2010 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 | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
202 #define make_euc_string(p, len) make_extstring ((Extbyte *) p, len, Qeuc_jp) |
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
203 #define build_euc_string(p) build_extstring ((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 { | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
240 /* 確定した文字列 (the confirmed string) */ |
3071 | 241 Vcanna_kakutei_string = make_euc_string (buf, len); |
3010 | 242 val = make_int (len); |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
243 /* 確定した文字列の読みの情報... |
3010 | 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 = | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
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); |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
263 /* ローマ字 (romanization) */ |
3010 | 264 } |
265 } | |
266 } | |
267 | |
268 | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
269 /* 候補表示の文字列です。 |
3010 | 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 | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
296 /* 一覧の情報 (information about the echo area menu) */ |
3010 | 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 | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
314 /* モードの情報 (mode information) */ |
3010 | 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 | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
321 /* その他の情報 (other information) */ |
3010 | 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! */ |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
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! */ |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
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 */ | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
393 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, |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
404 LISP_STRING_TO_EXTERNAL (rcfile, Qfile_name)); |
3010 | 405 } |
406 | |
3071 | 407 { |
408 char **warning = (char **) 0; | |
409 res = jrKanjiControl (0, KC_INITIALIZE, (char *) &warning); | |
410 val = Qnil; | |
411 if (warning) | |
412 { | |
413 for (p = q = warning ; *q ; q++) | |
414 ; | |
415 while (p < q) | |
416 { | |
417 q--; | |
418 val = Fcons (build_euc_string (*q), val); | |
419 } | |
420 } | |
421 val = Fcons (val, Qnil); | |
422 } | |
3010 | 423 |
424 if (res == -1) | |
425 { | |
3071 | 426 val = Fcons (build_euc_string (jrKanjiError), val); |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
427 /* イニシャライズで失敗した場合。 (on initialization failure) */ |
3010 | 428 return Fcons (Qnil, val); |
429 } | |
430 else | |
431 { | |
432 jrBeepFunc = call_Fding; | |
433 | |
434 #ifdef KC_SETAPPNAME | |
435 #ifndef CANNA_MULE | |
436 jrKanjiControl (0, KC_SETAPPNAME, "nemacs"); | |
437 #else /* CANNA_MULE */ | |
438 jrKanjiControl (0, KC_SETAPPNAME, "mule"); | |
439 #endif /* CANNA_MULE */ | |
440 #endif /* KC_SETAPPNAME */ | |
441 | |
4042 | 442 jrKanjiControl (0, KC_SETBUNSETSUKUGIRI, kugiri); |
3010 | 443 jrKanjiControl (0, KC_SETWIDTH, (char *) 78); |
444 #ifndef CANNA_MULE | |
445 jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1); | |
446 #else | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
447 /* mule だったら半角カタカナも使える |
3010 | 448 (Mule can use half-width katakana) */ |
449 if (canna_inhibit_hankakukana) | |
450 jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1); | |
451 #endif | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
452 jrKanjiControl (0, KC_YOMIINFO, (char *) 2); /* ※2: ローマ字まで返す |
3010 | 453 (*2: return to |
454 romanized form) */ | |
455 val = Fcons (Qnil, val); | |
456 return Fcons (CANNA_mode_keys (), val); | |
457 } | |
458 } | |
459 | |
460 DEFUN ("canna-finalize", Fcanna_finalize, 0, 0, 0, /* | |
461 finalize ``canna'', which is a kana-to-kanji converter for XEmacs. | |
462 This cause to write miscellaneous informations to kana-to-kanji dictionary. | |
463 */ | |
464 ()) | |
465 { | |
466 Lisp_Object val; | |
3071 | 467 char **p; |
468 char **warning = (char **) 0; | |
3010 | 469 |
3071 | 470 jrKanjiControl (0, KC_FINALIZE, (char *) &warning); |
3010 | 471 |
472 val = Qnil; | |
473 if (warning) | |
474 { | |
3071 | 475 for (p = warning ; *p; p++) |
3010 | 476 { |
3071 | 477 /* !!#### This is almost certainly wrong; `canna-initialize |
478 starts at the end of the warnings so the resulting list is | |
479 in the correct order. We should do the same. */ | |
480 val = Fcons (build_euc_string (*p), val); | |
3010 | 481 } |
482 } | |
483 val = Fcons (val, Qnil); | |
484 IRCP_context = -1; | |
485 return val; | |
486 } | |
487 | |
488 DEFUN ("canna-touroku-string", Fcanna_touroku_string, 1, 1, 0, /* | |
489 Register Kanji words into kana-to-kanji conversion dictionary. | |
490 */ | |
491 (str)) | |
492 { | |
493 jrKanjiStatusWithValue ksv; | |
494 jrKanjiStatus ks; | |
495 | |
496 CHECK_STRING (str); | |
497 ksv.buffer = (unsigned char *) key_buffer; | |
498 ksv.bytes_buffer = KEYTOSTRSIZE; | |
3071 | 499 LISP_STRING_TO_SIZED_EXTERNAL (str, ks.echoStr, ks.length, Qeuc_jp); |
3010 | 500 ksv.ks = &ks; |
501 jrKanjiControl (0, KC_DEFINEKANJI, (char *)&ksv); | |
502 return storeResults (key_buffer, ksv.val, ksv.ks); | |
503 } | |
504 | |
505 DEFUN ("canna-set-width", Fcanna_set_width, 1, 1, 0, /* | |
506 Set status-line width information, which is used to display | |
507 kanji candidates. | |
508 */ | |
509 (num)) | |
510 { | |
511 CHECK_INT (num); | |
512 | |
513 jrKanjiControl (0, KC_SETWIDTH, (char *) XINT (num)); | |
514 return Qnil; | |
515 } | |
516 | |
517 DEFUN ("canna-change-mode", Fcanna_change_mode, 1, 1, 0, /* | |
518 Change Japanese pre-edit mode. | |
519 */ | |
520 (num)) | |
521 { | |
522 jrKanjiStatusWithValue ksv; | |
523 jrKanjiStatus ks; | |
524 | |
525 CHECK_INT (num); | |
526 | |
527 ksv.buffer = (unsigned char *) key_buffer; | |
528 ksv.bytes_buffer = KEYTOSTRSIZE; | |
529 ksv.ks = &ks; | |
530 ksv.val = XINT (num); | |
531 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv); | |
532 return storeResults (key_buffer, ksv.val, ksv.ks); | |
533 } | |
534 | |
535 static Lisp_Object | |
536 CANNA_mode_keys (void) | |
537 { | |
538 #define CANNAWORKBUFSIZE 32 | |
539 char xxx[CANNAWORKBUFSIZE]; | |
540 Lisp_Object val; | |
541 int i, n; | |
542 | |
543 n = jrKanjiControl (0, KC_MODEKEYS, xxx); | |
544 val = Qnil; | |
545 for (i = n ; i > 0 ;) | |
546 { | |
547 --i; | |
548 /* !!#### something fucked here */ | |
549 val = Fcons (make_char ((int)(0xFF & (unsigned char) xxx[i])), val); | |
550 } | |
551 return val; | |
552 } | |
553 | |
554 DEFUN ("canna-store-yomi", Fcanna_store_yomi, 1, 2, 0, /* | |
555 Store yomi characters as a YOMI of kana-to-kanji conversion. | |
556 */ | |
557 (yomi, roma)) | |
558 { | |
559 jrKanjiStatusWithValue ksv; | |
560 jrKanjiStatus ks; | |
3071 | 561 Extbyte *ext; |
3010 | 562 |
563 CHECK_STRING (yomi); | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
564 ext = LISP_STRING_TO_EXTERNAL (yomi, Qeuc_jp); |
3071 | 565 strncpy (key_buffer, ext, sizeof (key_buffer)); |
566 key_buffer[sizeof (key_buffer) - 1] = '\0'; | |
3010 | 567 ks.length = strlen (key_buffer); |
568 | |
569 if (NILP (roma)) | |
570 { | |
571 ks.mode = 0; | |
572 } | |
573 else | |
574 { | |
575 CHECK_STRING (roma); | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
576 ext = LISP_STRING_TO_EXTERNAL (roma, Qeuc_jp); |
3071 | 577 ks.mode = (unsigned char *) (key_buffer + ks.length + 1); |
578 strncpy (key_buffer + ks.length + 1, ext, | |
579 sizeof (key_buffer) - ks.length - 1); | |
580 key_buffer[sizeof (key_buffer) - 1] = '\0'; | |
3010 | 581 } |
582 | |
583 ks.echoStr = (unsigned char *) key_buffer; | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
584 ksv.buffer = (unsigned char *) key_buffer; /* 返値用 (return value) */ |
3010 | 585 ksv.bytes_buffer = KEYTOSTRSIZE; |
586 ksv.ks = &ks; | |
587 | |
588 jrKanjiControl (0, KC_STOREYOMI, (char *)&ksv); | |
589 | |
590 return storeResults (key_buffer, ksv.val, ksv.ks); | |
591 } | |
592 | |
593 DEFUN ("canna-do-function", Fcanna_do_function, 1, 2, 0, /* | |
594 Do specified function at current mode. | |
595 */ | |
596 (num, ch)) | |
597 { | |
598 jrKanjiStatusWithValue ksv; | |
599 jrKanjiStatus ks; | |
600 | |
601 CHECK_INT (num); | |
602 | |
603 if (NILP (ch)) | |
604 { | |
605 *key_buffer = '@'; | |
606 } | |
607 else | |
608 { | |
609 CHECK_CHAR (ch); | |
610 *key_buffer = XCHAR (ch); | |
611 } | |
612 | |
613 ksv.buffer = (unsigned char *) key_buffer; | |
614 ksv.bytes_buffer = KEYTOSTRSIZE; | |
615 ksv.ks = &ks; | |
616 ksv.val = XINT (num); | |
617 jrKanjiControl (0, KC_DO, (char *) &ksv); | |
618 return storeResults (key_buffer, ksv.val, ksv.ks); | |
619 } | |
620 | |
621 DEFUN ("canna-parse", Fcanna_parse, 1, 1, 0, /* | |
622 Parse customize string. | |
623 */ | |
624 (str)) | |
625 { | |
626 Lisp_Object val; | |
3071 | 627 Extbyte **p; |
3010 | 628 int n; |
3071 | 629 Extbyte *ext; |
3010 | 630 |
631 CHECK_STRING (str); | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
632 ext = LISP_STRING_TO_EXTERNAL (str, Qeuc_jp); |
3071 | 633 strncpy (key_buffer, ext, sizeof (key_buffer)); |
634 key_buffer[sizeof (key_buffer) - 1] = '\0'; | |
635 p = (Extbyte **) key_buffer; | |
3010 | 636 n = jrKanjiControl (0, KC_PARSE, (char *) &p); |
637 val = Qnil; | |
638 while (n > 0) | |
639 { | |
640 n--; | |
3071 | 641 val = Fcons (build_euc_string (p[n]), val); |
3010 | 642 } |
643 return val; | |
644 } | |
645 | |
646 DEFUN ("canna-query-mode", Fcanna_query_mode, 0, 0, 0, /* | |
647 Get current mode string. | |
648 */ | |
649 ()) | |
650 { | |
651 char buf[256]; | |
652 | |
653 jrKanjiControl (0, KC_QUERYMODE, buf); | |
3071 | 654 return build_euc_string (buf); |
3010 | 655 } |
656 | |
657 /* | |
658 * Functions following this line are for KKCP interface compatible | |
659 * library. These functions may be used by MILK system. | |
660 */ | |
661 | |
662 #define RKBUFSIZE 1024 | |
663 | |
5201
11ed8768ac4f
attempt to fix errors in canna_api.c
Ben Wing <ben@xemacs.org>
parents:
4993
diff
changeset
|
664 static UExtbyte yomibuf[RKBUFSIZE]; |
3010 | 665 static short kugiri[RKBUFSIZE / 2]; |
666 | |
667 static int | |
668 confirmContext (void) | |
669 { | |
670 if (IRCP_context < 0) | |
671 { | |
672 int context; | |
673 | |
674 if ((context = jrKanjiControl (0, KC_GETCONTEXT, (char *) 0)) == -1) | |
675 { | |
676 return 0; | |
677 } | |
678 IRCP_context = context; | |
679 } | |
680 return 1; | |
681 } | |
682 | |
683 static int | |
684 byteLen (int bun, int len) | |
685 { | |
686 int i = 0, offset = 0, ch; | |
687 | |
688 if (0 <= bun && bun < RKBUFSIZE) | |
689 { | |
690 offset = kugiri[bun]; | |
691 } | |
692 | |
693 while (len-- > 0 && (ch = (int) yomibuf[offset + i])) | |
694 { | |
695 i++; | |
696 if (ch & 0x80) | |
697 { | |
698 i++; | |
699 } | |
700 } | |
701 return i; | |
702 } | |
703 | |
704 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /* | |
705 Return the result of kana-to-kanji conversion. | |
706 Clause separator is set. | |
707 */ | |
708 (yomi)) | |
709 { | |
710 int nbun; | |
3071 | 711 Extbyte *ext; |
3010 | 712 |
713 CHECK_STRING (yomi); | |
714 if (confirmContext () == 0) | |
715 { | |
716 return Qnil; | |
717 } | |
3071 | 718 |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
719 ext = LISP_STRING_TO_EXTERNAL (yomi, Qeuc_jp); |
3071 | 720 strncpy ((char *) yomibuf, ext, sizeof (yomibuf)); |
721 yomibuf[sizeof (yomibuf) - 1] = '\0'; | |
722 | |
5201
11ed8768ac4f
attempt to fix errors in canna_api.c
Ben Wing <ben@xemacs.org>
parents:
4993
diff
changeset
|
723 nbun = RkBgnBun (IRCP_context, (char *) yomibuf, strlen ((char *) yomibuf), |
3010 | 724 (RK_XFER << RK_XFERBITS) | RK_KFER); |
725 | |
726 return kanjiYomiList (IRCP_context, nbun); | |
727 } | |
728 | |
729 static Lisp_Object | |
730 kanjiYomiList (int context, int nbun) | |
731 { | |
732 Lisp_Object val, res = Qnil; | |
3071 | 733 UExtbyte RkBuf[RKBUFSIZE]; |
3010 | 734 int len, i, total; |
735 | |
736 for (i = nbun ; i > 0 ; ) | |
737 { | |
738 i--; | |
739 RkGoTo (context, i); | |
740 len = RkGetKanji (context, RkBuf, RKBUFSIZE); | |
3071 | 741 val = make_euc_string (RkBuf, len); |
3010 | 742 len = RkGetYomi (context, RkBuf, RKBUFSIZE); |
3071 | 743 res = Fcons (Fcons (val, make_euc_string (RkBuf, len)), res); |
3010 | 744 if (i < RKBUFSIZE / 2) |
745 { | |
746 kugiri[i] = len; | |
747 } | |
748 } | |
749 for (i = 0, total = 0 ; i < nbun ; i++) | |
750 { | |
751 int temp = kugiri[i]; | |
752 kugiri[i] = total; | |
753 total += temp; | |
754 } | |
755 return res; | |
756 } | |
757 | |
758 DEFUN ("canna-henkan-next", Fcanna_henkan_next, 1, 1, 0, /* | |
759 Return the list of candidates. | |
760 */ | |
761 (bunsetsu)) | |
762 { | |
763 int i, slen, len; | |
3071 | 764 UExtbyte *p, RkBuf[RKBUFSIZE]; |
3010 | 765 Lisp_Object res = Qnil; |
766 | |
767 CHECK_INT (bunsetsu); | |
768 if (confirmContext () == 0) | |
769 { | |
770 return Qnil; | |
771 } | |
772 RkGoTo (IRCP_context, XINT (bunsetsu)); | |
773 len = RkGetKanjiList (IRCP_context, RkBuf, RKBUFSIZE); | |
774 p = RkBuf; | |
775 for (i = 0 ; i < len ; i++) | |
776 { | |
3071 | 777 slen = strlen ((char *) p); |
3010 | 778 if (NILP(res)) |
779 { | |
3071 | 780 res = Fcons (make_euc_string (p, slen), Qnil); |
3010 | 781 } |
782 else | |
783 { | |
3071 | 784 XCDR (res) = Fcons (make_euc_string (p, slen), Qnil); |
3010 | 785 } |
786 p += slen + 1; | |
787 } | |
788 return res; | |
789 } | |
790 | |
791 DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, 2, 2, 0, /* | |
792 Specify the length of a clause. | |
793 */ | |
794 (bunsetsu, bunlen)) | |
795 { | |
796 int nbun, len; | |
797 | |
798 CHECK_INT (bunsetsu); | |
799 CHECK_INT (bunlen); | |
800 | |
801 nbun = XINT (bunsetsu); | |
802 if (confirmContext () == 0) | |
803 { | |
804 return Qnil; | |
805 } | |
806 RkGoTo (IRCP_context, nbun); | |
807 len = byteLen (nbun, XINT (bunlen)); | |
808 return kanjiYomiList (IRCP_context, RkResize (IRCP_context, len)); | |
809 } | |
810 | |
811 DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, 2, 2, 0, /* | |
812 Select a candidate. | |
813 */ | |
814 (bun, kouho)) | |
815 { | |
816 int nbun, nkouho; | |
817 | |
818 if (confirmContext () == 0) | |
819 { | |
820 return Qnil; | |
821 } | |
822 nbun = XINT(bun); | |
823 RkGoTo (IRCP_context, nbun); | |
824 | |
825 nkouho = XINT(kouho); | |
826 RkXfer (IRCP_context, nkouho); | |
827 return Qt; | |
828 } | |
829 | |
830 DEFUN ("canna-henkan-end", Fcanna_henkan_end, 0, 0, 0, /* | |
831 End conversion. | |
832 */ | |
833 ()) | |
834 { | |
835 if (confirmContext () == 0) | |
836 { | |
837 return Qnil; | |
838 } | |
4993
c0934cef10c6
convert some source files to utf-8
Ben Wing <ben@xemacs.org>
parents:
4981
diff
changeset
|
839 RkEndBun (IRCP_context, 1); /* 学習はいつでも行って良いものなのか? |
3010 | 840 (is it OK to invoke learning function |
841 at arbitrary times?) */ | |
842 return Qt; | |
843 } | |
844 | |
845 DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, 0, 0, 0, /* | |
846 Quit conversion. | |
847 */ | |
848 ()) | |
849 { | |
850 if (confirmContext () == 0) | |
851 { | |
852 return Qnil; | |
853 } | |
854 RkEndBun (IRCP_context, 0); | |
855 return Qt; | |
856 } | |
857 | |
858 /* variables below this line is constants of Canna */ | |
859 | |
860 static Fixnum canna_mode_AlphaMode; | |
861 static Fixnum canna_mode_EmptyMode; | |
862 static Fixnum canna_mode_KigoMode; | |
863 static Fixnum canna_mode_YomiMode; | |
864 static Fixnum canna_mode_JishuMode; | |
865 static Fixnum canna_mode_TankouhoMode; | |
866 static Fixnum canna_mode_IchiranMode; | |
867 static Fixnum canna_mode_YesNoMode; | |
868 static Fixnum canna_mode_OnOffMode; | |
869 #ifdef CANNA_MODE_AdjustBunsetsuMode | |
870 static Fixnum canna_mode_AdjustBunsetsuMode; | |
871 #endif | |
872 #ifdef CANNA_MODE_ChikujiYomiMode | |
873 static Fixnum canna_mode_ChikujiYomiMode; | |
874 static Fixnum canna_mode_ChikujiTanMode; | |
875 #endif | |
876 | |
877 static Fixnum canna_mode_HenkanMode; | |
878 #ifdef CANNA_MODE_HenkanNyuryokuMode | |
879 static Fixnum canna_mode_HenkanNyuryokuMode; | |
880 #endif | |
881 #ifdef CANNA_MODE_ZenHiraHenkanMode | |
882 static Fixnum canna_mode_ZenHiraHenkanMode; | |
883 #ifdef CANNA_MODE_HanHiraHenkanMode | |
884 static Fixnum canna_mode_HanHiraHenkanMode; | |
885 #endif | |
886 static Fixnum canna_mode_ZenKataHenkanMode; | |
887 static Fixnum canna_mode_HanKataHenkanMode; | |
888 static Fixnum canna_mode_ZenAlphaHenkanMode; | |
889 static Fixnum canna_mode_HanAlphaHenkanMode; | |
890 #endif | |
891 static Fixnum canna_mode_ZenHiraKakuteiMode; | |
892 #ifdef CANNA_MODE_HanHiraKakuteiMode | |
893 static Fixnum canna_mode_HanHiraKakuteiMode; | |
894 #endif | |
895 static Fixnum canna_mode_ZenKataKakuteiMode; | |
896 static Fixnum canna_mode_HanKataKakuteiMode; | |
897 static Fixnum canna_mode_ZenAlphaKakuteiMode; | |
898 static Fixnum canna_mode_HanAlphaKakuteiMode; | |
899 static Fixnum canna_mode_HexMode; | |
900 static Fixnum canna_mode_BushuMode; | |
901 static Fixnum canna_mode_ExtendMode; | |
902 static Fixnum canna_mode_RussianMode; | |
903 static Fixnum canna_mode_GreekMode; | |
904 static Fixnum canna_mode_LineMode; | |
905 static Fixnum canna_mode_ChangingServerMode; | |
906 static Fixnum canna_mode_HenkanMethodMode; | |
907 static Fixnum canna_mode_DeleteDicMode; | |
908 static Fixnum canna_mode_TourokuMode; | |
909 static Fixnum canna_mode_TourokuEmptyMode; | |
910 static Fixnum canna_mode_TourokuHinshiMode; | |
911 static Fixnum canna_mode_TourokuDicMode; | |
912 static Fixnum canna_mode_QuotedInsertMode; | |
913 static Fixnum canna_mode_BubunMuhenkanMode; | |
914 static Fixnum canna_mode_MountDicMode; | |
915 | |
916 static Fixnum canna_fn_SelfInsert; | |
917 static Fixnum canna_fn_FunctionalInsert; | |
918 static Fixnum canna_fn_QuotedInsert; | |
919 static Fixnum canna_fn_JapaneseMode; | |
920 static Fixnum canna_fn_AlphaMode; | |
921 static Fixnum canna_fn_HenkanNyuryokuMode; | |
922 static Fixnum canna_fn_Forward; | |
923 static Fixnum canna_fn_Backward; | |
924 static Fixnum canna_fn_Next; | |
925 static Fixnum canna_fn_Prev; | |
926 static Fixnum canna_fn_BeginningOfLine; | |
927 static Fixnum canna_fn_EndOfLine; | |
928 static Fixnum canna_fn_DeleteNext; | |
929 static Fixnum canna_fn_DeletePrevious; | |
930 static Fixnum canna_fn_KillToEndOfLine; | |
931 static Fixnum canna_fn_Henkan; | |
932 static Fixnum canna_fn_Kakutei; | |
933 static Fixnum canna_fn_Extend; | |
934 static Fixnum canna_fn_Shrink; | |
935 #ifdef CANNA_FN_AdjustBunsetsu | |
936 static Fixnum canna_fn_AdjustBunsetsu; | |
937 #endif | |
938 static Fixnum canna_fn_Quit; | |
939 static Fixnum canna_fn_ConvertAsHex; | |
940 static Fixnum canna_fn_ConvertAsBushu; | |
941 static Fixnum canna_fn_KouhoIchiran; | |
942 static Fixnum canna_fn_BubunMuhenkan; | |
943 static Fixnum canna_fn_Zenkaku; | |
944 static Fixnum canna_fn_Hankaku; | |
945 static Fixnum canna_fn_ToUpper; | |
946 static Fixnum canna_fn_Capitalize; | |
947 static Fixnum canna_fn_ToLower; | |
948 static Fixnum canna_fn_Hiragana; | |
949 static Fixnum canna_fn_Katakana; | |
950 static Fixnum canna_fn_Romaji; | |
951 #ifdef CANNA_FN_BaseHiragana | |
952 static Fixnum canna_fn_BaseHiragana; | |
953 static Fixnum canna_fn_BaseKatakana; | |
954 static Fixnum canna_fn_BaseEisu; | |
955 static Fixnum canna_fn_BaseZenkaku; | |
956 static Fixnum canna_fn_BaseHankaku; | |
957 static Fixnum canna_fn_BaseKana; | |
958 static Fixnum canna_fn_BaseKakutei; | |
959 static Fixnum canna_fn_BaseHenkan; | |
960 static Fixnum canna_fn_BaseHiraKataToggle; | |
961 static Fixnum canna_fn_BaseZenHanToggle; | |
962 static Fixnum canna_fn_BaseKanaEisuToggle; | |
963 static Fixnum canna_fn_BaseKakuteiHenkanToggle; | |
964 static Fixnum canna_fn_BaseRotateForward; | |
965 static Fixnum canna_fn_BaseRotateBackward; | |
966 #endif | |
967 static Fixnum canna_fn_ExtendMode; | |
968 static Fixnum canna_fn_Touroku; | |
969 static Fixnum canna_fn_HexMode; | |
970 static Fixnum canna_fn_BushuMode; | |
971 static Fixnum canna_fn_KigouMode; | |
972 #ifdef CANNA_FN_Mark | |
973 static Fixnum canna_fn_Mark; | |
974 #endif | |
975 #ifdef CANNA_FN_TemporalMode | |
976 static Fixnum canna_fn_TemporalMode; | |
977 #endif | |
978 | |
979 static Fixnum canna_key_Nfer; | |
980 static Fixnum canna_key_Xfer; | |
981 static Fixnum canna_key_Up; | |
982 static Fixnum canna_key_Left; | |
983 static Fixnum canna_key_Right; | |
984 static Fixnum canna_key_Down; | |
985 static Fixnum canna_key_Insert; | |
986 static Fixnum canna_key_Rollup; | |
987 static Fixnum canna_key_Rolldown; | |
988 static Fixnum canna_key_Home; | |
989 static Fixnum canna_key_Help; | |
990 static Fixnum canna_key_KP_Key; | |
991 static Fixnum canna_key_Shift_Nfer; | |
992 static Fixnum canna_key_Shift_Xfer; | |
993 static Fixnum canna_key_Shift_Up; | |
994 static Fixnum canna_key_Shift_Left; | |
995 static Fixnum canna_key_Shift_Right; | |
996 static Fixnum canna_key_Shift_Down; | |
997 static Fixnum canna_key_Cntrl_Nfer; | |
998 static Fixnum canna_key_Cntrl_Xfer; | |
999 static Fixnum canna_key_Cntrl_Up; | |
1000 static Fixnum canna_key_Cntrl_Left; | |
1001 static Fixnum canna_key_Cntrl_Right; | |
1002 static Fixnum canna_key_Cntrl_Down; | |
1003 | |
1004 Lisp_Object VCANNA; /* by MORIOKA Tomohiko <morioka@jaist.ac.jp> | |
1005 1996/6/7 */ | |
1006 | |
1007 /* | |
1008 * Each dynamically loaded Emacs module is given a name at compile | |
1009 * time. This is a short name, and must be a valid part of a C | |
1010 * identifier. This name is used to construct the name of several | |
1011 * functions which must appear in the module source code. | |
1012 * The first such function, modules_of_XXXX, should load in any dependent | |
1013 * modules. This function is optional, and the module will still load if | |
1014 * it is not present in the module. | |
1015 * | |
1016 * The second function, which is NOT optional, is syms_of_XXXX, in which | |
1017 * all functions that the module will be provided are declared. This | |
1018 * function will contain calls to DEFSUBR(). | |
1019 * | |
1020 * The third function, which is also NOT optional, is vars_of_XXXX, in | |
1021 * which you declare all variables that the module provides. This | |
1022 * function will contain calls to DEFVAR_LISP(), DEFVAR_BOOL() etc. | |
1023 * | |
1024 * When declaring functions and variables in the syms_of_XXXX and | |
1025 * vars_of_XXXX functions, you use the exact same syntax that you | |
1026 * would as if this module were being compiled into the pure Emacs. | |
1027 * | |
1028 * The fourth function, which is optional, is unload_XXXX, in which actions | |
1029 * that must be taken to unload the module are listed. XEmacs will unbind | |
1030 * functions and variables for you. Anything else that must be done should | |
1031 * appear in this function. | |
1032 * | |
1033 * All four of these functions are declared as void functions, | |
1034 * taking no parameters. Since this sample module is called 'sample', | |
1035 * the functions will be named 'modules_of_sample', 'syms_of_sample', | |
1036 * 'vars_of_sample', and 'unload_sample'. | |
1037 */ | |
1038 | |
1039 #if 0 | |
1040 void | |
1041 modules_of_canna_api (void) | |
1042 { | |
1043 /* | |
1044 * This function isn't actually required as we will not be loading | |
1045 * in any dependent modules, but if we were, we would do something like: | |
1046 * emodules_load ("dependent.ell", "canna2", "1.0.0"); | |
1047 */ | |
1048 } | |
1049 #endif | |
1050 | |
1051 void | |
1052 syms_of_canna_api (void) | |
1053 { | |
1054 DEFSUBR (Fcanna_key_proc); | |
1055 DEFSUBR (Fcanna_initialize); | |
1056 DEFSUBR (Fcanna_finalize); | |
1057 DEFSUBR (Fcanna_touroku_string); | |
1058 DEFSUBR (Fcanna_set_width); | |
1059 DEFSUBR (Fcanna_change_mode); | |
1060 DEFSUBR (Fcanna_store_yomi); | |
1061 DEFSUBR (Fcanna_do_function); | |
1062 DEFSUBR (Fcanna_parse); | |
1063 DEFSUBR (Fcanna_query_mode); | |
1064 DEFSUBR (Fcanna_set_bunsetsu); | |
1065 | |
1066 DEFSUBR (Fcanna_henkan_begin); | |
1067 DEFSUBR (Fcanna_henkan_next); | |
1068 DEFSUBR (Fcanna_bunsetu_henkou); | |
1069 DEFSUBR (Fcanna_henkan_kakutei); | |
1070 DEFSUBR (Fcanna_henkan_end); | |
1071 DEFSUBR (Fcanna_henkan_quit); | |
3071 | 1072 |
1073 DEFSYMBOL (Qeuc_jp); | |
3010 | 1074 } |
1075 | |
1076 void | |
1077 vars_of_canna_api (void) | |
1078 { | |
1079 DEFVAR_LISP ("CANNA", &VCANNA); /* hir@nec, 1992.5.21 */ | |
1080 VCANNA = Qt; /* hir@nec, 1992.5.21 */ | |
1081 | |
1082 DEFVAR_LISP ("canna-kakutei-string", &Vcanna_kakutei_string /* | |
1083 | |
1084 */ ); | |
1085 Vcanna_kakutei_string = Qnil; | |
1086 | |
1087 DEFVAR_LISP ("canna-kakutei-yomi", &Vcanna_kakutei_yomi /* | |
1088 | |
1089 */ ); | |
1090 Vcanna_kakutei_yomi = Qnil; | |
1091 | |
1092 DEFVAR_LISP ("canna-kakutei-romaji", &Vcanna_kakutei_romaji /* | |
1093 | |
1094 */ ); | |
1095 Vcanna_kakutei_romaji = Qnil; | |
1096 | |
1097 DEFVAR_LISP ("canna-henkan-string", &Vcanna_henkan_string /* | |
1098 | |
1099 */ ); | |
1100 Vcanna_henkan_string = Qnil; | |
1101 | |
1102 DEFVAR_INT ("canna-henkan-length", &canna_henkan_length /* | |
1103 | |
1104 */ ); | |
1105 canna_henkan_length = 0; | |
1106 | |
1107 DEFVAR_INT ("canna-henkan-revpos", &canna_henkan_revPos /* | |
1108 | |
1109 */ ); | |
1110 canna_henkan_revPos = 0; | |
1111 | |
1112 DEFVAR_INT ("canna-henkan-revlen", &canna_henkan_revLen /* | |
1113 | |
1114 */ ); | |
1115 canna_henkan_revLen = 0; | |
1116 | |
1117 DEFVAR_LISP ("canna-ichiran-string", &Vcanna_ichiran_string /* | |
1118 | |
1119 */ ); | |
1120 Vcanna_ichiran_string = Qnil; | |
1121 | |
1122 DEFVAR_INT ("canna-ichiran-length", &canna_ichiran_length /* | |
1123 | |
1124 */ ); | |
1125 canna_ichiran_length = 0; | |
1126 | |
1127 DEFVAR_INT ("canna-ichiran-revpos", &canna_ichiran_revPos /* | |
1128 | |
1129 */ ); | |
1130 canna_ichiran_revPos = 0; | |
1131 | |
1132 DEFVAR_INT ("canna-ichiran-revlen", &canna_ichiran_revLen /* | |
1133 | |
1134 */ ); | |
1135 canna_ichiran_revLen = 0; | |
1136 | |
1137 DEFVAR_LISP ("canna-mode-string", &Vcanna_mode_string /* | |
1138 | |
1139 */ ); | |
1140 Vcanna_mode_string = Qnil; | |
1141 | |
1142 DEFVAR_BOOL ("canna-empty-info", &canna_empty_info /* | |
1143 For canna | |
1144 */ ); | |
1145 canna_empty_info = 0; | |
1146 | |
1147 DEFVAR_BOOL ("canna-through-info", &canna_through_info /* | |
1148 For canna | |
1149 */ ); | |
1150 canna_through_info = 0; | |
1151 | |
1152 DEFVAR_BOOL ("canna-underline", &canna_underline /* | |
1153 For canna | |
1154 */ ); | |
1155 canna_underline = 0; | |
1156 | |
1157 DEFVAR_BOOL ("canna-inhibit-hankakukana", &canna_inhibit_hankakukana /* | |
1158 For canna | |
1159 */ ); | |
1160 canna_inhibit_hankakukana = 0; | |
1161 | |
1162 DEFVAR_INT ("canna-mode-alpha-mode", &canna_mode_AlphaMode /* | |
1163 | |
1164 */ ); | |
1165 canna_mode_AlphaMode = IROHA_MODE_AlphaMode; | |
1166 | |
1167 DEFVAR_INT ("canna-mode-empty-mode", &canna_mode_EmptyMode /* | |
1168 | |
1169 */ ); | |
1170 canna_mode_EmptyMode = IROHA_MODE_EmptyMode; | |
1171 | |
1172 DEFVAR_INT ("canna-mode-kigo-mode", &canna_mode_KigoMode /* | |
1173 | |
1174 */ ); | |
1175 canna_mode_KigoMode = IROHA_MODE_KigoMode; | |
1176 | |
1177 DEFVAR_INT ("canna-mode-yomi-mode", &canna_mode_YomiMode /* | |
1178 | |
1179 */ ); | |
1180 canna_mode_YomiMode = IROHA_MODE_YomiMode; | |
1181 | |
1182 DEFVAR_INT ("canna-mode-jishu-mode", &canna_mode_JishuMode /* | |
1183 | |
1184 */ ); | |
1185 canna_mode_JishuMode = IROHA_MODE_JishuMode; | |
1186 | |
1187 DEFVAR_INT ("canna-mode-tankouho-mode", &canna_mode_TankouhoMode /* | |
1188 | |
1189 */ ); | |
1190 canna_mode_TankouhoMode = IROHA_MODE_TankouhoMode; | |
1191 | |
1192 DEFVAR_INT ("canna-mode-ichiran-mode", &canna_mode_IchiranMode /* | |
1193 | |
1194 */ ); | |
1195 canna_mode_IchiranMode = IROHA_MODE_IchiranMode; | |
1196 | |
1197 DEFVAR_INT ("canna-mode-yes-no-mode", &canna_mode_YesNoMode /* | |
1198 | |
1199 */ ); | |
1200 canna_mode_YesNoMode = IROHA_MODE_YesNoMode; | |
1201 | |
1202 DEFVAR_INT ("canna-mode-on-off-mode", &canna_mode_OnOffMode /* | |
1203 | |
1204 */ ); | |
1205 canna_mode_OnOffMode = IROHA_MODE_OnOffMode; | |
1206 | |
1207 #ifdef CANNA_MODE_AdjustBunsetsuMode | |
1208 DEFVAR_INT ("canna-mode-adjust-bunsetsu-mode", | |
1209 &canna_mode_AdjustBunsetsuMode /* | |
1210 | |
1211 */ ); | |
1212 canna_mode_AdjustBunsetsuMode = CANNA_MODE_AdjustBunsetsuMode; | |
1213 #endif | |
1214 #ifdef CANNA_MODE_ChikujiYomiMode | |
1215 DEFVAR_INT ("canna-mode-chikuji-yomi-mode", &canna_mode_ChikujiYomiMode /* | |
1216 | |
1217 */ ); | |
1218 canna_mode_ChikujiYomiMode = CANNA_MODE_ChikujiYomiMode; | |
1219 | |
1220 DEFVAR_INT ("canna-mode-chikuji-bunsetsu-mode", | |
1221 &canna_mode_ChikujiTanMode /* | |
1222 | |
1223 */ ); | |
1224 canna_mode_ChikujiTanMode = CANNA_MODE_ChikujiTanMode; | |
1225 #endif | |
1226 | |
1227 DEFVAR_INT ("canna-mode-henkan-mode", &canna_mode_HenkanMode /* | |
1228 | |
1229 */ ); | |
1230 canna_mode_HenkanMode = IROHA_MODE_HenkanMode; | |
1231 | |
1232 #ifdef CANNA_MODE_HenkanNyuryokuMode | |
1233 DEFVAR_INT ("canna-mode-henkan-nyuuryoku-mode", | |
1234 &canna_mode_HenkanNyuryokuMode /* | |
1235 | |
1236 */ ); | |
1237 canna_mode_HenkanNyuryokuMode = CANNA_MODE_HenkanNyuryokuMode; | |
1238 #endif | |
1239 #ifdef CANNA_MODE_ZenHiraHenkanMode | |
1240 DEFVAR_INT ("canna-mode-zen-hira-henkan-mode", | |
1241 &canna_mode_ZenHiraHenkanMode /* | |
1242 | |
1243 */ ); | |
1244 canna_mode_ZenHiraHenkanMode = CANNA_MODE_ZenHiraHenkanMode; | |
1245 #ifdef CANNA_MODE_HanHiraHenkanMode | |
1246 DEFVAR_INT ("canna-mode-han-hira-henkan-mode", | |
1247 &canna_mode_HanHiraHenkanMode /* | |
1248 | |
1249 */ ); | |
1250 canna_mode_HanHiraHenkanMode = CANNA_MODE_HanHiraHenkanMode; | |
1251 #endif | |
1252 DEFVAR_INT ("canna-mode-zen-kata-henkan-mode", | |
1253 &canna_mode_ZenKataHenkanMode /* | |
1254 | |
1255 */ ); | |
1256 canna_mode_ZenKataHenkanMode = CANNA_MODE_ZenKataHenkanMode; | |
1257 | |
1258 DEFVAR_INT ("canna-mode-han-kata-henkan-mode", | |
1259 &canna_mode_HanKataHenkanMode /* | |
1260 | |
1261 */ ); | |
1262 canna_mode_HanKataHenkanMode = CANNA_MODE_HanKataHenkanMode; | |
1263 | |
1264 DEFVAR_INT ("canna-mode-zen-alpha-henkan-mode", | |
1265 &canna_mode_ZenAlphaHenkanMode /* | |
1266 | |
1267 */ ); | |
1268 canna_mode_ZenAlphaHenkanMode = CANNA_MODE_ZenAlphaHenkanMode; | |
1269 | |
1270 DEFVAR_INT ("canna-mode-han-alpha-henkan-mode", | |
1271 &canna_mode_HanAlphaHenkanMode /* | |
1272 | |
1273 */ ); | |
1274 canna_mode_HanAlphaHenkanMode = CANNA_MODE_HanAlphaHenkanMode; | |
1275 #endif | |
1276 DEFVAR_INT ("canna-mode-zen-hira-kakutei-mode", | |
1277 &canna_mode_ZenHiraKakuteiMode /* | |
1278 | |
1279 */ ); | |
1280 canna_mode_ZenHiraKakuteiMode = IROHA_MODE_ZenHiraKakuteiMode; | |
1281 #ifdef CANNA_MODE_HanHiraKakuteiMode | |
1282 DEFVAR_INT ("canna-mode-han-hira-kakutei-mode", | |
1283 &canna_mode_HanHiraKakuteiMode /* | |
1284 | |
1285 */ ); | |
1286 canna_mode_HanHiraKakuteiMode = CANNA_MODE_HanHiraKakuteiMode; | |
1287 #endif | |
1288 DEFVAR_INT ("canna-mode-zen-kata-kakutei-mode", | |
1289 &canna_mode_ZenKataKakuteiMode /* | |
1290 | |
1291 */ ); | |
1292 canna_mode_ZenKataKakuteiMode = IROHA_MODE_ZenKataKakuteiMode; | |
1293 | |
1294 DEFVAR_INT ("canna-mode-han-kata-kakutei-mode", | |
1295 &canna_mode_HanKataKakuteiMode /* | |
1296 | |
1297 */ ); | |
1298 canna_mode_HanKataKakuteiMode = IROHA_MODE_HanKataKakuteiMode; | |
1299 | |
1300 DEFVAR_INT ("canna-mode-zen-alpha-kakutei-mode", | |
1301 &canna_mode_ZenAlphaKakuteiMode /* | |
1302 | |
1303 */ ); | |
1304 canna_mode_ZenAlphaKakuteiMode = IROHA_MODE_ZenAlphaKakuteiMode; | |
1305 | |
1306 DEFVAR_INT ("canna-mode-han-alpha-kakutei-mode", | |
1307 &canna_mode_HanAlphaKakuteiMode /* | |
1308 | |
1309 */ ); | |
1310 canna_mode_HanAlphaKakuteiMode = IROHA_MODE_HanAlphaKakuteiMode; | |
1311 | |
1312 DEFVAR_INT ("canna-mode-hex-mode", &canna_mode_HexMode /* | |
1313 | |
1314 */ ); | |
1315 canna_mode_HexMode = IROHA_MODE_HexMode; | |
1316 | |
1317 DEFVAR_INT ("canna-mode-bushu-mode", &canna_mode_BushuMode /* | |
1318 | |
1319 */ ); | |
1320 canna_mode_BushuMode = IROHA_MODE_BushuMode; | |
1321 | |
1322 DEFVAR_INT ("canna-mode-extend-mode", &canna_mode_ExtendMode /* | |
1323 | |
1324 */ ); | |
1325 canna_mode_ExtendMode = IROHA_MODE_ExtendMode; | |
1326 | |
1327 DEFVAR_INT ("canna-mode-russian-mode", &canna_mode_RussianMode /* | |
1328 | |
1329 */ ); | |
1330 canna_mode_RussianMode = IROHA_MODE_RussianMode; | |
1331 | |
1332 DEFVAR_INT ("canna-mode-greek-mode", &canna_mode_GreekMode /* | |
1333 | |
1334 */ ); | |
1335 canna_mode_GreekMode = IROHA_MODE_GreekMode; | |
1336 | |
1337 DEFVAR_INT ("canna-mode-line-mode", &canna_mode_LineMode /* | |
1338 | |
1339 */ ); | |
1340 canna_mode_LineMode = IROHA_MODE_LineMode; | |
1341 | |
1342 DEFVAR_INT ("canna-mode-changing-server-mode", | |
1343 &canna_mode_ChangingServerMode /* | |
1344 | |
1345 */ ); | |
1346 canna_mode_ChangingServerMode = IROHA_MODE_ChangingServerMode; | |
1347 | |
1348 DEFVAR_INT ("canna-mode-henkan-method-mode", | |
1349 &canna_mode_HenkanMethodMode /* | |
1350 | |
1351 */ ); | |
1352 canna_mode_HenkanMethodMode = IROHA_MODE_HenkanMethodMode; | |
1353 | |
1354 DEFVAR_INT ("canna-mode-delete-dic-mode", &canna_mode_DeleteDicMode /* | |
1355 | |
1356 */ ); | |
1357 canna_mode_DeleteDicMode = IROHA_MODE_DeleteDicMode; | |
1358 | |
1359 DEFVAR_INT ("canna-mode-touroku-mode", &canna_mode_TourokuMode /* | |
1360 | |
1361 */ ); | |
1362 canna_mode_TourokuMode = IROHA_MODE_TourokuMode; | |
1363 | |
1364 DEFVAR_INT ("canna-mode-touroku-empty-mode", | |
1365 &canna_mode_TourokuEmptyMode /* | |
1366 | |
1367 */ ); | |
1368 canna_mode_TourokuEmptyMode = IROHA_MODE_TourokuEmptyMode; | |
1369 | |
1370 DEFVAR_INT ("canna-mode-touroku-hinshi-mode", | |
1371 &canna_mode_TourokuHinshiMode /* | |
1372 | |
1373 */ ); | |
1374 canna_mode_TourokuHinshiMode = IROHA_MODE_TourokuHinshiMode; | |
1375 | |
1376 DEFVAR_INT ("canna-mode-touroku-dic-mode", &canna_mode_TourokuDicMode /* | |
1377 | |
1378 */ ); | |
1379 canna_mode_TourokuDicMode = IROHA_MODE_TourokuDicMode; | |
1380 | |
1381 DEFVAR_INT ("canna-mode-quoted-insert-mode", | |
1382 &canna_mode_QuotedInsertMode /* | |
1383 | |
1384 */ ); | |
1385 canna_mode_QuotedInsertMode = IROHA_MODE_QuotedInsertMode; | |
1386 | |
1387 DEFVAR_INT ("canna-mode-bubun-muhenkan-mode", | |
1388 &canna_mode_BubunMuhenkanMode /* | |
1389 | |
1390 */ ); | |
1391 canna_mode_BubunMuhenkanMode = IROHA_MODE_BubunMuhenkanMode; | |
1392 | |
1393 DEFVAR_INT ("canna-mode-mount-dic-mode", &canna_mode_MountDicMode /* | |
1394 | |
1395 */ ); | |
1396 canna_mode_MountDicMode = IROHA_MODE_MountDicMode; | |
1397 | |
1398 DEFVAR_INT ("canna-func-self-insert", &canna_fn_SelfInsert /* | |
1399 | |
1400 */ ); | |
1401 canna_fn_SelfInsert = IROHA_FN_SelfInsert; | |
1402 | |
1403 DEFVAR_INT ("canna-func-functional-insert", &canna_fn_FunctionalInsert /* | |
1404 | |
1405 */ ); | |
1406 canna_fn_FunctionalInsert = IROHA_FN_FunctionalInsert; | |
1407 | |
1408 DEFVAR_INT ("canna-func-quoted-insert", &canna_fn_QuotedInsert /* | |
1409 | |
1410 */ ); | |
1411 canna_fn_QuotedInsert = IROHA_FN_QuotedInsert; | |
1412 | |
1413 DEFVAR_INT ("canna-func-japanese-mode", &canna_fn_JapaneseMode /* | |
1414 | |
1415 */ ); | |
1416 canna_fn_JapaneseMode = IROHA_FN_JapaneseMode; | |
1417 | |
1418 DEFVAR_INT ("canna-func-alpha-mode", &canna_fn_AlphaMode /* | |
1419 | |
1420 */ ); | |
1421 canna_fn_AlphaMode = IROHA_FN_AlphaMode; | |
1422 | |
1423 DEFVAR_INT ("canna-func-henkan-nyuryoku-mode", | |
1424 &canna_fn_HenkanNyuryokuMode /* | |
1425 | |
1426 */ ); | |
1427 canna_fn_HenkanNyuryokuMode = IROHA_FN_HenkanNyuryokuMode; | |
1428 | |
1429 DEFVAR_INT ("canna-func-forward", &canna_fn_Forward /* | |
1430 | |
1431 */ ); | |
1432 canna_fn_Forward = IROHA_FN_Forward; | |
1433 | |
1434 DEFVAR_INT ("canna-func-backward", &canna_fn_Backward /* | |
1435 | |
1436 */ ); | |
1437 canna_fn_Backward = IROHA_FN_Backward; | |
1438 | |
1439 DEFVAR_INT ("canna-func-next", &canna_fn_Next /* | |
1440 | |
1441 */ ); | |
1442 canna_fn_Next = IROHA_FN_Next; | |
1443 | |
1444 DEFVAR_INT ("canna-func-previous", &canna_fn_Prev /* | |
1445 | |
1446 */ ); | |
1447 canna_fn_Prev = IROHA_FN_Prev; | |
1448 | |
1449 DEFVAR_INT ("canna-func-beginning-of-line", &canna_fn_BeginningOfLine /* | |
1450 | |
1451 */ ); | |
1452 canna_fn_BeginningOfLine = IROHA_FN_BeginningOfLine; | |
1453 | |
1454 DEFVAR_INT ("canna-func-end-of-line", &canna_fn_EndOfLine /* | |
1455 | |
1456 */ ); | |
1457 canna_fn_EndOfLine = IROHA_FN_EndOfLine; | |
1458 | |
1459 DEFVAR_INT ("canna-func-delete-next", &canna_fn_DeleteNext /* | |
1460 | |
1461 */ ); | |
1462 canna_fn_DeleteNext = IROHA_FN_DeleteNext; | |
1463 | |
1464 DEFVAR_INT ("canna-func-delete-previous", &canna_fn_DeletePrevious /* | |
1465 | |
1466 */ ); | |
1467 canna_fn_DeletePrevious = IROHA_FN_DeletePrevious; | |
1468 | |
1469 DEFVAR_INT ("canna-func-kill-to-end-of-line", &canna_fn_KillToEndOfLine /* | |
1470 | |
1471 */ ); | |
1472 canna_fn_KillToEndOfLine = IROHA_FN_KillToEndOfLine; | |
1473 | |
1474 DEFVAR_INT ("canna-func-henkan", &canna_fn_Henkan /* | |
1475 | |
1476 */ ); | |
1477 canna_fn_Henkan = IROHA_FN_Henkan; | |
1478 | |
1479 DEFVAR_INT ("canna-func-kakutei", &canna_fn_Kakutei /* | |
1480 | |
1481 */ ); | |
1482 canna_fn_Kakutei = IROHA_FN_Kakutei; | |
1483 | |
1484 DEFVAR_INT ("canna-func-extend", &canna_fn_Extend /* | |
1485 | |
1486 */ ); | |
1487 canna_fn_Extend = IROHA_FN_Extend; | |
1488 | |
1489 DEFVAR_INT ("canna-func-shrink", &canna_fn_Shrink /* | |
1490 | |
1491 */ ); | |
1492 canna_fn_Shrink = IROHA_FN_Shrink; | |
1493 | |
1494 #ifdef CANNA_FN_AdjustBunsetsu | |
1495 DEFVAR_INT ("canna-func-adjust-bunsetsu", &canna_fn_AdjustBunsetsu /* | |
1496 | |
1497 */ ); | |
1498 canna_fn_AdjustBunsetsu = CANNA_FN_AdjustBunsetsu; | |
1499 #endif | |
1500 DEFVAR_INT ("canna-func-quit", &canna_fn_Quit /* | |
1501 | |
1502 */ ); | |
1503 canna_fn_Quit = IROHA_FN_Quit; | |
1504 | |
1505 DEFVAR_INT ("canna-func-convert-as-hex", &canna_fn_ConvertAsHex /* | |
1506 | |
1507 */ ); | |
1508 canna_fn_ConvertAsHex = IROHA_FN_ConvertAsHex; | |
1509 | |
1510 DEFVAR_INT ("canna-func-convert-as-bushu", &canna_fn_ConvertAsBushu /* | |
1511 | |
1512 */ ); | |
1513 canna_fn_ConvertAsBushu = IROHA_FN_ConvertAsBushu; | |
1514 | |
1515 DEFVAR_INT ("canna-func-kouho-ichiran", &canna_fn_KouhoIchiran /* | |
1516 | |
1517 */ ); | |
1518 canna_fn_KouhoIchiran = IROHA_FN_KouhoIchiran; | |
1519 | |
1520 DEFVAR_INT ("canna-func-bubun-muhenkan", &canna_fn_BubunMuhenkan /* | |
1521 | |
1522 */ ); | |
1523 canna_fn_BubunMuhenkan = IROHA_FN_BubunMuhenkan; | |
1524 | |
1525 DEFVAR_INT ("canna-func-zenkaku", &canna_fn_Zenkaku /* | |
1526 | |
1527 */ ); | |
1528 canna_fn_Zenkaku = IROHA_FN_Zenkaku; | |
1529 | |
1530 DEFVAR_INT ("canna-func-hankaku", &canna_fn_Hankaku /* | |
1531 | |
1532 */ ); | |
1533 canna_fn_Hankaku = IROHA_FN_Hankaku; | |
1534 | |
1535 DEFVAR_INT ("canna-func-to-upper", &canna_fn_ToUpper /* | |
1536 | |
1537 */ ); | |
1538 canna_fn_ToUpper = IROHA_FN_ToUpper; | |
1539 | |
1540 DEFVAR_INT ("canna-func-capitalize", &canna_fn_Capitalize /* | |
1541 | |
1542 */ ); | |
1543 canna_fn_Capitalize = IROHA_FN_Capitalize; | |
1544 | |
1545 DEFVAR_INT ("canna-func-to-lower", &canna_fn_ToLower /* | |
1546 | |
1547 */ ); | |
1548 canna_fn_ToLower = IROHA_FN_ToLower; | |
1549 | |
1550 DEFVAR_INT ("canna-func-hiragana", &canna_fn_Hiragana /* | |
1551 | |
1552 */ ); | |
1553 canna_fn_Hiragana = IROHA_FN_Hiragana; | |
1554 | |
1555 DEFVAR_INT ("canna-func-katakana", &canna_fn_Katakana /* | |
1556 | |
1557 */ ); | |
1558 canna_fn_Katakana = IROHA_FN_Katakana; | |
1559 | |
1560 DEFVAR_INT ("canna-func-romaji", &canna_fn_Romaji /* | |
1561 | |
1562 */ ); | |
1563 canna_fn_Romaji = IROHA_FN_Romaji; | |
1564 | |
1565 #ifdef CANNA_FN_BaseHiragana | |
1566 DEFVAR_INT ("canna-func-base-hiragana", &canna_fn_BaseHiragana /* | |
1567 | |
1568 */ ); | |
1569 canna_fn_BaseHiragana = CANNA_FN_BaseHiragana; | |
1570 | |
1571 DEFVAR_INT ("canna-func-base-katakana", &canna_fn_BaseKatakana /* | |
1572 | |
1573 */ ); | |
1574 canna_fn_BaseKatakana = CANNA_FN_BaseKatakana; | |
1575 | |
1576 DEFVAR_INT ("canna-func-base-eisu", &canna_fn_BaseEisu /* | |
1577 | |
1578 */ ); | |
1579 canna_fn_BaseEisu = CANNA_FN_BaseEisu; | |
1580 | |
1581 DEFVAR_INT ("canna-func-base-zenkaku", &canna_fn_BaseZenkaku /* | |
1582 | |
1583 */ ); | |
1584 canna_fn_BaseZenkaku = CANNA_FN_BaseZenkaku; | |
1585 | |
1586 DEFVAR_INT ("canna-func-base-hankaku", &canna_fn_BaseHankaku /* | |
1587 | |
1588 */ ); | |
1589 canna_fn_BaseHankaku = CANNA_FN_BaseHankaku; | |
1590 | |
1591 DEFVAR_INT ("canna-func-base-kana", &canna_fn_BaseKana /* | |
1592 | |
1593 */ ); | |
1594 canna_fn_BaseKana = CANNA_FN_BaseKana; | |
1595 | |
1596 DEFVAR_INT ("canna-func-base-kakutei", &canna_fn_BaseKakutei /* | |
1597 | |
1598 */ ); | |
1599 canna_fn_BaseKakutei = CANNA_FN_BaseKakutei; | |
1600 | |
1601 DEFVAR_INT ("canna-func-base-henkan", &canna_fn_BaseHenkan /* | |
1602 | |
1603 */ ); | |
1604 canna_fn_BaseHenkan = CANNA_FN_BaseHenkan; | |
1605 | |
1606 DEFVAR_INT ("canna-func-base-hiragana-katakana-toggle", | |
1607 &canna_fn_BaseHiraKataToggle /* | |
1608 | |
1609 */ ); | |
1610 canna_fn_BaseHiraKataToggle = CANNA_FN_BaseHiraKataToggle; | |
1611 | |
1612 DEFVAR_INT ("canna-func-base-zenkaku-hankaku-toggle", | |
1613 &canna_fn_BaseZenHanToggle /* | |
1614 | |
1615 */ ); | |
1616 canna_fn_BaseZenHanToggle = CANNA_FN_BaseZenHanToggle; | |
1617 | |
1618 DEFVAR_INT ("canna-func-base-kana-eisu-toggle", | |
1619 &canna_fn_BaseKanaEisuToggle /* | |
1620 | |
1621 */ ); | |
1622 canna_fn_BaseKanaEisuToggle = CANNA_FN_BaseKanaEisuToggle; | |
1623 | |
1624 DEFVAR_INT ("canna-func-base-kakutei-henkan-toggle", | |
1625 &canna_fn_BaseKakuteiHenkanToggle /* | |
1626 | |
1627 */ ); | |
1628 canna_fn_BaseKakuteiHenkanToggle = CANNA_FN_BaseKakuteiHenkanToggle; | |
1629 | |
1630 DEFVAR_INT ("canna-func-base-rotate-forward", | |
1631 &canna_fn_BaseRotateForward /* | |
1632 | |
1633 */ ); | |
1634 canna_fn_BaseRotateForward = CANNA_FN_BaseRotateForward; | |
1635 | |
1636 DEFVAR_INT ("canna-func-base-rotate-backward", | |
1637 &canna_fn_BaseRotateBackward /* | |
1638 | |
1639 */ ); | |
1640 canna_fn_BaseRotateBackward = CANNA_FN_BaseRotateBackward; | |
1641 | |
1642 #endif | |
1643 DEFVAR_INT ("canna-func-extend-mode", &canna_fn_ExtendMode /* | |
1644 | |
1645 */ ); | |
1646 canna_fn_ExtendMode = IROHA_FN_ExtendMode; | |
1647 | |
1648 DEFVAR_INT ("canna-func-touroku", &canna_fn_Touroku /* | |
1649 | |
1650 */ ); | |
1651 canna_fn_Touroku = IROHA_FN_Touroku; | |
1652 | |
1653 DEFVAR_INT ("canna-func-hex-mode", &canna_fn_HexMode /* | |
1654 | |
1655 */ ); | |
1656 canna_fn_HexMode = IROHA_FN_HexMode; | |
1657 | |
1658 DEFVAR_INT ("canna-func-bushu-mode", &canna_fn_BushuMode /* | |
1659 | |
1660 */ ); | |
1661 canna_fn_BushuMode = IROHA_FN_BushuMode; | |
1662 | |
1663 DEFVAR_INT ("canna-func-kigo-mode", &canna_fn_KigouMode /* | |
1664 | |
1665 */ ); | |
1666 canna_fn_KigouMode = IROHA_FN_KigouMode; | |
1667 | |
1668 #ifdef CANNA_FN_Mark | |
1669 DEFVAR_INT ("canna-func-mark", &canna_fn_Mark /* | |
1670 | |
1671 */ ); | |
1672 canna_fn_Mark = CANNA_FN_Mark; | |
1673 #endif | |
1674 #ifdef CANNA_FN_TemporalMode | |
1675 DEFVAR_INT ("canna-func-temporal-mode", &canna_fn_TemporalMode /* | |
1676 | |
1677 */ ); | |
1678 canna_fn_TemporalMode = CANNA_FN_TemporalMode; | |
1679 #endif | |
1680 | |
1681 DEFVAR_INT ("canna-key-nfer", &canna_key_Nfer /* | |
1682 | |
1683 */ ); | |
1684 canna_key_Nfer = IROHA_KEY_Nfer; | |
1685 | |
1686 DEFVAR_INT ("canna-key-xfer", &canna_key_Xfer /* | |
1687 | |
1688 */ ); | |
1689 canna_key_Xfer = IROHA_KEY_Xfer; | |
1690 | |
1691 DEFVAR_INT ("canna-key-up", &canna_key_Up /* | |
1692 | |
1693 */ ); | |
1694 canna_key_Up = IROHA_KEY_Up; | |
1695 | |
1696 DEFVAR_INT ("canna-key-left", &canna_key_Left /* | |
1697 | |
1698 */ ); | |
1699 canna_key_Left = IROHA_KEY_Left; | |
1700 | |
1701 DEFVAR_INT ("canna-key-right", &canna_key_Right /* | |
1702 | |
1703 */ ); | |
1704 canna_key_Right = IROHA_KEY_Right; | |
1705 | |
1706 DEFVAR_INT ("canna-key-down", &canna_key_Down /* | |
1707 | |
1708 */ ); | |
1709 canna_key_Down = IROHA_KEY_Down; | |
1710 | |
1711 DEFVAR_INT ("canna-key-insert", &canna_key_Insert /* | |
1712 | |
1713 */ ); | |
1714 canna_key_Insert = IROHA_KEY_Insert; | |
1715 | |
1716 DEFVAR_INT ("canna-key-rollup", &canna_key_Rollup /* | |
1717 | |
1718 */ ); | |
1719 canna_key_Rollup = IROHA_KEY_Rollup; | |
1720 | |
1721 DEFVAR_INT ("canna-key-rolldown", &canna_key_Rolldown /* | |
1722 | |
1723 */ ); | |
1724 canna_key_Rolldown = IROHA_KEY_Rolldown; | |
1725 | |
1726 DEFVAR_INT ("canna-key-home", &canna_key_Home /* | |
1727 | |
1728 */ ); | |
1729 canna_key_Home = IROHA_KEY_Home; | |
1730 | |
1731 DEFVAR_INT ("canna-key-help", &canna_key_Help /* | |
1732 | |
1733 */ ); | |
1734 canna_key_Help = IROHA_KEY_Help; | |
1735 | |
1736 DEFVAR_INT ("canna-key-kp-key", &canna_key_KP_Key /* | |
1737 | |
1738 */ ); | |
1739 canna_key_KP_Key = IROHA_KEY_KP_Key; | |
1740 | |
1741 DEFVAR_INT ("canna-key-shift-nfer", &canna_key_Shift_Nfer /* | |
1742 | |
1743 */ ); | |
1744 canna_key_Shift_Nfer = IROHA_KEY_Shift_Nfer; | |
1745 | |
1746 DEFVAR_INT ("canna-key-shift-xfer", &canna_key_Shift_Xfer /* | |
1747 | |
1748 */ ); | |
1749 canna_key_Shift_Xfer = IROHA_KEY_Shift_Xfer; | |
1750 | |
1751 DEFVAR_INT ("canna-key-shift-up", &canna_key_Shift_Up /* | |
1752 | |
1753 */ ); | |
1754 canna_key_Shift_Up = IROHA_KEY_Shift_Up; | |
1755 | |
1756 DEFVAR_INT ("canna-key-shift-left", &canna_key_Shift_Left /* | |
1757 | |
1758 */ ); | |
1759 canna_key_Shift_Left = IROHA_KEY_Shift_Left; | |
1760 | |
1761 DEFVAR_INT ("canna-key-shift-right", &canna_key_Shift_Right /* | |
1762 | |
1763 */ ); | |
1764 canna_key_Shift_Right = IROHA_KEY_Shift_Right; | |
1765 | |
1766 DEFVAR_INT ("canna-key-shift-down", &canna_key_Shift_Down /* | |
1767 | |
1768 */ ); | |
1769 canna_key_Shift_Down = IROHA_KEY_Shift_Down; | |
1770 | |
1771 DEFVAR_INT ("canna-key-control-nfer", &canna_key_Cntrl_Nfer /* | |
1772 | |
1773 */ ); | |
1774 canna_key_Cntrl_Nfer = IROHA_KEY_Cntrl_Nfer; | |
1775 | |
1776 DEFVAR_INT ("canna-key-control-xfer", &canna_key_Cntrl_Xfer /* | |
1777 | |
1778 */ ); | |
1779 canna_key_Cntrl_Xfer = IROHA_KEY_Cntrl_Xfer; | |
1780 | |
1781 DEFVAR_INT ("canna-key-control-up", &canna_key_Cntrl_Up /* | |
1782 | |
1783 */ ); | |
1784 canna_key_Cntrl_Up = IROHA_KEY_Cntrl_Up; | |
1785 | |
1786 DEFVAR_INT ("canna-key-control-left", &canna_key_Cntrl_Left /* | |
1787 | |
1788 */ ); | |
1789 canna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left; | |
1790 | |
1791 DEFVAR_INT ("canna-key-control-right", &canna_key_Cntrl_Right /* | |
1792 | |
1793 */ ); | |
1794 canna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right; | |
1795 | |
1796 DEFVAR_INT ("canna-key-control-down", &canna_key_Cntrl_Down /* | |
1797 | |
1798 */ ); | |
1799 canna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down; | |
1800 | |
1801 Fprovide (intern ("CANNA")); | |
1802 } | |
1803 | |
1804 #if 0 | |
1805 #ifdef HAVE_SHLIB | |
1806 void unload_canna_api (void); | |
1807 void | |
1808 unload_canna_api (void) | |
1809 { | |
1810 /* We don't need to do anything here in the sample case. However, if you | |
1811 create any new types with INIT_LRECORD_IMPLEMENTATION (sample_type), then | |
1812 UNDEF_LRECORD_IMPLEMENTATION (sample_type) must appear here. Also, any | |
1813 symbols declared with DEFSYMBOL (Qsample_var), or one of its variants, | |
1814 must have a corresponding unstaticpro_nodump (&Qsample_var) here. */ | |
1815 } | |
1816 #endif | |
1817 #endif | |
1818 | |
1819 #ifdef CANNA_MULE | |
1820 | |
3071 | 1821 /* Return the number of characters in an EUC-JP string. */ |
3010 | 1822 static int |
3071 | 1823 euc_jp_num_chars (unsigned char *p, int l) |
3010 | 1824 { |
1825 unsigned char ch, *cp = p; | |
1826 int len = 0; | |
1827 | |
1828 while ((cp < p + l) && (ch = *cp)) | |
1829 { | |
1830 if ((unsigned char) ch == ISO_CODE_SS2) | |
1831 { | |
1832 len++; | |
1833 cp += 2; | |
1834 } | |
1835 else if ((unsigned char) ch == ISO_CODE_SS3) | |
1836 { | |
1837 len++; | |
1838 cp += 3; | |
1839 } | |
1840 else if (ch & 0x80) | |
1841 { | |
1842 len++; | |
1843 cp += 2; | |
1844 } | |
1845 else | |
1846 { | |
1847 len++; | |
1848 cp++; | |
1849 } | |
1850 } | |
1851 return (len); | |
1852 } | |
1853 | |
1854 /* count number of characters */ | |
1855 static void | |
1856 count_char (unsigned char *p, int len, int pos, int rev, | |
1857 Fixnum *clen, Fixnum *cpos, Fixnum *crev) | |
1858 { | |
1859 unsigned char *q = p; | |
1860 | |
1861 *clen = *cpos = *crev = 0; | |
1862 if (len == 0) return; | |
1863 while (q < p + pos) | |
1864 { | |
1865 (*clen)++; | |
1866 (*cpos)++; | |
1867 if (*q++ & 0x80) q++; | |
1868 } | |
1869 while (q < p + pos + rev) | |
1870 { | |
1871 (*clen)++; | |
1872 (*crev)++; | |
1873 if (*q++ & 0x80) q++; | |
1874 } | |
1875 while (q < p + len) | |
1876 { | |
1877 (*clen)++; | |
1878 if (*q++ & 0x80) q++; | |
1879 } | |
1880 } | |
1881 #endif /* CANNA_MULE */ |