annotate Xwnmo/xwnmo/init.c @ 19:e48bf9927b1c

added make rule for build_stamp.h to cWnn and kWnn so that they will be built correctly.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Mon, 14 Apr 2008 17:55:44 +0900
parents bbc77ca4def5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
1 /*
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
2 * $Id: init.c,v 1.2 2001/06/14 18:16:16 ura Exp $
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
3 */
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
4
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
5 /*
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
6 * FreeWnn is a network-extensible Kana-to-Kanji conversion system.
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
7 * This file is part of FreeWnn.
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
8 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
9 * Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
10 * Copyright 1991, 1992 by Massachusetts Institute of Technology
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
11 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
12 * Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
13 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
14 * This program is free software; you can redistribute it and/or modify
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
15 * it under the terms of the GNU General Public License as published by
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
16 * the Free Software Foundation; either version 2, or (at your option)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
17 * any later version.
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
18 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
19 * This program is distributed in the hope that it will be useful,
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
22 * GNU General Public License for more details.
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
23 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
24 * You should have received a copy of the GNU General Public License
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
25 * along with GNU Emacs; see the file COPYING. If not, write to the
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
26 * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
27 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
28 * Commentary:
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
29 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
30 * Change log:
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
31 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
32 * Last modified date: 8,Feb.1999
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
33 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
34 * Code:
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
35 *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
36 */
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
37
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
38 #include "sdefine.h"
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
39 #include "xim.h"
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
40 #include "sheader.h"
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
41 #include "ext.h"
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
42
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
43 static void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
44 default_flag_set ()
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
45 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
46 cursor_colum = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
47 cursor_reverse = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
48 cursor_underline = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
49 cursor_invisible = 1;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
50 cursor_bold = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
51 quote_flag = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
52 send_ascii_char = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
53 send_ascii_stack = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
54 send_ascii_char_quote = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
55 c_c->command_func_stack[0] = NULL;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
56 c_c->func_stack_count = -1;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
57 c_c->buffer_ignored = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
58 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
59
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
60 static int
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
61 copy_env (wc)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
62 register WnnClientRec *wc;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
63 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
64 WnnEnv *p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
65
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
66 for (p = wc->normal_env; p; p = p->next)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
67 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
68 if (get_new_env (c_c, NULL, 0) < 0 || (p->host_name && !(servername = alloc_and_copy (p->host_name))))
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
69 goto ERROR_RET;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
70 envrcname = p->envrc_name;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
71 strcpy (env_name, p->env_name_str);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
72 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
73 for (p = wc->reverse_env; p; p = p->next)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
74 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
75 if (get_new_env (c_c, NULL, 1) < 0 || (p->host_name && !(reverse_servername = alloc_and_copy (p->host_name))))
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
76 goto ERROR_RET;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
77 reverse_envrcname = p->envrc_name;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
78 strcpy (reverse_env_name, p->env_name_str);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
79 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
80
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
81 send_ascii_char = send_ascii_char_def;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
82
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
83 c_c->m_table = wc->m_table;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
84 c_c->m_table->re_count++;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
85 return (0);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
86 ERROR_RET:
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
87 free_env (c_c->normal_env);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
88 free_env (c_c->reverse_env);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
89 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
90 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
91
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
92 static void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
93 add_wnnclientlist (cl)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
94 register WnnClientRec *cl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
95 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
96 cl->next = wnnclient_list;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
97 wnnclient_list = cl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
98 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
99
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
100 static void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
101 remove_wnnclientlist (cl)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
102 register WnnClientRec *cl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
103 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
104 register WnnClientList p, *prev;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
105 for (prev = &wnnclient_list; p = *prev; prev = &p->next)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
106 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
107 if (p == cl)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
108 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
109 *prev = p->next;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
110 break;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
111 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
112 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
113 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
114
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
115 void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
116 add_ximclientlist (cl)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
117 register XIMClientRec *cl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
118 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
119 cl->next = ximclient_list;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
120 ximclient_list = cl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
121 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
122
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
123 void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
124 remove_ximclientlist (cl)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
125 register XIMClientRec *cl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
126 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
127 register XIMClientList p, *prev;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
128 for (prev = &ximclient_list; p = *prev; prev = &p->next)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
129 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
130 if (p == cl)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
131 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
132 *prev = p->next;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
133 break;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
134 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
135 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
136 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
137
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
138 void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
139 add_inputlist (xi)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
140 register XIMInputRec *xi;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
141 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
142 xi->next = input_list;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
143 input_list = xi;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
144 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
145
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
146 void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
147 remove_inputlist (xi)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
148 register XIMInputRec *xi;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
149 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
150 register XIMInputList p, *prev;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
151 for (prev = &input_list; p = *prev; prev = &p->next)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
152 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
153 if (p == xi)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
154 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
155 *prev = p->next;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
156 break;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
157 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
158 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
159 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
160
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
161 static WnnClientRec *
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
162 find_same_lang (lang)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
163 char *lang;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
164 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
165 register XIMClientRec *p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
166 register XIMLangRec *xl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
167 register int i;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
168 for (p = ximclient_list; p != NULL; p = p->next)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
169 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
170 for (i = 0; i < p->lang_num; i++)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
171 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
172 xl = p->xl[i];
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
173 if (xl->w_c && xl->w_c->m_table)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
174 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
175 if (!strcmp (xl->lang_db->lang, lang) && xl->w_c != NULL)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
176 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
177 return ((WnnClientRec *) xl->w_c);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
178 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
179 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
180 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
181 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
182 return ((WnnClientRec *) NULL);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
183 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
184
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
185 int
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
186 allocate_wnn (uname)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
187 char *uname;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
188 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
189 int len = 0;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
190 register char *p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
191 extern void bzero ();
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
192
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
193 if (uname && *uname)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
194 len = strlen (uname) + 1;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
195 if (!(p = Malloc (sizeof (WnnClientRec) + sizeof (ClientBuf) + len)))
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
196 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
197 malloc_error ("allocation of data for wnn");
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
198 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
199 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
200 c_c = (WnnClientList) p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
201 bzero ((char *) c_c, sizeof (WnnClientRec));
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
202 p += sizeof (WnnClientRec);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
203 c_b = (ClientBuf *) p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
204 bzero ((char *) c_b, sizeof (ClientBuf));
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
205 if (uname && *uname)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
206 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
207 p += sizeof (ClientBuf);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
208 c_c->user_name = (char *) p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
209 strcpy (c_c->user_name, uname);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
210 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
211 add_wnnclientlist (c_c);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
212 default_flag_set ();
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
213 return (0);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
214 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
215
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
216 void
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
217 free_wnn ()
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
218 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
219 remove_wnnclientlist (c_c);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
220 Free ((char *) c_c);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
221 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
222
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
223 int
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
224 initialize_wnn (xl, root)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
225 XIMLangRec *xl;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
226 int root;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
227 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
228 WnnClientRec *p;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
229
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
230 if ((p = find_same_lang (xl->lang_db->lang)) != NULL)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
231 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
232 if (copy_env (p) < 0)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
233 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
234 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
235 else
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
236 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
237 if (uumrc_get_entries (xl->lang_db, 0, root) == -1)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
238 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
239 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
240 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
241 if (init_key_table (xl->lang_db->lang) == -1)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
242 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
243 del_client (c_c, 4);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
244 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
245 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
246 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
247 henkan_off_flag = henkan_off_def;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
248 maxlength = maxchg * 2;
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
249 if (allocate_areas () == -1)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
250 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
251 del_client (c_c, 3);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
252 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
253 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
254 if (init_history () == -1)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
255 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
256 del_client (c_c, 2);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
257 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
258 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
259 if (open_romkan (xl->lang_db) == -1)
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
260 {
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
261 del_client (c_c, 1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
262 return (-1);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
263 }
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
264 return (0);
bbc77ca4def5 initial import
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
diff changeset
265 }