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