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