Mercurial > hg > xemacs-beta
comparison src/mule-canna.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 3ecd8885ac67 |
children | 3078fd1074e8 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
1 /* CANNA interface | 1 /* CANNA interface -*- coding: euc-jp -*- |
2 | 2 |
3 Copyright (C) 1995 Free Software Foundation, Inc. | 3 Copyright (C) 1995 Free Software Foundation, Inc. |
4 Copyright (C) 1995 Sun Microsystems, Inc. | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 | 5 |
6 This file is part of XEmacs. | 6 This file is part of XEmacs. |
188 | 188 |
189 static int IRCP_context; | 189 static int IRCP_context; |
190 | 190 |
191 static Lisp_Object storeResults (unsigned char *, int, jrKanjiStatus *); | 191 static Lisp_Object storeResults (unsigned char *, int, jrKanjiStatus *); |
192 static Lisp_Object kanjiYomiList (int, int); | 192 static Lisp_Object kanjiYomiList (int, int); |
193 static Lisp_Object CANNA_mode_keys (void); | |
193 | 194 |
194 #ifdef CANNA_MULE | 195 #ifdef CANNA_MULE |
195 static void m2c (unsigned char *, int, unsigned char *); | 196 static void m2c (unsigned char *, int, unsigned char *); |
196 static Lisp_Object mule_make_string (unsigned char *, int); | 197 static Lisp_Object mule_make_string (unsigned char *, int); |
197 static int mule_strlen (unsigned char *, int); | 198 static int mule_strlen (unsigned char *, int); |
324 | 325 |
325 return Qnil; | 326 return Qnil; |
326 } | 327 } |
327 | 328 |
328 /* For whatever reason, calling Fding directly from libCanna loses */ | 329 /* For whatever reason, calling Fding directly from libCanna loses */ |
329 static void call_Fding() | 330 static void |
330 { | 331 call_Fding (void) |
331 extern Lisp_Object Fding(); | 332 { |
332 | |
333 Fding (Qnil, Qnil, Qnil); | 333 Fding (Qnil, Qnil, Qnil); |
334 } | 334 } |
335 | 335 |
336 DEFUN ("canna-initialize", Fcanna_initialize, 0, 3, 0, /* | 336 DEFUN ("canna-initialize", Fcanna_initialize, 0, 3, 0, /* |
337 Initialize ``canna'', which is a kana-to-kanji converter for GNU Emacs. | 337 Initialize ``canna'', which is a kana-to-kanji converter for GNU Emacs. |
419 /* イニシャライズで失敗した場合。 */ | 419 /* イニシャライズで失敗した場合。 */ |
420 return Fcons (Qnil, val); | 420 return Fcons (Qnil, val); |
421 } | 421 } |
422 else | 422 else |
423 { | 423 { |
424 extern void (*jrBeepFunc)(); | 424 extern void (*jrBeepFunc) (void); |
425 Lisp_Object CANNA_mode_keys (); | |
426 | 425 |
427 jrBeepFunc = call_Fding; | 426 jrBeepFunc = call_Fding; |
428 | 427 |
429 #ifdef KC_SETAPPNAME | 428 #ifdef KC_SETAPPNAME |
430 #ifndef CANNA_MULE | 429 #ifndef CANNA_MULE |
533 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv); | 532 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv); |
534 val = storeResults (buf, ksv.val, ksv.ks); | 533 val = storeResults (buf, ksv.val, ksv.ks); |
535 return val; | 534 return val; |
536 } | 535 } |
537 | 536 |
538 Lisp_Object | 537 static Lisp_Object |
539 CANNA_mode_keys (void) | 538 CANNA_mode_keys (void) |
540 { | 539 { |
541 #define CANNAWORKBUFSIZE 32 | 540 #define CANNAWORKBUFSIZE 32 |
542 char xxx[CANNAWORKBUFSIZE]; | 541 char xxx[CANNAWORKBUFSIZE]; |
543 Lisp_Object val; | 542 Lisp_Object val; |
716 } | 715 } |
717 return i; | 716 return i; |
718 } | 717 } |
719 | 718 |
720 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /* | 719 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /* |
721 かな漢字変換した結果を返還する。文節切りがしてある。 | 720 Return the result of kana-to-kanji conversion. |
721 Clause separator is set. | |
722 */ | 722 */ |
723 (yomi)) | 723 (yomi)) |
724 { | 724 { |
725 int nbun; | 725 int nbun; |
726 | 726 |
771 } | 771 } |
772 return res; | 772 return res; |
773 } | 773 } |
774 | 774 |
775 DEFUN ("canna-henkan-next", Fcanna_henkan_next, 1, 1, 0, /* | 775 DEFUN ("canna-henkan-next", Fcanna_henkan_next, 1, 1, 0, /* |
776 候補一覧を求める。 | 776 Return the list of candidates. |
777 */ | 777 */ |
778 (bunsetsu)) | 778 (bunsetsu)) |
779 { | 779 { |
780 int i, slen, len; | 780 int i, slen, len; |
781 unsigned char *p, RkBuf[RKBUFSIZE]; | 781 unsigned char *p, RkBuf[RKBUFSIZE]; |
796 { | 796 { |
797 endp = res = Fcons (make_string (p, slen), Qnil); | 797 endp = res = Fcons (make_string (p, slen), Qnil); |
798 } | 798 } |
799 else | 799 else |
800 { | 800 { |
801 endp = XCDR (endp) = Fcons (make_string (p, slen), Qnil); | 801 endp = XCDR (res) = Fcons (make_string (p, slen), Qnil); |
802 } | 802 } |
803 p += slen + 1; | 803 p += slen + 1; |
804 } | 804 } |
805 return res; | 805 return res; |
806 } | 806 } |
807 | 807 |
808 DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, 2, 2, 0, /* | 808 DEFUN ("canna-bunsetu-henkou", Fcanna_bunsetu_henkou, 2, 2, 0, /* |
809 文節の長さを指定する。 | 809 Specify the length of a clause. |
810 */ | 810 */ |
811 (bunsetsu, bunlen)) | 811 (bunsetsu, bunlen)) |
812 { | 812 { |
813 int nbun, len; | 813 int nbun, len; |
814 | 814 |
824 len = byteLen (nbun, XINT (bunlen)); | 824 len = byteLen (nbun, XINT (bunlen)); |
825 return kanjiYomiList (IRCP_context, RkResize (IRCP_context, len)); | 825 return kanjiYomiList (IRCP_context, RkResize (IRCP_context, len)); |
826 } | 826 } |
827 | 827 |
828 DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, 2, 2, 0, /* | 828 DEFUN ("canna-henkan-kakutei", Fcanna_henkan_kakutei, 2, 2, 0, /* |
829 候補選択。 | 829 Select a candidate. |
830 */ | 830 */ |
831 (bun, kouho)) | 831 (bun, kouho)) |
832 { | 832 { |
833 int nbun, nkouho; | 833 int nbun, nkouho; |
834 | 834 |
843 RkXfer (IRCP_context, nkouho); | 843 RkXfer (IRCP_context, nkouho); |
844 return Qt; | 844 return Qt; |
845 } | 845 } |
846 | 846 |
847 DEFUN ("canna-henkan-end", Fcanna_henkan_end, 0, 0, 0, /* | 847 DEFUN ("canna-henkan-end", Fcanna_henkan_end, 0, 0, 0, /* |
848 変換終了。 | 848 End conversion. |
849 */ | 849 */ |
850 ()) | 850 ()) |
851 { | 851 { |
852 if (confirmContext () == 0) | 852 if (confirmContext () == 0) |
853 { | 853 { |
856 RkEndBun (IRCP_context, 1); /* 学習はいつでも行って良いものなのか? */ | 856 RkEndBun (IRCP_context, 1); /* 学習はいつでも行って良いものなのか? */ |
857 return Qt; | 857 return Qt; |
858 } | 858 } |
859 | 859 |
860 DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, 0, 0, 0, /* | 860 DEFUN ("canna-henkan-quit", Fcanna_henkan_quit, 0, 0, 0, /* |
861 変換終了。 | 861 Quit conversion. |
862 */ | 862 */ |
863 ()) | 863 ()) |
864 { | 864 { |
865 if (confirmContext () == 0) | 865 if (confirmContext () == 0) |
866 { | 866 { |
1775 I assume CANNA can handle only Japanese EUC. */ | 1775 I assume CANNA can handle only Japanese EUC. */ |
1776 | 1776 |
1777 /* EUC multibyte string to MULE internal string */ | 1777 /* EUC multibyte string to MULE internal string */ |
1778 | 1778 |
1779 static void | 1779 static void |
1780 c2mu (char *cp, int l, char *mp) | 1780 c2mu (unsigned char *cp, int l, unsigned char *mp) |
1781 { | 1781 { |
1782 char ch, *ep = cp+l; | 1782 unsigned char ch, *ep = cp+l; |
1783 | 1783 |
1784 while ((cp < ep) && (ch = *cp)) | 1784 while ((cp < ep) && (ch = *cp)) |
1785 { | 1785 { |
1786 if ((unsigned char) ch == ISO_CODE_SS2) | 1786 if ((unsigned char) ch == ISO_CODE_SS2) |
1787 { | 1787 { |