aboutsummaryrefslogtreecommitdiffstats
path: root/japanese
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2009-12-08 01:27:31 +0800
committerhrs <hrs@FreeBSD.org>2009-12-08 01:27:31 +0800
commit55f48a61e8fe7438877cac331b93892f5408f12b (patch)
tree3117af283e6546e5b3c67bde334f35fecf1543ca /japanese
parentf7f6d2f3f340b47d90658a59306662b78d639b69 (diff)
downloadfreebsd-ports-gnome-55f48a61e8fe7438877cac331b93892f5408f12b.tar.gz
freebsd-ports-gnome-55f48a61e8fe7438877cac331b93892f5408f12b.tar.zst
freebsd-ports-gnome-55f48a61e8fe7438877cac331b93892f5408f12b.zip
- Fix SIGSEGV problem on amd64.
- Convert ConvDesc and ModeTable to a linked list, deprecate complex realloc-based memory management. - Add missing "${CAT} ${PKGMESSAGE}" in the post-install target. - Regenerate patches.
Diffstat (limited to 'japanese')
-rw-r--r--japanese/kinput2/Makefile5
-rw-r--r--japanese/kinput2/files/patch-cmd_Kinput2.ad (renamed from japanese/kinput2/files/patch-kinput2.ad)12
-rw-r--r--japanese/kinput2/files/patch-lib-imlib-imfuncs.h11
-rw-r--r--japanese/kinput2/files/patch-lib::imlib::imconv.c12
-rw-r--r--japanese/kinput2/files/patch-lib_CcWnn.c (renamed from japanese/kinput2/files/patch-lib-CcWnn.c)14
-rw-r--r--japanese/kinput2/files/patch-lib_IMProto.c (renamed from japanese/kinput2/files/patch-lib-IMProto.c)16
-rw-r--r--japanese/kinput2/files/patch-lib_cconv.c609
-rw-r--r--japanese/kinput2/files/patch-lib_imlib_imconv.c18
-rw-r--r--japanese/kinput2/files/patch-lib_imlib_imfuncs.h17
-rw-r--r--japanese/kinput2/files/patch-lib_imlib_imxport.c (renamed from japanese/kinput2/files/patch-lib-imlib-imxport.c)20
-rw-r--r--japanese/kinput2/pkg-message19
11 files changed, 705 insertions, 48 deletions
diff --git a/japanese/kinput2/Makefile b/japanese/kinput2/Makefile
index de15d30c6a68..f2aa1f7979e9 100644
--- a/japanese/kinput2/Makefile
+++ b/japanese/kinput2/Makefile
@@ -7,7 +7,7 @@
PORTNAME= kinput2
PORTVERSION= 3.1
-PORTREVISION= 12
+PORTREVISION= 13
CATEGORIES= japanese x11
MASTER_SITES= ftp://ftp.sra.co.jp/pub/x11/kinput2/
DISTNAME= ${PORTNAME}-v${PORTVERSION}
@@ -99,4 +99,7 @@ pre-configure: apply-slist
${INSTALL_DATA} ${WRKDIR}/Kinput2.conf ${WRKSRC}/Kinput2.conf
${PRINTF} "%s\n" ${CONF} > ${WRKSRC}/Kinput2_im.conf
+post-install:
+ @${CAT} ${PKGMESSAGE}
+
.include <bsd.port.post.mk>
diff --git a/japanese/kinput2/files/patch-kinput2.ad b/japanese/kinput2/files/patch-cmd_Kinput2.ad
index 7297d8b8a17c..a0f0d788d0d6 100644
--- a/japanese/kinput2/files/patch-kinput2.ad
+++ b/japanese/kinput2/files/patch-cmd_Kinput2.ad
@@ -1,6 +1,12 @@
---- cmd/Kinput2.ad.orig 2002-10-03 18:35:26.000000000 +0900
-+++ cmd/Kinput2.ad 2008-11-08 03:30:03.000000000 +0900
-@@ -32,9 +32,12 @@
+Index: cmd/Kinput2.ad
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/cmd/Kinput2.ad,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -p -r1.1.1.1 -r1.2
+--- cmd/Kinput2.ad 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ cmd/Kinput2.ad 7 Dec 2009 06:44:56 -0000 1.2
+@@ -32,9 +32,12 @@ Kinput2.height: 1
!!
!! Wnn setup
!!
diff --git a/japanese/kinput2/files/patch-lib-imlib-imfuncs.h b/japanese/kinput2/files/patch-lib-imlib-imfuncs.h
deleted file mode 100644
index f280fdc5db9a..000000000000
--- a/japanese/kinput2/files/patch-lib-imlib-imfuncs.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- lib/imlib/imfuncs.h.orig 2002-10-03 18:35:30.000000000 +0900
-+++ lib/imlib/imfuncs.h 2008-11-02 01:08:11.000000000 +0900
-@@ -60,7 +60,7 @@
- /*
- * Transport layer functions (defined in imxport.c)
- */
--extern int IMCreateTCPService _Pt_((int *portp));
-+extern int IMCreateTCPService _Pt_((int *portp, char *listenaddr));
- extern IMConnection *IMTCPConnection _Pt_((Widget protocol, int socket));
- extern int IMCreateUnixService _Pt_((char *path));
- extern IMConnection *IMUnixConnection _Pt_((Widget protocol, int socket));
diff --git a/japanese/kinput2/files/patch-lib::imlib::imconv.c b/japanese/kinput2/files/patch-lib::imlib::imconv.c
deleted file mode 100644
index bfe8aefa01ae..000000000000
--- a/japanese/kinput2/files/patch-lib::imlib::imconv.c
+++ /dev/null
@@ -1,12 +0,0 @@
---- lib/imlib/imconv.c.orig Thu Oct 3 18:35:30 2002
-+++ lib/imlib/imconv.c Tue Jun 3 01:34:56 2003
-@@ -591,6 +591,9 @@
- }
- }
- IMFinishRequest(conn, offset);
-+#ifdef STATUS_SYNC
-+ IMFlush(conn);
-+#endif /* STATUS_SYNC */
- }
-
- /*- preeditCaret: do actual preedit caret -*/
diff --git a/japanese/kinput2/files/patch-lib-CcWnn.c b/japanese/kinput2/files/patch-lib_CcWnn.c
index e1a27e3d9f00..b16e2c08e754 100644
--- a/japanese/kinput2/files/patch-lib-CcWnn.c
+++ b/japanese/kinput2/files/patch-lib_CcWnn.c
@@ -1,6 +1,12 @@
---- lib/CcWnn.c.orig 2002-10-03 18:35:27.000000000 +0900
-+++ lib/CcWnn.c 2008-12-28 13:32:01.000000000 +0900
-@@ -18,6 +18,8 @@
+Index: lib/CcWnn.c
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/lib/CcWnn.c,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -p -r1.1.1.1 -r1.2
+--- lib/CcWnn.c 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ lib/CcWnn.c 7 Dec 2009 06:44:58 -0000 1.2
+@@ -18,6 +18,8 @@ static char *rcsid = "$Id: CcWnn.c,v 1.5
* Author: Makoto Ishisone, Software Research Associates, Inc., Japan
*/
@@ -9,7 +15,7 @@
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Atoms.h>
-@@ -854,6 +856,10 @@
+@@ -854,6 +856,10 @@ CcWnnObject obj;
* $B$G!"3P$($F$*$/!#(B
*/
current_obj = obj;
diff --git a/japanese/kinput2/files/patch-lib-IMProto.c b/japanese/kinput2/files/patch-lib_IMProto.c
index c270d0995fb6..c5ccdc89ff89 100644
--- a/japanese/kinput2/files/patch-lib-IMProto.c
+++ b/japanese/kinput2/files/patch-lib_IMProto.c
@@ -1,6 +1,12 @@
---- lib/IMProto.c.orig 2002-10-03 18:35:28.000000000 +0900
-+++ lib/IMProto.c 2008-11-08 16:03:58.000000000 +0900
-@@ -259,7 +259,7 @@
+Index: lib/IMProto.c
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/lib/IMProto.c,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -p -r1.1.1.1 -r1.2
+--- lib/IMProto.c 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ lib/IMProto.c 7 Dec 2009 06:44:58 -0000 1.2
+@@ -259,7 +259,7 @@ Cardinal *num_args;
#ifdef IM_TCP_TRANSPORT
if (ipw->imp.use_tcp_transport) {
ipw->imp.tcp_port = 0; /* let the system choose the port number */
@@ -9,7 +15,7 @@
}
if (ipw->imp.tcp_sock >= 0) {
TRACE(("call XtAppAddInput for tcp socket(%d)\n", ipw->imp.tcp_sock));
-@@ -281,7 +281,7 @@
+@@ -281,7 +281,7 @@ Cardinal *num_args;
* The unix domain socket pathname has the following form:
* <UNIX_SOCKET_DIR>/<Display Name>-<Language>
*/
@@ -18,7 +24,7 @@
#ifdef S_IFLNK
{
/*
-@@ -292,11 +292,11 @@
+@@ -292,11 +292,11 @@ Cardinal *num_args;
struct stat st;
if (lstat(UNIX_SOCKET_DIR, &st) == 0 &&
(st.st_mode & S_IFMT) == S_IFDIR) {
diff --git a/japanese/kinput2/files/patch-lib_cconv.c b/japanese/kinput2/files/patch-lib_cconv.c
new file mode 100644
index 000000000000..ff777a4297bf
--- /dev/null
+++ b/japanese/kinput2/files/patch-lib_cconv.c
@@ -0,0 +1,609 @@
+Index: lib/cconv.c
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/lib/cconv.c,v
+retrieving revision 1.1.1.1
+retrieving revision 1.3
+diff -u -p -r1.1.1.1 -r1.3
+--- lib/cconv.c 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ lib/cconv.c 7 Dec 2009 06:50:44 -0000 1.3
+@@ -604,6 +604,7 @@ static char *rcsid = "$Id: cconv.c,v 10.
+ #endif
+
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <X11/Xlib.h>
+ #include <X11/keysym.h>
+ #include <X11/Xutil.h>
+@@ -672,8 +673,6 @@ static char *rcsid = "$Id: cconv.c,v 10.
+
+ #define ccEncodeChar(c) ((ulong)(c))
+
+-#define NOMODE 0xffff
+-
+ #define MATCHED_CHAR 0x8080 /* $B$3$l$O(B EUC $B$H$7$F$O(B illegal $B$J%3!<%I$J$N$G(B
+ * $BFCJL$JL\E*$KMQ$$$k(B */
+ #define CCLEAR_CHAR 0x8081 /* $B>e$KF1$8(B */
+@@ -688,15 +687,20 @@ typedef struct convdesc {
+ ushort context; /* context$BJ8;zNs(B ($B5U=g$K3JG<$5$l$k(B) */
+ ushort result; /* $BJQ497k2LJ8;zNs(B */
+ ushort function; /* function $B%Y%/%?$N%$%s%G%C%/%9(B */
++
++ struct convdesc *next;
+ } ConvDesc;
+
+ /* $B%b!<%I$4$H$N%F!<%V%k(B */
+-typedef struct {
+- char *name; /* $B%b!<%IL>(B */
++typedef struct modetable {
++ char name[1024]; /* $B%b!<%IL>(B */
+ int nrule; /* $B%k!<%k$N?t(B */
+- ConvDesc *cdbuf; /* $B%k!<%k(B */
++ struct convdesc *cd_head; /* $B%k!<%k(B */
+ wchar *prompt; /* $B%W%m%s%W%HJ8;zNs(B */
+- ushort fallthrough;
++
++ int mt_index;
++ struct modetable *fallthrough;
++ struct modetable *next;
+ } ModeTable;
+
+ /* ccParseRule() $B$GFbItI=8=$KJQ49$5$l$?%k!<%k(B */
+@@ -705,8 +709,8 @@ typedef struct _ccRule {
+ ccRule next; /* $B%k!<%k%j%9%H$N<!$NMWAG(B */
+ int refcnt; /* $B;2>H?t(B */
+ int nmode; /* $B%b!<%I$N?t(B */
+- int initialmode; /* $B=i4|%b!<%I(B */
+- ModeTable *modes; /* $B%b!<%I%F!<%V%k(B */
++ struct modetable *initialmode; /* $B=i4|%b!<%I(B */
++ struct modetable *modes; /* $B%b!<%I%F!<%V%k(B */
+ wchar *strbuf; /* $B%9%H%j%s%0%P%C%U%!(B */
+ ushort *funcbuf; /* $B%U%!%s%/%7%g%s%P%C%U%!(B */
+ int nfunc; /* $B%U%!%s%/%7%g%s$N?t(B */
+@@ -731,8 +735,8 @@ typedef struct _ccBuf {
+ void (*autofix)();
+ void (*modenotify)();
+ caddr_t client_data;
+- int currentmode; /* $B8=:_$N%b!<%I(B */
+- int previousmode; /* $B0l$DA0$N%b!<%I(B */
++ struct modetable *currentmode; /* $B8=:_$N%b!<%I(B */
++ struct modetable *previousmode; /* $B0l$DA0$N%b!<%I(B */
+ wchar *context;
+ wchar *contextend;
+ int contextsize;
+@@ -747,14 +751,6 @@ typedef struct {
+ wchar *strp;
+ } _strbufRec;
+
+-#define CDSIZE 10
+-#define MORECDSIZE 30
+-typedef struct {
+- ConvDesc *cdbuf; /* ConvDesc $B%"%l%$(B */
+- ConvDesc *cdend;
+- ConvDesc *cdp;
+-} _cdbufRec;
+-
+ #define FUNCSIZE 20
+ #define MOREFUNCSIZE 20
+ typedef struct {
+@@ -797,7 +793,7 @@ static int newMode(ccRule, Files *, _str
+ _funcnameRec *, int, uchar **);
+ static int getDesc(ccRule, uchar *, _funcbufRec *, _funcnameRec *,
+ ulong *, int *, wchar *, wchar *, int *);
+-static int getMode(ccRule, uchar *);
++static struct modetable *getMode(ccRule, uchar *);
+ static uchar *getQuote(uchar *, wchar *, int);
+ static int getKey(uchar *, ulong *, int *);
+ static int getmask(uchar *);
+@@ -810,14 +806,12 @@ static void deleteRule(ccRule);
+ static int wstrsave(_strbufRec *, wchar *);
+ static int wstralloc(_strbufRec *, int);
+ static void wstradjust(_strbufRec *);
+-static ConvDesc *cdalloc(_cdbufRec *);
+-static void cdadjust(_cdbufRec *);
+ static int funcalloc(_funcbufRec *, int);
+ static void funcadjust(_funcbufRec *);
+ static int funcsearch(_funcnameRec *, char *);
+ static void funcnameadjust(_funcnameRec *);
+ static int convchar(ccBuf, ulong, int, char *, int);
+-static int cconvert(ccBuf, int, ulong, int, int *, char *, int);
++static int cconvert(ccBuf, struct modetable *, ulong, int, int *, char *, int);
+ static int metamatch(ulong, ulong, int);
+ static int contextMatch(ccBuf, wchar *);
+ static void substStr(ccBuf, wchar *, wchar *, char *, int);
+@@ -841,8 +835,6 @@ static int getFunc();
+ static int wstrsave();
+ static int wstralloc();
+ static void wstradjust();
+-static ConvDesc *cdalloc();
+-static void cdadjust();
+ static int funcalloc();
+ static void funcadjust();
+ static int funcsearch();
+@@ -1098,7 +1090,7 @@ char *file;
+ fnrec.funcnamebuf = NULL;
+
+ rule->nmode = 0;
+- rule->initialmode = -1;
++ rule->initialmode = NULL;
+
+ while (getline(line, sizeof(line), &files, efunc)) {
+ (void)Strcpy(tmp, line);
+@@ -1191,33 +1183,42 @@ int ac;
+ uchar **av;
+ {
+ int nmode;
+- ModeTable *modes;
+ int i;
++ struct modetable *mtp;
++ struct modetable *mt_head;
+
+ ac--, av++;
+
+ nmode = ac;
+- modes = (ModeTable *)Malloc(nmode * sizeof(ModeTable));
+- if (modes == NULL) {
++ if ((mt_head = malloc(sizeof(struct modetable))) == NULL) {
+ eproc(rule->errorfunc, "can't alloc memory");
+ return -1;
+ }
+- rule->modes = modes;
++ memset(mt_head, 0, sizeof(struct modetable));
++ mt_head->mt_index = -1;
++ mtp = mt_head;
+
+ for (i = 0; i < nmode; i++) {
+- if ((modes[i].name = Malloc(Strlen(av[i]) + 1)) == NULL) {
++ if ((mtp->next = malloc(sizeof(struct modetable))) == NULL) {
+ eproc(rule->errorfunc, "can't alloc memory");
+- Free(modes);
+ return -1;
+ }
+- (void)Strcpy(modes[i].name, av[i]);
+- modes[i].nrule = 0;
+- modes[i].cdbuf = NULL;
+- modes[i].prompt = NULL;
+- modes[i].fallthrough = NOMODE;
++ memset(mtp->next, 0, sizeof(struct modetable));
++ mtp->next->mt_index = mtp->mt_index + 1;
++ mtp = mtp->next;
++
++ strncpy(mtp->name, av[i], sizeof(mtp->name) -1);
++ mtp->name[sizeof(mtp->name) - 1] = '\0';
++
++ mtp->nrule = 0;
++ mtp->cd_head = NULL;
++ mtp->prompt = NULL;
++ mtp->fallthrough = NULL;
+ }
+
++ rule->modes = mt_head->next;
+ rule->nmode = nmode;
++ free(mt_head);
+ return 0;
+ }
+
+@@ -1238,35 +1239,39 @@ uchar **av;
+ wchar prompt[30], context[100], result[100];
+ int func;
+ int ndesc = 0;
+- ModeTable *mp;
+- ConvDesc *cdp;
+- _cdbufRec cdbuf;
++ struct modetable *mtp;
++ struct convdesc *cdp;
++ struct convdesc *cd_head;
+ void (*efunc)() = rule->errorfunc;
+
+ /* $B%U%)!<%^%C%H$O(B
+ * "mode <$B%b!<%IL>(B> <"$B%W%m%s%W%HJ8;zNs(B"> [fallthrough <$B%b!<%IL>(B>]
+ */
+ /* $B%b!<%I$N%A%'%C%/(B */
+- if ((mode = getMode(rule, av[1])) < 0) {
++ if ((mtp = getMode(rule, av[1])) == NULL) {
+ EPROC2(efunc, "illegal modename: %s", av[1]);
+ return -1; /* No Such Mode */
+ }
+- mp = &rule->modes[mode];
+
+ if (getQuote(av[2], prompt, 0) == NULL) {
+ EPROC2(efunc, "illegal prompt: %s", av[2]);
+ return -1;
+ }
+- mp->prompt = promptsave(prompt);
+- mp->nrule = 0;
++
++ mtp->prompt = promptsave(prompt);
++ mtp->nrule = 0;
+
+ if (ac > 4 && !Strcmp(av[3], "fallthrough")) {
+- mp->fallthrough = getMode(rule, av[4]);
++ mtp->fallthrough = getMode(rule, av[4]);
+ } else {
+- mp->fallthrough = NOMODE;
++ mtp->fallthrough = NULL;
+ }
+
+- cdbuf.cdbuf = NULL;
++ if ((cd_head = malloc(sizeof(struct convdesc))) == NULL) {
++ return -1;
++ }
++ memset(cd_head, 0, sizeof(struct convdesc));
++ cdp = cd_head;
+
+ /* $B%k!<%k$rFI$s$G%9%H%"$9$k(B */
+ while (getline(line, sizeof(line), files, efunc)) {
+@@ -1277,9 +1282,11 @@ uchar **av;
+ break;
+ if (getDesc(rule, line, frec, fnrec, &inkey, &modmask,
+ context, result, &func)) {
+- if ((cdp = cdalloc(&cdbuf)) == NULL) {
++ if ((cdp->next = malloc(sizeof(struct convdesc))) == NULL) {
+ return -1;
+ }
++ memset(cdp->next, 0, sizeof(struct convdesc));
++ cdp = cdp->next;
+
+ /* $B%k!<%k$N%9%H%"(B */
+ cdp->key = inkey;
+@@ -1297,10 +1304,11 @@ uchar **av;
+ * $B$"$j$&$k(B
+ */
+
+- cdadjust(&cdbuf);
++ mtp->nrule = ndesc;
+
+- mp->nrule = ndesc;
+- mp->cdbuf = cdbuf.cdbuf;
++ /* cd_head is always empty. cd_head->next is the head. */
++ mtp->cd_head = cd_head->next;
++ free(cd_head);
+
+ return 0;
+ }
+@@ -1357,19 +1365,21 @@ int *funcp;
+ return 1;
+ }
+
+-static int getMode(rule, str)
++static struct modetable *getMode(rule, str)
+ ccRule rule;
+ uchar *str;
+ {
+- ModeTable *modes = rule->modes;
+- int i;
++ struct modetable *mtp = rule->modes;
+
+- for (i = 0; i < rule->nmode; i++) {
+- if (!Strcmp(str, modes[i].name))
+- return i;
++ while (mtp) {
++ if (!Strcmp(str, mtp->name)) {
++ return mtp;
++ }
++ mtp = mtp->next;
+ }
++
+ EPROC2(rule->errorfunc, "undefined mode %s", str);
+- return -1;
++ return NULL;
+ }
+
+ /* getQuote -- $B%/%)!<%F!<%7%g%s5-9f$G0O$^$l$?J8;zNs$rFI$s$G(B wchar $B$K$9$k(B */
+@@ -1609,6 +1619,7 @@ uchar **args;
+ ushort *fp;
+ int findex;
+ void (*efunc)() = rule->errorfunc;
++ struct modetable *mtp;
+
+ findex = funcalloc(frec, n + 1);
+ fp = frec->funcbuf + findex;
+@@ -1626,10 +1637,10 @@ uchar **args;
+ fp[j++] = PREVMODE;
+ break;
+ }
+- if ((i = getMode(rule, arg)) < 0) {
++ if ((mtp = getMode(rule, arg)) == NULL) {
+ break;
+ }
+- fp[j++] = MODECHANGE | i;
++ fp[j++] = MODECHANGE | mtp->mt_index;
+ break;
+ } else if (!Strcmp(func, "redo")) {
+ fp[j++] = REDO;
+@@ -1781,50 +1792,6 @@ _strbufRec *srec;
+ }
+ }
+
+-static ConvDesc *cdalloc(crec)
+-_cdbufRec *crec;
+-{
+- ConvDesc *ret;
+-
+- if (crec->cdbuf == NULL) {
+- crec->cdbuf = (ConvDesc *)Malloc(CDSIZE * sizeof(ConvDesc));
+- if (crec->cdbuf == NULL)
+- return NULL;
+- crec->cdend = crec->cdbuf + CDSIZE;
+- crec->cdp = crec->cdbuf;
+- }
+- if (crec->cdp >= crec->cdend) {
+- int size = crec->cdend - crec->cdbuf + MORECDSIZE;
+- int offset = crec->cdp - crec->cdbuf;
+- ConvDesc *cdp;
+-
+- cdp = (ConvDesc *)Realloc(crec->cdbuf, size * sizeof(ConvDesc));
+- if (cdp == NULL) {
+- return NULL;
+- }
+- crec->cdp = cdp + offset;
+- crec->cdbuf = cdp;
+- crec->cdend = cdp + size;
+- }
+-
+- ret = crec->cdp++;
+- return ret;
+-}
+-
+-static void cdadjust(crec)
+-_cdbufRec *crec;
+-{
+- int size = crec->cdp - crec->cdbuf;
+- ConvDesc *cdp;
+-
+- if (size == 0) return;
+- cdp = (ConvDesc *)Realloc(crec->cdbuf, size * sizeof(ConvDesc));
+- if (cdp != NULL) {
+- crec->cdbuf = cdp;
+- crec->cdp = crec->cdend = cdp + size;
+- }
+-}
+-
+ static int funcalloc(frec, n)
+ _funcbufRec *frec;
+ int n;
+@@ -1961,13 +1928,13 @@ int len; /* length of str */
+ /* $B%^%C%A$9$k%k!<%k$,8+$D$+$i$J$+$C$?$N$G(B
+ * fallthrough $B$G;XDj$5$l$k%b!<%I$N%k!<%k$rC5$9(B
+ */
+- int tmpmode = rule->modes[buf->currentmode].fallthrough;
++ struct modetable *tmpmode = buf->currentmode->fallthrough;
+
+- while (tmpmode != NOMODE) {
++ while (tmpmode != NULL) {
+ r = cconvert(buf, tmpmode, key, mask, &func, str, len);
+ if (r >= 0) /* $B%^%C%A$7$?(B */
+ break;
+- tmpmode = rule->modes[tmpmode].fallthrough;
++ tmpmode = tmpmode->fallthrough;
+ }
+ }
+
+@@ -1985,7 +1952,7 @@ int len; /* length of str */
+ else
+ goto redo; /* redo -- $B$b$&0lEY(B */
+ } else if (func & MODECHANGE) { /* $B%+%l%s%H%b!<%I$NJQ99(B */
+- int tmpmode = buf->currentmode;
++ struct modetable *tmpmode = buf->currentmode;
+
+ /* pseudo-key $B$NF~NO(B */
+ (void)convchar(buf, EXITMODE, 0, (char *)NULL, 0);
+@@ -1993,7 +1960,15 @@ int len; /* length of str */
+ if (func == PREVMODE) {
+ buf->currentmode = buf->previousmode;
+ } else {
+- buf->currentmode = func & ~MODECHANGE;
++ int index = func & ~MODECHANGE;
++ struct modetable *mtp;
++ for (mtp = rule->modes; mtp && mtp->mt_index != index; mtp = mtp->next)
++ ;
++ if (mtp) {
++ buf->currentmode = mtp;
++ } else {
++ return -1;
++ }
+ }
+ buf->previousmode = tmpmode;
+
+@@ -2038,7 +2013,7 @@ int len; /* length of str */
+
+ static int cconvert(buf, mode, inkey, mask, func, str, len)
+ ccBuf buf;
+-int mode; /* current mode */
++struct modetable *mode; /* current mode */
+ ulong inkey; /* input key (raw/mapped) */
+ int mask;
+ int *func; /* function */
+@@ -2046,36 +2021,34 @@ char *str;
+ int len;
+ {
+ ccRule rule = buf->rule;
+- ConvDesc *entry;
++ struct convdesc *cdp;
+ ulong key;
+ int n;
+- ModeTable *modep;
++ struct modetable *mtp = mode;
+
+- if (mode < 0 || mode >= rule->nmode)
++ if (mtp == NULL)
+ return -1; /* No Such Mode */
+
+- modep = &rule->modes[mode];
+-
+- if ((n = modep->nrule) <= 0)
++ if (mtp->nrule <= 0)
+ return -1; /* No Rules */
+
+- for (entry = modep->cdbuf; --n >= 0; entry++) {
+- key = entry->key;
++ for (cdp = mtp->cd_head; cdp; cdp = cdp->next) {
++ key = cdp->key;
+ if (key & (ulong)METAC) {
+ /* $B%o%$%k%I%+!<%IJ8;z$N%^%C%A%s%0(B */
+ if (!metamatch(key, inkey, len == 0))
+ continue;
+- } else if (key & (ulong)RAWKEY && mask != entry->mask) {
++ } else if (key & (ulong)RAWKEY && mask != cdp->mask) {
+ continue;
+ } else if (key != inkey) {
+ continue;
+ }
+
+ /* $B%-!<$,%^%C%A$7$?(B */
+- if (contextMatch(buf, rule->strbuf + entry->context)) {
+- substStr(buf, rule->strbuf + entry->context,
+- rule->strbuf + entry->result, str, len);
+- *func = entry->function;
++ if (contextMatch(buf, rule->strbuf + cdp->context)) {
++ substStr(buf, rule->strbuf + cdp->context,
++ rule->strbuf + cdp->result, str, len);
++ *func = cdp->function;
+ return 0;
+ }
+ }
+@@ -2347,7 +2320,6 @@ caddr_t data; /* callback $B%G!<%?(B
+
+ /* $B%+%l%s%H%b!<%I$N@_Dj(B */
+ buf->previousmode = buf->currentmode = rule->initialmode;
+-
+ buf->modifier = 0;
+
+ return buf;
+@@ -2357,7 +2329,7 @@ caddr_t data; /* callback $B%G!<%?(B
+ void ccFreeRule(rule)
+ ccRule rule;
+ {
+- ModeTable *modep;
++ struct modetable *mtp = rule->modes;
+ int i;
+
+ if (rule == NULL) return;
+@@ -2365,12 +2337,12 @@ ccRule rule;
+
+ deleteRule(rule);
+
+- for (modep = rule->modes, i = 0; i < rule->nmode; modep++, i++) {
+- Free(modep->name);
+- Free(modep->cdbuf);
+- Free(modep->prompt);
+- }
++ /* XXX */
++ Free(mtp->cd_head);
++ Free(mtp->prompt);
++
+ Free(rule->rulefile);
++ /* XXX */
+ Free(rule->modes);
+ Free(rule->strbuf);
+ Free(rule->funcbuf);
+@@ -2468,14 +2440,14 @@ XKeyPressedEvent *event; /* $B%-!<%$%Y%
+ int ccGetMode(buf)
+ ccBuf buf;
+ {
+- return buf->currentmode;
++ return buf->currentmode->mt_index;
+ }
+
+ /* ccGetModePrompt -- $B8=:_$N%b!<%I$N%W%m%s%W%HJ8;zNs$rJV$9(B */
+ wchar *ccGetModePrompt(buf)
+ ccBuf buf;
+ {
+- return buf->rule->modes[buf->currentmode].prompt;
++ return buf->currentmode->prompt;
+ }
+
+ /* ccGetRule -- $BJQ49%P%C%U%!$G;H$o$l$F$$$kJQ49%k!<%k$rJV$9(B */
+@@ -2599,7 +2571,6 @@ ccBuf buf;
+ ccDestroyBuf(buf);
+ }
+
+-
+ #ifdef DEBUG_CCONV
+ /*
+ * Debug Functions
+@@ -2625,11 +2596,11 @@ uchar *s;
+
+ void dumpRules(rule, mode)
+ ccRule rule;
+-int mode;
++struct modetable *mode;
+ {
+ int nkey;
+- ModeTable *modep;
+- ConvDesc *cdp;
++ struct modetable *mtp;
++ struct convdesc *cdp;
+ wchar *strbuf = rule->strbuf;
+ ushort *funcbuf = rule->funcbuf;
+ char **funcnames;
+@@ -2639,31 +2610,32 @@ int mode;
+ int i, j;
+
+ funcnames = (char **)__builtin_alloca(rule->nfunc * sizeof(char *));
+-{ char *cp, **fnp;
+- cp = rule->funcnamebuf;
+- fnp = funcnames;
+- for (i = 0; i < rule->nfunc; i++) {
+- *fnp++ = cp;
+- while (*cp++)
+- ;
++ {
++ char *cp, **fnp;
++ cp = rule->funcnamebuf;
++ fnp = funcnames;
++ for (i = 0; i < rule->nfunc; i++) {
++ *fnp++ = cp;
++ while (*cp++)
++ ;
++ }
+ }
+-}
+
+- if (mode < 0 || mode >= rule->nmode) {
+- printf("No such mode %d\n", mode);
++ if (mode == NULL) {
++ printf("No such mode\n");
+ return;
+ }
+- modep = &rule->modes[mode];
++ mtp = rule->modes;
+
+- printf("mode: %s (%d) prompt: ", modep->name, mode);
+- putws(modep->prompt);
+- if (modep->fallthrough != NOMODE) {
+- printf(" fallthrough: %d", modep->fallthrough);
++ printf("mode: %s (%d) prompt: ", mtp->name, mtp->mt_index);
++ putws(mtp->prompt);
++ if (mtp->fallthrough != NULL) {
++ printf(" fallthrough: %s", mtp->fallthrough->name);
+ }
+ putchar('\n');
+- cdp = modep->cdbuf;
+- for (i = 0; i < modep->nrule; i++) {
+- printf("rule[%d]: \"", i);
++
++ for (cdp = mtp->cd_head; cdp; cdp = cdp->next) {
++ printf("rule: \"");
+ putws(strbuf + cdp->context);
+ printf("\"\t");
+ if (cdp->key & RAWKEY) {
+@@ -2763,14 +2735,15 @@ void dumpAllRules(rule)
+ ccRule rule;
+ {
+ int i;
++ struct modetable *mtp;
+
+ printf("** RULE DUMP **\n");
+ printf("number of modes: %d initialmode: %s (%d)\n\n",
+ rule->nmode,
+- rule->modes[rule->initialmode].name,
+- rule->initialmode);
+- for (i = 0; i < rule->nmode; i++) {
+- dumpRules(rule, i);
++ rule->initialmode->name,
++ rule->initialmode->mt_index);
++ for (mtp = rule->modes; mtp; mtp = mtp->next) {
++ dumpRules(rule, mtp);
+ }
+ fflush(stdout);
+ }
diff --git a/japanese/kinput2/files/patch-lib_imlib_imconv.c b/japanese/kinput2/files/patch-lib_imlib_imconv.c
new file mode 100644
index 000000000000..33d900378a0f
--- /dev/null
+++ b/japanese/kinput2/files/patch-lib_imlib_imconv.c
@@ -0,0 +1,18 @@
+Index: lib/imlib/imconv.c
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/lib/imlib/imconv.c,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -p -r1.1.1.1 -r1.2
+--- lib/imlib/imconv.c 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ lib/imlib/imconv.c 7 Dec 2009 06:44:58 -0000 1.2
+@@ -591,6 +591,9 @@ OCCPreeditDrawArg *data;
+ }
+ }
+ IMFinishRequest(conn, offset);
++#ifdef STATUS_SYNC
++ IMFlush(conn);
++#endif /* STATUS_SYNC */
+ }
+
+ /*- preeditCaret: do actual preedit caret -*/
diff --git a/japanese/kinput2/files/patch-lib_imlib_imfuncs.h b/japanese/kinput2/files/patch-lib_imlib_imfuncs.h
new file mode 100644
index 000000000000..ef17eee53779
--- /dev/null
+++ b/japanese/kinput2/files/patch-lib_imlib_imfuncs.h
@@ -0,0 +1,17 @@
+Index: lib/imlib/imfuncs.h
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/lib/imlib/imfuncs.h,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -p -r1.1.1.1 -r1.2
+--- lib/imlib/imfuncs.h 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ lib/imlib/imfuncs.h 7 Dec 2009 06:44:58 -0000 1.2
+@@ -60,7 +60,7 @@ extern void IMSendBadLength _Pt_((IMConn
+ /*
+ * Transport layer functions (defined in imxport.c)
+ */
+-extern int IMCreateTCPService _Pt_((int *portp));
++extern int IMCreateTCPService _Pt_((int *portp, char *listenaddr));
+ extern IMConnection *IMTCPConnection _Pt_((Widget protocol, int socket));
+ extern int IMCreateUnixService _Pt_((char *path));
+ extern IMConnection *IMUnixConnection _Pt_((Widget protocol, int socket));
diff --git a/japanese/kinput2/files/patch-lib-imlib-imxport.c b/japanese/kinput2/files/patch-lib_imlib_imxport.c
index f76bba914818..9f02102abdb1 100644
--- a/japanese/kinput2/files/patch-lib-imlib-imxport.c
+++ b/japanese/kinput2/files/patch-lib_imlib_imxport.c
@@ -1,6 +1,12 @@
---- lib/imlib/imxport.c.orig 2002-10-03 18:35:31.000000000 +0900
-+++ lib/imlib/imxport.c 2008-11-08 16:02:24.000000000 +0900
-@@ -31,10 +31,12 @@
+Index: lib/imlib/imxport.c
+===================================================================
+RCS file: /home/cvs/private/hrs/kinput2/lib/imlib/imxport.c,v
+retrieving revision 1.1.1.1
+retrieving revision 1.2
+diff -u -p -r1.1.1.1 -r1.2
+--- lib/imlib/imxport.c 7 Dec 2009 06:36:04 -0000 1.1.1.1
++++ lib/imlib/imxport.c 7 Dec 2009 06:44:58 -0000 1.2
+@@ -31,10 +31,12 @@ static char *rcsid = "$Id: imxport.c,v 1
#ifdef IM_UNIX_TRANSPORT
#include <sys/un.h>
@@ -13,7 +19,7 @@
#endif
extern int errno;
-@@ -412,8 +414,9 @@
+@@ -412,8 +414,9 @@ IMConnection *conn;
#ifdef IM_TCP_TRANSPORT
int
@@ -24,7 +30,7 @@
{
struct sockaddr_in addr;
int optval = 1;
-@@ -431,7 +434,22 @@
+@@ -431,7 +434,22 @@ int *portp;
(char *)&optval, sizeof(optval));
#endif /* SO_REUSEADDR */
@@ -48,7 +54,7 @@
addr.sin_family = AF_INET;
addr.sin_port = htons(*portp);
-@@ -495,6 +513,7 @@
+@@ -495,6 +513,7 @@ char *path;
{
struct sockaddr_un addr;
int sock;
@@ -56,7 +62,7 @@
TRACE(("IMCreateUnixService(%s)\n", path));
if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
-@@ -510,15 +529,21 @@
+@@ -510,15 +529,21 @@ char *path;
* Remove socket which is created by the previous process.
*/
(void)unlink(path);
diff --git a/japanese/kinput2/pkg-message b/japanese/kinput2/pkg-message
index bae202362e2d..96f8f88fcb82 100644
--- a/japanese/kinput2/pkg-message
+++ b/japanese/kinput2/pkg-message
@@ -1,5 +1,14 @@
-############################################################
-Default key-binding is changed to "egg" key-binding by defining
-*CcWnn.ccdef: ccdef.kinput2.egg
-in ${LOCALBASE}/lib/X11/app-defaults/Kinput2.
-############################################################"
+---------------------------------------------------------------------------
+- The default key-binding is now "egg" style. See the following line in
+ in ${LOCALBASE}/lib/X11/app-defaults/Kinput2:
+
+*CcWnn.ccdef: ccdef.kinput2.egg
+
+- The default CcWnn.Jserver is now "unix"; via unix domain socket. To use
+ TCP/IP, modify the following line:
+
+*CcWnn.Jserver: unix
+
+ Note that $JSERVER environment variable can be used to override the
+ configuration file.
+---------------------------------------------------------------------------