annotate lisp/egg/egg-sj3-client.el @ 151:59463afc5666 r20-3b2

Import from CVS: tag r20-3b2
author cvs
date Mon, 13 Aug 2007 09:37:19 +0200
parents 131b0175ea99
children 262b8bb4a523
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1 ;; Sj3 server interface for Egg
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2 ;; Coded by K.Ishii, Sony Corp. (kiyoji@sm.sony.co.jp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
3
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
4 ;; This file is part of Egg on Mule (Multilingual Environment)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
5
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
6 ;; Egg is distributed in the forms of patches to GNU
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
7 ;; Emacs under the terms of the GNU EMACS GENERAL PUBLIC
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
8 ;; LICENSE which is distributed along with GNU Emacs by the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
9 ;; Free Software Foundation.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
10
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
11 ;; Egg is distributed in the hope that it will be useful,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
12 ;; but WITHOUT ANY WARRANTY; without even the implied
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
13 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
14 ;; PURPOSE. See the GNU EMACS GENERAL PUBLIC LICENSE for
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
15 ;; more details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
16
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
17 ;; You should have received a copy of the GNU EMACS GENERAL
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
18 ;; PUBLIC LICENSE along with Nemacs; see the file COPYING.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
19 ;; If not, write to the Free Software Foundation, 675 Mass
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
20 ;; Ave, Cambridge, MA 02139, USA.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
21
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
22 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
23 ;;; Mule - Sj3 server interface in elisp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
24 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
25
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
26 (provide 'sj3-client)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
27
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
28 ;;;; $B=$@5%a%b!(!((B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
29
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
30 ;;; Aug-4-94 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
31 ;;; Bug fixed in sj3-put-kata.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
32
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
33 ;;; Apr-6-94 by N.Tanaka
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
34 ;;; Add version 2(japanese EUC) protocol
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
35
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
36 ;;; Jun-16-93 by H.Shirasaki <sirasaki@rd.ecip.osaka-u.ac.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
37 ;;; In sj3-bunsetu-yomi-equal, typo fixed.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
38
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
39 ;;; Apr-6-93 by T.Saneto <sanewo@pdp.crl.sony.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
40 ;;; Bug fixed in sj3-bunsetu-yomi-equal.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
41
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
42 ;;; Mar-19-93 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
43 ;;; Changed sj3-server-dict-info for edit-dict
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
44
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
45 ;;; Aug-6-92 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
46 ;;; $BF|K\8lH=Dj$K(B lc-jp $B$r;H$&$h$&$KJQ99(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
47
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
48 ;;; Jul-30-92 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
49 ;;; $BD9$$J8>O$rJQ49$9$k$H$-$K5/$3$k(B "Args out of range" $B%(%i!<$N=$@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
50 ;;; $BEPO?$7$?F0;l$N:o=|$,$G$-$k$h$&$K(B sj3-server-dict-info $B$N=$@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
51 ;;; sj3serv $B$KEO$9%W%m%0%i%`L>$NJQ99(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
52
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
53 ;;; Jun-2-92 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
54 ;;; Mule $BMQ$KJQ99(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
55
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
56 ;;; Dec-12-91 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
57 ;;; $BJ8@a3X=,$,$&$^$/$G$-$J$$$3$H$,$"$k$?$a!"(Bsj3-result-buffer $B$rJQ99(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
58 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
59 ;;; sj3-get-stdy $B$G(B "Count exceed." $B%(%i!<$rNI$/5/$3$9$N$G:o=|(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
60
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
61 ;;; Nov-26-91 by K.Ishii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
62 ;;; sj3-server-open $B$G(B host_name $B$H(B user_name $B$rEO$9=gHV$N=$@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
63 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
64 ;;; sj3-server-henkan-next $B$r<B9T$7$F$h$/5/$3$k(B "Count exceed." $B$H$$$&(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
65 ;;; $B%P%0$N=$@5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
66 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
67 ;;; sj3-server-henkan-next $B$G0l3gJQ49$HJ8@aJQ49$GBh0l8uJd$,0c$C$?>l9g(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
68 ;;; $B$K5/$3$k%P%0$N=$@5(B($B$3$l$KH<$$J8@a3X=,(B sj3-server-b-study $B$N=$@5(B)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
69
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
70 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
71 ;;; Sj3 deamon command constants
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
72 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
73
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
74 (defconst SJ3_OPEN 1 "$BMxMQ<TEPO?(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
75 (defconst SJ3_CLOSE 2 "$BMxMQ<T:o=|(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
76 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
77 (defconst SJ3_DICADD 11 "$B<-=qDI2C(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
78 (defconst SJ3_DICDEL 12 "$B<-=q:o=|(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
79 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
80 (defconst SJ3_OPENSTDY 21 "$B3X=,%U%!%$%k%*!<%W%s(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
81 (defconst SJ3_CLOSESTDY 22 "$B3X=,%U%!%$%k%/%m!<%:(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
82 (defconst SJ3_STDYSIZE 23 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
83 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
84 (defconst SJ3_LOCK 31 "$B<-=q%m%C%/(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
85 (defconst SJ3_UNLOCK 32 "$B<-=q%"%s%m%C%/(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
86 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
87 (defconst SJ3_BEGIN 41 "$BJQ493+;O(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
88 (defconst SJ3_BEGIN_EUC 111 "$BJQ493+;O(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
89 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
90 (defconst SJ3_TANCONV 51 "$B:FJQ49!JJ8@a?-=L!K(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
91 (defconst SJ3_TANCONV_EUC 112 "$B:FJQ49!JJ8@a?-=L!K(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
92 (defconst SJ3_KOUHO 54 "$B8uJd(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
93 (defconst SJ3_KOUHO_EUC 115 "$B8uJd(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
94 (defconst SJ3_KOUHOSU 55 "$B8uJd?t(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
95 (defconst SJ3_KOUHOSU_EUC 116 "$B8uJd?t(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
96 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
97 (defconst SJ3_STDY 61 "$BJ8@a3X=,(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
98 (defconst SJ3_END 62 "$BJ8@aD93X=,(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
99 (defconst SJ3_END_EUC 117 "$BJ8@aD93X=,(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
100 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
101 (defconst SJ3_WREG 71 "$BC18lEPO?(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
102 (defconst SJ3_WREG_EUC 118 "$BC18lEPO?(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
103 (defconst SJ3_WDEL 72 "$BC18l:o=|(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
104 (defconst SJ3_WDEL_EUC 119 "$BC18l:o=|(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
105 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
106 (defconst SJ3_MKDIC 81 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
107 (defconst SJ3_MKSTDY 82 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
108 (defconst SJ3_MKDIR 83 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
109 (defconst SJ3_ACCESS 84 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
110 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
111 (defconst SJ3_WSCH 91 "$BC18l8!:w(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
112 (defconst SJ3_WSCH_EUC 120 "$BC18l8!:w(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
113 (defconst SJ3_WNSCH 92 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
114 (defconst SJ3_WNSCH_EUC 121 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
115 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
116 (defconst SJ3_VERSION 103 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
117
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
118 ;;; Sj3 server version error
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
119 (defconst SJ3_DifferentVersion 11 "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
120 (defvar *sj3-current-server-version* nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
121
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
122 (defvar sj3-server-buffer nil "Buffer associated with Sj3 server process.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
123
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
124 (defvar sj3-server-process nil "Sj3 Kana Kanji hankan process.")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
125
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
126 (defvar sj3-command-tail-position nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
127 (defvar sj3-command-buffer nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
128
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
129 (defvar sj3-result-buffer nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
130 (defvar sj3-henkan-string nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
131 (defvar sj3-bunsetu-suu nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
132
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
133 (defvar sj3-return-code nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
134 (defvar sj3-error-code nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
135
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
136 (defvar sj3-stdy-size nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
137 (defvar sj3-user-dict-list nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
138 (defvar sj3-sys-dict-list nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
139 (defvar sj3-yomi-llist nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
140 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
141 ;;; Put data into buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
142 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
143
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
144 (defun sj3-put-4byte (integer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
145 (insert (logand 255 (ash integer -24))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
146 (logand 255 (ash integer -16))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
147 (logand 255 (ash integer -8))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
148 (logand 255 (ash integer 0)) ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
149
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
150 (defun sj3-put-string (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
151 (insert str 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
152
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
153 (defun sj3-put-string* (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
154 (let ((sstr (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
155 (code-convert-string str *internal* *euc-japan*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
156 (code-convert-string str *internal* *sjis*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
157 (insert sstr 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
158
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
159 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
160 ;;; Get data from buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
161 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
162
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
163 (defun sj3-get-4byte ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
164
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
165 (let ((c 0) (point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
166 ;;;(goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
167 (while (< (point-max) (+ point 4))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
168 (accept-process-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
169 (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed.")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
170 (setq c (1+ c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
171 (goto-char point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
172
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
173 (let ((point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
174 (if (not (or (and (= (char-after point) 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
175 (< (char-after (+ point 1)) 128))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
176 (and (= (char-after point) 255)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
177 (<= 128 (char-after (+ point 1))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
178 (error "sj3-get-4byte: integer range overflow."))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
179 (prog1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
180 (logior
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
181 (lsh (char-after point) 24)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
182 (lsh (char-after (+ point 1)) 16)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
183 (lsh (char-after (+ point 2)) 8)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
184 (lsh (char-after (+ point 3)) 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
185 (goto-char (+ (point) 4)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
186
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
187 (defun sj3-get-byte ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
188 (let ((c 0) (point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
189 (while (< (point-max) (1+ point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
190 (accept-process-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
191 (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed.")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
192 (setq c (1+ c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
193 (goto-char point)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
194 (prog1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
195 (lsh (char-after point) 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
196 (forward-char 1))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
197
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
198 (defun sj3-get-string ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
199 (let ((point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
200 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
201 (let ((c 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
202 (while (eobp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
203 (accept-process-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
204 (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
205 (setq c (1+ c))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
206 (skip-chars-forward "^\0")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
207 (prog1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
208 (buffer-substring point (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
209 (forward-char 1))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
210
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
211 (defun sj3-get-string* ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
212 (let ((point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
213 (sj3-get-convert-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
214 (buffer-substring point (1- (point)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
215
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
216 (defun sj3-get-convert-string ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
217 (let ((point (point)) (c 0) str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
218 (while (not (search-forward "\0" nil t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
219 (accept-process-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
220 (goto-char point)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
221 (if (= c 10) (if t (progn (sit-for 0) (setq c 0)) (error "Count exceed")))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
222 (setq c (1+ c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
223 (setq str (buffer-substring point (1- (point))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
224 (delete-region point (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
225 (insert (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
226 (code-convert-string str *euc-japan* *internal*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
227 (code-convert-string str *sjis* *internal*)) 0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
228
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
229 (defun sj3-get-stdy ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
230 (let ((c 0) (point (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
231 (while (< (point-max) (+ point sj3-stdy-size))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
232 (accept-process-output)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
233 (if (>= c 10) (progn (sit-for 0) (setq c 0))) ;;; delete error
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
234 (setq c (1+ c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
235 (goto-char (+ point sj3-stdy-size))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
236
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
237 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
238 ;;; Sj3 Server Command Primitives
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
239 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
240
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
241 (defun sj3-command-start (command)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
242 (set-buffer sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
243 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
244 (if (not (= (point-max) (+ sj3-command-tail-position 1024)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
245 (error "sj3 command start error"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
246 (delete-region (point-min) sj3-command-tail-position)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
247 (sj3-put-4byte command))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
248
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
249 (defun sj3-command-reset ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
250 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
251 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
252 ;;; for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
253 (if (fboundp 'set-process-coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
254 (set-process-coding-system sj3-server-process *noconv* *noconv*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
255 ;;; for Nemacs 3.0 and later
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
256 ;; (if (fboundp 'set-process-kanji-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
257 ;; (set-process-kanji-code sj3-server-process 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
258 (set-buffer sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
259 (setq mc-flag nil) ;;; for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
260 ;; (setq kanji-flag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
261 ;; (setq kanji-fileio-code 0) ;;; for Nemacs 2.1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
262 (buffer-disable-undo sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
263 (erase-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
264 (setq sj3-command-tail-position (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
265 (let ((max 1024) (i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
266 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
267 (insert 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
268 (setq i (1+ i)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
269
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
270 (defun sj3-command-end ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
271 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
272 (erase-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
273 (set-buffer sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
274 (setq sj3-command-tail-position (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
275 ;; (process-send-region sj3-server-process (point-min)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
276 ;; (+ (point-min) (lsh (1+ (lsh (- (point) (point-min)) -10)) 10)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
277 (process-send-region sj3-server-process (point-min) (1+ (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
278 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
279
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
280 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
281 ;;; Sj3 Server Reply primitives
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
282 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
283
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
284 (defun sj3-get-result ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
285 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
286 (condition-case ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
287 (accept-process-output sj3-server-process)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
288 (error nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
289 (goto-char (point-min)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
290
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
291 (defun sj3-get-return-code ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
292 (setq sj3-return-code (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
293 (setq sj3-error-code (if (= sj3-return-code 0) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
294 (sj3-error-symbol sj3-return-code)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
295 (if sj3-error-code nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
296 sj3-return-code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
297
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
298 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
299 ;;; Sj3 Server Interface: sj3-server-open
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
300 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
301
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
302 ;(defvar *sj3-server-max-kana-string-length* 1000)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
303 ;(defvar *sj3-server-max-bunsetu-suu* 1000)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
304
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
305 (defvar *sj3-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
306 (setq *sj3-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
307 (defvar *sj3-program-name* "sj3-egg-m")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
308 (defvar *sj3-service-name* "sj3")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
309
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
310 (defun sj3-server-open (server-host-name login-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
311 (if (sj3-server-active-p) t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
312 (let ((server_version *sj3-server-version*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
313 (sj3serv_name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
314 (if (or (null server-host-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
315 (equal server-host-name "")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
316 (equal server-host-name "unix"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
317 (system-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
318 server-host-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
319 (user_name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
320 (if (or (null login-name) (equal login-name ""))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
321 (user-login-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
322 login-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
323 (host_name (system-name))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
324 (program_name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
325 (format "%d.%s"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
326 (string-to-int (substring (make-temp-name "") 1 6))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
327 *sj3-program-name*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
328 (setq sj3-server-process
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
329 (condition-case var
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
330 (open-network-stream "Sj3" " [Sj3 Output Buffer] "
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
331 sj3serv_name *sj3-service-name* )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
332 (error
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
333 (cond((string-match "Unknown host" (car (cdr var)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
334 (setq sj3-error-code (list ':SJ3_UNKNOWN_HOST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
335 sj3serv_name)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
336 ((string-match "Unknown service" (car (cdr var)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
337 (setq sj3-error-code (list ':SJ3_UNKNOWN_SERVICE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
338 *sj3-service-name*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
339 (t ;;; "Host ... not respoding"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
340 (setq sj3-error-code ':SJ3_SOCK_OPEN_FAIL)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
341 nil)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
342 (if (null sj3-server-process) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
343 (process-kill-without-query sj3-server-process)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
344 (setq sj3-server-buffer (get-buffer " [Sj3 Output Buffer] "))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
345 (setq sj3-command-buffer (get-buffer-create " [Sj3 Command Buffer] "))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
346 (setq sj3-result-buffer (get-buffer-create " [Sj3 Result Buffer] "))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
347
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
348 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
349 ;;; for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
350 (if (fboundp 'set-process-coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
351 (set-process-coding-system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
352 sj3-server-process *noconv* *noconv*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
353 ;;; for Nemacs 3.0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
354 ;; (if (fboundp 'set-process-kanji-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
355 ;; (set-process-kanji-code sj3-server-process 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
356 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
357 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
358 (setq mc-flag nil) ;;; for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
359 ;; (setq kanji-flag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
360 ;;; for Nemacs 2.1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
361 ;; (setq kanji-fileio-code 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
362 (buffer-disable-undo sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
363 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
364 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
365 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
366 (setq mc-flag nil) ;;; for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
367 ;; (setq kanji-flag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
368 ;;; for Nemacs 2.1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
369 ;; (setq kanji-fileio-code 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
370 (buffer-disable-undo sj3-result-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
371 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
372 (set-buffer sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
373 (setq mc-flag nil) ;;; for Mule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
374 ;; (setq kanji-flag nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
375 ;;; for Nemacs 2.1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
376 ;; (setq kanji-fileio-code 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
377 (buffer-disable-undo sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
378 (erase-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
379 (setq sj3-command-tail-position (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
380 (let ((max 1024) (i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
381 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
382 (insert 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
383 (setq i (1+ i)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
384 (sj3-clear-dict-list)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
385 (sj3-command-start SJ3_OPEN)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
386 (sj3-put-4byte server_version)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
387 (sj3-put-string host_name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
388 (sj3-put-string user_name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
389 (sj3-put-string program_name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
390 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
391 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
392 (sj3-get-return-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
393 (if (= sj3-return-code SJ3_DifferentVersion)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
394 (progn (sj3-command-start SJ3_OPEN)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
395 (sj3-put-4byte 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
396 (sj3-put-string host_name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
397 (sj3-put-string user_name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
398 (sj3-put-string program_name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
399 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
400 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
401 (sj3-get-return-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
402 (if (not (= sj3-return-code 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
403 (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
404 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
405 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
406 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
407 (if (or (= sj3-return-code 0) (> -1 sj3-return-code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
408 (progn (setq *sj3-current-server-version* 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
409 (if (not (= sj3-return-code 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
410 (setq *sj3-current-server-version* (- 0 sj3-return-code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
411 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
412 (sj3-get-stdy-size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
413 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
414 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
415 )))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
416
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
417 (defun sj3-server-active-p ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
418 (and sj3-server-process
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
419 (eq (process-status sj3-server-process) 'open)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
420
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
421 (defun sj3-connection-error ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
422 (setq sj3-error-code ':sj3-no-connection)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
423 (setq sj3-return-code -1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
424 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
425
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
426 (defun sj3-zero-arg-command (op)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
427 (if (sj3-server-active-p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
428 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
429 (sj3-command-start op)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
430 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
431 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
432 (sj3-get-return-code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
433 (sj3-connection-error)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
434
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
435 (defun sj3-server-close ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
436 (let (dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
437 (while (and (sj3-server-active-p) (setq dict-no (car sj3-sys-dict-list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
438 (sj3-server-close-dict dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
439 (setq sj3-sys-dict-list (cdr sj3-sys-dict-list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
440 (while (and (sj3-server-active-p) (setq dict-no (car sj3-user-dict-list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
441 (sj3-server-close-dict dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
442 (setq sj3-user-dict-list (cdr sj3-user-dict-list)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
443 (sj3-clear-dict-list))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
444 (sj3-server-close-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
445 (sj3-zero-arg-command SJ3_CLOSE)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
446 (if (sj3-server-active-p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
447 (delete-process sj3-server-process))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
448 (if sj3-server-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
449 (kill-buffer sj3-server-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
450 (if sj3-command-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
451 (kill-buffer sj3-command-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
452 (if sj3-result-buffer
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
453 (kill-buffer sj3-result-buffer))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
454 (setq sj3-server-process nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
455 (setq sj3-server-buffer nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
456 (setq sj3-command-buffer nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
457 (setq sj3-result-buffer nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
458
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
459 (defun sj3-clear-dict-list ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
460 (setq sj3-sys-dict-list nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
461 (setq sj3-user-dict-list nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
462
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
463 (or (fboundp 'si:kill-emacs)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
464 (fset 'si:kill-emacs (symbol-function 'kill-emacs)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
465
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
466 (defun kill-emacs (&optional arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
467 (interactive "P")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
468 (if (sj3-server-active-p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
469 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
470 (sj3-server-close)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
471 (si:kill-emacs arg))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
472
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
473 (defun sj3-get-stdy-size ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
474 (sj3-zero-arg-command SJ3_STDYSIZE)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
475 (if (not (= sj3-return-code 0)) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
476 (setq sj3-stdy-size (sj3-get-4byte))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
477
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
478 (defun sj3-put-stdy-dmy ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
479 (let ((i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
480 (while (< i sj3-stdy-size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
481 (insert 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
482 (setq i (1+ i)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
483
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
484 ;;; Sj3 Result Buffer's layout:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
485 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
486 ;;; { length:4 kana 0 kouhoSuu:4 kouhoNo:4
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
487 ;;; {studyData kanji 0 } ...
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
488 ;;; }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
489 ;;; 0 0 0 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
490
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
491 (defun sj3-skip-length ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
492 (goto-char (+ (point) 4)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
493
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
494 (defun sj3-skip-4byte ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
495 (goto-char (+ (point) 4)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
496
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
497 (defun sj3-skip-yomi ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
498 (skip-chars-forward "^\0") (forward-char 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
499
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
500 (defun sj3-skip-stdy ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
501 (goto-char (+ (point) sj3-stdy-size)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
502
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
503 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
504 ;;; entry function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
505 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
506 (defun sj3-server-henkan-begin (henkan-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
507 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
508 (let ((inhibit-quit t) mb-str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
509 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
510 (setq sj3-henkan-string henkan-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
511 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
512 (setq mb-str (code-convert-string henkan-string *internal* *euc-japan*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
513 (setq mb-str (code-convert-string henkan-string *internal* *sjis*))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
514 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
515 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
516 (erase-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
517 (setq sj3-bunsetu-suu 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
518 (setq sj3-yomi-llist nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
519 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
520 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
521 (sj3-command-start SJ3_BEGIN_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
522 (sj3-command-start SJ3_BEGIN)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
523 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
524 (sj3-put-string mb-str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
525 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
526 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
527 (sj3-get-return-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
528 (if (not (= sj3-return-code 0)) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
529 (let ((yp 0) p0 yl offset)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
530 (sj3-get-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
531 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
532 (delete-region (point) (point-max))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
533 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
534 (insert sj3-henkan-string 0 0 0 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
535 (goto-char p0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
536 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
537 (while (> (setq yl (sj3-get-byte)) 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
538 (let ((startp (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
539 (ystr (substring mb-str yp (+ yp yl)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
540 endp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
541 (setq yp (+ yp yl))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
542 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
543 (setq yl (length (code-convert-string ystr *euc-japan* *internal*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
544 (setq yl (length (code-convert-string ystr *sjis* *internal*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
545 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
546 (sj3-get-stdy) ;;; skip study-data
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
547 (sj3-get-convert-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
548 (setq endp (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
549 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
550 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
551 (forward-char yl)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
552 (setq sj3-yomi-llist (append sj3-yomi-llist (list yl)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
553 (insert 0) ;;; yomi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
554 (sj3-put-4byte 1) ;;; kouho suu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
555 (sj3-put-4byte 0) ;;; current kouho number
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
556 (insert-buffer-substring sj3-server-buffer startp endp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
557 ;;; insert study data and kanji strings
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
558 (setq offset (- (point) p0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
559 (goto-char p0) (sj3-put-4byte offset)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
560 (goto-char (+ (point) offset))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
561 (setq sj3-return-code (1+ sj3-return-code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
562 (set-buffer sj3-server-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
563 (setq sj3-bunsetu-suu sj3-return-code)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
564 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
565 ;;; entry function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
566 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
567 (defun sj3-server-henkan-quit () t)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
568
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
569 (defun sj3-get-yomi-suu-org ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
570 (if (setq sj3-yomi-llist (cdr sj3-yomi-llist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
571 (car sj3-yomi-llist)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
572 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
573
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
574 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
575 ;;; entry function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
576 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
577 (defun sj3-server-henkan-end (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
578 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
579 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
580 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
581 (let (length ystr len kouho-no kouho-suu p0 (ylist nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
582 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
583 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
584 (let ((max (if (and (integerp bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
585 (<= 0 bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
586 (<= bunsetu-no sj3-bunsetu-suu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
587 bunsetu-no
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
588 sj3-bunsetu-suu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
589 (i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
590 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
591 (setq length (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
592 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
593 (setq ystr (sj3-get-string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
594 (setq len (1- (- (point) p0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
595 (setq kouho-suu (sj3-get-4byte)) ;;; kouho suu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
596 (setq kouho-no (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
597 (if (and (> kouho-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
598 (< kouho-no (- kouho-suu 2))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
599 (> kouho-suu 3))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
600 (sj3-server-b-study kouho-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
601 (setq ylist (cons (list len ystr kouho-suu (point)) ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
602 (goto-char (+ p0 length))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
603 (setq i (1+ i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
604 (setq ylist (nreverse ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
605 (setq i 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
606 (let ((yp 0) (op 0) (ydata (car ylist)) (ol (car sj3-yomi-llist)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
607 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
608 (let ((yl (nth 0 ydata)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
609 (setq ylist (cdr ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
610 (if (and (= yp op) (= yl ol))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
611 (let ((pp (+ yp yl)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
612 (setq yp pp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
613 (setq op pp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
614 (setq ydata (car ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
615 (setq ol (sj3-get-yomi-suu-org)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
616 (let ((str (nth 1 ydata))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
617 (ent (nth 2 ydata)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
618 (setq ydata (car ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
619 (setq yp (+ yp yl))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
620 (while (< op yp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
621 (setq op (+ op ol))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
622 (setq ol (sj3-get-yomi-suu-org)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
623 (if (or (= ent 2) (= (nth 2 ydata) 2)) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
624 (let ((sub (- op yp)) (yl1 (nth 0 ydata)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
625 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
626 (goto-char (nth 3 ydata))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
627 (sj3-server-cl-study str (nth 1 ydata))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
628 (if (and (not (= sub yl1)) (not (= sub (- yl1 ol))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
629 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
630 (setq i (1+ i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
631 (setq ylist (cdr ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
632 (setq ydata (car ylist))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
633 (if (= sub yl1) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
634 (setq op (+ op ol))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
635 (setq ol (sj3-get-yomi-suu-org))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
636 (setq i (1+ i))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
637 (if (or (null ydata) (= (nth 0 ydata) ol) (= (nth 2 ydata) 2))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
638 sj3-return-code
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
639 (goto-char (nth 3 ydata))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
640 (sj3-server-cl-study (nth 1 ydata) "")))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
641
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
642 (defun sj3-server-cl-study (str1 str2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
643 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
644 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
645 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
646 (sj3-command-start SJ3_END_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
647 (sj3-command-start SJ3_END))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
648 (sj3-put-string* str1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
649 (sj3-put-string* str2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
650 (if (string= str2 "") (sj3-put-stdy-dmy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
651 (let (p0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
652 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
653 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
654 (set-buffer sj3-command-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
655 (insert-buffer-substring sj3-result-buffer p0 (+ p0 sj3-stdy-size))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
656 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
657 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
658 (sj3-get-return-code))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
659
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
660 (defun sj3-server-b-study (no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
661 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
662 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
663 (let ((i 0) p0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
664 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
665 (while (< i no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
666 (sj3-skip-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
667 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
668 (setq i (1+ i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
669 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
670 (sj3-command-start SJ3_STDY)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
671 (insert-buffer-substring sj3-result-buffer p0 (+ p0 sj3-stdy-size))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
672 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
673 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
674 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
675
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
676 (defun sj3-result-goto-bunsetu (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
677 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
678 (let (length (i 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
679 (while (< i bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
680 (setq length (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
681 (goto-char (+ (point) length))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
682 (setq i (1+ i)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
683
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
684 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
685 ;;; entry function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
686 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
687 (defun sj3-server-henkan-kakutei (bunsetu-no jikouho-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
688 (cond((not (sj3-server-active-p)) (sj3-connection-error))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
689 ((or (< bunsetu-no 0) (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
690 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
691 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
692 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
693 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
694 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
695 (let (kouho-suu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
696 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
697 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
698 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
699 (setq kouho-suu (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
700 (if (or (< jikouho-no 0) (<= kouho-suu jikouho-no)) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
701 (delete-char 4) (sj3-put-4byte jikouho-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
702 t)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
703
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
704 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
705 ;;; entry function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
706 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
707 (defun sj3-server-henkan-next (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
708 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
709 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
710 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
711 (let (p0 p1 kouho-suu length ystr)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
712 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
713 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
714 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
715 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
716 (setq ystr (sj3-get-string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
717 (setq p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
718 (setq kouho-suu (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
719 (if (> kouho-suu 1) t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
720 (let ((ksuu (sj3-server-henkan-kouho ystr)) (startp 0) endp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
721 (if (< ksuu 0) sj3-return-code
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
722 (let (kanji)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
723 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
724 (sj3-skip-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
725 (sj3-skip-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
726 (setq kanji (sj3-get-string))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
727 (if (> ksuu 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
728 (let ((i 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
729 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
730 (sj3-get-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
731 (setq startp (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
732 (sj3-get-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
733 (let ((kkanji (sj3-get-string*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
734 (if (equal kanji kkanji)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
735 (setq startp (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
736 (setq ksuu (1+ ksuu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
737 (setq i (1+ i))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
738 (while (< i ksuu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
739 (sj3-get-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
740 (delete-char -4)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
741 (sj3-get-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
742 (sj3-get-convert-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
743 (setq i (1+ i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
744 (setq endp (point))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
745 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
746 (if (> startp 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
747 (insert-buffer-substring sj3-server-buffer startp endp))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
748 (sj3-put-kata ystr)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
749 (insert ystr 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
750 (setq length (- (point) p0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
751 (goto-char p1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
752 (delete-char 4)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
753 (if (<= ksuu 0)(sj3-put-4byte 3) ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
754 (sj3-put-4byte (+ ksuu 2))) ;;; put kouho-suu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
755 (goto-char p0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
756 (delete-char -4)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
757 (sj3-put-4byte length))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
758 t))))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
759
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
760 (defun sj3-server-henkan-kouho (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
761 (if (not (sj3-server-active-p)) -1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
762 (let ((mb-str (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
763 (code-convert-string str *internal* *euc-japan*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
764 (code-convert-string str *internal* *sjis*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
765 len kouho-suu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
766 (setq len (length mb-str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
767 (setq kouho-suu (sj3-server-henkan-kouho-suu len mb-str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
768 (if (<= kouho-suu 0) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
769 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
770 (sj3-command-start SJ3_KOUHO_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
771 (sj3-command-start SJ3_KOUHO))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
772 (sj3-put-4byte len)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
773 (sj3-put-string mb-str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
774 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
775 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
776 (sj3-get-return-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
777 (if (not (= sj3-return-code 0)) -1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
778 kouho-suu)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
779
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
780 (defun sj3-put-kata (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
781 (setq str (copy-sequence str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
782 (let ((i 0) (len (length str)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
783 (while (< i len)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
784 (if (/= (aref str i) lc-jp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
785 (setq i (1+ i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
786 (if (= (aref str (1+ i)) ?\244)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
787 (aset str (1+ i) ?\245))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
788 (setq i (+ i 3)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
789 (insert str 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
790
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
791 (defun sj3-server-henkan-kouho-suu (yomi-length yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
792 (if (not (sj3-server-active-p)) -1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
793 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
794 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
795 (sj3-command-start SJ3_KOUHOSU_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
796 (sj3-command-start SJ3_KOUHOSU))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
797 (sj3-put-4byte yomi-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
798 (sj3-put-string yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
799 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
800 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
801 (sj3-get-return-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
802 (if (not (= sj3-return-code 0)) -1
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
803 (sj3-get-4byte)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
804
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
805 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
806 ;;; entry function
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
807 ;;;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
808 (defun sj3-server-bunsetu-henkou (bunsetu-no bunsetu-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
809 (cond((not (sj3-server-active-p)) (sj3-connection-error))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
810 ((or (< bunsetu-no 0) (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
811 nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
812 (t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
813 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
814 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
815 (let (yp0 p0 p1 str len1 len2 bunsetu-suu (bno bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
816 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
817 (setq yp0 (sj3-yomi-point bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
818 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
819 (setq str (sj3-get-yomi* yp0 bunsetu-length))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
820 (setq len1 (length str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
821 (setq bunsetu-suu sj3-bunsetu-suu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
822 (let (point length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
823 (setq len2 len1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
824 (while (and (< bno sj3-bunsetu-suu) (> len2 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
825 (setq length (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
826 (setq point (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
827 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
828 (setq len2 (- len2 (- (point) point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
829 (goto-char (+ point length))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
830 (setq bno (1+ bno))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
831 (setq p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
832 (delete-region p0 p1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
833 (setq sj3-bunsetu-suu (- sj3-bunsetu-suu (- bno bunsetu-no)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
834 (if (= (sj3-put-tanconv str) 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
835 (if (not (= len2 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
836 (let ((len (- 0 len2)) (yp1 (+ yp0 len1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
837 ystr mb-str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
838 (if (or (> bno (1+ bunsetu-no)) (= bno bunsetu-suu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
839 (setq ystr (sj3-get-yomi yp1 len))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
840 (let (ll length i)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
841 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
842 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
843 (setq length (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
844 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
845 (setq ll (+ len (- (point) (+ p0 4))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
846 (setq p1 (+ p0 (+ length 4)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
847 (setq ystr (sj3-get-yomi yp1 ll))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
848 (setq mb-str (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
849 (code-convert-string ystr *internal* *euc-japan*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
850 (code-convert-string ystr *internal* *sjis*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
851 (setq i (sj3-server-henkan-kouho-suu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
852 (length mb-str) mb-str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
853 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
854 (if (= i 0) (setq ystr (sj3-get-yomi yp1 len))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
855 (delete-region p0 p1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
856 (setq sj3-bunsetu-suu (1- sj3-bunsetu-suu))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
857 (setq len ll))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
858 (goto-char p0)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
859 (sj3-put-tanconv ystr))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
860 (if (= sj3-return-code -1) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
861 sj3-bunsetu-suu)))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
862
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
863 (defun sj3-put-tanconv (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
864 (let ((point (point)) len ksuu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
865 (mb-str (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
866 (code-convert-string str *internal* *euc-japan*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
867 (code-convert-string str *internal* *sjis*))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
868 (setq len (length mb-str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
869 (setq ksuu (sj3-server-henkan-kouho-suu len mb-str))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
870 (if (>= ksuu 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
871 (let (offset)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
872 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
873 (insert str 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
874 (if (or (= ksuu 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
875 (not (sj3-server-tanconv len mb-str)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
876 (put-kata-and-hira str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
877 (let (p0 p1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
878 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
879 (sj3-put-4byte 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
880 (sj3-put-4byte 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
881 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
882 (sj3-get-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
883 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
884 (sj3-get-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
885 (sj3-get-convert-string)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
886 (setq p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
887 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
888 (insert-buffer-substring sj3-server-buffer p0 p1)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
889 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
890 (setq offset (- (point) point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
891 (goto-char point) (sj3-put-4byte offset)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
892 (goto-char (+ (point) offset))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
893 (setq sj3-bunsetu-suu (1+ sj3-bunsetu-suu))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
894 sj3-return-code))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
895
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
896 (defun sj3-server-tanconv (len str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
897 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
898 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
899 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
900 (sj3-command-start SJ3_TANCONV_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
901 (sj3-command-start SJ3_TANCONV))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
902 (sj3-put-4byte len)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
903 (sj3-put-string str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
904 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
905 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
906 (sj3-get-return-code))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
907
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
908 (defun put-kata-and-hira (str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
909 (sj3-put-4byte 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
910 (sj3-put-4byte 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
911 (sj3-put-stdy-dmy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
912 (sj3-put-kata str)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
913 (insert str 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
914
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
915 (defun sj3-get-yomi (offset length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
916 (substring sj3-henkan-string offset (+ offset length)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
917
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
918 (defun sj3-get-yomi* (offset bunsetu-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
919 (let ((i 0) (c offset))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
920 (while (< i bunsetu-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
921 (let ((ch (substring sj3-henkan-string c (1+ c))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
922 (if (string= ch "\222");;lc-jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
923 (setq c (+ 3 c))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
924 (setq c (1+ c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
925 (setq i (1+ i))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
926 (substring sj3-henkan-string offset c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
927
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
928 (defun sj3-bunsetu-suu () sj3-bunsetu-suu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
929
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
930 (defun sj3-bunsetu-kanji (bunsetu-no &optional buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
931 (let ((savebuffer (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
932 (unwind-protect
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
933 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
934 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
935 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
936 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
937 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
938 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
939 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
940 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
941
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
942 (let ((i 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
943 (rksuu (- (sj3-get-4byte) 2)) ;;; real kouho-suu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
944 (max (sj3-get-4byte))) ;;; kouho-number
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
945 (sj3-skip-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
946 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
947 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
948 (setq i (1+ i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
949 (if (< i rksuu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
950 (sj3-skip-stdy))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
951
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
952 (let ( p1 p2 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
953 (setq p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
954 (skip-chars-forward "^\0") (setq p2 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
955 (forward-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
956 (if (null buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
957 (concat (buffer-substring p1 p2))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
958 (set-buffer buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
959 (insert-buffer-substring sj3-result-buffer p1 p2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
960 nil))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
961 (set-buffer savebuffer))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
962
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
963 (defun sj3-bunsetu-kanji-length (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
964 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
965 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
966 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
967 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
968 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
969 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
970 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
971 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
972
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
973 (let ((i 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
974 (rksuu (- (sj3-get-4byte) 2)) ;;; real kouho-suu
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
975 (max (sj3-get-4byte))) ;;; kouho-number
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
976 (sj3-skip-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
977 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
978 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
979 (setq i (1+ i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
980 (if (< i rksuu)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
981 (sj3-skip-stdy))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
982
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
983 (let ( p1 p3 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
984 (setq p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
985 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
986 (setq p3 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
987 (- p3 p1)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
988
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
989 (defun sj3-bunsetu-yomi-moji-suu (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
990 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
991 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
992 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
993 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
994 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
995 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
996 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
997 (let ((c 0) ch)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
998 (while (not (zerop (setq ch (following-char))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
999 (if (= ch lc-jp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1000 (forward-char 3)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1001 (forward-char 1))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1002 (setq c (1+ c)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1003 c))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1004
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1005 (defun sj3-yomi-point (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1006 (let ((i 0) (len 0) point length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1007 (goto-char (point-min))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1008 (while (< i bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1009 (setq length (sj3-get-4byte))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1010 (setq point (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1011 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1012 (setq len (+ len (- (point) point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1013 (goto-char (+ point length))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1014 (setq i (1+ i)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1015 len))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1016
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1017 (defun sj3-bunsetu-yomi (bunsetu-no &optional buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1018 (let ((savebuff (current-buffer)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1019 (unwind-protect
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1020 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1021 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1022 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1023 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1024 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1025 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1026 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1027 (let (p1 p2 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1028 (setq p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1029 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1030 (if (null buffer ) (buffer-substring p1 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1031 (setq p2 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1032 (set-buffer buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1033 (insert-buffer-substring sj3-result-buffer p1 p2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1034 t))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1035 (set-buffer savebuff))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1036
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1037 (defun sj3-bunsetu-yomi-equal (bunsetu-no yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1038 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1039 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1040 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1041 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1042 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1043 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1044 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1045 (looking-at (regexp-quote yomi))))) ;93.4.6 by T.Saneto
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1046
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1047 (defun sj3-bunsetu-kouho-suu (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1048 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1049 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1050 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1051 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1052 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1053 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1054 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1055 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1056 (sj3-get-4byte))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1057
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1058 (defun sj3-bunsetu-kouho-list (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1059 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1060 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1061 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1062 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1063 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1064 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1065 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1066 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1067 (let ((max (sj3-get-4byte)) (i 0) (result nil) p0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1068 (sj3-skip-4byte) ;;; current kouhou number
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1069 (sj3-skip-stdy)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1070 (while (< i max)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1071 (setq p0 (point))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1072 (skip-chars-forward "^\0")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1073 (setq result
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1074 (cons (concat (buffer-substring p0 (point)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1075 result))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1076 (forward-char 1)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1077 (setq i (1+ i))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1078 (if (< i (- max 2))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1079 (sj3-skip-stdy)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1080 (nreverse result)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1081
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1082 (defun sj3-bunsetu-kouho-number (bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1083 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1084 (set-buffer sj3-result-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1085 (if (or (< bunsetu-no 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1086 (<= sj3-bunsetu-suu bunsetu-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1087 nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1088 (sj3-result-goto-bunsetu bunsetu-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1089 (sj3-skip-length)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1090 (sj3-skip-yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1091 (sj3-skip-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1092 (sj3-get-4byte)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1093 )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1094
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1095 (defun sj3-simple-command (op arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1096 (if (sj3-server-active-p)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1097 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1098 (progn
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1099 (sj3-command-start op)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1100 (sj3-put-4byte arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1101 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1102 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1103 (sj3-get-return-code)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1104 (sj3-connection-error)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1105
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1106 (defun sj3-server-open-dict (dict-file-name password)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1107 (if (not (sj3-server-active-p))(sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1108 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1109 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1110 (sj3-command-start SJ3_DICADD)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1111 (sj3-put-string dict-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1112 (if (stringp password)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1113 (sj3-put-string password)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1114 (sj3-put-string 0))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1115 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1116 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1117 (sj3-get-return-code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1118 (if (not (= sj3-return-code 0)) nil
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1119 (let ((dict-no (sj3-get-4byte)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1120 (if (stringp password)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1121 (setq sj3-user-dict-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1122 (append sj3-user-dict-list (list dict-no)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1123 (setq sj3-sys-dict-list
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1124 (append sj3-sys-dict-list (list dict-no))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1125 dict-no))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1126
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1127 (defun sj3-server-close-dict (dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1128 (if (not (sj3-server-active-p))(sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1129 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1130 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1131 (sj3-command-start SJ3_DICDEL)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1132 (sj3-put-4byte dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1133 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1134 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1135 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1136
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1137 (defun sj3-server-make-dict (dict-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1138 (if (not (sj3-server-active-p))(sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1139 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1140 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1141 (sj3-command-start SJ3_MKDIC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1142 (sj3-put-string dict-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1143 (sj3-put-4byte 2048) ;;; Index length
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1144 (sj3-put-4byte 2048) ;;; Length
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1145 (sj3-put-4byte 256) ;;; Number
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1146 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1147 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1148 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1149
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1150 (defun sj3-server-open-stdy (stdy-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1151 (if (not (sj3-server-active-p))(sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1152 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1153 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1154 (sj3-command-start SJ3_OPENSTDY)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1155 (sj3-put-string stdy-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1156 (sj3-put-string 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1157 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1158 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1159 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1160
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1161 (defun sj3-server-close-stdy ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1162 (sj3-zero-arg-command SJ3_CLOSESTDY))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1163
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1164 (defun sj3-server-make-stdy (stdy-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1165 (if (not (sj3-server-active-p))(sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1166 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1167 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1168 (sj3-command-start SJ3_MKSTDY)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1169 (sj3-put-string stdy-file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1170 (sj3-put-4byte 2048) ;;; Number
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1171 (sj3-put-4byte 1) ;;; Step
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1172 (sj3-put-4byte 2048) ;;; Length
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1173 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1174 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1175 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1176
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1177 (defun sj3-server-dict-add (dictno kanji yomi bunpo)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1178 (if (not (sj3-server-active-p))(sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1179 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1180 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1181 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1182 (sj3-command-start SJ3_WREG_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1183 (sj3-command-start SJ3_WREG))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1184 (sj3-put-4byte dictno)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1185 (sj3-put-string* yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1186 (sj3-put-string* kanji)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1187 (sj3-put-4byte bunpo)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1188 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1189 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1190 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1191
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1192 (defun sj3-server-dict-delete (dictno kanji yomi bunpo)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1193 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1194 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1195 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1196 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1197 (sj3-command-start SJ3_WDEL_EUC)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1198 (sj3-command-start SJ3_WDEL))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1199 (sj3-put-4byte dictno)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1200 (sj3-put-string* yomi)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1201 (sj3-put-string* kanji)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1202 (sj3-put-4byte bunpo)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1203 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1204 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1205 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1206
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1207 (defun sj3-server-dict-info (dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1208 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1209 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1210 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1211 (let ((result nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1212 (set-buffer sj3-server-buffer)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1213 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1214 (sj3-simple-command SJ3_WSCH_EUC dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1215 (sj3-simple-command SJ3_WSCH dict-no))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1216 (while (= sj3-return-code 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1217 ;;; (sj3-get-4byte)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1218 (setq result (cons (list (sj3-get-string*)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1219 (sj3-get-string*) (sj3-get-4byte)) result))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1220 (if (= *sj3-current-server-version* 2)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1221 (sj3-simple-command SJ3_WNSCH_EUC dict-no)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1222 (sj3-simple-command SJ3_WNSCH dict-no)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1223 (if (= sj3-return-code 111)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1224 (setq sj3-error-code nil))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1225 (nreverse result))))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1226
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1227 (defun sj3-server-make-directory (dir-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1228 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1229 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1230 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1231 (sj3-command-start SJ3_MKDIR)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1232 (sj3-put-string dir-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1233 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1234 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1235 (sj3-get-return-code)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1236
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1237 (defun sj3-server-file-access (file-name access-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1238 (if (not (sj3-server-active-p)) (sj3-connection-error)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1239 (let ((inhibit-quit t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1240 (save-excursion
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1241 (sj3-command-start SJ3_ACCESS)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1242 (sj3-put-string file-name)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1243 (sj3-put-4byte access-mode)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1244 (sj3-command-end)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1245 (sj3-get-result)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1246 (setq sj3-error-code nil)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1247 (sj3-get-4byte)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1248
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1249 (defun sj3_lock ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1250 (sj3-zero-arg-command SJ3_LOCK))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1251
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1252 (defun sj3_unlock ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1253 (sj3-zero-arg-command SJ3_UNLOCK))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1254
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1255 (defun sj3_version ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1256 (sj3-zero-arg-command SJ3_VERSION))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1257
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1258 (defconst *sj3-error-alist*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1259 '(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1260 (1 :SJ3_SERVER_DEAD
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1261 "$B%5!<%P$,;`$s$G$$$^$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1262 (2 :SJ3_SOCK_OPEN_FAIL
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1263 "socket$B$N(Bopen$B$K<:GT$7$^$7$?!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1264 (6 :SJ3_ALLOC_FAIL
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1265 "$B%a%b%j(Balloc$B$G<:GT$7$^$7$?!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1266 (7 :SJ3_ILLEGAL_COMMAND
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1267 "$B%3%^%s%I$,4V0c$C$F$$$k(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1268 (12 :SJ3_BAD_HOST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1269 " $B%[%9%HL>$,$J$$(B ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1270 (13 :SJ3_BAD_USER
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1271 " $B%f!<%6L>$,$J$$(B ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1272 (31 :SJ3_NOT_A_DICT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1273 "$B@5$7$$<-=q$G$O$"$j$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1274 (35 :SJ3_NO_EXIST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1275 "$B%U%!%$%k$,B8:_$7$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1276 (37 :SJ3_OPENF_ERR
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1277 "$B%U%!%$%k$,%*!<%W%s$G$-$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1278 (39 :SJ3_PARAMR
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1279 "$B%U%!%$%k$NFI$_9~$_8"8B$,$"$j$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1280 (40 :SJ3_PARAMW
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1281 "$B%U%!%$%k$N=q$-9~$_8"8B$,$"$j$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1282 (71 :SJ3_NOT_A_USERDICT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1283 "$B;XDj$5$l$F<-=q$O!"%f!<%6!<<-=q$G$O$"$j$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1284 (72 :SJ3_RDONLY
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1285 "$B%j!<%I%*%s%j!<$N<-=q$KEPO?$7$h$&$H$7$^$7$?!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1286 (74 :SJ3_BAD_YOMI
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1287 "$BFI$_$KITE,Ev$JJ8;z$,4^$^$l$F$$$^$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1288 (75 :SJ3_BAD_KANJI
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1289 "$B4A;z$KITE,Ev$JJ8;z$,4^$^$l$F$$$^$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1290 (76 :SJ3_BAD_HINSHI
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1291 "$B;XDj$5$l$?IJ;lHV9f$,$"$j$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1292 (82 :SJ3_WORD_ALREADY_EXIST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1293 "$B;XDj$5$l$?C18l$O$9$G$KB8:_$7$F$$$^$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1294 (84 :SJ3_JISHOTABLE_FULL
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1295 "$B<-=q%F!<%V%k$,0lGU$G$9!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1296 (92 :SJ3_WORD_NO_EXIST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1297 "$B;XDj$5$l$?C18l$,B8:_$7$^$;$s!#(B")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1298 (102 :SJ3_MKDIR_FAIL
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1299 " $B%G%#%l%/%H%j$r:n$jB;$J$C$?(B ")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1300 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1301
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1302 (defun sj3-error-symbol (code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1303 (let ((pair (assoc code *sj3-error-alist*)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1304 (if (null pair)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1305 (list ':sj3-unknown-error-code code)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1306 (car (cdr pair)))))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1307