3 (defun decode-url-string (string &optional coding-system)
4 (if (> (length string) 0)
7 (while (string-match "%\\([0-9A-F][0-9A-F]\\)" string i)
8 (setq dest (concat dest
9 (substring string i (match-beginning 0))
12 (string-to-int (match-string 1 string) 16))))
15 (concat dest (substring string i))
18 (defvar www-ids-find-tang-chars-file-name
19 "~tomo/projects/chise/ids/www/tang-chars.udd")
21 (defun www-ids-find-format-line (c is)
22 (let ((str (encode-coding-string (format "%c" c) 'utf-8-er))
27 ((string-match "&CB\\([0-9]+\\);" str)
28 (setq code (string-to-int (match-string 1 str)))
29 (insert "<a href=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/char-desc?char=")
31 (insert (format "\"><img alt=\"CB%05d\" src=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/glyphs/cb-gaiji/%02d/CB%05d.gif\">\n"
32 code (/ code 1000) code))
33 (insert (format "CB%05d</a>" code))
35 ((string-match "&JC3-\\([0-9A-F]+\\);" str)
36 (setq code (string-to-int (match-string 1 str) 16))
37 (insert "<a href=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/char-desc?char=")
39 (insert (format "\"><img alt=\"JC3-%04X\" src=\"http://kanji.zinbun.kyoto-u.ac.jp/db/CHINA3/Gaiji/%04x.gif\">\n"
41 (insert (format "JC3-%04X</a>" code))
44 (insert "<a href=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/char-desc?char=")
50 (goto-char (point-min))
51 (while (search-forward "&" nil t)
52 (replace-match "&" t 'literal))
56 (or (if (setq ucs (or (char-ucs c)
57 (encode-char c 'ucs)))
58 (format " <a href=\"http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%X\">%s</a>"
60 (cond ((<= ucs #xFFFF)
61 (format "U+%04X" ucs))
63 (format "U-%08X" ucs))))
71 (ideographic-structure-to-ids is)
73 (goto-char (point-min))
74 (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
75 (setq code (string-to-int (match-string 1)))
77 (format "<img alt=\"CB%05d\" src=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/glyphs/cb-gaiji/%02d/CB%05d.gif\">"
78 code (/ code 1000) code)
84 www-ids-find-tang-chars-file-name)
85 (goto-char (point-min))
86 (re-search-forward (format "^%d$" ucs) nil t)))
88 (format " <a href=\"http://coe21.zinbun.kyoto-u.ac.jp/djvuchar?query=%s\">"
91 (format "%%%02X" (char-int c)))
92 (encode-coding-string (char-to-string c)
95 (princ (encode-coding-string "
\e$B"M
\e(B[
\e$BEbBeBsK\
\e(B]</a>" 'utf-8-jp-er)))
98 (defun www-batch-ids-find ()
99 (let ((components (car command-line-args-left))
100 (coded-charset-entity-reference-alist
103 '(=jef-china3 "JC3-" 4 X)
104 coded-charset-entity-reference-alist))
106 (setq command-line-args-left (cdr command-line-args-left))
108 ((stringp components)
109 (if (string-match "^components=" components)
110 (setq components (substring components (match-end 0))))
112 (if (> (length components) 0)
113 (decode-url-string components 'utf-8-jp-er)
117 (setq components nil)
119 (princ "Content-Type: text/html; charset=\"UTF-8\"
121 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
122 \"http://www.w3.org/TR/html4/loose.dtd\">
125 <title>CHISE IDS Find</title>
131 (princ (encode-coding-string "CHISE IDS
\e$B4A;z8!:w
\e(B" 'utf-8-jp-er))
134 <form action=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/ids-find\" method=\"GET\">
136 (princ (encode-coding-string "
\e$BItIJJ8;zNs
\e(B" 'utf-8-jp-er))
137 (princ " <input type=\"text\" name=\"components\" size=\"30\" maxlength=\"30\" value=\"")
138 (if (> (length components) 0)
139 (princ (encode-coding-string components 'utf-8-jp-er)))
141 <input type=\"submit\" value=\"")
142 (princ (encode-coding-string "
\e$B8!:w3+;O
\e(B" 'utf-8-jp-er))
149 ;; (map-char-attribute
151 ;; (when (every (lambda (p)
152 ;; (ideographic-structure-member p v))
154 ;; (princ (encode-coding-string
155 ;; (ids-find-format-line c v)
160 ;; 'ideographic-structure)
161 (when (= (length components) 1)
162 (www-ids-find-format-line (aref components 0)
163 (char-feature (aref components 0)
164 'ideographic-structure)))
165 (dolist (c (ideographic-products-find components))
166 (setq is (char-feature c 'ideographic-structure))
167 ;; to avoid problems caused by wrong indexes
168 (when (every (lambda (c)
169 (ideographic-structure-member c is))
171 (www-ids-find-format-line c is)))
174 (princ (encode-coding-string "<hr>
176 \e$B;XDj$7$?ItIJ$rA4$F4^$`4A;z$N0lMw$rI=<($7$^$9!#
\e(B
178 CHISE
\e$B$GMQ$$$i$l$k<BBV;2>H7A<0!JNc!'
\e(B&M-00256;
\e$B!K$GItIJ$r;XDj$9$k;v$b$G$-$^$9!#
\e(B" 'utf-8-jp-er))
184 href=\"http://kanji.zinbun.kyoto-u.ac.jp/projects/chise/xemacs/\"
185 >XEmacs CHISE</a> %s."
186 xemacs-chise-version))