annotate lib/Xsj3clib/symbol.c @ 21:7a454839a6de default tip

add some missing header files
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 09 Mar 2010 19:02:39 +0900
parents 92745d501b9a
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 #ifndef lint
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
2 static char *rcsid = "$Id: symbol.c,v 2.0 1992/02/13 18:33:43 nao Exp $";
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
3 #endif
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
4 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
5 * Copyright 1991 Sony Corporation
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
6 *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
7 * Permission to use, copy, modify, distribute, and sell this software and its
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
8 * documentation for any purpose is hereby granted without fee, provided that
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
9 * the above copyright notice appear in all copies and that both that
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
10 * copyright notice and this permission notice appear in supporting
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
11 * documentation, and that the name of Sony not be used in advertising or
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
12 * publicity pertaining to distribution of the software without specific,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
13 * written prior permission. Sony makes no representations about the
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
14 * suitability of this software for any purpose. It is provided "as is"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
15 * without express or implied warranty.
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 * SONY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SONY
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
19 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
22 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
23 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
24 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
25 * Author: Naoshi Suzuki, SONY Corporation. (nao@sm.sony.co.jp)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
26 */
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 #include <stdio.h>
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
29 #include "common.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
30 #include "util.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
31 #include "func.h"
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
32 #include "table.h"
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 Xsj3cSymbol _Xsj3cSymbolInit();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
35 int Xsj3cGetSymbolNum();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
36 Xsj3cSymbol Xsj3cGetSymbols();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
37 wchar *Xsj3cGetSymbol();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
38 int Xsj3cSetSymbol();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
39 void Xsj3cEndSymbol();
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 static int _Xsj3cReadSymbol();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
42
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
43 static Xsj3cSymbol symbollist = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
44 static int symbolnum = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
45
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
46 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
47 * _Xsj3cSymbolInit()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
48 * Decide sjsb file to read, then read it and make table for symbles.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
49 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
50 Xsj3cSymbol
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
51 _Xsj3cSymbolInit(sjsb, home)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
52 char *sjsb;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
53 char *home;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
54 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
55 extern char *getenv();
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
56 register char *p;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
57 char sbfile[BUFSIZ];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
58 int value;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
59
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
60 if (symbollist) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
61 return(symbollist);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
62 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
63 if (sjsb) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
64 if ((value = _Xsj3cReadSymbol(sjsb)) > 0)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
65 Xsj3cError("can't open sjsb file %s", sjsb);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
66 else if ( value < 0 )
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
67 Xsj3cError("read failed sjsb file %s", sjsb);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
68 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
69 sbfile[0] = '\0';
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
70 if ((p = getenv("SJSB")) && *p != '\0') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
71 if (*p != '/') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
72 if (home)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
73 strcpy(sbfile, home);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
74 strcat(sbfile, "/");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
75 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
76 strcat(sbfile, p);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
77 } else if (home) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
78 strcpy(sbfile, home);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
79 strcat(sbfile, "/.sjsb");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
80 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
81 strcpy(sbfile, SJ3DEFPATH);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
82 strcat(sbfile, DEF_SJSB_FILE);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
83 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
84 if ((value = _Xsj3cReadSymbol(sbfile)) > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
85 strcpy(sbfile, SJ3DEFPATH);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
86 strcat(sbfile, DEF_SJSB_FILE);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
87 if ((value = _Xsj3cReadSymbol(sbfile)) > 0) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
88 Xsj3cError("can't open sjsb file %s", sbfile);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
89 } else if ( value < 0 ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
90 Xsj3cError("read failed sjsb file %s", sbfile);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
91 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
92 } else if ( value < 0 ) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
93 Xsj3cError("read failed sjsb file %s", sbfile);
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 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
96 return(symbollist);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
97 }
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 * _Xsj3cReadSymbol()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
101 * Read sjsb file that is symbol table file.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
102 * Make symbol table and return it.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
103 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
104 static int
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
105 _Xsj3cReadSymbol(file)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
106 char *file;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
107 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
108 FILE *fp;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
109 unsigned char line[256];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
110 unsigned char *p;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
111 int len;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
112 wchar data[RBUFSIZ];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
113 register int i, j;
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 if ((fp = fopen(file, "r")) == NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
116 return (OPEN_FAILED);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
117 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
118
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
119 i = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
120 while (fgets(line, sizeof(line), fp) != NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
121 if (line[0] != '#' && line[0] != '\n')
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
122 i++;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
123 }
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 symbolnum = i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
126 if ((symbollist = (Xsj3cSymbol)calloc(i, sizeof(Xsj3cSymbolRec))) == NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
127 return (ALLOC_FAILED);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
128 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
129
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
130 rewind(fp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
131
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
132 j = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
133 while (fgets(line, sizeof(line), fp) != NULL && j < i) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
134 p = line;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
135 while (*p != '\n' && *p != '#') {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
136 p += _Xsj3cmINtowOUT(file, p, data, &len);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
137 SKIP(p);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
138 if (data[0] == '\0')
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
139 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
140 symbollist[j].data = _Xsj3cStoreWchar(data, len + 1);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
141 symbollist[j].len = len;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
142 if (!symbollist[j].data)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
143 return (ALLOC_FAILED);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
144 j++;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
145 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
146 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
147 fclose(fp);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
148 return (OK);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
149 }
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 * Xsj3cGetSymbolNum()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
153 * Set the appointed (by 2nd argument) symbol to 3rd argument.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
154 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
155 int
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
156 Xsj3cGetSymbolNum(buf, cur)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
157 Xsj3cBuf buf;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
158 int *cur;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
159 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
160 if (!buf->symbol) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
161 buf->symbol = _Xsj3cSymbolInit(NULL, NULL);
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 *cur = buf->cursymbol;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
164 return (symbolnum);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
165 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
166
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 * Xsj3cGetSymbols()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
169 * Set the appointed (by 2nd argument) symbol to 3rd argument.
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 Xsj3cSymbol
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
172 Xsj3cGetSymbols(buf)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
173 Xsj3cBuf buf;
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 if (!buf->symbol) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
176 buf->symbol = _Xsj3cSymbolInit(NULL, NULL);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
177 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
178 return (buf->symbol);
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 * Xsj3cGetSymbol()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
183 * Set the appointed (by 2nd argument) symbol to 3rd argument.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
184 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
185 wchar *
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
186 Xsj3cGetSymbol(buf, n, len)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
187 Xsj3cBuf buf;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
188 int n;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
189 int *len;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
190 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
191 if (!buf->symbol) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
192 buf->symbol = _Xsj3cSymbolInit(NULL, NULL);
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 *len = buf->symbol[n].len;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
195 return (buf->symbol[n].data);
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
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 * Xsj3cSetSymbol()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
200 * Set the selected symbol to the buffers.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
201 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
202 int
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
203 Xsj3cSetSymbol(buf, sel_symbol, changed, flush)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
204 Xsj3cBuf buf;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
205 int sel_symbol;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
206 int *changed;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
207 int *flush;
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 Xsj3cSeg seg;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
210 int change_pos;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
211 register int i;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
212 wchar symbol[RBUFSIZ];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
213
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
214 if (buf->segnum && buf->input[buf->curseg]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
215 && (buf->input[buf->curseg]->edit & SEG_NOEDIT)) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
216 /* $B8=J8@a$,JQ49:Q$_$N>l9g(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
217 if (buf->candidate)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
218 Xsj3cEndCandidate(buf, ON);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
219 /* FlushInConverion on $B$N;~$O3NDj$9$k(B */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
220 switch (buf->flushiconv) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
221 case ON:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
222 for (i = 1; i < buf->backsegnum + 1; i++) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
223 Xsj3cFreeSegment(buf->backup[i]);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
224 buf->backup[i] = NULL;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
225 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
226 if (!buf->backup) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
227 if ((buf->backup = (Xsj3cSeg *)calloc(BUNBUFSIZ,
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
228 sizeof(Xsj3cSeg))) == NULL) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
229 Xsj3cError("Cannot allocate for backup buffers");
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
230 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
231 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
232 if (seg = buf->backup[0]) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
233 Xsj3cClearSegment(buf, seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
234 } else
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
235 seg = buf->backup[0] = (Xsj3cSeg)Xsj3cCreateSegment(buf);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
236 buf->backsegnum = 1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
237 *flush = ON;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
238 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
239 case EDIT:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
240 if (!(seg = buf->input[buf->curseg]))
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
241 seg = buf->input[buf->curseg]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
242 = (Xsj3cSeg)Xsj3cCreateSegment(buf);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
243 *seg->str = '\0';
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
244 seg->sp = seg->str;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
245 *seg->oldstr = '\0';
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
246 seg->oldlen = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
247 seg->n_roma = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
248 seg->n_kana = -1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
249 if (buf->curseg == buf->segnum)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
250 buf->segnum++;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
251 else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
252 _Xsj3cUnConvSeg(buf, ONE, buf->muhencurlast);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
253 _Xsj3cStoreYomi(buf, seg, 0);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
254 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
255 *flush = OFF;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
256 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
257 case OFF:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
258 if (seg = buf->input[buf->segnum]) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
259 Xsj3cClearSegment(buf, seg);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
260 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
261 seg = buf->input[buf->segnum]
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
262 = (Xsj3cSeg)Xsj3cCreateSegment(buf);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
263 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
264 buf->curseg = buf->segnum;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
265 buf->segnum++;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
266 *flush = OFF;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
267 break;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
268 case NONE:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
269 default:
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
270 *flush = OFF;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
271 *changed = OFF;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
272 return 0;
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 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
275 seg = buf->input[buf->curseg];
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
276 if (buf->curseg == buf->segnum) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
277 buf->segnum++;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
278 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
279 if (!seg) {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
280 seg = buf->input[buf->curseg] = (Xsj3cSeg)Xsj3cCreateSegment(buf);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
281 } else {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
282 *seg->str = '\0';
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
283 seg->sp = seg->str;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
284 seg->n_roma = 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
285 seg->n_kana = -1;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
286 *seg->oldstr = '\0';
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
287 seg->oldlen = 0;
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 seg->edit = SEG_EDIT;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
291 change_pos = seg->cur;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
292 _Xsj3cwOUTtowPS(buf, symbol, buf->symbol[sel_symbol].data);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
293 _Xsj3cInsertWchar(seg, symbol, buf->symbol[sel_symbol].len);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
294 _Xsj3cStoreYomi(buf, seg, change_pos);
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
295 buf->cursymbol = sel_symbol;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
296 *changed = ON;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
297
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
298 return 0;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
299 }
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
300
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
301 /*
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
302 * Xsj3cEndSymbol()
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
303 * End symbol input mode(SelectMode) and back to InputMode.
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
304 */
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
305 void
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
306 Xsj3cEndSymbol(buf)
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
307 Xsj3cBuf buf;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
308 {
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
309 buf->convmode = InputModeMask;
92745d501b9a initial import from kinput2-v3.1
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
310 }