Mercurial > kinput2.yaz
comparison lib/Xatoklib/compstr.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: compstr.c,v 1.2 1999/08/24 09:01:08 ishisone Exp $" ; | |
20 #endif /* !lint */ | |
21 #include <Xatoklib.h> | |
22 #include <key_def.h> | |
23 | |
24 /* Page */ | |
25 /* | |
26 * [$B4X?tL>(B] | |
27 * XatokCompStr( ) | |
28 * [$BI=Bj(B] | |
29 * $BL$3NDjJ8;zNs>uBV<hF@(B | |
30 * [$B8F=P7A<0(B] | |
31 * int XatokCompStr( WCHAR *compStr, WORD *compAttr, | |
32 * WORD compLen, int *revPos, int *revLen ) | |
33 * | |
34 * [$B0z?t(B] | |
35 * $B7?(B : $BL>(B $B>N(B : IO : $B@b(B $BL@(B | |
36 * WCHAR : *compStr : i : $BL$3NDjJ8;zNs(B | |
37 * WORD : *compAttr : i : $BL$3NDjJ8;zNsB0@-(B | |
38 * WORD : compLen : i : $BL$3NDjJ8;zNsD9$5(B | |
39 * int : *revPos : o : $BH?E>I=<(3+;O0LCV(B | |
40 * int : *revLen : o : $BH?E>I=<(D9$5(B | |
41 * | |
42 * [$BJV$jCM(B] | |
43 * $B%;%0%a%s%H$N8D?t(B(1-3) | |
44 * | |
45 * [$B;HMQ4X?t(B] | |
46 * $B$J$7(B | |
47 * [$B5!G=(B] | |
48 * $BL$3NDjJ8;zNs$NJ8;z>pJs!"B0@->pJs$h$j!"(B | |
49 * $BL$3NDjJ8;zNs$NI=<(>uBV$r<hF@$9$k!#(B | |
50 * $BI=<(>uBV$H$O!"(B $B%N!<%^%kI=<(!"H?E>I=<($+$i@.N)$A!"(B | |
51 * $B:GBg#3$D$N%;%0%a%s%H$KJ,3d$5$l$k!#(B | |
52 * | |
53 */ | |
54 | |
55 int XatokCompStr(compStr, compAttr, compLen, revPos, revLen) | |
56 WCHAR *compStr; | |
57 WORD *compAttr; | |
58 WORD compLen; | |
59 int *revPos; | |
60 int *revLen; | |
61 { | |
62 int i ; | |
63 int nseg = 0 ; | |
64 int prevAttr = -1 ; | |
65 int isReverse = 0 ; | |
66 *revPos = 0 ; | |
67 *revLen = 0 ; | |
68 | |
69 for( i = 0 ; i < ( int )compLen ; i++ ) { | |
70 /* printf( "compAttr[%d] = %d\n", i , compAttr[i] ) ; */ | |
71 switch( compAttr[i] ) { | |
72 case ATCOLINDX_TARGETCONVERT: | |
73 case ATCOLINDX_TARGETNOTCONVERTED: | |
74 case ATCOLINDX_INPUTCUR: | |
75 case ATCOLINDX_INPUTCURKOTEI: | |
76 case ATCOLINDX_TARGETNOTCONVERTEDKOTEI: | |
77 case ATCOLINDX_TARGETCOMMENT : | |
78 ( *revLen )++ ; | |
79 if ( !isReverse ) { | |
80 *revPos = i ; | |
81 isReverse = 1 ; | |
82 } | |
83 if ( prevAttr != 1 ) { | |
84 prevAttr = 1 ; | |
85 nseg++ ; | |
86 } | |
87 break ; | |
88 default : | |
89 if ( prevAttr != 0 ) { | |
90 prevAttr = 0 ; | |
91 nseg++ ; | |
92 } | |
93 break ; | |
94 } | |
95 } | |
96 return nseg ; | |
97 } | |
98 | |
99 /* End of compstr.c */ |