Mercurial > hg > xemacs-beta
annotate lisp/mule/viet-util.el @ 5887:6eca500211f4
Prototype for X509_check_host() has changed, detect this in configure.ac
ChangeLog addition:
2015-04-09 Aidan Kehoe <kehoea@parhasard.net>
* configure.ac:
If X509_check_host() is available, check the number of arguments
it takes. Don't use it if it takes any number of arguments other
than five. Also don't use it if <openssl/x509v3.h> does not
declare it, since if that is so there is no portable way to tell
how many arguments it should take, and so we would end up smashing
the stack.
* configure: Regenerate.
src/ChangeLog addition:
2015-04-09 Aidan Kehoe <kehoea@parhasard.net>
* tls.c:
#include <openssl/x509v3.h> for its prototype for
X509_check_host().
* tls.c (tls_open):
Pass the new fifth argument to X509_check_host().
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 09 Apr 2015 14:27:02 +0100 |
parents | ac37a5f7e5be |
children |
rev | line source |
---|---|
778 | 1 ;;; viet-util.el --- utilities for Vietnamese -*- coding: iso-2022-7bit; -*- |
771 | 2 |
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | |
788 | 4 ;; Copyright (C) 2002 Ben Wing. |
771 | 5 ;; Licensed to the Free Software Foundation. |
6 | |
7 ;; Keywords: mule, multilingual, Vietnamese | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
11 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
12 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
13 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
14 ;; option) any later version. |
771 | 15 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
19 ;; for more details. |
771 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4072
diff
changeset
|
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
771 | 23 |
778 | 24 ;;; Synched up with: Emacs 21.1 (language/viet-util.el). |
771 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;; Vietnamese uses ASCII characters and additional 134 unique | |
29 ;; characters (these are Latin alphabets with various diacritical and | |
30 ;; tone marks). As far as I know, Vietnamese now has 4 different ways | |
31 ;; for representing these characters: VISCII, VSCII, VIQR, and | |
32 ;; Unicode. VISCII and VSCII are simple 1-byte code which assigns 134 | |
33 ;; unique characters in control-code area (0x00..0x1F) and right half | |
34 ;; area (0x80..0xFF). VIQR is a menmonic encoding specification | |
35 ;; representing diacritical marks by following ASCII characters. | |
36 | |
37 ;;; Code: | |
38 | |
39 ;;;###autoload | |
40 (defun viet-encode-viscii-char (char) | |
41 "Return VISCII character code of CHAR if appropriate." | |
4072 | 42 (check-argument-type #'characterp char) |
43 (if (eq char ?~) | |
44 char | |
45 (setq char (encode-coding-string char 'viscii)) | |
5366
f00192e1cd49
Examining the result of #'length: `eql', not `=', it's better style & cheaper
Aidan Kehoe <kehoea@parhasard.net>
parents:
4072
diff
changeset
|
46 (if (and (eql 1 (length char)) |
f00192e1cd49
Examining the result of #'length: `eql', not `=', it's better style & cheaper
Aidan Kehoe <kehoea@parhasard.net>
parents:
4072
diff
changeset
|
47 (not (eql (aref char 0) ?~))) |
4072 | 48 (aref char 0)))) |
771 | 49 |
50 ;; VIQR is a menmonic encoding specification for Vietnamese. | |
51 ;; It represents diacritical marks by ASCII characters as follows: | |
52 ;; ------------+----------+-------- | |
53 ;; mark | mnemonic | example | |
54 ;; ------------+----------+--------- | |
55 ;; breve | ( | a( -> ,1e(B | |
56 ;; circumflex | ^ | a^ -> ,1b(B | |
57 ;; horn | + | o+ -> ,1=(B | |
58 ;; ------------+----------+--------- | |
59 ;; acute | ' | a' -> ,1a(B | |
60 ;; grave | ` | a` -> ,1`(B | |
61 ;; hook above | ? | a? -> ,1d(B | |
62 ;; tilde | ~ | a~ -> ,1c(B | |
63 ;; dot below | . | a. -> ,1U(B | |
64 ;; ------------+----------+--------- | |
65 ;; d bar | dd | dd -> ,1p(B | |
66 ;; ------------+----------+--------- | |
67 | |
68 (defvar viet-viqr-alist | |
69 '(;; lowercase | |
70 (?,1!(B . "a('") ; 161 | |
71 (?,1"(B . "a(`") ; 162 | |
72 (?,1#(B . "a(.") ; 163 | |
73 (?,1$(B . "a^'") ; 164 | |
74 (?,1%(B . "a^`") ; 165 | |
75 (?,1&(B . "a^?") ; 166 | |
76 (?,1'(B . "a^.") ; 167 | |
77 (?,1((B . "e~") ; 168 | |
78 (?,1)(B . "e.") ; 169 | |
79 (?,1*(B . "e^'") ; 170 | |
80 (?,1+(B . "e^`") ; 171 | |
81 (?,1,(B . "e^?") ; 172 | |
82 (?,1-(B . "e^~") ; 173 | |
83 (?,1.(B . "e^.") ; 174 | |
84 (?,1/(B . "o^'") ; 175 | |
85 (?,10(B . "o^`") ; 176 | |
86 (?,11(B . "o^?") ; 177 | |
87 (?,12(B . "o^~") ; 178 | |
88 (?,15(B . "o^.") ; 181 | |
89 (?,16(B . "o+`") ; 182 | |
90 (?,17(B . "o+?") ; 183 | |
91 (?,18(B . "i.") ; 184 | |
92 (?,1=(B . "o+") ; 189 | |
93 (?,1>(B . "o+'") ; 190 | |
94 (?,1F(B . "a(?") ; 198 | |
95 (?,1G(B . "a(~") ; 199 | |
96 (?,1O(B . "y`") ; 207 | |
97 (?,1Q(B . "u+'") ; 209 | |
98 (?,1U(B . "a.") ; 213 | |
99 (?,1V(B . "y?") ; 214 | |
100 (?,1W(B . "u+`") ; 215 | |
101 (?,1X(B . "u+?") ; 216 | |
102 (?,1[(B . "y~") ; 219 | |
103 (?,1\(B . "y.") ; 220 | |
104 (?,1^(B . "o+~") ; 222 | |
105 (?,1_(B . "u+") ; 223 | |
106 (?,1`(B . "a`") ; 224 | |
107 (?,1a(B . "a'") ; 225 | |
108 (?,1b(B . "a^") ; 226 | |
109 (?,1c(B . "a~") ; 227 | |
110 (?,1d(B . "a?") ; 228 | |
111 (?,1e(B . "a(") ; 229 | |
112 (?,1f(B . "u+~") ; 230 | |
113 (?,1g(B . "a^~") ; 231 | |
114 (?,1h(B . "e`") ; 232 | |
115 (?,1i(B . "e'") ; 233 | |
116 (?,1j(B . "e^") ; 234 | |
117 (?,1k(B . "e?") ; 235 | |
118 (?,1l(B . "i`") ; 236 | |
119 (?,1m(B . "i'") ; 237 | |
120 (?,1n(B . "i~") ; 238 | |
121 (?,1o(B . "i?") ; 239 | |
122 (?,1p(B . "dd") ; 240 | |
123 (?,1q(B . "u+.") ; 241 | |
124 (?,1r(B . "o`") ; 242 | |
125 (?,1s(B . "o'") ; 243 | |
126 (?,1t(B . "o^") ; 244 | |
127 (?,1u(B . "o~") ; 245 | |
128 (?,1v(B . "o?") ; 246 | |
129 (?,1w(B . "o.") ; 247 | |
130 (?,1x(B . "u.") ; 248 | |
131 (?,1y(B . "u`") ; 249 | |
132 (?,1z(B . "u'") ; 250 | |
133 (?,1{(B . "u~") ; 251 | |
134 (?,1|(B . "u?") ; 252 | |
135 (?,1}(B . "y'") ; 253 | |
136 (?,1~(B . "o+.") ; 254 | |
137 | |
138 ;; upper case | |
139 (?,2!(B . "A('") ; 161 | |
140 (?,2"(B . "A(`") ; 162 | |
141 (?,2#(B . "A(.") ; 163 | |
142 (?,2$(B . "A^'") ; 164 | |
143 (?,2%(B . "A^`") ; 165 | |
144 (?,2&(B . "A^?") ; 166 | |
145 (?,2'(B . "A^.") ; 167 | |
146 (?,2((B . "E~") ; 168 | |
147 (?,2)(B . "E.") ; 169 | |
148 (?,2*(B . "E^'") ; 170 | |
149 (?,2+(B . "E^`") ; 171 | |
150 (?,2,(B . "E^?") ; 172 | |
151 (?,2-(B . "E^~") ; 173 | |
152 (?,2.(B . "E^.") ; 174 | |
153 (?,2/(B . "O^'") ; 175 | |
154 (?,20(B . "O^`") ; 176 | |
155 (?,21(B . "O^?") ; 177 | |
156 (?,22(B . "O^~") ; 178 | |
157 (?,25(B . "O^.") ; 181 | |
158 (?,26(B . "O+`") ; 182 | |
159 (?,27(B . "O+?") ; 183 | |
160 (?,28(B . "I.") ; 184 | |
161 (?,2=(B . "O+") ; 189 | |
162 (?,2>(B . "O+'") ; 190 | |
163 (?,2F(B . "A(?") ; 198 | |
164 (?,2G(B . "A(~") ; 199 | |
165 (?,2O(B . "Y`") ; 207 | |
166 (?,2Q(B . "U+'") ; 209 | |
167 (?,2U(B . "A.") ; 213 | |
168 (?,2V(B . "Y?") ; 214 | |
169 (?,2W(B . "U+`") ; 215 | |
170 (?,2X(B . "U+?") ; 216 | |
171 (?,2[(B . "Y~") ; 219 | |
172 (?,2\(B . "Y.") ; 220 | |
173 (?,2^(B . "O+~") ; 222 | |
174 (?,2_(B . "U+") ; 223 | |
175 (?,2`(B . "A`") ; 224 | |
176 (?,2a(B . "A'") ; 225 | |
177 (?,2b(B . "A^") ; 226 | |
178 (?,2c(B . "A~") ; 227 | |
179 (?,2d(B . "A?") ; 228 | |
180 (?,2e(B . "A(") ; 229 | |
181 (?,2f(B . "U+~") ; 230 | |
182 (?,2g(B . "A^~") ; 231 | |
183 (?,2h(B . "E`") ; 232 | |
184 (?,2i(B . "E'") ; 233 | |
185 (?,2j(B . "E^") ; 234 | |
186 (?,2k(B . "E?") ; 235 | |
187 (?,2l(B . "I`") ; 236 | |
188 (?,2m(B . "I'") ; 237 | |
189 (?,2n(B . "I~") ; 238 | |
190 (?,2o(B . "I?") ; 239 | |
191 (?,2p(B . "DD") ; 240 | |
192 (?,2p(B . "dD") ; 240 | |
193 (?,2p(B . "Dd") ; 240 | |
194 (?,2q(B . "U+.") ; 241 | |
195 (?,2r(B . "O`") ; 242 | |
196 (?,2s(B . "O'") ; 243 | |
197 (?,2t(B . "O^") ; 244 | |
198 (?,2u(B . "O~") ; 245 | |
199 (?,2v(B . "O?") ; 246 | |
200 (?,2w(B . "O.") ; 247 | |
201 (?,2x(B . "U.") ; 248 | |
202 (?,2y(B . "U`") ; 249 | |
203 (?,2z(B . "U'") ; 250 | |
204 (?,2{(B . "U~") ; 251 | |
205 (?,2|(B . "U?") ; 252 | |
206 (?,2}(B . "Y'") ; 253 | |
207 (?,2~(B . "O+.") ; 254 | |
208 | |
209 ;; escape from composition | |
210 (?\( . "\\(") ; breve (left parenthesis) | |
211 (?^ . "\\^") ; circumflex (caret) | |
212 (?+ . "\\+") ; horn (plus sign) | |
213 (?' . "\\'") ; acute (apostrophe) | |
214 (?` . "\\`") ; grave (backquote) | |
215 (?? . "\\?") ; hook above (question mark) | |
216 (?~ . "\\~") ; tilde (tilde) | |
217 (?. . "\\.") ; dot below (period) | |
218 (?d . "\\d") ; d-bar (d) | |
219 (?\\ . "\\\\") ; literal backslash | |
220 ) | |
221 "Alist of Vietnamese characters vs corresponding `VIQR' string.") | |
222 | |
223 ;; Regular expression matching single Vietnamese character represented | |
224 ;; by VIQR. | |
225 (defconst viqr-regexp | |
226 "[aeiouyAEIOUY]\\([(^+]?['`?~.]\\|[(^+]\\)\\|[Dd][Dd]") | |
227 | |
228 ;;;###autoload | |
229 (defun viet-decode-viqr-region (from to) | |
1196 | 230 "Convert `VIQR' mnemonics of the current region to Vietnamese characters. |
771 | 231 When called from a program, expects two arguments, |
232 positions (integers or markers) specifying the stretch of the region." | |
233 (interactive "r") | |
234 (save-restriction | |
235 (narrow-to-region from to) | |
236 (goto-char (point-min)) | |
237 (while (re-search-forward viqr-regexp nil t) | |
238 (let* ((viqr (buffer-substring (match-beginning 0) (match-end 0))) | |
239 (ch (car (rassoc viqr viet-viqr-alist)))) | |
240 (if ch | |
241 (progn | |
242 (delete-region (match-beginning 0) (match-end 0)) | |
243 (insert ch))))))) | |
244 | |
245 ;;;###autoload | |
246 (defun viet-decode-viqr-buffer () | |
1196 | 247 "Convert `VIQR' mnemonics of the current buffer to Vietnamese characters." |
771 | 248 (interactive) |
249 (viet-decode-viqr-region (point-min) (point-max))) | |
250 | |
251 ;;;###autoload | |
252 (defun viet-encode-viqr-region (from to) | |
1196 | 253 "Convert Vietnamese characters of the current region to `VIQR' mnemonics. |
771 | 254 When called from a program, expects two arguments, |
255 positions (integers or markers) specifying the stretch of the region." | |
256 (interactive "r") | |
257 (save-restriction | |
258 (narrow-to-region from to) | |
259 (goto-char (point-min)) | |
260 (while (re-search-forward "\\cv" nil t) | |
261 (let* ((ch (preceding-char)) | |
262 (viqr (cdr (assq ch viet-viqr-alist)))) | |
263 (if viqr | |
264 (progn | |
265 (delete-char -1) | |
266 (insert viqr))))))) | |
267 | |
268 ;;;###autoload | |
269 (defun viet-encode-viqr-buffer () | |
1196 | 270 "Convert Vietnamese characters of the current buffer to `VIQR' mnemonics." |
771 | 271 (interactive) |
272 (viet-encode-viqr-region (point-min) (point-max))) | |
273 | |
274 ;;;###autoload | |
275 (defun viqr-post-read-conversion (len) | |
276 (save-excursion | |
277 (save-restriction | |
278 (narrow-to-region (point) (+ (point) len)) | |
279 (let ((buffer-modified-p (buffer-modified-p))) | |
280 (viet-decode-viqr-region (point-min) (point-max)) | |
281 (set-buffer-modified-p buffer-modified-p) | |
282 (- (point-max) (point-min)))))) | |
283 | |
284 ;;;###autoload | |
285 (defun viqr-pre-write-conversion (from to) | |
286 (let ((old-buf (current-buffer))) | |
287 (set-buffer (generate-new-buffer " *temp*")) | |
288 (if (stringp from) | |
289 (insert from) | |
290 (insert-buffer-substring old-buf from to)) | |
291 (viet-encode-viqr-region (point-min) (point-max)) | |
292 ;; Should return nil as annotations. | |
293 nil)) | |
294 | |
295 ;;; | |
296 (provide 'viet-util) | |
297 | |
298 ;;; viet-util.el ends here |