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