1 /*
2  */
3 
4 /*
5 WNN7 CLIENT LIBRARY--SOFTWARE LICENSE TERMS AND CONDITIONS
6 
7 
8 Wnn7 Client Library :
9 (C) Copyright OMRON Corporation.       1995,1998,2000,2001 all rights reserved.
10 (C) Copyright OMRON Software Co., Ltd. 1995,1998,2000,2001 all rights reserved.
11 
12 Wnn Software :
13 (C) Copyright Kyoto University Research Institute for Mathematical Sciences
14      1987, 1988, 1989, 1990, 1991, 1992, 1993
15 (C) Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1993
16 (C) Copyright ASCTEC, Inc.  1987, 1988, 1989, 1990, 1991, 1992, 1993
17 
18 Preamble
19 
20 These Wnn7 Client Library--Software License Terms and Conditions
21  (the "License Agreement") shall state the conditions under which you are
22  permitted to copy, distribute or modify the software which can be used
23  to create Wnn7 Client Library (the "Wnn7 Client Library").  The License
24  Agreement can be freely copied and distributed verbatim, however, you
25  shall NOT add, delete or change anything on the License Agreement.
26 
27 OMRON Corporation and OMRON Software Co., Ltd. (collectively referred to
28  as "OMRON") jointly developed the Wnn7 Software (development code name
29  is FI-Wnn), based on the Wnn Software.  Starting from November, 1st, 1998,
30  OMRON publishes the source code of the Wnn7 Client Library, and OMRON
31  permits anyone to copy, distribute or change the Wnn7 Client Library under
32  the License Agreement.
33 
34 Wnn7 Client Library is based on the original version of Wnn developed by
35  Kyoto University Research Institute for Mathematical Sciences (KURIMS),
36  OMRON Corporation and ASTEC Inc.
37 
38 Article 1.  Definition.
39 
40 "Source Code" means the embodiment of the computer code, readable and
41  understandable by a programmer of ordinary skills.  It includes related
42  source code level system documentation, comments and procedural code.
43 
44 "Object File" means a file, in substantially binary form, which is directly
45  executable by a computer after linking applicable files.
46 
47 "Library" means a file, composed of several Object Files, which is directly
48  executable by a computer after linking applicable files.
49 
50 "Software" means a set of Source Code including information on its use.
51 
52 "Wnn7 Client Library" the computer program, originally supplied by OMRON,
53  which can be used to create Wnn7 Client Library.
54 
55 "Executable Module" means a file, created after linking Object Files or
56  Library, which is directly executable by a computer.
57 
58 "User" means anyone who uses the Wnn7 Client Library under the License
59  Agreement.
60 
61 Article 2.  Copyright
62 
63 2.1  OMRON Corporation and OMRON Software Co., Ltd. jointly own the Wnn7
64  Client Library, including, without limitation, its copyright.
65 
66 2.2  Following words followed by the above copyright notices appear
67  in all supporting documentation of software based on Wnn7 Client Library:
68 
69   This software is based on the original version of Wnn7 Client Library
70   developed by OMRON Corporation and OMRON Software Co., Ltd. and also based on
71   the original version of Wnn developed by Kyoto University Research Institute
72   for Mathematical Sciences (KURIMS), OMRON Corporation and ASTEC Inc.
73 
74 Article 3.  Grant
75 
76 3.1  A User is permitted to make and distribute verbatim copies of
77  the Wnn7 Client Library, including verbatim of copies of the License
78  Agreement, under the License Agreement.
79 
80 3.2  A User is permitted to modify the Wnn7 Client Library to create
81  Software ("Modified Software") under the License Agreement.  A User
82  is also permitted to make or distribute copies of Modified Software,
83  including verbatim copies of the License Agreement with the following
84  information.  Upon modifying the Wnn7 Client Library, a User MUST insert
85  comments--stating the name of the User, the reason for the modifications,
86  the date of the modifications, additional terms and conditions on the
87  part of the modifications if there is any, and potential risks of using
88  the Modified Software if they are known--right after the end of the
89  License Agreement (or the last comment, if comments are inserted already).
90 
91 3.3  A User is permitted to create Library or Executable Modules by
92  modifying the Wnn7 Client Library in whole or in part under the License
93  Agreement.  A User is also permitted to make or distribute copies of
94  Library or Executable Modules with verbatim copies of the License
95  Agreement under the License Agreement.  Upon modifying the Wnn7 Client
96  Library for creating Library or Executable Modules, except for porting
97  a computer, a User MUST add a text file to a package of the Wnn7 Client
98  Library, providing information on the name of the User, the reason for
99  the modifications, the date of the modifications, additional terms and
100  conditions on the part of the modifications if there is any, and potential
101  risks associated with using the modified Wnn7 Client Library, Library or
102  Executable Modules if they are known.
103 
104 3.4  A User is permitted to incorporate the Wnn7 Client Library in whole
105  or in part into another Software, although its license terms and
106  conditions may be different from the License Agreement, if such
107  incorporation or use associated with the incorporation does NOT violate
108  the License Agreement.
109 
110 Article 4. Warranty
111 
112 THE WNN7 CLIENT LIBRARY IS PROVIDED BY OMRON ON AN "AS IS" BAISIS.
113   OMRON EXPRESSLY DISLCIAMS ANY AND ALL WRRANTIES, EXPRESS OR IMPLIED,
114  INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY AND FITNESS
115  FOR A PARTICULAR PURPOSE, IN CONNECTION WITH THE WNN7 CLIENT LIBRARY
116  OR THE USE OR OTHER DEALING IN THE WNN7 CLIENT LIBRARY.  IN NO EVENT
117  SHALL OMRON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, PUNITIVE
118  OR CONSEQUENTIAL DAMAGES OF ANY KIND WHATSOEVER IN CONNECTION WITH THE
119  WNN7 CLIENT LIBRARY OR THE USE OR OTHER DEALING IN THE WNN7 CLIENT
120 LIBRARY.
121 
122 ***************************************************************************
123 Wnn7 Client Library :
124 (C) Copyright OMRON Corporation.       1995,1998,2000,2001 all rights reserved.
125 (C) Copyright OMRON Software Co., Ltd. 1995,1998,2000,2001 all rights reserved.
126 
127 Wnn Software :
128 (C) Copyright Kyoto University Research Institute for Mathematical Sciences
129      1987, 1988, 1989, 1990, 1991, 1992, 1993
130 (C) Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1993
131 (C) Copyright ASCTEC, Inc.  1987, 1988, 1989, 1990, 1991, 1992, 1993
132 ***************************************************************************
133 
134 Comments on Modifications:
135 */
136 
137 /*	Version 4.0
138  */
139 /*
140 	Nihongo	Henkan	Library Header File
141 */
142 #ifndef	_JSLIB_H_
143 #define _JSLIB_H_
144 
145 #ifndef	_WNN_SETJMP
146 #define	_WNN_SETJMP
147 #include <setjmp.h>
148 #endif
149 
150 #include "commonhd.h"
151 
152 #ifndef	w_char
153 #define	w_char	unsigned short
154 #endif	/* w_char */
155 
156 /* ��ü�٥���(�ʻ��ֹ�)����� */
157 #define	WNN_BUN_SENTOU	-1	/* ��ʸ�����Ƭ�ˤʤ���� */
158 #define	WNN_ALL_HINSI	-2	/* �ʤ�Ǥ⤨���� */
159 /* ��ü�٥�������� */
160 #define	WNN_VECT_KANREN	0	/* Ϣʸ���Ѵ��ν�ü�٥����� */
161 #define	WNN_VECT_KANTAN	1	/* ñʸ���Ѵ��ν�ü�٥����� */
162 #define	WNN_VECT_KANZEN	1	/* �������Ф��ν�ü�٥�����
163 				   ñʸ���Ѵ����Τ�Τ���������*/
164 #define WNN_VECT_BUNSETSU 2     /* Ϣʸ���Ѵ����Ρ���ʸ��ν�ü�٥�����*/
165 #define	WNN_VECT_NO	-1	/* ��ü�٥���1 ̵�� */
166 /* ʸ��ν�ü����³���� */
167 #define	WNN_CONNECT_BK	1	/* ���ꤵ�줿��ü�٥���������³�Ǥ�����*/
168 #define	WNN_NOT_CONNECT_BK	0	/* */
169 /* ʸ�����ü����³���� */
170 #define	WNN_CONNECT	1	/* ���ꤵ�줿(�ʻ졢��°��)����³�Ǥ�����*/
171 #define	WNN_SENTOU	2	/* ��ʸ�����Ƭ */
172 #define	WNN_NOT_CONNECT	3	/* ��Ƭ�ˤʤ�ʤ�����������³�Ǥ��ʤ� */
173 #define	WNN_GIJI	4	/* ����ʸ����ä���*/
174 
175 /* ����ʸ���ľ�������������� */
176 #define WNN_HIRAGANA	-1	/* �Ҥ餬�� *//* �ɤߤΤޤ� */
177 #define WNN_KATAKANA	-11	/* �������� */
178 #define WNN_IKEIJI_ENTRY	-50	/* �۷��� */
179 /* ���� */
180 #define	WNN_NUM_HAN	-2	/* Ⱦ�ѿ��� *//* �ɤߤΤޤ� */
181 #define	WNN_NUM_ZEN	-12	/* ���ѿ��� *//* ������ */
182 #define	WNN_NUM_KAN	-13	/* ������ *//* ���� */
183 #define	WNN_NUM_KANSUUJI -15	/* ������ *//* ɴ���� */
184 #define	WNN_NUM_KANOLD	-16	/* ������ *//* ��ɴ������ */
185 #define	WNN_NUM_HANCAN	-17	/* Ⱦ�ѿ��� *//* 1,234 */
186 #define	WNN_NUM_ZENCAN	-18	/* ���ѿ��� *//* ���������� */
187 /* �ѿ� */
188 #define	WNN_ALP_HAN	-4	/* Ⱦ�� *//* �ɤߤΤޤ� */
189 #define	WNN_ALP_ZEN	-30	/* ���� */
190 /* ���� */
191 #define	WNN_KIG_HAN	-5	/* Ⱦ�� *//* �ɤߤΤޤ� */
192 #define	WNN_KIG_JIS	-40	/* ����(JIS) */
193 #define	WNN_KIG_ASC	-41	/* ����(ASC) */
194 /* ������ */
195 #define WNN_OKURI_REGULATION -1	/* ��§ */
196 #define WNN_OKURI_NO 	0	/* ����ʤ� */
197 #define	WNN_OKURI_YES	1	/* ���� */
198 /* �Ѵ����� */
199 #define WNN_KANA_KOUHO	0	/* �Ҥ餬�� */
200 #define WNN_KANJI_KOUHO	1	/* ���� */
201 /* �Ѵ����� */
202 #define WNN_KANREN 0
203 #define WNN_KANTAN_DAI 1
204 #define WNN_KANZEN_DAI 2
205 #define WNN_KANTAN_SHO 3
206 #define WNN_KANZEN_SHO 4
207 
208 /* �۷��� �Ѵ����� */
209 #define WNN_IKEIJI_DAI (WNN_KANZEN_SHO+1)
210 
211 #define WNN_FT_DICT_FILE 1
212 #define WNN_FT_HINDO_FILE 2
213 #define WNN_FT_FUZOKUGO_FILE 3
214 /*
215  * (Jul. 8, 1994)
216  * New file type for FI-Wnn
217  */
218 #define WNN_FT_FI_DICT_FILE 4
219 #define WNN_FT_FI_HINDO_FILE 5
220 
221 #define WNN_STATIC_DICT 1		/* static dict */
222 #define WNN_UD_DICT 2			/* updatable dict */
223 #define WNN_REV_DICT 3		/* Updatable Dictonary with Reverse Index */
224 #define WNN_REG_DICT 4		/* Regular Expressino Dictonary */
225 /*
226  * (Jul. 8, 1994)
227  * New dictionary type for FI-Wnn
228  */
229 #define WNN_COMPACT_DICT 	5	/* ����ѥ��ȼ��� */
230 #define WNN_FI_SYSTEM_DICT 	6	/* �ƣɴط������ƥ༭�� */
231 #define WNN_FI_USER_DICT 	7	/* �ƣɴط��桼������ */
232 #define WNN_FI_HINDO_FILE 	8	/* �ƣɴط����� */
233 #define WNN_GROUP_DICT		9	/* ���롼�׼��� */
234 #define	WNN_MERGE_DICT		10	/* �ޡ������� */
235 
236 
237 /* Ϣ���Ѵ� NTWnn ���ή�� */
238 #define WNN_TEXT_DICT   12
239 
240 #define WNN_SYSTEM_DICT		0x80000000
241 
242 /*
243  * (Dec. 14, 1994)
244  * Numbers of special dictionaries
245  */
246 #define WNN_MAEKAKUTEI_DIC	-2
247 #define WNN_MUHENKAN_DIC	-3
248 #define WNN_BUNSETSUGIRI_DIC	-4
249 
250 #define WNN_DIC_MERGE		4	/* for merge dic */
251 #define WNN_DIC_GROUP		3	/* for group dic */
252 #define	WNN_DIC_TEMPORARY	2
253 #define	WNN_DIC_RDONLY	        1
254 #define	WNN_DIC_RW	        0
255 
256 #define	WNN_DIC_ADD_REV 1	/* ���Ѵ� */
257 #define	WNN_DIC_ADD_NOR 0	/* �̾���Ѵ� */
258 
259 /* header file for dic_syurui */
260 #define WNN_FILE_NOT_EXIST -1
261 #define WNN_NOT_A_JISHO 0
262 /* KURI
263 #define WNN_USER_DIC 1
264 #define WNN_SYSTEM_DIC 3
265 */
266 #define WNN_HINDO_FILE 4
267 #define WNN_FUZOKUGO_FILE 5
268 
269 /* set_hindo operation */
270 #define WNN_HINDO_NOP -2
271 #define WNN_IMA_ON -3
272 #define WNN_IMA_OFF -4
273 #define WNN_HINDO_INC -3
274 #define WNN_HINDO_DECL -4
275 #define WNN_ENTRY_NO_USE -1
276 
277 /* set hindo probability */
278 #define WNN_HINDO_NOT    0
279 #define WNN_HINDO_ALWAYS 1
280 #define WNN_HINDO_HIGH   2
281 #define WNN_HINDO_NORMAL 3
282 #define WNN_HINDO_LOW    4
283 
284 /* Auto learning operation */
285 #define WNN_MUHENKAN_LEARNING		1
286 #define WNN_BUNSETSUGIRI_LEARNING	2
287 
288 #define WNN_NO_LEARNING		-1
289 #define WNN_TEMPORARY_LEARNING	-2
290 
291 /* �������� 2000/07/21 NTWnn���ή�� */
292 /* �ɤߤμ��� */
293 #define NORMAL_BUN_ID   0   /* �̾��ɤ� */
294 #define HOSEI_BUN_ID    -1  /* ���������ɤ� */
295 
296 /*	wnn_is_need_write()	*/
297 #define WNN_NEED_WRITE_ERROR   -1 /* NOT_SUPPORTED_OPERATION */
298 #define WNN_NEED_WRITE_NO      0  /* not need write */
299 #define WNN_NEED_WRITE_ALL     1  /* need write all */
300 #define WNN_NEED_WRITE_HINDO   2  /* need write only hindo */
301 #define WNN_NEED_WRITE_NOTREAD 3  /* file is not read. */
302 
303 /*	Wnn constant
304 */
305 #define WNN_HOSTLEN 16
306 #define WNN_ENVNAME_LEN 32
307 
308 /*	js_who	*/
309 #define WNN_MAX_ENV_OF_A_CLIENT 32
310 
311 struct wnn_jwho {
312 	int sd;   /* jserver ��Υ����åȥǥ�������ץ�*/
313 	char user_name[WNN_ENVNAME_LEN];   /* �桼��̾ */
314 	char host_name[MAXHOSTNAMELEN];   /* �ۥ���̾ */
315 	int  env[WNN_MAX_ENV_OF_A_CLIENT];  /* ���Υ��饤����Ȥ����Ѥ��Ƥ���
316 					�Ķ��ֹ���������Ƥ���Ȥ���ˤϡ�-1 ������ */
317 };
318 typedef struct wnn_jwho WNN_JWHO;
319 
320 /*	js_env_list	*/
321 /* WNN_MAX_JISHO_OF_AN_ENV�ϡ�����(setdic)�ο�                  */
322 /* WNN_MAX_FILE_OF_AN_ENV�ϡ�                                   */
323 /* ����(setdic)�ο� �� setdic�ǻ��ꤵ��Ƥ������٥ե�����ο�   */
324 /*    �� ��°��ե����� �� ̵�Ѵ��ؽ����� �� ʸ���ڤ�ؽ�����   */
325 /*    �� �ƣɴط����� �� �ƣɴط����ټ��� �� �ƣɴط��桼������ */
326 /* �κ�����Ǥ�����;͵���� 300 �Ȥ��Ƥ��ޤ���                */
327 #define WNN_MAX_JISHO_OF_AN_ENV 128
328 #define WNN_MAX_FILE_OF_AN_ENV 300
329 
330 struct wnn_env_info {
331 	int	env_id;		/* �Ķ��ֹ� */
332 	char	env_name[WNN_ENVNAME_LEN]; /* �Ķ�̾ */
333 	int	ref_count;	/* ���ȿ� */
334 	/* struct wnn_param; */
335 	int	fzk_fid;	/* ��°��Υե������ֹ� */
336 	int jishomax;		/* ���Ѥ��Ƥ��뼭��θĿ� */
337 	int	jisho[WNN_MAX_JISHO_OF_AN_ENV];	/* ���Ѥ��Ƥ��뼭��μ����ֹ档
338 						   �ǽ��jishomax�Ĥ�����̣������ */
339 	int	file[WNN_MAX_FILE_OF_AN_ENV]; /* ���δĶ��ˤĤʤ��äƤ���
340 					 �ե������ֹ�(�����Ƥ���Ȥ���ˤϡ�-1 ������) */
341 };
342 typedef struct wnn_env_info WNN_ENV_INFO;
343 
344 #define WNN_COMMENT_LEN 512     /* jisho no comment no nagasa */
345 #define WNN_F_NAMELEN MAXPATHLEN
346 #define WNN_PASSWD_LEN 16  /* File Passwd Length */
347 #define WNN_PASSWD_RDONLY "*"
348 
349 
350 struct wnn_dic_info {
351 	int dic_no;		/* �����ֹ� */
352 	int body;		/* �������ΤΥե������ֹ� */
353 	int hindo;		/* ���٤Υե������ֹ� */
354 	int rw;			/* ������Ͽ��ǽ���ɤ���
355 					   (WNN_DIC_RW, WNN_DIC_RDONLY) */
356 	int hindo_rw;		/* ���٤�������ǽ���ɤ���
357 					   (WNN_DIC_RW, WNN_DIC_RDONLY) */
358 	int enablef;		/* ���������椫�ɤ���
359 					   (1 = ������, 0 = ��������) */
360 	int nice;		/* ������Ѵ�����ͥ���� */
361 	int rev;		/* ���Ѵ������ɤ���(1 = ���Ѵ�, 0 = ���Ѵ�) */
362 	/* added H.T */
363 	w_char comment[WNN_COMMENT_LEN];	/* ����Υ����� */
364 	char fname[WNN_F_NAMELEN]; /* ����Υե�����̾ */
365 	char hfname[WNN_F_NAMELEN]; /* ���٤Υե�����̾ */
366 	char passwd[WNN_PASSWD_LEN]; /* ����Υѥ���� */
367 	char hpasswd[WNN_PASSWD_LEN]; /* ���٤Υѥ���� */
368 	int type;		/* ����μ���(WNN_UD_DICT,WNN_STATIC_DICT) */
369 	int gosuu;		/* ����θ�� */
370 	int localf;
371 	int hlocalf;
372 };
373 
374 typedef struct wnn_dic_info WNN_DIC_INFO;
375 
376 /* (Dec. 1, 1994)
377    ��°��ե������������ѹ�¤�� */
378 struct wnn_fzk_info {
379 	w_char	comment[WNN_COMMENT_LEN];	/* ��°��Υ����� */
380 	char	fname[WNN_F_NAMELEN];		/* ��°��Υե�����̾ */
381 };
382 
383 typedef struct wnn_fzk_info WNN_FZK_INFO;
384 
385 struct wnn_file_stat {
386 	int type;			/* �ե�����μ���
387 			WNN_STATIC_DICT		�����������
388 			WNN_UD_DICT		��Ͽ��ǽ��������
389 			WNN_HINDO_FILE		���٥ե�����
390 			WNN_FUZOKUGO_FILE	��°��ե�����
391 			WNN_NOT_A_JISHO		����¾   */
392 };
393 
394 typedef struct wnn_file_stat WNN_FILE_STAT;
395 
396 /*	*/
397 extern	int	wnn_errorno;		/* Wnn�Υ��顼�Ϥ����ѿ��������� */
398 
399 extern char *wnn_dic_types[];	/* "����","��Ͽ","���Ѵ�","����" */
400 
401 extern char *cwnn_dic_types[];	/* "����","��Ͽ","���Ѵ�","����" */
402 extern char *bwnn_dic_types[];	/* "����","��Ͽ","���Ѵ�","����" */
403 
404 
405 /* ���ι�¤�Τϡ��饤�֥���������Ѥ����� */
406 struct wnn_jserver_id {
407 	int	sd;
408 	char	js_name[MAXHOSTNAMELEN];
409 	int	js_dead;
410 	jmp_buf js_dead_env;	/* �����Ф�������������Ǥ���env */
411 	int	js_dead_env_flg; /* jd_server_dead_env��ͭ�����ݤ�  */
412 };
413 
414 typedef struct wnn_jserver_id WNN_JSERVER_ID;
415 
416 /* ���ι�¤�Τϡ��饤�֥���������Ѥ����� */
417 struct wnn_env {
418 	int		env_id;
419 	WNN_JSERVER_ID	*js_id;
420 	char		lang[16];	/* for exsample "ja_JP" */
421 	int		muhenkan_mode;
422 	int		bunsetsugiri_mode;
423 	int		kutouten_mode;
424 	int		kakko_mode;
425 	int		kigou_mode;
426 	int		autosave;
427 	int		yosoku_use_mode;
428 	int		yosoku_realtime;
429 };
430 
431 typedef struct wnn_env WNN_ENV;
432 
433 struct wnn_param {
434 	int	n;	/* ��(��)ʸ����ϤΣ� */
435 	int	nsho;	/* ��ʸ����ξ�ʸ��κ���� */
436 	int 	p1;	/* ��Ω������٤Υѥ�᡼�� */
437 	int 	p2;	/* ��ʸ��Ĺ�Υѥ�᡼�� */
438 	int 	p3;	/* ��Ω��Ĺ�Υѥ�᡼�� */
439 	int 	p4;	/* ���Ȥä���ӥåȤΥѥ�᡼�� */
440 	int 	p5;	/* ����Υѥ�᡼�� */
441 	int	p6;	/* ��ʸ���ɾ���ͤΥѥ�᡼�� */
442 	int	p7;	/* ��ʸ��Ĺ�Υѥ�᡼�� */
443 	int	p8;	/* ��ʸ����Υѥ�᡼�� */
444 	int 	p9;	/* �����ʻ� ���������� */
445 	int 	p10;	/* �����ʻ� ���ʤ����� */
446 	/* CWNN:�ѿ������� */
447 	int 	p11;	/* �����ʻ� �ѿ������� */
448 	/* CWNN:��������� */
449 	int 	p12;	/* �����ʻ� ��������� */
450 	/* CWNN:����̤����� */
451 	int 	p13;	/* �����ʻ� �ij�̤����� */
452 	/* CWNN:�ij�̤����� */
453 	int 	p14;	/* �����ʻ� ��°������� */
454 	/* BWNN:No of koho */
455 	int 	p15;	/* �����ʻ� ����̤����� */
456 	/* CWNN:Not used */
457 };
458 
459 #define WNN_ENV_LAST_IS_FIRST_MASK      (1<<0)
460 #define WNN_ENV_COMPLEX_CONV_MASK       (1<<1)
461 #define WNN_ENV_OKURI_LEARN_MASK        (1<<2)
462 #define WNN_ENV_OKURI_MASK              (1<<3)
463 #define WNN_ENV_PREFIX_LEARN_MASK       (1<<4)
464 #define WNN_ENV_PREFIX_MASK             (1<<5)
465 #define WNN_ENV_SUFFIX_LEARN_MASK       (1<<6)
466 #define WNN_ENV_COMMON_LAERN_MASK       (1<<7)
467 #define WNN_ENV_FREQ_FUNC_MASK          (1<<8)
468 #define WNN_ENV_NUMERIC_MASK            (1<<9)
469 #define WNN_ENV_ALPHABET_MASK           (1<<10)
470 #define WNN_ENV_SYMBOL_MASK             (1<<11)
471 #define WNN_ENV_YURAGI_MASK		(1<<12)
472 #define WNN_ENV_RENDAKU_MASK		(1<<13)
473 #define WNN_ENV_BUNSETSUGIRI_LEARN_MASK (1<<14)
474 #define WNN_ENV_MUHENKAN_LEARN_MASK     (1<<15)
475 #define WNN_ENV_FI_RELATION_LEARN_MASK	(1<<16)
476 #define WNN_ENV_FI_FREQ_FUNC_MASK	(1<<17)
477 #define WNN_ENV_KUTOUTEN_MASK		(1<<18)
478 #define WNN_ENV_KAKKO_MASK		(1<<19)
479 #define WNN_ENV_KIGOU_MASK		(1<<20)
480 /* ����ͽ¬�ɲ�ʬ Jun. 1,2000 */
481 #define WNN_ENV_YOSOKU_USE_MASK		(1<<21)
482 #define WNN_ENV_YOSOKU_LEARN_MASK	(1<<22)
483 #define WNN_ENV_YOSOKU_MAX_DISP_MASK		(1<<23)
484 #define WNN_ENV_YOSOKU_LAST_IS_FIRST_MASK	(1<<24)
485 #define WNN_ENV_YOSOKU_REALTIME_MASK	(1<<25)
486 /* �������� 2000/07/21 NTWnn���ή�� */
487 #define WNN_ENV_BOIN_KABUSOKU_MASK  (1<<26) /* �첻�β���­ */
488 #define WNN_ENV_SHIIN_CHOKA_MASK  (1<<27)   /* �Ҳ���Ķ��   */
489 #define WNN_ENV_N_CHOKA_MASK   (1<<28)   /* [N]�β���­  */
490 
491 struct wnn_henkan_env {
492 	int	last_is_first_flag;     /* �ǽ����Ѻ�ͥ�� */
493 	int	complex_flag;           /* ʣ���ͥ�� */
494 	int	okuri_learn_flag;       /* ������ؽ� */
495 	int	okuri_flag;             /* ��������� */
496 	int	prefix_learn_flag;      /* ��Ƭ��ؽ� */
497 	int	prefix_flag;            /* ��Ƭ����� */
498 	int	suffix_learn_flag;      /* ������ؽ� */
499 	int	common_learn_flag;      /* ���Ѹ�ؽ� */
500 	int	freq_func_flag;         /* ���پ徺��Ψ�ؿ� */
501 	int	numeric_flag;           /* ���������ν��ɽ����ˡ */
502 	int	alphabet_flag;          /* ��������ե��٥åȤν��ɽ����ˡ */
503 	int	symbol_flag;            /* ��������ν��ɽ����ˡ */
504 	/*
505 	 * FI-Wnn �ɲ�ʬ
506 	 * (Oct. 14, 1994)
507 	 */
508 	int	yuragi_flag;		/* Ĺ������餮���� */
509 
510 	int	rendaku_flag;		/* Ϣ������ */
511 	int	bunsetsugiri_flag;      /* ʸ���ڤ�ؽ� */
512 	int	muhenkan_flag;          /* ̵�Ѵ��ؽ� */
513 	int	fi_relation_learn_flag;	/* �ƣɴط��ؽ� */
514 	int	fi_freq_func_flag;	/* �ƣɴط����پ徺��Ψ�ؿ� */
515 	/*
516 	 * FI-Wnn �ɲ�ʬ
517 	 * (Nov. 28, 1994)
518 	 */
519 	int	kutouten_flag;		/* ������ */
520 	int	kakko_flag;		/* ��� */
521 	int	kigou_flag;		/* ���� */
522 	/*
523 	 * ����ͽ¬�ɲ�ʬ
524 	 * (Jun. 1, 2000)
525 	 */
526 	int yosoku_use_flag; /* ����ͽ¬���ѡ��Ի��� */
527 	int yosoku_learn_flag; /* ����ͽ¬�ؽ����롦���ʤ� */
528 	int yosoku_max_disp; /* ����ͽ¬����ɽ���� (��10) */
529 	int yosoku_last_is_first_flag; /* ͽ¬�ǽ�����ͥ�褹�롦���ʤ� */
530 	int yosoku_realtime_flag; /* �ꥢ�륿����ͽ¬���롦���ʤ� */
531 
532 	/* �������� 2000/07/21 NTWnn���ή�� */
533 	int boin_kabusoku_flag; /* �첻�β���­ 1:ͭ�� 0:̵�� */
534 	int shiin_choka_flag;   /* �Ҳ���Ķ�� 1:ͭ�� 0:̵�� */
535 	int n_choka_flag;    /* [N]�β���­ 1:ͭ�� 0:̵�� */
536 
537 };
538 
539 /* dictionary type bit mask for js_fi_dic_list[_all] */
540 #define WNN_DIC_WNN_SYSTEM_MASK	(1<<0)
541 #define WNN_DIC_WNN_USER_MASK	(1<<1)
542 #define WNN_DIC_FI_SYSTEM_MASK	(1<<2)
543 #define WNN_DIC_FI_USER_MASK	(1<<3)
544 #define WNN_DIC_BUNSETSU_MASK  	(1<<4)
545 #define WNN_DIC_MUHENKAN_MASK 	(1<<5)
546 #define WNN_DIC_TEMPORARY_MASK  (1<<6)
547 #define WNN_DIC_NO_AUTOLEARN_MASK \
548     (WNN_DIC_WNN_SYSTEM_MASK | WNN_DIC_WNN_USER_MASK)
549 #define WNN_DIC_AUTOLEARN_MASK \
550     (WNN_DIC_BUNSETSU_MASK | WNN_DIC_MUHENKAN_MASK | WNN_DIC_TEMPORARY_MASK)
551 #define WNN_DIC_WNN_ALL_MASK \
552     (WNN_DIC_NO_AUTOLEARN_MASK | WNN_DIC_AUTOLEARN_MASK)
553 #define WNN_DIC_FI_ALL_MASK \
554     (WNN_DIC_FI_SYSTEM_MASK | WNN_DIC_FI_USER_MASK)
555 #define WNN_DIC_ALL_MASK \
556     (WNN_DIC_WNN_ALL_MASK | WNN_DIC_FI_ALL_MASK)
557 
558 
559 struct wnn_file_info_struct {
560 	int	fid;		/* �ե������ֹ� */
561 	char	name[WNN_F_NAMELEN]; /* �ե�����̾ */
562 	int	localf;		/* �����С������ȤΥե����뤫�ɤ���
563 					   1: �����С�������
564 					   0: ���饤����ȡ�������   */
565 	int	type;		/* �ե�����μ��� */
566 	int	ref_count;	/* (�Ķ������)���ȿ� */
567 };
568 
569 typedef struct wnn_file_info_struct WNN_FILE_INFO_STRUCT;
570 
571 #define WNN_VECT_L	((256+8*4-1)/(8*4) + 5)	/***** !!!!! ****/
572 
573 struct	wnn_sho_bunsetsu {
574 	int	end;		/* ����ʸ��� end char index */
575 	int	start;		/* ����ʸ��� top char index */
576 	int	jiriend;	/* ����ʸ��μ�Ω�� end char index */
577 	int	dic_no;		/* ��Ω��μ�����Υ���ȥ��ֹ� */
578 	int	entry;		/* ����ʸ��μ�Ω�켭�� entry */
579 
580 	int	hinsi;		/* ��Ω���ʻ� */
581 	int     status;		/* ��ʸ�����Ƭ�� */
582 	int	status_bkwd;	/* usiro ��ʸ�����³�Ǥ��뤫 */
583 	int 	hindo;		/* ���伫Ω������� */
584 
585 	int 	ima;		/* ���伫Ω��κ��Ȥä���ӥå� */
586 
587 	int	kangovect;	/* ��³�٥��ȥ�ơ��֥�ؤΥݥ��� */
588 	int 	hyoka;		/* ��ʸ��ɾ���� */
589 	w_char	*kanji;		/* ��Ω��ʸ���� */
590 	w_char	*yomi;		/* ��Ω����ɤ�ʸ���� */
591 	w_char	*fuzoku;	/* ��°��ʸ���� */
592 	/*
593 	 *���٤ˤĤ��Ƥϡ����٥ե����뤬���ꤵ��Ƥ�����ϡ�
594 	 *hindo = ���٥ե������(��)������ + �������(��)������
595 	 *ima = ���٥ե�����κ��Ȥä���ӥå�
596 	 *
597 	 *���٥ե����뤬���ꤵ��Ƥ��ʤ����ˤϡ�
598 	 *hindo = �������(��)�����͡�ima = ������κ��Ȥä���ӥå�
599 	 *�Ǥ��롣�����ǡ��������ͤȤϡ��׻������7�ӥåȤ˰��̤��줿�ͤǤ��롣
600 	 *���������ͤǤϤʤ��������ͤ��֤��Τϡ��Ѵ���̤ΥǥХå��Τ���Ǥ��롣
601 	 */
602 };
603 
604 struct	wnn_dai_bunsetsu {
605 	int	end;		/* ����ʸ��� end char index */
606 	int	start;		/* ����ʸ��� top char index */
607 	struct	wnn_sho_bunsetsu	*sbn;	/* ��ʸ����Ϸ�̤ؤΥݥ��� */
608 	int 	hyoka;		/* ��ʸ��ɾ���� */
609 	int	sbncnt;		/* ��ʸ��� (������ξ��ϡ��������)
610 					   DSD_SBN�ϡ�*sbn ���� sbncnt �������� */
611 };
612 
613 struct	wnn_jdata {
614 	int	dic_no;		/* �����ֹ� */
615 	int	serial;		/* ������Υ���ȥ��ֹ� */
616 	int	hinshi;		/* �ʻ��ֹ�(�ʻ��ֹ���ʻ�̾���б��ϡ�manual/etc
617 					   �β�����) */
618 	int	hindo;		/* ���� */
619 	int	ima;		/* ���Ȥä���ӥå� */
620 	int	int_hindo;	/* ���������� */
621 	int	int_ima;	/* �����⡢���Ȥä���ӥå� */
622 	w_char   *yomi;		/* �ɤߤ�ʸ���� */
623 	w_char	*kanji;		/* ����ʸ���� */
624 	w_char	*com;		/* ����ȥ�Υ�����ʸ���� */
625 	/*
626 	 *���٤ˤĤ��Ƥϡ����٥ե����뤬���ꤵ��Ƥ�����ϡ�
627 	 *hindo = ���٥ե������(����)�����͡�ima = ���٥ե�����κ��Ȥä���ӥå�
628 	 *int_hindo = �������(����)�����͡�int_ima = ������κ��Ȥä���ӥå�
629 	 *
630 	 *���٥ե����뤬���ꤵ��Ƥ��ʤ����ˤϡ�
631 	 *hindo = �������(����)�����͡�ima = ������κ��Ȥä���ӥå�
632 	 *int_hindo = -1��int_ima = -1
633 	 *
634 	 *���������ɤ���ξ��Ǥ⡢����ȥ꤬������ߤξ��֤λ��ˤϡ�
635 	 *hindo = -1, ima = 0 ���뤤�ϡ�
636 	 *int_hindo = -1, int_ima = 0 �Ȥʤ롣
637 	 *�����ǡ�(����)�����ͤȤϡ��׻������7�ӥåȤ˰��̤��줿�����ͤ��顢
638 	 *�ºݤ��ͤ����ꤷ���ͤǤ��롣
639 	 */
640 };
641 
642 struct	wnn_ret_buf {
643 	int	size;		/* buf ���� alloc ����Ƥ����礭�� */
644 	char	*buf;		/* malloc �ʤɤǤȤ�줿�ΰ� */
645 };
646 
647 /*
648  * (Sep. 20, 1994)
649  * ���ѣƣɴط������ѹ�¤�Τ��������
650  */
651 struct  fi_rel_data {
652 	int		fi_dic_no;	/* �ƣɴط�����μ����ֹ� */
653 	int		dic_no;		/* ��³�������μ����ֹ� */
654 	int		entry;		/* ��³�������Υ���ȥ��ֹ� */
655 	int		offset;		/* �ƣɴط��ǡ����Υ��ե��å��ֹ� */
656 	int		fi_hindo;	/* �ƣɴط���³���٤������� */
657 	int		fi_ima;		/* �ƣɴط���³���ӥåȤ������� */
658 };
659 
660 typedef struct fi_rel_data FI_PRIO_DATA;
661 
662 /*
663  * (Sep. 20, 1994)
664  * ���ѣƣɴط��������ѹ�¤�Τ��������
665  */
666 struct wnn_fi_rel_buf {
667 	int		       size;	 /* alloc ����Ƥ���ƣɴط��ǡ����� */
668 	int		       num;	 /* ͭ���ƣɴط��ǡ����� */
669 	struct fi_rel_data *fi_buf;  /* �ƣɴط��ǡ�����¤������ؤΥݥ��� */
670 };
671 
672 /*
673  * (Nov. 24, 1994)
674  * ������ƣ��Ѵ��ѹ�¤�Τ��������
675  */
676 #define WNN_PREV_BUN_SUU 2  /* �Ф��Ƥ���ľ������ʸ��� */
677 
678 /* ľ���˳��ꤷ��ʸ��γƾ����Ф��Ƥ�����¤�� */
679 struct wnn_prev_bun {
680 	int         dic_no;                 /* Wnn �����ֹ� */
681 	int         entry;                  /* ����ȥ��ֹ� */
682 	int         real_kanjilen;          /* ����ʸ��������°��ʤ���*/
683 	w_char      kouho[256];    		/* ����ʸ�������°�줢���
684 						   256 == LENGTHKANJI */
685 	int         jirilen;                /* ��Ω���ɤ�Ĺ */
686 	int         hinsi;                  /* �ʻ� */
687 };
688 
689 
690 #define	WNN_F_UNIQ_LEN	(sizeof(struct wnn_file_uniq))
691 
692 /* hinsi name used in jlib and jserver */
693 #define WNN_HINSI_MEISI		"̾��"
694 #define WNN_HINSI_TANKAN      	"ñ����"
695 #define WNN_HINSI_SUUSI		"����"
696 #define WNN_HINSI_SETTOUO	"��Ƭ��(��)"
697 #define WNN_HINSI_SETSUBI	"������"
698 #define WNN_HINSI_RENDAKU	"Ϣ��"
699 #define WNN_HINSI_TELNO		"�����ֹ�"
700 #define WNN_HINSI_ZIPCODE	"͹���ֹ�"
701 #define WNN_ROOT_HINSI_NODE	"/"
702 #define WNN_UNUSE_HINSI		9
703 
704 
705 /* ���ι�¤�Τϡ��饤�֥���������Ѥ����� */
706 struct wnn_file_head {
707 struct wnn_file_uniq{
708 	int time;
709 	int dev;
710 	int inode;
711 	char createhost[WNN_HOSTLEN];
712 } file_uniq;
713 struct wnn_file_uniq file_uniq_org;
714 	int file_type;
715 	char file_passwd[WNN_PASSWD_LEN];
716 };
717 
718 
719 #define WNN_HINSI_NAME_LEN 64
720 
721 #define	WNN_FILE_HEADER_LEN	(WNN_PASSWD_LEN + 8 + WNN_FILE_STRING_LEN + \
722 				 sizeof(struct wnn_file_uniq) * 2 + 4)
723 /*
724 				  8 is for future use
725 				  4 is for file_type.
726 				 */
727 
728 /*
729   JSLIB function declaration
730 */
731 #define	js_open(server, timeout)	js_open_lang(server, "ja_JP", timeout)
732 #define	js_connect(server,env_name)	js_connect_lang(server, env_name, "ja_JP")
733 
734 extern	WNN_JSERVER_ID *js_open_lang();
735 extern	unsigned int	dispname_to_ipaddr();
736 extern	int		js_close();
737 extern	WNN_JSERVER_ID *js_change_current_jserver();
738 extern	struct wnn_env *js_connect_lang();
739 extern	int		js_disconnect();
740 extern	int		js_env_list();
741 extern	int		js_param_set();
742 extern	int		js_param_get();
743 extern	char	       *js_get_lang();
744 /**************************************/
745 extern int js_access();
746 extern int js_dic_add();
747 extern int js_dic_delete();
748 extern int js_dic_file_create();
749 extern int js_dic_file_create_client();
750 extern int js_dic_info();
751 extern int js_dic_list();
752 extern int js_dic_list_all();
753 extern int js_dic_use();
754 extern int js_env_exist();
755 extern int js_env_sticky();
756 extern int js_env_un_sticky();
757 extern int js_file_comment_set();
758 extern int js_file_discard();
759 extern int js_file_info();
760 extern int js_file_list();
761 extern int js_file_list_all();
762 extern int js_file_loaded();
763 extern int js_file_loaded_local();
764 extern int js_file_password_set();
765 extern int js_file_read();
766 extern int js_file_receive();
767 extern int js_file_remove();
768 extern int js_file_remove_client();
769 extern int js_file_send();
770 extern int js_file_stat();
771 extern int js_file_write();
772 extern void js_flush();
773 extern int js_fuzokugo_get();
774 extern int js_fuzokugo_set();
775 extern int js_hindo_file_create();
776 extern int js_hindo_file_create_client();
777 extern int js_hindo_set();
778 extern int js_hinsi_dicts();
779 extern int js_hinsi_list();
780 extern int js_hinsi_name();
781 extern int js_hinsi_number();
782 extern int js_hinsi_table_set();
783 extern int js_isconnect();
784 extern int js_kanren();
785 extern int js_kantan_dai();
786 extern int js_kantan_sho();
787 extern int js_kanzen_dai();
788 extern int js_kanzen_sho();
789 extern int js_kill();
790 extern int js_mkdir();
791 extern int js_version();
792 extern int js_who();
793 extern int js_word_add();
794 extern int js_word_comment_set();
795 extern int js_word_delete();
796 extern int js_word_info();
797 extern int js_word_search();
798 extern int js_word_search_by_env();
799 
800 
801 extern int js_access_add_host();
802 extern int js_access_remove_host();
803 extern int js_access_add_user();
804 extern int js_access_remove_user();
805 extern int js_access_enable();
806 extern int js_access_disable();
807 extern char **js_access_get_info();
808 
809 extern int js_is_loaded_temporary_dic();
810 extern int js_temporary_dic_add();
811 extern int js_temporary_dic_delete();
812 extern int js_autolearning_word_add();
813 extern int js_temporary_word_add();
814 
815 extern int js_set_autolearning_dic();
816 extern int js_get_autolearning_dic();
817 
818 extern int js_set_henkan_env();
819 extern int js_get_henkan_env();
820 extern int js_get_henkan_env_local();
821 extern int js_set_henkan_hinsi();
822 extern int js_get_henkan_hinsi();
823 extern int js_henkan_with_data();
824 
825 /*
826  * (Jul. 8, 1994)
827  * New js_lib functions for FI-Wnn
828  */
829 extern int js_fi_dic_add();
830 extern int js_fi_hindo_file_create();
831 extern int js_fi_hindo_file_create_client();
832 
833 extern int js_fi_kanren();
834 extern int js_set_fi_priority();
835 extern int js_optimize_fi();
836 
837 extern int js_fi_dic_list();
838 extern int js_fi_dic_list_all();
839 extern int js_fuzokugo_list();
840 
841 /*
842  * for Nyuuryoku Yosoku
843  */
844 
845 /* ͽ¬����������˸�����Ǽ�����ѿ� */
846 /* js_yosoku_kouho_free() �ˤ�����Ū�˲�������ɬ�פ�����ޤ���*/
847 extern int ykYosokuKouhoNum;	/* ͽ¬����� */
848 extern char **ykYosokuKouho;	/* ͽ¬����(����ʸ����) */
849 
850 struct wnn_yosoku_bunsetsu {
851 	char yomi[256 * 2];	/* �ɤ�ʸ���� 256=LENGTHYOMI */
852 	int  jirilen;				/* ��Ω��Ĺ */
853 	char kanji[256 * 2]; /* ����ʸ���� 256=LENGTHKANJI */
854 	int  real_kanjilen;			/* ������ʬĹ */
855 	int  hinsi;					/* �ʻ� */
856 };
857 
858 struct wnn_yosoku_info {
859 	int nTotalRod; /* �︺���줿���ϥ������γ�� */
860 	int nTotalAllKey; /* ���Ϥ�����ʸ�ϤΥ����� */
861 	int nTotalUserKey; /* �桼�������Ϥ��������� */
862 	int nTotalRot; /* �︺���줿���֤γ�� */
863 	unsigned int nTotalAllTime; /* ��ʸ�Ϥο������ϻ��� */
864 	unsigned int nTotalUserTime; /* �桼�������Ϥ������� */
865 	int st_mday; /* ���ϳ����� */
866 	int st_hour; /* ���ϳ��ϻ� */
867 	int st_min; /* ���ϳ���ʬ */
868 	int lt_mday; /* ���Ͻ�λ�� */
869 	int lt_hour; /* ���Ͻ�λ�� */
870 	int lt_min; /* ���Ͻ�λʬ */
871 	int nTotalRoYkInput; /* ͽ¬���Ϥ�Ȥä���� */
872 	int nTotalAllYkKey;  /* ͽ¬���Ϥ����Ϥ���ʸ�Υ����� */
873 	int nNowRod; /* �︺���줿���ϥ������γ�� */
874 	int nNowAllKey; /* ����ʸ�Υ����� */
875 	int nNowUserKey; /* �桼�������Ϥ��������� */
876 	int nNowRot; /* �︺���줿���֤γ�� */
877 	unsigned int nNowAllTime; /* ����ʸ�ο������ϻ��� */
878 	unsigned int nNowUserTime; /* �桼�������Ϥ������� */
879 	unsigned int nTimePerOneKey; /* �桼���Σ������ο������ϻ��� */
880 };
881 
882 extern int js_yosoku_init(struct wnn_env *env);
883 extern int js_yosoku_free(struct wnn_env *env);
884 extern int js_yosoku_yosoku(struct wnn_env *env, char *yosoku_moji);
885 extern void js_yosoku_kouho_free(void);
886 extern int js_yosoku_toroku(struct wnn_env *env, int bunsetsu_num, struct wnn_yosoku_bunsetsu *ykbun);
887 extern int js_yosoku_selected_cand(struct wnn_env *env, int selectpos);
888 extern int js_yosoku_delete_cand(struct wnn_env *env, int selectpos);
889 extern int js_yosoku_cancel_latest_toroku(struct wnn_env *env);
890 extern int js_yosoku_reset_pre_yosoku(struct wnn_env *env);
891 extern int js_yosoku_ikkatsu_toroku(struct wnn_env *env, char *toroku_data, int size);
892 extern int js_yosoku_ikkatsu_toroku_init(struct wnn_env *env);
893 extern int js_yosoku_ikkatsu_toroku_end(struct wnn_env *env);
894 extern int js_yosoku_save_datalist(struct wnn_env *env);
895 extern int js_yosoku_init_time_keydata(struct wnn_env *env);
896 extern int js_yosoku_init_inputinfo(struct wnn_env *env);
897 extern int js_yosoku_set_user_inputinfo(struct wnn_env *env, int allkey, int userkey);
898 extern int js_yosoku_set_timeinfo(struct wnn_env *env, int yosokuselect, int throughyosoku, unsigned int inputtime, int keylen);
899 extern int js_yosoku_status(struct wnn_env *env, struct wnn_yosoku_info *ykinfo);
900 
901 /* Ϣ���Ѵ� NTWnn ���ή�� */
902 extern int js_assoc_with_data();
903 
904 /* ʣ���ʻ��ޤȤ�ơ��Ѵ��˻Ȥ����Ȥ�ʤ������ꤹ�� */
905 extern int js_set_henkan_hinsi_group();
906 
907 
908 #endif	/* _JSLIB_H_ */
909