comparison src/mule-canna.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children da8ed4261e83
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
1 /* CANNA interface -*- coding: euc-jp -*- 1 /* CANNA interface
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);
194 193
195 #ifdef CANNA_MULE 194 #ifdef CANNA_MULE
196 static void m2c (unsigned char *, int, unsigned char *); 195 static void m2c (unsigned char *, int, unsigned char *);
197 static Lisp_Object mule_make_string (unsigned char *, int); 196 static Lisp_Object mule_make_string (unsigned char *, int);
198 static int mule_strlen (unsigned char *, int); 197 static int mule_strlen (unsigned char *, int);
325 324
326 return Qnil; 325 return Qnil;
327 } 326 }
328 327
329 /* For whatever reason, calling Fding directly from libCanna loses */ 328 /* For whatever reason, calling Fding directly from libCanna loses */
330 static void 329 static void call_Fding()
331 call_Fding (void) 330 {
332 { 331 extern Lisp_Object Fding();
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) (void); 424 extern void (*jrBeepFunc)();
425 Lisp_Object CANNA_mode_keys ();
425 426
426 jrBeepFunc = call_Fding; 427 jrBeepFunc = call_Fding;
427 428
428 #ifdef KC_SETAPPNAME 429 #ifdef KC_SETAPPNAME
429 #ifndef CANNA_MULE 430 #ifndef CANNA_MULE
532 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv); 533 jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv);
533 val = storeResults (buf, ksv.val, ksv.ks); 534 val = storeResults (buf, ksv.val, ksv.ks);
534 return val; 535 return val;
535 } 536 }
536 537
537 static Lisp_Object 538 Lisp_Object
538 CANNA_mode_keys (void) 539 CANNA_mode_keys (void)
539 { 540 {
540 #define CANNAWORKBUFSIZE 32 541 #define CANNAWORKBUFSIZE 32
541 char xxx[CANNAWORKBUFSIZE]; 542 char xxx[CANNAWORKBUFSIZE];
542 Lisp_Object val; 543 Lisp_Object val;
715 } 716 }
716 return i; 717 return i;
717 } 718 }
718 719
719 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /* 720 DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, 1, 1, 0, /*
720 Return the result of kana-to-kanji conversion. 721 かな漢字変換した結果を返還する。文節切りがしてある。
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 Return the list of candidates. 776 候補一覧を求める。
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 (res) = Fcons (make_string (p, slen), Qnil); 801 endp = XCDR (endp) = 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 Specify the length of a clause. 809 文節の長さを指定する。
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 Select a candidate. 829 候補選択。
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 End conversion. 848 変換終了。
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 Quit conversion. 861 変換終了。
862 */ 862 */
863 ()) 863 ())
864 { 864 {
865 if (confirmContext () == 0) 865 if (confirmContext () == 0)
866 { 866 {
1020 1996/6/7 */ 1020 1996/6/7 */
1021 1021
1022 void 1022 void
1023 syms_of_mule_canna (void) 1023 syms_of_mule_canna (void)
1024 { 1024 {
1025 DEFVAR_LISP ("CANNA", &VCANNA); /* hir@nec, 1992.5.21 */
1026 VCANNA = Qt; /* hir@nec, 1992.5.21 */
1027
1025 DEFSUBR (Fcanna_key_proc); 1028 DEFSUBR (Fcanna_key_proc);
1026 DEFSUBR (Fcanna_initialize); 1029 DEFSUBR (Fcanna_initialize);
1027 DEFSUBR (Fcanna_finalize); 1030 DEFSUBR (Fcanna_finalize);
1028 DEFSUBR (Fcanna_touroku_string); 1031 DEFSUBR (Fcanna_touroku_string);
1029 DEFSUBR (Fcanna_set_width); 1032 DEFSUBR (Fcanna_set_width);
1043 } 1046 }
1044 1047
1045 void 1048 void
1046 vars_of_mule_canna (void) 1049 vars_of_mule_canna (void)
1047 { 1050 {
1048 DEFVAR_LISP ("CANNA", &VCANNA); /* hir@nec, 1992.5.21 */
1049 VCANNA = Qt; /* hir@nec, 1992.5.21 */
1050
1051 DEFVAR_LISP ("canna-kakutei-string", &Vcanna_kakutei_string /* 1051 DEFVAR_LISP ("canna-kakutei-string", &Vcanna_kakutei_string /*
1052 1052
1053 */ ); 1053 */ );
1054 Vcanna_kakutei_string = Qnil; 1054 Vcanna_kakutei_string = Qnil;
1055 1055
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 (unsigned char *cp, int l, unsigned char *mp) 1780 c2mu (char *cp, int l, char *mp)
1781 { 1781 {
1782 unsigned char ch, *ep = cp+l; 1782 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 {