summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Tse <liquidx@gentoo.org>2003-05-25 15:11:27 +0000
committerAlastair Tse <liquidx@gentoo.org>2003-05-25 15:11:27 +0000
commitc67f87674b39b6ed6e225e033897b6edc3831c24 (patch)
treedce1eebcbd67bef5bf841d69a80efa460bf5dfed
parent*** empty log message *** (diff)
downloadgentoo-2-c67f87674b39b6ed6e225e033897b6edc3831c24.tar.gz
gentoo-2-c67f87674b39b6ed6e225e033897b6edc3831c24.tar.bz2
gentoo-2-c67f87674b39b6ed6e225e033897b6edc3831c24.zip
massive chinese input support addition! watch out debian, here we come!
-rw-r--r--app-i18n/chinput/ChangeLog10
-rw-r--r--app-i18n/chinput/Manifest3
-rw-r--r--app-i18n/chinput/chinput-3.0.2.ebuild39
-rw-r--r--app-i18n/chinput/files/chinput-3.0.2-config.patch262
-rw-r--r--app-i18n/chinput/files/chinput-3.0.2-debian.patch2127
-rw-r--r--app-i18n/chinput/files/digest-chinput-3.0.21
-rw-r--r--app-i18n/fcitx/ChangeLog9
-rw-r--r--app-i18n/fcitx/Manifest3
-rw-r--r--app-i18n/fcitx/fcitx-1.8.5.ebuild35
-rw-r--r--app-i18n/fcitx/files/digest-fcitx-1.8.51
-rw-r--r--app-i18n/jmcce/ChangeLog9
-rw-r--r--app-i18n/jmcce/Manifest3
-rw-r--r--app-i18n/jmcce/files/digest-jmcce-1.4_rc21
-rw-r--r--app-i18n/jmcce/jmcce-1.4_rc2.ebuild39
-rw-r--r--app-i18n/scim-chinese/ChangeLog10
-rw-r--r--app-i18n/scim-chinese/Manifest3
-rw-r--r--app-i18n/scim-chinese/files/digest-scim-chinese-0.2.11
-rw-r--r--app-i18n/scim-chinese/scim-chinese-0.2.1.ebuild66
-rw-r--r--app-i18n/scim-tables/ChangeLog9
-rw-r--r--app-i18n/scim-tables/Manifest3
-rw-r--r--app-i18n/scim-tables/files/digest-scim-tables-0.2.11
-rw-r--r--app-i18n/scim-tables/scim-tables-0.2.1.ebuild27
-rw-r--r--app-i18n/scim/ChangeLog9
-rw-r--r--app-i18n/scim/Manifest3
-rw-r--r--app-i18n/scim/files/digest-scim-0.4.11
-rw-r--r--app-i18n/scim/scim-0.4.1.ebuild45
-rw-r--r--app-i18n/unicon/ChangeLog10
-rw-r--r--app-i18n/unicon/Manifest3
-rw-r--r--app-i18n/unicon/files/digest-unicon-3.0.41
-rw-r--r--app-i18n/unicon/files/unicon-3.0.4-debian.patch2087
-rw-r--r--app-i18n/unicon/files/unicon-3.0.4-gentoo.patch11
-rw-r--r--app-i18n/unicon/unicon-3.0.4.ebuild63
32 files changed, 4888 insertions, 7 deletions
diff --git a/app-i18n/chinput/ChangeLog b/app-i18n/chinput/ChangeLog
new file mode 100644
index 000000000000..a36ec8f7123f
--- /dev/null
+++ b/app-i18n/chinput/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for app-i18n/chinput
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/chinput/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*chinput-3.0.2 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> chinput-3.0.2.ebuild,
+ files/chinput-3.0.2-config.patch, files/chinput-3.0.2-debian.patch:
+ New ebuild. Another good Chinese Input method.
+
diff --git a/app-i18n/chinput/Manifest b/app-i18n/chinput/Manifest
index 6bbf6e97e1ba..0e89551b29ef 100644
--- a/app-i18n/chinput/Manifest
+++ b/app-i18n/chinput/Manifest
@@ -1,4 +1,5 @@
-MD5 c6b9dd17b881f54c2c8934c87273a9dd chinput-3.0.2.ebuild 904
+MD5 b9536805959a4156d6fcb8bb175f9a5f chinput-3.0.2.ebuild 1005
+MD5 4e66b2def8f29400b876f40422cfe470 ChangeLog 436
MD5 9239c39d87007f8cb4a73d77ac7a9ce1 files/chinput-3.0.2-debian.patch 64253
MD5 b35379e04831139b1dbd5e52205d376e files/chinput-3.0.2-config.patch 6521
MD5 815b166e6003978bbc45c37273612c21 files/digest-chinput-3.0.2 65
diff --git a/app-i18n/chinput/chinput-3.0.2.ebuild b/app-i18n/chinput/chinput-3.0.2.ebuild
new file mode 100644
index 000000000000..32e3e0fc47f3
--- /dev/null
+++ b/app-i18n/chinput/chinput-3.0.2.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/chinput/chinput-3.0.2.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+MY_P=${P/chinput/Chinput}
+DESCRIPTION="Featureful Chinese Input Method XIM Server"
+HOMEPAGE="http://www.opencjk.org/~yumj/project-chinput-e.html"
+SRC_URI="http://www.opencjk.org/~yumj/download/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+DEPEND="app-i18n/unicon
+ >=dev-libs/pth-1.2
+ >=media-libs/imlib-1.9"
+
+S=${WORKDIR}/${MY_P}
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ einfo "Applying chinput-3.0.2-config.patch"
+ patch -p1 < ${FILESDIR}/chinput-3.0.2-config.patch
+ # from debian unstable chinput_3.0.2-9
+ einfo "Applying chinput-3.0.2-debian.patch"
+ patch -p1 < ${FILESDIR}/chinput-3.0.2-debian.patch
+}
+
+src_compile() {
+ emake || die "make failed"
+}
+
+src_install() {
+ dodir /etc
+ make prefix=${D}/usr etc_prefix=${D}/etc install
+ cd ${S}; dodoc doc/*
+}
diff --git a/app-i18n/chinput/files/chinput-3.0.2-config.patch b/app-i18n/chinput/files/chinput-3.0.2-config.patch
new file mode 100644
index 000000000000..4d021314d96a
--- /dev/null
+++ b/app-i18n/chinput/files/chinput-3.0.2-config.patch
@@ -0,0 +1,262 @@
+--- chinput-3.0.2/resource/Chinput.ad
++++ chinput-3.0.2/resource/Chinput.ad
+@@ -25,10 +25,10 @@
+ ! locales
+ !
+
+-chinput.gblocale = zh_CN
+-chinput.gbklocale = zh_CN.gbk
+-chinput.gb18030locale = zh_CN.gb18030
+-chinput.big5locale = zh_TW.big5
++chinput.gblocale = zh_CN.gb2312
++chinput.gbklocale = zh_CN.GBK
++chinput.gb18030locale = zh_CN.GB18030
++chinput.big5locale = zh_TW.Big5
+
+ !
+ ! input style: AUTO, ROOT, OVERSPOT, ONSPOT, OFFSPOT
+@@ -57,15 +57,21 @@
+ ! for big5: PY, ETZY, ZOZY, Simplex, CangJie,
+ ! English, 4Corner, HSU, ARRAY30, Boshiamy
+ !
+-chinput.dictionary = /usr/lib/unicon2
++chinput.dictionary = /usr/lib/unicon/modules/
+ chinput.inputmethod.gb = ZNPY
+ chinput.inputmethod.big5 = PY
++
++! Default setting for CHINESE/WESTERN punctuation marks.
++chinput.punct = WESTERN
++
+ !
+ ! 16 point font set
+ !
+ chinput.font = 8x16
+-chinput.gbfont = -*-song-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0
+-chinput.big5font = -*-song-medium-r-normal--16-*-*-*-*-*-big5-0
++!chinput.gbfont = -default-song-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0
++!chinput.big5font = -default-ming-medium-r-normal--16-*-*-*-*-*-big5-0
++chinput.gbfont = -*-*-*-*-*--16-*-*-*-*-*-gb2312.1980-0
++chinput.big5font = -*-*-*-*-*--16-*-*-*-*-*-big5-0
+ !
+ !
+ ! inputbar width in chars
+@@ -103,175 +109,175 @@
+ IMENAME = ÖÇÄÜÆ´Òô
+ IMENAME = ´¼¯à«÷­µ
+ ENCODING = GB
+-FILE = freepy
+-MODULE = /usr/lib/unicon2/cce_pinyin.so
++FILE = cce/dict
++MODULE = /usr/lib/unicon/modules/cce/cce_pinyin.so
+ FAVORITE = YES
+
+ [PY]
+ IMENAME = GBKÆ´Òô
+ IMENAME = µL½Õ«÷­µ
+ ENCODING = GB
+-FILE = gbk/gbkpy_mb.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gbk/gbkpy_mb.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [TONEPY]
+ IMENAME = ´øµ÷Æ´Òô
+ IMENAME = ±a½Õ«÷­µ
+ ENCODING = GB
+-FILE = gb/TONEPY.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/TONEPY.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [CCDOSPY]
+ IMENAME = ËõдƴÒô
+ IMENAME = ÁY¼g«÷­µ
+ ENCODING = GB
+-FILE = gb/CCDOSPY.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/CCDOSPY.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [WuBi]
+ IMENAME = Îå±Ê×ÖÐÍ
+ IMENAME = ¤­µ§¦r«¬
+ ENCODING = GB
+-FILE = gb/WuBi.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = cce/dict/wubi.tab
++MODULE = /usr/lib/unicon/modules/cce/cce_hzinput.so
+ FAVORITE = YES
+
+ [CangJie]
+ IMENAME = ²Ôò¡ÊäÈë
+ IMENAME = »a¾e¿é¤J
+ ENCODING = GB
+-FILE = gb/CangJie.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/CangJie.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [English]
+ IMENAME = Ó¢ººÊäÈë
+ IMENAME = ­^º~¿é¤J
+ ENCODING = GB
+-FILE = gb/English.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/English.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [CTLau]
+ IMENAME = ÁõÊÏÔÁÒô
+ IMENAME = ¼B¤ó¸f­µ
+ ENCODING = GB
+-FILE = gb/CTLau.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/CTLau.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [SW]
+ IMENAME = Ê×βÂë
+ IMENAME = ­º§À½X
+ ENCODING = GB
+-FILE = gb/SW.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/SW.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [QianMa]
+ IMENAME = Ç®ÂëÊäÈë
+ IMENAME = ¿ú½X¿é¤J
+ ENCODING = GB
+-FILE = gb/QianMa.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/QianMa.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [ZRM]
+ IMENAME = ×ÔÈ»Âë
+ IMENAME = ¦ÛµM½X
+ ENCODING = GB
+-FILE = gb/zrm-2.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/zrm-2.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [MGM]
+ IMENAME = Âë¸ùÂë
+ IMENAME = ½X®Ú½X
+ ENCODING = GB
+-FILE = gb/mgm.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/gb/mgm.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = NO
+
+ [PY]
+ IMENAME = Æ´ÒôÊäÈë
+ IMENAME = «÷­µ¿é¤J
+ ENCODING = BIG5
+-FILE = big5/pinyin.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/pinyin.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [ETZY]
+ IMENAME = ÒÐÌì×¢Òô
+ IMENAME = ­Ê¤Ñª`­µ
+ ENCODING = BIG5
+-FILE = big5/ETZY.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/ETZY.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [ZOZY]
+ IMENAME = ÁãÒ»×¢Òô
+ IMENAME = ¹s¤@ª`­µ
+ ENCODING = BIG5
+-FILE = big5/ZOZY.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/ZOZY.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [Simplex]
+ IMENAME = ¼òÒ×ÊäÈë
+ IMENAME = ²©ö¿é¤J
+ ENCODING = BIG5
+-FILE = big5/simplex.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/simplex.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = NO
+
+ [CangJie]
+ IMENAME = ²Öò¡ÊäÈë
+ IMENAME = ­Ü¾e¿é¤J
+ ENCODING = BIG5
+-FILE = big5/cj.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/cj.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [English]
+ IMENAME = Ó¢ººÊäÈë
+ IMENAME = ­^º~¿é¤J
+ ENCODING = BIG5
+-FILE = big5/English.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/English.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = NO
+
+ [4Corner]
+ IMENAME = ËĽǺÅÂë
+ IMENAME = ¥|¨¤¸¹½X
+ ENCODING = BIG5
+-FILE = big5/4Corner.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/4Corner.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = NO
+
+ [HSU]
+ IMENAME = ÐíÊÏÔÁÒô
+ IMENAME = ³\¤ó¸f­µ
+ ENCODING = BIG5
+-FILE = big5/HSU.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/HSU.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = NO
+
+ [ARRAY30]
+ IMENAME = ÐÐÁУ³£°
+ IMENAME = ¦æ¦C¢²¢¯
+ ENCODING = BIG5
+-FILE = big5/array30.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/array30.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
+ [Boshiamy]
+ IMENAME = ÎÞϺÃ×
+ IMENAME = µL½¼¦Ì
+ ENCODING = BIG5
+-FILE = big5/Boshiamy.tab
+-MODULE = /usr/lib/unicon2/TL_hzinput.so
++FILE = turbo/dict/big5/Boshiamy.tab
++MODULE = /usr/lib/unicon/modules/turbo/TL_hzinput.so
+ FAVORITE = YES
+
diff --git a/app-i18n/chinput/files/chinput-3.0.2-debian.patch b/app-i18n/chinput/files/chinput-3.0.2-debian.patch
new file mode 100644
index 000000000000..a41b1dc29692
--- /dev/null
+++ b/app-i18n/chinput/files/chinput-3.0.2-debian.patch
@@ -0,0 +1,2127 @@
+--- chinput-3.0.2.orig/resource/Makefile
++++ chinput-3.0.2/resource/Makefile
+@@ -3,5 +3,5 @@
+ all:
+
+ install:
+- mkdir -p $(prefix)/lib/ZWinPro
+- cp -f Chinput.ad $(prefix)/lib/ZWinPro/Chinput.ad
++ mkdir -p $(prefix)/share/chinput
++ cp -f Chinput.ad $(etc_prefix)/Chinput.ad
+--- chinput-3.0.2.orig/src/Makefile
++++ chinput-3.0.2/src/Makefile
+@@ -11,11 +11,11 @@
+ LIBIMLIB = -lImlib
+
+ #CFLAGS = -Wall -g -DFOR_PILOT_COMPAT -O2 -fno-strength-reduce -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE=500L -D_BSD_SOURCE -D_SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO
+-CFLAGS = -Wall -g -DFOR_PILOT_COMPAT -O2 -fno-strength-reduce
++CFLAGS = -Wall -DFOR_PILOT_COMPAT -O2 -fno-strength-reduce
+
+ INC = -I./include -I./IMdkit/include -I/usr/include -I/usr/X11R6/include
+
+-LIB = -L/usr/X11R6/lib -lXext -lX11 ./IMdkit/lib/libXimd.a -L/usr/lib/unicon2 -limmclient -Wl,-rpath=/usr/lib/unicon2 -limm_server -lpth -ldl
++LIB = -L/usr/X11R6/lib -lXext -lX11 ./IMdkit/lib/libXimd.a -L/usr/lib/unicon -limmclient -Wl,-rpath=/usr/lib/unicon -limm_server -lpth -ldl
+
+ SRC = chinput.c init.c server.c config.c color.c util.c convert.c IC.c XIM.c focus.c root.c overspot.c onspot.c offspot.c voice.c keyboard.c handw.c hwengine.c loop.c
+
+--- chinput-3.0.2.orig/src/color.c
++++ chinput-3.0.2/src/color.c
+@@ -215,7 +215,7 @@
+ /* Access font */
+ if ((*font_info = XLoadQueryFont(display,fontname)) == NULL)
+ {
+- (void) fprintf( stderr, "Basic: Cannot open font %s\\n",
++ (void) fprintf( stderr, "Basic: Cannot open font %s\n",
+ fontname);
+ exit( -1 );
+ }
+--- chinput-3.0.2.orig/src/config.c
++++ chinput-3.0.2/src/config.c
+@@ -222,6 +222,7 @@
+ }
+ if(HZServer.hzVKwin.onflag)
+ XMapRaised(display, window3);
++
+ }
+
+ void proc_hide_window()
+@@ -251,6 +252,8 @@
+ }
+ if(HZServer.hzVKwin.onflag)
+ XUnmapWindow(display, window3);
++ if(!strcmp(chinputime[cur_inputmethod].name,"ZNPY"))
++ IMM_FlushUserPhrase(chinput_imm);
+ }
+
+ void HZprocToggleWindow(void)
+--- chinput-3.0.2.orig/src/hwengine.c
++++ chinput-3.0.2/src/hwengine.c
+@@ -58,10 +58,10 @@
+
+ if(getenv("LC_ALL") && strstr(getenv("LC_ALL"), "zh_TW"))
+ execlp ("kpengine","/usr/bin/kpengine",
+- "/usr/lib/ZWinPro/hzbig5.dat", NULL);
++ "/usr/share/chinput/hzbig5.dat", NULL);
+ else
+ execlp ("kpengine","/usr/bin/kpengine",
+- "/usr/lib/ZWinPro/hzgb.dat", NULL);
++ "/usr/share/chinput/hzgb.dat", NULL);
+ } else if (engine_pid < (pid_t) 0) /* failure */
+ fprintf(stderr, "Fork failed.\n");
+
+--- chinput-3.0.2.orig/src/init.c
++++ chinput-3.0.2/src/init.c
+@@ -19,7 +19,7 @@
+ */
+
+ #include "all.h"
+-
++#include "config.h"
+ #ifdef IMLIB
+ #include "icons/chinput.xpm"
+ #include "icons/123.xpm"
+@@ -103,6 +103,7 @@
+ char fontname[256];
+
+ //create font set
++/*
+ if(strcmp(setlocale(LC_ALL, gb18030locale), gb18030locale) ||
+ !XSupportsLocale()){
+ if(strcmp(setlocale(LC_ALL, gbklocale), gbklocale) ||
+@@ -114,6 +115,8 @@
+ }
+ }
+ }
++*/
++ setlocale(LC_ALL, gblocale);
+ sprintf(fontname, "%s,%s", font_latin, font_gb);
+ if((fontset_gb = XCreateFontSet(display, fontname,
+ &missing_list, &missing_count, &def_string)) == NULL) {
+@@ -394,7 +397,7 @@
+ }
+
+ flag_corner = False; //half
+- flag_punct = False; //chinese punctuation
++ flag_punct = False; //english punctuation
+ flag_lock = LOCK_NONE; //encoding not locked
+ flag_ec = True; //chinese output
+ flag_english = False; //no english
+@@ -407,7 +410,7 @@
+ hmode = HZSERVER_HMODE_NO;
+ strcpy(input_method_gb, "ZNPY");
+ strcpy(input_method_big5, "PY");
+- strcpy(dict_path, "/usr/dict");
++ strcpy(dict_path, IMDIR);
+ cur_inputmethod = 0;
+ flag_showime = True;
+ flag_automode = True;
+@@ -465,7 +468,7 @@
+
+ // system ad file
+ if(fp == NULL){
+- if((fp = fopen("/usr/lib/ZWinPro/Chinput.ad", "r")) == NULL){
++ if((fp = fopen(RESOURCEFILE, "r")) == NULL){
+ printf("chinput: Chinput.ad not found.\n");
+ exit(1);
+ }
+@@ -522,11 +525,11 @@
+ flag_client = HZSERVER_AREAMODE_SERVER;
+ } else if(!mystrcmp(line, "chinput.dictionary")){
+ strcpy(dict_path, get_value(line));
+- } else if(!mystrcmp(line, "chinput.showime")){
+- if(!strcmp(get_value(line), "YES"))
+- flag_showime = 1;
+- else
+- flag_showime = 0;
++ } else if(!mystrcmp(line, "chinput.punct")){
++ if(!strcasecmp(get_value(line), "CHINESE"))
++ flag_punct = True;
++ else if(!strcasecmp(get_value(line), "WESTERN"))
++ flag_punct = False;
+ } else if(!mystrcmp(line, "chinput.font")){
+ strcpy(font_latin, get_value(line));
+ } else if(!mystrcmp(line, "chinput.gbfont")){
+@@ -563,7 +566,9 @@
+ Boolean file_exist(char *fname)
+ {
+ char name[256];
+- if(!strcmp(fname, "gb")) return True; //ZNPY
++// if(!strcmp(fname, "gb")) return True; //ZNPY
++ if((!strcmp(fname,"gb"))||(strstr(fname,"pyinput"))
++ ||(!strcmp(fname,"cce"))) return True; //ZNPY
+ sprintf(name, "%s/%s", dict_path, fname);
+
+ if(access(name, F_OK) == 0) return True;
+@@ -582,7 +587,7 @@
+ sprintf(fname, "%s/.chinput", getenv("HOME"));
+ fp = fopen(fname, "r");
+ if(!fp){
+- fp = fopen("/usr/lib/ZWinPro/Chinput.ad", "r");
++ fp = fopen("/etc/Chinput.ad", "r");
+ if(!fp) {
+ printf("Cannot open resource file Chinput.ad\n");
+ exit(1);
+--- chinput-3.0.2.orig/src/offspot.c
++++ chinput-3.0.2/src/offspot.c
+@@ -244,7 +244,7 @@
+ if(flag_corner) strcat(buf, "¡¾È«");
+ else strcat(buf, "¡¾°ë");
+ if(flag_punct) strcat(buf, "£ï¡¿");
+- else strcat(buf, "¡¤¡¿");
++ else strcat(buf, " .¡¿");
+ strcat(buf, chinputime[cur_inputmethod].namegb);
+ strcat(buf, ": ");
+ } else {
+--- chinput-3.0.2.orig/src/onspot.c
++++ chinput-3.0.2/src/onspot.c
+@@ -255,7 +255,7 @@
+ if(flag_corner) strcat(tmp, "¡¾È«");
+ else strcat(tmp, "¡¾°ë");
+ if(flag_punct) strcat(tmp, "£ï¡¿");
+- else strcat(tmp, "¡¤¡¿");
++ else strcat(tmp, " .¡¿");
+ strcat(tmp, chinputime[cur_inputmethod].namegb);
+
+ //if popup candidate window, then we need not put selection on
+--- chinput-3.0.2.orig/src/overspot.c
++++ chinput-3.0.2/src/overspot.c
+@@ -460,6 +460,7 @@
+ if(flag_found)HZoverspotDrawCandidateButton();
+ }
+
++
+ void HZoverspotResizeStatusWindow(IC *ic)
+ {
+ Window win = (Window)0;
+@@ -583,7 +584,7 @@
+ if(flag_corner) strcat(buf, "¡¾È«");
+ else strcat(buf, "¡¾°ë");
+ if(flag_punct) strcat(buf, "£ï¡¿");
+- else strcat(buf, "¡¤¡¿");
++ else strcat(buf, " .¡¿");
+ strcat(buf, chinputime[cur_inputmethod].namegb);
+ } else {
+ if(flag_corner) strcat(buf, "¡i¥þ");
+@@ -666,7 +667,7 @@
+ if(flag_corner) strcat(buf, "¡¾È«");
+ else strcat(buf, "¡¾°ë");
+ if(flag_punct) strcat(buf, "£ï¡¿");
+- else strcat(buf, "¡¤¡¿");
++ else strcat(buf, " .¡¿");
+ strcat(buf, chinputime[cur_inputmethod].namegb);
+ } else {
+ strcpy(buf, "");
+@@ -700,7 +701,7 @@
+
+ //auxiliary window flush
+ HZoverspotCandidateFlush();
+-
++
+ //status window flush, this function only happens if
+ //the client use XIMPreeditPosition|XIMStatusArea style
+ HZoverspotStatusFlush();
+--- chinput-3.0.2.orig/src/root.c
++++ chinput-3.0.2/src/root.c
+@@ -123,7 +123,7 @@
+ status_button gb_sbutton[] = {
+ {XOFF, YOFF, True, "ÖÐ", "Ó¢"},
+ {XOFF+18, YOFF, False, "°ë", "È«"},
+- {XOFF+36, YOFF, False, "£ï" "¡¤"},
++ {XOFF+36, YOFF, False, "£ï" " ."},
+ {XOFF+54, YOFF, True, "¼ò", "·±"}
+ };
+
+@@ -269,7 +269,7 @@
+ HZServer.encoding == HZSERVER_ENCODING_GBK ||
+ HZServer.encoding == HZSERVER_ENCODING_GB18030)
+ draw_button_label(dpy, win, panelgc,
+- p_x1, p_y1, p_x2, p_y2, offset, "¡¤", 2);
++ p_x1, p_y1, p_x2, p_y2, offset, " .", 2);
+ else if(HZServer.encoding == HZSERVER_ENCODING_BIG5)
+ draw_button_label(dpy, win, panelgc,
+ p_x1, p_y1, p_x2, p_y2, offset, "¡O", 2);
+@@ -484,7 +484,7 @@
+ HZServer.encoding == HZSERVER_ENCODING_GBK ||
+ HZServer.encoding == HZSERVER_ENCODING_GB18030)
+ draw_button_label(dpy, win, panelgc,
+- p_x1, p_y1, p_x2, p_y2, offset, "¡¤", 2);
++ p_x1, p_y1, p_x2, p_y2, offset, " .", 2);
+ else if(HZServer.encoding == HZSERVER_ENCODING_BIG5)
+ draw_button_label(dpy, win, panelgc,
+ p_x1, p_y1, p_x2, p_y2, offset, "¡O", 2);
+@@ -518,7 +518,7 @@
+ HZServer.encoding == HZSERVER_ENCODING_GBK ||
+ HZServer.encoding == HZSERVER_ENCODING_GB18030)
+ draw_button_label(dpy, win, panelgc,
+- p_x1, p_y1, p_x2, p_y2, offset, "¡¤", 2);
++ p_x1, p_y1, p_x2, p_y2, offset, " .", 2);
+ else if(HZServer.encoding == HZSERVER_ENCODING_BIG5)
+ draw_button_label(dpy, win, panelgc,
+ p_x1, p_y1, p_x2, p_y2, offset, "¡O", 2);
+--- chinput-3.0.2.orig/src/util.c
++++ chinput-3.0.2/src/util.c
+@@ -271,7 +271,7 @@
+ case '.': return(XK_period);
+ case '\b': return(XK_BackSpace);
+ case '\t': return(XK_Tab);
+- case '\n': return(XK_Return);
++// case '\n': return(XK_Return);
+ default: return((KeySym)i);
+ } /* End switch */
+ /* I have no idea, so we'll just cast it and hope we're right. :) */
+--- chinput-3.0.2.orig/src/IMdkit/include/Xi18n.h
++++ chinput-3.0.2/src/IMdkit/include/Xi18n.h
+@@ -318,7 +318,7 @@
+ int minor_code;
+ CARD16 connect_id;
+ CARD16 icid;
+- CARD32 flag;
++ CARD32 filter_event_mask;
+ CARD32 intercept_event_mask;
+ CARD32 select_event_mask;
+ CARD32 forward_event_mask;
+@@ -400,6 +400,14 @@
+ XIMStringConversionCallbackStruct strconv;
+ } IMStrConvCBStruct;
+
++typedef struct
++{
++ int major_code;
++ int minor_code;
++ CARD16 connect_id;
++ CARD16 icid;
++} IMSyncXlibStruct;
++
+ typedef union _IMProtocol
+ {
+ int major_code;
+@@ -427,6 +435,7 @@
+ IMPreeditCBStruct preedit_callback;
+ IMStatusCBStruct status_callback;
+ IMStrConvCBStruct strconv_callback;
++ IMSyncXlibStruct sync_xlib;
+ long pad[32];
+ } IMProtocol;
+
+--- chinput-3.0.2.orig/src/IMdkit/include/IMdkit.h
++++ chinput-3.0.2/src/IMdkit/include/IMdkit.h
+@@ -97,11 +97,12 @@
+ Status (*closeIM) (XIMS);
+ char* (*setIMValues) (XIMS, XIMArg *);
+ char* (*getIMValues) (XIMS, XIMArg *);
+- Status (*forwardEvent) (XIMS, ...);
+- Status (*commitString) (XIMS, ...);
+- int (*callCallback) (XIMS, ...);
+- int (*preeditStart) (XIMS, ...);
+- int (*preeditEnd) (XIMS, ...);
++ Status (*forwardEvent) (XIMS, XPointer);
++ Status (*commitString) (XIMS, XPointer);
++ int (*callCallback) (XIMS, XPointer);
++ int (*preeditStart) (XIMS, XPointer);
++ int (*preeditEnd) (XIMS, XPointer);
++ int (*syncXlib) (XIMS, XPointer);
+ } IMMethodsRec, *IMMethods;
+
+ typedef struct
+@@ -114,6 +115,7 @@
+ {
+ IMMethods methods;
+ IMCoreRec core;
++ Bool sync;
+ void *protocol;
+ } XIMProtocolRec;
+
+@@ -129,5 +131,6 @@
+ int IMCallCallback (XIMS, XPointer);
+ int IMPreeditStart (XIMS, XPointer);
+ int IMPreeditEnd (XIMS, XPointer);
++int IMSyncXlib (XIMS, XPointer);
+
+ #endif /* IMdkit_h */
+--- chinput-3.0.2.orig/src/IMdkit/lib/FrameMgr.c
++++ chinput-3.0.2/src/IMdkit/lib/FrameMgr.c
+@@ -314,6 +314,8 @@
+ fm->idx += 8;
+ break;
+ #endif
++ default:
++ break;
+ }
+ /*endswitch*/
+ _FrameMgrPutToken(fm, data, data_size);
+@@ -465,6 +467,8 @@
+
+ case EOL:
+ return FmEOD;
++ default:
++ break;
+ }
+ /*endswitch*/
+ return (FmStatus) NULL; /* Should never be reached */
+@@ -484,7 +488,7 @@
+
+ if (type & COUNTER_MASK)
+ {
+- int end;
++ int end=0;
+ FrameIter client_data;
+
+ type &= ~COUNTER_MASK;
+@@ -507,6 +511,8 @@
+ end = Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
+ break;
+ #endif
++ default:
++ break;
+ }
+ /*endswitch*/
+
+@@ -685,6 +691,8 @@
+
+ case EOL:
+ return FmEOD;
++ default:
++ break;
+ }
+ /*endswitch*/
+ return (FmStatus) NULL; /* Should never be reached */
+@@ -779,6 +787,8 @@
+
+ case EOL:
+ return FmEOD;
++ default:
++ break;
+ }
+ /*endswitch*/
+ }
+@@ -909,8 +919,8 @@
+ register int offset, iter_idx;
+
+ info->counter.is_byte_len =
+- (((int) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
+- offset = ((int) fi->template[fi->cur_no].data) >> 8;
++ (((long) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
++ offset = ((long) fi->template[fi->cur_no].data) >> 8;
+ iter_idx = fi->cur_no + offset;
+ if (fi->template[iter_idx].type == ITER)
+ {
+@@ -958,8 +968,8 @@
+ register int size;
+ register int i;
+
+- unit = _UNIT ((int) fi->template[fi->cur_no].data);
+- number = _NUMBER ((int) fi->template[fi->cur_no].data);
++ unit = _UNIT ((long) fi->template[fi->cur_no].data);
++ number = _NUMBER ((long) fi->template[fi->cur_no].data);
+
+ i = fi->cur_no;
+ size = 0;
+@@ -1028,6 +1038,8 @@
+ /*endif*/
+ }
+ break;
++ default:
++ break;
+ }
+ /*endswitch*/
+ return ret_type;
+@@ -1058,8 +1070,8 @@
+ register int iter_idx;
+
+ info->counter.is_byte_len =
+- (((int) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
+- offset = ((int)fi->template[fi->cur_no].data) >> 8;
++ (((long) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
++ offset = ((long)fi->template[fi->cur_no].data) >> 8;
+ iter_idx = fi->cur_no + offset;
+ if (fi->template[iter_idx].type == ITER)
+ {
+@@ -1101,12 +1113,12 @@
+ if (info)
+ {
+ register int unit;
+- register number;
+- register size;
+- register i;
++ register int number;
++ register int size;
++ register int i;
+
+- unit = _UNIT ((int) fi->template[fi->cur_no].data);
+- number = _NUMBER ((int) fi->template[fi->cur_no].data);
++ unit = _UNIT ((long) fi->template[fi->cur_no].data);
++ number = _NUMBER ((long) fi->template[fi->cur_no].data);
+
+ i = fi->cur_no;
+ size = 0;
+@@ -1161,6 +1173,8 @@
+ else
+ ret_type = sub_type;
+ /*endif*/
++ default:
++ break;
+ }
+ break;
+ }
+@@ -1325,6 +1339,8 @@
+ return FmSuccess;
+ /*endif*/
+ break;
++ default:
++ break;
+ }
+ /*endswitch*/
+ i = _FrameInstIncrement(fi->template, i);
+@@ -1377,6 +1393,8 @@
+ return ret_size;
+ /*endif*/
+ break;
++ default:
++ break;
+ }
+ /*endswitch*/
+ i = _FrameInstIncrement (fi->template, i);
+@@ -1421,6 +1439,9 @@
+ return FmSuccess;
+ /*endif*/
+ break;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ i = _FrameInstIncrement (fi->template, i);
+@@ -1561,6 +1582,9 @@
+ ChainMgrFree (&it->cm);
+ }
+ break;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ Xfree (it);
+@@ -1712,6 +1736,9 @@
+ /*endif*/
+ return ret_type;
+ }
++
++ default:
++ return (XimFrameType) NULL;
+ }
+ /*endswitch*/
+ return (XimFrameType) NULL; /* This should never occur */
+@@ -1786,6 +1813,9 @@
+ /*endif*/
+ return (ret_type);
+ }
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ /* Reaching here is a bug! */
+@@ -1906,6 +1936,9 @@
+ /*endif*/
+ }
+ return FmNoMoreData;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ return FmNoMoreData;
+@@ -1966,6 +1999,9 @@
+ }
+ /*endfor*/
+ return NO_VALID_FIELD;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ return NO_VALID_FIELD;
+@@ -2051,6 +2087,9 @@
+ }
+ /*endif*/
+ break;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ return FmNoMoreData;
+@@ -2143,6 +2182,9 @@
+ }
+ /*endfor*/
+ break;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ return size;
+@@ -2171,6 +2213,9 @@
+ /*endwhile*/
+ ChainIterFree (&ci);
+ break;
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ it->cur_no = 0;
+@@ -2260,6 +2305,8 @@
+
+ case ITER:
+ return _FrameInstIncrement (frame, count + 1);
++ default:
++ break;
+ }
+ /*endswitch*/
+ return - 1; /* Error */
+@@ -2304,6 +2351,8 @@
+ }
+ /*endwhile*/
+ return 0;
++ default:
++ break;
+ }
+ /*enswitch*/
+ return - 1; /* Error */
+@@ -2350,8 +2399,8 @@
+ register int size;
+ register int i;
+
+- unit = _UNIT ((int) fi->template[cur_no].data);
+- number = _NUMBER ((int) fi->template[cur_no].data);
++ unit = _UNIT ((long) fi->template[cur_no].data);
++ number = _NUMBER ((long) fi->template[cur_no].data);
+
+ i = cur_no;
+ size = 0;
+@@ -2395,6 +2444,9 @@
+ /*endif*/
+ return sub_size;
+ }
++
++ default:
++ break;
+ }
+ /*endswitch*/
+ return NO_VALUE;
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nAttr.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nAttr.c
+@@ -30,8 +30,10 @@
+ ******************************************************************/
+
+ #include <X11/Xlib.h>
++#include <X11/Xresource.h>
+ #include "IMdkit.h"
+ #include "Xi18n.h"
++#include "XimFunc.h"
+
+ typedef struct
+ {
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nClbk.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nClbk.c
+@@ -33,6 +33,7 @@
+ #include "IMdkit.h"
+ #include "Xi18n.h"
+ #include "FrameMgr.h"
++#include "XimFunc.h"
+
+ int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data)
+ {
+@@ -168,14 +169,10 @@
+ FrameMgrPutToken (fm, preedit_CB->icid);
+ FrameMgrPutToken (fm, draw->caret);
+ FrameMgrPutToken (fm, draw->chg_first);
+-FrameMgrPutToken(fm, draw->chg_length);
++ FrameMgrPutToken (fm, draw->chg_length);
+ FrameMgrPutToken (fm, status);
+-FrameMgrPutToken(fm, draw->text->length);
+-if( draw->text->length )
++ FrameMgrPutToken (fm, draw->text->length);
+ FrameMgrPutToken (fm, draw->text->string);
+-FrameMgrPutToken(fm, feedback_count);
+-
+-
+ for (i = 0; i < feedback_count; i++)
+ FrameMgrPutToken (fm, draw->text->feedback[i]);
+ /*endfor*/
+@@ -325,10 +322,10 @@
+ int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data)
+ {
+ Xi18n i18n_core = ims->protocol;
+- FrameMgr fm;
++ FrameMgr fm = (FrameMgr)0;
+ extern XimFrameRec status_draw_text_fr[];
+ extern XimFrameRec status_draw_bitmap_fr[];
+- register int total_size;
++ register int total_size = 0;
+ unsigned char *reply = NULL;
+ IMStatusCBStruct *status_CB =
+ (IMStatusCBStruct *) &call_data->status_callback;
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nIc.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nIc.c
+@@ -33,6 +33,7 @@
+ #include "IMdkit.h"
+ #include "Xi18n.h"
+ #include "FrameMgr.h"
++#include "XimFunc.h"
+
+ #define IC_SIZE 64
+
+@@ -104,6 +105,7 @@
+ return;
+ /*endif*/
+ FrameMgrGetToken (fm, base_name);
++ FrameMgrFree(fm);
+ strncpy (buf, base_name, base_length);
+ buf[base_length] = (char) 0;
+
+@@ -536,10 +538,7 @@
+ attr_ret[n].attribute_id = xic_attr[j].attribute_id;
+ attr_ret[n].name_length = xic_attr[j].length;
+ attr_ret[n].name = malloc (xic_attr[j].length + 1);
+- memcpy (attr_ret[n].name,
+- xic_attr[j].name,
+- xic_attr[j].length);
+- attr_ret[n].name[xic_attr[j].length] = '\0';
++ strcpy(attr_ret[n].name, xic_attr[j].name);
+ attr_ret[n].type = xic_attr[j].type;
+ n++;
+ i++;
+@@ -560,10 +559,7 @@
+ attr_ret[n].attribute_id = xic_attr[j].attribute_id;
+ attr_ret[n].name_length = xic_attr[j].length;
+ attr_ret[n].name = malloc (xic_attr[j].length + 1);
+- memcpy (attr_ret[n].name,
+- xic_attr[j].name,
+- xic_attr[j].length);
+- attr_ret[n].name[xic_attr[j].length] = '\0';
++ strcpy(attr_ret[n].name, xic_attr[j].name);
+ attr_ret[n].type = xic_attr[j].type;
+ n++;
+ break;
+@@ -651,6 +647,7 @@
+ FrameMgrGetToken (fm, value);
+ attrib_list[attrib_num].value = (void *) malloc (value_length + 1);
+ memmove (attrib_list[attrib_num].value, value, value_length);
++ ((char *)attrib_list[attrib_num].value)[value_length] = '\0';
+ attrib_num++;
+ }
+ /*endwhile*/
+@@ -720,9 +717,23 @@
+
+ if (i18n_core->address.improto)
+ {
+- if (!(i18n_core->address.improto(ims, call_data)))
++ int ret, i;
++
++ ret = i18n_core->address.improto(ims, call_data);
++ for (i=0; i<preedit_ic_num; i++) {
++ if (pre_attr[i].value_length)
++ free(pre_attr[i].value);
++ }
++ for (i=0; i<status_ic_num; i++) {
++ if (sts_attr[i].value_length)
++ free(sts_attr[i].value);
++ }
++ for (i=0; i<ic_num; i++) {
++ if (ic_attr[i].value_length)
++ free(ic_attr[i].value);
++ }
++ if (ret == 0)
+ return;
+- /*endif*/
+ }
+ /*endif*/
+ if (create_flag == True)
+@@ -797,6 +808,7 @@
+ }
+ /*endif*/
+ FrameMgrFree (fm);
++ XFree(reply);
+ }
+
+ /* called from GetICValueMessageProc */
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nMethod.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nMethod.c
+@@ -39,6 +39,7 @@
+ #include "FrameMgr.h"
+ #include "IMdkit.h"
+ #include "Xi18n.h"
++#include "XimFunc.h"
+
+ extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
+
+@@ -47,11 +48,12 @@
+ static Status xi18n_closeIM (XIMS);
+ static char *xi18n_setIMValues (XIMS, XIMArg *);
+ static char *xi18n_getIMValues (XIMS, XIMArg *);
+-static Status xi18n_forwardEvent (XIMS, IMForwardEventStruct *);
+-static Status xi18n_commit (XIMS, IMCommitStruct *);
+-static Status xi18n_callCallback (XIMS, IMProtocol *);
+-static Status xi18n_preeditStart (XIMS, IMProtocol *);
+-static Status xi18n_preeditEnd (XIMS, IMProtocol *);
++static Status xi18n_forwardEvent (XIMS, XPointer);
++static Status xi18n_commit (XIMS, XPointer);
++static int xi18n_callCallback (XIMS, XPointer);
++static int xi18n_preeditStart (XIMS, XPointer);
++static int xi18n_preeditEnd (XIMS, XPointer);
++static int xi18n_syncXlib (XIMS, XPointer);
+
+ #ifndef XIM_SERVERS
+ #define XIM_SERVERS "XIM_SERVERS"
+@@ -71,6 +73,7 @@
+ xi18n_callCallback,
+ xi18n_preeditStart,
+ xi18n_preeditEnd,
++ xi18n_syncXlib,
+ };
+
+ extern Bool _Xi18nCheckXAddress (Xi18n, TransportSW *, char *);
+@@ -79,8 +82,10 @@
+ TransportSW _TransR[] =
+ {
+ {"X", 1, _Xi18nCheckXAddress},
++#ifdef TCPCONN
+ {"tcp", 3, _Xi18nCheckTransAddress},
+ {"local", 5, _Xi18nCheckTransAddress},
++#endif
+ #ifdef DNETCONN
+ {"decnet", 6, _Xi18nCheckTransAddress},
+ #endif
+@@ -543,6 +548,7 @@
+ break;
+ }
+ }
++
+ if (found == False) {
+ XSetSelectionOwner (dpy, atom, ims_win, CurrentTime);
+ XChangeProperty (dpy,
+@@ -576,6 +582,83 @@
+ return (XGetSelectionOwner (dpy, atom) == ims_win);
+ }
+
++static int DeleteXi18nAtom(Xi18n i18n_core)
++{
++ Display *dpy = i18n_core->address.dpy;
++ Window root = RootWindow (dpy, DefaultScreen (dpy));
++ Atom realtype;
++ int realformat;
++ unsigned long bytesafter;
++ long *data=NULL;
++ unsigned long length;
++ Atom atom;
++ int i, ret;
++ int found;
++ char buf[256];
++
++ (void)sprintf(buf, "@server=%s", i18n_core->address.im_name);
++ if ((atom = XInternAtom(dpy, buf, False)) == 0)
++ return False;
++ i18n_core->address.selection = atom;
++
++ if (XIM_Servers == None)
++ XIM_Servers = XInternAtom (dpy, XIM_SERVERS, False);
++ XGetWindowProperty (dpy,
++ root,
++ XIM_Servers,
++ 0L,
++ 1000000L,
++ False,
++ XA_ATOM,
++ &realtype,
++ &realformat,
++ &length,
++ &bytesafter,
++ (unsigned char **) (&data));
++ if (realtype != XA_ATOM || realformat != 32) {
++ if (data != NULL)
++ XFree ((char *) data);
++ return False;
++ }
++
++ found = False;
++ for (i = 0; i < length; i++) {
++ if (data[i] == atom) {
++ found = True;
++ break;
++ }
++ }
++
++ if (found == True) {
++ for (i=i+1; i<length; i++)
++ data[i-1] = data[i];
++ XChangeProperty (dpy,
++ root,
++ XIM_Servers,
++ XA_ATOM,
++ 32,
++ PropModeReplace,
++ (unsigned char *)data,
++ length-1);
++ ret = True;
++ }
++ else {
++ XChangeProperty (dpy,
++ root,
++ XIM_Servers,
++ XA_ATOM,
++ 32,
++ PropModePrepend,
++ (unsigned char *)data,
++ 0);
++ ret = False;
++ }
++ if (data != NULL)
++ XFree ((char *) data);
++ return ret;
++}
++
++
+ /* XIM protocol methods */
+ static void *xi18n_setup (Display *dpy, XIMArg *args)
+ {
+@@ -686,7 +769,7 @@
+ SelectionRequest,
+ SelectionRequest,
+ WaitXSelectionRequest,
+- ims);
++ (XPointer)ims);
+ XFlush(dpy);
+ return True;
+ }
+@@ -694,74 +777,20 @@
+ static Status xi18n_closeIM(XIMS ims)
+ {
+ Xi18n i18n_core = ims->protocol;
+- Window ims_win = i18n_core->address.im_window;
+ Display *dpy = i18n_core->address.dpy;
+- Atom atom = i18n_core->address.selection;
+- Window root = RootWindow (dpy, DefaultScreen (dpy));
+- Atom realtype;
+- int realformat;
+- unsigned long length;
+- unsigned long bytesafter;
+- long *data, *new_data;
+- int i, j;
+
++ DeleteXi18nAtom(i18n_core);
+ if (!i18n_core->methods.end (ims))
+ return False;
+- /*endif*/
+
+ _XUnregisterFilter (dpy,
+ i18n_core->address.im_window,
+ WaitXSelectionRequest,
+- ims);
+-/*
+- * Now we should delete the atom list in XIM_Servers property of Root Window
+- */
+-/*
+- XGetWindowProperty (dpy,
+- root,
+- XIM_Servers,
+- 0L,
+- 1000000L,
+- False,
+- XA_ATOM,
+- &realtype,
+- &realformat,
+- &length,
+- &bytesafter,
+- (unsigned char **) (&data));
+- if (realtype == XA_ATOM && realformat == 32 && length>0) {
+- new_data = malloc(sizeof(long) * length);
+- memset(new_data, 0, sizeof(long) * length);
+-
+- for (i=0, j=0; i<length; i++) {
+- if (data[i] != atom) {
+- new_data[j] = data[i];
+- j ++;
+- }
+- }
+- XDeleteProperty (dpy,
+- root,
+- XIM_Servers);
+- if (j > 0)
+- XChangeProperty (dpy,
+- root,
+- XIM_Servers,
+- XA_ATOM,
+- 32,
+- PropModePrepend,
+- (unsigned char *)new_data,
+- j);
+- free(new_data);
+- }
+- XFlush(dpy);
+-
+- if (data != NULL)
+- XFree ((char *) data);
++ (XPointer)ims);
+ XFree (i18n_core->address.im_name);
+ XFree (i18n_core->address.im_locale);
+ XFree (i18n_core->address.im_addr);
+ XFree (i18n_core);
+-*/
+ return True;
+ }
+
+@@ -817,9 +846,10 @@
+ /*endswitch*/
+ }
+
+-static Status xi18n_forwardEvent (XIMS ims, IMForwardEventStruct *call_data)
++static Status xi18n_forwardEvent (XIMS ims, XPointer xp)
+ {
+ Xi18n i18n_core = ims->protocol;
++ IMForwardEventStruct *call_data = (IMForwardEventStruct *)xp;
+ FrameMgr fm;
+ extern XimFrameRec forward_event_fr[];
+ register int total_size;
+@@ -879,9 +909,10 @@
+ return True;
+ }
+
+-static Status xi18n_commit (XIMS ims, IMCommitStruct *call_data)
++static Status xi18n_commit (XIMS ims, XPointer xp)
+ {
+ Xi18n i18n_core = ims->protocol;
++ IMCommitStruct *call_data = (IMCommitStruct *)xp;
+ FrameMgr fm;
+ extern XimFrameRec commit_chars_fr[];
+ extern XimFrameRec commit_both_fr[];
+@@ -974,8 +1005,9 @@
+ return True;
+ }
+
+-static int xi18n_callCallback (XIMS ims, IMProtocol *call_data)
++static int xi18n_callCallback (XIMS ims, XPointer xp)
+ {
++ IMProtocol *call_data = (IMProtocol *)xp;
+ switch (call_data->major_code)
+ {
+ case XIM_GEOMETRY:
+@@ -1010,8 +1042,9 @@
+ }
+
+ /* preeditStart and preeditEnd are used only for Dynamic Event Flow. */
+-static int xi18n_preeditStart (XIMS ims, IMProtocol *call_data)
++static int xi18n_preeditStart (XIMS ims, XPointer xp)
+ {
++ IMProtocol *call_data = (IMProtocol *)xp;
+ Xi18n i18n_core = ims->protocol;
+ IMPreeditStateStruct *preedit_state =
+ (IMPreeditStateStruct *) &call_data->preedit_state;
+@@ -1036,8 +1069,9 @@
+ return True;
+ }
+
+-static int xi18n_preeditEnd (XIMS ims, IMProtocol *call_data)
++static int xi18n_preeditEnd (XIMS ims, XPointer xp)
+ {
++ IMProtocol *call_data = (IMProtocol *)xp;
+ Xi18n i18n_core = ims->protocol;
+ int on_key_num = i18n_core->address.on_keys.count_keys;
+ int off_key_num = i18n_core->address.off_keys.count_keys;
+@@ -1057,3 +1091,39 @@
+ 0);
+ return True;
+ }
++
++static int xi18n_syncXlib (XIMS ims, XPointer xp)
++{
++ IMProtocol *call_data = (IMProtocol *)xp;
++ Xi18n i18n_core = ims->protocol;
++ IMSyncXlibStruct *sync_xlib;
++
++ extern XimFrameRec sync_fr[];
++ FrameMgr fm;
++ CARD16 connect_id = call_data->any.connect_id;
++ int total_size;
++ unsigned char *reply;
++
++ sync_xlib = (IMSyncXlibStruct *) &call_data->sync_xlib;
++ fm = FrameMgrInit (sync_fr, NULL,
++ _Xi18nNeedSwap (i18n_core, connect_id));
++ total_size = FrameMgrGetTotalSize(fm);
++ reply = (unsigned char *) malloc (total_size);
++ if (!reply) {
++ _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
++ return False;
++ }
++ memset (reply, 0, total_size);
++ FrameMgrSetBuffer (fm, reply);
++
++ /* input input-method ID */
++ FrameMgrPutToken (fm, connect_id);
++ /* input input-context ID */
++ FrameMgrPutToken (fm, sync_xlib->icid);
++ _Xi18nSendMessage (ims, connect_id, XIM_SYNC, 0, reply, total_size);
++
++ FrameMgrFree (fm);
++ XFree(reply);
++ return True;
++}
++
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nPtHdr.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nPtHdr.c
+@@ -29,6 +29,10 @@
+
+ ******************************************************************/
+
++#ifdef HAVE_CONFIG_H
++# include "config.h"
++#endif
++
+ #include <stdlib.h>
+ #include <sys/param.h>
+ #include <X11/Xlib.h>
+@@ -40,6 +44,8 @@
+ #include "FrameMgr.h"
+ #include "IMdkit.h"
+ #include "Xi18n.h"
++#include "XimFunc.h"
++
+
+ extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
+
+@@ -556,6 +562,17 @@
+ FrameMgrFree (fm);
+
+ client->sync = False;
++
++ if (ims->sync == True) {
++ ims->sync = False;
++ if (i18n_core->address.improto) {
++ call_data->sync_xlib.major_code = XIM_SYNC_REPLY;
++ call_data->sync_xlib.minor_code = 0;
++ call_data->sync_xlib.connect_id = input_method_ID;
++ call_data->sync_xlib.icid = input_context_ID;
++ i18n_core->address.improto(ims, call_data);
++ }
++ }
+ }
+
+ static void GetIMValueFromName (Xi18n i18n_core,
+@@ -703,7 +720,10 @@
+ register int j;
+ int number;
+ CARD16 *im_attrID_list;
++ char **name_list;
++ CARD16 name_number;
+ XIMAttribute *im_attribute_list;
++ IMGetIMValuesStruct *getim = (IMGetIMValuesStruct *)&call_data->getim;
+ CARD16 connect_id = call_data->any.connect_id;
+ CARD16 input_method_ID;
+
+@@ -716,6 +736,8 @@
+ FrameMgrGetToken (fm, byte_length);
+ im_attrID_list = (CARD16 *) malloc (sizeof (CARD16)*20);
+ memset (im_attrID_list, 0, sizeof (CARD16)*20);
++ name_list = (char **)malloc(sizeof(char *) * 20);
++ memset(name_list, 0, sizeof(char *) * 20);
+ number = 0;
+ while (FrameMgrIsIterLoopEnd (fm, &status) == False)
+ {
+@@ -724,32 +746,26 @@
+ }
+ FrameMgrFree (fm);
+
+-#ifdef PROTOCOL_RICH
+- if (i18n_core->address.improto) {
+- IMGetIMValuesStruct *getim = (IMGetIMValuesStruct *) &call_data->getim;
+- char **name_list;
+- CARD16 name_number;
+-
+- name_list = (char **) malloc (sizeof (char *)*20);
+- memset (name_list, 0, sizeof (char *)*20);
+- name_number = 0;
+- for (i = 0; i < number; i++) {
+- for (j = 0; j < i18n_core->address.im_attr_num; j++) {
+- if (i18n_core->address.xim_attr[j].attribute_id ==
++ name_number = 0;
++ for (i = 0; i < number; i++) {
++ for (j = 0; j < i18n_core->address.im_attr_num; j++) {
++ if (i18n_core->address.xim_attr[j].attribute_id ==
+ im_attrID_list[i]) {
+- name_list[name_number++] =
++ name_list[name_number++] =
+ i18n_core->address.xim_attr[j].name;
+- break;
+- }
++ break;
+ }
+ }
+- getim->number = name_number;
+- getim->im_attr_list = name_list;
+- if (!(i18n_core->address.improto (ims, call_data))) {
+- XFree (name_list);
++ }
++ getim->number = name_number;
++ getim->im_attr_list = name_list;
++ XFree (name_list);
++
++
++#ifdef PROTOCOL_RICH
++ if (i18n_core->address.improto) {
++ if (!(i18n_core->address.improto (ims, call_data)))
+ return;
+- }
+- XFree (name_list);
+ }
+ #endif /* PROTOCOL_RICH */
+
+@@ -805,6 +821,8 @@
+ FrameMgrFree (fm);
+ XFree (reply);
+
++ for (i = 0; i < iter_count; i++)
++ XFree(im_attribute_list[i].value);
+ XFree (im_attribute_list);
+ }
+
+@@ -950,6 +968,7 @@
+ 0,
+ reply,
+ total_size);
++ XFree(reply);
+ FrameMgrFree (fm);
+ }
+
+@@ -1007,6 +1026,7 @@
+
+ FrameMgrPutToken (fm, input_method_ID);
+ FrameMgrPutToken (fm, resetic->icid);
++ FrameMgrPutToken(fm, resetic->length);
+ FrameMgrPutToken (fm, resetic->commit_string);
+
+ _Xi18nSendMessage (ims,
+@@ -1016,6 +1036,7 @@
+ reply,
+ total_size);
+ FrameMgrFree (fm);
++ XFree(reply);
+ }
+
+ static int WireEventToEvent (Xi18n i18n_core,
+@@ -1299,7 +1320,7 @@
+ Xi18nAddressRec *address = (Xi18nAddressRec *) & i18n_core->address;
+ XIMEncodings *p;
+ int i, j;
+- int enc_index;
++ int enc_index=0;
+
+ p = (XIMEncodings *) &address->encoding_list;
+ for (i = 0; i < (int) p->count_encodings; i++)
+@@ -1617,58 +1638,72 @@
+ switch (call_data.major_code)
+ {
+ case XIM_CONNECT:
++ //DebugLog(4, ("-- XIM_CONNECT\n"));
+ ConnectMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_DISCONNECT:
++ //DebugLog(4, ("-- XIM_DISCONNECT\n"));
+ DisConnectMessageProc (ims, &call_data);
+ break;
+
+ case XIM_OPEN:
++ //DebugLog(4, ("-- XIM_OPEN\n"));
+ OpenMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_CLOSE:
++ //DebugLog(4, ("-- XIM_CLOSE\n"));
+ CloseMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_QUERY_EXTENSION:
++ //DebugLog(4, ("-- XIM_QUERY_EXTENSION\n"));
+ QueryExtensionMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_GET_IM_VALUES:
++ //DebugLog(4, ("-- XIM_GET_IM_VALUES\n"));
+ GetIMValuesMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_CREATE_IC:
++ //DebugLog(4, ("-- XIM_CREATE_IC\n"));
+ CreateICMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_SET_IC_VALUES:
++ //DebugLog(4, ("-- XIM_SET_IC_VALUES\n"));
+ SetICValuesMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_GET_IC_VALUES:
++ //DebugLog(4, ("-- XIM_GET_IC_VALUES\n"));
+ GetICValuesMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_SET_IC_FOCUS:
++ //DebugLog(4, ("-- XIM_SET_IC_FOCUS\n"));
+ SetICFocusMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_UNSET_IC_FOCUS:
++ //DebugLog(4, ("-- XIM_UNSET_IC_FOCUS\n"));
+ UnsetICFocusMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_DESTROY_IC:
++ //DebugLog(4, ("-- XIM_DESTROY_IC\n"));
+ DestroyICMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_RESET_IC:
++ //DebugLog(4, ("-- XIM_RESET_IC\n"));
+ ResetICMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_FORWARD_EVENT:
++ //DebugLog(4, ("-- XIM_FORWARD_EVENT\n"));
+ if (client->sync == True)
+ {
+ AddQueue (client, p);
+@@ -1681,34 +1716,42 @@
+ break;
+
+ case XIM_EXTENSION:
++ //DebugLog(4, ("-- XIM_EXTENSION\n"));
+ ExtensionMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_SYNC:
++ //DebugLog(4, ("-- XIM_SYNC\n"));
+ break;
+
+ case XIM_SYNC_REPLY:
++ //DebugLog(4, ("-- XIM_SYNC_REPLY\n"));
+ SyncReplyMessageProc (ims, &call_data, p1);
+ ProcessQueue (ims, connect_id);
+ break;
+
+ case XIM_TRIGGER_NOTIFY:
++ //DebugLog(4, ("-- XIM_TRIGGER_NOTIFY\n"));
+ TriggerNotifyMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_ENCODING_NEGOTIATION:
++ //DebugLog(4, ("-- XIM_ENCODING_NEGOTIATION\n"));
+ EncodingNegotiatonMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_PREEDIT_START_REPLY:
++ //DebugLog(4, ("-- XIM_PREEDIT_START_REPLY\n"));
+ PreeditStartReplyMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_PREEDIT_CARET_REPLY:
++ //DebugLog(4, ("-- XIM_PREEDIT_CARET_REPLY\n"));
+ PreeditCaretReplyMessageProc (ims, &call_data, p1);
+ break;
+
+ case XIM_STR_CONVERSION_REPLY:
++ //DebugLog(4, ("-- XIM_STR_CONVERSION_REPLY\n"));
+ StrConvReplyMessageProc (ims, &call_data, p1);
+ break;
+ }
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nTr.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nTr.c
+@@ -177,11 +177,11 @@
+ /*endif*/
+ return (unsigned char *) p;
+
+- //TODO: Get rid of this label, and the goto's
++ /* TODO: Get rid of this label, and the goto's */
+ read_error:
+ _XUnregisterInternalConnection (i18n_core->address.dpy, fd);
+- _XimdXTransDisconnect (tr_client->accept_conn);
+- _XimdXTransClose (tr_client->accept_conn);
++ _XimXTransDisconnect (tr_client->accept_conn);
++ _XimXTransClose (tr_client->accept_conn);
+ return (unsigned char *) NULL;
+ }
+
+@@ -200,7 +200,7 @@
+ return False;
+ }
+ /*endif*/
+- fd = _XimdXTransGetConnectionNumber(spec->trans_conn);
++ fd = _XimXTransGetConnectionNumber(spec->trans_conn);
+ return _XRegisterInternalConnection(i18n_core->address.dpy, fd,
+ (_XInternalConnectionProc)Xi18nWaitTransListen,
+ (XPointer)ims);
+@@ -212,13 +212,13 @@
+ TransSpecRec *spec = (TransSpecRec *) i18n_core->address.connect_addr;
+ int fd;
+
+- fd = _XimdXTransGetConnectionNumber (spec->trans_conn);
++ fd = _XimXTransGetConnectionNumber (spec->trans_conn);
+ if (fd == 0)
+ return False;
+ /*endif*/
+ _XUnregisterInternalConnection (i18n_core->address.dpy, fd);
+- _XimdXTransDisconnect (spec->trans_conn);
+- _XimdXTransClose (spec->trans_conn);
++ _XimXTransDisconnect (spec->trans_conn);
++ _XimXTransClose (spec->trans_conn);
+
+ XFree (spec->port);
+ XFree (spec);
+@@ -255,7 +255,7 @@
+ Xi18n i18n_core = ims->protocol;
+ Xi18nClient *client = _Xi18nFindClient(i18n_core, connect_id);
+ TransClient *tr_client = (TransClient *)client->trans_rec;
+- int fd = _XimdXTransGetConnectionNumber(tr_client->accept_conn);
++ int fd = _XimXTransGetConnectionNumber(tr_client->accept_conn);
+
+ for (;;)
+ {
+@@ -294,8 +294,8 @@
+
+ _XUnregisterInternalConnection (i18n_core->address.dpy,
+ tr_client->accept_fd);
+- _XimdXTransDisconnect (tr_client->accept_conn);
+- _XimdXTransClose (tr_client->accept_conn);
++ _XimXTransDisconnect (tr_client->accept_conn);
++ _XimXTransClose (tr_client->accept_conn);
+ XFree (tr_client);
+ _Xi18nDeleteClient (i18n_core, connect_id);
+ return True;
+@@ -308,7 +308,7 @@
+ {
+ int len;
+
+- if ((len = _XimdXTransRead (accept_conn, buf, buf_len)) <= 0)
++ if ((len = _XimXTransRead (accept_conn, buf, buf_len)) <= 0)
+ return False;
+ /*endif*/
+ *ret_len = len;
+@@ -321,7 +321,7 @@
+
+ while (len > 0)
+ {
+- if ((nbyte = _XimdXTransWrite (accept_conn, buf, len)) <= 0)
++ if ((nbyte = _XimXTransWrite (accept_conn, buf, len)) <= 0)
+ return False;
+ /*endif*/
+ len -= nbyte;
+@@ -387,7 +387,7 @@
+ tr_client = (TransClient *) malloc (sizeof (TransClient));
+
+ tr_client->accept_conn = accept_conn;
+- tr_client->accept_fd = _XimdXTransGetConnectionNumber (accept_conn);
++ tr_client->accept_fd = _XimXTransGetConnectionNumber (accept_conn);
+ client->trans_rec = tr_client;
+
+ return ((TransClient *) tr_client);
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nUtil.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nUtil.c
+@@ -33,9 +33,11 @@
+ #include "IMdkit.h"
+ #include "Xi18n.h"
+ #include "FrameMgr.h"
++#include "XimFunc.h"
+
+ Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
+
++int
+ _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id)
+ {
+ CARD8 im_byteOrder = i18n_core->address.im_byteOrder;
+@@ -47,20 +49,23 @@
+ Xi18nClient *_Xi18nNewClient(Xi18n i18n_core)
+ {
+ static CARD16 connect_id = 0;
++ int new_connect_id;
+ Xi18nClient *client;
+
+ if (i18n_core->address.free_clients)
+ {
+ client = i18n_core->address.free_clients;
+ i18n_core->address.free_clients = client->next;
++ new_connect_id = client->connect_id;
+ }
+ else
+ {
+ client = (Xi18nClient *) malloc (sizeof (Xi18nClient));
++ new_connect_id = ++connect_id;
+ }
+ /*endif*/
+ memset (client, 0, sizeof (Xi18nClient));
+- client->connect_id = ++connect_id;
++ client->connect_id = new_connect_id;
+ client->pending = (XIMPending *) NULL;
+ client->sync = False;
+ client->byte_order = '?'; /* initial value */
+@@ -226,6 +231,7 @@
+ reply,
+ total_size);
+ FrameMgrFree (fm);
++ XFree(reply);
+ }
+
+ void _Xi18nSetEventMask (XIMS ims,
+@@ -266,4 +272,5 @@
+ total_size);
+
+ FrameMgrFree (fm);
++ XFree(reply);
+ }
+--- chinput-3.0.2.orig/src/IMdkit/lib/i18nX.c
++++ chinput-3.0.2/src/IMdkit/lib/i18nX.c
+@@ -35,6 +35,7 @@
+ #include "IMdkit.h"
+ #include "Xi18n.h"
+ #include "Xi18nX.h"
++#include "XimFunc.h"
+
+ extern Xi18nClient *_Xi18nFindClient(Xi18n, CARD16);
+ extern Xi18nClient *_Xi18nNewClient(Xi18n);
+@@ -70,7 +71,7 @@
+ {
+ Xi18n i18n_core = ims->protocol;
+ Xi18nClient *client = i18n_core->address.clients;
+- XClient *x_client;
++ XClient *x_client = NULL;
+ FrameMgr fm;
+ extern XimFrameRec packet_header_fr[];
+ unsigned char *p = NULL;
+@@ -195,7 +196,7 @@
+ ClientMessage,
+ ClientMessage,
+ WaitXIMProtocol,
+- ims);
++ (XPointer)ims);
+ event.xclient.type = ClientMessage;
+ event.xclient.display = dpy;
+ event.xclient.window = new_client;
+@@ -232,7 +233,7 @@
+ ClientMessage,
+ ClientMessage,
+ WaitXConnectMessage,
+- ims);
++ (XPointer)ims);
+ return True;
+ }
+
+@@ -244,7 +245,7 @@
+ _XUnregisterFilter (dpy,
+ i18n_core->address.im_window,
+ WaitXConnectMessage,
+- ims);
++ (XPointer)ims);
+ return True;
+ }
+
+@@ -417,7 +418,7 @@
+ _XUnregisterFilter (dpy,
+ x_client->accept_win,
+ WaitXIMProtocol,
+- ims);
++ (XPointer)ims);
+ XFree (x_client);
+ _Xi18nDeleteClient (i18n_core, connect_id);
+ return True;
+--- chinput-3.0.2.orig/src/IMdkit/lib/IMConn.c
++++ chinput-3.0.2/src/IMdkit/lib/IMConn.c
+@@ -30,7 +30,8 @@
+ ******************************************************************/
+
+ #include <X11/Xlib.h>
+-#include <malloc.h>
++#include <stdlib.h>
++#include <string.h>
+ #include "IMdkit.h"
+ #include <stdarg.h>
+
+@@ -44,7 +45,7 @@
+
+ for (attr = va_arg (var, char*); attr; attr = va_arg (var, char*))
+ {
+- va_arg (var, XIMArg *);
++ (void)va_arg (var, XIMArg *);
+ ++(*total_count);
+ }
+ /*endfor*/
+--- chinput-3.0.2.orig/src/IMdkit/lib/IMMethod.c
++++ chinput-3.0.2/src/IMdkit/lib/IMMethod.c
+@@ -57,3 +57,9 @@
+ {
+ return (ims->methods->preeditEnd) (ims, call_data);
+ }
++
++int IMSyncXlib(XIMS ims, XPointer call_data)
++{
++ ims->sync = True;
++ return (ims->methods->syncXlib) (ims, call_data);
++}
+--- chinput-3.0.2.orig/src/IMdkit/lib/IMValues.c
++++ chinput-3.0.2/src/IMdkit/lib/IMValues.c
+@@ -29,6 +29,7 @@
+
+ ******************************************************************/
+
++#include <stdlib.h>
+ #include <X11/Xlib.h>
+ #include "IMdkit.h"
+ #include <stdarg.h>
+@@ -43,7 +44,7 @@
+
+ for (attr = va_arg (var, char *); attr; attr = va_arg (var, char *))
+ {
+- va_arg (var, XIMArg *);
++ (void)va_arg (var, XIMArg *);
+ ++(*total_count);
+ }
+ /*endfor*/
+--- chinput-3.0.2.orig/src/IMdkit/lib/Makefile
++++ chinput-3.0.2/src/IMdkit/lib/Makefile
+@@ -1,7 +1,7 @@
+
+ CC = gcc
+ #CFLAGS = -c -O2 -fno-strength-reduce -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE=500L -D_BSD_SOURCE -D_SVID_SOURCE -DFUNCPROTO=15 -DNARROWPROTO -DUNIXCONN -DTCPCONN -DXIM_t -DTRANS_SERVER
+-CFLAGS = -c -O2 -fno-strength-reduce -DXIM_t -DTRANS_SERVER
++CFLAGS = -c -O2 -fno-strength-reduce -DXIM_t -DTRANS_SERVER
+ INC = -I../include -I/usr/X11R6/include
+
+
+--- chinput-3.0.2.orig/src/IMdkit/lib/XimFunc.h
++++ chinput-3.0.2/src/IMdkit/lib/XimFunc.h
+@@ -0,0 +1,72 @@
++/******************************************************************
++
++ Copyright 1994, 1995 by Sun Microsystems, Inc.
++ Copyright 1993, 1994 by Hewlett-Packard Company
++
++Permission to use, copy, modify, distribute, and sell this software
++and its documentation for any purpose is hereby granted without fee,
++provided that the above copyright notice appear in all copies and
++that both that copyright notice and this permission notice appear
++in supporting documentation, and that the name of Sun Microsystems, Inc.
++and Hewlett-Packard not be used in advertising or publicity pertaining to
++distribution of the software without specific, written prior permission.
++Sun Microsystems, Inc. and Hewlett-Packard make no representations about
++the suitability of this software for any purpose. It is provided "as is"
++without express or implied warranty.
++
++SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
++WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
++WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
++SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
++SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
++RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
++CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
++IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++
++ Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
++
++ This version tidied and debugged by Steve Underwood May 1999
++
++******************************************************************/
++
++#ifndef _XimFunc_h
++#define _XimFunc_h
++
++/* i18nAttr.c */
++void _Xi18nInitAttrList (Xi18n i18n_core);
++void _Xi18nInitExtension(Xi18n i18n_core);
++
++/* i18nClbk.c */
++int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nPreeditStartCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nPreeditDrawCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nPreeditCaretCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nPreeditDoneCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nStatusStartCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nStatusDoneCallback (XIMS ims, IMProtocol *call_data);
++int _Xi18nStringConversionCallback (XIMS ims, IMProtocol *call_data);
++
++/* i18nIc.c */
++void _Xi18nChangeIC (XIMS ims, IMProtocol *call_data, unsigned char *p,
++ int create_flag);
++void _Xi18nGetIC (XIMS ims, IMProtocol *call_data, unsigned char *p);
++
++/* i18nUtil.c */
++int _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id);
++Xi18nClient *_Xi18nNewClient(Xi18n i18n_core);
++Xi18nClient *_Xi18nFindClient (Xi18n i18n_core, CARD16 connect_id);
++void _Xi18nDeleteClient (Xi18n i18n_core, CARD16 connect_id);
++void _Xi18nSendMessage (XIMS ims, CARD16 connect_id, CARD8 major_opcode,
++ CARD8 minor_opcode, unsigned char *data, long length);
++void _Xi18nSendTriggerKey (XIMS ims, CARD16 connect_id);
++void _Xi18nSetEventMask (XIMS ims, CARD16 connect_id, CARD16 im_id,
++ CARD16 ic_id, CARD32 forward_mask, CARD32 sync_mask);
++
++/* Xlib internal */
++void _XRegisterFilterByType(Display*, Window, int, int,
++ Bool (*filter)(Display*, Window, XEvent*, XPointer), XPointer);
++void _XUnregisterFilter(Display*, Window,
++ Bool (*filter)(Display*, Window, XEvent*, XPointer), XPointer);
++
++#endif
+--- chinput-3.0.2.orig/src/config.h
++++ chinput-3.0.2/src/config.h
+@@ -0,0 +1,5 @@
++#ifndef CONFIG_H
++#define CONFIG_H
++#define RESOURCEFILE "/etc/Chinput.ad"
++#define IMDIR "/usr/dict/"
++#endif
+--- chinput-3.0.2.orig/handwriting/Makefile
++++ chinput-3.0.2/handwriting/Makefile
+@@ -26,9 +26,9 @@
+ perl conv_jdata.pl < strokedata_big5.h > hzbig5.dat
+
+ install: kpengine hzgb.dat hzbig5.dat
+- mkdir -p $(prefix)/lib/ZWinPro
+- cp -f hzgb.dat $(prefix)/lib/ZWinPro/hzgb.dat
+- cp -f hzbig5.dat $(prefix)/lib/ZWinPro/hzbig5.dat
++ mkdir -p $(prefix)/share/chinput
++ cp -f hzgb.dat $(prefix)/share/chinput/hzgb.dat
++ cp -f hzbig5.dat $(prefix)/share/chinput/hzbig5.dat
+ cp -f kpengine $(prefix)/bin/kpengine
+
+ clean:
+--- chinput-3.0.2.orig/debian/README.Debian
++++ chinput-3.0.2/debian/README.Debian
+@@ -0,0 +1,39 @@
++Chinput for Debian
++----------------------
++ For more information about Debian Chinese support, please visit:
++ http://www.debian.org/intl/zh
++
++ Before you use Chinput, may be you need to do some configuration.
++ Under Bash shell:
++ For GB2312:
++ export LANG=zh_CN.GB2312
++ export LC_CTYPE=zh_CN.GB2312
++ export XMODIFIERS=@im=Chinput
++
++ For Big5:
++ export LANG=zh_TW.Big5
++ export LC_CTYPE=zh_TW.Big5
++ export XMODIFIERS=@im=Chinput
++ Chinput also support GBK, but I haven't tested it.
++
++ Ctrl+Space to activate chinput.
++ Notice: Only when the program support XIM protocol, the Chinput
++could be activated.
++
++ TIP: For libc6(>=2.1.94 && <2.2), you maybe need to make a link by
++hand:
++ cd /usr/lib/locale; ln -s zh_CN zh_CN.GB2312; ln -s zh_TW zh_TW.Big5
++
++ Enjoy it!!
++
++ -- Yu Guanghui <ygh@debian.org>, Tue, 17 Oct 2000 00:47:01 +0800
++
++ Notice: Chinput only can use 16 point fonts.
++ Thanks for Forrest Cahoon <forrest@pconline.com> 's report.
++
++ -- Yu Guanghui <ygh@debian.org>, Wed, 19 Oct 2001 17:47:01 +0800
++
++ You can copy /etc/Chinput.ad to ~/.chinput in order to custom configure.
++
++ -- Yu Guanghui <ygh@debian.org>, Sat, 10 May 2003 20:26:01 +0800
++
+--- chinput-3.0.2.orig/debian/changelog
++++ chinput-3.0.2/debian/changelog
+@@ -0,0 +1,155 @@
++chinput (3.0.2-13) unstable; urgency=low
++
++ * Changed /usr/lib/ZWinPro to /usr/share/chinput
++ * Moved Chinput.ad to /etc
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 10 May 2003 20:25:07 +0800
++
++chinput (3.0.2-12) unstable; urgency=low
++
++ * Build with new unicon-im.
++
++ -- Yu Guanghui <ygh@debian.org> Fri, 9 May 2003 18:19:08 +0800
++
++chinput (3.0.2-11) unstable; urgency=low
++
++ * Built with libpth2 (closes:Bug#184675)
++ * maybe it's libpth2's bug, I have to depend on libpth2 by hand.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 12 Mar 2003 21:26:20 +0800
++
++chinput (3.0.2-10) unstable; urgency=low
++
++ * Using XCIN's IMdkit instead of the old one, expect some memory
++ leaks can be fixed.
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 10 Jun 2002 20:49:01 +0800
++
++chinput (3.0.2-9) unstable; urgency=low
++
++ * Changed WuBi input method from turbo to cce.
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 11 May 2002 21:35:29 +0800
++
++chinput (3.0.2-8) unstable; urgency=low
++
++ * Compiled with libpth14
++
++ -- Yu Guanghui <ygh@debian.org> Tue, 15 Jan 2002 22:44:00 +0800
++
++chinput (3.0.2-7) unstable; urgency=low
++
++ * This patch is from John R. Daily [jdaily@progeny.com].
++ Thank you very much. (closes:Bug#119884)
++ * Add ia64 back into control (changed arch to any)
++ * FrameMgr.c: Changed dangerous pointer->int cast to pointer->uintptr_t,
++ a new type defined by C99 to be an integer the same size as a pointer.
++ * IMValues.c: Added stdlib.h header for malloc(3) to avoid pointer
++ truncation issues on ia64.
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 17 Nov 2001 08:29:26 +0800
++
++chinput (3.0.2-6) unstable; urgency=low
++
++ * Removed IA64 from the support listing. It will be added
++ in future if unicon supports IA64.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 24 Oct 2001 15:51:50 +0800
++
++chinput (3.0.2-5) unstable; urgency=low
++
++ * My stupid mistake. Forgot to change back fontname in color.c
++ and default fonts in Chinput.ad after testing a bug of the
++ defoma package. (closes:Bug#116232)
++ * Notice: The chinput only can use 16 points fonts.
++
++ -- Yu Guanghui <ygh@debian.org> Fri, 19 Oct 2001 17:41:33 +0800
++
++chinput (3.0.2-4) unstable; urgency=low
++
++ * Fonts problem workround. (just simple don't use
++ medium fonts now)
++ * Depend latest unicon-im 3.0.4-2 now.
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 17 Sep 2001 23:09:38 +0800
++
++chinput (3.0.2-3) unstable; urgency=low
++
++ * Fixed Big5 locale name from zh_TW.BIG5 to zh_TW.Big5.
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 12 Aug 2001 09:50:47 +0800
++
++chinput (3.0.2-2) unstable; urgency=low
++
++ * Fixed display problem with xf4.1.0. (not a good way, but it work).
++
++ -- Yu Guanghui <ygh@debian.org> Fri, 3 Aug 2001 21:00:55 +0800
++
++chinput (3.0.2-1) unstable; urgency=low
++
++ * New upstream release
++
++ -- Yu Guanghui <ygh@debian.org> Thu, 19 Jul 2001 17:54:47 +0800
++
++chinput (3.0.1-9) unstable; urgency=low
++
++ * New patch for couldn't switch to ZNPY in some cases. Thanks to
++ moonlight (www.linuxforum.net).
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 7 Jul 2001 08:07:19 +0800
++
++chinput (3.0.1-8) unstable; urgency=low
++
++ * Apply chinese from Shu Jingxiang<hashao@china.com>.
++ * Depended unicon 3.0.3-4 now.
++
++ -- Yu Guanghui <ygh@debian.org> Fri, 6 Jul 2001 15:21:36 +0800
++
++chinput (3.0.1-7) unstable; urgency=low
++
++ * Fixed user phrase support.
++ * chinput will depend unicon 3.0.3-3 for the user phrase support.
++
++ -- Yu Guanghui <ygh@debian.org> Thu, 5 Jul 2001 22:57:22 +0800
++
++chinput (3.0.1-6) unstable; urgency=low
++
++ * Merged with miniChinput <http://www.yichang.net.cn/~bozhang/>.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 30 May 2001 00:26:43 +0800
++
++chinput (3.0.1-5) unstable; urgency=low
++
++ * Because xfonts-arphic-* will be replaced by ttf-arphic-*, changed
++ depend from xfonts-arphic-* to ttf-arphic-*.(closes:Bug#98878)
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 27 May 2001 19:07:17 +0800
++
++chinput (3.0.1-4) unstable; urgency=low
++
++ * Fixed for unicon-3.0.2.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 2 May 2001 02:15:34 +0800
++
++chinput (3.0.1-3) unstable; urgency=low
++
++ * Add lintian override file, make lintian happy. :)
++
++ -- Yu Guanghui <ygh@debian.org> Tue, 20 Feb 2001 22:56:01 +0800
++
++chinput (3.0.1-2) unstable; urgency=low
++
++ * Change Build-depends to unicon-im (>=3.0-3), chinput can't be
++ compiled and work with the old one.
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 19 Feb 2001 22:27:20 +0800
++
++chinput (3.0.1-1) unstable; urgency=low
++
++ * Initial Release.
++
++ -- Yu Guanghui <ygh@debian.org> Tue, 17 Oct 2000 00:47:01 +0800
++
++Local variables:
++mode: debian-changelog
++End:
+--- chinput-3.0.2.orig/debian/copyright
++++ chinput-3.0.2/debian/copyright
+@@ -0,0 +1,14 @@
++This package was debianized by Yu Guanghui <ygh@debian.org> on
++Tue, 17 Oct 2000 00:47:01 +0800.
++
++It was downloaded from http://turbolinux.com.cn/~justiny/project-chinput.html
++
++Upstream Author: Yu Mingjian <justiny@turbolinux.com.cn>
++
++Copyright:
++
++The programs in this package may be copied under the terms of the GNU
++General Public Licence (see below).
++
++On Debian systems, you can find the complete GNU GPL at
++/usr/share/common-licenses/GPL.
+--- chinput-3.0.2.orig/debian/menu
++++ chinput-3.0.2/debian/menu
+@@ -0,0 +1,3 @@
++?package(chinput):needs="x11" section="XShells"\
++ title="Chinput" command="/usr/bin/chinput" \
++ longtitle="Chinese input server for X Window System with XIM support"
+--- chinput-3.0.2.orig/debian/dirs
++++ chinput-3.0.2/debian/dirs
+@@ -0,0 +1,4 @@
++etc/
++usr/bin
++usr/sbin
++usr/share/lintian/overrides
+--- chinput-3.0.2.orig/debian/override
++++ chinput-3.0.2/debian/override
+@@ -0,0 +1,4 @@
++chinput: binary-or-shlib-defines-rpath ./usr/bin/chinput /usr/lib/unicon
++chinput: binary-without-manpage chinput
++chinput: binary-without-manpage kpengine
++chinput: package-has-a-duplicate-relation unicon-im
+--- chinput-3.0.2.orig/debian/control
++++ chinput-3.0.2/debian/control
+@@ -0,0 +1,17 @@
++Source: chinput
++Section: utils
++Priority: optional
++Build-depends: debhelper, libpth-dev, imlib-dev, unicon-im (>= 3.0.4-9)
++Maintainer: Yu Guanghui <ygh@debian.org>
++Standards-Version: 3.5.8
++
++Package: chinput
++Architecture: any
++Depends: ${shlibs:Depends}, ttf-arphic-gbsn00lp | ttf-arphic-bsmi00lp, libpth2
++Conflicts: unicon-im (<< 3.0.4-9)
++Description: Chinese XIM Input Server
++ This package contains the Chinput Chinese input server with XIM support.
++ It supports both Big5 (traditional Chinese) and GB (simplified Chinese)
++ character sets.
++ .
++ Author: Yu Mingjian <justiny@turbolinux.com.cn>
+--- chinput-3.0.2.orig/debian/rules
++++ chinput-3.0.2/debian/rules
+@@ -0,0 +1,78 @@
++#!/usr/bin/make -f
++# Sample debian/rules that uses debhelper.
++# GNU copyright 1997 to 1999 by Joey Hess.
++
++# Uncomment this to turn on verbose mode.
++#export DH_VERBOSE=1
++
++# This is the debhelper compatability version to use.
++export DH_COMPAT=1
++
++build: build-stamp
++build-stamp:
++ dh_testdir
++
++
++ # Add here commands to compile the package.
++ #$(MAKE)
++
++ touch build-stamp
++
++clean:
++ dh_testdir
++ dh_testroot
++ rm -f build-stamp
++
++ # Add here commands to clean up after the build process.
++ -$(MAKE) clean
++
++ dh_clean
++
++install: build
++ dh_testdir
++ dh_testroot
++ dh_clean -k
++ dh_installdirs
++
++ # Add here commands to install the package into debian/tmp.
++ $(MAKE) install prefix=`pwd`/debian/tmp/usr etc_prefix=`pwd`/debian/tmp/etc
++ cp -f debian/override `pwd`/debian/tmp/usr/share/lintian/overrides/chinput
++
++
++# Build architecture-independent files here.
++binary-indep: build install
++# We have nothing to do by default.
++
++# Build architecture-dependent files here.
++binary-arch: build install
++# dh_testversion
++ dh_testdir
++ dh_testroot
++# dh_installdebconf
++ dh_installdocs
++ dh_installexamples
++ dh_installmenu
++# dh_installemacsen
++# dh_installpam
++# dh_installinit
++ dh_installcron
++ dh_installmanpages
++ dh_installinfo
++# dh_undocumented
++ dh_installchangelogs doc/CHANGES
++ dh_link
++ dh_strip
++ dh_compress
++ dh_fixperms
++ # You may want to make some executables suid here.
++# dh_suidregister
++# dh_makeshlibs
++ dh_installdeb
++# dh_perl
++ dh_shlibdeps
++ dh_gencontrol
++ dh_md5sums
++ dh_builddeb
++
++binary: binary-indep binary-arch
++.PHONY: build clean binary-indep binary-arch binary install
+--- chinput-3.0.2.orig/debian/docs
++++ chinput-3.0.2/debian/docs
+@@ -0,0 +1,5 @@
++doc/API
++doc/BUGS
++doc/FAQ
++doc/README
++doc/USAGE
+--- chinput-3.0.2.orig/debian/conffiles
++++ chinput-3.0.2/debian/conffiles
+@@ -0,0 +1 @@
++/etc/Chinput.ad
+--- chinput-3.0.2.orig/debian/patches/ia64.patch
++++ chinput-3.0.2/debian/patches/ia64.patch
+@@ -0,0 +1,78 @@
++diff -Naur chinput.orig/src/IMdkit/lib/FrameMgr.c chinput-3.0.2/src/IMdkit/lib/FrameMgr.c
++--- chinput.orig/src/IMdkit/lib/FrameMgr.c Sat Jul 1 21:01:01 2000
+++++ chinput-3.0.2/src/IMdkit/lib/FrameMgr.c Fri Nov 16 15:28:48 2001
++@@ -28,6 +28,7 @@
++
++ #include <X11/Xlibint.h>
++ #include <stdlib.h>
+++#include <stdint.h> /* uintptr_t */
++ #include "FrameMgr.h"
++
++ /* Convenient macro */
++@@ -909,8 +910,8 @@
++ register int offset, iter_idx;
++
++ info->counter.is_byte_len =
++- (((int) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
++- offset = ((int) fi->template[fi->cur_no].data) >> 8;
+++ (((uintptr_t) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
+++ offset = ((uintptr_t) fi->template[fi->cur_no].data) >> 8;
++ iter_idx = fi->cur_no + offset;
++ if (fi->template[iter_idx].type == ITER)
++ {
++@@ -958,8 +959,8 @@
++ register int size;
++ register int i;
++
++- unit = _UNIT ((int) fi->template[fi->cur_no].data);
++- number = _NUMBER ((int) fi->template[fi->cur_no].data);
+++ unit = _UNIT ((uintptr_t) fi->template[fi->cur_no].data);
+++ number = _NUMBER ((uintptr_t) fi->template[fi->cur_no].data);
++
++ i = fi->cur_no;
++ size = 0;
++@@ -1058,8 +1059,8 @@
++ register int iter_idx;
++
++ info->counter.is_byte_len =
++- (((int) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
++- offset = ((int)fi->template[fi->cur_no].data) >> 8;
+++ (((uintptr_t) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
+++ offset = ((uintptr_t)fi->template[fi->cur_no].data) >> 8;
++ iter_idx = fi->cur_no + offset;
++ if (fi->template[iter_idx].type == ITER)
++ {
++@@ -1105,8 +1106,8 @@
++ register size;
++ register i;
++
++- unit = _UNIT ((int) fi->template[fi->cur_no].data);
++- number = _NUMBER ((int) fi->template[fi->cur_no].data);
+++ unit = _UNIT ((uintptr_t) fi->template[fi->cur_no].data);
+++ number = _NUMBER ((uintptr_t) fi->template[fi->cur_no].data);
++
++ i = fi->cur_no;
++ size = 0;
++@@ -2350,8 +2351,8 @@
++ register int size;
++ register int i;
++
++- unit = _UNIT ((int) fi->template[cur_no].data);
++- number = _NUMBER ((int) fi->template[cur_no].data);
+++ unit = _UNIT ((uintptr_t) fi->template[cur_no].data);
+++ number = _NUMBER ((uintptr_t) fi->template[cur_no].data);
++
++ i = cur_no;
++ size = 0;
++
++diff -Naur chinput.orig/src/IMdkit/lib/IMValues.c chinput-3.0.2/src/IMdkit/lib/IMValues.c
++--- chinput.orig/src/IMdkit/lib/IMValues.c Sat Jul 1 21:01:01 2000
+++++ chinput-3.0.2/src/IMdkit/lib/IMValues.c Fri Nov 16 15:22:14 2001
++@@ -32,6 +32,7 @@
++ #include <X11/Xlib.h>
++ #include "IMdkit.h"
++ #include <stdarg.h>
+++#include <stdlib.h> /* malloc(3) ! */
++
++ #define Va_start(a,b) va_start(a,b)
++
diff --git a/app-i18n/chinput/files/digest-chinput-3.0.2 b/app-i18n/chinput/files/digest-chinput-3.0.2
new file mode 100644
index 000000000000..100833dfbe64
--- /dev/null
+++ b/app-i18n/chinput/files/digest-chinput-3.0.2
@@ -0,0 +1 @@
+MD5 7e0c8a9f6a253d4846e74782f395cd7f Chinput-3.0.2.tar.gz 485221
diff --git a/app-i18n/fcitx/ChangeLog b/app-i18n/fcitx/ChangeLog
new file mode 100644
index 000000000000..59620c26b10b
--- /dev/null
+++ b/app-i18n/fcitx/ChangeLog
@@ -0,0 +1,9 @@
+# ChangeLog for app-i18n/fcitx
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/fcitx/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*fcitx-1.8.5 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> fcitx-1.8.5.ebuild:
+ New ebuild for Chinese Input for X
+
diff --git a/app-i18n/fcitx/Manifest b/app-i18n/fcitx/Manifest
index 49fee20e30f8..f3ba516a6cdc 100644
--- a/app-i18n/fcitx/Manifest
+++ b/app-i18n/fcitx/Manifest
@@ -1,2 +1,3 @@
-MD5 9c8edc11013bcc0f2b6cf91603905461 fcitx-1.8.5.ebuild 686
+MD5 59c216c8e9d5ce102693655e6e391bb1 fcitx-1.8.5.ebuild 783
+MD5 1c9ec85a8d00d5871a4b683de0ef5c21 ChangeLog 346
MD5 9ae1f3d5714643599037127042dfb979 files/digest-fcitx-1.8.5 64
diff --git a/app-i18n/fcitx/fcitx-1.8.5.ebuild b/app-i18n/fcitx/fcitx-1.8.5.ebuild
new file mode 100644
index 000000000000..48205381b586
--- /dev/null
+++ b/app-i18n/fcitx/fcitx-1.8.5.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/fcitx/fcitx-1.8.5.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+DESCRIPTION="Free Chinese Input Toy for X. Another Chinese XIM Input Method"
+HOMEPAGE="http://www.fcitx.org/"
+SRC_URI="http://www.fcitx.org/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="truetype"
+
+DEPEND="virtual/x11
+ truetype? ( virtual/xft )"
+
+S=${WORKDIR}/${P}
+
+src_compile() {
+ if [ -n "`use truetype`" ]; then
+ make -f Makefile.xft || die "xft make failed"
+ else
+ make || die "make failed"
+ fi
+}
+
+src_install() {
+ dobin fcitx
+ insinto /usr/share/fcitx
+ doins data/*.mb
+
+ dodoc doc/ChangLog.txt doc/cjkvinput.txt
+ dohtml doc/*.htm
+}
+
diff --git a/app-i18n/fcitx/files/digest-fcitx-1.8.5 b/app-i18n/fcitx/files/digest-fcitx-1.8.5
new file mode 100644
index 000000000000..c9966bd44595
--- /dev/null
+++ b/app-i18n/fcitx/files/digest-fcitx-1.8.5
@@ -0,0 +1 @@
+MD5 c2b7c48b906c4812f305fc9f5a605458 fcitx-1.8.5.tar.bz2 948478
diff --git a/app-i18n/jmcce/ChangeLog b/app-i18n/jmcce/ChangeLog
new file mode 100644
index 000000000000..6ad8e4b7ca97
--- /dev/null
+++ b/app-i18n/jmcce/ChangeLog
@@ -0,0 +1,9 @@
+# ChangeLog for app-i18n/jmcce
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/jmcce/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*jmcce-1.4_rc2 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> jmcce-1.4_rc2.ebuild:
+ new ebuild for console based chinese input
+
diff --git a/app-i18n/jmcce/Manifest b/app-i18n/jmcce/Manifest
index e4883c471c35..102ca60dd391 100644
--- a/app-i18n/jmcce/Manifest
+++ b/app-i18n/jmcce/Manifest
@@ -1,2 +1,3 @@
-MD5 87d815a7e73f959d35c501e6aa86d3c1 jmcce-1.4_rc2.ebuild 796
+MD5 15613ab1e0dacff60930f224c8ba603e jmcce-1.4_rc2.ebuild 895
+MD5 a77fe88ee9ce9da860af7c2239c0baca ChangeLog 358
MD5 e77919af8495197697785325e0809b82 files/digest-jmcce-1.4_rc2 65
diff --git a/app-i18n/jmcce/files/digest-jmcce-1.4_rc2 b/app-i18n/jmcce/files/digest-jmcce-1.4_rc2
new file mode 100644
index 000000000000..b8d4a54fcb6f
--- /dev/null
+++ b/app-i18n/jmcce/files/digest-jmcce-1.4_rc2
@@ -0,0 +1 @@
+MD5 cc90be0e97920f9d597e795a13bc9806 jmcce-1.4RC2.tar.gz 6420069
diff --git a/app-i18n/jmcce/jmcce-1.4_rc2.ebuild b/app-i18n/jmcce/jmcce-1.4_rc2.ebuild
new file mode 100644
index 000000000000..8b177a2c06b3
--- /dev/null
+++ b/app-i18n/jmcce/jmcce-1.4_rc2.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/jmcce/jmcce-1.4_rc2.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+MY_PV=${PV/_rc/RC}
+S=${WORKDIR}/${PN}-${MY_PV}
+DESCRIPTION="A Chinese Console supporting BIG5, GB and Japanese input."
+HOMEPAGE="http://jmcce.slat.org"
+SRC_URI="http://zope.slat.org/Project/Jmcce/DOWNLOAD/${PN}-${MY_PV}.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~x86"
+IUSE=""
+
+DEPEND=">=media-libs/svgalib-1.4.3
+ >=sys-libs/ncurses-4.2"
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+src_compile() {
+ cd ${S}
+
+ ./genconf.sh
+ econf --sysconfdir=/etc/jmcce
+ emake || die "make failed"
+}
+
+src_install() {
+ dodir /etc/jmcce
+
+ make DESTDIR=${D} install || die "install failed"
+
+ dodir /usr/share/doc
+ mv ${D}/usr/share/doc/jmcce-1.4RC2 ${D}/usr/share/doc/${PF}
+ doman doc/jmcce.1
+}
+
+
diff --git a/app-i18n/scim-chinese/ChangeLog b/app-i18n/scim-chinese/ChangeLog
new file mode 100644
index 000000000000..62d41a65613e
--- /dev/null
+++ b/app-i18n/scim-chinese/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for app-i18n/scim-chinese
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/scim-chinese/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*scim-chinese-0.2.1 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> scim-chinese-0.2.1.ebuild:
+ Initial ebuild. Distribution of this ebuild is allowed by the author, but
+ the binary must not be mirrored or used for commercial purposes.
+
diff --git a/app-i18n/scim-chinese/Manifest b/app-i18n/scim-chinese/Manifest
index e6fec17e475c..25ac193e082d 100644
--- a/app-i18n/scim-chinese/Manifest
+++ b/app-i18n/scim-chinese/Manifest
@@ -1,2 +1,3 @@
-MD5 ec89113f717253683f6b15185c8df93d scim-chinese-0.2.1.ebuild 625
+MD5 ec0910b91206e56881d37fdc5ca60005 scim-chinese-0.2.1.ebuild 1572
+MD5 e7c9042678ec32bb282ea24ad9cd7803 ChangeLog 480
MD5 711ddeffc04e00fc58aae25eb1f6e5d5 files/digest-scim-chinese-0.2.1 75
diff --git a/app-i18n/scim-chinese/files/digest-scim-chinese-0.2.1 b/app-i18n/scim-chinese/files/digest-scim-chinese-0.2.1
new file mode 100644
index 000000000000..4b39e70c8ecf
--- /dev/null
+++ b/app-i18n/scim-chinese/files/digest-scim-chinese-0.2.1
@@ -0,0 +1 @@
+MD5 dfcc5ac6aa0bfdd7289b18dfb041d6a4 scim-chinese-0.2.1-1.i586.rpm 1619241
diff --git a/app-i18n/scim-chinese/scim-chinese-0.2.1.ebuild b/app-i18n/scim-chinese/scim-chinese-0.2.1.ebuild
new file mode 100644
index 000000000000..7c41ac07e80c
--- /dev/null
+++ b/app-i18n/scim-chinese/scim-chinese-0.2.1.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/scim-chinese/scim-chinese-0.2.1.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+DESCRIPTION="Smart Common Input Method (SCIM) Closed Source Pinyin Input Method"
+HOMEPAGE="http://www.gnuchina.org/~suzhe/scim/"
+SRC_URI="http://www.gnuchina.org/~suzhe/scim/scim-chinese/${P}-1.i586.rpm"
+
+LICENSE="scim-chinese"
+SLOT="0"
+KEYWORDS="~x86 -*"
+IUSE=""
+
+RDEPEND="virtual/x11
+ >=app-i18n/scim-0.4.1"
+
+DEPEND="${RDEPEND}
+ app-arch/rpm"
+
+S=${WORKDIR}
+
+src_unpack() {
+ cd ${S}
+ rpm2cpio ${DISTDIR}/${A} | cpio -i --make-directories
+}
+
+src_compile() {
+ return
+}
+
+dosym_r() {
+ srcdir=$1
+ dstdir=$2
+
+ for x in `find ${D}${srcdir}`; do
+ dst=${dstdir}${x#$D$srcdir}
+ src=${x#$D}
+ einfo "Linking $src to $dst"
+ if [ ! -d "`dirname $D$dst`" ]; then
+ dodir ${dst}
+ fi
+ dosym $src $dst
+ done
+
+}
+
+src_install() {
+ # get installed scim version
+ SCIM_VER=$(scim -h | grep "Smart Common Input Method" | awk '{print $5}')
+
+ # install into /opt because this is binary-only
+ PREFIX=/opt/scim-chinese
+
+ cd ${S}
+ insinto ${PREFIX}/lib/scim-1.0/Server
+ doins usr/lib/scim-1.0/Server/*
+ dosym_r ${PREFIX}/lib/scim-1.0/Server /usr/lib/scim-1.0/${SCIM_VER}/Server
+
+ insinto ${PREFIX}/share/scim/chinese
+ doins usr/share/scim/chinese/*
+ dosym_r ${PREFIX}/share/scim/chinese /usr/share/scim/chinese
+
+ insinto /etc/gconf/schemas
+ doins etc/gconf/schemas/*
+ dodoc usr/share/doc/packages/scim-chinese-0.2.1/{AUTHORS,COPYING,README}
+}
diff --git a/app-i18n/scim-tables/ChangeLog b/app-i18n/scim-tables/ChangeLog
new file mode 100644
index 000000000000..6c1518630f14
--- /dev/null
+++ b/app-i18n/scim-tables/ChangeLog
@@ -0,0 +1,9 @@
+# ChangeLog for app-i18n/scim-tables
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/scim-tables/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*scim-tables-0.2.1 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> scim-tables-0.2.1.ebuild:
+ New ebuild needed for SCIM
+
diff --git a/app-i18n/scim-tables/Manifest b/app-i18n/scim-tables/Manifest
index 9f4d0d2594a8..8dfe3a4bee6d 100644
--- a/app-i18n/scim-tables/Manifest
+++ b/app-i18n/scim-tables/Manifest
@@ -1,2 +1,3 @@
-MD5 e737b6974124db6debc9ddec38c88dc7 scim-tables-0.2.1.ebuild 586
+MD5 b212c0e0ba83ea434b2c5d3d3798e059 scim-tables-0.2.1.ebuild 695
+MD5 c6586c8512dcc45be20851ca49b1bbeb ChangeLog 362
MD5 c6de8b28ebe045b1ce480db4994024ec files/digest-scim-tables-0.2.1 70
diff --git a/app-i18n/scim-tables/files/digest-scim-tables-0.2.1 b/app-i18n/scim-tables/files/digest-scim-tables-0.2.1
new file mode 100644
index 000000000000..7049ee7bb7a3
--- /dev/null
+++ b/app-i18n/scim-tables/files/digest-scim-tables-0.2.1
@@ -0,0 +1 @@
+MD5 491cb1b5a5d978dea1af7b2ee5e1f2e2 scim-tables-0.2.1.tar.gz 1424174
diff --git a/app-i18n/scim-tables/scim-tables-0.2.1.ebuild b/app-i18n/scim-tables/scim-tables-0.2.1.ebuild
new file mode 100644
index 000000000000..7bfc167fb619
--- /dev/null
+++ b/app-i18n/scim-tables/scim-tables-0.2.1.ebuild
@@ -0,0 +1,27 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/scim-tables/scim-tables-0.2.1.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+DESCRIPTION="Smart Common Input Method (SCIM) Generic Table Input Method Server"
+HOMEPAGE="http://www.gnuchina.org/~suzhe/scim/"
+SRC_URI="http://www.gnuchina.org/~suzhe/scim/sources/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+RESTRICT="nomirror"
+
+DEPEND=">=app-i18n/scim-0.4.1"
+
+S=${WORKDIR}/${P}
+
+src_compile() {
+ econf ${myconf}
+ emake || "make failed"
+}
+
+src_install() {
+ einstall || "install failed"
+ dodoc README ChangeLog AUTHORS
+}
diff --git a/app-i18n/scim/ChangeLog b/app-i18n/scim/ChangeLog
new file mode 100644
index 000000000000..30f8f93cac18
--- /dev/null
+++ b/app-i18n/scim/ChangeLog
@@ -0,0 +1,9 @@
+# ChangeLog for app-i18n/scim
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/scim/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*scim-0.4.1 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> scim-0.4.1.ebuild:
+ New ebuild of another Chinese Input System
+
diff --git a/app-i18n/scim/Manifest b/app-i18n/scim/Manifest
index 1442631c6df8..4d67de6d3b07 100644
--- a/app-i18n/scim/Manifest
+++ b/app-i18n/scim/Manifest
@@ -1,2 +1,3 @@
-MD5 b6e31745660428557285d282a39f40be scim-0.4.1.ebuild 923
+MD5 2b539734f86121d1f60c824ae9d940c8 scim-0.4.1.ebuild 1057
+MD5 469107447c6f6e3b3d9755c8b7f5a6c3 ChangeLog 350
MD5 8cd8761fc85ac6df2a99fb43620d2c8c files/digest-scim-0.4.1 63
diff --git a/app-i18n/scim/files/digest-scim-0.4.1 b/app-i18n/scim/files/digest-scim-0.4.1
new file mode 100644
index 000000000000..b142b4be10dd
--- /dev/null
+++ b/app-i18n/scim/files/digest-scim-0.4.1
@@ -0,0 +1 @@
+MD5 5bdc752b5cfb18714f1ba25698a75804 scim-0.4.1.tar.gz 1194758
diff --git a/app-i18n/scim/scim-0.4.1.ebuild b/app-i18n/scim/scim-0.4.1.ebuild
new file mode 100644
index 000000000000..ab37017bc1d7
--- /dev/null
+++ b/app-i18n/scim/scim-0.4.1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/scim/scim-0.4.1.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+inherit gnome2
+
+DESCRIPTION="Smart Common Input Method (SCIM) is a Input Method (IM) development platform"
+HOMEPAGE="http://www.gnuchina.org/~suzhe/scim/"
+SRC_URI="http://www.gnuchina.org/~suzhe/scim/sources/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE="gtk"
+
+RDEPEND="virtual/x11
+ >=gnome-base/gconf-1.2
+ >=dev-libs/libxml2-2.5
+ >=gnome-base/ORBit2-2.5
+ gtk? ( >=x11-libs/gtk+-2
+ >=dev-libs/atk-1
+ >=x11-libs/pango-1
+ >=dev-libs/glib-2 )"
+PDEPEND=">=app-i18n/scim-tables-0.2.1"
+
+DEPEND="${RDEPEND}
+ dev-lang/perl"
+
+
+S=${WORKDIR}/${P}
+
+src_compile() {
+ local myconf
+ use gtk || myconf="--disable-gtk2-immodule"
+ econf ${myconf}
+ emake || "make failed"
+}
+
+src_install() {
+ einstall || "install failed"
+ dodoc README AUTHORS ChangeLog docs/developers docs/scim.cfg
+ dohtml -r docs/html/*
+}
+
+SCROLLKEEPER_UPDATE="0"
diff --git a/app-i18n/unicon/ChangeLog b/app-i18n/unicon/ChangeLog
new file mode 100644
index 000000000000..4dc60bb78f14
--- /dev/null
+++ b/app-i18n/unicon/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for app-i18n/unicon
+# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/unicon/ChangeLog,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+*unicon-3.0.4 (25 May 2003)
+
+ 25 May 2003; Alastair Tse <liquidx@gentoo.org> unicon-3.0.4.ebuild,
+ files/unicon-3.0.4-debian.patch, files/unicon-3.0.4-gentoo.patch:
+ New ebuild. Contains required IM methods for Chinput.
+
diff --git a/app-i18n/unicon/Manifest b/app-i18n/unicon/Manifest
index a8388139a533..471755c86117 100644
--- a/app-i18n/unicon/Manifest
+++ b/app-i18n/unicon/Manifest
@@ -1,4 +1,5 @@
-MD5 6deeec9300fbdd3f0d0267938730c3ac unicon-3.0.4.ebuild 1362
+MD5 e9c00930ce6c6190c0b74f748387042f unicon-3.0.4.ebuild 1505
+MD5 e738bbb245fc3ce2b399dbe13481cdb0 ChangeLog 437
MD5 e69f90a124ed00f574cc5ae111df1bd7 files/digest-unicon-3.0.4 66
MD5 cc6f3b807859a0d79f19b3f649de45b5 files/unicon-3.0.4-debian.patch 59606
MD5 31b30bcac54f35d0a41f969075a136de files/unicon-3.0.4-gentoo.patch 302
diff --git a/app-i18n/unicon/files/digest-unicon-3.0.4 b/app-i18n/unicon/files/digest-unicon-3.0.4
new file mode 100644
index 000000000000..bf0cbd907c9b
--- /dev/null
+++ b/app-i18n/unicon/files/digest-unicon-3.0.4
@@ -0,0 +1 @@
+MD5 b8c9a0aa908c4be8108578f5d4a19fe5 unicon-3.0.4.tar.bz2 5300843
diff --git a/app-i18n/unicon/files/unicon-3.0.4-debian.patch b/app-i18n/unicon/files/unicon-3.0.4-debian.patch
new file mode 100644
index 000000000000..fbbf2f498158
--- /dev/null
+++ b/app-i18n/unicon/files/unicon-3.0.4-debian.patch
@@ -0,0 +1,2087 @@
+--- unicon-3.0.4.orig/fonts/gb/Makefile.in
++++ unicon-3.0.4/fonts/gb/Makefile.in
+@@ -2,6 +2,7 @@
+ CFLAGS = @CFLAGS@
+ CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
+ PROG = encode-gb.o
++DESTDIR =
+
+ CC=gcc $(CFLAGS)
+ MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
+--- unicon-3.0.4.orig/fonts/gb/Makefile
++++ unicon-3.0.4/fonts/gb/Makefile
+@@ -0,0 +1,25 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
++PROG = encode-gb.o
++DESTDIR =
++
++CC=gcc $(CFLAGS)
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++
++all: $(PROG)
++
++$(PROG): encode-gb.mo
++ ld -m elf_i386 -r encode-gb.mo -o $(PROG)
++encode-gb.mo: font_gb16.h encode-gb.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c encode-gb.c -o encode-gb.mo
++
++clean:
++ rm -f a.out *.bak *.o *~ core encode-gb.mo $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
++
++install: all
++ sh install_module.sh $(PROG)
+--- unicon-3.0.4.orig/fonts/gbk/Makefile.in
++++ unicon-3.0.4/fonts/gbk/Makefile.in
+@@ -2,6 +2,7 @@
+ CFLAGS = @CFLAGS@
+ CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
+ PROG = encode-gbk.o
++DESTDIR =
+
+ CC=gcc $(CFLAGS)
+ MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
+--- unicon-3.0.4.orig/fonts/gbk/Makefile
++++ unicon-3.0.4/fonts/gbk/Makefile
+@@ -0,0 +1,25 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
++PROG = encode-gbk.o
++DESTDIR =
++
++CC=gcc $(CFLAGS)
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++
++all: $(PROG)
++
++$(PROG): encode-gbk.mo
++ ld -m elf_i386 -r encode-gbk.mo -o $(PROG)
++encode-gbk.mo: font_gbk16.h encode-gbk.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c encode-gbk.c -o encode-gbk.mo
++
++clean:
++ rm -f a.out *.bak *.o *.mo *~ core encode-gb.mo $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
++
++install: all
++ sh install_module.sh $(PROG)
+--- unicon-3.0.4.orig/fonts/jis/Makefile.in
++++ unicon-3.0.4/fonts/jis/Makefile.in
+@@ -2,6 +2,7 @@
+ CFLAGS = @CFLAGS@
+ CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
+ PROG = encode-jis.o
++DESTDIR =
+
+ CC=gcc $(CFLAGS)
+ MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
+--- unicon-3.0.4.orig/fonts/jis/Makefile
++++ unicon-3.0.4/fonts/jis/Makefile
+@@ -0,0 +1,25 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
++PROG = encode-jis.o
++DESTDIR =
++
++CC=gcc $(CFLAGS)
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++
++all: $(PROG)
++
++$(PROG): encode-jis.mo
++ ld -m elf_i386 -r encode-jis.mo -o $(PROG)
++encode-jis.mo: font_jis16.h encode-jis.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c encode-jis.c -o encode-jis.mo
++
++clean:
++ rm -f a.out core *.bak *.o *~ *.mo $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
++
++install: all
++ sh install_module.sh $(PROG)
+--- unicon-3.0.4.orig/fonts/big5/Makefile.in
++++ unicon-3.0.4/fonts/big5/Makefile.in
+@@ -2,6 +2,7 @@
+ CFLAGS = @CFLAGS@
+ CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
+ PROG = encode-big5.o
++DESTDIR=
+
+ KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
+
+--- unicon-3.0.4.orig/fonts/big5/Makefile
++++ unicon-3.0.4/fonts/big5/Makefile
+@@ -0,0 +1,27 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
++PROG = encode-big5.o
++DESTDIR=
++
++KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
++
++CC=gcc $(CFLAGS)
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++
++all: $(PROG)
++
++$(PROG): encode-big5.mo
++ ld -m elf_i386 -r encode-big5.mo -o $(PROG)
++encode-big5.mo: font_big5_16.h encode-big5.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c encode-big5.c -o encode-big5.mo
++
++clean:
++ rm -f a.out *.bak *.o *.mo core *~ $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
++
++install: all
++ sh install_module.sh $(PROG)
+--- unicon-3.0.4.orig/fonts/kscm/Makefile.in
++++ unicon-3.0.4/fonts/kscm/Makefile.in
+@@ -2,6 +2,7 @@
+ CFLAGS = @CFLAGS@
+ CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
+ PROG = encode-kscm.o
++DESTDIR =
+
+ CC=gcc $(CFLAGS)
+ MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
+--- unicon-3.0.4.orig/fonts/kscm/Makefile
++++ unicon-3.0.4/fonts/kscm/Makefile
+@@ -0,0 +1,26 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I/usr/src/linux/include -I. -include /usr/src/linux/include/linux/modversions.h
++PROG = encode-kscm.o
++DESTDIR =
++
++CC=gcc $(CFLAGS)
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++
++all: $(PROG)
++
++$(PROG): encode-kscm.mo
++ ld -m elf_i386 -r encode-kscm.mo -o $(PROG)
++encode-kscm.mo: font_kscm16.h encode-kscm.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c encode-kscm.c -o encode-kscm.mo
++
++clean:
++ rm -f a.out *.bak *.o core *~ *.mo $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
++
++install: all
++ sh install_module.sh $(PROG)
++
+--- unicon-3.0.4.orig/fonts/Makefile
++++ unicon-3.0.4/fonts/Makefile
+@@ -0,0 +1,33 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++all:
++ cd big5; make
++ cd gb; make
++ cd gbk; make
++ cd kscm; make
++ cd jis; make
++
++install: all
++ cd big5; make install
++ cd gb; make install
++ cd gbk; make install
++ cd kscm; make install
++ cd jis; make install
++
++clean:
++ cd big5; make clean
++ cd gb; make clean
++ cd gbk; make clean
++ cd jis; make clean
++ cd kscm; make clean
++ rm -f *.bak core *~
++
++distclean: clean
++ rm -f config.status config.log config.cache Makefile
++ cd big5; make distclean
++ cd gb; make distclean
++ cd gbk; make distclean
++ cd jis; make distclean
++ cd kscm; make distclean
++ rm -f *.bak core tags TAGS
++
+--- unicon-3.0.4.orig/tools/Makefile
++++ unicon-3.0.4/tools/Makefile
+@@ -0,0 +1,26 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++LIBDIR=$(prefix)/lib/unicon
++CFLAGS = -g -O2
++CFLAGS += -I. -I../include
++PROG = uniconcfg uniconctrl
++
++CC=gcc $(CFLAGS)
++
++all: $(PROG)
++uniconcfg:
++ $(CC) -lnewt uniconcfg.c -o uniconcfg
++uniconctrl:
++ $(CC) uniconctrl.c -o uniconctrl
++clean:
++ rm -f a.out *.bak *.o core *~ $(PROG)
++
++install: all
++ mkdir -p $(prefix)/bin $(LIBDIR)/bin
++ install -o root -g root -m755 uniconcfg $(LIBDIR)/bin/uniconcfg
++ install -o root -g root -m755 uniconctrl $(LIBDIR)/bin/uniconctrl
++ ln -sf $(prefix)/lib/unicon/bin/uniconctrl /usr/bin/uniconctrl
++ ln -sf $(prefix)/lib/unicon/bin/uniconcfg /usr/bin/uniconcfg
++
++distclean: clean
++ rm -f Makefile tags TAGS
+--- unicon-3.0.4.orig/Makefile.in
++++ unicon-3.0.4/Makefile.in
+@@ -1,10 +1,10 @@
+ prefix=@prefix@
+ all:
+- cd unikey; make
+- cd fonts; make
++# cd unikey; make
++# cd fonts; make
+ cd unicon; make
+- cd tools; make
+- cd unimap; make
++# cd tools; make
++# cd unimap; make
+
+ data:
+ cd unicon; make data
+@@ -17,26 +17,26 @@
+ if [ ! -d $(prefix)/lib/unicon ] ; then mkdir -p $(prefix)/lib/unicon; fi
+ if [ ! -d $(prefix)/bin ] ; then mkdir -p $(prefix)/bin; fi
+ cd unicon; make install
+- cd unikey; make install
+- cd fonts; make install
+- cd tools; make install
+- cd unimap; make install
++# cd unikey; make install
++# cd fonts; make install
++# cd tools; make install
++# cd unimap; make install
+
+ clean:
+ cd unicon; make clean
+- cd unikey; make clean
+- cd fonts; make clean
+- cd tools; make clean
+- cd unimap; make clean
++# cd unikey; make clean
++# cd fonts; make clean
++# cd tools; make clean
++# cd unimap; make clean
+ rm -f core *.bak *~
+
+ distclean: clean
+ rm -f config.status config.log config.cache Makefile
+ cd unicon; make distclean
+- cd unikey; make distclean
+- cd fonts; make distclean
+- cd tools; make distclean
+- cd sfonts; make distclean
+- cd unimap; make distclean
++# cd unikey; make distclean
++# cd fonts; make distclean
++# cd tools; make distclean
++# cd sfonts; make distclean
++# cd unimap; make distclean
+ rm -f *.bak
+
+--- unicon-3.0.4.orig/sfonts/tools/Makefile
++++ unicon-3.0.4/sfonts/tools/Makefile
+@@ -0,0 +1,36 @@
++# Generated automatically from Makefile.in by configure.
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++PROG = sfont
++OBJS = main.o sfont.o filter.o encode-gb.o encode-gbk.o \
++ encode-big5.o encode-jis.o encode-kscm.o
++FONT_PATH=../../fonts
++CC=gcc -g $(CFLAGS) -I. -I../../include
++
++all: $(PROG)
++
++$(PROG): $(OBJS)
++ $(CC) $(OBJS) -o $(PROG)
++main.o: main.cpp
++ $(CC) -c main.cpp -o main.o
++filter.o: filter.cpp filter.hpp
++ $(CC) -c filter.cpp -o filter.o
++sfont.o: sfont.cpp sfont.hpp
++ $(CC) -c sfont.cpp -o sfont.o
++encode-gb.o : $(FONT_PATH)/gb/encode-gb.c $(FONT_PATH)/gb/font_gb16.h
++ $(CC) -c -I$(FONT_PATH)/gb $(FONT_PATH)/gb/encode-gb.c -o encode-gb.o
++encode-gbk.o : $(FONT_PATH)/gbk/encode-gbk.c $(FONT_PATH)/gbk/font_gbk16.h
++ $(CC) -c -I$(FONT_PATH)/gbk $(FONT_PATH)/gbk/encode-gbk.c -o encode-gbk.o
++encode-big5.o : $(FONT_PATH)/big5/encode-big5.c $(FONT_PATH)/big5/font_big5_16.h
++ $(CC) -c -I$(FONT_PATH)/big5 $(FONT_PATH)/big5/encode-big5.c -o encode-big5.o
++encode-jis.o : $(FONT_PATH)/jis/encode-jis.c $(FONT_PATH)/jis/font_jis16.h
++ $(CC) -c -I$(FONT_PATH)/jis $(FONT_PATH)/jis/encode-jis.c -o encode-jis.o
++encode-kscm.o : $(FONT_PATH)/kscm/encode-kscm.c $(FONT_PATH)/kscm/font_kscm16.h
++ $(CC) -c -I$(FONT_PATH)/kscm $(FONT_PATH)/kscm/encode-kscm.c -o encode-kscm.o
++
++clean:
++ rm -f a.out *.bak *.o core *~ $(PROG)
++
++distclean: clean
++ rm -f Makefile
+--- unicon-3.0.4.orig/sfonts/genfont/Makefile
++++ unicon-3.0.4/sfonts/genfont/Makefile
+@@ -0,0 +1,52 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I.
++
++CC=gcc $(CFLAGS)
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++PROG = gb gbk big5 jis kscm
++
++all: $(PROG)
++
++# GB
++gb: sencode-gb.mo
++ ld -m elf_i386 -r sencode-gb.mo -o sencode-gb.o
++sencode-gb.mo: sencode-gb.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c sencode-gb.c -o sencode-gb.mo
++
++# GBK
++gbk: sencode-gbk.mo
++ ld -m elf_i386 -r sencode-gbk.mo -o sencode-gbk.o
++sencode-gbk.mo: sencode-gbk.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c sencode-gbk.c -o sencode-gbk.mo
++
++# Big5
++big5: sencode-big5.mo
++ ld -m elf_i386 -r sencode-big5.mo -o sencode-big5.o
++sencode-big5.mo: sencode-big5.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c sencode-big5.c -o sencode-big5.mo
++
++# JIS
++jis: sencode-jis.mo
++ ld -m elf_i386 -r sencode-jis.mo -o sencode-jis.o
++sencode-jis.mo: sencode-jis.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c sencode-jis.c -o sencode-jis.mo
++
++# JIS
++kscm: sencode-kscm.mo
++ ld -m elf_i386 -r sencode-kscm.mo -o sencode-kscm.o
++sencode-kscm.mo: sencode-jis.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c sencode-kscm.c -o sencode-kscm.mo
++
++clean:
++ rm -f a.out *.bak *.o core *~ sencode-gb.mo $(PROG)
++
++distclean: clean
++ rm -f Makefile
++ rm -f *.h
++
++install: all
++ mkdir -p /lib/modules/`uname -a|awk '{print $$3}'`/misc
++ cp -f $(PROG) /lib/modules/`uname -a|awk '{print $$3}'`/misc
++
+--- unicon-3.0.4.orig/sfonts/Makefile
++++ unicon-3.0.4/sfonts/Makefile
+@@ -0,0 +1,29 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CC=gcc $(CFLAGS)
++PROG = tools
++
++all: $(PROG)
++
++tools:
++ cd tools; make
++
++# run genfont manual
++genfont:
++ cd genfont; make
++
++clean:
++ rm -f *.bak *.o *~ core
++ cd tools; make clean
++ cd genfont; make clean
++
++
++distclean: clean
++ rm -f Makefile tags TAGS
++ cd tools; make distclean
++ cd genfont; make distclean
++
++install: all
++ cd tools; make install
++ cd genfont; make install
++
+--- unicon-3.0.4.orig/unicon/client/Makefile.in
++++ unicon-3.0.4/unicon/client/Makefile.in
+@@ -34,8 +34,8 @@
+ g++ $(CFLAGS) -D__DLL_SUPPORT__ -ldl -lpth test.cpp $(PROG_LIB) $(SERVER_LIB) -o test
+
+ install: all
+- mkdir -p $(prefix)/lib/unicon
+- cp -f $(PROG_LIB) $(prefix)/lib/unicon
++# mkdir -p $(prefix)/lib
++ cp -f $(PROG_LIB) $(prefix)/lib
+ clean:
+ rm -f *.o a.out core *~ *.bak $(PROG_LIB) $(PROG)
+
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/Makefile.in
++++ unicon-3.0.4/unicon/ImmModules/cce/Makefile.in
+@@ -6,7 +6,7 @@
+ CCE_OBJS = xl_hzinput.o CCE_hzinput.o intcode.o \
+ xl_pinyin.o CCE_pinyin.o
+
+-CFLAGS = -g -O2 -fomit-frame-pointer -W -Wall -I. -I../../include
++CFLAGS = -fPIC -g -O2 -fomit-frame-pointer -W -Wall -I. -I../../include
+
+ all: cce_hzinput.so cce_pinyin.so gb18030_intcode.so
+
+@@ -15,14 +15,14 @@
+ xl_hzinput.o : xl_hzinput.c
+ gcc $(CFLAGS) -c xl_hzinput.c -o xl_hzinput.o
+ cce_hzinput.so: CCE_hzinput.o xl_hzinput.o
+- gcc CCE_hzinput.o xl_hzinput.o -shared -o cce_hzinput.so
++ gcc CCE_hzinput.o xl_hzinput.o -fPIC -shared -o cce_hzinput.so
+
+ xl_pinyin.o : xl_pinyin.c xl_pinyin.h
+ gcc $(CFLAGS) -c xl_pinyin.c -o xl_pinyin.o
+ CCE_pinyin.o : CCE_pinyin.c
+ gcc $(CFLAGS) -c CCE_pinyin.c -o CCE_pinyin.o
+ cce_pinyin.so : xl_pinyin.o CCE_pinyin.o
+- gcc CCE_pinyin.o xl_pinyin.o -shared -o cce_pinyin.so
++ gcc CCE_pinyin.o xl_pinyin.o -fPIC -shared -o cce_pinyin.so
+
+ intcode.o : xl_intcode.c
+ gcc $(CFLAGS) -c xl_intcode.c -o intcode.o
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/inputs/Makefile.in
++++ unicon-3.0.4/unicon/ImmModules/cce/inputs/Makefile.in
+@@ -2,7 +2,7 @@
+ prefix=@prefix@
+ CFLAGS = @CFLAGS@
+
+-CFLAGS += -I. -I..
++CFLAGS += -O2 -I. -I..
+
+ LIBDIR = $(prefix)/lib/unicon
+ LD = gcc $(CFLAGS)
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/inputs/cin2dat.c
++++ unicon-3.0.4/unicon/ImmModules/cce/inputs/cin2dat.c
+@@ -114,7 +114,7 @@
+
+ /* qcmp2 compare two ITEM2 structure, according to its key1/key2/ch */
+ int
+-qcmp2 (ITEM2 * a, ITEM2 * b)
++qcmp2 (const ITEM2 * a, const ITEM2 * b)
+ {
+ if (a->key1 > b->key1)
+ return 1;
+@@ -134,7 +134,7 @@
+
+ /* qcmp compare two ITEM2 structure, according to its key1/key2/occur_seq */
+ int
+-qcmp (ITEM2 * a, ITEM2 * b)
++qcmp (const ITEM2 * a, const ITEM2 * b)
+ {
+ if (a->key1 > b->key1)
+ return 1;
+@@ -148,7 +148,7 @@
+ }
+
+ int
+-qcmp_ser (ITEM * a, ITEM * b)
++qcmp_ser (const ITEM * a, const ITEM * b)
+ {
+ if (a->ch > b->ch)
+ return 1;
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/inputs/cin2tab.c
++++ unicon-3.0.4/unicon/ImmModules/cce/inputs/cin2tab.c
+@@ -3,6 +3,7 @@
+ #include <stdarg.h>
+ #include <sys/types.h>
+ #include <string.h>
++#include <stdlib.h>
+ #include "xl_hzinput.h"
+
+ FILE *fr, *fw;
+@@ -114,7 +115,7 @@
+
+ /* qcmp2 compare two ITEM2 structure, according to its key1/key2/ch */
+ int
+-qcmp2 (ITEM2 * a, ITEM2 * b)
++qcmp2 (const ITEM2 * a, const ITEM2 * b)
+ {
+ if (a->key1 > b->key1)
+ return 1;
+@@ -152,7 +153,7 @@
+ }
+
+ int
+-qcmp_ser (ITEM * a, ITEM * b)
++qcmp_ser (const ITEM * a, const ITEM * b)
+ {
+ if (a->ch > b->ch)
+ return 1;
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/inputs/tab2txt.c
++++ unicon-3.0.4/unicon/ImmModules/cce/inputs/tab2txt.c
+@@ -71,7 +71,7 @@
+ exit (1);
+ }
+
+- if (fseek (in, -4, SEEK_END) == -1 ||
++ if (fseek (in, -sizeof(int), SEEK_END) == -1 ||
+ fread (&fsize, sizeof (int), 1, in) != 1 || fsize != ftell (in) - sizeof (int)) // error!!
+ {
+ fprintf (stderr, "%s is not a valid pinyin phrase file.\n", infile);
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/CCE_pinyin.c
++++ unicon-3.0.4/unicon/ImmModules/cce/CCE_pinyin.c
+@@ -44,6 +44,8 @@
+ extern void CCE_ClosePinyin (InputModule * p);
+ extern InputModule *pCCE_OpenPinyin (char *szPath);
+ extern void Pinyin_SaveAllPyUsrPhrase ();
++extern int SaveUsrPhrase(char *pathname);
++extern int SavePhraseFrequencyi(char *pathname);
+
+ static void
+ SetPhraseBuffer (PhraseItem * p, char *buf, int buflen)
+@@ -156,6 +158,12 @@
+ static int
+ IMM_Flush ()
+ {
++ char name[256];
++ sprintf(name,"%s/.pyinput/usrphrase.tab",getenv("HOME"));
++ SaveUsrPhrase(name);
++ sprintf(name,"%s/.pyinput/sysfrequency.tab",getenv("HOME"));
++ SavePhraseFrequency(name);
++
+ return 1;
+ }
+
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/xl_pinyin.c
++++ unicon-3.0.4/unicon/ImmModules/cce/xl_pinyin.c
+@@ -43,7 +43,8 @@
+
+ static int LoadPinyinTable (char *pathname);
+ static int SaveSysPhrase (char *pathname, int remove);
+-static int SaveUsrPhrase (char *pathname);
++//static int SaveUsrPhrase (char *pathname);
++int SaveUsrPhrase (char *pathname);
+ static int LoadUsrPhrase (char *pathname);
+ static int LoadSysPhrase (char *pathname);
+ static void FindMatchPhrase (InputModule * inmd, PYString pinyin[],
+@@ -59,11 +60,13 @@
+ // MAX_EACH_PY = 38 a[], b[], c[] ....
+ // map the pinyin to keys
+ static SysPhrase *sysph[MAX_PY_NUM]; // system phrases
+-static int sys_size;
++static int sys_size,sys_num;
+
+-static int FuzzyPinyin; // zh-ch-sh z-c-s
++static int FuzzyPinyin =0 ; // zh-ch-sh z-c-s
+ static UsrPhrase *usrph[MAX_PY_NUM]; //user defined phrase
+
++static int LoadPhraseFrequency(char *pathname);
++
+ /**************************************************************************
+ * Structure of the Char/Phrases *
+ * u_char len; // char/phrase len *
+@@ -134,7 +137,7 @@
+
+ //Rat: modified for processing user-defined dictionaries
+ if ((usrhome = getenv ("HOME")) != NULL)
+- {
++ {
+ sprintf (buf, "%s/%s", usrhome, ".pyinput");
+ retval = stat (buf, &statbuf);
+
+@@ -148,24 +151,24 @@
+ {
+ if ( statbuf.st_size < MIN_USRPHR_SIZE || LoadUsrPhrase (buf) == -1)
+ {
+- printf ("Couldn't load %s. Please fix it.\n", buf);
+- sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
+- if ((retval = access (buf, R_OK)) == 0)
+- {
+- if (LoadUsrPhrase (buf) == -1)
+- printf ("Couldn't load %s. Please fix it.\n",
+- buf);
++ printf ("Couldn't load %s. Please fix it. size or load error\n", buf);
++ sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
++ if ((retval = access (buf, R_OK)) == 0)
++ {
++ if (LoadUsrPhrase (buf) == -1)
++ printf ("Couldn't load %s. Please fix it. sysfile\n",
++ buf);
++ }
++ }
+ }
+- }
+- }
+- else
+- {
+- creat (buf, 0600);
+- sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
++ else
++ {
++ creat (buf, 0600);
++ sprintf (buf, "%s/%s", szPath, "usrphrase.tab");
+ if ((retval = access (buf, R_OK)) == 0)
+ {
+ if (LoadUsrPhrase (buf) == -1)
+- printf ("Couldn't load %s. Please fix it.\n", buf);
++ printf ("Couldn't load %s. Please fix it. couldn't access\n", buf);
+ }
+ }
+ }
+@@ -186,7 +189,7 @@
+ {
+ if (LoadUsrPhrase (buf) == -1)
+ {
+- printf ("Couldn't load %s. Please fix it.\n", buf);
++ printf ("Couldn't load %s. Please fix it. create\n", buf);
+ }
+ }
+ }
+@@ -207,6 +210,13 @@
+
+ }
+
++ sprintf(buf,"%s/%s/%s",usrhome,".pyinput","sysfrequency.tab");
++ if(LoadPhraseFrequency(buf) == -1)
++ {
++ creat(buf,0700);
++ SavePhraseFrequency(buf);
++ }
++
+ return 1;
+ }
+
+@@ -265,7 +275,8 @@
+ }
+
+ /* need to combine the same pinyin/phrases */
+-static int
++//static int
++int
+ SaveUsrPhrase (char *pathname)
+ {
+ int i, tmpcount;
+@@ -340,6 +351,53 @@
+ return 0;
+ }
+
++int SavePhraseFrequency(char *pathname)
++{
++ FILE *stream;
++ Phrase *sph;
++ SysPhrase *sysph_tmp;
++ char *f;
++ char *p;
++ int i,j,k,index,pcount;
++
++ if ( (stream = fopen(pathname , "wb" )) == NULL )
++ {
++ fatal("%s file can't open\n",pathname);
++ return -1;
++ }
++
++ f = (char *) malloc (sys_num);
++ memset (f, 0, sys_num);
++ pcount=0;
++
++ for(i = 1; i < MAX_PY_NUM; i++)
++ {
++ sysph_tmp = sysph[i];
++ assert (sysph_tmp != NULL);
++ p = (char*)sysph_tmp->phrase; // count = total pinyin number
++ for(j = 0; j < sysph_tmp->count; j++)
++ {
++ sph = (Phrase *)p;
++ assert (sph != NULL);
++ for(k = 0; k < sph->count; k++)
++ {
++ index = sph->len+1 + (2*sph->len+1)*k + 2*sph->len;
++ f[pcount]=sph->key[index];
++ pcount++;
++ }
++ p += SizeOfPhrase(sph->len,sph->count);
++ }
++ }
++ assert (pcount==sys_num);
++ fseek(stream,0,SEEK_SET);
++ fwrite(f, sys_num, 1, stream);
++ fwrite(&(sys_size),sizeof(int),1,stream);
++ fwrite(&(sys_num),sizeof(int),1,stream);
++ free(f);
++ fclose(stream);
++ return 0;
++}
++
+ // don't save the frequency information, all lost?
+ static int
+ SaveSysPhrase (char *pathname, int remove)
+@@ -483,6 +541,7 @@
+ fseek (stream, 0, SEEK_SET);
+ p = (char *) malloc (sys_size);
+ memset (p, 0, sys_size);
++ sys_num = 0;
+ /* Attach the shared segment to local address space */
+ if (fread (p, sys_size, 1, stream) != 1)
+ {
+@@ -494,15 +553,74 @@
+ sysph[i] = sysph_tmp = (SysPhrase *) p;
+ p = (char *) sysph_tmp->phrase;
+ for (j = 0; j < sysph_tmp->count; j++)
+- {
++ {
+ kph = (Phrase *) p;
+ p += SizeOfPhrase (kph->len, kph->count); // skip the string
+- }
++ sys_num += kph->count;
++ }
+ }
+ fclose (stream);
+ return 0;
+ }
+
++static int LoadPhraseFrequency(char *pathname)
++{
++ FILE *stream;
++ Phrase *sph;
++ SysPhrase *sysph_tmp;
++ char *f;
++ char *p;
++ int i,j,k,index,sys_size_tmp,sys_num_tmp,pcount;
++
++ if ( (stream = fopen(pathname , "rb" )) == NULL )
++ {
++ fatal("%s file can't open\n",pathname);
++ return -1;
++ }
++
++ if (fseek(stream,-sizeof(int)*2,SEEK_END) == -1 ||
++ fread(&(sys_size_tmp),sizeof(int),1,stream) != 1 ||
++ fread(&(sys_num_tmp),sizeof(int),1,stream) != 1 ||
++ sys_size != sys_size_tmp||
++ sys_num_tmp != ftell(stream)-sizeof(int)*2 ||
++ sys_num != sys_num_tmp) // error!!
++ {
++ fatal("%s is not a valid pinyin phrase freqency file.\n",pathname);
++ return -1;
++ }
++ fseek(stream,0,SEEK_SET);
++ f = (char *) malloc (sys_num);
++ memset (f, 0, sys_num);
++ if (fread(f, sys_num, 1, stream) != 1)
++ {
++ fatal("Load File %s Error.\n", pathname);
++ return -1;
++ }
++ //
++ pcount=0;
++ for(i = 1; i < MAX_PY_NUM; i++)
++ {
++ sysph_tmp = sysph[i];
++ assert (sysph_tmp != NULL);
++ p = (char*)sysph_tmp->phrase; // count = total pinyin number
++ for(j = 0; j < sysph_tmp->count; j++)
++ {
++ sph = (Phrase *)p;
++ assert (sph != NULL);
++ for(k = 0; k < sph->count; k++)
++ {
++ index = sph->len+1 + (2*sph->len+1)*k + 2*sph->len;
++ sph->key[index] = f[pcount];
++ pcount++;
++ }
++ p += SizeOfPhrase(sph->len,sph->count);
++ }
++ }
++ free(f);
++ fclose(stream);
++ return 0;
++}
++
+ // When loading the phrase library, save it in memory
+ // structure, dynamic linklist
+ /* str, hanzi codes, key: pinyin codes, len: length, pass: system/user */
+@@ -676,6 +794,7 @@
+ inmd->lenkey = 0;
+ inmd->key[0] = '\0';
+ inmd->nTotalCurSel = 0;
++ inmd->flg_english = 0;
+ }
+
+ // pinyin[0]-pinyin[len-1], parsed pinyin chars
+@@ -710,6 +829,7 @@
+
+ if (!inmd->len)
+ return NULL;
++ printf("szGetSelectPhrase called\n");
+
+ idx = inmd->startpos + n;
+
+@@ -735,6 +855,15 @@
+ char strhz[MAX_PHRASE_LEN * 2 + 1];
+ int pos, idx;
+
++
++ if (ch == '\n')
++ {
++ strcpy(strbuf,inmd->inbuf);
++ ResetPinyinInput(inmd);
++ return 2;
++ }
++
++
+ if (!inmd->len)
+ return 1;
+
+@@ -782,12 +911,16 @@
+ }
+ else // not yet, some unselected pinyin exist
+ {
++ inmd->flg_english = 0;
+ // forward the pinyinpos pointer
+ for (pos = strlen (strhz) / 2; pos > 0; inmd->pinyinpos++)
+ {
+ ch = inmd->pinyin[inmd->pinyinpos][0];
+ if (ch == 'i' || ch == 'u' || ch == 'v' || ch < 'a' || ch > 'z')
++ {
++ inmd->flg_english = 1;
+ continue;
++ }
+ pos--;
+ }
+
+@@ -820,21 +953,26 @@
+
+ char chtmp;
+ int count;
++ int i;
++ char tmpbuf[128];
+
+ /* \010 = Ctrl+H, \177 = BackSpace */
+ if (ch == '\010' || ch == '\177') // BackSpace
+ {
+ if (!strlen (inbuf))
+- return 0;
++ return 0;
+ else if (!strlen (inbuftmp))
+ {
+ strcpy (inbuftmp, inbuf);
++ inbuf[strlen(inbuf)-1] = '\0';
+ *pybuftmp = '\0'; // clear all the selected chars, reparse
+ }
+ else
+ {
+ inbuf[strlen (inbuf) - 1] = '\0';
+- inbuftmp[strlen (inbuftmp) - 1] = '\0'; // cut one pinyin-char off
++ if(inmd->flg_english) strcpy(inbuftmp,inbuf);
++ else inbuftmp[strlen (inbuftmp) - 1] = '\0'; // cut one pinyin-char off
++
+ if (!strlen (inbuf))
+ {
+ ResetPinyinInput (inmd);
+@@ -862,7 +1000,8 @@
+ chtmp = inmd->pinyin[inmd->lenpy - 1][0];
+ if (chtmp == 'i' || chtmp == 'u' || chtmp == 'v')
+ {
+- inbuf[strlen (inbuf) - 1] = '\0';
++// inbuf[strlen (inbuf) - 1] = '\0';
++ inmd->flg_english = 1;
+ inbuftmp[strlen (inbuftmp) - 1] = '\0';
+ inmd->lenpy--;
+ return 1;
+@@ -871,7 +1010,7 @@
+ /* Too many chars now */
+ if (EffectPyNum (inmd->pinyin, inmd->lenpy) > MAX_PHRASE_LEN)
+ {
+- inbuf[strlen (inbuf) - 1] = '\0';
++// inbuf[strlen (inbuf) - 1] = '\0';
+ inbuftmp[strlen (inbuftmp) - 1] = '\0';
+ inmd->lenpy--;
+ return 1;
+@@ -881,6 +1020,14 @@
+ FillForwardSelection (inmd, 0);
+ CreatePyMsg (inmd);
+
++ tmpbuf[0] = '\0';
++ for(i = 0;i < inmd->lenpy; i++)
++ {
++ strcat(tmpbuf,inmd->pinyin[i]);
++ }
++ if(strcmp(inmd->inbuf,tmpbuf)) inmd->flg_english = 1;
++ else inmd->flg_english = 0;
++
+ return 1;
+ }
+
+@@ -921,8 +1068,8 @@
+ break;
+
+ default: // select some keys
+- if ((ch >= '1' && ch <= '9') || ch == '0' || ch == ' ')
+- return SelectKeyPressed (inmd, ch, strbuf);
++ if ((ch >= '1' && ch <= '9') || ch == '0' || ch == ' ' || ch == '\n')
++ return SelectKeyPressed (inmd, ch, strbuf);
+ break;
+ }
+ return 0;
+@@ -952,6 +1099,12 @@
+ continue;
+ }
+
++ if (pybuf[offset] == 'v' || pybuf[offset] == 'i' || pybuf[offset] == 'u')
++ {
++ offset++; count = 2;
++ continue;
++ }
++
+ ahead = pybuf[offset] - 'a';
+ if (ahead < 0 || ahead > 25)
+ return 0;
+@@ -1004,13 +1157,13 @@
+ // temporary array, 500 items
+
+ int lenarr[MAX_PHRASE_LEN], result;
+- char ch;
++ char ch, ch2='\0';
+
+ if (!lenpy)
+- {
++ {
+ inmd->len = 0;
+ return;
+- }
++ }
+
+ /* first of all, fill the pykey array */
+ for (i = 0; i < lenpy; i++)
+@@ -1022,9 +1175,14 @@
+ ahead = pinyin[i][0] - 'a';
+ lenkey = 0;
+ tmplen = strlen (pinyin[i]);
++ if(tmplen > 1)
++ ch2 = pinyin[i][1];
+ for (j = 0; (keytmp = pytab[ahead][j].key); j++)
+ {
+- if (tmplen == 1 || !strncmp (pinyin[i], pytab[ahead][j].py, tmplen))
++// if (tmplen == 1 || !strncmp (pinyin[i], pytab[ahead][j].py, tmplen))
++ if (tmplen == 1 || !strcmp (pinyin[i], pytab[ahead][j].py)
++ || ((tmplen == 2) && (!FuzzyPinyin)&&(ch=='z'||ch=='c'||ch=='s')
++ &&(ch2=='h')))
+ // prefix match
+ {
+ pykey[count][lenkey++] = keytmp;
+@@ -1048,7 +1206,7 @@
+ }
+ }
+ pykey[count++][lenkey] = 0;
+- } // for i = 1 to lenpy, pykey array filled
++ } // for i = 1 to lenpy, pykey array filled
+
+ for (i = 0; i < MAX_PHRASE_LEN; i++)
+ lenarr[i] = 0;
+@@ -1334,13 +1492,17 @@
+ int
+ CCE_GetInputDisplay (InputModule * p, char *buf)
+ {
+- strcpy (buf, p->iapybuf);
++// strcpy (buf, p->iapybuf);
++ if(p->flg_english) strcpy(buf, p->inbuf);
++ else strcpy(buf, p->iapybuf);
+ return 1;
+ }
+
+ int
+ CCE_GetSelectDisplay (InputModule * p, char *buf)
+ {
+- strcpy (buf, p->iahzbuf);
++// strcpy (buf, p->iahzbuf);
++ if(p->flg_english) strcpy(buf, p->inbuf);
++ else strcpy(buf, p->iahzbuf);
+ return p->nTotalCurSel;
+ }
+--- unicon-3.0.4.orig/unicon/ImmModules/cce/xl_pinyin.h
++++ unicon-3.0.4/unicon/ImmModules/cce/xl_pinyin.h
+@@ -137,6 +137,7 @@
+ // MAX_HZ_BUF = 250
+ int nTotalCurSel; /* Total Selection */
+ int SelectionLen;
++ int flg_english;
+ }
+ InputModule; // about 30KB
+
+@@ -149,6 +150,8 @@
+ int Pinyin_KeyFilter (InputModule * inmd, u_char key, char *buf, int *len);
+ int Pinyin_KeyPressed (InputModule * inmd, u_char key);
+ void RefreshPYInputArea (InputModule * inmd);
++int SaveUsrPhrase(char *pathname);
++int SavePhraseFrequency(char *pathname);
+ int UnloadSysPhrase ();
+ int UnloadUserPhrase ();
+
+--- unicon-3.0.4.orig/unicon/ImmModules/turbo/Makefile.in
++++ unicon-3.0.4/unicon/ImmModules/turbo/Makefile.in
+@@ -1,11 +1,11 @@
+ prefix=@prefix@
+ CFLAGS=@CFLAGS@
+ # CFLAGS += -V2.7.2.3 -I.
+-CFLAGS += -I.
++CFLAGS += -I. -O2
+ PROG = TL_hzinput.so
+ TL_OBJS = xl_hzinput.o TL_hzinput.o xl_phrase.o xl_sysphrase.o xl_mfile.o
+
+-CFLAGS = -g -Wall -I../../include -I.
++CFLAGS = -fPIC -g -Wall -I../../include -I.
+
+ all:dlib
+ dlib: $(PROG)
+@@ -21,7 +21,7 @@
+ xl_sysphrase.o : xl_sysphrase.c
+ gcc $(CFLAGS) -c xl_sysphrase.c -o xl_sysphrase.o
+ $(PROG): $(TL_OBJS)
+- gcc $(TL_OBJS) -shared -o $(PROG)
++ gcc $(TL_OBJS) -fPIC -shared -o $(PROG)
+
+ # GB Support
+ gbdata: cin2tab addphrase levelphrase
+@@ -62,7 +62,8 @@
+ install: all
+ mkdir -p $(prefix)/lib/unicon/modules/turbo
+ cp -f *.so $(prefix)/lib/unicon/modules/turbo
+-data-install: big5data gbdata
++#data-install: big5data gbdata
++data-install:
+ mkdir -p $(prefix)/lib/unicon/modules/turbo/dict/{gb,gbk,big5}
+ cp -f tl_sysphrase.*.bin $(prefix)/lib/unicon/modules/turbo
+ cp -f gb/*.tab $(prefix)/lib/unicon/modules/turbo/dict/gb
+--- unicon-3.0.4.orig/unicon/ImmModules/turbo/xl_phrase.c
++++ unicon-3.0.4/unicon/ImmModules/turbo/xl_phrase.c
+@@ -413,11 +413,11 @@
+ }
+
+ static TL_SysPhrase_T *pDefaultSysPhrase = NULL;
+-static int qcmp (void *t1, void *t2)
++static int qcmp (const void *t1, const void *t2)
+ {
+ u_long c1, c2;
+- ITEM *a = (ITEM *) t1,
+- *b = (ITEM*) t2;
++ const ITEM *a = (ITEM *) t1,
++ *b = (ITEM*) t2;
+
+ if (a->key1 > b->key1)
+ return 1;
+--- unicon-3.0.4.orig/unicon/ImmModules/turbo/xl_hzinput.c
++++ unicon-3.0.4/unicon/ImmModules/turbo/xl_hzinput.c
+@@ -239,11 +239,11 @@
+ }
+
+ static HzInputTable_T *pDefaultClient = NULL;
+-static int qcmp (void *t1, void *t2)
++static int qcmp (const void *t1, const void *t2)
+ {
+ long c1, c2, k1, k2;
+- long *a = (long *) t1,
+- *b = (long *) t2;
++ const long *a = (long *) t1,
++ *b = (long *) t2;
+ int n1, n2, m1, m2;
+ static char p1[256], p2[256];
+ n1 = pDefaultClient->cur_table->item[*a].nPhrase;
+--- unicon-3.0.4.orig/unicon/ImmModules/turbo/xl_mfile.c
++++ unicon-3.0.4/unicon/ImmModules/turbo/xl_mfile.c
+@@ -26,6 +26,7 @@
+
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <string.h>
+
+ typedef struct MemFile_handle
+ {
+--- unicon-3.0.4.orig/unicon/ImmModules/cxterm/dict/Makefile
++++ unicon-3.0.4/unicon/ImmModules/cxterm/dict/Makefile
+@@ -0,0 +1,34 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++dictdir=$(prefix)/lib/unicon/modules/cxterm/dict
++
++SUBDIRS = gb big5 jis ks
++all::
++ for i in $(SUBDIRS) ;\
++ do \
++ echo "making" all "in $(CURRENT_DIR)/$$i..."; \
++ $(MAKE) -C $$i all; \
++ done
++
++clean:
++ $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* make.log MakeOut core "#"*
++ @for flag in ${MAKEFLAGS} ''; do \
++ case "$$flag" in *=*) ;; *[ik]*) set +e;; esac; done; \
++ for i in $(SUBDIRS) ;\
++ do \
++ echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
++ $(MAKE) -C $$i $(MFLAGS) $(PARALLELMFLAGS) clean; \
++ done
++distclean:
++ $(RM) Makefile tags TAGS
++
++install: all
++ for i in $(SUBDIRS) ;\
++ do \
++ echo "installing" "in $$i..."; \
++ mkdir -p $(dictdir)/$$i; \
++ install -o root -g root -m644 $$i/*.cit $(dictdir)/$$i/; \
++ done
++
++
++
+--- unicon-3.0.4.orig/unicon/ImmModules/cxterm/utils/Makefile
++++ unicon-3.0.4/unicon/ImmModules/cxterm/utils/Makefile
+@@ -0,0 +1,37 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++
++CFLAGS += -I. -I..
++
++LIBDIR = $(prefix)/lib/unicon
++LD = gcc $(CFLAGS)
++INSTALL = install -c
++
++GROUP = root
++
++PROGS = cit2tit tit2cit
++
++all: $(PROGS)
++
++cit2tit:
++ $(LD) -o cit2tit cit2tit.c HZutil.c
++
++tit2cit:
++ $(LD) -o tit2cit tit2cit.c HZutil.c
++
++clean:
++ rm -f $(PROGS)
++ rm -f *.o core *~ *.bak
++
++distclean:clean
++ rm -f Makefile tags TAGS
++
++install: all
++ mkdir -p $(LIBDIR)/bin
++ $(INSTALL) -o root -g $(GROUP) -m 755 -d $(LIBDIR)/bin
++ $(INSTALL) -s -o root -g $(GROUP) -m 755 tit2cit $(LIBDIR)/bin
++ $(INSTALL) -s -o root -g $(GROUP) -m 755 cit2tit $(LIBDIR)/bin
++
++
++
+--- unicon-3.0.4.orig/unicon/ImmModules/cxterm/Makefile.in
++++ unicon-3.0.4/unicon/ImmModules/cxterm/Makefile.in
+@@ -5,13 +5,13 @@
+ PROG = cxterm_hzinput.so
+ OBJS = hzinput.o Cxterm_hzinput.o
+
+-CFLAGS = -g -Wall -I../../include -I.
++CFLAGS = -fPIC -g -Wall -I../../include -I.
+
+ all: $(PROG)
+ cd utils && make
+ cd dict && make
+ $(PROG) : $(OBJS)
+- gcc $(OBJS) -shared -o $(PROG)
++ gcc $(OBJS) -fPIC -shared -o $(PROG)
+ Cxterm_hzinput.o : Cxterm_hzinput.c
+ gcc $(CFLAGS) -c Cxterm_hzinput.c -o Cxterm_hzinput.o
+ hzinput.o : hzinput.c
+--- unicon-3.0.4.orig/unicon/ImmModules/cxterm/Makefile
++++ unicon-3.0.4/unicon/ImmModules/cxterm/Makefile
+@@ -0,0 +1,34 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++# CFLAGS += -V2.7.2.3 -I.
++CFLAGS += -I.
++PROG = cxterm_hzinput.so
++OBJS = hzinput.o Cxterm_hzinput.o
++
++CFLAGS = -fPIC -g -Wall -I../../include -I.
++
++all: $(PROG)
++ cd utils && make
++ cd dict && make
++$(PROG) : $(OBJS)
++ gcc $(OBJS) -fPIC -shared -o $(PROG)
++Cxterm_hzinput.o : Cxterm_hzinput.c
++ gcc $(CFLAGS) -c Cxterm_hzinput.c -o Cxterm_hzinput.o
++hzinput.o : hzinput.c
++ gcc $(CFLAGS) -c hzinput.c -o hzinput.o
++install: all
++ mkdir -p $(prefix)/lib/unicon/modules/cxterm
++ cp *.so $(prefix)/lib/unicon/modules/cxterm
++ cd utils && make install
++ cd dict && make install
++clean:
++ rm -f *.o core a.out *.bak test *.so *~
++ cd utils && make clean
++ cd dict && make clean
++
++distclean: clean
++ rm -f Makefile tags TAGS
++ cd utils && make distclean
++ cd dict && make distclean
++
+--- unicon-3.0.4.orig/unicon/Makefile.in
++++ unicon-3.0.4/unicon/Makefile.in
+@@ -2,9 +2,9 @@
+ all:
+ cd server; make
+ cd client; make
+- cd unicon; make
++# cd unicon; make
+ cd ImmModules/cce && make
+- cd ImmModules/cxterm && make
++# cd ImmModules/cxterm && make
+ cd ImmModules/turbo && make
+ ccedata:
+ cd ImmModules/cce/inputs && make
+@@ -19,23 +19,25 @@
+ if [ ! -d $(prefix) ] ; then mkdir -p $(prefix); fi
+ if [ ! -d $(prefix)/lib/unicon ] ; then mkdir -p $(prefix)/lib/unicon; fi
+ if [ ! -d $(prefix)/bin ] ; then mkdir -p $(prefix)/bin; fi
+- cd ImmModules/cce/inputs; make install
+- cd ImmModules/turbo; make data-install
++ cd ImmModules/cce/inputs; make install prefix=$(prefix)
++ cd ImmModules/turbo; make data-install prefix=$(prefix)
+ install: all
+ if [ ! -d $(prefix) ] ; then mkdir -p $(prefix); fi
+ if [ ! -d $(prefix)/lib/unicon ] ; then mkdir -p $(prefix)/lib/unicon; fi
+ if [ ! -d $(prefix)/bin ] ; then mkdir -p $(prefix)/bin; fi
+ cd server; make install
+ cd client; make install
+- cd unicon; make install
++# cd unicon; make install
+ cd ImmModules/cce; make install
+- cd ImmModules/cxterm; make install
++# cd ImmModules/cxterm; make install
+ cd ImmModules/turbo; make install
++ cp -f unicon/sys-gb.tab $(prefix)/lib/unicon
++ cp -f unicon/sys-big5.tab $(prefix)/lib/unicon
+
+ clean:
+ cd server; make clean
+ cd client; make clean
+- cd unicon; make clean
++# cd unicon; make clean
+ cd ImmModules/cce; make clean
+ cd ImmModules/cce/inputs; make clean
+ cd ImmModules/cxterm; make clean
+@@ -47,10 +49,10 @@
+ distclean: clean
+ rm -f config.status config.log config.cache Makefile tags TAGS
+ cd server; make distclean
+- cd unicon; make distclean
++# cd unicon; make distclean
+ cd client; make distclean
+ cd ImmModules/cce; make distclean
+ cd ImmModules/cce/inputs; make distclean
+- cd ImmModules/cxterm; make distclean
++# cd ImmModules/cxterm; make distclean
+ cd ImmModules/turbo; make distclean
+
+--- unicon-3.0.4.orig/unicon/server/TLS_Debug.cpp
++++ unicon-3.0.4/unicon/server/TLS_Debug.cpp
+@@ -32,8 +32,10 @@
+ #include <stdlib.h>
+ #include <assert.h>
+ #include <string.h>
++#include <stdarg.h>
+ #include <TLS_Debug.hpp>
+-TLS_CDebug::TLS_CDebug (char *szFileName, int mode = 0)
++
++TLS_CDebug::TLS_CDebug (char *szFileName, int mode)
+ {
+ if (szFileName == NULL)
+ {
+--- unicon-3.0.4.orig/unicon/server/Makefile.in
++++ unicon-3.0.4/unicon/server/Makefile.in
+@@ -1,7 +1,7 @@
+ prefix=@prefix@
+ CFLAGS = @CFLAGS@
+ APP_PROG = imm_server
+-DLIB_PROG = libimm_server.so
++DLIB_PROG = libimm_server.so.0.0
+
+ APP_OBJS = TLS_HzInput.o TLS_ImmOp.o TLS_TcpipMain.o TLS_MemFile.o \
+ TLS_PthSocket.o TLS_Debug.o \
+@@ -14,13 +14,13 @@
+ LIBS = /usr/lib/libpth.so -ldl
+
+ # CFLAGS = -g -D__IMM_DEBUG__ -Wall -I. -I/usr/include -I../include
+-CFLAGS = -g -Wall -I. -I/usr/include -I../include
++CFLAGS = -fPIC -g -Wall -I. -I../include
+ CC=g++
+
+ all: $(DLIB_PROG)
+
+-libimm_server.so: $(DLIB_OBJS)
+- $(CC) $(DLIB_OBJS) -shared -o $(DLIB_PROG)
++libimm_server.so.0.0: $(DLIB_OBJS)
++ $(CC) $(DLIB_OBJS) -fPIC -Wl,-soname,libimm_server.so.0 -shared -o $(DLIB_PROG) -ldl
+
+ TLS_LibMain.o : TLS_LibMain.cpp
+ $(CC) $(CFLAGS) -DUNICON_LIB=\"$(prefix)/lib/unicon\" -c TLS_LibMain.cpp -o TLS_LibMain.o
+@@ -46,9 +46,10 @@
+
+ install: all
+ mkdir -p $(prefix)/bin
+- mkdir -p $(prefix)/lib/unicon
++ mkdir -p $(prefix)/lib
+ if [ -f $(APP_PROG) ]; then cp -f $(APP_PROG) $(prefix)/bin; fi
+- if [ -f $(DLIB_PROG) ]; then cp -f $(DLIB_PROG) $(prefix)/lib/unicon; fi
++ if [ -f $(DLIB_PROG) ]; then cp -f $(DLIB_PROG) $(prefix)/lib; fi
++ cd $(prefix)/lib;ln -s libimm_server.so.0.0 libimm_server.so.0;ln -s libimm_server.so.0 libimm_server.so
+
+ clean:
+ if test -e $(PROG); then rm -f $(PROG); fi
+--- unicon-3.0.4.orig/unicon/unicon/unicon.ini.in
++++ unicon-3.0.4/unicon/unicon/unicon.ini.in
+@@ -49,8 +49,8 @@
+ MethodModule7=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
+ MethodTable7=@PREFIX@/lib/unicon/modules/turbo/dict/gb/CangJie.tab
+ MethodName7=²Ôò¡ÊäÈë
+-MethodModule8=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
+-MethodTable8=@PREFIX@/lib/unicon/modules/turbo/dict/gb/WuBi.tab
++MethodModule8=@PREFIX@/lib/unicon/modules/cce/cce_hzinput.so
++MethodTable8=@PREFIX@/lib/unicon/modules/cce/dict/wubi.tab
+ MethodName8=Îå±Ê×ÖÐÍ
+ MethodModule9=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
+ MethodTable9=@PREFIX@/lib/unicon/modules/turbo/dict/gb/QianMa.tab
+@@ -110,8 +110,8 @@
+ MethodModule7=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
+ MethodTable7=@PREFIX@/lib/unicon/modules/turbo/dict/gb/CangJie.tab
+ MethodName7=²Ôò¡ÊäÈë
+-MethodModule8=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
+-MethodTable8=@PREFIX@/lib/unicon/modules/turbo/dict/gb/WuBi.tab
++MethodModule8=@PREFIX@/lib/unicon/modules/cce/cce_hzinput.so
++MethodTable8=@PREFIX@/lib/unicon/modules/cce/dict/wubi.tab
+ MethodName8=Îå±Ê×ÖÐÍ
+ MethodModule9=@PREFIX@/lib/unicon/modules/turbo/TL_hzinput.so
+ MethodTable9=@PREFIX@/lib/unicon/modules/turbo/dict/gb/QianMa.tab
+--- unicon-3.0.4.orig/unicon/unicon/Makefile
++++ unicon-3.0.4/unicon/unicon/Makefile
+@@ -0,0 +1,52 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++PROG = unicon
++OBJS = ImmHzInput.o AImmHzInput.o Main.o UniKey.o \
++ MyInputArea.o SysConfig.o MyConfig.o ConfigManager.o
++S_IMM_LIB = ../client/libimmclient.a
++D_IMM_LIB = ../client/libimmclient.a -lpth -ldl -L../server -Wl,-rpath=$(prefix)/lib/unicon -limm_server
++
++# CFLAGS = -g -Wall -I. -DSIMULATE_OS_KEY -DSIMULATE_OS_VIDEO
++# __CLIB24_SUPPORT__
++CFLAGS = -g -Wall -I. -I../include -I../../include -I../unikey
++CC = g++ -g
++all: $(PROG) unicon.ini
++
++unicon: $(OBJS) $(S_IMM_LIB)
++ $(CC) -ldl $(OBJS) $(D_IMM_LIB) -o $(PROG)
++
++slib: $(OBJS) $(S_IMM_LIB)
++ $(CC) $(OBJS) $(S_IMM_LIB) -o $(PROG)
++ImmHzInput.o: ImmHzInput.cpp ImmHzInput.hpp
++ $(CC) $(CFLAGS) -c ImmHzInput.cpp -o ImmHzInput.o
++AImmHzInput.o: AImmHzInput.cpp AImmHzInput.hpp
++ $(CC) $(CFLAGS) -c AImmHzInput.cpp -o AImmHzInput.o
++MyInputArea.o: MyInputArea.cpp MyInputArea.hpp
++ $(CC) $(CFLAGS) -c MyInputArea.cpp -o MyInputArea.o
++SysConfig.o : SysConfig.cpp SysConfig.hpp
++ $(CC) $(CFLAGS) -c SysConfig.cpp -o SysConfig.o
++MyConfig.o : MyConfig.cpp MyConfig.hpp SysConfig.hpp
++ $(CC) $(CFLAGS) -DUNICON_LIB=\"$(prefix)/lib/unicon\" -c MyConfig.cpp -o MyConfig.o
++UniKey.o : UniKey.hpp UniKey.cpp
++ $(CC) $(CFLAGS) -c UniKey.cpp -o UniKey.o
++Main.o: Main.cpp
++ $(CC) $(CFLAGS) -D__DLL_SUPPORT__ -DUNICON_LIB=\"$(prefix)/lib/unicon\" -c Main.cpp -o Main.o
++ConfigManager.o: ConfigManager.cpp
++ $(CC) $(CFLAGS) -DUNICON_LIB=\"$(prefix)/lib/unicon\" -c ConfigManager.cpp -o ConfigManager.o
++
++unicon.ini: unicon.ini.in
++ sed -e "s.@PREFIX@.$(prefix).g" unicon.ini.in > unicon.ini
++
++install: all
++ mkdir -p $(prefix)/bin $(prefix)/lib/unicon
++ install -o root -g root -m755 unicon $(prefix)/bin
++ install -o root -g root -m644 unicon.ini $(prefix)/lib/unicon
++ install -o root -g root -m644 sys-gb.tab $(prefix)/lib/unicon
++ install -o root -g root -m644 sys-big5.tab $(prefix)/lib/unicon
++
++clean:
++ rm -f *.o core *.bak a.out unicon.ini *~ $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
+--- unicon-3.0.4.orig/unikey/Makefile.in
++++ unicon-3.0.4/unikey/Makefile.in
+@@ -3,6 +3,7 @@
+ CFLAGS += -I. -I./include -I../include -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h
+ PROG = unikey.o
+ CC=gcc $(CFLAGS)
++DESTDIR =
+
+ MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
+
+--- unicon-3.0.4.orig/unikey/Makefile
++++ unicon-3.0.4/unikey/Makefile
+@@ -0,0 +1,40 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++CFLAGS = -g -O2
++CFLAGS += -I. -I./include -I../include -I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h
++PROG = unikey.o
++CC=gcc $(CFLAGS)
++DESTDIR =
++
++MODCFLAGS = -Wall -O2 -DMODULE -D__KERNEL__ -DLINUX
++
++all: $(PROG)
++
++unikey.o: xl_keyhooks.o xl_unikey.o xl_keymasks.o xl_hzfb.o xl_fontmgr.o
++ ld -m elf_i386 -r xl_keyhooks.o xl_unikey.o xl_keymasks.o xl_hzfb.o \
++ xl_fontmgr.o -o unikey.o
++
++xl_unikey.o: xl_unikey.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c xl_unikey.c -o xl_unikey.o
++
++xl_keyhooks.o: xl_keyhooks.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c xl_keyhooks.c -o xl_keyhooks.o
++
++xl_keymasks.o: xl_keymasks.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c xl_keymasks.c -o xl_keymasks.o
++
++xl_hzfb.o: xl_hzfb.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c xl_hzfb.c -o xl_hzfb.o
++xl_fontmgr.o: xl_fontmgr.c /usr/include/linux/version.h
++ $(CC) $(MODCFLAGS) -c xl_fontmgr.c -o xl_fontmgr.o
++
++clean:
++ rm -f *.bak *.o xl_unikey.o *~ core $(PROG)
++
++install: all
++ rm -f /dev/unikey ; \
++ mknod /dev/unikey c 10 202 ; \
++ sh install_module.sh $(PROG)
++
++distclean: clean
++ rm -f Makefile tags TAGS
+--- unicon-3.0.4.orig/unimap/Makefile
++++ unicon-3.0.4/unimap/Makefile
+@@ -0,0 +1,14 @@
++# Generated automatically from Makefile.in by configure.
++prefix=/usr
++all: unimapsh
++unimapsh:
++ echo "#!/bin/bash" > load-unimap.sh
++ echo "loadunimap $(prefix)/lib/unicon/direct.uni" >> load-unimap.sh
++install: all
++ install -m 644 direct.uni $(prefix)/lib/unicon
++ install -m 644 load-unimap.sh $(prefix)/lib/unicon
++clean:
++ rm -f *.bak core *~ load-unimap.sh
++
++distclean: clean
++ rm -f Makefile
+--- unicon-3.0.4.orig/debian/README.Debian
++++ unicon-3.0.4/debian/README.Debian
+@@ -0,0 +1,5 @@
++unicon for Debian
++----------------------
++
++
++ -- Yu Guanghui <ygh@debian.org>, Thu, 16 Nov 2000 08:48:37 +0800
+--- unicon-3.0.4.orig/debian/changelog
++++ unicon-3.0.4/debian/changelog
+@@ -0,0 +1,183 @@
++unicon (3.0.4-9) unstable; urgency=low
++
++ * Fix gcc-3.2 compile errors. (closes:Bug#188909)
++
++ -- Yu Guanghui <ygh@debian.org> Thu, 8 May 2003 13:17:08 +0800
++
++unicon (3.0.4-8) unstable; urgency=low
++
++ * minor fixes.
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 19 Aug 2002 18:31:39 +0800
++
++unicon (3.0.4-7) unstable; urgency=low
++
++ * Changed WuBi input method from turbo to cce.
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 11 May 2002 21:33:28 +0800
++
++unicon (3.0.4-6) unstable; urgency=low
++
++ * This patch is from John R. Daily [jdaily@progeny.com].
++ Thank you very much. (closes:Bug#119877)
++ * Added ia64 to the "Architecture" line in debian/control
++ (change arch to any)
++ * Critical: Added stdlib.h include to cin2tab.c so that
++ realloc(3) returns a valid pointer. Without the function
++ prototype, the 64-bit pointer was being truncated to a
++ 32-bit int, and unlike on alpha, ia64 uses the entire
++ 64-bit space for pointer values.
++ * Added string.h to xl_mfile.c to provide a prototype for
++ memcpy(3).
++ * Minor: Changed functions passed to qsort to declare const
++ arguments, to better comply with qsort's prototype. There
++ are still warnings because the parameters are not void *
++ in two files.
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 17 Nov 2001 08:32:49 +0800
++
++unicon (3.0.4-5) unstable; urgency=low
++
++ * Removed IA64 from the support listing. It will be added
++ in future if the new versoin supports IA64.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 24 Oct 2001 15:33:08 +0800
++
++unicon (3.0.4-4) unstable; urgency=low
++
++ * Fixed a memory leak. Got the patch from www.linuxforum.com.
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 21 Oct 2001 17:41:11 +0800
++
++unicon (3.0.4-3) unstable; urgency=low
++
++ * Compiled cce module with -fPIC. (closes:Bug#114784)
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 8 Oct 2001 22:03:54 +0800
++
++unicon (3.0.4-2) unstable; urgency=low
++
++ * Fixed exact match.
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 7 Oct 2001 21:57:49 +0800
++
++unicon (3.0.4-1) unstable; urgency=low
++
++ * New upstream release
++ * Merged with old patches.
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 17 Sep 2001 20:08:09 +0800
++
++unicon (3.0.3-7) unstable; urgency=low
++
++ * Fixed tab2txt bug. Get from miniChinput-0.0.2-alpha2.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 18 Jul 2001 00:12:56 +0800
++
++unicon (3.0.3-6) unstable; urgency=low
++
++ * Fixed the include path, in order to let gcc 3.0 work.
++ (closes: Bug#104618, Bug#104759)
++ * Need more than 150 mins build time under m68k. (closes: Bug#103802)
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 14 Jul 2001 10:27:19 +0800
++
++unicon (3.0.3-5) unstable; urgency=low
++
++ * New excat match patch, get from miniChinput.
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 8 Jul 2001 18:55:02 +0800
++
++unicon (3.0.3-4) unstable; urgency=low
++
++ * Megred with minichinput.
++
++ -- Yu Guanghui <ygh@debian.org> Fri, 6 Jul 2001 15:44:40 +0800
++
++unicon (3.0.3-3) unstable; urgency=low
++
++ * Merged patch from huyou (www.linuxforum.net). The ZNPY input method
++ supports user phrase.
++
++ -- Yu Guanghui <ygh@debian.org> Thu, 5 Jul 2001 22:54:00 +0800
++
++unicon (3.0.3-2) unstable; urgency=low
++
++ * Apply patch for ZNPY input. If it's an exact match, break out now.
++ Thank althea.bbs@bbs.smth.org.
++
++ -- Yu Guanghui <ygh@debian.org> Fri, 29 Jun 2001 18:19:56 +0800
++
++unicon (3.0.3-1) unstable; urgency=low
++
++ * New upstream release
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 17 Jun 2001 11:35:33 +0800
++
++unicon (3.0.2-3) unstable; urgency=low
++
++ * Marked conflics with chinput <= 3.0.1-3.
++ * Close again.(closes: Bug#99670)
++
++ -- Yu Guanghui <ygh@debian.org> Thu, 10 May 2001 00:59:30 +0800
++
++unicon (3.0.2-2) unstable; urgency=low
++
++ * Removed cxterm dict build, we don't need it. (closes: #Bug96670)
++
++ -- Yu Guanghui <ygh@debian.org> Tue, 8 May 2001 00:21:51 +0800
++
++unicon (3.0.2-1) unstable; urgency=low
++
++ * New upstream release
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 2 May 2001 00:07:39 +0800
++
++unicon (3.0-7) unstable; urgency=low
++
++ * Added Build-Depends: xlibs-dev
++
++ -- Yu Guanghui <ygh@debian.org> Tue, 13 Mar 2001 21:02:59 +0800
++
++unicon (3.0-6) unstable; urgency=low
++
++ * Fixed alpha build fails. (closes:Bug#87981)
++ I Have sended the patch to the upstream author.
++
++ -- Yu Guanghui <ygh@debian.org> Wed, 28 Feb 2001 23:11:55 +0800
++
++unicon (3.0-5) unstable; urgency=low
++
++ * Added Build-Depends: debhelper,libpth-dev (closes:Bug#87268)
++
++ -- Yu Guanghui <ygh@debian.org> Sat, 24 Feb 2001 09:13:44 +0800
++
++unicon (3.0-4) unstable; urgency=low
++
++ *Add lintian override file for unicon-im, make lintian happy.
++
++ -- Yu Guanghui <ygh@debian.org> Tue, 20 Feb 2001 23:04:43 +0800
++
++unicon (3.0-3) unstable; urgency=low
++
++ *Fixed the shared library install: libimm_server.so.0.0 is installed correctly now.
++ *Add lost file sys-gb.tab, sys-big5.tab to /usr/lib/unicon
++ *Applyed pinyin input method patch from Liang Changtai<linuxrat@gnuchina.org>.
++
++ -- Yu Guanghui <ygh@debian.org> Mon, 19 Feb 2001 22:25:46 +0800
++
++unicon (3.0-2) unstable; urgency=low
++
++ * add gcc compile flag -fPIC for the shared libraries.
++
++ -- Yu Guanghui <ygh@debian.org> Sun, 18 Feb 2001 21:21:08 +0800
++
++unicon (3.0-1) unstable; urgency=low
++
++ * Initial Release.
++
++ -- Yu Guanghui <ygh@debian.org> Thu, 16 Nov 2000 08:48:37 +0800
++
++Local variables:
++mode: debian-changelog
++End:
+--- unicon-3.0.4.orig/debian/copyright
++++ unicon-3.0.4/debian/copyright
+@@ -0,0 +1,19 @@
++This package was debianized by Yu Guanghui <ygh@debian.org> on
++Thu, 16 Nov 2000 08:48:37 +0800.
++
++It was downloaded from ftp.turbolinux.com.cn
++
++Upstream Author(s): Arthur Ma <arthur.ma@turbolinux.com.cn>
++
++Copyright:
++
++This is UNICON
++
++The programs in this package may be copied under the terms of the GNU Lesser
++General Public Licence, version 2.1 (see below).
++
++They were written by several people, and integrate work from many many
++others. See the CREDITS file for details.
++
++On Debian systems, you can find the complete GNU GPL v2 at
++/usr/share/common-licenses/GPL.
+--- unicon-3.0.4.orig/debian/unicon-im.files
++++ unicon-3.0.4/debian/unicon-im.files
+@@ -0,0 +1 @@
++usr
+--- unicon-3.0.4.orig/debian/postinst
++++ unicon-3.0.4/debian/postinst
+@@ -0,0 +1,45 @@
++#! /bin/sh
++# postinst script for unicon
++#
++# see: dh_installdeb(1)
++
++set -e
++
++# summary of how this script can be called:
++# * <postinst> `configure' <most-recently-configured-version>
++# * <old-postinst> `abort-upgrade' <new version>
++# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
++# <new-version>
++# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
++# <failed-install-package> <version> `removing'
++# <conflicting-package> <version>
++# for details, see /usr/doc/packaging-manual/
++#
++# quoting from the policy:
++# Any necessary prompting should almost always be confined to the
++# post-installation script, and should be protected with a conditional
++# so that unnecessary prompting doesn't happen if a package's
++# installation fails and the `postinst' is called with `abort-upgrade',
++# `abort-remove' or `abort-deconfigure'.
++
++case "$1" in
++ configure)
++ ;;
++
++ abort-upgrade|abort-remove|abort-deconfigure)
++ ;;
++
++ *)
++ echo "postinst called with unknown argument \`$1'" >&2
++ exit 0
++ ;;
++esac
++
++# dh_installdeb will replace this with shell code automatically
++# generated by other debhelper scripts.
++
++#DEBHELPER#
++
++exit 0
++
++
+--- unicon-3.0.4.orig/debian/postrm
++++ unicon-3.0.4/debian/postrm
+@@ -0,0 +1,37 @@
++#! /bin/sh
++# postrm script for unicon
++#
++# see: dh_installdeb(1)
++
++set -e
++
++# summary of how this script can be called:
++# * <postrm> `remove'
++# * <postrm> `purge'
++# * <old-postrm> `upgrade' <new-version>
++# * <new-postrm> `failed-upgrade' <old-version>
++# * <new-postrm> `abort-install'
++# * <new-postrm> `abort-install' <old-version>
++# * <new-postrm> `abort-upgrade' <old-version>
++# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
++# for details, see /usr/doc/packaging-manual/
++
++case "$1" in
++ purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
++
++ # update the menu system
++# if [ -x /usr/bin/update-menus ]; then update-menus; fi
++ ;;
++
++ *)
++ echo "postrm called with unknown argument \`$1'" >&2
++ exit 0
++
++esac
++
++# dh_installdeb will replace this with shell code automatically
++# generated by other debhelper scripts.
++
++#DEBHELPER#
++
++
+--- unicon-3.0.4.orig/debian/TODO.Debian
++++ unicon-3.0.4/debian/TODO.Debian
+@@ -0,0 +1,4 @@
++Only the input method library has been packged now. The unicon package will finish
++soon.
++ Yu Guanghui<ygh@debian.org>
++ 2001.2.18
+--- unicon-3.0.4.orig/debian/control
++++ unicon-3.0.4/debian/control
+@@ -0,0 +1,14 @@
++Source: unicon
++Section: utils
++Build-Depends: debhelper (>= 2.0.72), libpth-dev, xlibs-dev
++Priority: optional
++Maintainer: Yu Guanghui <ygh@debian.org>
++Standards-Version: 3.5.0
++
++Package: unicon-im
++Architecture: any
++Depends: ${shlibs:Depends}
++Conflicts: chinput (<= 3.0.1-3)
++Description: Chinese Input Method Libaray
++ General Chinese Input method interface and API. It is using by chinput and
++ unicon now.
+--- unicon-3.0.4.orig/debian/unicon-im.override
++++ unicon-3.0.4/debian/unicon-im.override
+@@ -0,0 +1,3 @@
++unicon-im: shlib-with-non-pic-code usr/lib/unicon/modules/turbo/TL_hzinput.so
++unicon-im: non-dev-pkg-with-shlib-symlink usr/lib/libimm_server.so.0.0 usr/lib/libimm_server.so
++unicon-im: postinst-must-call-ldconfig usr/lib/libimm_server.so.0.0
+--- unicon-3.0.4.orig/debian/rules
++++ unicon-3.0.4/debian/rules
+@@ -0,0 +1,93 @@
++#!/usr/bin/make -f
++# Sample debian/rules that uses debhelper.
++# GNU copyright 1997 by Joey Hess.
++#
++# This version is for a hypothetical package that builds an
++# architecture-dependant package, as well as an architecture-independent
++# package.
++
++# Uncomment this to turn on verbose mode.
++#export DH_VERBOSE=1
++
++# This is the debhelper compatability version to use.
++export DH_COMPAT=3
++
++# This has to be exported to make some magic below work.
++
++# shared library versions, option 1
++version=0.0
++major=0
++
++
++build: build-stamp
++build-stamp:
++ dh_testdir
++
++ ./configure --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
++ # Add here commands to compile the package.
++ $(MAKE)
++ $(MAKE) data
++
++ touch build-stamp
++
++clean:
++ dh_testdir
++ dh_testroot
++ rm -f build-stamp
++
++ # Add here commands to clean up after the build process.
++ -$(MAKE) distclean
++
++ dh_clean
++
++install: build
++ dh_testdir
++ dh_testroot
++ dh_clean -k
++ dh_installdirs
++
++ $(MAKE) install prefix=`pwd`/debian/unicon-im/usr DESTDIR=`pwd`/debian/unicon-im/usr
++ $(MAKE) data-install prefix=`pwd`/debian/unicon-im/usr
++ cp -f debian/unicon-im.override `pwd`/debian/unicon-im/usr/share/lintian/overrides/unicon-im
++
++# dh_movefiles
++
++# Build architecture-independent files here.
++# Pass -i to all debhelper commands in this target to reduce clutter.
++binary-indep: build install
++
++# Build architecture-dependent files here.
++# Pass -a to all debhelper commands in this target to reduce clutter.
++binary-arch: build install
++# Need this version of debhelper for DH_OPTIONS to work.
++# dh_testversion 1.1.17
++ dh_testdir
++ dh_testroot
++# dh_installdebconf
++ dh_installdocs
++ dh_installexamples
++ dh_installmenu
++# dh_installemacsen
++# dh_installpam
++# dh_installinit
++ dh_installcron
++# dh_installmanpages
++ dh_installinfo
++# dh_undocumented
++ dh_installchangelogs ChangeLog
++ dh_strip
++ dh_link
++ dh_compress
++ dh_fixperms
++ # You may want to make some executables suid here.
++# dh_suidregister
++ dh_installdeb
++ dh_makeshlibs
++# dh_perl
++ dh_shlibdeps
++ dh_gencontrol
++ dh_md5sums
++ dh_builddeb
++
++binary: binary-indep binary-arch
++.PHONY: build clean binary-indep binary-arch binary install
+--- unicon-3.0.4.orig/debian/unicon-im.docs
++++ unicon-3.0.4/debian/unicon-im.docs
+@@ -0,0 +1,13 @@
++BUGS
++README
++README_cn
++THANKS
++RELEASE
++RELEASE_cn
++CREDITS
++debian/TODO.Debian
++doc/faq_en.txt
++doc/smallfont.txt
++doc/tech_unicon.txt
++doc/unicon_font_header.txt
++doc/whitepaper_unicon.txt
+--- unicon-3.0.4.orig/debian/patches/ia64.patch
++++ unicon-3.0.4/debian/patches/ia64.patch
+@@ -0,0 +1,106 @@
++diff -Naur unicon.orig/unicon/ImmModules/cce/inputs/cin2dat.c unicon-3.0.4/unicon/ImmModules/cce/inputs/cin2dat.c
++--- unicon.orig/unicon/ImmModules/cce/inputs/cin2dat.c Tue Sep 11 02:12:10 2001
+++++ unicon-3.0.4/unicon/ImmModules/cce/inputs/cin2dat.c Fri Nov 16 14:41:36 2001
++@@ -114,7 +114,7 @@
++
++ /* qcmp2 compare two ITEM2 structure, according to its key1/key2/ch */
++ int
++-qcmp2 (ITEM2 * a, ITEM2 * b)
+++qcmp2 (const ITEM2 * a, const ITEM2 * b)
++ {
++ if (a->key1 > b->key1)
++ return 1;
++@@ -134,7 +134,7 @@
++
++ /* qcmp compare two ITEM2 structure, according to its key1/key2/occur_seq */
++ int
++-qcmp (ITEM2 * a, ITEM2 * b)
+++qcmp (const ITEM2 * a, const ITEM2 * b)
++ {
++ if (a->key1 > b->key1)
++ return 1;
++@@ -148,7 +148,7 @@
++ }
++
++ int
++-qcmp_ser (ITEM * a, ITEM * b)
+++qcmp_ser (const ITEM * a, const ITEM * b)
++ {
++ if (a->ch > b->ch)
++ return 1;
++diff -Naur unicon.orig/unicon/ImmModules/cce/inputs/cin2tab.c unicon-3.0.4/unicon/ImmModules/cce/inputs/cin2tab.c
++--- unicon.orig/unicon/ImmModules/cce/inputs/cin2tab.c Tue Sep 11 02:12:10 2001
+++++ unicon-3.0.4/unicon/ImmModules/cce/inputs/cin2tab.c Fri Nov 16 14:41:16 2001
++@@ -3,6 +3,7 @@
++ #include <stdarg.h>
++ #include <sys/types.h>
++ #include <string.h>
+++#include <stdlib.h>
++ #include "xl_hzinput.h"
++
++ FILE *fr, *fw;
++@@ -114,7 +115,7 @@
++
++ /* qcmp2 compare two ITEM2 structure, according to its key1/key2/ch */
++ int
++-qcmp2 (ITEM2 * a, ITEM2 * b)
+++qcmp2 (const ITEM2 * a, const ITEM2 * b)
++ {
++ if (a->key1 > b->key1)
++ return 1;
++@@ -152,7 +153,7 @@
++ }
++
++ int
++-qcmp_ser (ITEM * a, ITEM * b)
+++qcmp_ser (const ITEM * a, const ITEM * b)
++ {
++ if (a->ch > b->ch)
++ return 1;
++diff -Naur unicon.orig/unicon/ImmModules/turbo/xl_hzinput.c unicon-3.0.4/unicon/ImmModules/turbo/xl_hzinput.c
++--- unicon.orig/unicon/ImmModules/turbo/xl_hzinput.c Wed Aug 8 09:32:38 2001
+++++ unicon-3.0.4/unicon/ImmModules/turbo/xl_hzinput.c Fri Nov 16 14:35:47 2001
++@@ -239,11 +239,11 @@
++ }
++
++ static HzInputTable_T *pDefaultClient = NULL;
++-static int qcmp (void *t1, void *t2)
+++static int qcmp (const void *t1, const void *t2)
++ {
++ long c1, c2, k1, k2;
++- long *a = (long *) t1,
++- *b = (long *) t2;
+++ const long *a = (long *) t1,
+++ *b = (long *) t2;
++ int n1, n2, m1, m2;
++ static char p1[256], p2[256];
++ n1 = pDefaultClient->cur_table->item[*a].nPhrase;
++diff -Naur unicon.orig/unicon/ImmModules/turbo/xl_mfile.c unicon-3.0.4/unicon/ImmModules/turbo/xl_mfile.c
++--- unicon.orig/unicon/ImmModules/turbo/xl_mfile.c Wed Aug 8 09:32:38 2001
+++++ unicon-3.0.4/unicon/ImmModules/turbo/xl_mfile.c Fri Nov 16 14:36:15 2001
++@@ -26,6 +26,7 @@
++
++ #include <stdlib.h>
++ #include <stdio.h>
+++#include <string.h>
++
++ typedef struct MemFile_handle
++ {
++diff -Naur unicon.orig/unicon/ImmModules/turbo/xl_phrase.c unicon-3.0.4/unicon/ImmModules/turbo/xl_phrase.c
++--- unicon.orig/unicon/ImmModules/turbo/xl_phrase.c Wed Aug 8 09:32:38 2001
+++++ unicon-3.0.4/unicon/ImmModules/turbo/xl_phrase.c Fri Nov 16 14:38:43 2001
++@@ -413,11 +413,11 @@
++ }
++
++ static TL_SysPhrase_T *pDefaultSysPhrase = NULL;
++-static int qcmp (void *t1, void *t2)
+++static int qcmp (const void *t1, const void *t2)
++ {
++ u_long c1, c2;
++- ITEM *a = (ITEM *) t1,
++- *b = (ITEM*) t2;
+++ const ITEM *a = (ITEM *) t1,
+++ *b = (ITEM*) t2;
++
++ if (a->key1 > b->key1)
++ return 1;
+--- unicon-3.0.4.orig/debian/unicon-im.dirs
++++ unicon-3.0.4/debian/unicon-im.dirs
+@@ -0,0 +1,2 @@
++usr/share/lintian/overrides
++usr/lib/unicon
diff --git a/app-i18n/unicon/files/unicon-3.0.4-gentoo.patch b/app-i18n/unicon/files/unicon-3.0.4-gentoo.patch
new file mode 100644
index 000000000000..7be821844d8f
--- /dev/null
+++ b/app-i18n/unicon/files/unicon-3.0.4-gentoo.patch
@@ -0,0 +1,11 @@
+--- unicon-3.0.4/sfonts/tools/main.cpp 2001-08-08 15:32:33.000000000 +0100
++++ unicon-3.0.4/sfonts/tools/main.cpp 2003-05-25 03:10:59.000000000 +0100
+@@ -29,7 +29,7 @@
+ #include <mytype.h>
+ #include <filter.hpp>
+ #include <sfont.hpp>
+-
++#include <string.h>
+
+ /* font_type */
+ #define XL_DB_GB 0
diff --git a/app-i18n/unicon/unicon-3.0.4.ebuild b/app-i18n/unicon/unicon-3.0.4.ebuild
new file mode 100644
index 000000000000..39beb757469c
--- /dev/null
+++ b/app-i18n/unicon/unicon-3.0.4.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-i18n/unicon/unicon-3.0.4.ebuild,v 1.1 2003/05/25 15:10:52 liquidx Exp $
+
+inherit eutils
+
+# This release was taken from debian sources. For some reason I can't
+# find this release on turbolinux's site. Even Mandrake is using the
+# older 3.0.3.
+
+# TODO: Figure out how to build the kernel-modules.
+
+DESCRIPTION="CJK (Chinese/Japanese/Korean) console input, display system and input modules."
+HOMEPAGE="http://www.gnu.org/directory/UNICON.html"
+SRC_URI="mirror://gentoo/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+DEPEND="virtual/kernel
+ dev-libs/newt
+ dev-libs/pth"
+
+S=${WORKDIR}/${P}
+
+MAKEOPTS="${MAKEOPTS} -j1"
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ einfo "Applying unicon-3.0.4-debian.patch"
+ patch -p1 < ${FILESDIR}/unicon-3.0.4-debian.patch || die "Failed applying debian patch"
+ epatch ${FILESDIR}/unicon-3.0.4-gentoo.patch
+}
+
+src_compile() {
+ econf
+
+ make || die "make failed"
+ make data || die "make data failed"
+
+ cd ${S}/tools
+ make || die "make tools failed"
+
+ # still has gcc-3.2 issues
+ # make -C sfonts/tools || die "make tools failed"
+}
+
+src_install() {
+ make prefix=${D}/usr install || die "install failed"
+
+ # still has gcc-3.2 issues
+ # dobin sfonts/tools/sfont
+ dobin tools/uniconcfg
+ dobin tools/uniconctrl
+
+ make prefix=${D}/usr data-install || die "install data failed"
+
+ dobin scripts/unicon-start
+
+}