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