diff options
Diffstat (limited to 'app-i18n/xcin/files/xcin-chewing.diff')
-rw-r--r-- | app-i18n/xcin/files/xcin-chewing.diff | 517 |
1 files changed, 517 insertions, 0 deletions
diff --git a/app-i18n/xcin/files/xcin-chewing.diff b/app-i18n/xcin/files/xcin-chewing.diff new file mode 100644 index 000000000000..9bec1dc8c9f9 --- /dev/null +++ b/app-i18n/xcin/files/xcin-chewing.diff @@ -0,0 +1,517 @@ +diff -uNrBb xcin.bak/configure xcin/configure +--- xcin.bak/configure 2004-05-27 19:19:22.000000000 +0800 ++++ xcin/configure 2004-05-27 19:20:03.000000000 +0800 +@@ -8601,6 +8601,7 @@ + src/Cinput/zh_hex/Makefile \ + src/Cinput/gen_inp/Makefile \ + src/Cinput/bimsphone/Makefile \ ++ src/Cinput/chewing/Makefile \ + src/util/Makefile \ + src/util/cin2tab/Makefile \ + src/util/testprog/Makefile \ +@@ -8751,6 +8752,7 @@ + src/Cinput/zh_hex/Makefile \ + src/Cinput/gen_inp/Makefile \ + src/Cinput/bimsphone/Makefile \ ++ src/Cinput/chewing/Makefile \ + src/util/Makefile \ + src/util/cin2tab/Makefile \ + src/util/testprog/Makefile \ +diff -uNrBb xcin.bak/src/Cinput/Makefile.in xcin/src/Cinput/Makefile.in +--- xcin.bak/src/Cinput/Makefile.in 2001-09-22 18:47:48.000000000 +0800 ++++ xcin/src/Cinput/Makefile.in 2004-05-27 19:18:50.000000000 +0800 +@@ -1,4 +1,4 @@ +-SUBSYS = zh_hex gen_inp bimsphone ++SUBSYS = zh_hex gen_inp bimsphone chewing + OTHERS = im_comm + + .PHONY: depend subdirs clean distclean install +diff -uNrBb xcin.bak/src/Cinput/chewing/.depend xcin/src/Cinput/chewing/.depend +--- xcin.bak/src/Cinput/chewing/.depend 1970-01-01 08:00:00.000000000 +0800 ++++ xcin/src/Cinput/chewing/.depend 2004-05-27 19:18:50.000000000 +0800 +@@ -0,0 +1,9 @@ ++# ++# PLEASE DON'T EDIT. ++# ++# This is automatically generated from "make depend". ++# You need GCC and perl to generate me. ++# ++ ++xcin_chewing.lo: xcin_chewing.c ../../../config.h ../../../src/include/xcintool.h ../../../src/include/module.h ++ @$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(DEFS) $(INC) -c -o $@ xcin_chewing.c +diff -uNrBb xcin.bak/src/Cinput/chewing/Makefile.in xcin/src/Cinput/chewing/Makefile.in +--- xcin.bak/src/Cinput/chewing/Makefile.in 1970-01-01 08:00:00.000000000 +0800 ++++ xcin/src/Cinput/chewing/Makefile.in 2004-05-27 19:18:50.000000000 +0800 +@@ -0,0 +1,29 @@ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++include $(top_srcdir)/Rules ++ ++INC = $(xcininc) $(intl_inc) $(x_includes) -I$(top_srcdir) ++LIB = $(xcinlib) -lchewing ++TARGET = chewing.la ++ ++SRC = xcin_chewing.c ++OBJ = $(SRC:.c=.lo) ++ ++.PHONY: depend clean distclean ++ ++all: depend $(TARGET) ++ ++$(TARGET): $(OBJ) ++ $(LIBTOOL) --mode=link $(CC) -module -avoid-version -o $(TARGET) \ ++ $(OBJ) $(LIB) -rpath $(moddir) ++include .depend ++ ++depend: ++ $(Dep_Rule) | $(PERL) $(makedep) $(rules) LC_Rule lo > .depend ++ ++clean: ++ rm -f $(OBJ) *.o $(TARGET) core *.a ++distclean: clean ++ rm -rf Makefile .libs ++install: $(TARGET) ++ $(LIBTOOL) --mode=install $(INSTALL_DATA) $(TARGET) $(xcin_modp) +diff -uNrBb xcin.bak/src/Cinput/chewing/xcin_chewing.c xcin/src/Cinput/chewing/xcin_chewing.c +--- xcin.bak/src/Cinput/chewing/xcin_chewing.c 1970-01-01 08:00:00.000000000 +0800 ++++ xcin/src/Cinput/chewing/xcin_chewing.c 2004-05-27 19:18:50.000000000 +0800 +@@ -0,0 +1,409 @@ ++/* ++ this file is the interface between chewing and xcin ++*/ ++ ++#ifdef HAVE_CONFIG_H ++# include "config.h" ++#endif ++ ++#include <chewing/chewingio.h> ++#include <chewing/hash.h> ++/* XXX: #include <chewing/console_chewing.h> */ ++#include <chewing/dict.h> ++#include <chewing/zuin.h> ++#include <chewing/char.h> ++#include <string.h> ++ ++#include <X11/Xlib.h> ++#include <X11/keysym.h> ++#include "xcintool.h" ++#include "module.h" ++ ++#define DBG(msg) \ ++ fprintf(stderr, "\033[44;37m" msg "\033[m\n") ++ ++// the following keystate masks are defined by xcin ++#define CAPS_MASK (2) ++#define CTRL_MASK (4) ++ ++/* statistics symbol required by chewing */ ++int lifetime ; ++ ++int MakeInpinfo(inpinfo_t *inpinfo, ChewingOutput *pgo) ; ++ ++int CallSetConfig(inpinfo_t *inpinfo, ChewingData *pgdata) ++{ ++ ConfigData config ; ++ int i ; ++ ++ /* config.selectAreaLen = inpinfo->xcin_wlen ; ++ if (config.selectAreaLen == 0) ++ config.selectAreaLen = 80 ; */ ++ config.selectAreaLen = 40; ++ // config.maxChiSymbolLen = 22 ; ++ config.maxChiSymbolLen = 16; ++ ++ for(i=0; i<9; i++) ++ config.selKey[i] = i + '1' ; ++ config.selKey[9] = '0' ; ++ SetConfig(pgdata, &config) ; ++ return 0 ; ++} ++ ++static int ++ChewingInit(void *conf, char *objname, xcin_rc_t *xc) ++{ ++ char *cmd[2], kb_type_str[256]; ++ ChewingConf *cf = (ChewingConf *)conf ; ++ ++ char *prefix = "/usr/share/chewing"; ++ ++ cmd[0] = objname ; ++ cmd[1] = "KB_TYPE" ; ++ kb_type_str[0] = '\0' ; ++ get_resource(xc, cmd, kb_type_str, 200, 2) ; ++ cf->kb_type = KBStr2Num(kb_type_str) ; ++ ++ cf->inp_cname = strdup("·s»Ĺµ") ; ++ cf->inp_ename = strdup("Chewing") ; ++ ++ /* Initialize Chewing */ ++ ReadTree(prefix) ; ++ InitChar(prefix) ; ++ InitDict(prefix) ; ++ ReadHash(prefix) ; ++ ++ return True ; ++} ++ ++static int ++ChewingXimInit(void *conf, inpinfo_t *inpinfo) ++{ ++ static char cchBuffer[MAX_PHONE_SEQ_LEN] ; ++ ChewingConf *cf = (ChewingConf *)conf ; ++ int i; ++ ++ inpinfo->iccf = (ChewingData *) calloc(1, sizeof(ChewingData)) ; ++ ++ InitChewing(inpinfo->iccf, cf) ; ++ CallSetConfig(inpinfo, (ChewingData *) inpinfo->iccf) ; ++ ++ inpinfo->lcch = (wch_t *) calloc(MAX_PHONE_SEQ_LEN, sizeof(wch_t)) ; ++ inpinfo->lcch_grouping = (ubyte_t *) calloc(MAX_PHONE_SEQ_LEN, sizeof(ubyte_t) ); ++ inpinfo->cch = cchBuffer ; // 2000.6.30 ++ ++ inpinfo->inp_cname = cf->inp_cname; ++ inpinfo->inp_ename = cf->inp_ename; ++ inpinfo->area3_len = 2 * ZUIN_SIZE + 4; ++ inpinfo->guimode = GUIMOD_LISTCHAR | GUIMOD_SELKEYSPOT; ++ inpinfo->keystroke_len = 0; ++ inpinfo->s_keystroke = (wch_t *) calloc(3 + MAX_PHRASE_LEN, sizeof(wch_t)) ; ++ ++ inpinfo->mcch = (wch_t *) calloc( MAX_CHOICE_BUF, sizeof(wch_t) ); ++ inpinfo->mcch_grouping = (ubyte_t *) calloc( MAX_SELKEY, sizeof(ubyte_t) ); ++ inpinfo->n_mcch = 0; ++ ++ inpinfo->n_lcch = 0; ++ inpinfo->edit_pos = 0; ++ inpinfo->cch_publish.wch = (wchar_t)0; ++ ++ // check_winsize(inpinfo, iccf); ++ // [yet] check winsize is under construction. ++ ++ inpinfo->n_selkey = 10; ++ inpinfo->s_selkey = (wch_t *) calloc( MAX_SELKEY, sizeof(wch_t) ); ++ ++ for (i=0; i<9; i++) { ++ inpinfo->s_selkey[i].wch = (wchar_t)0; ++ inpinfo->s_selkey[i].s[0] = i + '1'; ++ } ++ inpinfo->s_selkey[9].wch = (wchar_t)0; ++ inpinfo->s_selkey[9].s[0] = '0'; ++ ++ return True ; ++} ++ ++void CommitString(inpinfo_t *inpinfo, ChewingOutput *pgo) ++{ ++ int i ; ++ ++ memset(inpinfo->cch, 0, sizeof(wch_t)*MAX_PHONE_SEQ_LEN) ; ++ for(i=0; i<pgo->nCommitStr; i++) ++ strcat(inpinfo->cch, (const char *)pgo->commitStr[i].s) ; ++} ++ ++static unsigned int ++ChewingXimEnd(void *conf, inpinfo_t *inpinfo) ++{ ++ ChewingOutput gOut ; ++ int rtn ; ++ ++ /* if preedit exists, commit the string */ ++ OnKeyEnter(inpinfo->iccf, &gOut) ; ++ ++ rtn = MakeInpinfo(inpinfo, &gOut) ; ++ free(inpinfo->iccf); ++ free(inpinfo->s_keystroke); ++ free(inpinfo->lcch); ++ free(inpinfo->mcch); ++ free(inpinfo->mcch_grouping); ++ ++ inpinfo->iccf = NULL; ++ inpinfo->s_keystroke = NULL; ++ inpinfo->lcch = NULL; ++ ++ // under construction ++ return rtn ; ++} ++ ++void ShowChoose(inpinfo_t *inpinfo, ChoiceInfo *pci, ChewingOutput *pgo) ++{ ++ int i,no,k,len; ++ ++ // for new xcin, there is no need to modify the lcch buffer ++ // instead, we put phrase to choose in mcch ++ no = pci->pageNo * pci->nChoicePerPage; ++ len = 0; ++ ++ for(i=0;i<pci->nChoicePerPage; no++,i++) { ++ ++ // in the last page, no will exceed nTotalChoice ++ if( no >= pci->nTotalChoice ) ++ break; ++ // for each char in the phrase, copy to mcch ++ for(k=0; pci->totalChoiceStr[no][k]!='\0'; k+=2) ++ memcpy(inpinfo->mcch[len++].s, &(pci->totalChoiceStr[no][k]), 2) ; ++ // set grouping to the length of the phrase ++ inpinfo->mcch_grouping[i+1] = k/2; ++ } ++ // i stores how many choices are available ++ inpinfo->mcch_grouping[0] = i; ++ ++ // set pgstate according to pci->pageNo & pci->nPage ++ if( pci->nPage == 1) { ++ inpinfo->mcch_pgstate = MCCH_ONEPG; ++ } ++ else { ++ if( pci->pageNo == 0 ) ++ inpinfo->mcch_pgstate = MCCH_BEGIN; ++ else if( pci->pageNo == pci->nPage - 1) ++ inpinfo->mcch_pgstate = MCCH_END; ++ else ++ inpinfo->mcch_pgstate = MCCH_MIDDLE; ++ } ++ ++ inpinfo->n_mcch = len ; ++} ++ ++void ShowText(inpinfo_t *inpinfo, ChewingOutput *pgo) ++{ ++ memset(inpinfo->lcch, 0, sizeof(wch_t)*MAX_PHONE_SEQ_LEN) ; ++ memcpy(inpinfo->lcch, pgo->chiSymbolBuf, sizeof(wch_t) * pgo->chiSymbolBufLen) ; ++ inpinfo->n_lcch = pgo->chiSymbolBufLen ; ++} ++ ++void ShowInterval(inpinfo_t *inpinfo, ChewingOutput *pgo) ++{ ++ int i, k, begin, len, count, nGroup ; ++ int label[MAX_PHONE_SEQ_LEN] ; ++ ++ if( pgo->chiSymbolBufLen == 0) { ++ inpinfo->lcch_grouping[0] = 0 ; ++ return ; ++ } ++ ++ // set label ++ for(count=0; count<pgo->chiSymbolBufLen; count++) ++ label[count] = count ; ++ ++ for(i=0; i<pgo->nDispInterval; i++) { ++ len = pgo->dispInterval[i].to - pgo->dispInterval[i].from ; ++ ++ if( len > 1) { ++ for(k=pgo->dispInterval[i].from; k<pgo->dispInterval[i].to; k++) ++ label[k] = count ; ++ count++ ; ++ } ++ } ++ ++ // begin to set lcch_grouping by the label ++ nGroup = 0 ; ++ begin = 0 ; ++ for(i=1; i<pgo->chiSymbolBufLen; i++) { ++ if( label[i] != label[begin] ) { ++ inpinfo->lcch_grouping[++nGroup] = ( i - begin ) ; ++ begin = i ; ++ } ++ } ++ inpinfo->lcch_grouping[++nGroup] = ( i - begin ) ; ++ inpinfo->lcch_grouping[0] = nGroup ; ++} ++ ++void ShowStateAndZuin(inpinfo_t *inpinfo, ChewingOutput *pgo) ++{ ++ int i, a , len = 0; ++ memset( inpinfo->s_keystroke, 0, sizeof(wch_t)*(3 + MAX_PHRASE_LEN)) ; ++ if(pgo->bShowMsg) { ++ memcpy( inpinfo->s_keystroke, pgo->showMsg, sizeof(wch_t)*pgo->showMsgLen) ; ++ inpinfo->keystroke_len = pgo->showMsgLen ; ++ } ++ else { ++ if(pgo->bChiSym) ++ strcpy( (char *)inpinfo->s_keystroke[0].s, "¤¤") ; ++ else ++ strcpy( (char *)inpinfo->s_keystroke[0].s, "^") ; ++ ++ inpinfo->s_keystroke[1].s[0] = ' ' ; ++ for(i=0,a=2; i<ZUIN_SIZE; i++) ++ if(pgo->zuinBuf[i].s[0] != '\0') { ++ inpinfo->s_keystroke[a++].wch = pgo->zuinBuf[i].wch ; ++ ++ len; ++ } ++ inpinfo->keystroke_len = len; ++ } ++} ++ ++void SetCursor(inpinfo_t *inpinfo, ChewingOutput *pgo) ++{ ++ inpinfo->edit_pos = pgo->chiSymbolCursor; ++} ++ ++int MakeInpinfo(inpinfo_t *inpinfo, ChewingOutput *pgo) ++{ ++ int rtnValue = 0 ; ++ ++ if(pgo->keystrokeRtn & KEYSTROKE_ABSORB) ++ rtnValue |= IMKEY_ABSORB ; ++ if(pgo->keystrokeRtn & KEYSTROKE_IGNORE) ++ rtnValue |= IMKEY_IGNORE ; ++ if(pgo->keystrokeRtn & KEYSTROKE_BELL) ++ rtnValue |= IMKEY_BELL ; ++ if(pgo->keystrokeRtn & KEYSTROKE_COMMIT) { ++ rtnValue |= IMKEY_COMMIT ; ++ CommitString(inpinfo, pgo) ; ++ } ++ ++ if(pgo->pci->nPage != 0) { // in selection mode ++ ShowChoose(inpinfo,pgo->pci,pgo) ; ++ inpinfo->guimode &= ~GUIMOD_LISTCHAR; ++ } ++ else { // not in selection mode ++ ShowText(inpinfo, pgo) ; ++ ShowInterval(inpinfo, pgo) ; // kpchen 2000.2.9 ++ inpinfo->guimode |= GUIMOD_LISTCHAR; ++ } ++ ShowStateAndZuin(inpinfo, pgo) ; ++ SetCursor(inpinfo, pgo) ; ++ return rtnValue ; ++} ++ ++static unsigned int ++ChewingKeystroke(void *conf, inpinfo_t *inpinfo, keyinfo_t *keyinfo) ++{ ++ KeySym keysym = keyinfo->keysym; ++ ChewingOutput gOut ; ++ int rtn ; ++ static KeySym last_key = 0; ++ ++ // set Chinese / English mode by keystate ++ if( keyinfo->keystate & CAPS_MASK ) { // uppercase ++ SetChiEngMode( inpinfo->iccf, SYMBOL_MODE); ++ } ++ else { // lower case ++ SetChiEngMode( inpinfo->iccf, CHINESE_MODE); ++ } ++ ++ ++ // check no ctrl key was pressed ++ if(keyinfo->keystate >= 0 && !(keyinfo->keystate & CTRL_MASK) ) { ++ switch(keysym) { ++ case XK_Escape: ++ OnKeyEsc(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_Return: ++ OnKeyEnter(inpinfo->iccf, &gOut) ; ++ inpinfo->n_mcch = 0; ++ break ; ++ case XK_Delete: ++ OnKeyDel(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_BackSpace: ++ OnKeyBackspace(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_Up: ++ OnKeyUp(inpinfo->iccf, &gOut); ++ break ; ++ case XK_Down: ++ OnKeyDown(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_Left: ++ OnKeyLeft(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_Right: ++ OnKeyRight(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_Home: ++ OnKeyHome(inpinfo->iccf, &gOut); ++ break; ++ case XK_End: ++ OnKeyEnd(inpinfo->iccf, &gOut); ++ break; ++ ++ case XK_Tab: ++ if( last_key == XK_Tab) // double click TAB ++ OnKeyDblTab(inpinfo->iccf, &gOut); ++ else ++ OnKeyTab(inpinfo->iccf, &gOut) ; ++ break ; ++ case XK_Caps_Lock: ++ OnKeyCapslock(inpinfo->iccf, &gOut) ; ++ break ; ++ default: ++ OnKeyDefault(inpinfo->iccf,keysym,&gOut ) ; ++ break ; ++ } ++ } ++ ++ else if(keyinfo->keystate & CTRL_MASK) { // Ctrl-key Mask ++ // We need to fill the 'gOut' variable for output. ++ if(keysym <= '9' && keysym >= '0') ++ OnKeyCtrlNum(inpinfo->iccf,keysym,&gOut) ; ++ else ++ OnKeyCtrlDefault(inpinfo->iccf,&gOut) ; ++ } ++ ++ ++ last_key = keysym; ++ rtn = MakeInpinfo(inpinfo, &gOut) ; ++ return rtn ; ++} ++ ++static int ++ChewingShowKeystroke(void *conf, simdinfo_t *simdinfo) ++{ ++ simdinfo->s_keystroke = NULL; ++ return False; ++} ++ ++static char zh_chewing_comments[] = ++"This is a very smart phonetic input method module.\n" ++"By Lu-chuan Kung <lckung@iis.sinica.edu.tw> and\n" ++"And Kang-pen Chen <kpchen@iis.sinica.edu.tw>.\n"; ++ ++static char *zh_chewing_valid_objname[] = { "chewing", NULL }; ++ ++module_t module_ptr = { ++ { MTYPE_IM, ++ "zh_chewing", /* name */ ++ MODULE_VERSION, /* version */ ++ zh_chewing_comments }, /* comments */ ++ zh_chewing_valid_objname, /* valid_objname */ ++ sizeof(ChewingConf), /* conf_size */ ++ ChewingInit, /* init */ ++ ChewingXimInit, /* xim_init */ ++ ChewingXimEnd, /* xim_end */ ++ ChewingKeystroke, /* keystroke */ ++ ChewingShowKeystroke, /* show_keystroke */ ++ NULL ++}; ++ +diff -uNrBb xcin.bak/src/include/module.h xcin/src/include/module.h +--- xcin.bak/src/include/module.h 2001-10-16 00:21:14.000000000 +0800 ++++ xcin/src/include/module.h 2004-05-27 19:18:50.000000000 +0800 +@@ -278,7 +278,7 @@ + + /* Quick key phrase: %trigger, %shift, %ctrl, %alt */ + extern void qphrase_init(xcin_rc_t *xrc, char *phrase_fn); +-extern char *qphrase_str(int ch, int class); ++extern char *qphrase_str(int ch, int _class); + extern char *get_qphrase_list(void); + + /* GUI Request registration */ +diff -uNrBb xcin.bak/src/include/xcintool.h xcin/src/include/xcintool.h +--- xcin.bak/src/include/xcintool.h 2001-11-11 20:50:48.000000000 +0800 ++++ xcin/src/include/xcintool.h 2004-05-27 19:18:50.000000000 +0800 +@@ -197,12 +197,14 @@ + }; + + /* XCIN global resources. */ ++#ifndef __USE_GNU + typedef struct { + char *lc_ctype; + char *lc_messages; + char *encoding; + int encid, locid; + } locale_t; ++#endif + + typedef struct { + int argc; /* Command line arguement list */ |