Mercurial > emacs
annotate lisp/language/ind-util.el @ 89106:4b0c0e0d0458
(iscii-to-ucs-region): Fix typo.
author | Dave Love <fx@gnu.org> |
---|---|
date | Fri, 13 Sep 2002 23:25:53 +0000 |
parents | 4ff0e9aff188 |
children | baa9de960667 |
rev | line source |
---|---|
41470 | 1 ;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: iso-2022-7bit; -*- |
2 | |
3 ;; Copyright (C) 2001 Free Software Foundation, Inc. | |
4 | |
5 ;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp> | |
6 ;; Keywords: multilingual, Indian, Devanagari | |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; This file provides conversion between UCS and various | |
28 ;; transliteration schemes, such as ITRANS, kyoto-harvard and aiba | |
29 ;; methods. It also provides conversion between IS 13194 and UCS. | |
30 ;; Finally, this program provides the compatibility support with | |
31 ;; old implementation of Devanagari script. | |
32 | |
33 ;;; Code: | |
34 | |
35 ;;; Transliteration | |
36 | |
37 ;; The followings provide the various transliteration schemes (such as | |
38 ;; ITRANS, kyoto-harvard, and Aiba) of Indian scripts. They are also | |
39 ;; used in quail/indian.el for typing Indian script in Emacs. | |
40 | |
41 (eval-and-compile | |
42 | |
42060
f3b460667d31
(range): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
42056
diff
changeset
|
43 (defun indian-regexp-of-hashtbl-keys (hashtbl) |
41470 | 44 "Returns the regular expression of hashtable keys." |
45 (let ((max-specpdl-size 1000)) | |
46 (regexp-opt | |
89094 | 47 (sort |
41470 | 48 (let (dummy) |
42056 | 49 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) |
50 hashtbl) | |
41470 | 51 dummy) |
52 (function (lambda (x y) (> (length x) (length y)))))))) | |
53 | |
54 (defvar indian-dev-base-table | |
55 '( | |
56 (;; VOWELS (18) | |
57 (?$,15E(B nil) (?$,15F(B ?$,15~(B) (?$,15G(B ?$,15(B) (?$,15H(B ?$,16 (B) (?$,15I(B ?$,16!(B) (?$,15J(B ?$,16"(B) | |
58 (?$,15K(B ?$,16#(B) (?$,15L(B ?$,16$(B) (?$,15M(B ?$,16%(B) (?$,15N(B ?$,16&(B) (?$,15O(B ?$,16'(B) (?$,15P(B ?$,16((B) | |
59 (?$,15Q(B ?$,16)(B) (?$,15R(B ?$,16*(B) (?$,15S(B ?$,16+(B) (?$,15T(B ?$,16,(B) (?$,16@(B ?$,16B(B) (?$,16A(B ?$,16C(B)) | |
60 (;; CONSONANTS (currently 42, including special cases) | |
61 ?$,15U(B ?$,15V(B ?$,15W(B ?$,15X(B ?$,15Y(B ;; GUTTRULS | |
89094 | 62 ?$,15Z(B ?$,15[(B ?$,15\(B ?$,15](B ?$,15^(B ;; PALATALS |
63 ?$,15_(B ?$,15`(B ?$,15a(B ?$,15b(B ?$,15c(B ;; CEREBRALS | |
64 ?$,15d(B ?$,15e(B ?$,15f(B ?$,15g(B ?$,15h(B ?$,15i(B ;; DENTALS | |
65 ?$,15j(B ?$,15k(B ?$,15l(B ?$,15m(B ?$,15n(B ;; LABIALS | |
41470 | 66 ?$,15o(B ?$,15p(B ?$,15q(B ?$,15r(B ?$,15s(B ?$,15t(B ?$,15u(B ;; SEMIVOWELS |
89094 | 67 ?$,15v(B ?$,15w(B ?$,15x(B ?$,15y(B ;; SIBILANTS |
68 ?$,168(B ?$,169(B ?$,16:(B ?$,16;(B ?$,16<(B ?$,16=(B ?$,16>(B ?$,16?(B ;; NUKTAS | |
41470 | 69 "$,15\6-5^(B" "$,15U6-5w(B") |
89094 | 70 (;; Misc Symbols (7) |
41470 | 71 ?$,15A(B ?$,15B(B ?$,15C(B ?$,15}(B ?$,16-(B ?$,160(B ?$,16D(B) |
72 (;; Digits (10) | |
73 ?$,16F(B ?$,16G(B ?$,16H(B ?$,16I(B ?$,16J(B ?$,16K(B ?$,16L(B ?$,16M(B ?$,16N(B ?$,16O(B) | |
74 (;; Inscript-extra (4) (#, $, ^, *, ]) | |
75 "$,16-5p(B" "$,15p6-(B" "$,15d6-5p(B" "$,15v6-5p(B" "$,15|(B"))) | |
76 | |
77 (defvar indian-pnj-base-table nil) | |
78 (defvar indian-ori-base-table nil) | |
79 (defvar indian-bng-base-table nil) | |
80 (defvar indian-asm-base-table nil) | |
81 (defvar indian-tlg-base-table nil) | |
82 (defvar indian-knd-base-table nil) | |
83 (defvar indian-mlm-base-table nil) | |
84 (defvar indian-tml-base-table nil) | |
85 | |
86 (defvar indian-base-table-to-language-alist | |
87 '((indian-dev-base-table . "Devanagari") | |
89094 | 88 (indian-pnj-base-table . "Punjabi") |
41470 | 89 (indian-ori-base-table . "Oriya") |
90 (indian-bng-base-table . "Bengali") | |
91 (indian-asm-base-table . "Assamese") | |
92 (indian-tlg-base-table . "Telugu") | |
93 (indian-knd-base-table . "Kannada") | |
94 (indian-mlm-base-table . "Malayalam") | |
95 (indian-tml-base-table . "Tamil"))) | |
96 | |
97 (defvar indian-itrans-v5-table | |
98 '(;; for encode/decode | |
99 (;; vowels -- 18 | |
100 "a" ("aa" "A") "i" ("ii" "I") "u" ("uu" "U") | |
101 ("RRi" "R^i") ("LLi" "L^i") (".c" "e.c") nil "e" "ai" | |
102 "o.c" nil "o" "au" ("RRI" "R^I") ("LLI" "L^I")) | |
89094 | 103 (;; consonants -- 40 |
41470 | 104 "k" "kh" "g" "gh" ("~N" "N^") |
105 "ch" ("Ch" "chh") "j" "jh" ("~n" "JN") | |
106 "T" "Th" "D" "Dh" "N" | |
89094 | 107 "t" "th" "d" "dh" "n" "nh" |
41470 | 108 "p" "ph" "b" "bh" "m" |
109 "y" "r" "rh" "l" ("L" "ld") nil ("v" "w") | |
110 "sh" ("Sh" "shh") "s" "h" | |
111 "q" "K" "G" ("J" "z") ".D" ".Dh" "f" ("Y" "yh") | |
112 ("GY" "dny") "x") | |
113 (;; misc -- 7 | |
114 ".N" (".n" "M") "H" ".a" ".h" ("AUM" "OM") ".."))) | |
115 | |
116 (defvar indian-kyoto-harvard-table | |
117 '(;; for encode/decode | |
118 (;; vowel | |
119 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu") | |
120 "R" ("L" "lR") nil nil "e" "ai" | |
121 nil nil "o" "au" ("q" "RR" "Q") ("E" "LL" "lRR")) | |
122 (;; consonant | |
123 "k" "kh" "g" "gh" "G" | |
124 "c" "ch" "j" "jh" "J" | |
125 "T" "Th" "D" "Dh" "N" | |
126 "t" "th" "d" "dh" "n" nil | |
127 "p" "ph" "b" "bh" "m" | |
128 "y" "r" nil "l" "L" nil "v" | |
129 ("z" "Z") "S" "s" "h" | |
130 nil nil nil nil nil nil nil nil | |
131 nil nil) | |
132 (;; misc | |
133 nil "M" "H" "'" nil "." nil))) | |
134 | |
135 (defvar indian-harvard-table | |
136 '(;; for encode/decode | |
137 (;; vowel | |
138 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu") | |
139 "R" ("L" "lR") nil nil "e" "ai" | |
140 nil nil "o" "au" ("RR" "q" "Q") ("LL" "E" "lRR")) | |
141 (;; consonant | |
142 "k" "kh" "g" "gh" "G" | |
143 "c" "ch" "j" "jh" "J" | |
144 "T" "Th" "D" "Dh" "N" | |
145 "t" "th" "d" "dh" "n" nil | |
146 "p" "ph" "b" "bh" "m" | |
147 "y" "r" nil "l" "L" nil "v" | |
148 ("z" "Z") "S" "s" "h" | |
149 nil nil nil nil nil nil nil nil | |
150 nil nil) | |
151 (;; misc | |
152 nil "M" "H" "'" nil "." nil))) | |
153 | |
154 (defvar indian-tokyo-table | |
155 '(;; for encode/decode | |
156 (;; vowel | |
157 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu") | |
158 "R" ("L" "lR") nil nil "e" "ai" | |
159 nil nil "o" "au" ("Q" "RR" "q") ("E" "LL" "lRR")) | |
160 (;; consonant | |
161 "k" "kh" "g" "gh" "G" | |
162 "c" "ch" "j" "jh" "J" | |
163 "T" "Th" "D" "Dh" "N" | |
164 "t" "th" "d" "dh" "n" nil | |
165 "p" "ph" "b" "bh" "m" | |
166 "y" "r" nil "l" "L" nil "v" | |
167 ("Z" "z") "S" "s" "h" | |
168 nil nil nil nil nil nil nil nil | |
169 nil nil) | |
170 (;; misc | |
171 nil "M" "H" "'" nil "." nil))) | |
172 | |
173 (defvar indian-aiba-table | |
174 '(;; for encode/decode | |
175 (;; vowel | |
176 "a" "aa" "i" "ii" "u" "uu" | |
177 ".r" ".l" nil nil "e" "ai" | |
178 nil nil "o" "au" "~r" "~l") | |
179 (;; consonant | |
180 "k" "kh" "g" "gh" "^n" | |
181 "c" "ch" "j" "jh" "~n" | |
182 ".t" ".th" ".d" ".dh" ".n" | |
183 "t" "th" "d" "dh" "n" nil | |
184 "p" "ph" "b" "bh" "m" | |
185 "y" "r" nil "l" nil nil "v" | |
186 "^s" ".s" "s" "h" | |
187 nil nil nil nil nil nil nil nil | |
188 nil nil) | |
189 (;; misc | |
190 nil ".m" ".h" "'" nil "." nil))) | |
191 | |
192 (defun mapthread (function seq1 &rest seqrest) | |
193 "Apply FUNCTION to each element of SEQ1 and return result list. | |
194 If there are several SEQRESTs, FUNCTION is called with that many | |
195 arguments, with all possible combinations of these multiple SEQUENCES. | |
196 Thus, if SEQ1 contains 3 elements and SEQ2 contains 5 elements, then | |
197 FUNCTION will be called 15 times." | |
198 (if seqrest | |
89094 | 199 (mapcar |
41470 | 200 (lambda (x) |
89094 | 201 (apply |
202 'mapthread | |
203 `(lambda (&rest y) (apply ',function x y)) | |
204 seqrest)) | |
41470 | 205 seq1) |
206 (mapcar function seq1))) | |
207 | |
208 (defun indian--puthash-char (char trans-char hashtbls) | |
209 (let ((encode-hash (car hashtbls)) ;; char -> trans | |
210 (decode-hash (cdr hashtbls)) ;; trans -> char | |
211 ) | |
212 ;; char -- nil / char / string (/ list of vowel & matra) | |
213 ;; trans-char -- nil / string / list of strings | |
214 (when (and char trans-char) | |
215 (if (stringp trans-char) (setq trans-char (list trans-char))) | |
88620 | 216 (if (characterp char) (setq char (char-to-string char))) |
41470 | 217 (puthash char (car trans-char) encode-hash) |
218 (mapc | |
42056 | 219 (lambda (trans) |
220 (puthash trans char decode-hash)) | |
41470 | 221 trans-char)))) |
222 | |
42056 | 223 (defun indian--map (f l1 l2) |
224 (while l1 | |
225 (funcall f (pop l1) (pop l2)))) | |
226 | |
41470 | 227 (defun indian--puthash-v (v trans-v hashtbls) |
89094 | 228 (indian--map |
42056 | 229 (lambda (v trans-v) |
230 (indian--puthash-char (car v) trans-v hashtbls)) | |
41470 | 231 v trans-v)) |
232 | |
233 (defun indian--puthash-c (c trans-c halant hashtbls) | |
42056 | 234 (indian--map |
235 (lambda (c trans-c) | |
88620 | 236 (if (characterp c) (setq c (char-to-string c))) |
42056 | 237 (indian--puthash-char (concat c halant) trans-c hashtbls)) |
41470 | 238 c trans-c)) |
239 | |
240 (defun indian--puthash-m (m trans-m hashtbls) | |
42056 | 241 (indian--map |
242 (lambda (m trans-m) | |
243 (indian--puthash-char m trans-m hashtbls)) | |
41470 | 244 m trans-m)) |
245 | |
246 (defun indian--puthash-cv (c trans-c v trans-v hashtbls) | |
42056 | 247 (indian--map |
248 (lambda (c trans-c) | |
249 (indian--map | |
250 (lambda (v trans-v) | |
251 (when (and c trans-c v trans-v) | |
88620 | 252 (if (characterp c) (setq c (char-to-string c))) |
253 (setq v (if (characterp (cadr v)) (char-to-string (cadr v)) "")) | |
42056 | 254 (if (stringp trans-c) (setq trans-c (list trans-c))) |
255 (if (stringp trans-v) (setq trans-v (list trans-v))) | |
89094 | 256 (indian--puthash-char |
42056 | 257 (concat c v) |
258 (apply 'append | |
259 (mapthread 'concat trans-c trans-v)) | |
260 hashtbls))) | |
261 v trans-v)) | |
41470 | 262 c trans-c)) |
263 | |
264 (defun indian-make-hash (table trans-table) | |
265 "Indian Transliteration Hash for decode/encode" | |
266 (let* ((encode-hash (makehash 'equal)) | |
267 (decode-hash (makehash 'equal)) | |
268 (hashtbls (cons encode-hash decode-hash)) | |
269 (vowels (elt table 0)) | |
270 (consonants (elt table 1)) | |
271 (misc (elt table 2)) | |
272 (digits (elt table 3)) | |
273 (halant (char-to-string (elt misc 4))) | |
274 (trans-vowels (elt trans-table 0)) | |
275 (trans-consonants (elt trans-table 1)) | |
276 (trans-misc (elt trans-table 2)) | |
277 (trans-digits '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))) | |
278 (indian--puthash-v vowels trans-vowels hashtbls) | |
279 (indian--puthash-c consonants trans-consonants halant hashtbls) | |
89094 | 280 (indian--puthash-cv consonants trans-consonants |
41470 | 281 vowels trans-vowels hashtbls) |
282 (indian--puthash-m misc trans-misc hashtbls) | |
283 (indian--puthash-m digits trans-digits hashtbls) | |
284 hashtbls)) | |
285 | |
286 (defvar indian-dev-itrans-v5-hash | |
287 (indian-make-hash indian-dev-base-table | |
288 indian-itrans-v5-table)) | |
289 (defvar indian-dev-kyoto-harvard-hash | |
290 (indian-make-hash indian-dev-base-table | |
291 indian-kyoto-harvard-table)) | |
292 (defvar indian-dev-aiba-hash | |
293 (indian-make-hash indian-dev-base-table | |
294 indian-aiba-table)) | |
295 | |
296 ) | |
297 | |
298 (defmacro indian-translate-region (from to hashtable encode-p) | |
299 `(save-excursion | |
300 (save-restriction | |
89094 | 301 (let ((regexp ,(indian-regexp-of-hashtbl-keys |
302 (if encode-p (car (eval hashtable)) | |
41470 | 303 (cdr (eval hashtable)))))) |
304 (narrow-to-region from to) | |
305 (goto-char (point-min)) | |
306 (while (re-search-forward regexp nil t) | |
89094 | 307 (let ((matchstr (gethash (match-string 0) |
42056 | 308 (if ,encode-p |
309 (car ,hashtable) | |
310 (cdr ,hashtable))))) | |
41470 | 311 (if matchstr (replace-match matchstr)))))))) |
312 | |
313 ;;; | |
314 | |
315 (defun indian-dev-itrans-v5-encode-region (from to) | |
316 (interactive "r") | |
89094 | 317 (indian-translate-region |
41470 | 318 from to indian-dev-itrans-v5-hash t)) |
319 | |
320 (defun indian-dev-itrans-v5-decode-region (from to) | |
321 (interactive "r") | |
322 (indian-translate-region | |
323 from to indian-dev-itrans-v5-hash nil)) | |
324 | |
325 (defun indian-dev-kyoto-harvard-encode-region (from to) | |
326 (interactive "r") | |
89094 | 327 (indian-translate-region |
41470 | 328 from to indian-dev-kyoto-harvard-hash t)) |
329 | |
330 (defun indian-dev-kyoto-harvard-decode-region (from to) | |
331 (interactive "r") | |
332 (indian-translate-region | |
333 from to indian-dev-kyoto-harvard-hash nil)) | |
334 | |
335 (defun indian-dev-aiba-encode-region (from to) | |
336 (interactive "r") | |
89094 | 337 (indian-translate-region |
41470 | 338 from to indian-dev-aiba-hash t)) |
339 | |
340 (defun indian-dev-aiba-decode-region (from to) | |
341 (interactive "r") | |
342 (indian-translate-region | |
343 from to indian-dev-aiba-hash nil)) | |
344 | |
345 | |
346 | |
347 | |
348 ;;; IS 13194 utilities | |
349 | |
89094 | 350 ;; The following provide conversion between IS 13194 (ISCII) and UCS. |
41470 | 351 |
352 (defvar ucs-bengali-to-is13194-alist nil) | |
353 (defvar ucs-assamese-to-is13194-alist nil) | |
354 (defvar ucs-gurmukhi-to-is13194-alist nil) | |
355 (defvar ucs-gujarati-to-is13194-alist nil) | |
356 (defvar ucs-oriya-to-is13194-alist nil) | |
357 (defvar ucs-tamil-to-is13194-alist nil) | |
358 (defvar ucs-telugu-to-is13194-alist nil) | |
359 (defvar ucs-malayalam-to-is13194-alist nil) | |
360 | |
89094 | 361 (defvar is13194-default-repertory 'devanagari) |
41470 | 362 |
363 (defvar is13194-repertory-to-ucs-script | |
89094 | 364 `((DEF ?\x40 ,is13194-default-repertory) |
365 (RMN ?\x41 ,is13194-default-repertory) | |
41470 | 366 (DEV ?\x42 devanagari) |
367 (BNG ?\x43 bengali) | |
368 (TML ?\x44 tamil) | |
369 (TLG ?\x45 telugu) | |
370 (ASM ?\x46 bengali) | |
371 (ORI ?\x47 oriya) | |
372 (KND ?\x48 kannada) | |
373 (MLM ?\x49 malayalam) | |
374 (GJR ?\x4a gujarati) | |
375 (PNJ ?\x4b gurmukhi))) | |
376 | |
377 ;; for guiding find-variable function. | |
378 (defvar is13194-to-ucs-devanagari-hashtbl nil) | |
379 (defvar is13194-to-ucs-devanagari-regexp nil) | |
380 (defvar is13194-to-ucs-bengali-hashtbl nil) | |
381 (defvar is13194-to-ucs-bengali-regexp nil) | |
382 (defvar is13194-to-ucs-assamese-hashtbl nil) | |
383 (defvar is13194-to-ucs-assamese-regexp nil) | |
384 (defvar is13194-to-ucs-gurmukhi-hashtbl nil) | |
385 (defvar is13194-to-ucs-gurmukhi-regexp nil) | |
386 (defvar is13194-to-ucs-gujarati-hashtbl nil) | |
387 (defvar is13194-to-ucs-gujarati-regexp nil) | |
388 (defvar is13194-to-ucs-oriya-hashtbl nil) | |
389 (defvar is13194-to-ucs-oriya-regexp nil) | |
390 (defvar is13194-to-ucs-tamil-hashtbl nil) | |
391 (defvar is13194-to-ucs-tamil-regexp nil) | |
392 (defvar is13194-to-ucs-telugu-hashtbl nil) | |
393 (defvar is13194-to-ucs-telugu-regexp nil) | |
394 (defvar is13194-to-ucs-malayalam-hashtbl nil) | |
395 (defvar is13194-to-ucs-malayalam-regexp nil) | |
396 | |
89094 | 397 (mapc |
398 (function (lambda (script) | |
399 (let ((hashtable (intern (concat "is13194-to-ucs-" | |
400 (symbol-name script) "-hashtbl" ))) | |
401 (regexp (intern (concat "is13194-to-ucs-" | |
402 (symbol-name script) "-regexp")))) | |
41470 | 403 (set hashtable (make-hash-table :test 'equal :size 128)) |
404 (mapc | |
405 (function (lambda (x) | |
89094 | 406 (put-char-code-property (car x) 'script script) |
407 (put-char-code-property (car x) 'iscii (cdr x)) | |
408 (puthash (cdr x) (char-to-string (car x)) | |
409 (eval hashtable)))) | |
41470 | 410 (eval (intern (concat "ucs-" (symbol-name script) |
89094 | 411 "-to-is13194-alist")))) |
42060
f3b460667d31
(range): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
42056
diff
changeset
|
412 (set regexp (indian-regexp-of-hashtbl-keys (eval hashtable)))))) |
41470 | 413 '(devanagari bengali assamese gurmukhi gujarati |
414 oriya tamil telugu malayalam)) | |
415 | |
416 (defvar ucs-to-is13194-regexp | |
417 ;; only Devanagari is supported now. | |
88620 | 418 (concat "[" (char-to-string #x0900) |
89094 | 419 "-" (char-to-string #x097f) "]") |
41470 | 420 "Regexp that matches to conversion") |
421 | |
422 (defun ucs-to-iscii-region (from to) | |
89094 | 423 "Converts the indian UCS characters in the region to ISCII. |
41470 | 424 Returns new end position." |
425 (interactive "r") | |
426 ;; only Devanagari is supported now. | |
427 (save-excursion | |
428 (save-restriction | |
429 (narrow-to-region from to) | |
430 (goto-char (point-min)) | |
89094 | 431 (let* ((current-repertory is13194-default-repertory)) |
432 (while (re-search-forward ucs-to-is13194-regexp nil t) | |
433 (replace-match | |
434 (get-char-code-property (string-to-char (match-string 0)) | |
435 'iscii)))) | |
41470 | 436 (point-max)))) |
437 | |
438 (defun iscii-to-ucs-region (from to) | |
89094 | 439 "Converts the ISCII characters in the region to UCS. |
41470 | 440 Returns new end position." |
441 (interactive "r") | |
442 ;; only Devanagari is supported now. | |
443 (save-excursion | |
444 (save-restriction | |
445 (narrow-to-region from to) | |
446 (goto-char (point-min)) | |
89094 | 447 (let* ((current-repertory is13194-default-repertory) |
448 (current-hashtable | |
449 (intern (concat "is13194-to-ucs-" | |
450 (symbol-name current-repertory) "-hashtbl"))) | |
451 (current-regexp | |
452 (intern (concat "is13194-to-ucs-" | |
453 (symbol-name current-repertory) "-regexp"))) | |
454 (re (eval current-regexp)) | |
89106 | 455 (hash (eval current-hashtable))) |
89094 | 456 (while (re-search-forward re nil t) |
457 (replace-match (gethash (match-string 0) hash "")))) | |
41470 | 458 (point-max)))) |
459 | |
460 ;;;###autoload | |
461 (defun indian-compose-region (from to) | |
462 "Compose the region according to `composition-function-table'. " | |
463 (interactive "r") | |
464 (save-excursion | |
465 (save-restriction | |
466 (let ((pos from) chars (max to)) | |
89094 | 467 (narrow-to-region from to) |
468 (while (< pos max) | |
469 (setq chars (compose-chars-after pos)) | |
470 (if chars (setq pos (+ pos chars)) (setq pos (1+ pos)))))))) | |
41470 | 471 |
472 ;;;###autoload | |
473 (defun indian-compose-string (string) | |
89094 | 474 (with-temp-buffer |
41470 | 475 (insert string) |
476 (indian-compose-region (point-min) (point-max)) | |
477 (buffer-string))) | |
478 | |
479 ;;;###autoload | |
480 (defun in-is13194-post-read-conversion (len) | |
481 (let ((pos (point)) endpos) | |
482 (setq endpos (iscii-to-ucs-region pos (+ pos len))) | |
483 (indian-compose-region pos endpos) | |
484 (- endpos pos))) | |
485 | |
486 ;;;###autoload | |
487 (defun in-is13194-pre-write-conversion (from to) | |
488 (let ((buf (current-buffer))) | |
489 (set-buffer (generate-new-buffer " *temp*")) | |
490 (if (stringp from) | |
491 (insert from) | |
492 (insert-buffer-substring buf from to)) | |
493 (ucs-to-iscii-region (point-min) (point-max)) | |
494 nil)) | |
495 | |
496 | |
497 | |
498 | |
499 ;;; Backward Compatibility support programs | |
500 | |
89094 | 501 ;; The following provides the conversion from old-implementation of |
41470 | 502 ;; Emacs Devanagari script to UCS. |
503 | |
504 (defconst indian-2-colum-to-ucs | |
505 '( | |
506 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
507 ;;2120 $(5!!!"!#!$!%!&!'!(!)!*!+!,!-!.!/(B | |
508 ("$(5!!(B" . "$,15A(B") | |
509 ("$(5!"(B" . "$,15B(B") | |
510 ("$(5!#(B" . "$,15C(B") | |
511 ("$(5!$(B" . "$,15E(B") | |
512 ("$(5!%(B" . "$,15F(B") | |
513 ("$(5!&(B" . "$,15G(B") | |
514 ("$(5!'(B" . "$,15H(B") | |
515 ("$(5!((B" . "$,15I(B") | |
516 ("$(5!)(B" . "$,15J(B") | |
517 ("$(5!*(B" . "$,15K(B") | |
518 ("$(5!*"p(B" . "$,15p6#(B") | |
519 ("$(5!+(B" . "$,15N(B") | |
520 ("$(5!,(B" . "$,15O(B") | |
521 ("$(5!-(B" . "$,15P(B") | |
522 ("$(5!.(B" . "$,15M(B") | |
523 ("$(5!/(B" . "$,15R(B") | |
524 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
525 ;;2130 $(5!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?(B | |
526 ("$(5!0(B" . "$,15S(B") | |
527 ("$(5!1(B" . "$,15T(B") | |
528 ("$(5!2(B" . "$,15Q(B") | |
529 ("$(5!3(B" . "$,15U(B") | |
530 ("$(5!4(B" . "$,15V(B") | |
531 ("$(5!5(B" . "$,15W(B") | |
532 ("$(5!6(B" . "$,15X(B") | |
533 ("$(5!7(B" . "$,15Y(B") | |
534 ("$(5!8(B" . "$,15Z(B") | |
535 ("$(5!9(B" . "$,15[(B") | |
536 ("$(5!:(B" . "$,15\(B") | |
537 ("$(5!;(B" . "$,15](B") | |
538 ("$(5!<(B" . "$,15^(B") | |
539 ("$(5!=(B" . "$,15_(B") | |
540 ("$(5!>(B" . "$,15`(B") | |
541 ("$(5!?(B" . "$,15a(B") | |
542 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
543 ;;2140 $(5!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O(B | |
544 ("$(5!@(B" . "$,15b(B") | |
545 ("$(5!A(B" . "$,15c(B") | |
546 ("$(5!B(B" . "$,15d(B") | |
547 ("$(5!C(B" . "$,15e(B") | |
548 ("$(5!D(B" . "$,15f(B") | |
549 ("$(5!E(B" . "$,15g(B") | |
550 ("$(5!F(B" . "$,15h(B") | |
551 ("$(5!G(B" . "$,15i(B") | |
552 ("$(5!H(B" . "$,15j(B") | |
553 ("$(5!I(B" . "$,15k(B") | |
554 ("$(5!J(B" . "$,15l(B") | |
555 ("$(5!K(B" . "$,15m(B") | |
556 ("$(5!L(B" . "$,15n(B") | |
557 ("$(5!M(B" . "$,15o(B") | |
558 ("$(5!N(B" . "$,16?(B") | |
559 ("$(5!O(B" . "$,15p(B") | |
560 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
561 ;;2150 $(5!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_(B | |
562 ("$(5!P(B" . "$,15q(B") | |
563 ("$(5!Q(B" . "$,15r(B") | |
564 ("$(5!R(B" . "$,15s(B") | |
565 ("$(5!S(B" . "$,15t(B") | |
566 ("$(5!T(B" . "$,15u(B") | |
567 ("$(5!U(B" . "$,15v(B") | |
568 ("$(5!V(B" . "$,15w(B") | |
569 ("$(5!W(B" . "$,15x(B") | |
570 ("$(5!X(B" . "$,15y(B") | |
571 ("$(5!Z(B" . "$,15~(B") | |
572 ("$(5![(B" . "$,15(B") | |
573 ("$(5!\(B" . "$,16 (B") | |
574 ("$(5!](B" . "$,16!(B") | |
575 ("$(5!^(B" . "$,16"(B") | |
576 ("$(5!_(B" . "$,16#(B") | |
577 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
578 ;;2160 $(5!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o(B | |
579 ("$(5!`(B" . "$,16&(B") | |
580 ("$(5!a(B" . "$,16'(B") | |
581 ("$(5!b(B" . "$,16((B") | |
582 ("$(5!c(B" . "$,16%(B") | |
583 ("$(5!d(B" . "$,16*(B") | |
584 ("$(5!e(B" . "$,16+(B") | |
585 ("$(5!f(B" . "$,16,(B") | |
586 ("$(5!g(B" . "$,16)(B") | |
587 ("$(5!h(B" . "$,16-(B") | |
588 ("$(5!i(B" . "$,15|(B") | |
589 ("$(5!j(B" . "$,16D(B") | |
590 ("$(5!j!j(B" . "$,16E(B") | |
591 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
592 ;;2170 $(5!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~(B | |
593 ("$(5!q(B" . "$,16F(B") | |
594 ("$(5!r(B" . "$,16G(B") | |
595 ("$(5!s(B" . "$,16H(B") | |
596 ("$(5!t(B" . "$,16I(B") | |
597 ("$(5!u(B" . "$,16J(B") | |
598 ("$(5!v(B" . "$,16K(B") | |
599 ("$(5!w(B" . "$,16L(B") | |
600 ("$(5!x(B" . "$,16M(B") | |
601 ("$(5!y(B" . "$,16N(B") | |
602 ("$(5!z(B" . "$,16O(B") | |
603 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
604 ;;2220 $(5"!"""#"$"%"&"'"(")"*"+","-"."/(B | |
605 ("$(5"!(B" . "$,16;6-5p(B") | |
606 ("$(5""(B" . "$,16>6-5p(B") | |
607 ("$(5"#(B" . "$,15U6-5p(B") | |
608 ("$(5"$(B" . "$,15W6-5p(B") | |
609 ("$(5"%(B" . "$,15d6-5p(B") | |
610 ("$(5"&(B" . "$,15j6-5p(B") | |
611 ("$(5"'(B" . "$,15k6-5p(B") | |
612 ("$(5")(B" . "$,15v6-5p(B") | |
613 ("$(5",(B" . "$,15p6!(B") | |
614 ("$(5"-(B" . "$,15p6"(B") | |
615 ("$(5".(B" . "$,15q6!(B") | |
616 ("$(5"/(B" . "$,15q6"(B") | |
617 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
618 ;;2230 $(5"0"1"2"3"4"5"6"7"8"9":";"<"=">"?(B | |
619 ("$(5"3(B" . "$,15U6-(B") | |
620 ("$(5"4(B" . "$,15V6-(B") | |
621 ("$(5"5(B" . "$,15W6-(B") | |
622 ("$(5"6(B" . "$,15X6-(B") | |
623 ("$(5"8(B" . "$,15Z6-(B") | |
624 ("$(5"8"q(B" . "$,15Z6-5p6-(B") | |
625 ("$(5":(B" . "$,15\6-(B") | |
626 ("$(5";(B" . "$,15]6-(B") | |
627 ("$(5"<(B" . "$,15^6-(B") | |
628 ("$(5"<(B" . "$,15^6-(B") | |
629 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
630 ;;2240 $(5"@"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O(B | |
631 ("$(5"A(B" . "$,15c6-(B") | |
632 ("$(5"B(B" . "$,15d6-(B") | |
633 ("$(5"C(B" . "$,15e6-(B") | |
634 ("$(5"E(B" . "$,15g6-(B") | |
635 ("$(5"F(B" . "$,15h6-(B") | |
636 ("$(5"G(B" . "$,15i6-(B") | |
637 ("$(5"H(B" . "$,15j6-(B") | |
638 ("$(5"I(B" . "$,15k6-(B") | |
639 ("$(5"J(B" . "$,15l6-(B") | |
640 ("$(5"J(B" . "$,15l6-(B") | |
641 ("$(5"K(B" . "$,15m6-(B") | |
642 ("$(5"L(B" . "$,15n6-(B") | |
643 ("$(5"M(B" . "$,15o6-(B") | |
644 ("$(5"N(B" . "$,16?6-(B") | |
645 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
646 ;;2250 $(5"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_(B | |
647 ("$(5"Q(B" . "$,15r6-(B") | |
648 ("$(5"R(B" . "$,15s6-(B") | |
649 ("$(5"S(B" . "$,15t6-(B") | |
650 ("$(5"T(B" . "$,15u6-(B") | |
651 ("$(5"U(B" . "$,15v6-(B") | |
652 ("$(5"V(B" . "$,15w6-(B") | |
653 ("$(5"W(B" . "$,15x6-(B") | |
654 ("$(5"](B" . "$,16-5o(B") | |
655 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
656 ;;2260 $(5"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o(B | |
657 ("$(5"`(B" . "$,15W6-5p6-(B") | |
658 ("$(5"a(B" . "$,15X6-5h6-(B") | |
659 ("$(5"c(B" . "$,15d6-5d6-(B") | |
660 ("$(5"d(B" . "$,15d6-5p6-(B") | |
661 ("$(5"e(B" . "$,15g6-5h6-(B") | |
662 ("$(5"f(B" . "$,15g6-5p6-(B") | |
663 ("$(5"g(B" . "$,15j6-5d6-(B") | |
664 ("$(5"h(B" . "$,15v6-5Z6-(B") | |
665 ("$(5"i(B" . "$,15v6-5p6-(B") | |
666 ("$(5"j(B" . "$,15v6-5u6-(B") | |
667 ("$(5"k(B" . "$,15h6-5h6-(B") | |
668 ("$(5"l(B" . "$,15U6-5w6-(B") | |
669 ("$(5"m(B" . "$,15\6-5^6-(B") | |
670 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
671 ;;2270 $(5"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~(B | |
672 ("$(5"p(B" . "$,15p6-(B") | |
673 ("$(5"q(B" . "$,16-5p(B") | |
674 ("$(5"r(B" . "$,16-5p(B") | |
675 ("$(5"s(B" . "$,1686-(B") | |
676 ("$(5"t(B" . "$,1696-(B") | |
677 ("$(5"u(B" . "$,16:6-(B") | |
678 ("$(5"y(B" . "$,16>6-(B") | |
679 ("$(5"z(B" . "$,16;6-(B") | |
680 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
681 ;;2320 $(5#!#"###$#%#&#'#(#)#*#+#,#-#.#/(B | |
682 ("$(5#!(B" . "$,160(B") | |
683 ("$(5#&(B" . "$,15L(B") | |
684 ("$(5#&"p(B" . "$,15p6$(B") | |
685 ("$(5#'(B" . "$,16A(B") | |
686 ("$(5#'"p(B" . "$,15p6C(B") | |
687 ("$(5#*(B" . "$,16@(B") | |
688 ("$(5#*"p(B" . "$,15p6B(B") | |
689 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
690 ;;2330 $(5#0#1#2#3#4#5#6#7#8#9#:#;#<#=#>#?(B | |
691 ("$(5#3(B" . "$,168(B") | |
692 ("$(5#4(B" . "$,169(B") | |
693 ("$(5#5(B" . "$,16:(B") | |
694 ("$(5#:(B" . "$,16;(B") | |
695 ("$(5#?(B" . "$,16<(B") | |
696 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
697 ;;2340 $(5#@#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O(B | |
698 ("$(5#@(B" . "$,16=(B") | |
699 ("$(5#I(B" . "$,16>(B") | |
700 ("$(5#J(B" . "$,15}(B") | |
701 ("$(5#K(B" . "$,16$(B") | |
702 ("$(5#L(B" . "$,16B(B") | |
703 ("$(5#M(B" . "$,16C(B") | |
704 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
705 ;;2350 $(5#P#Q#R#S#T#U#V#W#X#Y#Z#[#\#]#^#_(B | |
706 ("$(5#P(B" . "$,15n6-5h(B") | |
707 ("$(5#Q(B" . "$,15n6-5r(B") | |
708 ("$(5#R(B" . "$,15y6#(B") | |
709 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
710 ;;2360 $(5#`#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o(B | |
711 ("$(5#`(B" . "$,15r6-5r(B") | |
712 ("$(5#a(B" . "$,15u6-5h(B") | |
713 ("$(5#b(B" . "$,15u6-5u(B") | |
714 ("$(5#c(B" . "$,15v6-5Z(B") | |
715 ("$(5#d(B" . "$,15v6-5h(B") | |
716 ("$(5#e(B" . "$,15v6-5l(B") | |
717 ("$(5#f(B" . "$,15v6-5r(B") | |
718 ("$(5#g(B" . "$,15v6-5u(B") | |
719 ("$(5#h(B" . "$,15w6-5_6-5p6-5o(B") | |
720 ("$(5#i(B" . "$,15w6-5_6-5o(B") | |
721 ("$(5#j(B" . "$,15w6-5_6-5u(B") | |
722 ("$(5#k(B" . "$,15w6-5_(B") | |
723 ("$(5#l(B" . "$,15w6-5`(B") | |
724 ("$(5#m(B" . "$,15x6-5h(B") | |
725 ("$(5#n(B" . "$,15x6-5p(B") | |
726 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
727 ;;2370 $(5#p#q#r#s#t#u#v#w#x#y#z#{#|#}#~(B | |
728 ("$(5#p(B" . "$,15y6-5c(B") | |
729 ("$(5#q(B" . "$,15y6-5h(B") | |
730 ("$(5#r(B" . "$,15y6-5n(B") | |
731 ("$(5#s(B" . "$,15y6-5o(B") | |
732 ("$(5#t(B" . "$,15y6-5p(B") | |
733 ("$(5#u(B" . "$,15y6-5r(B") | |
734 ("$(5#v(B" . "$,15y6-5u(B") | |
735 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
736 ;;2420 $(5$!$"$#$$$%$&$'$($)$*$+$,$-$.$/(B | |
737 ("$(5$!(B" . "$,15U6-5d6-5p6-5o(B") | |
738 ("$(5$"(B" . "$,15U6-5d6-5u(B") | |
739 ("$(5$#(B" . "$,15U6-5d6-5o(B") | |
740 ("$(5$$(B" . "$,15U6-5h6-5o(B") | |
741 ("$(5$%(B" . "$,15U6-5p6-5o(B") | |
742 ("$(5$&(B" . "$,15U6-5u6-5o(B") | |
743 ("$(5$'(B" . "$,15U6-5U(B") | |
744 ("$(5$((B" . "$,15U6-5d(B") | |
745 ("$(5$)(B" . "$,15U6-5h(B") | |
746 ("$(5$*(B" . "$,15U6-5n(B") | |
747 ("$(5$+(B" . "$,15U6-5o(B") | |
748 ("$(5$,(B" . "$,15U6-5r(B") | |
749 ("$(5$-(B" . "$,15U6-5u(B") | |
750 ("$(5$.(B" . "$,15U6-5w(B") | |
751 ("$(5$/(B" . "$,15X6-5h(B") | |
752 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
753 ;;2430 $(5$0$1$2$3$4$5$6$7$8$9$:$;$<$=$>$?(B | |
754 ("$(5$0(B" . "$,15Y6-5U6-5d6-5o(B") | |
755 ("$(5$1(B" . "$,15Y6-5U6-5w6-5u(B") | |
756 ("$(5$2(B" . "$,15Y6-5U6-5d(B") | |
757 ("$(5$3(B" . "$,15Y6-5U6-5w(B") | |
758 ("$(5$4(B" . "$,15Y6-5X6-5p(B") | |
759 ("$(5$5(B" . "$,15Y6-5U6-5o(B") | |
760 ("$(5$6(B" . "$,15Y6-5V6-5o(B") | |
761 ("$(5$7(B" . "$,15Y6-5W6-5o(B") | |
762 ("$(5$8(B" . "$,15Y6-5X6-5o(B") | |
763 ("$(5$9(B" . "$,15Y6-5U(B") | |
764 ("$(5$:(B" . "$,15Y6-5V(B") | |
765 ("$(5$;(B" . "$,15Y6-5W(B") | |
766 ("$(5$<(B" . "$,15Y6-5X(B") | |
767 ("$(5$=(B" . "$,15Y6-5Y(B") | |
768 ("$(5$>(B" . "$,15Y6-5h(B") | |
769 ("$(5$?(B" . "$,15Y6-5n(B") | |
770 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
771 ;;2440 $(5$@$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O(B | |
772 ("$(5$@(B" . "$,15Y6-5o(B") | |
773 ("$(5$A(B" . "$,15Z6-5Z(B") | |
774 ("$(5$B(B" . "$,15Z6-5^(B") | |
775 ("$(5$C(B" . "$,15[6-5o(B") | |
776 ("$(5$D(B" . "$,15\6-5p(B") | |
777 ("$(5$E(B" . "$,15\6-5^(B") | |
778 ("$(5$F(B" . "$,15^6-5Z(B") | |
779 ("$(5$G(B" . "$,15^6-5\(B") | |
780 ("$(5$H(B" . "$,15_6-5U(B") | |
781 ("$(5$I(B" . "$,15_6-5_(B") | |
782 ("$(5$J(B" . "$,15_6-5`(B") | |
783 ("$(5$K(B" . "$,15_6-5o(B") | |
784 ("$(5$L(B" . "$,15`6-5o(B") | |
785 ("$(5$M(B" . "$,15a6-5W6-5o(B") | |
786 ("$(5$N(B" . "$,15a6-5X6-5p(B") | |
787 ("$(5$O(B" . "$,15a6-5p6-5o(B") | |
788 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
789 ;;2450 $(5$P$Q$R$S$T$U$V$W$X$Y$Z$[$\$]$^$_(B | |
790 ("$(5$P(B" . "$,15a6-5W(B") | |
791 ("$(5$Q(B" . "$,15a6-5X(B") | |
792 ("$(5$R(B" . "$,15a6-5a(B") | |
793 ("$(5$S(B" . "$,15a6-5n(B") | |
794 ("$(5$T(B" . "$,15a6-5o(B") | |
795 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
796 ;;2460 $(5$`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o(B | |
797 ("$(5$`(B" . "$,15b6-5o(B") | |
798 ("$(5$a(B" . "$,15d6-5d(B") | |
799 ("$(5$b(B" . "$,15d6-5h(B") | |
800 ("$(5$c(B" . "$,15f6-5f6-5o(B") | |
801 ("$(5$d(B" . "$,15f6-5g6-5o(B") | |
802 ("$(5$e(B" . "$,15f6-5m6-5o(B") | |
803 ("$(5$f(B" . "$,15f6-5p6-5o(B") | |
804 ("$(5$g(B" . "$,15f6-5u6-5o(B") | |
805 ("$(5$h(B" . "$,15f6-5W6-5p(B") | |
806 ("$(5$i(B" . "$,15f6-5X6-5p(B") | |
807 ("$(5$j(B" . "$,15f6-5f6-5u(B") | |
808 ("$(5$k(B" . "$,15f6-5g6-5u(B") | |
809 ("$(5$l(B" . "$,15f6-5W(B") | |
810 ("$(5$m(B" . "$,15f6-5X(B") | |
811 ("$(5$n(B" . "$,15f6-5f(B") | |
812 ("$(5$o(B" . "$,15f6-5g(B") | |
813 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f | |
814 ;;2470 $(5$p$q$r$s$t$u$v$w$x$y$z${$|$}$~(B | |
815 ("$(5$p(B" . "$,15f6-5h(B") | |
816 ("$(5$q(B" . "$,15f6-5l(B") | |
817 ("$(5$r(B" . "$,15f6-5m(B") | |
818 ("$(5$s(B" . "$,15f6-5n(B") | |
819 ("$(5$t(B" . "$,15f6-5o(B") | |
820 ("$(5$u(B" . "$,15f6-5u(B") | |
821 ("$(5$v(B" . "$,15g6-5h(B") | |
822 ("$(5$w(B" . "$,15h6-5h(B") | |
823 ("$(5$x(B" . "$,15j6-5d(B") | |
824 ("$(5$y(B" . "$,15j6-5h(B") | |
825 ("$(5$z(B" . "$,15j6-5r(B") | |
826 ("$(5${(B" . "$,15l6-5h(B") | |
827 ("$(5$|(B" . "$,15l6-5l(B") | |
828 ("$(5$}(B" . "$,15l6-5u(B") | |
829 ("$(5$~(B" . "$,15m6-5h(B"))) | |
830 | |
831 (defconst indian-2-column-to-ucs-regexp | |
832 "$(5!j!j(B\\|$(5"8"q(B\\|[$(5#&#'!*#*(B]$(5"p(B\\|[$(5!!(B-$(5$~(B]") | |
833 | |
834 (put 'indian-2-column-to-ucs-chartable 'char-table-extra-slots 1) | |
835 (defconst indian-2-column-to-ucs-chartable | |
836 (let ((table (make-char-table 'indian-2-column-to-ucs-chartable)) | |
89094 | 837 (alist nil)) |
41470 | 838 (dolist (elt indian-2-colum-to-ucs) |
839 (if (= (length (car elt)) 1) | |
89094 | 840 (aset table (aref (car elt) 0) (cdr elt)) |
841 (setq alist (cons elt alist)))) | |
41470 | 842 (set-char-table-extra-slot table 0 alist) |
843 table)) | |
844 | |
845 (defun indian-2-column-to-ucs-region (from to) | |
846 "Convert old Emacs Devanagari characters to UCS." | |
847 (interactive "r") | |
848 (save-excursion | |
849 (save-restriction | |
850 (let ((pos from) | |
89094 | 851 (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0))) |
852 (narrow-to-region from to) | |
853 (decompose-region from to) | |
854 (goto-char (point-min)) | |
855 (while (re-search-forward indian-2-column-to-ucs-regexp nil t) | |
856 (let ((len (- (match-end 0) (match-beginning 0))) | |
857 subst) | |
858 (if (= len 1) | |
859 (setq subst (aref indian-2-column-to-ucs-chartable | |
42056 | 860 (char-after (match-beginning 0)))) |
89094 | 861 (setq subst (assoc (match-string 0) alist))) |
862 (replace-match (if subst subst "?")))) | |
863 (indian-compose-region (point-min) (point-max)))))) | |
42056 | 864 |
89094 | 865 (provide 'ind-util) |
42056 | 866 |
41470 | 867 ;;; ind-util.el ends here |