1 /* Copyright 1992 NEC Corporation, Tokyo, Japan.
2 *
3 * Permission to use, copy, modify, distribute and sell this software
4 * and its documentation for any purpose is hereby granted without
5 * fee, provided that the above copyright notice appear in all copies
6 * and that both that copyright notice and this permission notice
7 * appear in supporting documentation, and that the name of NEC
8 * Corporation not be used in advertising or publicity pertaining to
9 * distribution of the software without specific, written prior
10 * permission. NEC Corporation makes no representations about the
11 * suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * NEC CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
16 * NO EVENT SHALL NEC CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
18 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19 * OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
22
23 #if !defined(lint) && !defined(__CODECENTER__)
24 static char rcs_id[] = "@(#) 102.1 $Id: commondata.c,v 1.4.2.1 2004/04/26 22:53:02 aida_s Exp $";
25 #endif /* lint */
26
27 #include "canna.h"
28 #include <canna/mfdef.h>
29 #include "patchlevel.h"
30
31 struct CannaConfig cannaconf;
32
33 /* �ǥե���ȤΥ��������Ѵ��ѤΥХåե� */
34
35 int defaultContext = -1;
36 int defaultBushuContext = -1;
37
38 /* ���������Ѵ��ơ��֥� */
39 /*
40 * ���������Ѵ��ơ��֥�ϣ��Ĥ�����ɤ��Ǥ��礦��ʣ����ɬ�פʤΤ�
41 * ����� RomeStruct �Υ��ФȤ�������Ƥ���ɬ�פ⤢��ޤ��礦��...��
42 * �λ��Ϥ��λ��ǹͤ��ޤ��礦��
43 */
44
45 struct RkRxDic *romajidic, *englishdic, *RkwOpenRoma();
46
47 /* ̤��������Ǹ����ν����Τ����� */
48
49 int howToBehaveInCaseOfUndefKey = kc_normal;
50
51 /*
52 * �����̾��������Ƥ����ѿ�
53 */
54
55 char saveapname[CANNA_MAXAPPNAME]; /* �����ФȤ���³���ڤ�Ȥ���AP̾ */
56
57 /*
58 * irohacheck ���ޥ�ɤˤ�äƻȤ��Ƥ��뤫�Ȥ���
59 * irohacheck �ʤ��Ǥ� verbose ��ɽ���͡�
60 */
61
62 int ckverbose = 0;
63
64 /*
65 * ���顼�Υ�å�����������Ƥ����ѿ�
66 */
67
68 char *jrKanjiError = "";
69
70 /*
71 * �ǥХ���å�������Ф����ɤ����Υե饰
72 */
73
74 int iroha_debug = 0;
75
76 /*
77 * �Ϥ�Ƥλ��Ѥ��ɤ������ե饰
78 */
79
80 int FirstTime = 1;
81
82 /*
83 * �ӡ��ײ����Ĥ餹�ؿ����Ǽ����Ȥ���
84 */
85
86 int (*jrBeepFunc)() = (int (*)())NULL;
87
88 /*
89 * KC_INITIALIZE ľ��˼¹Ԥ��뵡ǽ����
90 */
91
92 BYTE *initfunc = (BYTE *)0;
93 int howToReturnModeInfo = ModeInfoStyleIsString;
94 char *RomkanaTable = (char *)NULL;
95 char *EnglishTable = (char *)NULL;
96 /* char *Dictionary = (char *)NULL; */
97 struct dicname *RengoGakushu = (struct dicname *)NULL;
98 struct dicname *KatakanaGakushu = (struct dicname *)NULL;
99 struct dicname *HiraganaGakushu = (struct dicname *)NULL;
100
101 int nKouhoBunsetsu = 16;
102
103 int KeepCursorPosition = 0;
104
105 int nothermodes = 0;
106
107 keySupplement keysup[MAX_KEY_SUP];
108 int nkeysup = 0;
109
110 /*
111 * ������κݻ��Ѥ���������ե�����̾�����ƤȤäƤ����Хåե���
112 * �ե�����̾��","�Ƕ��ڤ��롣(��ĥ��ǽ�ǻ���)
113 */
114
115 char *CANNA_initfilename = (char *)NULL;
116
117 /*
118 * �������
119 */
120
121 int protocol_version = -1;
122 int server_version = -1;
123 char *server_name = (char *)NULL;
124
125 int chikuji_debug = 0;
126 int auto_define = 0;
127
128 void (*keyconvCallback)() = (void (*)())0;
129
130 extraFunc *extrafuncp = (extraFunc *)NULL;
131 struct dicname *kanjidicnames; /* .canna �ǻ��ꤷ�Ƥ��뼭��ꥹ�� */
132 char *kataautodic = (char *)NULL; /* �������ʸ켫ư��Ͽ�Ѽ��� */
133 #ifdef HIRAGANAAUTO
134 char *hiraautodic = (char *)NULL; /* �Ҥ餬�ʸ켫ư��Ͽ�Ѽ��� */
135 #endif
136
137 /* �桼������ */
138 jrUserInfoStruct *uinfo = (jrUserInfoStruct *)NULL;
139
140 /* �ޥ���Ƚ�����ԤäƤ��뤫�ɤ��� */
141 int mountnottry = 1;
142
143 void
InitCannaConfig(cf)144 InitCannaConfig(cf)
145 struct CannaConfig *cf;
146 {
147 bzero(cf, sizeof(struct CannaConfig));
148 cf->CannaVersion = CANNA_MAJOR_MINOR;
149 cf->kouho_threshold = 2;
150 cf->strokelimit = STROKE_LIMIT;
151 cf->CursorWrap = 1;
152 cf->SelectDirect = 1;
153 cf->HexkeySelect = 1;
154 cf->ChBasedMove = 1;
155 cf->Gakushu = 1;
156 cf->grammaticalQuestion = 1;
157 cf->stayAfterValidate = 1;
158 cf->kCount = 1;
159 cf->hexCharacterDefiningStyle = HEX_USUAL;
160 cf->ChikujiContinue = 1;
161 cf->RenbunContinue = 1;
162 cf->MojishuContinue = 1;
163 cf->kojin = 1;
164 cf->indexSeparator = DEFAULTINDEXSEPARATOR;
165 cf->allowNextInput = 1;
166 cf->chikujiRealBackspace = 1;
167 cf->BackspaceBehavesAsQuit = 1;
168 cf->doKatakanaGakushu = 1;
169 cf->doHiraganaGakushu = 1;
170 cf->auto_sync = 1;
171 }
172
173 static void freeUInfo pro((void));
174
175 static void
freeUInfo()176 freeUInfo()
177 {
178 if (uinfo) {
179 if (uinfo->uname)
180 free(uinfo->uname);
181 if (uinfo->gname)
182 free(uinfo->gname);
183 if (uinfo->srvname)
184 free(uinfo->srvname);
185 if (uinfo->topdir)
186 free(uinfo->topdir);
187 if (uinfo->cannafile)
188 free(uinfo->cannafile);
189 if (uinfo->romkanatable)
190 free(uinfo->romkanatable);
191 free((char *)uinfo);
192 uinfo = (jrUserInfoStruct *)NULL;
193 }
194 }
195
196 /*
197 �ǥե�������ͤˤ�ɤ���
198 */
199 void
restoreBindings()200 restoreBindings()
201 {
202 InitCannaConfig(&cannaconf);
203
204 if (initfunc) free(initfunc);
205 initfunc = (BYTE *)NULL;
206
207 if (server_name) free(server_name);
208 server_name = (char *)NULL;
209
210 if (RomkanaTable) {
211 free(RomkanaTable);
212 RomkanaTable = (char *)NULL;
213 }
214 if (EnglishTable) {
215 free(EnglishTable);
216 EnglishTable = (char *)NULL;
217 }
218 romajidic = (struct RkRxDic *)NULL;
219 englishdic = (struct RkRxDic *)NULL;
220 RengoGakushu = (struct dicname *)NULL;
221 KatakanaGakushu = (struct dicname *)NULL;
222 HiraganaGakushu = (struct dicname *)NULL;
223 howToBehaveInCaseOfUndefKey = kc_normal;
224 /* kanjidicname[nkanjidics = 0] = (char *)NULL; ����Τ��Ȥʤ���� */
225 kanjidicnames = (struct dicname *)NULL;
226 kataautodic = (char *)NULL;
227 #ifdef HIRAGANAAUTO
228 hiraautodic = (char *)NULL;
229 #endif
230 auto_define = 0;
231 saveapname[0] = '\0';
232 KeepCursorPosition = 0;
233
234 nothermodes = 0;
235 protocol_version = server_version = -1;
236 nKouhoBunsetsu = 16;
237 nkeysup = 0;
238 chikuji_debug = 0;
239 keyconvCallback = (void (*)())0;
240 freeUInfo();
241 }
242