1 /*
2  * $Id: dslib.h,v 2.15.2.1 2000/08/04 05:37:12 kaneda Exp $
3  */
4 
5 /*
6 WNN6 CLIENT LIBRARY--SOFTWARE LICENSE TERMS AND CONDITIONS
7 
8 
9 Wnn6 Client Library :
10 (C) Copyright OMRON Corporation.       1995,1998,2000 all rights reserved.
11 (C) Copyright OMRON Software Co., Ltd. 1995,1998,2000 all rights reserved.
12 
13 Wnn Software :
14 (C) Copyright Kyoto University Research Institute for Mathematical Sciences
15      1987, 1988, 1989, 1990, 1991, 1992, 1993
16 (C) Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1993
17 (C) Copyright ASCTEC, Inc.  1987, 1988, 1989, 1990, 1991, 1992, 1993
18 
19 Preamble
20 
21 These Wnn6 Client Library--Software License Terms and Conditions
22  (the "License Agreement") shall state the conditions under which you are
23  permitted to copy, distribute or modify the software which can be used
24  to create Wnn6 Client Library (the "Wnn6 Client Library").  The License
25  Agreement can be freely copied and distributed verbatim, however, you
26  shall NOT add, delete or change anything on the License Agreement.
27 
28 OMRON Corporation and OMRON Software Co., Ltd. (collectively referred to
29  as "OMRON") jointly developed the Wnn6 Software (development code name
30  is FI-Wnn), based on the Wnn Software.  Starting from November, 1st, 1998,
31  OMRON publishes the source code of the Wnn6 Client Library, and OMRON
32  permits anyone to copy, distribute or change the Wnn6 Client Library under
33  the License Agreement.
34 
35 Wnn6 Client Library is based on the original version of Wnn developed by
36  Kyoto University Research Institute for Mathematical Sciences (KURIMS),
37  OMRON Corporation and ASTEC Inc.
38 
39 Article 1.  Definition.
40 
41 "Source Code" means the embodiment of the computer code, readable and
42  understandable by a programmer of ordinary skills.  It includes related
43  source code level system documentation, comments and procedural code.
44 
45 "Object File" means a file, in substantially binary form, which is directly
46  executable by a computer after linking applicable files.
47 
48 "Library" means a file, composed of several Object Files, which is directly
49  executable by a computer after linking applicable files.
50 
51 "Software" means a set of Source Code including information on its use.
52 
53 "Wnn6 Client Library" the computer program, originally supplied by OMRON,
54  which can be used to create Wnn6 Client Library.
55 
56 "Executable Module" means a file, created after linking Object Files or
57  Library, which is directly executable by a computer.
58 
59 "User" means anyone who uses the Wnn6 Client Library under the License
60  Agreement.
61 
62 Article 2.  Copyright
63 
64 2.1  OMRON Corporation and OMRON Software Co., Ltd. jointly own the Wnn6
65  Client Library, including, without limitation, its copyright.
66 
67 2.2  Following words followed by the above copyright notices appear
68  in all supporting documentation of software based on Wnn6 Client Library:
69 
70   This software is based on the original version of Wnn6 Client Library
71   developed by OMRON Corporation and OMRON Software Co., Ltd. and also based on
72   the original version of Wnn developed by Kyoto University Research Institute
73   for Mathematical Sciences (KURIMS), OMRON Corporation and ASTEC Inc.
74 
75 Article 3.  Grant
76 
77 3.1  A User is permitted to make and distribute verbatim copies of
78  the Wnn6 Client Library, including verbatim of copies of the License
79  Agreement, under the License Agreement.
80 
81 3.2  A User is permitted to modify the Wnn6 Client Library to create
82  Software ("Modified Software") under the License Agreement.  A User
83  is also permitted to make or distribute copies of Modified Software,
84  including verbatim copies of the License Agreement with the following
85  information.  Upon modifying the Wnn6 Client Library, a User MUST insert
86  comments--stating the name of the User, the reason for the modifications,
87  the date of the modifications, additional terms and conditions on the
88  part of the modifications if there is any, and potential risks of using
89  the Modified Software if they are known--right after the end of the
90  License Agreement (or the last comment, if comments are inserted already).
91 
92 3.3  A User is permitted to create Library or Executable Modules by
93  modifying the Wnn6 Client Library in whole or in part under the License
94  Agreement.  A User is also permitted to make or distribute copies of
95  Library or Executable Modules with verbatim copies of the License
96  Agreement under the License Agreement.  Upon modifying the Wnn6 Client
97  Library for creating Library or Executable Modules, except for porting
98  a computer, a User MUST add a text file to a package of the Wnn6 Client
99  Library, providing information on the name of the User, the reason for
100  the modifications, the date of the modifications, additional terms and
101  conditions on the part of the modifications if there is any, and potential
102  risks associated with using the modified Wnn6 Client Library, Library or
103  Executable Modules if they are known.
104 
105 3.4  A User is permitted to incorporate the Wnn6 Client Library in whole
106  or in part into another Software, although its license terms and
107  conditions may be different from the License Agreement, if such
108  incorporation or use associated with the incorporation does NOT violate
109  the License Agreement.
110 
111 Article 4. Warranty
112 
113 THE WNN6 CLIENT LIBRARY IS PROVIDED BY OMRON ON AN "AS IS" BAISIS.
114   OMRON EXPRESSLY DISLCIAMS ANY AND ALL WRRANTIES, EXPRESS OR IMPLIED,
115  INCLUDING, WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY AND FITNESS
116  FOR A PARTICULAR PURPOSE, IN CONNECTION WITH THE WNN6 CLIENT LIBRARY
117  OR THE USE OR OTHER DEALING IN THE WNN6 CLIENT LIBRARY.  IN NO EVENT
118  SHALL OMRON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, PUNITIVE
119  OR CONSEQUENTIAL DAMAGES OF ANY KIND WHATSOEVER IN CONNECTION WITH THE
120  WNN6 CLIENT LIBRARY OR THE USE OR OTHER DEALING IN THE WNN6 CLIENT
121 LIBRARY.
122 
123 ***************************************************************************
124 Wnn6 Client Library :
125 (C) Copyright OMRON Corporation.       1995,1998,2000 all rights reserved.
126 (C) Copyright OMRON Software Co., Ltd. 1995,1998,2000 all rights reserved.
127 
128 Wnn Software :
129 (C) Copyright Kyoto University Research Institute for Mathematical Sciences
130      1987, 1988, 1989, 1990, 1991, 1992, 1993
131 (C) Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1993
132 (C) Copyright ASCTEC, Inc.  1987, 1988, 1989, 1990, 1991, 1992, 1993
133 ***************************************************************************
134 
135 Comments on Modifications:
136 */
137 
138 /*	Version 4.0
139  */
140 /*
141 	Modified	Feb.14,1993		tna@kyoto-sr.co.jp
142 			Feb.15,1993		tna@kyoto-sr.co.jp
143 */
144 /*
145 	Nihongo	Henkan	Library Header File
146 */
147 #ifndef _DSLIB_H_
148 #define _DSLIB_H_
149 
150 #ifndef	_WNN_SETJMP
151 #define	_WNN_SETJMP
152 #include <setjmp.h>
153 #endif
154 
155 #ifndef	w_char
156 #define	w_char	unsigned short
157 #endif	/* w_char */
158 
159 #include "jslib.h"
160 
161 /*	Wnn constant
162 */
163 #define WNN_IPADDRLEN 40
164 #define DS_S_BUF_SIZ		9216    /* NEVER change this */
165 #define DS_R_BUF_SIZ		9216    /* NEVER change this */
166 #define DM_S_BUF_SIZ      	256
167 #define DM_R_BUF_SIZ	  	256
168 
169 #define JJ_MAX			3
170 
171 #define JS_FILES_ALLOC_SIZE	64
172 #define DS_FILES_ALLOC_SIZE	128
173 
174 struct serv_addr {
175         char	addr[WNN_IPADDRLEN];
176         int	addrlen;
177         int	addrtype;
178 	int	portno;
179 	int	jserver;
180 };
181 
182 typedef struct serv_addr	SERV_ADDR;
183 
184 struct wnn_dserver_id {
185 	int	sd;
186 	SERV_ADDR	ad;
187 	int	ds_dead;
188 	jmp_buf ds_dead_env;	/* �����Ф�������������Ǥ���env */
189 	int	ds_dead_env_flg; /* dd_server_dead_env��ͭ�����ݤ�  */
190 	int	rbc;
191 	int	rbp;
192 	unsigned char rcv_buf[DS_R_BUF_SIZ];
193 };
194 
195 typedef struct wnn_dserver_id WNN_DSERVER_ID;
196 
197 #define MAX_WNNDS_NUM	64
198 #define MAX_SERVER_LIST 4
199 
200 #define WNNDEFS "/wnndefs"
201 #define WNNDEFS_DATA 512
202 
203 
204 struct wnn_dic_file_info {
205     int	file_type;
206     char	passwd[ WNN_PASSWD_LEN ];
207     char	hpasswd[ WNN_PASSWD_LEN ];
208     struct	wnn_file_uniq funiq;
209     int		maxserial;
210     int		gosuu;
211     int		maxcomment;
212     w_char comment[WNN_COMMENT_LEN];
213 };
214 
215 typedef struct wnn_dic_file_info	WNN_DIC_FILE_INFO;
216 
217 
218 struct wnn_hindo_info_struct {
219     int	file_type;
220     char	passwd[ WNN_PASSWD_LEN ];
221     struct	wnn_file_uniq funiq;
222 };
223 
224 typedef	struct wnn_hindo_info_struct	WNN_HINDO_INFO_STRUCT;
225 
226 struct  ds_jdata {
227     /* struct jdata <jdata.h> is modified for dslib */
228   w_char *yomi,*kanji,*comment;
229   short   which ;               /* gyaku henkan? */
230   int   serial;                 /* index is a serial number of the first
231                                  entry which is stored in this entry*/
232   int   kosuu;                  /* this means the number of elements in this
233                                  entry */
234   struct  ds_jdata  *jptr; 	/* pointer to another jdata which
235                                  points out a jdata of the same yomi
236                                  but (always)different jishono*/
237   unsigned short   *hinsi;
238   unsigned char *hindo;                 /* ���� */
239   unsigned char *hindo_in;              /* �������� */
240 };
241 
242 struct ds_inspect_struct {
243     w_char	*yomi;
244 /*    struct ds_jdata *jd;	D.K 5/4 */
245     struct jdata	*jd;
246 };
247 
248 struct ds_word_search_struct {
249     int	   match_len;		/* maxmum matching length */
250     int	   total;		/* total words : don't need? */
251 /*    struct ds_jdata **jd;	D.K  5/4 */
252     struct jdata	**jd;
253 };
254 
255 
256 struct alloc_data {
257     unsigned char	*data;
258     int			alloc_max;
259     struct alloc_data 	*next;
260 };
261 
262 #define ALLOC_DATA_SIZE 1024
263 
264 /*
265  * Macros added by D.K
266  *
267  */
268 
269 #define DS_FILE_UNLOAD		-2
270 #define DS_FILE_LOADED_JSERVER  -1
271 #define DS_FILE_LOADED_DEFAULT	0
272 
273 #define	GET_WNN_DSERVER_ID(ds_id) \
274                              (&dserver_id_table[(ds_id)])
275 #define	GET_WNN_DSERVER_ID_FID(fid) \
276                              (&dserver_id_table[files[(fid)].ds_id])
277 #define	LOADED_ON_JSERVER_P(fid) \
278                       (files[(fid)].ds_id == DS_FILE_LOADED_JSERVER)
279 
280 #define handler_of_dserver_dead(err_val) \
281 { \
282     if (current_ds) { \
283         if(current_ds->ds_dead || setjmp(current_dserver_dead)) { \
284 	    wnn_errorno=WNN_DS_DEAD; \
285 	    return err_val; \
286         } \
287         wnn_errorno = 0; /* here initialize wnn_errorno; */    \
288     } \
289 }
290 #endif /* _DSLIB_H_ */
291