From: morioka Date: Tue, 2 Mar 1999 18:52:41 +0000 (+0000) Subject: (Fcanna_touroku_string): Modify for Emacs 20.3 or later. X-Git-Tag: emacs-canna-1_2~4 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28a802b04d8bb60665a1965ade5b693d23f3bf3a;p=elisp%2Femacs-canna.git (Fcanna_touroku_string): Modify for Emacs 20.3 or later. (Fcanna_store_yomi): Likewise. (Fcanna_parse): Likewise. (Fcanna_henkan_begin): Likewise. --- diff --git a/canna.c b/canna.c index b41f45d..300e5c8 100644 --- a/canna.c +++ b/canna.c @@ -1,26 +1,28 @@ -/* - CANNA interface for NEmacs +/* CANNA interface for Emacs/mule and XEmacs/mule. - This file is a part of Canna on Nemacs. + Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999 MORIOKA Tomohiko - Canna on Nemacs is distributed in the forms of patches - to Nemacs under the terms of the GNU EMACS GENERAL - PUBLIC LICENSE which is distributed along with GNU Emacs - by the Free Software Foundation. + This file is not part of GNU Emacs. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. - Canna on Nemacs is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A - PARTICULAR PURPOSE. See the GNU EMACS GENERAL PUBLIC - LICENSE for more details. + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - You should have received a copy of the GNU EMACS GENERAL - PUBLIC LICENSE along with Nemacs; see the file COPYING. - If not, write to the Free Software Foundation, 675 Mass - Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU General Public License + along with GNU Emacs; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. Authors: Akira Kon (kon@d1.bs2.mt.nec.co.jp) Ichiro Hirakura (hirakura@uxp.bs2.mt.nec.co.jp) + modified by MORIOKA Tomohiko Functions defined in this file are @@ -141,7 +143,7 @@ */ #ifndef lint -static char rcs_id[] = "$Id: canna.c,v 1.35 1997-03-06 12:41:59 morioka Exp $"; +static char rcs_id[] = "$Id: canna.c,v 1.36 1999-03-02 18:52:41 morioka Exp $"; #endif #include @@ -149,18 +151,31 @@ static char rcs_id[] = "$Id: canna.c,v 1.35 1997-03-06 12:41:59 morioka Exp $"; #include "config.h" #include "lisp.h" #include "buffer.h" -#ifdef CANNA_MULE +#ifndef CANNA_NEMACS #include "charset.h" #endif +#ifdef CANNA_EMACS +#include "coding.h" +#endif + +#ifdef CANNA_EMACS +#define CHARSET_KATAKANA_JISX0201 137 +#define CHARSET_JAPANESE_JISX0208 146 +#define CHARSET_JAPANESE_JISX0212 148 +#else +#ifdef CANNA_MULE +#define CHARSET_KATAKANA_JISX0201 LCKANA +#define CHARSET_JAPANESE_JISX0208 LCJP +#define CHARSET_JAPANESE_JISX0212 LCJP2 +#define ISO_CODE_SS2 SS2 +#define ISO_CODE_SS3 SS3 +#endif /* CANNA_MULE */ +#endif -#ifdef CANNA2 #define IROHA_BC #include "canna/jrkanji.h" #include "canna/RK.h" -#else /* !CANNA2 */ -#include "iroha/jrkanji.h" -#include "iroha/RK.h" -#endif /* !CANNA2 */ + extern char *jrKanjiError; #define KEYTOSTRSIZE 2048 @@ -171,18 +186,24 @@ static int Vcanna_empty_info, Vcanna_through_info; static int Vcanna_underline; static int Vcanna_inhibit_hankakukana; /* hir, 1994.12.5 */ +#ifndef CANNA_EMACS_DL static Lisp_Object Vcanna_kakutei_string; static Lisp_Object Vcanna_kakutei_yomi; static Lisp_Object Vcanna_kakutei_romaji; static Lisp_Object Vcanna_henkan_string; +#endif static int Vcanna_henkan_length; static int Vcanna_henkan_revPos; static int Vcanna_henkan_revLen; +#ifndef CANNA_EMACS_DL static Lisp_Object Vcanna_ichiran_string; +#endif static int Vcanna_ichiran_length; static int Vcanna_ichiran_revPos; static int Vcanna_ichiran_revLen; +#ifndef CANNA_EMACS_DL static Lisp_Object Vcanna_mode_string; +#endif static int IRCP_context; @@ -194,7 +215,7 @@ static Lisp_Object storeResults(); static Lisp_Object kanjiYomiList(); #endif -#ifdef CANNA_MULE +#ifndef CANNA_NEMACS #if __STDC__ static m2c(unsigned char *, int, unsigned char *); static Lisp_Object mule_make_string(unsigned char *, int); @@ -211,7 +232,7 @@ static count_char(); /* Lisp functions definition */ -DEFUN ("canna-key-proc", Fcanna_key_proc, Scanna_key_proc, +DEFUN ("canna-key-proc", Fcanna_key_proc, Scanna_key_proc, 1, 1, 0, "Translate a key input to a set of strings. The strings contain both\n\ well-formed string and intermediate result to show the translation\n\ @@ -242,10 +263,19 @@ jrKanjiStatus *ks; } else { /* ³ÎÄꤷ¤¿Ê¸»úÎó */ +#ifndef CANNA_EMACS_DL Vcanna_kakutei_string = make_string(buf, len); +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-kakutei-string"), make_string(buf, len)); +#endif val = make_number(len); /* ³ÎÄꤷ¤¿Ê¸»úÎó¤ÎÆɤߤξðÊó... */ +#ifndef CANNA_EMACS_DL Vcanna_kakutei_yomi = Vcanna_kakutei_romaji = Qnil; +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-kakutei-yomi"), Qnil); + Fset(intern("canna-kakutei-romaji"), Qnil); +#endif if (ks->info & KanjiYomiInfo) { unsigned char *p = buf + len + 1; int yomilen = strlen(p); @@ -253,21 +283,38 @@ jrKanjiStatus *ks; if (len + yomilen + 1 < KEYTOSTRSIZE) { int yomilen2; +#ifndef CANNA_EMACS_DL Vcanna_kakutei_yomi = make_string(p, yomilen); /* ÆÉ¤ß */ +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-kakutei-yomi"), make_string(p, yomilen)); +#endif p += yomilen + 1; yomilen2 = strlen(p); if (len + yomilen + yomilen2 + 2 < KEYTOSTRSIZE) { +#ifndef CANNA_EMACS_DL Vcanna_kakutei_romaji = make_string(p, yomilen2); /* ¥í¡¼¥Þ»ú */ +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-kakutei-romaji"), make_string(p, yomilen2)); +#endif } } } /* ¸õÊäɽ¼¨¤Îʸ»úÎó¤Ç¤¹¡£*/ +#ifndef CANNA_EMACS_DL Vcanna_henkan_string = Qnil; +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-henkan-string"), Qnil); +#endif if (ks->length >= 0) { +#ifndef CANNA_EMACS_DL Vcanna_henkan_string = make_string(ks->echoStr, ks->length); -#ifndef CANNA_MULE +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-henkan-string"), + make_string(ks->echoStr, ks->length)); +#endif +#ifdef CANNA_NEMACS Vcanna_henkan_length = ks->length; Vcanna_henkan_revPos = ks->revPos; Vcanna_henkan_revLen = ks->revLen; @@ -286,10 +333,19 @@ jrKanjiStatus *ks; } /* °ìÍ÷¤Î¾ðÊó */ +#ifndef CANNA_EMACS_DL Vcanna_ichiran_string = Qnil; +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-ichiran-string"), Qnil); +#endif if (ks->info & KanjiGLineInfo && ks->gline.length >= 0) { +#ifndef CANNA_EMACS_DL Vcanna_ichiran_string = make_string(ks->gline.line, ks->gline.length); -#ifndef CANNA_MULE +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-ichiran-string"), + make_string(ks->gline.line, ks->gline.length)); +#endif +#ifdef CANNA_NEMACS Vcanna_ichiran_length = ks->gline.length; Vcanna_ichiran_revPos = ks->gline.revPos; Vcanna_ichiran_revLen = ks->gline.revLen; @@ -301,9 +357,18 @@ jrKanjiStatus *ks; } /* ¥â¡¼¥É¤Î¾ðÊó */ +#ifndef CANNA_EMACS_DL Vcanna_mode_string = Qnil; +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-mode-string"), Qnil); +#endif if (ks->info & KanjiModeInfo) { +#ifndef CANNA_EMACS_DL Vcanna_mode_string = make_string(ks->mode, strlen(ks->mode)); +#else /* CANNA_EMACS_DL */ + Fset(intern("canna-mode-string"), + make_string(ks->mode, strlen(ks->mode))); +#endif } /* ¤½¤Î¾¤Î¾ðÊó */ @@ -319,14 +384,16 @@ DEFUN ("canna-set-bunsetsu-kugiri", Fcanna_set_bunsetsu, Scanna_set_bunsetsu, "This function sets the clause separator.\n\ If non-nil value is specified, the white space separator will be used.\n\ No separator will be used otherwise.") -(num) -Lisp_Object num; + (num) + Lisp_Object num; { int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© */ kugiri = NILP(num) ? 0 : 1; jrKanjiControl(0, KC_SETBUNSETSUKUGIRI, (char *)kugiri); + + return Qnil; } DEFUN ("canna-initialize", Fcanna_initialize, Scanna_initialize, 0, 3, 0, @@ -413,7 +480,7 @@ Lisp_Object num, server, rcfile; jrBeepFunc = Fding; #ifdef KC_SETAPPNAME -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS wcKanjiControl(0, KC_SETAPPNAME, "nemacs"); #else /* CANNA_MULE */ wcKanjiControl(0, KC_SETAPPNAME, "mule"); @@ -422,7 +489,7 @@ Lisp_Object num, server, rcfile; jrKanjiControl(0, KC_SETBUNSETSUKUGIRI, (char *)kugiri); jrKanjiControl(0, KC_SETWIDTH, (char *)78); -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS jrKanjiControl(0, KC_INHIBITHANKAKUKANA, (char *)1); #else /* hir, 1994.12.5 */ /* mule ¤À¤Ã¤¿¤éȾ³Ñ¥«¥¿¥«¥Ê¤â»È¤¨¤ë */ @@ -466,18 +533,22 @@ Lisp_Object str; jrKanjiStatus ks; int len; Lisp_Object val; -#ifdef CANNA_MULE +#ifndef CANNA_NEMACS unsigned char cbuf[4096]; #endif CHECK_STRING(str, 0); ksv.buffer = (unsigned char *)buf; ksv.bytes_buffer = KEYTOSTRSIZE; -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS ks.echoStr = XSTRING (str)->data; ks.length = XSTRING (str)->size; #else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING (str)->data, STRING_BYTES (XSTRING (str)), cbuf); +#else /* for byte indexing emacsen (Emacs 20.2) */ m2c(XSTRING (str)->data, XSTRING (str)->size, cbuf); +#endif /* STRING_BYTES */ ks.echoStr = cbuf; ks.length = strlen(cbuf); #endif /* CANNA_MULE */ @@ -548,12 +619,16 @@ Lisp_Object yomi, roma; jrKanjiStatus ks; CHECK_STRING(yomi, 0); -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS strncpy(buf, XSTRING(yomi)->data, XSTRING(yomi)->size); ks.length = XSTRING (yomi)->size; buf[ks.length] = '\0'; #else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING(yomi)->data, STRING_BYTES (XSTRING(yomi)), buf); +#else /* for byte indexing emacsen (Emacs 20.2) */ m2c(XSTRING(yomi)->data, XSTRING(yomi)->size, buf); +#endif /* STRING_BYTES */ ks.length = strlen(buf); #endif /* CANNA_MULE */ @@ -563,14 +638,18 @@ Lisp_Object yomi, roma; else { CHECK_STRING(roma, 0); -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS strncpy(buf + XSTRING(yomi)->size + 1, XSTRING(roma)->data, XSTRING(roma)->size); buf[XSTRING(yomi)->size + 1 + XSTRING(roma)->size] = '\0'; ks.mode = (unsigned char *)(buf + XSTRING(yomi)->size + 1); #else /* CANNA_MULE */ ks.mode = (unsigned char *)(buf + ks.length + 1); +#ifdef STRING_BYTES + m2c(XSTRING(roma)->data, STRING_BYTES (XSTRING(roma)), ks.mode); +#else /* for byte indexing emacsen (Emacs 20.2) */ m2c(XSTRING(roma)->data, XSTRING(roma)->size, ks.mode); +#endif /* STRING_BYTES */ #endif /* CANNA_MULE */ } @@ -627,11 +706,15 @@ Lisp_Object str; CHECK_STRING(str, 0); -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS strncpy(buf, XSTRING(str)->data, XSTRING(str)->size); buf[XSTRING(str)->size] = '\0'; #else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING(str)->data, STRING_BYTES (XSTRING(str)), buf); +#else /* for byte indexing emacsen (Emacs 20.2) */ m2c(XSTRING(str)->data, XSTRING(str)->size, buf); +#endif /* STRING_BYTES */ #endif /* CANNA_MULE */ p = (unsigned char**)buf; n = jrKanjiControl(0, KC_PARSE, (char *)&p); @@ -708,13 +791,17 @@ DEFUN ("canna-henkan-begin", Fcanna_henkan_begin, Scanna_henkan_begin, if (confirmContext() == 0) { return Qnil; } -#ifndef CANNA_MULE +#ifdef CANNA_NEMACS strncpy(yomibuf, XSTRING(yomi)->data, XSTRING(yomi)->size); yomibuf[XSTRING(yomi)->size] = '\0'; nbun = RkBgnBun(IRCP_context, XSTRING(yomi)->data, XSTRING(yomi)->size, (RK_XFER << RK_XFERBITS) | RK_KFER); #else /* CANNA_MULE */ +#ifdef STRING_BYTES + m2c(XSTRING(yomi)->data, STRING_BYTES (XSTRING(yomi)), yomibuf); +#else /* for byte indexing emacsen (Emacs 20.2) */ m2c(XSTRING(yomi)->data, XSTRING(yomi)->size, yomibuf); +#endif /* STRING_BYTES */ nbun = RkBgnBun(IRCP_context, (char *)yomibuf, strlen(yomibuf), (RK_XFER << RK_XFERBITS) | RK_KFER); #endif /* CANNA_MULE */ @@ -983,12 +1070,34 @@ static int Vcanna_key_Cntrl_Left = IROHA_KEY_Cntrl_Left; static int Vcanna_key_Cntrl_Right = IROHA_KEY_Cntrl_Right; static int Vcanna_key_Cntrl_Down = IROHA_KEY_Cntrl_Down; -static Lisp_Object VCANNA; /* hir@nec, 1992.5.21 */ +#ifdef CANNA_EMACS_DL +static struct Lisp_Subr *s_canna_key_proc; +static struct Lisp_Subr *s_canna_set_bunsetsu; +static struct Lisp_Subr *s_canna_initialize; +static struct Lisp_Subr *s_canna_finalize; +static struct Lisp_Subr *s_canna_touroku_string; +static struct Lisp_Subr *s_canna_set_width; +static struct Lisp_Subr *s_canna_change_mode; +static struct Lisp_Subr *s_canna_store_yomi; +static struct Lisp_Subr *s_canna_do_function; +static struct Lisp_Subr *s_canna_parse; +static struct Lisp_Subr *s_canna_query_mode; +static struct Lisp_Subr *s_canna_henkan_begin; +static struct Lisp_Subr *s_canna_henkan_next; +static struct Lisp_Subr *s_canna_bunsetu_henkou; +static struct Lisp_Subr *s_canna_henkan_kakutei; +static struct Lisp_Subr *s_canna_henkan_end; +static struct Lisp_Subr *s_canna_henkan_quit; +#else +static Lisp_Object VCANNA; /* hir@nec, 1992.5.21 */ +#endif + +#ifndef CANNA_EMACS_DL syms_of_canna () { DEFVAR_LISP ("CANNA", &VCANNA, ""); /* hir@nec, 1992.5.21 */ - VCANNA = Qt; /* hir@nec, 1992.5.21 */ + VCANNA = Qt; /* hir@nec, 1992.5.21 */ defsubr (&Scanna_key_proc); defsubr (&Scanna_initialize); @@ -1001,32 +1110,156 @@ syms_of_canna () defsubr (&Scanna_parse); defsubr (&Scanna_query_mode); defsubr (&Scanna_set_bunsetsu); +#else /* CANNA_EMACS_DL */ +void +emacs_canna_init () +{ + Lisp_Object sym; + + sym = intern("CANNA"); + XSYMBOL (sym)->value = Qt; + + s_canna_key_proc + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_key_proc, s_canna_key_proc, sizeof (struct Lisp_Subr)); + defsubr (s_canna_key_proc); + + s_canna_initialize + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_initialize, s_canna_initialize, sizeof (struct Lisp_Subr)); + defsubr (s_canna_initialize); + + s_canna_finalize + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_finalize, s_canna_finalize, sizeof (struct Lisp_Subr)); + defsubr (s_canna_finalize); + + s_canna_touroku_string + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_touroku_string, s_canna_touroku_string, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_touroku_string); + + s_canna_set_width + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_set_width, s_canna_set_width, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_set_width); + + s_canna_change_mode + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_change_mode, s_canna_change_mode, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_change_mode); + + s_canna_store_yomi + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_store_yomi, s_canna_store_yomi, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_store_yomi); + + s_canna_do_function + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_do_function, s_canna_do_function, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_do_function); + + s_canna_parse + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_parse, s_canna_parse, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_parse); + + s_canna_query_mode + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_query_mode, s_canna_query_mode, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_query_mode); + + s_canna_set_bunsetsu + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_set_bunsetsu, s_canna_set_bunsetsu, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_set_bunsetsu); +#endif +#ifndef CANNA_EMACS_DL DEFVAR_LISP("canna-kakutei-string", &Vcanna_kakutei_string, ""); DEFVAR_LISP("canna-kakutei-yomi", &Vcanna_kakutei_yomi, ""); DEFVAR_LISP("canna-kakutei-romaji", &Vcanna_kakutei_romaji, ""); DEFVAR_LISP("canna-henkan-string", &Vcanna_henkan_string, ""); +#else /* CANNA_EMACS_DL */ + sym = intern("canna-kakutei-string"); sym = Qnil; + sym = intern("canna-kakutei-yomi"); sym = Qnil; + sym = intern("canna-kakutei-romaji"); sym = Qnil; + sym = intern("canna-henkan-string"); sym = Qnil; +#endif DEFVAR_INT ("canna-henkan-length", &Vcanna_henkan_length, ""); DEFVAR_INT ("canna-henkan-revpos", &Vcanna_henkan_revPos, ""); DEFVAR_INT ("canna-henkan-revlen", &Vcanna_henkan_revLen, ""); +#ifndef CANNA_EMACS_DL DEFVAR_LISP("canna-ichiran-string", &Vcanna_ichiran_string, ""); +#else /* CANNA_EMACS_DL */ + sym = intern("canna-ichiran-string"); sym = Qnil; +#endif DEFVAR_INT ("canna-ichiran-length", &Vcanna_ichiran_length, ""); DEFVAR_INT ("canna-ichiran-revpos", &Vcanna_ichiran_revPos, ""); DEFVAR_INT ("canna-ichiran-revlen", &Vcanna_ichiran_revLen, ""); +#ifndef CANNA_EMACS_DL DEFVAR_LISP("canna-mode-string", &Vcanna_mode_string, ""); - +#else /* CANNA_EMACS_DL */ + sym = intern("canna-mode-string"); sym = Qnil; +#endif DEFVAR_BOOL ("canna-empty-info", &Vcanna_empty_info, "For canna"); DEFVAR_BOOL ("canna-through-info", &Vcanna_through_info, "For canna"); DEFVAR_BOOL ("canna-underline", &Vcanna_underline, "For canna"); DEFVAR_BOOL ("canna-inhibit-hankakukana", &Vcanna_inhibit_hankakukana, "For canna"); /* hir, 1994.12.5 */ +#ifndef CANNA_EMACS_DL defsubr (&Scanna_henkan_begin); defsubr (&Scanna_henkan_next); defsubr (&Scanna_bunsetu_henkou); defsubr (&Scanna_henkan_kakutei); defsubr (&Scanna_henkan_end); defsubr (&Scanna_henkan_quit); +#else /* CANNA_EMACS_DL */ + s_canna_henkan_begin + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_henkan_begin, s_canna_henkan_begin, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_henkan_begin); + + s_canna_henkan_next + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_henkan_next, s_canna_henkan_next, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_henkan_next); + + s_canna_bunsetu_henkou + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_bunsetu_henkou, s_canna_bunsetu_henkou, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_bunsetu_henkou); + + s_canna_henkan_kakutei + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_henkan_kakutei, s_canna_henkan_kakutei, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_henkan_kakutei); + + s_canna_henkan_end + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_henkan_end, s_canna_henkan_end, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_henkan_end); + + s_canna_henkan_quit + = (struct Lisp_Subr *)xmalloc (sizeof (struct Lisp_Subr)); + bcopy (&Scanna_henkan_quit, s_canna_henkan_quit, + sizeof (struct Lisp_Subr)); + defsubr (s_canna_henkan_quit); +#endif DEFVAR_INT ("canna-mode-alpha-mode", &Vcanna_mode_AlphaMode, ""); DEFVAR_INT ("canna-mode-empty-mode", &Vcanna_mode_EmptyMode, ""); @@ -1201,7 +1434,64 @@ syms_of_canna () DEFVAR_INT ("canna-key-control-down", &Vcanna_key_Cntrl_Down, ""); } -#ifdef CANNA_MULE +#ifdef CANNA_EMACS_DL +void +emacs_wnnfns_fini () +{ + undefsubr (s_canna_key_proc); + free (s_canna_key_proc); + + undefsubr (s_canna_initialize); + free (s_canna_initialize); + + undefsubr (s_canna_finalize); + free (s_canna_finalize); + + undefsubr (s_canna_touroku_string); + free (s_canna_touroku_string); + + undefsubr (s_canna_set_width); + free (s_canna_set_width); + + undefsubr (s_canna_change_mode); + free (s_canna_change_mode); + + undefsubr (s_canna_store_yomi); + free (s_canna_store_yomi); + + undefsubr (s_canna_do_function); + free (s_canna_do_function); + + undefsubr (s_canna_parse); + free (s_canna_parse); + + undefsubr (s_canna_query_mode); + free (s_canna_query_mode); + + undefsubr (s_canna_set_bunsetsu); + free (s_canna_set_bunsetsu); + + undefsubr (s_canna_henkan_begin); + free (s_canna_henkan_begin); + + undefsubr (s_canna_henkan_next); + free (s_canna_henkan_next); + + undefsubr (s_canna_bunsetu_henkou); + free (s_canna_bunsetu_henkou); + + undefsubr (s_canna_henkan_kakutei); + free (s_canna_henkan_kakutei); + + undefsubr (s_canna_henkan_end); + free (s_canna_henkan_end); + + undefsubr (s_canna_henkan_quit); + free (s_canna_henkan_quit); +} +#endif + +#ifndef CANNA_NEMACS /* To handle MULE internal code and EUC. I assume CANNA can handle only Japanese EUC. */ @@ -1216,17 +1506,17 @@ char *mp; char ch, *ep = cp+l; while((cp < ep) && (ch = *cp)) { - if ((unsigned char)ch == SS2) { - *mp++ = LCKANA; + if ((unsigned char)ch == ISO_CODE_SS2) { + *mp++ = CHARSET_KATAKANA_JISX0201; cp++; } - else if ((unsigned char)ch == SS3) { - *mp++ = LCJP2; + else if ((unsigned char)ch == ISO_CODE_SS3) { + *mp++ = CHARSET_JAPANESE_JISX0212; cp++; *mp++ = *cp++; } else if(ch & 0x80) { - *mp++ = LCJP; + *mp++ = CHARSET_JAPANESE_JISX0208; *mp++ = *cp++; } *mp++ = *cp++; @@ -1246,13 +1536,13 @@ unsigned char *cp; while((mp < ep) && (ch = *mp++)) { switch (ch) { - case LCKANA: - *cp++ = SS2; + case CHARSET_KATAKANA_JISX0201: + *cp++ = ISO_CODE_SS2; *cp++ = *mp++; break; - case LCJP2: - *cp++ = SS3; - case LCJP: + case CHARSET_JAPANESE_JISX0212: + *cp++ = ISO_CODE_SS3; + case CHARSET_JAPANESE_JISX0208: *cp++ = *mp++; *cp++ = *mp++; break; @@ -1289,11 +1579,11 @@ int l; int len = 0; while((cp < p + l) && (ch = *cp)) { - if ((unsigned char)ch == SS2) { + if ((unsigned char)ch == ISO_CODE_SS2) { len += 2; cp += 2; } - else if ((unsigned char)ch == SS3) { + else if ((unsigned char)ch == ISO_CODE_SS3) { len += 3; cp += 3; }