comparison lib/Xatoklib/event.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
comparison
equal deleted inserted replaced
-1:000000000000 0:92745d501b9a
1 /*
2 * Copyright 1999 Justsystem Corporation, Japan.
3 *
4 * Permission to use, copy, modify, and distribute this software and its
5 * documentation for any purpose and without fee is hereby granted,
6 * provided that the above copyright notice appear in all copies and that
7 * both that copyright notice and this permission notice appear in
8 * supporting documentation, and that the name of Justsystem Corporation
9 * not be used in advertising or publicity pertaining to distribution
10 * of the software without specific, written prior permission. Justsystem
11 * Corporation makes no representations about the suitability of this
12 * software for any purpose. It is provided "as is" without express
13 * or implied warranty.
14 *
15 * Author: Atsushi Irisawa
16 */
17
18 #ifndef lint
19 static char rcsid[] = "$Id: event.c,v 1.4 1999/08/24 09:05:26 ishisone Exp $" ;
20 #endif /* !lint */
21
22 #include <stdio.h>
23 #include <X11/IntrinsicP.h>
24 #include <X11/StringDefs.h>
25 #include <X11/Xmu/Atoms.h>
26 #include <X11/keysym.h>
27 #include <InputConv.h>
28
29 #include <Xatoklib.h>
30 #include <key_def.h>
31
32
33 /* Page */
34 /*
35 * [$B4X?tL>(B]
36 * WordDelEvent( )
37 * [$BI=Bj(B]
38 * $BC18l:o=|%&%#%s%I%&I=<(;~$N%$%Y%s%H=hM}(B
39 * [$B8F=P7A<0(B]
40 * int WordDelEvent( _XatokRecPtr acomm, WORD *aajcode, WORD *ceCmd )
41 *
42 * [$B0z?t(B]
43 * $B7?(B : $BL>(B $B>N(B : IO : $B@b(B $BL@(B
44 * _XatokRecPtr : acomm : i/o : kinput2$BMQJQ49%P%C%U%!(B
45 * WORD : *aajcode : i/o : $BF~NO%-!<%3!<%I(B
46 * WORD : *ceCmd : o : ATOK12CE $B$N%3%^%s%IHV9f(B
47 *
48 * [$BJV$jCM(B]
49 * 0 : $B%-!<F~NO%$%Y%s%H$r(BCE$B$XEO$5$J$$(B
50 * 1 : $B%-!<F~NO%$%Y%s%H$r(BCE$B$XEO$9(B
51 *
52 * [$B;HMQ4X?t(B]
53 * $B$J$7(B
54 * [$B5!G=(B]
55 * $BC18l:o=|3NG'%@%$%"%m%0$rI=<($7$F$$$k;~$KM-8z$J%-!<$N(B
56 * $B@)8f$r9T$J$&!#M-8z$J%-!<$O(B 'Y','y', 'N', 'n' $B$@$1$G$"$k!#(B
57 * $B$=$l0J30$N%-!<$,F~NO$5$l$?;~$O2?$b$7$J$$!#(B
58 * $BM-8z%-!<$N;~$@$1!"%(%s%8%s$K%-!<$rEO$9$N$G#1$rJV$9!#(B
59 */
60 static int WordDelEvent(acomm, aajcode, ceCmd)
61 _XatokRecPtr acomm;
62 WORD *aajcode;
63 WORD *ceCmd;
64 {
65 int status = 0 ;
66
67 switch( *aajcode ) {
68 case 'y' :
69 case 'Y' :
70 case 'n' :
71 case 'N' :
72 /*
73 * $BM-8z%-!<$N>l9g(B
74 */
75 acomm->convStatus ^= M_WDEL ; /* 623 */
76 status = 1 ;
77 break ;
78 default :
79 status = 0 ;
80 }
81 return status ;
82 }
83 /* Page */
84 /*
85 * [$B4X?tL>(B]
86 * AuxEvent( )
87 * [$BI=Bj(B]
88 * AUX$B%&%#%s%I%&I=<(;~$N%$%Y%s%H=hM}(B
89 * [$B8F=P7A<0(B]
90 * int AuxEvent( _XatokRecPtr acomm, WORD *aajcode,
91 * WORD *ceCmd, int *length )
92 *
93 * [$B0z?t(B]
94 * $B7?(B : $BL>(B $B>N(B : IO : $B@b(B $BL@(B
95 * _XatokRecPtr : acomm : i/o : kinput2$BMQJQ49%P%C%U%!(B
96 * WORD : *aajcode : i/o : $BF~NO%-!<%3!<%I(B
97 * WORD : *ceCmd : o : ATOK12CE $B$N%3%^%s%IHV9f(B
98 * int : *length : o : $BF~NO$5$l$?J8;zNs$ND9$5(B
99 *
100 *
101 * [$BJV$jCM(B]
102 * -1 : $BAw?.%(%i!<(B
103 * N : $BAw?.%P%$%H?t(B
104 *
105 * [$B;HMQ4X?t(B]
106 * MenuCtrl( )
107 * [$B5!G=(B]
108 * AUX $B%&%#%s%I%&I=<(;~$N%$%Y%s%H=hM}$r9T$J$&!#(B
109 * AUX $B%&%#%s%I%&$K$O(B MenuClass $B$,@_Dj$5$l$F$$$F!"(B
110 * MenuClass $B$KDj5A$5$l$?2hLL$NA+0\$r9T$J$&!#(B
111 */
112 static int AuxEvent(acomm, aajcode, ceCmd, length)
113 _XatokRecPtr acomm;
114 WORD *aajcode;
115 WORD *ceCmd;
116 int *length;
117 {
118 int status ;
119
120 *length = 0 ;
121
122 #ifdef ATOK_DEBUG
123 printf( "AUX KEY 0x%x\n", *aajcode ) ;
124 #endif /* ATOK_DEBUG */
125 status = MenuCtrl( acomm, &acomm->curAux, aajcode, 0, length ) ;
126 #ifdef ATOK_DEBUG
127 printf( "MENU Status = %d\n", status ) ;
128 #endif /* ATOK_DEBUG */
129 /*
130 * NULL $B$K$J$C$?>l9g$O(BAUX WINDOW$B$r%-%c%s%;%k$5$l$?>l9g(B
131 * status : -1 $BJQ99$J$7(B(DefaultProc $B$G=hM}(B)
132 * : 0 $B%a%K%e!<$NA*BrJQ99(B
133 * : 1 $B%a%K%e!<JQ99(B
134 * : 2 $B%a%K%e!<$N3NDj(B
135 *
136 * MenuStatus : 1 AuxStart
137 * 2 AuxChange
138 * 3 AuxEnd
139 */
140 switch( status ) {
141 case 1 :
142 /* $B%a%K%e!<JQ99$"$j(B */
143 /* printf( "acomm->curAux 0x%x\n", acomm->curAux ) ; */
144 if ( !acomm->curAux ) {
145 acomm->curAux = acomm->menuAux ;
146 acomm->menuStatus = ICAuxEnd ; /* END */
147 }
148 break ;
149 case 2 :
150 /* $B%a%K%e!<3NDj(B */
151 acomm->menuStatus = ICAuxChange ;
152 break ;
153 case -1 :
154 acomm->menuStatus = ICAuxChange ;
155 return *length ;
156 case 0 :
157 default :
158 acomm->menuStatus = ICAuxChange ;
159 return 0 ;
160 }
161 /* return 0 ; */
162 return *length ;
163 }
164
165 /* Page */
166 /*
167 * [$B4X?tL>(B]
168 * CandEvent( )
169 * [$BI=Bj(B]
170 * $B8uJd%&%#%s%I%&I=<(;~$N%$%Y%s%H=hM}(B
171 * [$B8F=P7A<0(B]
172 * int CandEvent( _XatokRecPtr acomm, WORD *aajcode, WORD *ceCmd )
173 *
174 * [$B0z?t(B]
175 * $B7?(B : $BL>(B $B>N(B : IO : $B@b(B $BL@(B
176 * _XatokRecPtr : acomm : i/o : kinput2$BMQJQ49%P%C%U%!(B
177 * WORD : *aajcode : i/o : $BF~NO%-!<%3!<%I(B
178 * WORD : *ceCmd : o : ATOK12CE $B$N%3%^%s%IHV9f(B
179 *
180 *
181 * [$BJV$jCM(B]
182 * 0 : $B%-!<F~NO%$%Y%s%H$r(BCE$B$XEO$5$J$$(B
183 * 1 : $B%-!<F~NO%$%Y%s%H$r(BCE$B$XEO$9(B
184 *
185 * [$B;HMQ4X?t(B]
186 * atokCandidate( )
187 * [$B5!G=(B]
188 * $B8uJd%&%#%s%I%&$,I=<($5$l$F$$$k;~$N%$%Y%s%H=hM}$r9T$J$&!#(B
189 * $B%$%Y%s%H=hM}$OF~NO$5$l$?(B aajcode $B$K$h$jBP1~$9$k=hM}$,(B
190 * $B7hDj$9$k!#$3$3$G%A%'%C%/$7$F$$$k%3!<%I$O(B
191 * kinput2 $B$N(BAtokClass $B$N%b%8%e!<%k$G$bI=<(@)8f$N$?$a(B
192 * $B%A%'%C%/$7$F$$$k!#(B
193 * CTR_DEL $B$,2!$5$l$?;~$O!"(Bkinput2 $BB&$GJQ99$5$l$?%+%l%s%H8uJd$r(B
194 * $B%(%s%8%s$KEA$($F$+$i!"(BCTR_DEL $B$N:o=|=hM}$r8F$S=P$9!#(B
195 */
196 static int CandEvent(acomm, aajcode, ceCmd)
197 _XatokRecPtr acomm;
198 WORD *aajcode;
199 WORD *ceCmd;
200 {
201 int pgMax ;
202 int len = 0 ;
203
204 pgMax = acomm->kohoMax ;
205
206 switch( *aajcode ) {
207 case EESC :
208 *aajcode = FUNC_CNV_CANCL ;
209 return 0 ;
210 case LEFT :
211 case RIGHT :
212 case DOWN :
213 case UP :
214 case CTR_U :
215 case CTR_N :
216 case CTR_F :
217 case CTR_B :
218 case CTR_A :
219 return 0 ;
220 case CTR_DEL :
221 /*
222 * $B8=:_(B $BI=<(>eA*Br$5$l$F$$$k8uJd$r%(%s%8%s$KEA$($k(B
223 * $BI,MW$,$"$k!#(B
224 */
225 *aajcode = acomm->kohoPos ;
226 atokCandidate( acomm, *aajcode ) ;
227 *aajcode = CTR_DEL ;
228 acomm->convStatus |= M_WDEL ; /* 623 */
229 return 1 ;
230 case SPACE :
231 *aajcode = SPACE ;
232 /* *aajcode = XFER ; */
233 return 0 ; /* 617 */
234 break ;
235 case CR :
236 /*
237 * kinput2 $BB&$GA*Br$5$l$F$$$k=j$H%(%s%8%sFb$G(B
238 * $BA*Br$5$l$F$$$k=j$rF14|$5$;$k!#(B
239 */
240 *aajcode = acomm->kohoPos ;
241
242 acomm->NETrqst.AtCEIncode = acomm->kohoPos ;
243 #ifdef ATOK_DEBUG
244 printf( "\301\252\302\362\244\265\244\354\244\277\270\365\312\344\310\326\271\346 (%d) Page (%d)\n"/*=$BA*Br$5$l$?8uJdHV9f(B (%d) Page (%d)\n=*/,
245 acomm->NETrqst.AtCEIncode,
246 acomm->kohoCurPage ) ;
247 #endif /* ATOK_DEBUG */
248 len = 1 ;
249 break ;
250 /*
251 * $B?t;z%-!<$N>l9g$O8uJdHV9f$rA*Br$7$?;v$H$9$k!#(B
252 * $BM-8z$J?t;z$K$D$$$F$O%A%'%C%/$9$k;v(B
253 */
254
255 default :
256 len = 0 ;
257 #ifdef CAND_PAGE
258 if ( *aajcode >= '1' && *aajcode <= '9' ) {
259 *aajcode -= '1' ;
260 len = 1 ;
261 }
262 else if ( *aajcode >= 'a' && *aajcode <= 'z' ) {
263 *aajcode -= 'a' ;
264 *aajcode += 10 ;
265 len = 1 ;
266 }
267 else if ( *aajcode >= 'A' && *aajcode <= 'Z' ) {
268 *aajcode -= 'A' ;
269 *aajcode += 10 ;
270 len = 1 ;
271 }
272 *aajcode = acomm->kohoCurPage * pgMax + *aajcode ;
273 *aajcode = acomm->kohoCurPage * pgMax + *aajcode ;
274 #else
275 len = 0 ;
276 #endif
277 }
278 if ( len > 0 ) {
279 #ifdef ATOK_DEBUG
280 Printf( "\270\365\312\344 \270\275\272\337\244\316\245\332\241\274\245\270 (%d)\n"/*=$B8uJd(B $B8=:_$N%Z!<%8(B (%d)\n=*/, acomm->kohoCurPage ) ;
281 printf( "\270\365\312\344 \263\316\304\352\310\326\271\346 (%d)\n"/*=$B8uJd(B $B3NDjHV9f(B (%d)\n=*/, *aajcode ) ;
282 printf( "\270\365\312\344 \263\316\304\352\310\326\271\346 (%d)\n"/*=$B8uJd(B $B3NDjHV9f(B (%d)\n=*/, acomm->NETrqst.AtCEIncode ) ;
283 #endif /* ATOK_DEBUG */
284 atokCandidate( acomm, *aajcode ) ;
285
286 *aajcode = VKEY|FUNC_KAKU_BUBUN ;
287
288 }
289 return len ;
290 }
291 /* Page */
292 /*
293 * [$B4X?tL>(B]
294 * KeyEvent( )
295 * [$BI=Bj(B]
296 * $B%-!<F~NO%$%Y%s%H=hM}(B
297 * [$B8F=P7A<0(B]
298 * int KeyEvent( _XatokRecPtr acomm, WORD *aajcode, WORD *ceCmd )
299 *
300 * [$B0z?t(B]
301 * $B7?(B : $BL>(B $B>N(B : IO : $B@b(B $BL@(B
302 * _XatokRecPtr : acomm : i/o : kinput2$BMQJQ49%P%C%U%!(B
303 * WORD : *aajcode : i/o : $BF~NO%-!<%3!<%I(B
304 * WORD : *ceCmd : o : ATOK12CE $B$N%3%^%s%IHV9f(B
305 *
306 * [$BJV$jCM(B]
307 * 0 : $B%-!<F~NO%$%Y%s%H$r(BCE$B$XEO$5$J$$(B
308 * 1 : $B%-!<F~NO%$%Y%s%H$r(BCE$B$XEO$9(B
309 *
310 * [$B;HMQ4X?t(B]
311 * atokCandidate( )
312 * XatokBufferConvert( )
313 * [$B5!G=(B]
314 * $BDL>oF~NO>uBV$G$N%-!<F~NO%$%Y%s%H$N=hM}$r9T$J$&!#(B
315 * $BDL>o$N>uBV$G$O$J$/!"B>$N%$%Y%s%H=hM}$r9T$J$o$l$?8e$G$b(B
316 * $B%(%s%8%s$K%-!<$rEO$9I,MW$,$"$k>l9g$K$O8F$S=P$5$l$k!#(B
317 */
318 static int KeyEvent(acomm, aajcode, ceCmd, wbuf, length, status, enable, change, elseEvent)
319 _XatokRecPtr acomm;
320 WORD *aajcode;
321 WORD *ceCmd;
322 wchar *wbuf;
323 int *length;
324 int *status;
325 int *enable;
326 int *change;
327 int *elseEvent;
328 {
329 int call = 1 ;
330 int sRet = 0 ;
331 WORD key ;
332
333 *length = 0 ;
334 *status = 0 ;
335 *enable = 0 ;
336 *change = 0 ;
337 acomm->NETrqst.AtCEIncode = 0 ;
338 acomm->NETrqst.AtCEPrvAPIOutinf = 0 ;
339 /*
340 * $BL$3NDjJ8;zNs$,$J$$$H$-$K@)8f%-!<$r2!$5$l$?>l9g$K$O(B
341 * $B%-!<$r$=$N$^$^JV$9!#(B
342 * $B@)8f%-!<$K$D$$$F$N(B if $BJ8$O(B $B=$@5$9$kI,MW$"$j!#(B
343 */
344 #if 0
345 if ( !acomm->echoLen && *aajcode == CR ) {
346 /*
347 (
348 *aajcode == CR ||
349 *aajcode == SPACE ||
350 *aajcode == BS
351 )) {
352 */
353 printf( "\245\271\245\353\241\274 KEY %x\n"/*=$B%9%k!<(B KEY %x\n=*/, *aajcode ) ;
354 #ifdef ATOK_DEBUG
355 #endif /* ATOK_DEBUG */
356 wbuf[0] = *aajcode & 0xff ;
357 *length = 1 ;
358 return 1 ;
359 }
360 #endif
361 key = *aajcode ;
362 /*
363 * CTRL + W $B$O(B $BF~NO%b!<%I$N@Z$jBX$(%-!<(B
364 * $B%-!<F~NOCf$KBP1~$7$?(BAAJ CODE$B$N5!G=$G(B SWITCH$B$9$k$3$H!#(B
365 */
366 switch( *aajcode ) {
367 case CTR_F7 :
368 case CTR_W :
369 if ( acomm->echoLen > 0 ) {
370 return 0 ;
371 }
372 acomm->convStatus = M_AUX ;
373 MenuCtrl( acomm, &acomm->curAux, aajcode, 1, length ) ;
374 acomm->menuStatus = ICAuxStart ;
375 return 0 ;
376 case SPACE :
377 *ceCmd = IME_PRV_KEYCONVERT ;
378 /* *aajcode = XFER ; */
379 /* key = XFER ; */
380 /*
381 * $B$3$3$O(B $B%9%Z!<%9%-!<$N3dEv$r%A%'%C%/$9$k;v(B
382 */
383 if ( !acomm->echoLen ) key = SPACE ;
384 else key = XFER ;
385 /* key = XFER ; */
386 key = SPACE ; /* 616 */
387
388 acomm->NETrqst.AtCEIncode = key & 0xffff ;
389 sRet = 1 ;
390 break ;
391 /* KEYCONV */
392 default :
393 *ceCmd = IME_PRV_KEYCONVERT ;
394 acomm->NETrqst.AtCEIncode = *aajcode & 0xffff ;
395 sRet = 1 ;
396 break ;
397 }
398
399 if ( call ) {
400 acomm->NETrqst.ceCmd = *ceCmd ;
401
402 #ifdef ATOK_DEBUG
403 printf( "COMMUNICATE CMD(%d) AAJCODE(0x%04x)\n", *ceCmd, *aajcode & 0xffff ) ;
404 #endif /* ATOK_DEBUG */
405 AtokClntCommunicate( acomm->sock, &acomm->NETrqst, &acomm->NETrslt ) ;
406 #ifdef ATOK_DEBUG
407 printf( "REQ OK\n" ) ;
408 #endif /* ATOK_DEBUG */
409 }
410
411 *length = XatokBufferConvert( acomm, *ceCmd, &acomm->NETrslt,
412 status, enable, change, elseEvent ) ;
413
414 #ifdef ATOK_DEBUG
415 printf( "\270\365\312\344\244\316\277\364\244\362\245\301\245\247\245\303\245\257(%d)\241\243\n"/*=$B8uJd$N?t$r%A%'%C%/(B(%d)$B!#(B\n=*/, acomm->kohoNum ) ;
416 printf( "CAND STAT (%d)\n", acomm->convStatus & M_CAND ) ;
417 #endif /* ATOK_DEBUG */
418 /*
419 * $B8uJd$,J#?tB8:_$7!"8=:_$^$@8uJd%&%#%s%I%&$rI=<($7$F$$$J$$$J$i(B
420 * $B8uJd%&%#%s%I%&$rI=<($9$k$?$a$K!"8uJd%j%9%H$r<hF@$9$k!#(B
421 */
422 if ( acomm->kohoNum > 1 &&
423 !( acomm->convStatus & M_CAND ) ) {
424
425 /*
426 * kohoNum $B$K$O(B $B8=:_$O8uJd?t$,F~$C$F$$$k$,!"(B
427 * Candidate $B$r$h$V$H%+%l%s%H8uJdHV9f$K$J$C$F$7$^$&$N$G(B
428 * kohoNum2 $B$K8uJd$NAm?t$rJ]B8$7$F$*$/(B
429 */
430 acomm->kohoNum2 = acomm->kohoNum ;
431
432 #ifdef ATOK_DEBUG
433 printf( "\270\365\312\344\244\254\244\242\244\303\244\277\244\316\244\307 \270\365\312\344\311\275\274\250\245\342\241\274\245\311\244\313\260\334\244\353\241\243\n"/*=$B8uJd$,$"$C$?$N$G(B $B8uJdI=<(%b!<%I$K0\$k!#(B\n=*/ ) ;
434 #endif /* ATOK_DEBUG */
435 atokCandidate( acomm, ATCEPRVAPI_READCMD ) ;
436 acomm->convStatus |= M_CAND ;
437 *aajcode = XFER ;
438 *length = XatokBufferConvert( acomm, *ceCmd, &acomm->NETrslt,
439 status, enable, change, elseEvent ) ;
440 }
441
442 return 1 ;
443 }
444
445 /* Page */
446 /*
447 * [$B4X?tL>(B]
448 * XatokEventControl( )
449 * [$BI=Bj(B]
450 * $B%-!<F~NO$N<u$1IU$1(B
451 * [$B8F=P7A<0(B]
452 * int XatokEventControl( AtokPart
453 * [$B0z?t(B]
454 * $B7?(B : $BL>(B $B>N(B : IO : $B@b(B $BL@(B
455 *
456 *
457 * [$BJV$jCM(B]
458 *
459 * [$B;HMQ4X?t(B]
460 *
461 * [$B5!G=(B]
462 * X $B$+$i$N%$%Y%s%H$r<u$1<h$j(B ATOK $B$N(B AAJCODE$B$KJQ49$7$F!"(B
463 * ATOK CE $B$KJQ49$r0MMj$9$k!#(B
464 * $BJQ497k2L$r<u$1<h$C$?8e$K!"(BlibXatok $BMQ$KJQ497k2L$r(B
465 * $B%P%C%U%!$K@_Dj$9$k!#(B
466 *
467 */
468 int XatokEventControl(acomm, event, xkey, kbuf, nbytes, aajcode, status, enable, change, elseEvent)
469 /* Fix Length */
470 _XatokRecPtr acomm;
471 XKeyEvent *event;
472 KeySym xkey;
473 char *kbuf;
474 int nbytes;
475 WORD *aajcode;
476 int *status;
477 int *enable;
478 int *change;
479 int *elseEvent;
480 {
481 char euc[BUFSIZ*4] ; /* $BFI$_I=<($N$?$a$N%P%C%U%!(B */
482 int es ; /* euc $BJ8;zNs$ND9$5(B */
483 unsigned char *sp ;
484 wchar *wbuf ;
485
486 WORD ceCmd = -1 ; /* CE $B$XAw$k%3%^%s%I(B */
487 int length ; /* $B3NDjJ8;zNs$ND9$5(B */
488 extern WORD getAAJCode( ) ;
489 int i ; /* WORK */
490 int sRet ;
491
492 wbuf = acomm->wbuf ;
493 *status = 0 ;
494 wbuf[0] = 0 ;
495 length = 0 ;
496 acomm->wlen = 0 ;
497
498 /*
499 * $BK\Ev$O$3$3$G(B ATOK CE$B$r8F$S=P$7(B $BJQ497k2L$r8+$F=hM}$r$9$k!#(B
500 * CE $B$r8F$S=P$9(BAPI$B$O(B X$B$N%-!<%$%Y%s%H$r8+$F(B AAJCODE$B$K$9$k!#(B
501 * $B3NDj$7$?J8;z$,$"$k>l9g$K$O!"(B wbuf $B$K3NDjJ8;z$r@_Dj$9$k!#(B
502 * $B3NDj$7$J$+$C$?>l9g$K$O!"F~NOJ8;z$H$7$F(Bprebuf $B$K%;%C%H$9$k!#(B
503 */
504 /*
505 * $B$3$3$G(B $B%-!<F~NO$r(BATOK$B$N%3!<%I(B(AAJCODE)$B$KJQ49$7$F!"(B
506 * $B3F%b!<%I;~$KBP1~$7$?%3%^%s%I$NE83+$9$k!#(B
507 */
508 *aajcode = getAAJCode( event, xkey, kbuf ) ;
509 #ifdef ATOK_DEBUG
510 printf( "aajcode 0x%x = len = %d\n", *aajcode, acomm->echoLen ) ;
511 printf( "convStatus %d\n", acomm->convStatus ) ;
512 #endif /* ATOK_DEBUG */
513 if ( *aajcode == 0 ) {
514 return 0 ;
515 }
516
517 /*
518 * $B%-!<%$%Y%s%H$,H/@8$7$F$3$N4X?t$K$H$s$GMh$?;~$K(B
519 * $B%b!<%I$,@_Dj$5$l$F$$$J$$>l9g$K$O!"JQ493+;O$N%-!<$r(B
520 * $B2!$5$l$?;~$G$"$k$N$G!"%-!<JQ49%b!<%I$K@_Dj$9$k!#(B
521 */
522 if ( acomm->convStatus == M_NOKEYCONV ) {
523 atokKanjiOn( acomm ) ;
524 /* printf( "KANJI ON MODE (%d)\n", acomm->convStatus ) ; */
525 }
526
527 /*
528 * CTRL_SPACE $B$O(B $B4A;z(BON$B!?(BOFF$B$N@Z$jBX$(%-!<(B
529 * CTRL_SPACE $B$O$I$s$J>l9g$G$b4A;z(BOFF
530 */
531 if ( *aajcode == SFT_SP ) {
532 #ifdef ATOK_DEBUG
533 printf( "AAJ SFT_SP -> KANJIOFF\n" ) ;
534 #endif /* ATOK_DEBUG */
535 if ( acomm->convStatus == M_KEYCONV ) {
536 atokKanjiOff( acomm ) ;
537 /* printf( "KANJI ON OFF (%d)\n", acomm->oldStatus ) ; */
538 }
539 return 0 ;
540 }
541
542 if ( acomm->convStatus & M_AUX ) {
543 /*
544 * AUX $B%&%#%s%I%&(B $BI=<(Cf$N%$%Y%s%H=hM}(B
545 */
546
547 sRet = AuxEvent( acomm, aajcode, &ceCmd, &length ) ;
548 /* printf( "AUX %d RETURN LENGTH = %d\n", sRet, length ) ; */
549 if ( sRet < 1 ) {
550 return length ;
551 }
552 }
553 /* if ( acomm->convStatus & M_CAND ) { */
554 /*
555 * $B8uJd%&%#%s%I%&$rI=<(Cf$G$+$D%7%9%F%`9T$rI=<($7$F$$$J$$>l9g$N(B
556 * $B%$%Y%s%H=hM}(B
557 */
558 if ( acomm->convStatus & M_WDEL ) {
559 sRet = WordDelEvent( acomm, aajcode, &ceCmd ) ;
560 if ( sRet == 0 ) {
561 return 0 ;
562 }
563 }
564 if ( acomm->convStatus & M_CAND &&
565 !( acomm->convStatus & M_SYSLINE )) { /* 616 */
566 /*
567 * $B8uJd%&%#%s%I%&$rI=<(Cf$N%$%Y%s%H=hM}(B
568 */
569 sRet = CandEvent( acomm, aajcode, &ceCmd ) ;
570 /*
571 * $B%9%F!<%?%9$,#00J30$N;~$O!"8uJd$,3NDj$5$l$?;~(B
572 */
573 if ( sRet == 0 ) {
574 return 0 ;
575 }
576 }
577 /*
578 * $B$=$NB>$O(B $BDL>o$N%-!<F~NO%$%Y%s%H(B
579 */
580 /* printf( "KEY CONV AAJ 0x%x\n", *aajcode ) ; */
581 KeyEvent( acomm, aajcode, &ceCmd, wbuf, &length,
582 status, enable, change, elseEvent ) ;
583
584 /* printf( "$B8uJd$NHV9f(B(%d)$B!#(B\n", acomm->kohoPos ) ; */
585 #ifdef ATOK_DEBUG
586 printf( "\263\316\304\352\312\270\273\372\316\363EVENT[%s]\n"/*=$B3NDjJ8;zNs(BEVENT[%s]\n=*/, acomm->wbuf ) ;
587 #endif /* ATOK_DEBUG */
588 acomm->wlen = length ;
589
590 return length ;
591 }
592
593 /* End of event.c */