File: sysline.c

package info (click to toggle)
kinput2 3.1-14
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 3,284 kB
  • sloc: ansic: 49,965; makefile: 104; sh: 68
file content (191 lines) | stat: -rw-r--r-- 5,336 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/* 
 * Copyright 1999 Justsystem Corporation, Japan.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for any purpose and without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation, and that the name of Justsystem Corporation
 * not be used in advertising or publicity pertaining to distribution
 * of the software without specific, written prior permission.  Justsystem 
 * Corporation makes no representations about the suitability of this
 * software for any purpose.  It is provided "as is" without express
 * or implied warranty.
 *
 * Author: Atsushi Irisawa
 */

#ifndef lint
static  char    rcsid[] = "$Id: sysline.c,v 1.2 1999/08/24 09:01:10 ishisone Exp $" ;
#endif  /* !lint */

#include        <stdio.h>
#include        <X11/IntrinsicP.h>
#include        <X11/StringDefs.h>
#include        <X11/Xmu/Atoms.h>
#include        <X11/keysym.h>
#include	<InputConv.h>

#include	<Xatoklib.h>

/* Page */
/*
 * [$B4X?tL>(B]
 *              auxSyslineCtrl( )
 * [$BI=Bj(B]
 *              $B%G!<%?$NAw?.(B
 * [$B8F=P7A<0(B]
 *      	int auxSyslineCtrl( _XatokRecPtr acomm, int isdecision )
 *
 * [$B0z?t(B]
 *              $B7?(B           : $BL>(B  $B>N(B  : I O : $B@b(B      $BL@(B
 *		_XatokRecPtr : acomm   : i/o : kinput2$BMQJQ49%P%C%U%!(B
 *		int          : isdecision : i : $B3NDj%G!<%?%U%i%0(B
 *
 *
 * [$BJV$jCM(B]
 *		 0 : AUX $B%&%#%s%I%&7QB3(B
 *		 1 : AUX $B%&%#%s%I%&=*N;(B
 *
 * [$B;HMQ4X?t(B]
 *		$B$J$7(B
 * [$B5!G=(B]
 *		SYSLINE$B%G!<%?$N%U%i%0$,(B ATOK12CE $B%(%s%8%s$G@_Dj$5$l$F$$$k>l9g$K(B
 *		$B%7%9%F%`9T$r?75,$K3+$/!"%7%9%F%`9T$NJ8;zNs$rJQ99$9$k!"(B
 *		$B%7%9%F%`9T$rJD$8$k$J$I$N!"I=<($r$I$N$h$&$K9T$J$&$+$rH=CG$9$k(B
 *		$B%U%!%s%/%7%g%s$G$"$j!"I=<($r4IM}$7$F$$$k%b%8%e!<%k$h$j(B
 *		$B8F$S=P$5$l$k!#(B
 */
int auxSyslineCtrl(acomm, isdecision)
_XatokRecPtr    acomm;
int		isdecision;		/* $B3NDjJ8;z$,$"$k$+$J$$$+!)(B */
{
	int	status = 0 ;

#ifdef	ATOK_DEBUG
	printf( "GUIDE isdecision %d\n", isdecision ) ;
	printf( "GUIDE VAL %d\n", acomm->guide_OpenIndex ) ;
	printf( "GUIDE CLOSE VAL %d\n", acomm->guide_closeEventIndex ) ;
	printf( "GUIDE OPEN VAL %d\n", acomm->guide_openEventIndex ) ;
#endif
	if ( acomm->guide_openEventIndex & CEGUIDEINDX_ERROR ) {
		/* printf( "CEGUIDEINDX_ERROR\n" ) ; */
		acomm->convStatus |= M_SYSLINE ;
		if ( acomm->aux_isopened ) {
			acomm->menuStatus = ICAuxChange ;
		}
		else {
			acomm->menuStatus = ICAuxStart ;
		}
		acomm->aux_isopened = 1 ;
	}
	else if ( acomm->guide_OpenIndex & CEGUIDEINDX_CODE )  {
		/* printf( "CEGUIDEINDX_CODE\n" ) ; */
		acomm->convStatus |= M_SYSLINE ;
		if ( acomm->aux_isopened ) {
			acomm->menuStatus = ICAuxChange ;
		}
		else {
			acomm->menuStatus = ICAuxStart ;
		}
		acomm->aux_isopened = 1 ;
	}
	else if ( acomm->guide_OpenIndex & CEGUIDEINDX_KIGOU ) {
		/* printf( "CEGUIDEINDX_CODE\n" ) ; */
		acomm->convStatus |= M_SYSLINE ;
		if ( acomm->aux_isopened ) {
			acomm->menuStatus = ICAuxChange ;
		}
		else {
			acomm->menuStatus = ICAuxStart ;
		}
		acomm->aux_isopened = 1 ;
		status = isdecision ;
	}
	else {
		/* printf( "SYSLINE OTHER\n" ) ; */

		acomm->convStatus ^=  M_SYSLINE ;	/* 0616 */
		acomm->aux_isopened = 0 ;
		acomm->menuStatus = ICAuxEnd ;
		status = 1 ;
	}
	return status ;
}
/* Page */
/*
 * [$B4X?tL>(B]
 *		auxSyslineString( )
 *              AtokNetSend( )
 * [$BI=Bj(B]
 *              $B%7%9%F%`9TJ8;zNs$N:n@.!#(B
 * [$B8F=P7A<0(B]
 *      int auxSyslineString( _XatokRecPtr acomm, menuAux *mAux,
 *		wchar *echoStr, int *echoLen, int *revLen, int	*revPos )
 *
 * [$B0z?t(B]
 *              $B7?(B           : $BL>(B  $B>N(B  : I O : $B@b(B      $BL@(B
 *		_XatokRecPtr : acomm   : i/o : kinput2$BMQJQ49%P%C%U%!(B
 *		menuAux	     : *mAux:     : $B8=:_L$;HMQ(B
 *		wchar	     : *echoStr:   o : $BI=<(J8;zNs(B
 *		int          : *echoLen:   o : $BI=<(J8;zNs$ND9$5(B
 *		int	     : *revLen :   o : $BH?E>3+;O0LCV(B
 *		int	     : *revPos :   o : $BH?E>J8;zNsD9$5(B
 *
 *
 * [$BJV$jCM(B]
 *		-1 : $BAw?.%(%i!<(B
 *		 N : $BAw?.%P%$%H?t(B
 *
 * [$B;HMQ4X?t(B]
 *		$B$J$7(B
 * [$B5!G=(B]
 *		$B%7%9%F%`9T$KI=<($9$kJ8;zNs$r:n@.$7!"H?E>I=<(0LCV!"H?E>I=<($N(B
 *		$BD9$5$r5a$a$k!#(B
 */

int auxSyslineString(acomm, mAux, echoStr, echoLen, revLen, revPos)
_XatokRecPtr    acomm;
menuAux		*mAux;
wchar		*echoStr;
int		*echoLen;
int		*revLen;
int		*revPos;
{
	int	wsize = sizeof( wchar ) ;
	int	isreverse = 0 ;
	int	rev = 0 ;
	int	i ;

	*revPos = 0 ;
	*revLen = 0 ;

	memcpy( acomm->aux_echoStr, acomm->sysLineStr, acomm->sysLineLen * wsize ) ;

	*echoLen = acomm->sysLineLen ;
	for ( i = 0 ; i < acomm->sysLineLen ; i++ ) {
		switch( acomm->sysAttrPtr[i] ) {
			case ATCOLINDX_SYSLINEBACK :
			case ATCOLINDX_SYSLINEINPUT :
			case ATCOLINDX_SYSLINEINPUTCUR :
			case ATCOLINDX_SYSLINENOTSELECTITEM :
			case ATCOLINDX_SYSLINEHOSOKU :
			case ATCOLINDX_SYSLINEGUIDEMESSAGE :
				if ( isreverse ) {
					goto done;
				}
				rev++ ;
				break ;
			case ATCOLINDX_SYSLINESELECTITEM :
				isreverse = 1 ;
				( *revLen ) ++ ;
				break ;
		}
	}
done:
	if ( isreverse ) {
		*revPos = rev ;
	}
	return 1 ;
}
/* End of sysline.c */