412
|
1 /*
|
70
|
2 Copyright (C) 1995 Free Software Foundation, Inc.
|
|
3 Copyright (C) 1995 Sun Microsystems, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Mule 2.3. Not in FSF. */
|
|
23
|
|
24 /* Jserver Interface for Mule
|
|
25 Coded by Yutaka Ishikawa at ETL (yisikawa@etl.go.jp)
|
|
26 Satoru Tomura at ETL (tomura@etl.go.jp)
|
|
27 Modified for Wnn4 library by
|
|
28 Toshiaki Shingu (shingu@cpr.canon.co.jp)
|
|
29 Hiroshi Kuribayashi (kuri@nff.ncl.omron.co.jp) */
|
|
30
|
|
31 /*
|
|
32 * Functions defined in this file are
|
|
33 * (wnn-server-open wnn-host-name login-name)
|
|
34 * wnn-host-name: STRING or NIL
|
|
35 * login-name: STRING
|
|
36 * RETURNS: BOOLEAN
|
|
37 * DESCRIPTION:
|
|
38 * jserver $B$H@\B3$7!"%5!<%P!<FbIt$K@5JQ49!?5UJQ49#2$D$N4D6-$r(B
|
|
39 * $B:n$k!#%(%i!<$N;~$O(B nil $B$rJV$9!#(B
|
|
40 *
|
|
41 * (wnn-server-close)
|
|
42 * RETURNS: BOOLEAN
|
|
43 * DESCRIPTION:
|
|
44 * jserver $B$H$N@\B3$r@Z$k!#<-=q!"IQEY$O%;!<%V$5$l$J$$!#(B
|
|
45 *
|
|
46 * (wnn-server-dict-add dict-file-name hindo-file-name priority
|
|
47 * dict-file-mode hindo-file-mode pw1 pw2)
|
|
48 * dict-file-name: STRING
|
|
49 * hindo-file-name: STRING or NULL-STRING
|
|
50 * priority: INTEGER
|
|
51 * dict-file-mode: BOOLEAN
|
|
52 * hindo-file-mode: BOOLEAN
|
|
53 * pw1: STRING or NIL
|
|
54 * pw2: STRING or NIL
|
|
55 * DESCRIPTION:
|
98
|
56 * $B<-=q%U%!%$%kL>!"IQEY%U%!%$%kL>!"M%@hEY!"<-=q%U%!%$%k%b!<%I(B
|
|
57 * $BIQEY%U%!%$%k%b!<%I$G;XDj$7$?<-=q$r%P%C%U%!$KDI2C$9$k!#(B
|
|
58 * pw1, pw2 $B$O<-=q%U%!%$%k!"IQEY%U%!%$%k$N%Q%9%o!<%I!#(B
|
70
|
59 *
|
|
60 * (wnn-server-dict-delete dic-no)
|
|
61 * dic-no: INTEGER
|
|
62 * RETURNS: $B%(%i!<$N;~(B nil
|
98
|
63 * DESCRIPTION: dic-no $B$N<-=qHV9f$N<-=q$r!"%P%C%U%!$+$i(B
|
70
|
64 * $B:o=|$9$k!#(B
|
|
65 *
|
|
66 * (wnn-server-dict-list)
|
|
67 * RETURNS: ((dic-no1 file-name1 comment1 word-no1 nice1)
|
|
68 * (dic-no2 file-name2 comment2 word-no2 nice2)...)
|
98
|
69 * DESCRIPTION: $B%P%C%U%!>e$N<-=q$N%j%9%H$rF@$k!#(B
|
70
|
70 *
|
|
71 * (wnn-server-dict-comment dic-no comment)
|
|
72 * RETURNS: $B%(%i!<$N;~(B nil
|
|
73 * DESCRIPTION: dic-no $B$N<-=q$K%3%a%s%H$r$D$1$k!#(B
|
|
74 *
|
|
75 * (wnn-server-set-rev rev)
|
|
76 * rev: BOOLEAN
|
|
77 * rev $B$,(B nil $B$N;~$O@5JQ49!"$=$l0J30$N;~$O5UJQ49(B
|
|
78 *
|
|
79 * (wnn-server-henkan-begin henkan-string)
|
|
80 * henkan-string: STRING
|
|
81 * RETURNS: bunsetu-suu
|
|
82 * DESCRIPTION:
|
|
83 * $B2>L>4A;zJQ49$r$7!"Bh0l8uJd$NJ8@a?t$rJV$9!#(B
|
|
84 *
|
|
85 * (wnn-server-zenkouho bunsetu-no dai)
|
|
86 * bunsetu-no: INTEGER
|
|
87 * dai: BOOLEAN
|
|
88 * RETURNS: offset
|
|
89 * DESCRIPTION:
|
|
90 * $BJ8@aHV9f$G;XDj$5$l$?J8@a$NA48uJd$r$H$j$@$7(B
|
98
|
91 * $B!"8=:_$N%*%U%;%C%H$rJV$9!#(B
|
70
|
92 *
|
|
93 * (wnn-server-get-zenkouho offset)
|
|
94 * bunsetu-no: INTEGER
|
|
95 * dai: BOOLEAN
|
|
96 * RETURNS: list of zenkouho
|
|
97 * DESCRIPTION:
|
98
|
98 * $B%*%U%;%C%H$G;XDj$5$l$?8uJd$rF@$k!#(B
|
70
|
99 *
|
|
100 * (wnn-server-zenkouho-bun)
|
|
101 * RETURNS: INTEGER
|
|
102 * DESCRIPTION:
|
|
103 * $BA48uJd$rI=<($7$F$$$kJ8@aHV9f$rF@$k!#(B
|
|
104 *
|
|
105 * (wnn-server-zenkouho-suu)
|
|
106 * RETURNS: INTEGER
|
|
107 * DESCRIPTION:
|
|
108 * $BA48uJd$rI=<($7$F$$$kJ8@a$NA48uJd?t$rF@$k!#(B
|
|
109 *
|
|
110 * (wnn-server-dai-top bun-no)
|
|
111 * bun-no: INTEGER
|
|
112 * RETURNS: BOOLEAN
|
|
113 * DESCRIPTION:
|
|
114 * $BJ8@a$,BgJ8@a$N@hF,$J$i(B t
|
|
115 *
|
|
116 * (wnn-server-dai-end bun-no)
|
|
117 * bun-no: INTEGER
|
|
118 * RETURNS: INTEGER
|
|
119 * DESCRIPTION:
|
|
120 * $B<!$NBgJ8@a$NJ8@aHV9f$rF@$k!#(B
|
|
121 *
|
|
122 * (wnn-server-henkan-kakutei kouho-no dai)
|
|
123 * kouho-no: INTEGER
|
|
124 * dai: BOOLEAN
|
|
125 * RETURNS: BOOLEAN
|
|
126 * DESCRIPTION:
|
|
127 * $B8uJdHV9f$G<($5$l$?8uJd$rA*Br$9$k!#(B
|
|
128 * (wnn-server-zenkouho) $B$r8F$s$F$+$i$G$J$$$H$$$1$J$$!#(B
|
|
129 *
|
|
130 * (wnn-server-bunsetu-henkou bunsetu-no bunsetu-length dai)
|
|
131 * bunsetu-no: INTEGER
|
|
132 * bunsetu-length: INTEGER
|
|
133 * dai: BOOLEAN
|
|
134 * RETURNS:
|
|
135 * DESCRIPTION:
|
|
136 * $BJ8@a$ND9$5$rJQ99$9$k!#(B
|
|
137 *
|
|
138 * (wnn-bunsetu-kouho-inspect bunsetu-no)
|
|
139 * bunsetu-no: INTEGER
|
|
140 * RETURNS: (kanji yomi jisho-no serial-no hinsi hindo
|
|
141 * ima hyoka daihyoka kangovect)
|
|
142 * DESCRIPTION:
|
98
|
143 * $BJ8@a$N?'!9$J>pJs$rJQ49%P%C%U%!$+$i$H$j=P$9!#(B
|
70
|
144 *
|
|
145 * (wnn-server-henkan-quit)
|
|
146 * RETURNS: BOOLEAN
|
|
147 * DESCRIPTION:
|
|
148 * $B2?$b$7$J$$!#(B
|
|
149 *
|
|
150 * (wnn-server-bunsetu-kanji bun-no)
|
|
151 * RETURNS: (bunsetu-kanji length)
|
|
152 * DESCRIPTION:
|
|
153 *
|
|
154 * (wnn-server-bunsetu-yomi bun-no)
|
|
155 * RETURNS: (bunsetu-yomi length)
|
|
156 * DESCRIPTION:
|
|
157 *
|
|
158 * (wnn-server-bunsetu-suu)
|
|
159 * RETURNS: bunsetu-suu
|
|
160 * DESCRIPTION:
|
|
161 *
|
|
162 * (wnn-server-hindo-update &optional bunsetu-no)
|
|
163 * bunsetu-no: INTEGER
|
|
164 * RETURNS: BOOLEAN
|
|
165 * DESCRIPTION:
|
|
166 * $BIQEY>pJs$r99?7$9$k!#(B
|
|
167 *
|
|
168 * (wnn-server-word-add dic-no tango yomi comment hinsi)
|
|
169 * dic-no: INTEGER
|
|
170 * tango: STRING
|
|
171 * yoni: STRING
|
|
172 * comment: STRING
|
|
173 * hinsi: INTEGER
|
|
174 * RETURNS: BOOLEAN
|
|
175 * DESCRIPTION:
|
|
176 * $B<-=q$KC18l$rEPO?$9$k!#(B
|
|
177 *
|
|
178 * (wnn-server-word-delete dic-no entry)
|
|
179 * dic-no: INTEGER
|
|
180 * entry: INTEGER
|
|
181 * RETURNS: BOOLEAN
|
|
182 * DESCRIPTION:
|
98
|
183 * $B<-=q$+$i%(%s%H%jHV9f$G<($5$l$kC18l$r:o=|$9$k!#(B
|
70
|
184 *
|
|
185 * (wnn-server-word-use dic-no entry)
|
|
186 * dic-no: INTEGER
|
|
187 * entry: INTEGER
|
|
188 * RETURNS: BOOLEAN
|
|
189 * DESCRIPTION:
|
98
|
190 * $B<-=q$+$i%(%s%H%jHV9f$G<($5$l$kC18l$NM-8z!?L58z$r%H%0%k$9$k!#(B
|
|
191 *
|
70
|
192 * (wnn-server-word-info dic-no entry)
|
|
193 * dic-no: INTEGER
|
|
194 * entry: INTEGER
|
|
195 * RETURNS: (yomi kanji comment hindo hinsi)
|
|
196 * DESCRIPTION:
|
98
|
197 * $B<-=q$+$i%(%s%H%jHV9f$G<($5$l$kC18l$N>pJs$rF@$k!#(B
|
70
|
198 *
|
|
199 * (wnn-server-word-hindo-set dic-no entry hindo)
|
|
200 * dic-no: INTEGER
|
|
201 * entry: INTEGER
|
|
202 * hindo: INTEGER
|
|
203 * RETURNS: BOOLEAN
|
|
204 * DESCRIPTION:
|
98
|
205 * $B<-=q$+$i%(%s%H%jHV9f$G<($5$l$kC18l$NIQEY$r@_Dj$9$k!#(B
|
70
|
206 *
|
|
207 * (wnn-server-word-search yomi)
|
|
208 * yomi: STRING
|
|
209 * RETURNS: a LIST of dict-joho
|
|
210 * DESCRIPTION:
|
|
211 * $BA4$F$N<-=q$+$iC18l8!:w$r9T$J$&!#(B
|
|
212 *
|
|
213 * (wnn-server-dict-save)
|
|
214 * RETURNS: BOOLEAN
|
|
215 * DESCRIPTION:
|
98
|
216 * $BA4$F$N<-=q$HIQEY%U%!%$%k$r%;!<%V$9$k!#(B
|
70
|
217 *
|
|
218 * (wnn-server-get-param)
|
|
219 * RETURNS: (n nsho p1 p2 p3 ... p15)
|
98
|
220 * DESCRIPTION: $BJQ49%Q%i%a!<%?$rF@$k!#(B
|
70
|
221 *
|
|
222 * (wnn-server-set-param n sho p1 ... p15)
|
|
223 * RETURNS: $B%(%i!<$N;~(B nil
|
98
|
224 * DESCRIPTION: $BJQ49%Q%i%a!<%?$r@_Dj$9$k!#(B
|
70
|
225 *
|
|
226 * (wnn-server-get-msg error-no)
|
|
227 * RETURNS: $B%(%i!<%a225;!<%8(B
|
98
|
228 * DESCRIPTION: $B%(%i!<HV9f$+$i%a%C%;!<%8$rF@$k!#(B
|
70
|
229 *
|
|
230 * (wnn-server-fuzokugo-set fname)
|
|
231 * RETURNS: $B%(%i!<$N;~(B nil
|
98
|
232 * DESCRIPTION: $B%P%C%U%!$KImB08l%U%!%$%k$rFI$_9~$`!#(B
|
70
|
233 *
|
|
234 * (wnn-server-fuzokugo-get)
|
98
|
235 * RETURNS: $B%U%!%$%kL>(B
|
|
236 * DESCRIPTION: $B%P%C%U%!$NImB08l%U%!%$%kL>$rF@$k!#(B
|
70
|
237 *
|
|
238 * (wnn-server-isconnect)
|
98
|
239 * RETURNS: $B%3%M%/%H$7$F$l$P(B t, $B$7$F$J$1$l$P(B nil
|
70
|
240 * DESCRIPTION: $B%5!<%P$H7Q$C$F$$$k$+D4$Y$k!#(B
|
|
241 *
|
|
242 * (wnn-server-hinsi-dicts hinsi-no)
|
|
243 * RETURNS: (dic-no1 dic-no2 ...)
|
|
244 * DESCRIPTION: hinsi-no $B$NIJ;l$,EPO?$G$-$k<-=q$N%j%9%H$rF@$k!#(B
|
|
245 * hinsi-no = -1 $B$N$H$-$K$O!"EPO?2DG=$JA4<-=q$rF@$k!#(B
|
|
246 *
|
|
247 * (wnn-server-hinsi-list dic-no name)
|
|
248 * RETURNS: (name1 name2 ... )
|
|
249 * DESCRIPTION: dic-no $B$N<-=q$G!"IJ;l%N!<%I$KB0$9$k(B
|
|
250 * $BIJ;l%N!<%I!JL>!K$N%j%9%H$rF@$k!#(B
|
|
251 * $BIJ;lL>$rM?$($?;~$O!"#0$rJV$9!#(B
|
|
252 *
|
|
253 * (wnn-server-hinsi-name hinsi-no)
|
|
254 * RETURNS: hinsi-name
|
|
255 * DESCRIPTION: $BIJ;lHV9f$+$iL>A0$r<h$k!#(B
|
|
256 *
|
|
257 * (wnn-server-hinsi-number hinsi-name)
|
|
258 * RETURNS: hinsi-no
|
|
259 * DESCRIPTION: $BIJ;lL>$rIJ;lHV9f$KJQ49$9$k!#(B
|
|
260 *
|
|
261 * (wnn-server-version)
|
|
262 * RETURNS: version ID(int)
|
|
263 *
|
|
264 */
|
|
265
|
|
266 #include <config.h>
|
|
267 #include "lisp.h"
|
|
268
|
|
269 #include "buffer.h"
|
|
270 #include "window.h"
|
151
|
271 #include "sysdep.h"
|
70
|
272
|
151
|
273 #include "wnn/commonhd.h"
|
98
|
274 #include "mule-charset.h"
|
151
|
275 #include "wnn/jllib.h"
|
|
276 #include "wnn/cplib.h"
|
70
|
277
|
|
278 /* UCHAR $B$,Fs=EDj5A$5$l$k$N$G(B */
|
|
279 #define _UCHAR_T
|
|
280
|
|
281 #define EGG_TIMEOUT 5
|
|
282 #define NSERVER 4
|
|
283 #define WNNSERVER_J 0
|
|
284 #define WNNSERVER_C 1
|
|
285 #define WNNSERVER_T 2
|
|
286 #define WNNSERVER_K 3
|
|
287
|
380
|
288 int check_wnn_server_type (void);
|
98
|
289 void w2m (w_char *wp, unsigned char *mp, unsigned char lb);
|
|
290 void m2w (unsigned char *mp, w_char *wp);
|
|
291 void w2y (w_char *w);
|
|
292 void c2m (unsigned char *cp, unsigned char *mp, unsigned char lb);
|
|
293 static void puts2 (char *s);
|
157
|
294 static int dai_end (int no, int server);
|
98
|
295 static int yes_or_no (unsigned char *s);
|
|
296
|
157
|
297 /* Why doesn't wnn have a prototype for these? */
|
|
298 typedef unsigned int letter;
|
|
299 int cwnn_yincod_pzy(w_char *, w_char, int);
|
|
300 int cwnn_pzy_yincod(letter *, letter *, int);
|
|
301
|
70
|
302 static struct wnn_buf *wnnfns_buf[NSERVER];
|
|
303 static struct wnn_env *wnnfns_env_norm[NSERVER];
|
|
304 static struct wnn_env *wnnfns_env_rev[NSERVER];
|
|
305 static int wnnfns_norm;
|
|
306 static unsigned char lb_wnn_server_type[NSERVER] =
|
98
|
307 {LEADING_BYTE_JAPANESE_JISX0208, LEADING_BYTE_CHINESE_GB2312, LEADING_BYTE_THAI_TIS620, LEADING_BYTE_KOREAN_KSC5601};
|
70
|
308
|
|
309 /* Lisp Variables and Constants Definition */
|
|
310 Lisp_Object Qjserver;
|
|
311 Lisp_Object Qcserver;
|
|
312 /*Lisp_Object Qtserver;*/
|
|
313 Lisp_Object Qkserver;
|
|
314 Lisp_Object Qwnn_no_uniq;
|
|
315 Lisp_Object Qwnn_uniq;
|
|
316 Lisp_Object Qwnn_uniq_kanji;
|
98
|
317 Lisp_Object Qwnn_n, Qwnn_nsho, Qwnn_hindo, Qwnn_len, Qwnn_jiri, Qwnn_flag;
|
|
318 Lisp_Object Qwnn_jisho, Qwnn_sbn, Qwnn_dbn_len, Qwnn_sbn_cnt, Qwnn_suuji;
|
|
319 Lisp_Object Qwnn_kana, Qwnn_eisuu, Qwnn_kigou, Qwnn_toji_kakko, Qwnn_fuzokogo, Qwnn_kaikakko;
|
70
|
320 Lisp_Object Vwnn_server_type;
|
|
321 Lisp_Object Vcwnn_zhuyin;
|
|
322 Lisp_Object Vwnnenv_sticky;
|
|
323 Lisp_Object Vwnn_uniq_level;
|
|
324 int lb_sisheng;
|
|
325
|
|
326 /* Lisp functions definition */
|
|
327
|
|
328 DEFUN ("wnn-server-open", Fwnn_open, 2, 2, 0, /*
|
|
329 Connect to jserver of host HNAME, make an environment with
|
|
330 login name LNAME in the server.
|
|
331 Return nil if error occurs
|
|
332 */
|
98
|
333 (hname, lname))
|
70
|
334 {
|
300
|
335 char *envname;
|
|
336 char *langname;
|
|
337 char *hostname;
|
70
|
338 int snum;
|
300
|
339 int size;
|
70
|
340 CHECK_STRING (lname);
|
|
341
|
|
342 snum = check_wnn_server_type ();
|
|
343 switch (snum)
|
|
344 {
|
|
345 case WNNSERVER_J:
|
300
|
346 langname = "ja_JP";
|
70
|
347 break;
|
|
348 case WNNSERVER_C:
|
300
|
349 langname = "zh_CN";
|
70
|
350 break;
|
380
|
351 /*
|
70
|
352 case WNNSERVER_T:
|
|
353 strcpy (langname, "zh_TW");
|
|
354 break;
|
|
355 */
|
|
356 case WNNSERVER_K:
|
300
|
357 langname = "ko_KR";
|
70
|
358 break;
|
300
|
359 case -1:
|
|
360 default:
|
|
361 return Qnil;
|
70
|
362 }
|
300
|
363 size = XSTRING_LENGTH (lname) > 1024 ? 1026 : XSTRING_LENGTH (lname) + 2;
|
|
364 envname = alloca (size);
|
|
365 strncpy (envname, (char *) XSTRING_DATA (lname), size-2);
|
|
366 envname[size-2] = '\0';
|
|
367 if (NILP (hname)) hostname = "";
|
70
|
368 else
|
|
369 {
|
|
370 CHECK_STRING (hname);
|
300
|
371 size = XSTRING_LENGTH(hname) > 1024 ? 1025 : XSTRING_LENGTH(hname) + 1;
|
|
372
|
|
373 hostname = alloca (size);
|
|
374 strncpy (hostname, (char *) XSTRING_DATA (hname), size-1);
|
|
375 hostname[size-1] = '\0';
|
70
|
376 }
|
|
377 CHECK_STRING (lname);
|
126
|
378 /* 97/4/16 jhod@po.iijnet.or.jp
|
|
379 * libwnn uses SIGALRM, so we need to stop and start interrupts.
|
|
380 */
|
|
381 stop_interrupts();
|
70
|
382 if (!(wnnfns_buf[snum] = jl_open_lang (envname, hostname, langname,
|
|
383 0, 0, 0, EGG_TIMEOUT)))
|
|
384 {
|
126
|
385 start_interrupts();
|
70
|
386 return Qnil;
|
|
387 }
|
126
|
388 if (!jl_isconnect (wnnfns_buf[snum]))
|
|
389 {
|
|
390 start_interrupts();
|
|
391 return Qnil;
|
|
392 }
|
70
|
393 wnnfns_env_norm[snum] = jl_env_get (wnnfns_buf[snum]);
|
|
394 /* if (Vwnnenv_sticky == Qt) jl_env_sticky_e (wnnfns_env_norm[snum]);
|
|
395 else jl_env_un_sticky_e (wnnfns_env_norm[snum]);*/
|
|
396 strcat (envname, "R");
|
|
397 if (!(wnnfns_env_rev[snum] = jl_connect_lang (envname, hostname, langname,
|
|
398 0, 0, 0, EGG_TIMEOUT)))
|
|
399 {
|
126
|
400 start_interrupts();
|
70
|
401 return Qnil;
|
|
402 }
|
|
403 /* if (Vwnnenv_sticky == Qt) jl_env_sticky_e (wnnfns_env_rev[snum]);
|
|
404 else jl_env_un_sticky_e (wnnfns_env_rev[snum]);*/
|
126
|
405 start_interrupts();
|
70
|
406 return Qt;
|
|
407 }
|
|
408
|
|
409
|
|
410 DEFUN ("wnn-server-close", Fwnn_close, 0, 0, 0, /*
|
380
|
411 Close the connection to jserver, Dictionary and frequency files
|
70
|
412 are not saved.
|
|
413 */
|
98
|
414 ())
|
70
|
415 {
|
|
416 int snum;
|
|
417 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
418 if (!wnnfns_buf[snum]) return Qnil;
|
|
419 if (wnnfns_env_norm[snum])
|
|
420 {
|
380
|
421 if (NILP (Vwnnenv_sticky)) jl_env_un_sticky_e (wnnfns_env_norm[snum]);
|
70
|
422 else jl_env_sticky_e (wnnfns_env_norm[snum]);
|
|
423 jl_disconnect (wnnfns_env_norm[snum]);
|
|
424 }
|
|
425 if (wnnfns_env_rev[snum])
|
|
426 {
|
380
|
427 if (NILP (Vwnnenv_sticky)) jl_env_un_sticky_e (wnnfns_env_rev[snum]);
|
70
|
428 else jl_env_sticky_e (wnnfns_env_rev[snum]);
|
|
429 jl_disconnect (wnnfns_env_rev[snum]);
|
|
430 }
|
|
431 jl_env_set (wnnfns_buf[snum], 0);
|
|
432 jl_close (wnnfns_buf[snum]);
|
|
433 wnnfns_buf[snum] = (struct wnn_buf *) 0;
|
|
434 wnnfns_env_norm[snum] = wnnfns_env_rev[snum] = (struct wnn_env *) 0;
|
|
435 return Qt;
|
|
436 }
|
|
437
|
|
438 DEFUN ("wnn-server-dict-add", Fwnn_dict_add, 5, MANY, 0, /*
|
|
439 Add dictionary specified by DICT-FILE-NAME, FREQ-FILE-NAME,
|
|
440 PRIORITY, DICT-FILE-MODE, FREQ-FILE-MODE.
|
|
441 Specify password files of dictionary and frequency, PW1 and PW2, if needed.
|
|
442 */
|
98
|
443 (int nargs, Lisp_Object *args))
|
70
|
444 {
|
|
445 struct gcpro gcpro1;
|
|
446 int snum;
|
|
447 CHECK_STRING (args[0]);
|
|
448 CHECK_STRING (args[1]);
|
|
449 CHECK_INT (args[2]);
|
380
|
450 if (! NILP (args[5])) CHECK_STRING (args[5]);
|
|
451 if (! NILP (args[6])) CHECK_STRING (args[6]);
|
70
|
452 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
453 if (!wnnfns_buf[snum]) return Qnil;
|
|
454 GCPRO1 (*args);
|
|
455 gcpro1.nvars = nargs;
|
|
456 if (jl_dic_add (wnnfns_buf[snum],
|
380
|
457 XSTRING_DATA (args[0]),
|
|
458 XSTRING_DATA (args[1]),
|
70
|
459 wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV,
|
|
460 XINT (args[2]),
|
380
|
461 NILP (args[3]) ? WNN_DIC_RDONLY : WNN_DIC_RW,
|
|
462 NILP (args[4]) ? WNN_DIC_RDONLY : WNN_DIC_RW,
|
|
463 NILP (args[5]) ? 0 : XSTRING_DATA (args[5]),
|
|
464 NILP (args[6]) ? 0 : XSTRING_DATA (args[6]),
|
70
|
465 yes_or_no,
|
|
466 puts2 ) < 0)
|
|
467 {
|
|
468 UNGCPRO;
|
|
469 return Qnil;
|
|
470 }
|
|
471 UNGCPRO;
|
|
472 return Qt;
|
|
473 }
|
|
474
|
|
475 DEFUN ("wnn-server-dict-delete", Fwnn_dict_delete, 1, 1, 0, /*
|
|
476 Remove dictionary specified by DIC-NUMBER from buffer.
|
|
477 */
|
98
|
478 (dicno))
|
70
|
479 {
|
|
480 int no;
|
|
481 int snum;
|
|
482 CHECK_INT (dicno);
|
|
483 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
484 no = XINT (dicno);
|
|
485 if (!wnnfns_buf[snum]) return Qnil;
|
|
486 if (jl_dic_delete (wnnfns_buf[snum], no) < 0) return Qnil;
|
|
487 return Qt;
|
|
488 }
|
|
489
|
|
490 DEFUN ("wnn-server-dict-list", Fwnn_dict_list, 0, 0, 0, /*
|
|
491 Return information of dictionaries.
|
|
492 */
|
98
|
493 ())
|
70
|
494 {
|
|
495 WNN_DIC_INFO *dicinfo;
|
|
496 int cnt, i;
|
|
497 unsigned char comment[1024];
|
|
498 Lisp_Object val;
|
380
|
499 int snum;
|
70
|
500 unsigned char lb;
|
|
501
|
|
502 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
503 lb = lb_wnn_server_type[snum];
|
|
504 if (!wnnfns_buf[snum]) return Qnil;
|
|
505 #ifdef WNN6
|
|
506 if((cnt = jl_fi_dic_list (wnnfns_buf[snum], 0x3f, &dicinfo)) < 0)
|
|
507 return Qnil;
|
|
508 #else
|
|
509 if((cnt = jl_dic_list (wnnfns_buf[snum], &dicinfo)) < 0) return Qnil;
|
|
510 #endif
|
|
511 val = Qnil;
|
|
512 for (i = 0, dicinfo += cnt; i < cnt; i++)
|
|
513 {
|
|
514 dicinfo--;
|
|
515 w2m (dicinfo->comment, comment, lb);
|
157
|
516 /* #### The following has not been Mule-ized!!
|
|
517 fname and comment must be ASCII strings! */
|
|
518 val =
|
|
519 Fcons (Fcons (make_int (dicinfo->dic_no),
|
|
520 list4 (make_string ((Bufbyte *) (dicinfo->fname),
|
|
521 strlen (dicinfo->fname)),
|
|
522 make_string (comment, strlen ((char *) comment)),
|
|
523 make_int (dicinfo->gosuu),
|
|
524 make_int (dicinfo->nice))), val);
|
70
|
525 }
|
|
526 return val;
|
|
527 }
|
|
528
|
|
529 DEFUN ("wnn-server-dict-comment", Fwnn_dict_comment, 2, 2, 0, /*
|
|
530 Set comment to dictionary specified by DIC-NUMBER.
|
|
531 Comment string COMMENT
|
380
|
532 */
|
98
|
533 (dicno, comment))
|
70
|
534 {
|
157
|
535 w_char wbuf[512];
|
|
536 int snum;
|
70
|
537 CHECK_INT (dicno);
|
|
538 CHECK_STRING (comment);
|
|
539 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
540 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
541 m2w (XSTRING_DATA (comment), wbuf);
|
|
542 if (jl_dic_comment_set (wnnfns_buf[snum], XINT (dicno), wbuf) < 0)
|
70
|
543 return Qnil;
|
|
544 return Qt;
|
|
545 }
|
|
546
|
|
547
|
|
548 DEFUN ("wnn-server-set-rev", Fwnn_set_rev, 1, 1, 0, /*
|
|
549 Switch the translation mode to normal if T, or reverse if NIL.
|
|
550 */
|
98
|
551 (rev))
|
70
|
552 {
|
|
553 int snum;
|
|
554 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
380
|
555 if (NILP (rev))
|
70
|
556 {
|
157
|
557 if ((!wnnfns_buf[snum]) || (!wnnfns_env_norm[snum])) return Qnil;
|
70
|
558 jl_env_set (wnnfns_buf[snum], wnnfns_env_norm[snum]);
|
|
559 wnnfns_norm = 1;
|
|
560 }
|
|
561 else
|
|
562 {
|
157
|
563 if ((!wnnfns_buf[snum]) || (!wnnfns_env_rev[snum])) return Qnil;
|
70
|
564 jl_env_set (wnnfns_buf[snum], wnnfns_env_rev[snum]);
|
|
565 wnnfns_norm = 0;
|
|
566 }
|
134
|
567 return Qt;
|
70
|
568 }
|
|
569
|
|
570 DEFUN ("wnn-server-henkan-begin", Fwnn_begin_henkan, 1, 1, 0, /*
|
|
571 Translate YOMI string to kanji. Retuen the number of bunsetsu.
|
|
572 */
|
98
|
573 (hstring))
|
70
|
574 {
|
|
575 int cnt;
|
|
576 w_char wbuf[5000];
|
|
577 int snum;
|
|
578 CHECK_STRING (hstring);
|
|
579 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
580 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
581 m2w (XSTRING_DATA (hstring), wbuf);
|
70
|
582 if (snum == WNNSERVER_C)
|
|
583 w2y (wbuf);
|
|
584
|
|
585 #ifdef WNN6
|
380
|
586 if ((cnt = jl_fi_ren_conv (wnnfns_buf[snum], wbuf, 0, -1, WNN_USE_MAE)) < 0)
|
70
|
587 return Qnil;
|
|
588 #else
|
380
|
589 if ((cnt = jl_ren_conv (wnnfns_buf[snum], wbuf, 0, -1, WNN_USE_MAE)) < 0)
|
70
|
590 return Qnil;
|
98
|
591 #endif
|
70
|
592 return make_int (cnt);
|
|
593 }
|
|
594
|
|
595 DEFUN ("wnn-server-zenkouho", Fwnn_zenkouho, 2, 2, 0, /*
|
272
|
596 Get zenkouho at BUNSETSU-NUMBER. Second argument DAI is t.
|
70
|
597 if dai-bunsetsu, NIL if sho-bunsetsu. Return the current offset of zenkouho.
|
|
598 */
|
98
|
599 (bunNo, dai))
|
70
|
600 {
|
173
|
601 int no, offset;
|
70
|
602 int snum;
|
|
603 int uniq_level;
|
|
604 CHECK_INT (bunNo);
|
|
605 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
606 if (!wnnfns_buf[snum]) return Qnil;
|
|
607 no = XINT (bunNo);
|
98
|
608 if (EQ(Vwnn_uniq_level, Qwnn_no_uniq)) uniq_level = WNN_NO_UNIQ;
|
|
609 else if (EQ(Vwnn_uniq_level, Qwnn_uniq)) uniq_level = WNN_UNIQ;
|
70
|
610 else uniq_level = WNN_UNIQ_KNJ;
|
173
|
611 if (NILP (dai))
|
70
|
612 {
|
173
|
613 if ((offset = jl_zenkouho (wnnfns_buf[snum],no,WNN_USE_MAE,
|
|
614 uniq_level)) < 0)
|
70
|
615 return Qnil;
|
|
616 }
|
|
617 else
|
|
618 {
|
173
|
619 if ((offset = jl_zenkouho_dai (wnnfns_buf[snum], no, dai_end (no, snum),
|
|
620 WNN_USE_MAE, uniq_level)) < 0)
|
70
|
621 return Qnil;
|
|
622 }
|
|
623 return make_int (offset);
|
|
624 }
|
|
625
|
|
626
|
|
627 DEFUN ("wnn-server-get-zenkouho", Fwnn_get_zenkouho, 1, 1, 0, /*
|
272
|
628 Get kanji string of KOUHO-NUMBER.
|
70
|
629 */
|
98
|
630 (kouhoNo))
|
70
|
631 {
|
|
632 unsigned char kanji_buf[256];
|
|
633 w_char wbuf[256];
|
|
634 int snum;
|
|
635 unsigned char lb;
|
|
636 CHECK_INT (kouhoNo);
|
|
637 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
638 lb = lb_wnn_server_type[snum];
|
|
639 if (!wnnfns_buf[snum]) return Qnil;
|
|
640 jl_get_zenkouho_kanji (wnnfns_buf[snum], XINT (kouhoNo), wbuf);
|
|
641 w2m (wbuf, kanji_buf, lb);
|
157
|
642 return make_string (kanji_buf, strlen ((char *) kanji_buf));
|
70
|
643 }
|
|
644
|
|
645 DEFUN ("wnn-server-zenkouho-bun", Fwnn_zenkouho_bun, 0, 0, 0, /*
|
|
646 For Wnn.
|
|
647 */
|
98
|
648 ())
|
70
|
649 {
|
|
650 int snum;
|
|
651 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
652 return make_int (jl_zenkouho_bun (wnnfns_buf[snum]));
|
|
653 }
|
|
654
|
|
655 DEFUN ("wnn-server-zenkouho-suu", Fwnn_zenkouho_suu, 0, 0, 0, /*
|
272
|
656 Return the number of zen kouho.
|
70
|
657 */
|
98
|
658 ())
|
70
|
659 {
|
|
660 int snum;
|
|
661 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
662 return make_int (jl_zenkouho_suu (wnnfns_buf[snum]));
|
|
663 }
|
|
664
|
|
665 DEFUN ("wnn-server-dai-top", Fwnn_dai_top, 1, 1, 0, /*
|
272
|
666 Return t if bunsetsu BUN-NUMBER is dai-bunsetsu.
|
70
|
667 */
|
98
|
668 (bunNo))
|
70
|
669 {
|
|
670 int snum;
|
|
671 CHECK_INT (bunNo);
|
|
672 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
673 if (!wnnfns_buf[snum]) return Qnil;
|
|
674 if (jl_dai_top (wnnfns_buf[snum], XINT (bunNo)) == 1) return Qt;
|
|
675 else return Qnil;
|
|
676 }
|
|
677
|
|
678 DEFUN ("wnn-server-dai-end", Fwnn_dai_end, 1, 1, 0, /*
|
|
679 Return the bunsetu number of the next dai-bunsetsu after BUN-NUMBER.
|
|
680 */
|
98
|
681 (bunNo))
|
70
|
682 {
|
|
683 int snum;
|
|
684 CHECK_INT (bunNo);
|
|
685 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
686 if (!wnnfns_buf[snum]) return Qnil;
|
|
687 return make_int (dai_end (XINT (bunNo), snum));
|
|
688 }
|
|
689
|
|
690 DEFUN ("wnn-server-henkan-kakutei", Fwnn_kakutei, 2, 2, 0, /*
|
|
691 Set candidate with OFFSET, DAI. DAI is T if dai-bunsetsu.
|
|
692 */
|
98
|
693 (offset, dai))
|
70
|
694 {
|
|
695 int snum;
|
|
696 CHECK_INT (offset);
|
|
697 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
698 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
699 if (NILP (dai))
|
70
|
700 {
|
|
701 if (jl_set_jikouho (wnnfns_buf[snum], XINT (offset)) < 0) return Qnil;
|
|
702 }
|
|
703 else
|
|
704 {
|
|
705 if (jl_set_jikouho_dai (wnnfns_buf[snum], XINT (offset)) < 0)
|
|
706 return Qnil;
|
|
707 }
|
|
708 return Qt;
|
|
709 }
|
|
710
|
|
711 DEFUN ("wnn-server-bunsetu-henkou", Fwnn_bunsetu_henkou, 3, 3, 0, /*
|
|
712 Change length of BUN-NUMBER bunsetu to LEN. DAI is T if dai-bunsetsu.
|
|
713 */
|
98
|
714 (bunNo, len, dai))
|
70
|
715 {
|
|
716 int cnt, no;
|
|
717 int snum;
|
|
718 CHECK_INT (bunNo);
|
|
719 CHECK_INT (len);
|
|
720 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
721 if (!wnnfns_buf[snum]) return Qnil;
|
|
722 no = XINT (bunNo);
|
|
723 #ifdef WNN6
|
|
724 if ((cnt = jl_fi_nobi_conv (wnnfns_buf[snum], no, XINT(len), -1, WNN_USE_MAE,
|
380
|
725 NILP (dai) ? WNN_SHO : WNN_DAI)) < 0)
|
70
|
726 return Qnil;
|
|
727 #else
|
|
728 if ((cnt = jl_nobi_conv (wnnfns_buf[snum], no, XINT(len), -1, WNN_USE_MAE,
|
380
|
729 NILP (dai) ? WNN_SHO : WNN_DAI)) < 0)
|
70
|
730 return Qnil;
|
|
731 #endif
|
|
732 return make_int (cnt);
|
|
733 }
|
|
734
|
|
735 DEFUN ("wnn-server-inspect", Fwnn_inspect, 1, 1, 0, /*
|
|
736 Get bunsetsu information specified by BUN-NUMBER.
|
|
737 */
|
98
|
738 (bunNo))
|
70
|
739 {
|
|
740 Lisp_Object val;
|
|
741 unsigned char cbuf[512];
|
|
742 w_char wbuf[256];
|
|
743 int bun_no, yomilen, jirilen, i;
|
|
744 int snum;
|
|
745 unsigned char lb;
|
|
746 CHECK_INT (bunNo);
|
|
747 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
748 lb = lb_wnn_server_type[snum];
|
|
749 if (!wnnfns_buf[snum]) return Qnil;
|
|
750 bun_no = XINT (bunNo);
|
|
751 val = Qnil;
|
|
752 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->kangovect), val);
|
|
753 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->daihyoka), val);
|
|
754 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->hyoka), val);
|
|
755 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->ima), val);
|
|
756 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->hindo), val);
|
|
757 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->hinsi), val);
|
|
758 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->entry), val);
|
|
759 val = Fcons (make_int (wnnfns_buf[snum]->bun[bun_no]->dic_no), val);
|
|
760 yomilen = jl_get_yomi (wnnfns_buf[snum], bun_no, bun_no + 1, wbuf);
|
|
761 jirilen = wnnfns_buf[snum]->bun[bun_no]->jirilen;
|
|
762 for (i = yomilen; i >= jirilen; i--) wbuf[i+1] = wbuf[i];
|
|
763 wbuf[jirilen] = '+';
|
|
764 w2m (wbuf, cbuf, lb);
|
157
|
765 val = Fcons (make_string (cbuf, strlen ((char *) cbuf)), val);
|
70
|
766 jl_get_kanji (wnnfns_buf[snum], bun_no, bun_no + 1, wbuf);
|
|
767 w2m (wbuf, cbuf, lb);
|
157
|
768 val = Fcons (make_string (cbuf, strlen ((char *) cbuf)), val);
|
70
|
769 return val;
|
|
770 }
|
|
771
|
|
772
|
|
773 DEFUN ("wnn-server-henkan-quit", Fwnn_quit_henkan, 0, 0, 0, /*
|
|
774 do nothing
|
|
775 */
|
98
|
776 ())
|
70
|
777 {
|
|
778 int snum;
|
|
779 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
780 if (!wnnfns_buf[snum]) return Qnil;
|
|
781 return Qt;
|
|
782 }
|
|
783
|
|
784 DEFUN ("wnn-server-bunsetu-kanji", Fwnn_bunsetu_kanji, 1, 1, 0, /*
|
|
785 Get the pair of kanji and length of bunsetsu specified by BUN-NUMBER.
|
|
786 */
|
98
|
787 (bunNo))
|
70
|
788 {
|
|
789 int no;
|
|
790 unsigned char kanji_buf[256];
|
|
791 w_char wbuf[256];
|
|
792 int kanji_len;
|
|
793 int snum;
|
|
794 unsigned char lb;
|
|
795 CHECK_INT (bunNo);
|
|
796 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
797 lb = lb_wnn_server_type[snum];
|
|
798 if (!wnnfns_buf[snum]) return Qnil;
|
|
799 no = XINT (bunNo);
|
|
800 kanji_len = jl_get_kanji (wnnfns_buf[snum], no, no + 1, wbuf);
|
|
801 w2m (wbuf, kanji_buf, lb);
|
157
|
802 return Fcons (make_string (kanji_buf, strlen ((char *) kanji_buf)),
|
70
|
803 make_int (kanji_len));
|
|
804 }
|
|
805
|
|
806 DEFUN ("wnn-server-bunsetu-yomi", Fwnn_bunsetu_yomi, 1, 1, 0, /*
|
|
807 Get the pair of yomi and length of bunsetsu specified by BUN-NUMBER.
|
|
808 */
|
98
|
809 (bunNo))
|
70
|
810 {
|
|
811 int no;
|
|
812 unsigned char yomi_buf[256];
|
|
813 w_char wbuf[256];
|
|
814 int yomi_len;
|
|
815 int snum;
|
|
816 unsigned char lb;
|
|
817 CHECK_INT (bunNo);
|
|
818 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
819 lb = lb_wnn_server_type[snum];
|
|
820 if (!wnnfns_buf[snum]) return Qnil;
|
|
821 no = XINT (bunNo);
|
|
822 yomi_len = jl_get_yomi (wnnfns_buf[snum], no, no + 1, wbuf);
|
|
823 w2m (wbuf, yomi_buf, lb);
|
157
|
824 return Fcons (make_string (yomi_buf, strlen ((char *) yomi_buf)),
|
70
|
825 make_int (yomi_len));
|
|
826 }
|
|
827
|
|
828 DEFUN ("wnn-server-bunsetu-suu", Fwnn_bunsetu_suu, 0, 0, 0, /*
|
|
829 Get the number of bunsetsu.
|
|
830 */
|
98
|
831 ())
|
70
|
832 {
|
|
833 int snum;
|
|
834 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
835 if (!wnnfns_buf[snum]) return Qnil;
|
|
836 return make_int (jl_bun_suu (wnnfns_buf[snum]));
|
|
837 }
|
|
838
|
|
839 DEFUN ("wnn-server-hindo-update", Fwnn_hindo_update, 0, 1, 0, /*
|
|
840 Update frequency of bunsetsu specified by NUM-NUMBER.
|
|
841 */
|
98
|
842 (bunNo))
|
70
|
843 {
|
|
844 int no;
|
|
845 int snum;
|
|
846 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
380
|
847 if (NILP (bunNo)) no = -1;
|
70
|
848 else
|
|
849 {
|
|
850 CHECK_INT (bunNo);
|
|
851 no = XINT (bunNo);
|
|
852 }
|
|
853 if (!wnnfns_buf[snum]) return Qnil;
|
|
854 #ifdef WNN6
|
|
855 if (jl_optimize_fi (wnnfns_buf[snum], 0, no) < 0) return Qnil;
|
|
856 #else
|
|
857 if (jl_update_hindo (wnnfns_buf[snum], 0, no) < 0) return Qnil;
|
|
858 #endif
|
|
859 return Qt;
|
|
860 }
|
|
861
|
|
862
|
|
863 DEFUN ("wnn-server-word-add", Fwnn_word_toroku, 5, 5, 0, /*
|
|
864 Add a word to dictionary. Arguments are
|
|
865 DIC-NUMBER, KANJI, YOMI, COMMENT, HINSI-NUMBER
|
|
866 */
|
98
|
867 (dicno, kanji, yomi, comment, hinsi))
|
70
|
868 {
|
|
869 w_char yomi_buf[256], kanji_buf[256], comment_buf[256];
|
|
870 int snum;
|
|
871 CHECK_INT (dicno);
|
|
872 CHECK_STRING (kanji);
|
|
873 CHECK_STRING (yomi);
|
|
874 CHECK_STRING (comment);
|
|
875 CHECK_INT (hinsi);
|
|
876 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
877 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
878 m2w (XSTRING_DATA (yomi), yomi_buf);
|
70
|
879 if (snum == WNNSERVER_C)
|
|
880 w2y (yomi_buf);
|
380
|
881 m2w (XSTRING_DATA (kanji), kanji_buf);
|
|
882 m2w (XSTRING_DATA (comment), comment_buf);
|
70
|
883 if (jl_word_add (wnnfns_buf[snum], XINT (dicno), yomi_buf, kanji_buf,
|
380
|
884 comment_buf, XINT (hinsi), 0) < 0)
|
70
|
885 return Qnil;
|
|
886 else return Qt;
|
|
887 }
|
|
888
|
|
889
|
|
890 DEFUN ("wnn-server-word-delete", Fwnn_word_sakujo, 2, 2, 0, /*
|
|
891 Delete a word from dictionary, specified by DIC-NUMBER, SERIAL-NUMBER
|
|
892 */
|
98
|
893 (no, serial))
|
70
|
894 {
|
|
895 int snum;
|
|
896 CHECK_INT (no);
|
|
897 CHECK_INT (serial);
|
|
898 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
899 if (!wnnfns_buf[snum]) return Qnil;
|
|
900 if (jl_word_delete (wnnfns_buf[snum], XINT (no), XINT (serial)) < 0)
|
|
901 return Qnil;
|
|
902 else return Qt;
|
|
903 }
|
|
904
|
|
905
|
|
906 DEFUN ("wnn-server-word-use", Fwnn_word_use, 2, 2, 0, /*
|
|
907 Toggle on/off word, specified by DIC-NUMBER and SERIAL-NUMBER
|
|
908 */
|
98
|
909 (no, serial))
|
70
|
910 {
|
|
911 int snum;
|
|
912 CHECK_INT (no);
|
|
913 CHECK_INT (serial);
|
|
914 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
915 if (!wnnfns_buf[snum]) return Qnil;
|
|
916 if (jl_word_use (wnnfns_buf[snum], XINT (no), XINT (serial)) < 0)
|
|
917 return Qnil;
|
|
918 else return Qt;
|
|
919 }
|
|
920
|
|
921 DEFUN ("wnn-server-word-info", Fwnn_word_info, 2, 2, 0, /*
|
|
922 Return list of yomi, kanji, comment, hindo, hinshi.
|
|
923 */
|
98
|
924 (no, serial))
|
70
|
925 {
|
|
926 Lisp_Object val;
|
|
927 struct wnn_jdata *info_buf;
|
|
928 unsigned char cbuf[512];
|
|
929 int snum;
|
|
930 unsigned char lb;
|
|
931 CHECK_INT (no);
|
|
932 CHECK_INT (serial);
|
|
933 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
934 lb = lb_wnn_server_type[snum];
|
|
935 if (!wnnfns_buf[snum]) return Qnil;
|
102
|
936 if ((info_buf = jl_word_info (wnnfns_buf[snum],
|
|
937 XINT (no), XINT (serial))) != NULL)
|
70
|
938 {
|
|
939 return Qnil;
|
|
940 }
|
|
941 else
|
|
942 {
|
|
943 val = Qnil;
|
|
944 val = Fcons (make_int (info_buf->hinshi), val);
|
|
945 val = Fcons (make_int (info_buf->hindo), val);
|
|
946 w2m (info_buf->com, cbuf, lb);
|
157
|
947 val = Fcons (make_string (cbuf, strlen ((char *) cbuf)), val);
|
70
|
948 w2m (info_buf->kanji, cbuf, lb);
|
157
|
949 val = Fcons (make_string (cbuf, strlen ((char *) cbuf)), val);
|
70
|
950 w2m (info_buf->yomi, cbuf, lb);
|
157
|
951 val = Fcons (make_string (cbuf, strlen ((char *) cbuf)), val);
|
70
|
952 return val;
|
|
953 }
|
|
954 }
|
|
955
|
|
956 DEFUN ("wnn-server-word-hindo-set", Fwnn_hindo_set, 3, 3, 0, /*
|
|
957 Set frequency to arbitrary value. Specified by DIC-NUMBER,
|
|
958 SERIAL-NUMBER, FREQUENCY
|
|
959 */
|
98
|
960 (no, serial, hindo))
|
70
|
961 {
|
|
962 int snum;
|
|
963 CHECK_INT (no);
|
|
964 CHECK_INT (serial);
|
|
965 CHECK_INT (hindo);
|
|
966 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
967 if (!wnnfns_buf[snum]) return Qnil;
|
|
968 if (js_hindo_set (jl_env_get (wnnfns_buf[snum]),
|
|
969 XINT (no),
|
|
970 XINT (serial),
|
|
971 WNN_HINDO_NOP,
|
|
972 XINT (hindo)) < 0)
|
|
973 return Qnil;
|
|
974 else return Qt;
|
|
975 }
|
|
976
|
|
977
|
|
978 DEFUN ("wnn-server-word-search", Fwnn_dict_search, 1, 1, 0, /*
|
|
979 Search a word YOMI from buffer.
|
|
980 Return list of (kanji hinshi freq dic_no serial).
|
|
981 */
|
98
|
982 (yomi))
|
70
|
983 {
|
|
984 Lisp_Object val;
|
|
985 struct wnn_jdata *wordinfo;
|
|
986 int i, count;
|
|
987 w_char wbuf[256];
|
|
988 unsigned char kanji_buf[256];
|
|
989 int snum;
|
|
990 unsigned char lb;
|
|
991 CHECK_STRING (yomi);
|
|
992 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
993 lb = lb_wnn_server_type[snum];
|
|
994 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
995 m2w (XSTRING_DATA (yomi), wbuf);
|
70
|
996 if (snum == WNNSERVER_C)
|
|
997 w2y (wbuf);
|
|
998 if ((count = jl_word_search_by_env (wnnfns_buf[snum],
|
|
999 wbuf, &wordinfo)) < 0)
|
|
1000 return Qnil;
|
|
1001 val = Qnil;
|
|
1002 for (i = 0, wordinfo += count; i < count; i++)
|
|
1003 {
|
|
1004 wordinfo--;
|
|
1005 w2m (wordinfo->kanji, kanji_buf, lb);
|
157
|
1006 val = Fcons (Fcons (make_string (kanji_buf, strlen ((char *) kanji_buf)),
|
70
|
1007 list4 (make_int (wordinfo->hinshi),
|
|
1008 make_int (wordinfo->hindo),
|
|
1009 make_int (wordinfo->dic_no),
|
|
1010 make_int (wordinfo->serial))),
|
|
1011 val);
|
|
1012 }
|
|
1013 return val;
|
|
1014 }
|
|
1015
|
|
1016 DEFUN ("wnn-server-dict-save", Fwnn_dict_save, 0, 0, 0, /*
|
|
1017 Save all dictionaries and frequency files.
|
|
1018 */
|
98
|
1019 ())
|
70
|
1020 {
|
|
1021 int snum;
|
|
1022 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1023 if (!wnnfns_buf[snum]) return Qnil;
|
|
1024 if (jl_dic_save_all (wnnfns_buf[snum]) < 0) return Qnil;
|
|
1025 else return Qt;
|
|
1026 }
|
|
1027
|
|
1028 DEFUN ("wnn-server-get-param", Fwnn_get_param, 0, 0, 0, /*
|
|
1029 Returns (n nsho hindo len jiri flag jisho sbn dbn_len sbn_cnt
|
|
1030 suuji kana eisuu kigou toji_kakko fuzokogo kaikakko)
|
|
1031 */
|
98
|
1032 ())
|
70
|
1033 {
|
|
1034 struct wnn_param param;
|
|
1035 int snum;
|
|
1036 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1037 if (!wnnfns_buf[snum]) return Qnil;
|
|
1038 if (jl_param_get (wnnfns_buf[snum], ¶m) < 0) return Qnil;
|
|
1039 return Fcons (make_int (param.n),
|
|
1040 Fcons (make_int (param.nsho),
|
|
1041 Fcons (make_int (param.p1),
|
|
1042 Fcons (make_int (param.p2),
|
|
1043 Fcons (make_int (param.p3),
|
|
1044 Fcons (make_int (param.p4),
|
|
1045 Fcons (make_int (param.p5),
|
|
1046 Fcons (make_int (param.p6),
|
|
1047 Fcons (make_int (param.p7),
|
|
1048 Fcons (make_int (param.p8),
|
|
1049 Fcons (make_int (param.p9),
|
|
1050 Fcons (make_int (param.p10),
|
|
1051 Fcons (make_int (param.p11),
|
|
1052 Fcons (make_int (param.p12),
|
|
1053 Fcons (make_int (param.p13),
|
|
1054 Fcons (make_int (param.p14),
|
|
1055 Fcons (make_int (param.p15),Qnil)))))))))))))))));
|
|
1056 }
|
|
1057
|
98
|
1058 DEFUN ("wnn-server-set-param", Fwnn_set_param, 1, 1, 0, /*
|
|
1059 Set parameters using an alist, where the CAR contains one of
|
|
1060 wnn_n, wnn_nsho, wnn_hindo, wnn_len, wnn_jiri, wnn_flag,
|
|
1061 wnn_jisho, wnn_sbn, wnn_dbn_len, wnn_sbn_cnt, wnn_suuji,
|
|
1062 wnn_kana, wnn_eisuu, wnn_kigou, wnn_toji_kakko, wnn_fuzokogo,
|
|
1063 or wnn_kaikakko and the CDR contains the value.
|
70
|
1064 */
|
98
|
1065 (Vsetvalues_alist))
|
70
|
1066 {
|
|
1067 int rc;
|
|
1068 struct wnn_param param;
|
98
|
1069 Lisp_Object tail, key, val;
|
70
|
1070 int snum;
|
98
|
1071
|
70
|
1072 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1073 if (!wnnfns_buf[snum]) return Qnil;
|
98
|
1074 rc = jl_param_get (wnnfns_buf[snum], ¶m);
|
|
1075 if (rc < 0) return Qnil;
|
|
1076
|
|
1077 EXTERNAL_PROPERTY_LIST_LOOP (tail, key, val, Vsetvalues_alist)
|
|
1078 {
|
|
1079 int setval;
|
|
1080 CHECK_INT (val);
|
|
1081 setval = XINT (val);
|
|
1082 if (EQ (key, Qwnn_n)) param.n = setval;
|
380
|
1083 else if (EQ (key, Qwnn_nsho)) param.nsho = setval;
|
98
|
1084 else if (EQ (key, Qwnn_hindo)) param.p1 = setval;
|
|
1085 else if (EQ (key, Qwnn_len)) param.p2 = setval;
|
|
1086 else if (EQ (key, Qwnn_jiri)) param.p3 = setval;
|
|
1087 else if (EQ (key, Qwnn_flag)) param.p4 = setval;
|
|
1088 else if (EQ (key, Qwnn_jisho)) param.p5 = setval;
|
|
1089 else if (EQ (key, Qwnn_sbn)) param.p6 = setval;
|
|
1090 else if (EQ (key, Qwnn_dbn_len)) param.p7 = setval;
|
|
1091 else if (EQ (key, Qwnn_sbn_cnt)) param.p8 = setval;
|
|
1092 else if (EQ (key, Qwnn_suuji)) param.p9 = setval;
|
|
1093 else if (EQ (key, Qwnn_kana)) param.p10 = setval;
|
|
1094 else if (EQ (key, Qwnn_eisuu)) param.p11 = setval;
|
|
1095 else if (EQ (key, Qwnn_kigou)) param.p12 = setval;
|
|
1096 else if (EQ (key, Qwnn_toji_kakko)) param.p13 = setval;
|
|
1097 else if (EQ (key, Qwnn_fuzokogo)) param.p14 = setval;
|
|
1098 else if (EQ (key, Qwnn_kaikakko)) param.p15 = setval;
|
|
1099 else
|
|
1100 {
|
|
1101 signal_simple_error ("Invalid wnn keyword", key);
|
|
1102 return Qnil;
|
|
1103 }
|
|
1104 }
|
|
1105
|
|
1106 #if 0
|
|
1107 printf("wnn_n = %d\n",param.n);
|
|
1108 printf("wnn_nsho = %d\n",param.nsho);
|
380
|
1109 printf("wnn_hindo = %d\n",param.p1);
|
|
1110 printf("wnn_len = %d\n",param.p2);
|
|
1111 printf("wnn_jiri = %d\n",param.p3);
|
|
1112 printf("wnn_flag = %d\n",param.p4);
|
|
1113 printf("wnn_jisho = %d\n",param.p5);
|
|
1114 printf("wnn_sbn = %d\n",param.p6);
|
|
1115 printf("wnn_dbn_len = %d\n",param.p7);
|
|
1116 printf("wnn_sbn_cnt = %d\n",param.p8);
|
|
1117 printf("wnn_suuji = %d\n",param.p9);
|
|
1118 printf("wnn_kana = %d\n",param.p10);
|
|
1119 printf("wnn_eisuu = %d\n",param.p11);
|
|
1120 printf("wnn_kigou = %d\n",param.p12);
|
|
1121 printf("wnn_toji_kakko = %d\n",param.p13);
|
|
1122 printf("wnn_fuzokogo = %d\n",param.p14);
|
|
1123 printf("wnn_kaikakko = %d\n",param.p15);
|
98
|
1124 #endif
|
|
1125
|
70
|
1126 rc = jl_param_set (wnnfns_buf[snum], ¶m);
|
|
1127 if (rc < 0) return Qnil;
|
|
1128 return Qt;
|
|
1129 }
|
|
1130
|
|
1131 DEFUN ("wnn-server-get-msg", Fwnn_get_msg, 0, 0, 0, /*
|
|
1132 Get message string from wnn_perror.
|
|
1133 */
|
98
|
1134 ())
|
70
|
1135 {
|
157
|
1136 unsigned char mbuf[256];
|
70
|
1137 char *msgp;
|
|
1138 int snum;
|
|
1139 unsigned char lb;
|
|
1140 char langname[32];
|
|
1141 /* CHECK_INT (errno);*/
|
|
1142 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1143 lb = lb_wnn_server_type[snum];
|
|
1144 switch (snum)
|
|
1145 {
|
|
1146 case WNNSERVER_J:
|
|
1147 strcpy (langname, "ja_JP");
|
|
1148 break;
|
|
1149 case WNNSERVER_C:
|
|
1150 strcpy (langname, "zh_CN");
|
|
1151 break;
|
|
1152 /*
|
|
1153 case WNNSERVER_T:
|
|
1154 strcpy (langname, "zh_TW");
|
|
1155 break;
|
|
1156 */
|
|
1157 case WNNSERVER_K:
|
|
1158 strcpy (langname, "ko_KR");
|
|
1159 break;
|
|
1160 }
|
|
1161 if (!wnnfns_buf[snum]) return Qnil;
|
|
1162 /* msgp = msg_get (wnn_msg_cat, XINT (errno), 0, 0);*/
|
|
1163 msgp = wnn_perror_lang (langname);
|
157
|
1164 c2m ((unsigned char *) msgp, mbuf, lb);
|
|
1165 return make_string (mbuf, strlen ((char *) mbuf));
|
70
|
1166 }
|
|
1167
|
|
1168
|
|
1169 DEFUN ("wnn-server-fuzokugo-set", Fwnn_fuzokugo_set, 1, 1, 0, /*
|
|
1170 For Wnn.
|
|
1171 */
|
98
|
1172 (file))
|
70
|
1173 {
|
|
1174 int snum;
|
|
1175 CHECK_STRING (file);
|
|
1176 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1177 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
1178 if (jl_fuzokugo_set (wnnfns_buf[snum], XSTRING_DATA (file)) < 0)
|
70
|
1179 return Qnil;
|
|
1180 return Qt;
|
|
1181 }
|
|
1182
|
|
1183 DEFUN ("wnn-server-fuzokugo-get", Fwnn_fuzokugo_get, 0, 0, 0, /*
|
|
1184 For Wnn.
|
|
1185 */
|
98
|
1186 ())
|
70
|
1187 {
|
|
1188 char fname[256];
|
|
1189 int snum;
|
|
1190 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1191 if (!wnnfns_buf[snum]) return Qnil;
|
|
1192 if (jl_fuzokugo_get (wnnfns_buf[snum], fname) < 0) return Qnil;
|
157
|
1193 return make_string ((Bufbyte *) fname, strlen (fname));
|
70
|
1194 }
|
|
1195
|
|
1196
|
|
1197 DEFUN ("wnn-server-isconnect", Fwnn_isconnect, 0, 0, 0, /*
|
|
1198 For Wnn.
|
|
1199 */
|
98
|
1200 ())
|
70
|
1201 {
|
|
1202 int snum;
|
|
1203 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1204 if (!wnnfns_buf[snum]) return Qnil;
|
|
1205 if (jl_isconnect (wnnfns_buf[snum])) return Qt;
|
|
1206 else return Qnil;
|
|
1207 }
|
|
1208
|
|
1209 DEFUN ("wnn-server-hinsi-dicts", Fwnn_hinsi_dicts, 1, 1, 0, /*
|
|
1210 For Wnn.
|
|
1211 */
|
98
|
1212 (hinsi))
|
70
|
1213 {
|
|
1214 int *area;
|
|
1215 int cnt;
|
|
1216 Lisp_Object val;
|
|
1217 int snum;
|
|
1218 CHECK_INT (hinsi);
|
|
1219 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1220 if (!wnnfns_buf[snum]) return Qnil;
|
|
1221 if ((cnt = jl_hinsi_dicts (wnnfns_buf[snum], XINT (hinsi), &area)) < 0)
|
|
1222 return Qnil;
|
|
1223 val = Qnil;
|
|
1224 for (area += cnt; cnt > 0; cnt--)
|
|
1225 {
|
|
1226 area--;
|
|
1227 val = Fcons (make_int (*area), val);
|
|
1228 }
|
|
1229 return val;
|
|
1230 }
|
|
1231
|
|
1232 DEFUN ("wnn-server-hinsi-list", Fwnn_hinsi_list, 2, 2, 0, /*
|
|
1233 For Wnn.
|
|
1234 */
|
98
|
1235 (dicno, name))
|
70
|
1236 {
|
|
1237 int cnt;
|
|
1238 Lisp_Object val;
|
|
1239 w_char wbuf[256];
|
|
1240 w_char **area;
|
|
1241 unsigned char cbuf[512];
|
|
1242 int snum;
|
|
1243 unsigned char lb;
|
|
1244 CHECK_INT (dicno);
|
|
1245 CHECK_STRING (name);
|
|
1246 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1247 lb = lb_wnn_server_type[snum];
|
|
1248 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
1249 m2w (XSTRING_DATA (name), wbuf);
|
70
|
1250 if ((cnt = jl_hinsi_list (wnnfns_buf[snum], XINT (dicno), wbuf, &area)) < 0)
|
|
1251 return Qnil;
|
|
1252 if (cnt == 0) return make_int (0);
|
|
1253 val = Qnil;
|
|
1254 for (area += cnt; cnt > 0; cnt--)
|
|
1255 {
|
|
1256 area--;
|
|
1257 w2m (*area, cbuf, lb);
|
157
|
1258 val = Fcons (make_string (cbuf, strlen ((char *) cbuf)), val);
|
70
|
1259 }
|
|
1260 return val;
|
|
1261 }
|
|
1262
|
|
1263 DEFUN ("wnn-server-hinsi-name", Fwnn_hinsi_name, 1, 1, 0, /*
|
|
1264 For Wnn.
|
|
1265 */
|
98
|
1266 (no))
|
70
|
1267 {
|
|
1268 unsigned char name[256];
|
|
1269 w_char *wname;
|
|
1270 int snum;
|
|
1271 unsigned char lb;
|
|
1272 CHECK_INT (no);
|
|
1273 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1274 lb = lb_wnn_server_type[snum];
|
|
1275 if (!wnnfns_buf[snum]) return Qnil;
|
|
1276 if ((wname = jl_hinsi_name (wnnfns_buf[snum], XINT (no))) == 0) return Qnil;
|
|
1277 w2m (wname, name, lb);
|
157
|
1278 return make_string (name, strlen ((char *) name));
|
70
|
1279 }
|
|
1280 #ifdef WNN6
|
|
1281 DEFUN ("wnn-server-fisys-dict-add", Fwnn_fisys_dict_add, 3, MANY, 0, /*
|
|
1282 Add dictionary specified by FISYS-DICT-FILE-NAME, FISYS-FREQ-FILE-NAME,
|
|
1283 FISYS-FREQ-FILE-MODE.
|
|
1284 Specify password files of dictionary and frequency, PW1 and PW2, if needed.
|
|
1285 */
|
98
|
1286 (int nargs, Lisp_Object *args))
|
70
|
1287 {
|
|
1288 struct gcpro gcpro1;
|
|
1289 int snum;
|
|
1290 CHECK_STRING (args[0]);
|
|
1291 CHECK_STRING (args[1]);
|
380
|
1292 if (! NILP (args[3])) CHECK_STRING (args[3]);
|
70
|
1293 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1294 if(!wnnfns_buf[snum]) return Qnil;
|
|
1295 GCPRO1 (*args);
|
|
1296 gcpro1.nvars = nargs;
|
|
1297 if(jl_fi_dic_add(wnnfns_buf[snum],
|
380
|
1298 XSTRING_DATA (args[0]),
|
|
1299 XSTRING_DATA (args[1]),
|
|
1300 WNN_FI_SYSTEM_DICT,
|
|
1301 WNN_DIC_RDONLY,
|
|
1302 NILP (args[2]) ? WNN_DIC_RDONLY : WNN_DIC_RW,
|
|
1303 0,
|
|
1304 NILP (args[3]) ? 0 : XSTRING_DATA (args[3]),
|
|
1305 yes_or_no,
|
|
1306 puts2 ) < 0) {
|
70
|
1307 UNGCPRO;
|
|
1308 return Qnil;
|
|
1309 }
|
|
1310 UNGCPRO;
|
|
1311 return Qt;
|
|
1312 }
|
|
1313
|
|
1314 DEFUN ("wnn-server-fiusr-dict-add", Fwnn_fiusr_dict_add, 4, MANY, 0, /*
|
|
1315 Add dictionary specified by FIUSR-DICT-FILE-NAME, FIUSR-FREQ-FILE-NAME,
|
|
1316 FIUSR-DICT-FILE-MODE, FIUSR-FREQ-FILE-MODE.
|
|
1317 Specify password files of dictionary and frequency, PW1 and PW2, if needed.
|
|
1318 */
|
98
|
1319 (int nargs, Lisp_Object *args))
|
70
|
1320 {
|
|
1321 struct gcpro gcpro1;
|
|
1322 int snum;
|
|
1323 CHECK_STRING (args[0]);
|
|
1324 CHECK_STRING (args[1]);
|
380
|
1325 if (! NILP (args[4])) CHECK_STRING (args[4]);
|
|
1326 if (! NILP (args[5])) CHECK_STRING (args[5]);
|
70
|
1327 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1328 if(!wnnfns_buf[snum]) return Qnil;
|
|
1329 GCPRO1 (*args);
|
|
1330 gcpro1.nvars = nargs;
|
|
1331 if(jl_fi_dic_add(wnnfns_buf[snum],
|
380
|
1332 XSTRING_DATA (args[0]),
|
|
1333 XSTRING_DATA (args[1]),
|
|
1334 WNN_FI_USER_DICT,
|
|
1335 NILP (args[2]) ? WNN_DIC_RDONLY : WNN_DIC_RW,
|
|
1336 NILP (args[3]) ? WNN_DIC_RDONLY : WNN_DIC_RW,
|
|
1337 NILP (args[4]) ? 0 : XSTRING_DATA (args[4]),
|
|
1338 NILP (args[5]) ? 0 : XSTRING_DATA (args[5]),
|
|
1339 yes_or_no,
|
|
1340 puts2 ) < 0) {
|
70
|
1341 UNGCPRO;
|
|
1342 return Qnil;
|
|
1343 }
|
|
1344 UNGCPRO;
|
|
1345 return Qt;
|
|
1346 }
|
|
1347
|
|
1348 DEFUN ("wnn-server-notrans-dict-add", Fwnn_notrans_dict_add, 3, MANY, 0, /*
|
|
1349 Add dictionary specified by NOTRANS-DICT-FILE-NAME, PRIORITY, DICT-FILE-MODE.
|
|
1350 Specify password files of dictionary and frequency PW1 if needed.
|
|
1351 */
|
98
|
1352 (int nargs, Lisp_Object *args))
|
70
|
1353 {
|
|
1354 struct gcpro gcpro1;
|
|
1355 int snum;
|
|
1356 int dic_no;
|
|
1357 struct wnn_env *cur_env;
|
|
1358 unsigned long vmask = 0;
|
|
1359 struct wnn_henkan_env henv;
|
|
1360 CHECK_STRING (args[0]);
|
|
1361 CHECK_INT (args[1]);
|
380
|
1362 if (! NILP (args[3])) CHECK_STRING (args[3]);
|
70
|
1363 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1364 if(!wnnfns_buf[snum]) return Qnil;
|
|
1365 GCPRO1 (*args);
|
|
1366 gcpro1.nvars = nargs;
|
|
1367 if(wnnfns_norm)
|
|
1368 cur_env = wnnfns_env_norm[snum];
|
|
1369 else
|
|
1370 cur_env = wnnfns_env_rev[snum];
|
|
1371 dic_no = js_get_autolearning_dic(cur_env, WNN_MUHENKAN_LEARNING);
|
|
1372 if (dic_no == WNN_NO_LEARNING) {
|
|
1373 if((dic_no = jl_dic_add(wnnfns_buf[snum],
|
380
|
1374 XSTRING_DATA (args[0]),
|
70
|
1375 0,
|
|
1376 wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV,
|
|
1377 XINT(args[1]),
|
|
1378 WNN_DIC_RW, WNN_DIC_RW,
|
380
|
1379 NILP (args[3]) ? 0 : XSTRING_DATA (args[3]),
|
70
|
1380 0,
|
|
1381 yes_or_no,
|
|
1382 puts2)) < 0) {
|
|
1383 UNGCPRO;
|
|
1384 return Qnil;
|
|
1385 }
|
|
1386 js_set_autolearning_dic(cur_env, WNN_MUHENKAN_LEARNING, dic_no);
|
|
1387 }
|
|
1388 if(!js_is_loaded_temporary_dic(cur_env)) {
|
|
1389 if(js_temporary_dic_add(cur_env,
|
|
1390 wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV) < 0) {
|
|
1391 UNGCPRO;
|
|
1392 return Qnil;
|
|
1393 }
|
|
1394 }
|
|
1395 vmask |= WNN_ENV_MUHENKAN_LEARN_MASK;
|
380
|
1396 henv.muhenkan_flag = NILP (args[2]) ? WNN_DIC_RDONLY : WNN_DIC_RW;
|
70
|
1397 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1398 vmask,
|
|
1399 &henv) < 0) {
|
|
1400 UNGCPRO;
|
|
1401 return Qnil;
|
|
1402 }
|
|
1403 UNGCPRO;
|
|
1404 return Qt;
|
|
1405 }
|
|
1406
|
|
1407 DEFUN ("wnn-server-bmodify-dict-add", Fwnn_bmodify_dict_add, 3, MANY, 0, /*
|
|
1408 Add dictionary specified by BMODIFY-DICT-FILE-NAME, PRIORITY, DICT-FILE-MODE.
|
|
1409 Specify password files of dictionary and frequency PW1 if needed.
|
|
1410 */
|
98
|
1411 (int nargs, Lisp_Object *args))
|
70
|
1412 {
|
|
1413 struct gcpro gcpro1;
|
|
1414 int snum;
|
|
1415 int dic_no;
|
|
1416 struct wnn_env *cur_env;
|
|
1417 unsigned long vmask = 0;
|
|
1418 struct wnn_henkan_env henv;
|
|
1419 CHECK_STRING (args[0]);
|
|
1420 CHECK_INT (args[1]);
|
380
|
1421 if (! NILP (args[3])) CHECK_STRING (args[3]);
|
70
|
1422 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1423 if(!wnnfns_buf[snum]) return Qnil;
|
|
1424 GCPRO1 (*args);
|
|
1425 gcpro1.nvars = nargs;
|
|
1426 if(wnnfns_norm)
|
|
1427 cur_env = wnnfns_env_norm[snum];
|
|
1428 else
|
|
1429 cur_env = wnnfns_env_rev[snum];
|
|
1430 dic_no = js_get_autolearning_dic(cur_env, WNN_BUNSETSUGIRI_LEARNING);
|
|
1431 if (dic_no == WNN_NO_LEARNING) {
|
|
1432 if((dic_no = jl_dic_add(wnnfns_buf[snum],
|
380
|
1433 XSTRING_DATA (args[0]),
|
70
|
1434 0,
|
|
1435 wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV,
|
|
1436 XINT(args[1]),
|
|
1437 WNN_DIC_RW, WNN_DIC_RW,
|
380
|
1438 NILP (args[3]) ? 0 : XSTRING_DATA (args[3]),
|
70
|
1439 0,
|
|
1440 yes_or_no,
|
|
1441 puts2)) < 0) {
|
|
1442 UNGCPRO;
|
|
1443 return Qnil;
|
|
1444 }
|
|
1445 js_set_autolearning_dic(cur_env, WNN_BUNSETSUGIRI_LEARNING, dic_no);
|
|
1446 }
|
|
1447 if(!js_is_loaded_temporary_dic(cur_env)) {
|
|
1448 if(js_temporary_dic_add(cur_env,
|
|
1449 wnnfns_norm ? WNN_DIC_ADD_NOR : WNN_DIC_ADD_REV) < 0) {
|
|
1450 UNGCPRO;
|
|
1451 return Qnil;
|
|
1452 }
|
|
1453 }
|
|
1454 vmask |= WNN_ENV_BUNSETSUGIRI_LEARN_MASK;
|
380
|
1455 henv.bunsetsugiri_flag = NILP (args[2]) ? WNN_DIC_RDONLY : WNN_DIC_RW;
|
70
|
1456 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1457 vmask,
|
|
1458 &henv) < 0) {
|
|
1459 UNGCPRO;
|
|
1460 return Qnil;
|
|
1461 }
|
|
1462 UNGCPRO;
|
|
1463 return Qt;
|
|
1464 }
|
|
1465
|
|
1466 DEFUN ("wnn-server-set-last-is-first", Fwnn_last_is_first, 1, 1, 0, /*
|
|
1467 For FI-Wnn.
|
|
1468 */
|
98
|
1469 (mode))
|
70
|
1470 {
|
|
1471 int snum;
|
|
1472 unsigned long vmask = 0;
|
|
1473 struct wnn_henkan_env henv;
|
|
1474 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1475 if(!wnnfns_buf[snum]) return Qnil;
|
380
|
1476 vmask |= WNN_ENV_LAST_IS_FIRST_MASK;
|
|
1477 henv.last_is_first_flag = NILP (mode) ? False : True;
|
70
|
1478 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1479 vmask,
|
|
1480 &henv) < 0) return Qnil;
|
|
1481 return Qt;
|
|
1482 }
|
|
1483
|
|
1484 DEFUN ("wnn-server-set-complex-conv-mode", Fwnn_complex_conv, 1, 1, 0, /*
|
|
1485 For FI-Wnn.
|
|
1486 */
|
98
|
1487 (mode))
|
70
|
1488 {
|
|
1489 int snum;
|
|
1490 unsigned long vmask = 0;
|
|
1491 struct wnn_henkan_env henv;
|
|
1492 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1493 if(!wnnfns_buf[snum]) return Qnil;
|
|
1494 vmask |= WNN_ENV_COMPLEX_CONV_MASK;
|
380
|
1495 henv.complex_flag = NILP (mode) ? False : True;
|
70
|
1496 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1497 vmask,
|
|
1498 &henv) < 0) return Qnil;
|
|
1499 return Qt;
|
|
1500 }
|
|
1501
|
|
1502 DEFUN ("wnn-server-set-okuri-learn-mode", Fwnn_okuri_learn, 1, 1, 0, /*
|
|
1503 For FI-Wnn.
|
|
1504 */
|
98
|
1505 (mode))
|
70
|
1506 {
|
|
1507 int snum;
|
|
1508 unsigned long vmask = 0;
|
|
1509 struct wnn_henkan_env henv;
|
|
1510 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1511 if(!wnnfns_buf[snum]) return Qnil;
|
|
1512 vmask |= WNN_ENV_OKURI_LEARN_MASK;
|
380
|
1513 henv.okuri_learn_flag = NILP (mode) ? False : True;
|
70
|
1514 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1515 vmask,
|
|
1516 &henv) < 0) return Qnil;
|
|
1517 return Qt;
|
|
1518 }
|
|
1519
|
|
1520 DEFUN ("wnn-server-set-okuri-flag", Fwnn_okuri_flag, 1, 1, 0, /*
|
|
1521 For FI-Wnn.
|
|
1522 */
|
129
|
1523 (lmode))
|
70
|
1524 {
|
129
|
1525 int snum, mode;
|
70
|
1526 unsigned long vmask = 0;
|
|
1527 struct wnn_henkan_env henv;
|
129
|
1528 CHECK_INT (lmode);
|
|
1529 mode = XINT (lmode);
|
70
|
1530 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1531 if(!wnnfns_buf[snum]) return Qnil;
|
|
1532 if(mode != WNN_OKURI_REGULATION &&
|
|
1533 mode != WNN_OKURI_NO &&
|
|
1534 mode != WNN_OKURI_YES)
|
|
1535 return Qnil;
|
|
1536 else
|
|
1537 henv.okuri_flag = mode;
|
|
1538 vmask |= WNN_ENV_OKURI_MASK;
|
|
1539 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1540 vmask,
|
|
1541 &henv) < 0) return Qnil;
|
|
1542 return Qt;
|
|
1543 }
|
|
1544
|
|
1545 DEFUN ("wnn-server-set-prefix-learn-mode", Fwnn_prefix_learn, 1, 1, 0, /*
|
|
1546 For FI-Wnn.
|
|
1547 */
|
98
|
1548 (mode))
|
70
|
1549 {
|
|
1550 int snum;
|
|
1551 unsigned long vmask = 0;
|
|
1552 struct wnn_henkan_env henv;
|
|
1553 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1554 if(!wnnfns_buf[snum]) return Qnil;
|
|
1555 vmask |= WNN_ENV_PREFIX_LEARN_MASK;
|
380
|
1556 henv.prefix_learn_flag = NILP (mode) ? False : True;
|
70
|
1557 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1558 vmask,
|
|
1559 &henv) < 0) return Qnil;
|
|
1560 return Qt;
|
|
1561 }
|
|
1562
|
|
1563 DEFUN ("wnn-server-set-prefix-flag", Fwnn_prefix_flag, 1, 1, 0, /*
|
|
1564 For FI-Wnn.
|
|
1565 */
|
129
|
1566 (lmode))
|
70
|
1567 {
|
129
|
1568 int snum, mode;
|
70
|
1569 unsigned long vmask = 0;
|
|
1570 struct wnn_henkan_env henv;
|
129
|
1571 CHECK_INT (lmode);
|
|
1572 mode = XINT (lmode);
|
70
|
1573 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1574 if(!wnnfns_buf[snum]) return Qnil;
|
|
1575 if(mode != WNN_KANA_KOUHO && mode != WNN_KANJI_KOUHO)
|
|
1576 return Qnil;
|
|
1577 else
|
|
1578 henv.prefix_flag = mode;
|
|
1579 vmask |= WNN_ENV_PREFIX_MASK;
|
|
1580 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1581 vmask,
|
|
1582 &henv) < 0) return Qnil;
|
|
1583 return Qt;
|
|
1584 }
|
|
1585
|
|
1586 DEFUN ("wnn-server-set-suffix-learn-mode", Fwnn_suffix_learn, 1, 1, 0, /*
|
|
1587 For FI-Wnn.
|
|
1588 */
|
98
|
1589 (mode))
|
70
|
1590 {
|
|
1591 int snum;
|
|
1592 unsigned long vmask = 0;
|
|
1593 struct wnn_henkan_env henv;
|
|
1594 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1595 if(!wnnfns_buf[snum]) return Qnil;
|
|
1596 vmask |= WNN_ENV_SUFFIX_LEARN_MASK;
|
380
|
1597 henv.suffix_learn_flag = NILP (mode) ? False : True;
|
70
|
1598 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1599 vmask,
|
|
1600 &henv) < 0) return Qnil;
|
|
1601 return Qt;
|
|
1602 }
|
|
1603
|
|
1604 DEFUN ("wnn-server-set-common-learn-mode", Fwnn_common_learn, 1, 1, 0, /*
|
|
1605 For FI-Wnn.
|
|
1606 */
|
98
|
1607 (mode))
|
70
|
1608 {
|
|
1609 int snum;
|
|
1610 unsigned long vmask = 0;
|
|
1611 struct wnn_henkan_env henv;
|
|
1612 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1613 if(!wnnfns_buf[snum]) return Qnil;
|
|
1614 vmask |= WNN_ENV_COMMON_LAERN_MASK;
|
380
|
1615 henv.common_learn_flag = NILP (mode) ? False : True;
|
70
|
1616 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1617 vmask,
|
|
1618 &henv) < 0) return Qnil;
|
|
1619 return Qt;
|
|
1620 }
|
|
1621
|
|
1622 DEFUN ("wnn-server-set-freq-func-mode", Fwnn_freq_func, 1, 1, 0, /*
|
|
1623 For FI-Wnn.
|
|
1624 */
|
129
|
1625 (lmode))
|
70
|
1626 {
|
129
|
1627 int snum, mode;
|
70
|
1628 unsigned long vmask = 0;
|
|
1629 struct wnn_henkan_env henv;
|
129
|
1630 CHECK_INT (lmode);
|
|
1631 mode = XINT (lmode);
|
70
|
1632 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1633 if(!wnnfns_buf[snum]) return Qnil;
|
|
1634 if(mode != 0 && mode != 1 && mode != 2 && mode != 3 && mode != 4)
|
|
1635 return Qnil;
|
|
1636 else
|
|
1637 henv.freq_func_flag = mode;
|
|
1638 vmask |= WNN_ENV_FREQ_FUNC_MASK;
|
|
1639 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1640 vmask,
|
|
1641 &henv) < 0) return Qnil;
|
|
1642 return Qt;
|
|
1643 }
|
|
1644
|
|
1645 DEFUN ("wnn-server-set-numeric-mode", Fwnn_numeric, 1, 1, 0, /*
|
|
1646 For FI-Wnn.
|
|
1647 */
|
129
|
1648 (lmode))
|
70
|
1649 {
|
129
|
1650 int snum, mode;
|
70
|
1651 unsigned long vmask = 0;
|
|
1652 struct wnn_henkan_env henv;
|
129
|
1653 CHECK_INT (lmode);
|
|
1654 mode = XINT (lmode);
|
70
|
1655 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1656 if(!wnnfns_buf[snum]) return Qnil;
|
|
1657 if(mode != WNN_NUM_KANSUUJI &&
|
|
1658 mode != WNN_NUM_KANOLD &&
|
|
1659 mode != WNN_NUM_HANCAN &&
|
|
1660 mode != WNN_NUM_ZENCAN &&
|
|
1661 mode != WNN_NUM_HAN &&
|
|
1662 mode != WNN_NUM_ZEN &&
|
|
1663 mode != WNN_NUM_KAN)
|
|
1664 return Qnil;
|
|
1665 else
|
|
1666 henv.numeric_flag = mode;
|
|
1667 vmask |= WNN_ENV_NUMERIC_MASK;
|
|
1668 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1669 vmask,
|
|
1670 &henv) < 0) return Qnil;
|
|
1671 return Qt;
|
|
1672 }
|
|
1673
|
|
1674 DEFUN ("wnn-server-set-alphabet-mode", Fwnn_alphabet, 1, 1, 0, /*
|
|
1675 For FI-Wnn.
|
|
1676 */
|
129
|
1677 (lmode))
|
70
|
1678 {
|
129
|
1679 int snum, mode;
|
70
|
1680 unsigned long vmask = 0;
|
|
1681 struct wnn_henkan_env henv;
|
129
|
1682 CHECK_INT (lmode);
|
|
1683 mode = XINT (lmode);
|
70
|
1684 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1685 if(!wnnfns_buf[snum]) return Qnil;
|
|
1686 if(mode != WNN_ALP_HAN && mode != WNN_ALP_ZEN)
|
|
1687 return Qnil;
|
|
1688 else
|
|
1689 henv.alphabet_flag = mode;
|
|
1690 vmask |= WNN_ENV_ALPHABET_MASK;
|
|
1691 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1692 vmask,
|
|
1693 &henv) < 0) return Qnil;
|
|
1694 return Qt;
|
|
1695 }
|
|
1696
|
|
1697 DEFUN ("wnn-server-set-symbol-mode", Fwnn_symbol, 1, 1, 0, /*
|
|
1698 For FI-Wnn.
|
|
1699 */
|
129
|
1700 (lmode))
|
70
|
1701 {
|
129
|
1702 int snum, mode;
|
70
|
1703 unsigned long vmask = 0;
|
|
1704 struct wnn_henkan_env henv;
|
129
|
1705 CHECK_INT (lmode);
|
|
1706 mode = XINT (lmode);
|
70
|
1707 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1708 if(!wnnfns_buf[snum]) return Qnil;
|
|
1709 if(mode != WNN_KIG_HAN && mode != WNN_KIG_JIS && mode != WNN_KIG_ASC)
|
|
1710 return Qnil;
|
|
1711 else
|
|
1712 henv.symbol_flag = mode;
|
|
1713 vmask |= WNN_ENV_SYMBOL_MASK;
|
|
1714 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1715 vmask,
|
|
1716 &henv) < 0) return Qnil;
|
|
1717 return Qt;
|
|
1718 }
|
|
1719
|
|
1720 DEFUN ("wnn-server-set-yuragi-mode", Fwnn_yuragi, 1, 1, 0, /*
|
|
1721 For FI-Wnn.
|
|
1722 */
|
98
|
1723 (mode))
|
70
|
1724 {
|
|
1725 int snum;
|
|
1726 unsigned long vmask = 0;
|
|
1727 struct wnn_henkan_env henv;
|
|
1728 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1729 if(!wnnfns_buf[snum]) return Qnil;
|
|
1730 vmask |= WNN_ENV_YURAGI_MASK;
|
380
|
1731 henv.yuragi_flag = NILP (mode) ? False : True;
|
70
|
1732 if(jl_set_henkan_env(wnnfns_buf[snum],
|
|
1733 vmask,
|
|
1734 &henv) < 0) return Qnil;
|
|
1735 return Qt;
|
|
1736 }
|
|
1737
|
|
1738 DEFUN ("wnn-reset-previous-info", Fwnn_reset_prev, 0, 0, 0, /*
|
|
1739 For FI-Wnn.
|
|
1740 */
|
98
|
1741 ())
|
70
|
1742 {
|
|
1743 int snum;
|
|
1744 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1745 if(!wnnfns_buf[snum]) return Qnil;
|
|
1746 if(jl_reset_prev_bun(wnnfns_buf[snum]) < 0) return Qnil;
|
|
1747 return Qt;
|
|
1748 }
|
|
1749 #endif /* Wnn6 */
|
|
1750
|
|
1751 DEFUN ("wnn-server-version", Fwnn_version, 0, 0, 0, /*
|
|
1752 Returns Wnn server version ID.
|
|
1753 */
|
98
|
1754 ())
|
70
|
1755 {
|
|
1756 int snum;
|
|
1757 int serv;
|
|
1758 int libv;
|
|
1759 struct wnn_env *cur_env;
|
|
1760 if ((snum = check_wnn_server_type()) == -1) return Qnil;
|
|
1761 if(!wnnfns_buf[snum]) return Qnil;
|
|
1762 if(wnnfns_norm)
|
|
1763 cur_env = wnnfns_env_norm[snum];
|
|
1764 else
|
|
1765 cur_env = wnnfns_env_rev[snum];
|
|
1766 if(js_version (cur_env->js_id,&serv,&libv) < 0) return Qnil;
|
|
1767 return make_int (serv);
|
|
1768 }
|
|
1769
|
|
1770 DEFUN ("wnn-server-hinsi-number", Fwnn_hinsi_number, 1, 1, 0, /*
|
|
1771 For Wnn.
|
|
1772 */
|
98
|
1773 (name))
|
70
|
1774 {
|
|
1775 w_char w_buf[256];
|
|
1776 int no;
|
|
1777 int snum;
|
|
1778 CHECK_STRING (name);
|
|
1779 if ((snum = check_wnn_server_type ()) == -1) return Qnil;
|
|
1780 if (!wnnfns_buf[snum]) return Qnil;
|
380
|
1781 m2w (XSTRING_DATA (name), w_buf);
|
70
|
1782 if ((no = jl_hinsi_number (wnnfns_buf[snum], w_buf)) < 0) return Qnil;
|
|
1783 return make_int (no);
|
|
1784 }
|
|
1785
|
|
1786 void
|
|
1787 syms_of_mule_wnn (void)
|
|
1788 {
|
|
1789 DEFSUBR (Fwnn_open);
|
|
1790 DEFSUBR (Fwnn_close);
|
|
1791 DEFSUBR (Fwnn_dict_add);
|
|
1792 DEFSUBR (Fwnn_dict_delete);
|
|
1793 DEFSUBR (Fwnn_dict_list);
|
|
1794 DEFSUBR (Fwnn_dict_comment);
|
|
1795 DEFSUBR (Fwnn_set_rev);
|
|
1796 DEFSUBR (Fwnn_begin_henkan);
|
|
1797 DEFSUBR (Fwnn_zenkouho);
|
|
1798 DEFSUBR (Fwnn_get_zenkouho);
|
|
1799 DEFSUBR (Fwnn_zenkouho_bun);
|
|
1800 DEFSUBR (Fwnn_zenkouho_suu);
|
|
1801 DEFSUBR (Fwnn_dai_top);
|
|
1802 DEFSUBR (Fwnn_dai_end);
|
|
1803 DEFSUBR (Fwnn_kakutei);
|
|
1804 DEFSUBR (Fwnn_bunsetu_henkou);
|
|
1805 DEFSUBR (Fwnn_inspect);
|
|
1806 DEFSUBR (Fwnn_quit_henkan);
|
|
1807 DEFSUBR (Fwnn_bunsetu_kanji);
|
|
1808 DEFSUBR (Fwnn_bunsetu_yomi);
|
|
1809 DEFSUBR (Fwnn_bunsetu_suu);
|
|
1810 DEFSUBR (Fwnn_hindo_update);
|
|
1811 DEFSUBR (Fwnn_word_toroku);
|
|
1812 DEFSUBR (Fwnn_word_sakujo);
|
|
1813 DEFSUBR (Fwnn_word_use);
|
|
1814 DEFSUBR (Fwnn_word_info);
|
|
1815 DEFSUBR (Fwnn_hindo_set);
|
|
1816 DEFSUBR (Fwnn_dict_search);
|
|
1817 DEFSUBR (Fwnn_dict_save);
|
|
1818 DEFSUBR (Fwnn_get_param);
|
|
1819 DEFSUBR (Fwnn_set_param);
|
|
1820 DEFSUBR (Fwnn_get_msg);
|
|
1821 DEFSUBR (Fwnn_fuzokugo_set);
|
|
1822 DEFSUBR (Fwnn_fuzokugo_get);
|
|
1823 DEFSUBR (Fwnn_isconnect);
|
|
1824 DEFSUBR (Fwnn_hinsi_dicts);
|
|
1825 DEFSUBR (Fwnn_hinsi_list);
|
|
1826 DEFSUBR (Fwnn_hinsi_name);
|
|
1827 DEFSUBR (Fwnn_hinsi_number);
|
|
1828 #ifdef WNN6
|
|
1829 DEFSUBR (Fwnn_fisys_dict_add);
|
|
1830 DEFSUBR (Fwnn_fiusr_dict_add);
|
|
1831 DEFSUBR (Fwnn_notrans_dict_add);
|
|
1832 DEFSUBR (Fwnn_bmodify_dict_add);
|
|
1833 DEFSUBR (Fwnn_last_is_first);
|
|
1834 DEFSUBR (Fwnn_complex_conv);
|
|
1835 DEFSUBR (Fwnn_okuri_learn);
|
|
1836 DEFSUBR (Fwnn_okuri_flag);
|
|
1837 DEFSUBR (Fwnn_prefix_learn);
|
|
1838 DEFSUBR (Fwnn_prefix_flag);
|
|
1839 DEFSUBR (Fwnn_suffix_learn);
|
|
1840 DEFSUBR (Fwnn_common_learn);
|
|
1841 DEFSUBR (Fwnn_freq_func);
|
|
1842 DEFSUBR (Fwnn_numeric);
|
|
1843 DEFSUBR (Fwnn_alphabet);
|
|
1844 DEFSUBR (Fwnn_symbol);
|
|
1845 DEFSUBR (Fwnn_yuragi);
|
|
1846 DEFSUBR (Fwnn_reset_prev);
|
|
1847 #endif /* Wnn6 */
|
|
1848 DEFSUBR (Fwnn_version);
|
|
1849
|
|
1850 defsymbol (&Qjserver, "jserver");
|
|
1851 defsymbol (&Qcserver, "cserver");
|
|
1852 /* defsymbol (&Qtserver, "tserver"); */
|
|
1853 defsymbol (&Qkserver, "kserver");
|
|
1854
|
|
1855 defsymbol (&Qwnn_no_uniq, "wnn-no-uniq");
|
|
1856 defsymbol (&Qwnn_uniq, "wnn-uniq");
|
|
1857 defsymbol (&Qwnn_uniq_kanji, "wnn-uniq-kanji");
|
98
|
1858 defsymbol (&Qwnn_n, "wnn_n");
|
|
1859 defsymbol (&Qwnn_nsho, "wnn_nsho");
|
|
1860 defsymbol (&Qwnn_hindo, "wnn_hindo");
|
|
1861 defsymbol (&Qwnn_len, "wnn_len");
|
|
1862 defsymbol (&Qwnn_jiri, "wnn_jiri");
|
|
1863 defsymbol (&Qwnn_flag, "wnn_flag");
|
|
1864 defsymbol (&Qwnn_jisho, "wnn_jisho");
|
|
1865 defsymbol (&Qwnn_sbn, "wnn_sbn");
|
|
1866 defsymbol (&Qwnn_dbn_len, "wnn_dbn_len");
|
|
1867 defsymbol (&Qwnn_sbn_cnt, "wnn_sbn_cnt");
|
|
1868 defsymbol (&Qwnn_suuji, "wnn_suuji");
|
|
1869 defsymbol (&Qwnn_kana, "wnn_kana");
|
|
1870 defsymbol (&Qwnn_eisuu, "wnn_eisuu");
|
|
1871 defsymbol (&Qwnn_kigou, "wnn_kigou");
|
|
1872 defsymbol (&Qwnn_toji_kakko, "wnn_toji_kakko");
|
|
1873 defsymbol (&Qwnn_fuzokogo, "wnn_fuzokogo");
|
|
1874 defsymbol (&Qwnn_kaikakko, "wnn_kaikakko");
|
70
|
1875 }
|
|
1876
|
|
1877 void
|
412
|
1878 vars_of_mule_wnn (void)
|
398
|
1879 {
|
|
1880 int i;
|
|
1881
|
70
|
1882 DEFVAR_INT ("lb-sisheng", &lb_sisheng /*
|
|
1883 Leading character for Sisheng.
|
|
1884 */ );
|
|
1885 DEFVAR_LISP ("wnn-server-type", &Vwnn_server_type /*
|
|
1886 *jserver, cserver ..
|
|
1887 */ );
|
|
1888 DEFVAR_LISP ("cwnn-zhuyin", &Vcwnn_zhuyin /*
|
|
1889 *pinyin or zhuyin
|
|
1890 */ );
|
|
1891 DEFVAR_LISP ("wnnenv-sticky", &Vwnnenv_sticky /*
|
|
1892 *If non-nil, make environment sticky
|
|
1893 */ );
|
|
1894 DEFVAR_LISP ("wnn-uniq-level", &Vwnn_uniq_level /*
|
|
1895 *Uniq level
|
|
1896 */ );
|
|
1897
|
|
1898 Vwnn_server_type = Qjserver;
|
|
1899 Vcwnn_zhuyin = Qnil;
|
|
1900 Vwnnenv_sticky = Qnil;
|
|
1901
|
|
1902 Vwnn_uniq_level = Qwnn_uniq;
|
|
1903
|
412
|
1904 for (i = 0; i < NSERVER; i++)
|
|
1905 {
|
|
1906 wnnfns_buf[i] = (struct wnn_buf *) 0;
|
|
1907 wnnfns_env_norm[i] = (struct wnn_env *) 0;
|
|
1908 wnnfns_env_rev[i] = (struct wnn_env *) 0;
|
|
1909 }
|
|
1910
|
207
|
1911 Fprovide(intern("wnn"));
|
70
|
1912 }
|
|
1913
|
|
1914 void
|
|
1915 w2m (w_char *wp, unsigned char *mp, unsigned char lb)
|
|
1916 {
|
|
1917 w_char wc;
|
|
1918 w_char pzy[10];
|
|
1919 int i, len;
|
|
1920
|
173
|
1921 while ((wc = *wp++) != 0)
|
70
|
1922 {
|
|
1923 switch (wc & 0x8080)
|
|
1924 {
|
|
1925 case 0x80:
|
98
|
1926 if (EQ(Vwnn_server_type, Qcserver))
|
70
|
1927 {
|
|
1928 len = cwnn_yincod_pzy (pzy, wc,
|
380
|
1929 NILP (Vcwnn_zhuyin)
|
70
|
1930 ? CWNN_PINYIN
|
|
1931 : CWNN_ZHUYIN);
|
|
1932 for (i = 0; i < len; i++)
|
|
1933 {
|
|
1934 if (pzy[i] & 0x80)
|
|
1935 {
|
98
|
1936 *mp++ = PRE_LEADING_BYTE_PRIVATE_1; /* #### Not sure about this one... */
|
70
|
1937 *mp++ = lb_sisheng;
|
|
1938 }
|
|
1939 *mp++ = pzy[i];
|
|
1940 }
|
|
1941 }
|
|
1942 else
|
|
1943 {
|
98
|
1944 *mp++ = LEADING_BYTE_KATAKANA_JISX0201;
|
70
|
1945 *mp++ = (wc & 0xff);
|
|
1946 }
|
|
1947 break;
|
|
1948 case 0x8080:
|
|
1949 *mp++ = lb;
|
|
1950 *mp++ = (wc & 0xff00) >> 8;
|
|
1951 *mp++ = wc & 0x00ff;
|
|
1952 break;
|
|
1953 case 0x8000:
|
98
|
1954 if (lb == LEADING_BYTE_JAPANESE_JISX0208)
|
|
1955 *mp++ = LEADING_BYTE_JAPANESE_JISX0212;
|
|
1956 else if (lb == LEADING_BYTE_CHINESE_BIG5_1)
|
|
1957 *mp++ = LEADING_BYTE_CHINESE_BIG5_2;
|
70
|
1958 else
|
|
1959 *mp++ = lb;
|
|
1960 *mp++ = (wc & 0xff00) >> 8;
|
173
|
1961 *mp++ = (wc & 0x00ff) | 0x80;
|
70
|
1962 break;
|
|
1963 default:
|
|
1964 *mp++ = wc & 0x00ff;
|
|
1965 break;
|
|
1966 }
|
|
1967 }
|
|
1968 *mp = 0;
|
|
1969 }
|
|
1970
|
|
1971 void
|
|
1972 m2w (unsigned char *mp, w_char *wp)
|
|
1973 {
|
|
1974 unsigned int ch;
|
380
|
1975
|
173
|
1976 while ((ch = *mp++) != 0)
|
70
|
1977 {
|
98
|
1978 if (BUFBYTE_LEADING_BYTE_P (ch))
|
70
|
1979 {
|
|
1980 switch (ch)
|
|
1981 {
|
98
|
1982 case LEADING_BYTE_KATAKANA_JISX0201:
|
70
|
1983 *wp++ = *mp++; break;
|
98
|
1984 case LEADING_BYTE_LATIN_JISX0201:
|
70
|
1985 *wp++ = *mp++ & 0x7F; break;
|
98
|
1986 case LEADING_BYTE_JAPANESE_JISX0208_1978:
|
|
1987 case LEADING_BYTE_CHINESE_GB2312:
|
|
1988 case LEADING_BYTE_JAPANESE_JISX0208:
|
|
1989 case LEADING_BYTE_KOREAN_KSC5601:
|
70
|
1990 /* case LEADING_BYTE_TW: */
|
|
1991 ch = *mp++;
|
|
1992 *wp++ = (ch << 8) | *mp++;
|
|
1993 break;
|
98
|
1994 case LEADING_BYTE_JAPANESE_JISX0212:
|
70
|
1995 ch = *mp++;
|
|
1996 *wp++ = (ch << 8) | (*mp++ & 0x7f);
|
|
1997 break;
|
98
|
1998 case PRE_LEADING_BYTE_PRIVATE_1: /* #### Not sure about this one... */
|
70
|
1999 ch = *mp++;
|
|
2000 if (ch == lb_sisheng)
|
|
2001 *wp++ = 0x8e80 | *mp++;
|
|
2002 else
|
|
2003 mp++;
|
|
2004 break;
|
|
2005 default: /* ignore this character */
|
98
|
2006 mp += REP_BYTES_BY_FIRST_BYTE(ch) - 1;
|
70
|
2007 }
|
|
2008 }
|
98
|
2009 else
|
|
2010 {
|
|
2011 *wp++ = ch;
|
|
2012 }
|
70
|
2013 }
|
|
2014 *wp = 0;
|
|
2015 }
|
|
2016
|
|
2017 void
|
|
2018 w2y (w_char *w)
|
|
2019 {
|
157
|
2020 letter pbuf[5000], ybuf[5000];
|
|
2021 unsigned int *pin;
|
70
|
2022 w_char *y;
|
|
2023 int len;
|
|
2024
|
|
2025 pin = pbuf;
|
|
2026 y = w;
|
|
2027 while (1)
|
|
2028 {
|
|
2029 if (*w == 0)
|
|
2030 {*pin =0; break;}
|
|
2031 else *pin = *w;
|
|
2032 w++; pin++;
|
|
2033 }
|
|
2034 len = cwnn_pzy_yincod (ybuf, pbuf,
|
380
|
2035 NILP (Vcwnn_zhuyin) ? CWNN_PINYIN : CWNN_ZHUYIN);
|
70
|
2036 if (len <= 0)
|
|
2037 return;
|
|
2038
|
|
2039 pin = ybuf;
|
|
2040 while (1)
|
|
2041 {
|
|
2042 if (*pin == 0 || len == 0)
|
|
2043 {*y = 0;break;}
|
|
2044 *y = *pin;
|
|
2045 y++; pin++; len--;
|
|
2046 }
|
|
2047 }
|
|
2048
|
|
2049 void
|
|
2050 c2m (unsigned char *cp, unsigned char *mp, unsigned char lb)
|
|
2051 {
|
173
|
2052 unsigned char ch;
|
|
2053 while ((ch = *cp) != 0)
|
70
|
2054 {
|
|
2055 if (ch & 0x80)
|
|
2056 {
|
|
2057 *mp++ = lb;
|
|
2058 *mp++ = *cp++;
|
|
2059 }
|
|
2060 *mp++ = *cp++;
|
|
2061 }
|
|
2062 *mp = 0;
|
|
2063 }
|
|
2064
|
157
|
2065 static int
|
70
|
2066 dai_end (int no, int server)
|
|
2067 {
|
|
2068 for (no++; no < jl_bun_suu (wnnfns_buf[server])
|
|
2069 && !jl_dai_top (wnnfns_buf[server], no); no++);
|
|
2070 return (no);
|
|
2071 }
|
|
2072
|
|
2073 static int
|
|
2074 yes_or_no (unsigned char *s)
|
|
2075 {
|
|
2076 unsigned char mbuf[512];
|
|
2077 unsigned char lb;
|
|
2078 int len;
|
|
2079 int snum;
|
|
2080 if ((snum = check_wnn_server_type ()) == -1) return 0;
|
|
2081 lb = lb_wnn_server_type[snum];
|
|
2082 /* if no message found, create file without query */
|
98
|
2083 /* if (wnn_msg_cat->msg_bd == 0) return 1;*/
|
70
|
2084 if (*s == 0) return 1;
|
|
2085 c2m (s, mbuf, lb);
|
|
2086 /* truncate "(Y/N)" */
|
|
2087 for (len = 0; (mbuf[len]) && (len < 512); len++);
|
|
2088 for (; (mbuf[len] != '(') && (len > 0); len--);
|
98
|
2089 {
|
|
2090 Lisp_Object yes, str;
|
134
|
2091 struct gcpro gcpro1;
|
98
|
2092
|
|
2093 str = make_string (mbuf, len);
|
134
|
2094 GCPRO1 (str);
|
102
|
2095 yes = call1(Qyes_or_no_p, str);
|
134
|
2096 UNGCPRO;
|
98
|
2097 if (NILP (yes)) return 0;
|
|
2098 else return (1);
|
|
2099 }
|
70
|
2100 }
|
|
2101
|
|
2102 static void
|
|
2103 puts2 (char *s)
|
|
2104 {
|
134
|
2105 #if 0 /* jhod: We don't really need this echoed... */
|
98
|
2106 #if 0
|
70
|
2107 Lisp_Object args[1];
|
|
2108 char mbuf[512];
|
|
2109 unsigned char lb;
|
|
2110 extern Lisp_Object Fmessage ();
|
|
2111 int snum;
|
|
2112 if ((snum = check_wnn_server_type ()) == -1) return;
|
|
2113 lb = lb_wnn_server_type[snum];
|
|
2114 c2m (s, mbuf, lb);
|
|
2115 args[0] = make_string (mbuf, strlen (mbuf));
|
|
2116 Fmessage (1, args);
|
98
|
2117 #else
|
|
2118 message("%s",s);
|
134
|
2119 #endif
|
|
2120 #endif
|
70
|
2121 }
|
|
2122
|
|
2123 int
|
|
2124 check_wnn_server_type (void)
|
|
2125 {
|
98
|
2126 if (EQ(Vwnn_server_type, Qjserver))
|
70
|
2127 {
|
|
2128 return WNNSERVER_J;
|
|
2129 }
|
98
|
2130 else if (EQ(Vwnn_server_type, Qcserver))
|
70
|
2131 {
|
|
2132 return WNNSERVER_C;
|
|
2133 }
|
|
2134 /* else if (Vwnn_server_type == Qtserver)
|
|
2135 {
|
|
2136 return WNNSERVER_T;
|
|
2137 } */
|
98
|
2138 else if (EQ(Vwnn_server_type, Qkserver))
|
70
|
2139 {
|
|
2140 return WNNSERVER_K;
|
|
2141 }
|
|
2142 else return -1;
|
|
2143 }
|