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