annotate lib/Xatoklib/buffer.c @ 0:92745d501b9a

initial import from kinput2-v3.1
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 04:44:30 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
2 * Copyright 1999 Justsystem Corporation, Japan.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
3 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
4 * Permission to use, copy, modify, and distribute this software and its
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
5 * documentation for any purpose and without fee is hereby granted,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
6 * provided that the above copyright notice appear in all copies and that
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
7 * both that copyright notice and this permission notice appear in
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
8 * supporting documentation, and that the name of Justsystem Corporation
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
9 * not be used in advertising or publicity pertaining to distribution
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
10 * of the software without specific, written prior permission. Justsystem
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
11 * Corporation makes no representations about the suitability of this
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
12 * software for any purpose. It is provided "as is" without express
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
13 * or implied warranty.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
14 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
15 * Author: Atsushi Irisawa
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
16 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
17
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
18 #ifndef lint
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
19 static char rcsid[] = "$Id: buffer.c,v 1.3 1999/08/24 09:05:26 ishisone Exp $" ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
20 #endif /* !lint */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
21
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
22 #include <stdio.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
23 #include <X11/IntrinsicP.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
24 #include <X11/StringDefs.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
25 #include <X11/Xmu/Atoms.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
26 #include <X11/keysym.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
27
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
28
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
29 #include <Xatoklib.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
30
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
31
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
32 /* Page */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
33 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
34 * [$B4X?tL>(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
35 * XatokClearBuffer( )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
36 * [$BI=Bj(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
37 * kinput2$BMQJQ49%P%C%U%!$K%/%j%"(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
38 * [$B8F=P7A<0(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
39 * int XatokClearBuffer( _XatokRecPtr acomm )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
40 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
41 * [$B0z?t(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
42 * $B7?(B : $BL>(B $B>N(B : I O : $B@b(B $BL@(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
43 * _XatokRecPtr : acomm : i/o : kinput2$BMQJQ49%P%C%U%!(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
44 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
45 * [$BJV$jCM(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
46 * $B$J$7(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
47 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
48 * [$B;HMQ4X?t(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
49 * $B$J$7(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
50 * [$B5!G=(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
51 * $B3NJ]$5$l$?(B kinput2$BMQJQ49%P%C%U%!$r%/%j%"$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
52 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
53 void XatokClearBuffer(abuf)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
54 _XatokRecPtr abuf;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
55 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
56 int i, n ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
57
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
58 for( i = 0 ; i < abuf->nbr_of_seg ; i++ ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
59 /* XatokFreeSegement( abuf->segments[i] ) ; */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
60 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
61 abuf->cur_seg = 0 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
62 abuf->nbr_of_seg = 0 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
63
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
64 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
65
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
66 /* Page */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
67 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
68 * [$B4X?tL>(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
69 * XatokBufferConvert( )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
70 * [$BI=Bj(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
71 * $B%(%s%8%sJQ497k2L%G!<%?$N%3%s%P!<%H(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
72 * [$B8F=P7A<0(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
73 * int XatokBufferConvert( _XatokRecPtr acomm,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
74 * WORD ceCmd, AtokRsltPacket *result, int *status,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
75 * int *enable, int *change, int *elseEvent )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
76 * [$B0z?t(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
77 * $B7?(B : $BL>(B $B>N(B : I O : $B@b(B $BL@(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
78 * _XatokRecPtr : acomm : i/o : kinput2$BMQJQ49%P%C%U%!(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
79 * WORD ceCmd,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
80 * AtokRsltPacket *result,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
81 * int *status,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
82 * int *enable,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
83 * int *change,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
84 * int *elseEvent
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
85 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
86 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
87 * [$BJV$jCM(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
88 * $B3NDjJ8;zNs$ND9$5(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
89 * [$B;HMQ4X?t(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
90 * ucs2euc( )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
91 * es = euc2wcs( )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
92 * s2e( )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
93 * XatokCompStr( )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
94 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
95 * [$B5!G=(B]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
96 * ATOK12X $B$X$N(BREQUEST$B$h$j(B $BLa$C$FMh$?%G!<%?$r%A%'%C%/$7!"(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
97 * kinput2 $B$N(B ATOK CLASS$B$G;HMQ$G$-$k%G!<%?7A<0$KJQ49$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
98 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
99 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
100 int XatokBufferConvert(acomm, ceCmd, result, status, enable, change, elseEvent)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
101 _XatokRecPtr acomm;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
102 WORD ceCmd;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
103 AtokRsltPacket *result;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
104 int *status;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
105 int *enable;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
106 int *change;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
107 int *elseEvent;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
108 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
109 char euc[BUFSIZ*4] ; /* $BFI$_I=<($N$?$a$N%P%C%U%!(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
110 int es ; /* euc $BJ8;zNs$ND9$5(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
111 unsigned char *sp, *sp1, *uni2euc( ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
112 wchar *wbuf ; /* $B3NDjJ8;zNs(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
113 char *wrbuf ; /* $B3NDjFI$_J8;zNs(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
114
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
115 int length = 0 ; /* $B3NDjJ8;zNs$ND9$5(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
116 int i, n, ksize ; /* WORK */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
117 AtokRsltHdr *hdr ; /* WORK */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
118 int wsize ; /* WORK */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
119 static int euclen = 1 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
120
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
121 wsize = sizeof( wchar ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
122 wbuf = acomm->wbuf ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
123 wrbuf = acomm->wrbuf ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
124
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
125 hdr = &acomm->NETrslt.header ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
126
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
127 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
128 * $B%b!<%IJ8;zNs$N@_Dj(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
129 * $B%b!<%IJ8;zNs$N@hF,$K6uGr$,B8:_$9$k$N$G:o=|$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
130 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
131 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
132 printf( "buffer conv \245\342\241\274\245\311LEN %d\n"/*=buffer conv $B%b!<%I(BLEN %d\n=*/, hdr->modeLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
133 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
134 if ( hdr->modeLen > 0 ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
135 es = hdr->modeLen * 3 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
136 sp = ( unsigned char * )malloc( es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
137 bzero( sp, es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
138 ucs2euc( hdr->modePtr, hdr->modeLen, sp, es, 0x0000a2ae ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
139 sp1 = sp ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
140 while( *sp1 == 0x20 ) sp1++ ; /* SPACE */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
141 es = strlen( sp1 ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
142 es = euc2wcs( sp1, es, acomm->mode.name ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
143 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
144 printf( "\245\342\241\274\245\311\312\270\273\372\316\363 [%s]\n"/*=$B%b!<%IJ8;zNs(B [%s]\n=*/, sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
145 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
146 acomm->mode.length = hdr->modeLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
147 acomm->mode.length = es ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
148 free( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
149 /* acomm->mode.changes = 1 ; */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
150 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
151
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
152 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
153 * $B3NDjJ8;zNs$,B8:_$9$k>l9g$K$O!"(Bwbuf $B$K3NDjJ8;zNs$r@_Dj$7!"(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
154 * $B%j%?!<%sCM$G$"$k3NDjJ8;zNs$ND9$5$r@_Dj$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
155 * wrbuf $B$K$OFI$_J8;zNs$r@_Dj$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
156 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
157 if ( hdr->resultStrLen ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
158 es = hdr->resultStrLen * 3 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
159 sp = ( unsigned char * )malloc( es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
160 bzero( sp, es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
161 ucs2euc( hdr->resultStrPtr, hdr->resultStrLen, sp, es, 0x0000a2ae ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
162
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
163 es = strlen( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
164 es = euc2wcs( sp, es, wbuf ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
165 length = hdr->resultStrLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
166 free( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
167
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
168 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
169 * $B$h$_J8;zNs(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
170 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
171 bzero( acomm->wrbuf, sizeof( acomm->wrbuf )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
172 es = hdr->resultReadLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
173 s2e( hdr->resultReadPtr, es, wrbuf, sizeof( acomm->wrbuf )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
174
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
175 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
176 printf( "=== buffer.c \263\316\304\352EUC [%s] === \n"/*==== buffer.c $B3NDj(BEUC [%s] === \n=*/, sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
177 printf( "=== buffer.c \263\316\304\352 READ EUC [%s] === \n"/*==== buffer.c $B3NDj(B READ EUC [%s] === \n=*/, acomm->wrbuf ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
178 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
179
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
180 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
181 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
182 * $BL$3NDjJ8;zNs$,$"$C$?>l9g$K$O!"(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
183 * $BL$3NDjJ8;zNs$r(BUNICODE$B$+$i(BEUC$B$KJQ49$7!"(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
184 * $BH?E>I=<(Ey$N0LCV$r5a$a$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
185 * $BL$3NDjJ8;zNs$ND9$5$HL$3NDjJ8;zNsB0@-$ND9$5$O(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
186 * $BF1$8$J$N$G(B if $BJ8$O$^$H$a$F=hM}$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
187 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
188 if ( hdr->compStrLen ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
189 es = hdr->compStrLen * wsize ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
190 es = hdr->compStrLen * 3 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
191 sp = ( unsigned char * )malloc( es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
192 bzero( sp, es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
193
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
194 ucs2euc( hdr->compStrPtr, hdr->compStrLen, sp, es, 0x0000a2ae ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
195 es = strlen( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
196
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
197 acomm->echoLen = euc2wcs( sp, es, acomm->echoStr ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
198 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
199 * $B$3$3$GH?E>I=<($N%3%a%s%H$b:n@.$9$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
200 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
201 XatokCompStr( hdr->compStrPtr, hdr->compAttrPtr,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
202 hdr->compStrLen, &acomm->revPos, &acomm->revLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
203 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
204 /* printf( "$BL$3NDjJ8;zNs(B[%s]\n", sp ) ; */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
205 printf( "EUC CODE\n" ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
206 for( i = 0 ; sp[i] ; i++ ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
207 printf( "0x%x ", sp[i] ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
208 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
209 printf( "\n" ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
210
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
211 printf( "== DEBUG \314\244\263\316\304\352\311\275\274\250:\n"/*=== DEBUG $BL$3NDjI=<((B:\n=*/ ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
212 printf( "==> [%s]\n", sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
213 printf( "==> [----+----1----+----2----+----3]\n" ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
214 printf( "==> [" ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
215 for( i = 0 ; i < acomm->revPos ; i++ ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
216 printf( "\241\373"/*=$B!{(B=*/ ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
217 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
218 for( i = 0 ; i < acomm->revLen ; i++ ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
219 printf( "\241\374"/*=$B!|(B=*/ ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
220 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
221 for( i = acomm->revPos + acomm->revLen ; i < hdr->compStrLen ; i++ ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
222 printf( "\241\373"/*=$B!{(B=*/ ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
223 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
224 printf( "-]\n" ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
225 printf( "revPos %d, revLen %d\n", acomm->revPos, acomm->revLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
226 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
227
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
228 free( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
229 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
230 else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
231 acomm->echoLen = 0 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
232 acomm->echoStr[0] = 0 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
233 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
234
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
235 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
236 * $B8uJdJ8;zNs(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
237 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
238 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
239 printf( "\270\365\312\344\277\364\241\242 %d, \270\365\312\344\245\265\245\244\245\272 %d\n"/*=$B8uJd?t!"(B %d, $B8uJd%5%$%:(B %d\n=*/, hdr->kohoNum, hdr->kohoStrLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
240 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
241
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
242 acomm->kohoNum = 0 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
243 if ( hdr->kohoNum > 0 && hdr->kohoStrLen > 0 ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
244 n = hdr->kohoNum ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
245 ksize = hdr->kohoStrLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
246 if ( acomm->kohoSize == 0 ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
247 acomm->kohoStrPtr = ( WCHAR * )malloc( ksize * sizeof( WCHAR )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
248 acomm->kohoLenPtr = ( BYTE * )malloc( n * sizeof( BYTE )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
249 acomm->kohoSfxPtr = ( BYTE * )malloc( n * sizeof( BYTE )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
250 acomm->kohoSize = n ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
251 acomm->kohoStrLen = ksize ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
252 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
253 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
254 * $BJ8;zNsD9!"B0@-$O!"8uJd?t$@$13NJ](B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
255 * $B8uJd?t$O(B kohoSize $B$K(B $B@_Dj$7$F$"$k!#(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
256 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
257 if ( acomm->kohoSize < n ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
258
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
259 acomm->kohoLenPtr = ( BYTE * )realloc( acomm->kohoLenPtr, n * sizeof( BYTE )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
260 acomm->kohoSfxPtr = ( BYTE * )realloc( acomm->kohoSfxPtr, n * sizeof( BYTE )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
261 acomm->kohoSize = n ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
262 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
263 if ( acomm->kohoStrLen < ksize ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
264 acomm->kohoStrPtr = ( WCHAR * )realloc( acomm->kohoStrPtr, ksize * sizeof( WCHAR )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
265 acomm->kohoStrLen = ksize ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
266 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
267
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
268 memcpy( acomm->kohoStrPtr, hdr->kohoStrPtr, ksize * sizeof( WCHAR)) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
269 memcpy( acomm->kohoLenPtr, hdr->kohoLenPtr, n * sizeof( BYTE )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
270 memcpy( acomm->kohoSfxPtr, hdr->kohoSfxPtr, n * sizeof( BYTE )) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
271 acomm->kohoNum = n ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
272 acomm->kohoPos = hdr->kohoPos ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
273
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
274 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
275 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
276 int kk ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
277 char *eep ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
278 kk = ksize * sizeof( WCHAR );
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
279 eep = uni2euc( acomm->kohoStrPtr, &kk ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
280 printf( "\270\365\312\344 [%s]\n"/*=$B8uJd(B [%s]\n=*/, eep ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
281 for ( i = 0 ; i < n ; i++ ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
282 printf( "%d ", acomm->kohoLenPtr[i] ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
283 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
284 printf( "\304\271\244\265\n"/*=$BD9$5(B\n=*/ ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
285 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
286 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
287 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
288
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
289 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
290 * $B%7%9%F%`9T%G!<%?(B
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
291 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
292 if ( hdr->sysStrLen ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
293 es = hdr->sysStrLen * 3 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
294 sp = ( unsigned char * )malloc( es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
295 bzero( sp, es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
296 ucs2euc( hdr->sysStrPtr, hdr->sysStrLen, sp, es, 0x0000a2ae ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
297 es = strlen( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
298 es = euc2wcs( sp, es, acomm->sysLineStr ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
299 acomm->sysLineLen = hdr->sysStrLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
300 #ifdef ATOK_DEBUG
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
301 printf( "SYS LINE LEN in buffer.c (%d)\n", hdr->sysStrLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
302 #endif /* ATOK_DEBUG */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
303 if ( acomm->sysLineSize == 0 ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
304 acomm->sysAttrPtr = ( WORD * )malloc( sizeof( WORD ) *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
305 hdr->sysStrLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
306 acomm->sysLineSize = hdr->sysStrLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
307 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
308 else if ( acomm->sysLineSize < hdr->sysStrLen ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
309 acomm->sysAttrPtr = ( WORD * )malloc( sizeof( WORD ) *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
310 hdr->sysStrLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
311 acomm->sysLineSize = hdr->sysStrLen ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
312 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
313 memcpy( acomm->sysAttrPtr, hdr->sysAttrPtr, sizeof( WORD ) * hdr->sysStrLen ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
314
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
315 free( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
316 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
317 if ( hdr->guideStrLen ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
318 es = hdr->guideStrLen * 3 ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
319 sp = ( unsigned char * )malloc( es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
320 bzero( sp, es ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
321 ucs2euc( hdr->guideStrPtr, hdr->guideStrLen, sp, es, 0x0000a2ae ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
322 free( sp ) ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
323 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
324 acomm->kohoNum = hdr->kohoNum ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
325
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
326 acomm->guide_openEventIndex = hdr->CEGuideOpenEventIndx ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
327 acomm->guide_closeEventIndex = hdr->CEGuideCloseEventIndx ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
328 acomm->guide_OpenIndex = hdr->CEGuideOpenIndx ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
329
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
330 *status = hdr->CEOutinf ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
331 *enable = hdr->StatusEnableFlag ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
332 *change = hdr->DispChangeStatus ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
333 *elseEvent = hdr->StatusElseEvent ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
334
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
335 return length ;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
336 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
337 /* End of buffer.c */