3a0dc098f6a25c9d284a81b993350c1c8cbc2c78
[bpt/emacs.git] / lisp / language / ind-util.el
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 (require 'cl)
43
44 (defun range (from to)
45 "Make the list of the integers of range FROM to TO."
46 (let (result)
47 (while (<= from to) (setq result (cons to result) to (1- to))) result))
48
49 (defun regexp-of-hashtbl-keys (hashtbl)
50 "Returns the regular expression of hashtable keys."
51 (let ((max-specpdl-size 1000))
52 (regexp-opt
53 (sort
54 (let (dummy)
55 (maphash (function (lambda (key val) (setq dummy (cons key dummy)))) hashtbl)
56 dummy)
57 (function (lambda (x y) (> (length x) (length y))))))))
58
59 (defvar indian-dev-base-table
60 '(
61 (;; VOWELS (18)
62 (?\e$,15E\e(B nil) (?\e$,15F\e(B ?\e$,15~\e(B) (?\e$,15G\e(B ?\e$,15\7f\e(B) (?\e$,15H\e(B ?\e$,16 \e(B) (?\e$,15I\e(B ?\e$,16!\e(B) (?\e$,15J\e(B ?\e$,16"\e(B)
63 (?\e$,15K\e(B ?\e$,16#\e(B) (?\e$,15L\e(B ?\e$,16$\e(B) (?\e$,15M\e(B ?\e$,16%\e(B) (?\e$,15N\e(B ?\e$,16&\e(B) (?\e$,15O\e(B ?\e$,16'\e(B) (?\e$,15P\e(B ?\e$,16(\e(B)
64 (?\e$,15Q\e(B ?\e$,16)\e(B) (?\e$,15R\e(B ?\e$,16*\e(B) (?\e$,15S\e(B ?\e$,16+\e(B) (?\e$,15T\e(B ?\e$,16,\e(B) (?\e$,16@\e(B ?\e$,16B\e(B) (?\e$,16A\e(B ?\e$,16C\e(B))
65 (;; CONSONANTS (currently 42, including special cases)
66 ?\e$,15U\e(B ?\e$,15V\e(B ?\e$,15W\e(B ?\e$,15X\e(B ?\e$,15Y\e(B ;; GUTTRULS
67 ?\e$,15Z\e(B ?\e$,15[\e(B ?\e$,15\\e(B ?\e$,15]\e(B ?\e$,15^\e(B ;; PALATALS
68 ?\e$,15_\e(B ?\e$,15`\e(B ?\e$,15a\e(B ?\e$,15b\e(B ?\e$,15c\e(B ;; CEREBRALS
69 ?\e$,15d\e(B ?\e$,15e\e(B ?\e$,15f\e(B ?\e$,15g\e(B ?\e$,15h\e(B ?\e$,15i\e(B ;; DENTALS
70 ?\e$,15j\e(B ?\e$,15k\e(B ?\e$,15l\e(B ?\e$,15m\e(B ?\e$,15n\e(B ;; LABIALS
71 ?\e$,15o\e(B ?\e$,15p\e(B ?\e$,15q\e(B ?\e$,15r\e(B ?\e$,15s\e(B ?\e$,15t\e(B ?\e$,15u\e(B ;; SEMIVOWELS
72 ?\e$,15v\e(B ?\e$,15w\e(B ?\e$,15x\e(B ?\e$,15y\e(B ;; SIBILANTS
73 ?\e$,168\e(B ?\e$,169\e(B ?\e$,16:\e(B ?\e$,16;\e(B ?\e$,16<\e(B ?\e$,16=\e(B ?\e$,16>\e(B ?\e$,16?\e(B ;; NUKTAS
74 "\e$,15\6-5^\e(B" "\e$,15U6-5w\e(B")
75 (;; Misc Symbols (7)
76 ?\e$,15A\e(B ?\e$,15B\e(B ?\e$,15C\e(B ?\e$,15}\e(B ?\e$,16-\e(B ?\e$,160\e(B ?\e$,16D\e(B)
77 (;; Digits (10)
78 ?\e$,16F\e(B ?\e$,16G\e(B ?\e$,16H\e(B ?\e$,16I\e(B ?\e$,16J\e(B ?\e$,16K\e(B ?\e$,16L\e(B ?\e$,16M\e(B ?\e$,16N\e(B ?\e$,16O\e(B)
79 (;; Inscript-extra (4) (#, $, ^, *, ])
80 "\e$,16-5p\e(B" "\e$,15p6-\e(B" "\e$,15d6-5p\e(B" "\e$,15v6-5p\e(B" "\e$,15|\e(B")))
81
82 (defvar indian-pnj-base-table nil)
83 (defvar indian-ori-base-table nil)
84 (defvar indian-bng-base-table nil)
85 (defvar indian-asm-base-table nil)
86 (defvar indian-tlg-base-table nil)
87 (defvar indian-knd-base-table nil)
88 (defvar indian-mlm-base-table nil)
89 (defvar indian-tml-base-table nil)
90
91 (defvar indian-base-table-to-language-alist
92 '((indian-dev-base-table . "Devanagari")
93 (indian-pnj-base-table . "Punjabi")
94 (indian-ori-base-table . "Oriya")
95 (indian-bng-base-table . "Bengali")
96 (indian-asm-base-table . "Assamese")
97 (indian-tlg-base-table . "Telugu")
98 (indian-knd-base-table . "Kannada")
99 (indian-mlm-base-table . "Malayalam")
100 (indian-tml-base-table . "Tamil")))
101
102 (defvar indian-itrans-v5-table
103 '(;; for encode/decode
104 (;; vowels -- 18
105 "a" ("aa" "A") "i" ("ii" "I") "u" ("uu" "U")
106 ("RRi" "R^i") ("LLi" "L^i") (".c" "e.c") nil "e" "ai"
107 "o.c" nil "o" "au" ("RRI" "R^I") ("LLI" "L^I"))
108 (;; consonants -- 40
109 "k" "kh" "g" "gh" ("~N" "N^")
110 "ch" ("Ch" "chh") "j" "jh" ("~n" "JN")
111 "T" "Th" "D" "Dh" "N"
112 "t" "th" "d" "dh" "n" "nh"
113 "p" "ph" "b" "bh" "m"
114 "y" "r" "rh" "l" ("L" "ld") nil ("v" "w")
115 "sh" ("Sh" "shh") "s" "h"
116 "q" "K" "G" ("J" "z") ".D" ".Dh" "f" ("Y" "yh")
117 ("GY" "dny") "x")
118 (;; misc -- 7
119 ".N" (".n" "M") "H" ".a" ".h" ("AUM" "OM") "..")))
120
121 (defvar indian-kyoto-harvard-table
122 '(;; for encode/decode
123 (;; vowel
124 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu")
125 "R" ("L" "lR") nil nil "e" "ai"
126 nil nil "o" "au" ("q" "RR" "Q") ("E" "LL" "lRR"))
127 (;; consonant
128 "k" "kh" "g" "gh" "G"
129 "c" "ch" "j" "jh" "J"
130 "T" "Th" "D" "Dh" "N"
131 "t" "th" "d" "dh" "n" nil
132 "p" "ph" "b" "bh" "m"
133 "y" "r" nil "l" "L" nil "v"
134 ("z" "Z") "S" "s" "h"
135 nil nil nil nil nil nil nil nil
136 nil nil)
137 (;; misc
138 nil "M" "H" "'" nil "." nil)))
139
140 (defvar indian-harvard-table
141 '(;; for encode/decode
142 (;; vowel
143 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu")
144 "R" ("L" "lR") nil nil "e" "ai"
145 nil nil "o" "au" ("RR" "q" "Q") ("LL" "E" "lRR"))
146 (;; consonant
147 "k" "kh" "g" "gh" "G"
148 "c" "ch" "j" "jh" "J"
149 "T" "Th" "D" "Dh" "N"
150 "t" "th" "d" "dh" "n" nil
151 "p" "ph" "b" "bh" "m"
152 "y" "r" nil "l" "L" nil "v"
153 ("z" "Z") "S" "s" "h"
154 nil nil nil nil nil nil nil nil
155 nil nil)
156 (;; misc
157 nil "M" "H" "'" nil "." nil)))
158
159 (defvar indian-tokyo-table
160 '(;; for encode/decode
161 (;; vowel
162 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu")
163 "R" ("L" "lR") nil nil "e" "ai"
164 nil nil "o" "au" ("Q" "RR" "q") ("E" "LL" "lRR"))
165 (;; consonant
166 "k" "kh" "g" "gh" "G"
167 "c" "ch" "j" "jh" "J"
168 "T" "Th" "D" "Dh" "N"
169 "t" "th" "d" "dh" "n" nil
170 "p" "ph" "b" "bh" "m"
171 "y" "r" nil "l" "L" nil "v"
172 ("Z" "z") "S" "s" "h"
173 nil nil nil nil nil nil nil nil
174 nil nil)
175 (;; misc
176 nil "M" "H" "'" nil "." nil)))
177
178 (defvar indian-aiba-table
179 '(;; for encode/decode
180 (;; vowel
181 "a" "aa" "i" "ii" "u" "uu"
182 ".r" ".l" nil nil "e" "ai"
183 nil nil "o" "au" "~r" "~l")
184 (;; consonant
185 "k" "kh" "g" "gh" "^n"
186 "c" "ch" "j" "jh" "~n"
187 ".t" ".th" ".d" ".dh" ".n"
188 "t" "th" "d" "dh" "n" nil
189 "p" "ph" "b" "bh" "m"
190 "y" "r" nil "l" nil nil "v"
191 "^s" ".s" "s" "h"
192 nil nil nil nil nil nil nil nil
193 nil nil)
194 (;; misc
195 nil ".m" ".h" "'" nil "." nil)))
196
197 (defun mapthread (function seq1 &rest seqrest)
198 "Apply FUNCTION to each element of SEQ1 and return result list.
199 If there are several SEQRESTs, FUNCTION is called with that many
200 arguments, with all possible combinations of these multiple SEQUENCES.
201 Thus, if SEQ1 contains 3 elements and SEQ2 contains 5 elements, then
202 FUNCTION will be called 15 times."
203 (if seqrest
204 (mapcar
205 (lambda (x)
206 (apply
207 'mapthread
208 `(lambda (&rest y) (apply (quote ,function) ,x y))
209 seqrest))
210 seq1)
211 (mapcar function seq1)))
212
213 (defun indian--puthash-char (char trans-char hashtbls)
214 (let ((encode-hash (car hashtbls)) ;; char -> trans
215 (decode-hash (cdr hashtbls)) ;; trans -> char
216 )
217 ;; char -- nil / char / string (/ list of vowel & matra)
218 ;; trans-char -- nil / string / list of strings
219 (when (and char trans-char)
220 (if (stringp trans-char) (setq trans-char (list trans-char)))
221 (if (char-valid-p char) (setq char (char-to-string char)))
222 (puthash char (car trans-char) encode-hash)
223 (mapc
224 '(lambda (trans)
225 (puthash trans char decode-hash))
226 trans-char))))
227
228 (defun indian--puthash-v (v trans-v hashtbls)
229 (mapcar*
230 '(lambda (v trans-v)
231 (indian--puthash-char (car v) trans-v hashtbls))
232 v trans-v))
233
234 (defun indian--puthash-c (c trans-c halant hashtbls)
235 (mapcar*
236 '(lambda (c trans-c)
237 (if (char-valid-p c) (setq c (char-to-string c)))
238 (indian--puthash-char (concat c halant) trans-c hashtbls))
239 c trans-c))
240
241 (defun indian--puthash-m (m trans-m hashtbls)
242 (mapcar*
243 '(lambda (m trans-m)
244 (indian--puthash-char m trans-m hashtbls))
245 m trans-m))
246
247 (defun indian--puthash-cv (c trans-c v trans-v hashtbls)
248 (mapcar*
249 '(lambda (c trans-c)
250 (mapcar*
251 (lambda (v trans-v)
252 (when (and c trans-c v trans-v)
253 (if (char-valid-p c) (setq c (char-to-string c)))
254 (setq v (if (char-valid-p (cadr v)) (char-to-string (cadr v)) ""))
255 (if (stringp trans-c) (setq trans-c (list trans-c)))
256 (if (stringp trans-v) (setq trans-v (list trans-v)))
257 (indian--puthash-char
258 (concat c v)
259 (apply 'append
260 (mapthread 'concat trans-c trans-v))
261 hashtbls)))
262 v trans-v))
263 c trans-c))
264
265 (defun indian-make-hash (table trans-table)
266 "Indian Transliteration Hash for decode/encode"
267 (let* ((encode-hash (makehash 'equal))
268 (decode-hash (makehash 'equal))
269 (hashtbls (cons encode-hash decode-hash))
270 (vowels (elt table 0))
271 (consonants (elt table 1))
272 (misc (elt table 2))
273 (digits (elt table 3))
274 (halant (char-to-string (elt misc 4)))
275 (trans-vowels (elt trans-table 0))
276 (trans-consonants (elt trans-table 1))
277 (trans-misc (elt trans-table 2))
278 (trans-digits '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")))
279 (indian--puthash-v vowels trans-vowels hashtbls)
280 (indian--puthash-c consonants trans-consonants halant hashtbls)
281 (indian--puthash-cv consonants trans-consonants
282 vowels trans-vowels hashtbls)
283 (indian--puthash-m misc trans-misc hashtbls)
284 (indian--puthash-m digits trans-digits hashtbls)
285 hashtbls))
286
287 (defvar indian-dev-itrans-v5-hash
288 (indian-make-hash indian-dev-base-table
289 indian-itrans-v5-table))
290 (defvar indian-dev-kyoto-harvard-hash
291 (indian-make-hash indian-dev-base-table
292 indian-kyoto-harvard-table))
293 (defvar indian-dev-aiba-hash
294 (indian-make-hash indian-dev-base-table
295 indian-aiba-table))
296
297 )
298
299 (defmacro indian-translate-region (from to hashtable encode-p)
300 `(save-excursion
301 (save-restriction
302 (let ((regexp ,(regexp-of-hashtbl-keys
303 (if encode-p (car (eval hashtable))
304 (cdr (eval hashtable))))))
305 (narrow-to-region from to)
306 (goto-char (point-min))
307 (while (re-search-forward regexp nil t)
308 (let ((matchstr (gethash (match-string 0)
309 (if ,encode-p (car ,hashtable) (cdr ,hashtable)))))
310 (if matchstr (replace-match matchstr))))))))
311
312 ;;;
313
314 (defun indian-dev-itrans-v5-encode-region (from to)
315 (interactive "r")
316 (indian-translate-region
317 from to indian-dev-itrans-v5-hash t))
318
319 (defun indian-dev-itrans-v5-decode-region (from to)
320 (interactive "r")
321 (indian-translate-region
322 from to indian-dev-itrans-v5-hash nil))
323
324 (defun indian-dev-kyoto-harvard-encode-region (from to)
325 (interactive "r")
326 (indian-translate-region
327 from to indian-dev-kyoto-harvard-hash t))
328
329 (defun indian-dev-kyoto-harvard-decode-region (from to)
330 (interactive "r")
331 (indian-translate-region
332 from to indian-dev-kyoto-harvard-hash nil))
333
334 (defun indian-dev-aiba-encode-region (from to)
335 (interactive "r")
336 (indian-translate-region
337 from to indian-dev-aiba-hash t))
338
339 (defun indian-dev-aiba-decode-region (from to)
340 (interactive "r")
341 (indian-translate-region
342 from to indian-dev-aiba-hash nil))
343
344
345
346
347 ;;; IS 13194 utilities
348
349 ;; The followings provide conversion between IS 13194 (ISCII) and UCS.
350
351 (defvar ucs-devanagari-to-is13194-alist
352 '(;;Unicode vs IS13194 ;; only Devanagari is supported now.
353 (?\x0900 . "[U+0900]")
354 (?\x0901 . "\e(5!\e(B")
355 (?\x0902 . "\e(5"\e(B")
356 (?\x0903 . "\e(5#\e(B")
357 (?\x0904 . "[U+0904]")
358 (?\x0905 . "\e(5$\e(B")
359 (?\x0906 . "\e(5%\e(B")
360 (?\x0907 . "\e(5&\e(B")
361 (?\x0908 . "\e(5'\e(B")
362 (?\x0909 . "\e(5(\e(B")
363 (?\x090a . "\e(5)\e(B")
364 (?\x090b . "\e(5*\e(B")
365 (?\x090c . "\e(5&i\e(B")
366 (?\x090d . "\e(5.\e(B")
367 (?\x090e . "\e(5+\e(B")
368 (?\x090f . "\e(5,\e(B")
369 (?\x0910 . "\e(5-\e(B")
370 (?\x0911 . "\e(52\e(B")
371 (?\x0912 . "\e(5/\e(B")
372 (?\x0913 . "\e(50\e(B")
373 (?\x0914 . "\e(51\e(B")
374 (?\x0915 . "\e(53\e(B")
375 (?\x0916 . "\e(54\e(B")
376 (?\x0917 . "\e(55\e(B")
377 (?\x0918 . "\e(56\e(B")
378 (?\x0919 . "\e(57\e(B")
379 (?\x091a . "\e(58\e(B")
380 (?\x091b . "\e(59\e(B")
381 (?\x091c . "\e(5:\e(B")
382 (?\x091d . "\e(5;\e(B")
383 (?\x091e . "\e(5<\e(B")
384 (?\x091f . "\e(5=\e(B")
385 (?\x0920 . "\e(5>\e(B")
386 (?\x0921 . "\e(5?\e(B")
387 (?\x0922 . "\e(5@\e(B")
388 (?\x0923 . "\e(5A\e(B")
389 (?\x0924 . "\e(5B\e(B")
390 (?\x0925 . "\e(5C\e(B")
391 (?\x0926 . "\e(5D\e(B")
392 (?\x0927 . "\e(5E\e(B")
393 (?\x0928 . "\e(5F\e(B")
394 (?\x0929 . "\e(5G\e(B")
395 (?\x092a . "\e(5H\e(B")
396 (?\x092b . "\e(5I\e(B")
397 (?\x092c . "\e(5J\e(B")
398 (?\x092d . "\e(5K\e(B")
399 (?\x092e . "\e(5L\e(B")
400 (?\x092f . "\e(5M\e(B")
401 (?\x0930 . "\e(5O\e(B")
402 (?\x0931 . "\e(5P\e(B")
403 (?\x0932 . "\e(5Q\e(B")
404 (?\x0933 . "\e(5R\e(B")
405 (?\x0934 . "\e(5S\e(B")
406 (?\x0935 . "\e(5T\e(B")
407 (?\x0936 . "\e(5U\e(B")
408 (?\x0937 . "\e(5V\e(B")
409 (?\x0938 . "\e(5W\e(B")
410 (?\x0939 . "\e(5X\e(B")
411 (?\x093a . "[U+093a]")
412 (?\x093b . "[U+093b]")
413 (?\x093c . "\e(5i\e(B")
414 (?\x093d . "\e(5ji\e(B")
415 (?\x093e . "\e(5Z\e(B")
416 (?\x093f . "\e(5[\e(B")
417 (?\x0940 . "\e(5\\e(B")
418 (?\x0941 . "\e(5]\e(B")
419 (?\x0942 . "\e(5^\e(B")
420 (?\x0943 . "\e(5_\e(B")
421 (?\x0944 . "\e(5_i\e(B")
422 (?\x0945 . "\e(5c\e(B")
423 (?\x0946 . "\e(5`\e(B")
424 (?\x0947 . "\e(5a\e(B")
425 (?\x0948 . "\e(5b\e(B")
426 (?\x0949 . "\e(5g\e(B")
427 (?\x094a . "\e(5d\e(B")
428 (?\x094b . "\e(5e\e(B")
429 (?\x094c . "\e(5f\e(B")
430 (?\x094d . "\e(5h\e(B")
431 (?\x094e . "[U+094e]")
432 (?\x094f . "[U+094f]")
433 (?\x0950 . "\e(5!i\e(B")
434 (?\x0951 . "\e(5p5\e(B")
435 (?\x0952 . "\e(5p8\e(B")
436 (?\x0953 . "[DEVANAGARI GRAVE ACCENT]")
437 (?\x0954 . "[DEVANAGARI ACUTE ACCENT]")
438 (?\x0955 . "[U+0955]")
439 (?\x0956 . "[U+0956]")
440 (?\x0957 . "[U+0957]")
441 (?\x0958 . "\e(53i\e(B")
442 (?\x0959 . "\e(54i\e(B")
443 (?\x095a . "\e(55i\e(B")
444 (?\x095b . "\e(5:i\e(B")
445 (?\x095c . "\e(5?i\e(B")
446 (?\x095d . "\e(5@i\e(B")
447 (?\x095e . "\e(5Ii\e(B")
448 (?\x095f . "\e(5N\e(B")
449 (?\x0960 . "\e(5*i\e(B")
450 (?\x0961 . "\e(5'i\e(B")
451 (?\x0962 . "\e(5[i\e(B")
452 (?\x0963 . "\e(5ei\e(B")
453 (?\x0964 . "\e(5j\e(B")
454 (?\x0965 . "\e(5jj\e(B")
455 (?\x0966 . "\e(5q\e(B")
456 (?\x0967 . "\e(5r\e(B")
457 (?\x0968 . "\e(5s\e(B")
458 (?\x0969 . "\e(5t\e(B")
459 (?\x096a . "\e(5u\e(B")
460 (?\x096b . "\e(5v\e(B")
461 (?\x096c . "\e(5w\e(B")
462 (?\x096d . "\e(5x\e(B")
463 (?\x096e . "\e(5y\e(B")
464 (?\x096f . "\e(5z\e(B")
465 (?\x0970 . "[U+0970]")
466 (?\x0971 . "[U+0971]")
467 (?\x0972 . "[U+0972]")
468 (?\x0973 . "[U+0973]")
469 (?\x0974 . "[U+0974]")
470 (?\x0975 . "[U+0975]")
471 (?\x0976 . "[U+0976]")
472 (?\x0977 . "[U+0977]")
473 (?\x0978 . "[U+0978]")
474 (?\x0979 . "[U+0979]")
475 (?\x097a . "[U+097a]")
476 (?\x097b . "[U+097b]")
477 (?\x097c . "[U+097c]")
478 (?\x097d . "[U+097d]")
479 (?\x097e . "[U+097e]")
480 (?\x097f . "[U+097f]")))
481
482 (defvar ucs-bengali-to-is13194-alist nil)
483 (defvar ucs-assamese-to-is13194-alist nil)
484 (defvar ucs-gurmukhi-to-is13194-alist nil)
485 (defvar ucs-gujarati-to-is13194-alist nil)
486 (defvar ucs-oriya-to-is13194-alist nil)
487 (defvar ucs-tamil-to-is13194-alist nil)
488 (defvar ucs-telugu-to-is13194-alist nil)
489 (defvar ucs-malayalam-to-is13194-alist nil)
490
491 (defvar is13194-default-repartory 'devanagari)
492
493 (defvar is13194-repertory-to-ucs-script
494 `((DEF ?\x40 ,is13194-default-repartory)
495 (RMN ?\x41 ,is13194-default-repartory)
496 (DEV ?\x42 devanagari)
497 (BNG ?\x43 bengali)
498 (TML ?\x44 tamil)
499 (TLG ?\x45 telugu)
500 (ASM ?\x46 bengali)
501 (ORI ?\x47 oriya)
502 (KND ?\x48 kannada)
503 (MLM ?\x49 malayalam)
504 (GJR ?\x4a gujarati)
505 (PNJ ?\x4b gurmukhi)))
506
507 ;; for guiding find-variable function.
508 (defvar is13194-to-ucs-devanagari-hashtbl nil)
509 (defvar is13194-to-ucs-devanagari-regexp nil)
510 (defvar is13194-to-ucs-bengali-hashtbl nil)
511 (defvar is13194-to-ucs-bengali-regexp nil)
512 (defvar is13194-to-ucs-assamese-hashtbl nil)
513 (defvar is13194-to-ucs-assamese-regexp nil)
514 (defvar is13194-to-ucs-gurmukhi-hashtbl nil)
515 (defvar is13194-to-ucs-gurmukhi-regexp nil)
516 (defvar is13194-to-ucs-gujarati-hashtbl nil)
517 (defvar is13194-to-ucs-gujarati-regexp nil)
518 (defvar is13194-to-ucs-oriya-hashtbl nil)
519 (defvar is13194-to-ucs-oriya-regexp nil)
520 (defvar is13194-to-ucs-tamil-hashtbl nil)
521 (defvar is13194-to-ucs-tamil-regexp nil)
522 (defvar is13194-to-ucs-telugu-hashtbl nil)
523 (defvar is13194-to-ucs-telugu-regexp nil)
524 (defvar is13194-to-ucs-malayalam-hashtbl nil)
525 (defvar is13194-to-ucs-malayalam-regexp nil)
526
527 (mapc
528 (function (lambda (script)
529 (let ((hashtable (intern (concat "is13194-to-ucs-"
530 (symbol-name script) "-hashtbl" )))
531 (regexp (intern (concat "is13194-to-ucs-"
532 (symbol-name script) "-regexp"))))
533 (set hashtable (make-hash-table :test 'equal :size 128))
534 (mapc
535 (function (lambda (x)
536 (put-char-code-property (decode-char 'ucs (car x))
537 'script script)
538 (put-char-code-property (decode-char 'ucs (car x))
539 'iscii (cdr x))
540 (puthash (cdr x) (char-to-string (decode-char 'ucs (car x)))
541 (eval hashtable))))
542 (eval (intern (concat "ucs-" (symbol-name script)
543 "-to-is13194-alist"))))
544 (set regexp (regexp-of-hashtbl-keys (eval hashtable))))))
545 '(devanagari bengali assamese gurmukhi gujarati
546 oriya tamil telugu malayalam))
547
548 (defvar ucs-to-is13194-regexp
549 ;; only Devanagari is supported now.
550 (concat "[" (char-to-string (decode-char 'ucs #x0900))
551 "-" (char-to-string (decode-char 'ucs #x097f)) "]")
552 "Regexp that matches to conversion")
553
554 (defun ucs-to-iscii-region (from to)
555 "Converts the indian UCS characters in the region to ISCII.
556 Returns new end position."
557 (interactive "r")
558 ;; only Devanagari is supported now.
559 (save-excursion
560 (save-restriction
561 (narrow-to-region from to)
562 (goto-char (point-min))
563 (let* ((current-repertory is13194-default-repartory))
564 (while (re-search-forward ucs-to-is13194-regexp nil t)
565 (replace-match
566 (get-char-code-property (string-to-char (match-string 0))
567 'iscii))))
568 (point-max))))
569
570 (defun iscii-to-ucs-region (from to)
571 "Converts the ISCII characters in the region to UCS.
572 Returns new end position."
573 (interactive "r")
574 ;; only Devanagari is supported now.
575 (save-excursion
576 (save-restriction
577 (narrow-to-region from to)
578 (goto-char (point-min))
579 (let* ((current-repertory is13194-default-repartory)
580 (current-hashtable
581 (intern (concat "is13194-to-ucs-"
582 (symbol-name current-repertory) "-hashtbl")))
583 (current-regexp
584 (intern (concat "is13194-to-ucs-"
585 (symbol-name current-repertory) "-regexp"))))
586 (while (re-search-forward (eval current-regexp) nil t)
587 (replace-match
588 (gethash (match-string 0) (eval current-hashtable) ""))))
589 (point-max))))
590
591 ;;;###autoload
592 (defun indian-compose-region (from to)
593 "Compose the region according to `composition-function-table'. "
594 (interactive "r")
595 (save-excursion
596 (save-restriction
597 (let ((pos from) chars (max to))
598 (narrow-to-region from to)
599 (while (< pos max)
600 (setq chars (compose-chars-after pos))
601 (if chars (setq pos (+ pos chars)) (setq pos (1+ pos))))))))
602
603 ;;;###autoload
604 (defun indian-compose-string (string)
605 (with-temp-buffer
606 (insert string)
607 (indian-compose-region (point-min) (point-max))
608 (buffer-string)))
609
610 ;;;###autoload
611 (defun in-is13194-post-read-conversion (len)
612 (let ((pos (point)) endpos)
613 (setq endpos (iscii-to-ucs-region pos (+ pos len)))
614 (indian-compose-region pos endpos)
615 (- endpos pos)))
616
617 ;;;###autoload
618 (defun in-is13194-pre-write-conversion (from to)
619 (let ((buf (current-buffer)))
620 (set-buffer (generate-new-buffer " *temp*"))
621 (if (stringp from)
622 (insert from)
623 (insert-buffer-substring buf from to))
624 (ucs-to-iscii-region (point-min) (point-max))
625 nil))
626
627
628
629
630 ;;; Backward Compatibility support programs
631
632 ;; The followings provides the conversion from old-implementation of
633 ;; Emacs Devanagari script to UCS.
634
635 (defconst indian-2-colum-to-ucs
636 '(
637 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
638 ;;2120 \e$(5!!!"!#!$!%!&!'!(!)!*!+!,!-!.!/\e(B
639 ("\e$(5!!\e(B" . "\e$,15A\e(B")
640 ("\e$(5!"\e(B" . "\e$,15B\e(B")
641 ("\e$(5!#\e(B" . "\e$,15C\e(B")
642 ("\e$(5!$\e(B" . "\e$,15E\e(B")
643 ("\e$(5!%\e(B" . "\e$,15F\e(B")
644 ("\e$(5!&\e(B" . "\e$,15G\e(B")
645 ("\e$(5!'\e(B" . "\e$,15H\e(B")
646 ("\e$(5!(\e(B" . "\e$,15I\e(B")
647 ("\e$(5!)\e(B" . "\e$,15J\e(B")
648 ("\e$(5!*\e(B" . "\e$,15K\e(B")
649 ("\e$(5!*"p\e(B" . "\e$,15p6#\e(B")
650 ("\e$(5!+\e(B" . "\e$,15N\e(B")
651 ("\e$(5!,\e(B" . "\e$,15O\e(B")
652 ("\e$(5!-\e(B" . "\e$,15P\e(B")
653 ("\e$(5!.\e(B" . "\e$,15M\e(B")
654 ("\e$(5!/\e(B" . "\e$,15R\e(B")
655 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
656 ;;2130 \e$(5!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?\e(B
657 ("\e$(5!0\e(B" . "\e$,15S\e(B")
658 ("\e$(5!1\e(B" . "\e$,15T\e(B")
659 ("\e$(5!2\e(B" . "\e$,15Q\e(B")
660 ("\e$(5!3\e(B" . "\e$,15U\e(B")
661 ("\e$(5!4\e(B" . "\e$,15V\e(B")
662 ("\e$(5!5\e(B" . "\e$,15W\e(B")
663 ("\e$(5!6\e(B" . "\e$,15X\e(B")
664 ("\e$(5!7\e(B" . "\e$,15Y\e(B")
665 ("\e$(5!8\e(B" . "\e$,15Z\e(B")
666 ("\e$(5!9\e(B" . "\e$,15[\e(B")
667 ("\e$(5!:\e(B" . "\e$,15\\e(B")
668 ("\e$(5!;\e(B" . "\e$,15]\e(B")
669 ("\e$(5!<\e(B" . "\e$,15^\e(B")
670 ("\e$(5!=\e(B" . "\e$,15_\e(B")
671 ("\e$(5!>\e(B" . "\e$,15`\e(B")
672 ("\e$(5!?\e(B" . "\e$,15a\e(B")
673 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
674 ;;2140 \e$(5!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O\e(B
675 ("\e$(5!@\e(B" . "\e$,15b\e(B")
676 ("\e$(5!A\e(B" . "\e$,15c\e(B")
677 ("\e$(5!B\e(B" . "\e$,15d\e(B")
678 ("\e$(5!C\e(B" . "\e$,15e\e(B")
679 ("\e$(5!D\e(B" . "\e$,15f\e(B")
680 ("\e$(5!E\e(B" . "\e$,15g\e(B")
681 ("\e$(5!F\e(B" . "\e$,15h\e(B")
682 ("\e$(5!G\e(B" . "\e$,15i\e(B")
683 ("\e$(5!H\e(B" . "\e$,15j\e(B")
684 ("\e$(5!I\e(B" . "\e$,15k\e(B")
685 ("\e$(5!J\e(B" . "\e$,15l\e(B")
686 ("\e$(5!K\e(B" . "\e$,15m\e(B")
687 ("\e$(5!L\e(B" . "\e$,15n\e(B")
688 ("\e$(5!M\e(B" . "\e$,15o\e(B")
689 ("\e$(5!N\e(B" . "\e$,16?\e(B")
690 ("\e$(5!O\e(B" . "\e$,15p\e(B")
691 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
692 ;;2150 \e$(5!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_\e(B
693 ("\e$(5!P\e(B" . "\e$,15q\e(B")
694 ("\e$(5!Q\e(B" . "\e$,15r\e(B")
695 ("\e$(5!R\e(B" . "\e$,15s\e(B")
696 ("\e$(5!S\e(B" . "\e$,15t\e(B")
697 ("\e$(5!T\e(B" . "\e$,15u\e(B")
698 ("\e$(5!U\e(B" . "\e$,15v\e(B")
699 ("\e$(5!V\e(B" . "\e$,15w\e(B")
700 ("\e$(5!W\e(B" . "\e$,15x\e(B")
701 ("\e$(5!X\e(B" . "\e$,15y\e(B")
702 ("\e$(5!Z\e(B" . "\e$,15~\e(B")
703 ("\e$(5![\e(B" . "\e$,15\7f\e(B")
704 ("\e$(5!\\e(B" . "\e$,16 \e(B")
705 ("\e$(5!]\e(B" . "\e$,16!\e(B")
706 ("\e$(5!^\e(B" . "\e$,16"\e(B")
707 ("\e$(5!_\e(B" . "\e$,16#\e(B")
708 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
709 ;;2160 \e$(5!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o\e(B
710 ("\e$(5!`\e(B" . "\e$,16&\e(B")
711 ("\e$(5!a\e(B" . "\e$,16'\e(B")
712 ("\e$(5!b\e(B" . "\e$,16(\e(B")
713 ("\e$(5!c\e(B" . "\e$,16%\e(B")
714 ("\e$(5!d\e(B" . "\e$,16*\e(B")
715 ("\e$(5!e\e(B" . "\e$,16+\e(B")
716 ("\e$(5!f\e(B" . "\e$,16,\e(B")
717 ("\e$(5!g\e(B" . "\e$,16)\e(B")
718 ("\e$(5!h\e(B" . "\e$,16-\e(B")
719 ("\e$(5!i\e(B" . "\e$,15|\e(B")
720 ("\e$(5!j\e(B" . "\e$,16D\e(B")
721 ("\e$(5!j!j\e(B" . "\e$,16E\e(B")
722 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
723 ;;2170 \e$(5!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~\e(B
724 ("\e$(5!q\e(B" . "\e$,16F\e(B")
725 ("\e$(5!r\e(B" . "\e$,16G\e(B")
726 ("\e$(5!s\e(B" . "\e$,16H\e(B")
727 ("\e$(5!t\e(B" . "\e$,16I\e(B")
728 ("\e$(5!u\e(B" . "\e$,16J\e(B")
729 ("\e$(5!v\e(B" . "\e$,16K\e(B")
730 ("\e$(5!w\e(B" . "\e$,16L\e(B")
731 ("\e$(5!x\e(B" . "\e$,16M\e(B")
732 ("\e$(5!y\e(B" . "\e$,16N\e(B")
733 ("\e$(5!z\e(B" . "\e$,16O\e(B")
734 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
735 ;;2220 \e$(5"!"""#"$"%"&"'"(")"*"+","-"."/\e(B
736 ("\e$(5"!\e(B" . "\e$,16;6-5p\e(B")
737 ("\e$(5""\e(B" . "\e$,16>6-5p\e(B")
738 ("\e$(5"#\e(B" . "\e$,15U6-5p\e(B")
739 ("\e$(5"$\e(B" . "\e$,15W6-5p\e(B")
740 ("\e$(5"%\e(B" . "\e$,15d6-5p\e(B")
741 ("\e$(5"&\e(B" . "\e$,15j6-5p\e(B")
742 ("\e$(5"'\e(B" . "\e$,15k6-5p\e(B")
743 ("\e$(5")\e(B" . "\e$,15v6-5p\e(B")
744 ("\e$(5",\e(B" . "\e$,15p6!\e(B")
745 ("\e$(5"-\e(B" . "\e$,15p6"\e(B")
746 ("\e$(5".\e(B" . "\e$,15q6!\e(B")
747 ("\e$(5"/\e(B" . "\e$,15q6"\e(B")
748 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
749 ;;2230 \e$(5"0"1"2"3"4"5"6"7"8"9":";"<"=">"?\e(B
750 ("\e$(5"3\e(B" . "\e$,15U6-\e(B")
751 ("\e$(5"4\e(B" . "\e$,15V6-\e(B")
752 ("\e$(5"5\e(B" . "\e$,15W6-\e(B")
753 ("\e$(5"6\e(B" . "\e$,15X6-\e(B")
754 ("\e$(5"8\e(B" . "\e$,15Z6-\e(B")
755 ("\e$(5"8"q\e(B" . "\e$,15Z6-5p6-\e(B")
756 ("\e$(5":\e(B" . "\e$,15\6-\e(B")
757 ("\e$(5";\e(B" . "\e$,15]6-\e(B")
758 ("\e$(5"<\e(B" . "\e$,15^6-\e(B")
759 ("\e$(5"<\e(B" . "\e$,15^6-\e(B")
760 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
761 ;;2240 \e$(5"@"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O\e(B
762 ("\e$(5"A\e(B" . "\e$,15c6-\e(B")
763 ("\e$(5"B\e(B" . "\e$,15d6-\e(B")
764 ("\e$(5"C\e(B" . "\e$,15e6-\e(B")
765 ("\e$(5"E\e(B" . "\e$,15g6-\e(B")
766 ("\e$(5"F\e(B" . "\e$,15h6-\e(B")
767 ("\e$(5"G\e(B" . "\e$,15i6-\e(B")
768 ("\e$(5"H\e(B" . "\e$,15j6-\e(B")
769 ("\e$(5"I\e(B" . "\e$,15k6-\e(B")
770 ("\e$(5"J\e(B" . "\e$,15l6-\e(B")
771 ("\e$(5"J\e(B" . "\e$,15l6-\e(B")
772 ("\e$(5"K\e(B" . "\e$,15m6-\e(B")
773 ("\e$(5"L\e(B" . "\e$,15n6-\e(B")
774 ("\e$(5"M\e(B" . "\e$,15o6-\e(B")
775 ("\e$(5"N\e(B" . "\e$,16?6-\e(B")
776 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
777 ;;2250 \e$(5"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_\e(B
778 ("\e$(5"Q\e(B" . "\e$,15r6-\e(B")
779 ("\e$(5"R\e(B" . "\e$,15s6-\e(B")
780 ("\e$(5"S\e(B" . "\e$,15t6-\e(B")
781 ("\e$(5"T\e(B" . "\e$,15u6-\e(B")
782 ("\e$(5"U\e(B" . "\e$,15v6-\e(B")
783 ("\e$(5"V\e(B" . "\e$,15w6-\e(B")
784 ("\e$(5"W\e(B" . "\e$,15x6-\e(B")
785 ("\e$(5"]\e(B" . "\e$,16-5o\e(B")
786 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
787 ;;2260 \e$(5"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o\e(B
788 ("\e$(5"`\e(B" . "\e$,15W6-5p6-\e(B")
789 ("\e$(5"a\e(B" . "\e$,15X6-5h6-\e(B")
790 ("\e$(5"c\e(B" . "\e$,15d6-5d6-\e(B")
791 ("\e$(5"d\e(B" . "\e$,15d6-5p6-\e(B")
792 ("\e$(5"e\e(B" . "\e$,15g6-5h6-\e(B")
793 ("\e$(5"f\e(B" . "\e$,15g6-5p6-\e(B")
794 ("\e$(5"g\e(B" . "\e$,15j6-5d6-\e(B")
795 ("\e$(5"h\e(B" . "\e$,15v6-5Z6-\e(B")
796 ("\e$(5"i\e(B" . "\e$,15v6-5p6-\e(B")
797 ("\e$(5"j\e(B" . "\e$,15v6-5u6-\e(B")
798 ("\e$(5"k\e(B" . "\e$,15h6-5h6-\e(B")
799 ("\e$(5"l\e(B" . "\e$,15U6-5w6-\e(B")
800 ("\e$(5"m\e(B" . "\e$,15\6-5^6-\e(B")
801 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
802 ;;2270 \e$(5"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~\e(B
803 ("\e$(5"p\e(B" . "\e$,15p6-\e(B")
804 ("\e$(5"q\e(B" . "\e$,16-5p\e(B")
805 ("\e$(5"r\e(B" . "\e$,16-5p\e(B")
806 ("\e$(5"s\e(B" . "\e$,1686-\e(B")
807 ("\e$(5"t\e(B" . "\e$,1696-\e(B")
808 ("\e$(5"u\e(B" . "\e$,16:6-\e(B")
809 ("\e$(5"y\e(B" . "\e$,16>6-\e(B")
810 ("\e$(5"z\e(B" . "\e$,16;6-\e(B")
811 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
812 ;;2320 \e$(5#!#"###$#%#&#'#(#)#*#+#,#-#.#/\e(B
813 ("\e$(5#!\e(B" . "\e$,160\e(B")
814 ("\e$(5#&\e(B" . "\e$,15L\e(B")
815 ("\e$(5#&"p\e(B" . "\e$,15p6$\e(B")
816 ("\e$(5#'\e(B" . "\e$,16A\e(B")
817 ("\e$(5#'"p\e(B" . "\e$,15p6C\e(B")
818 ("\e$(5#*\e(B" . "\e$,16@\e(B")
819 ("\e$(5#*"p\e(B" . "\e$,15p6B\e(B")
820 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
821 ;;2330 \e$(5#0#1#2#3#4#5#6#7#8#9#:#;#<#=#>#?\e(B
822 ("\e$(5#3\e(B" . "\e$,168\e(B")
823 ("\e$(5#4\e(B" . "\e$,169\e(B")
824 ("\e$(5#5\e(B" . "\e$,16:\e(B")
825 ("\e$(5#:\e(B" . "\e$,16;\e(B")
826 ("\e$(5#?\e(B" . "\e$,16<\e(B")
827 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
828 ;;2340 \e$(5#@#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O\e(B
829 ("\e$(5#@\e(B" . "\e$,16=\e(B")
830 ("\e$(5#I\e(B" . "\e$,16>\e(B")
831 ("\e$(5#J\e(B" . "\e$,15}\e(B")
832 ("\e$(5#K\e(B" . "\e$,16$\e(B")
833 ("\e$(5#L\e(B" . "\e$,16B\e(B")
834 ("\e$(5#M\e(B" . "\e$,16C\e(B")
835 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
836 ;;2350 \e$(5#P#Q#R#S#T#U#V#W#X#Y#Z#[#\#]#^#_\e(B
837 ("\e$(5#P\e(B" . "\e$,15n6-5h\e(B")
838 ("\e$(5#Q\e(B" . "\e$,15n6-5r\e(B")
839 ("\e$(5#R\e(B" . "\e$,15y6#\e(B")
840 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
841 ;;2360 \e$(5#`#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o\e(B
842 ("\e$(5#`\e(B" . "\e$,15r6-5r\e(B")
843 ("\e$(5#a\e(B" . "\e$,15u6-5h\e(B")
844 ("\e$(5#b\e(B" . "\e$,15u6-5u\e(B")
845 ("\e$(5#c\e(B" . "\e$,15v6-5Z\e(B")
846 ("\e$(5#d\e(B" . "\e$,15v6-5h\e(B")
847 ("\e$(5#e\e(B" . "\e$,15v6-5l\e(B")
848 ("\e$(5#f\e(B" . "\e$,15v6-5r\e(B")
849 ("\e$(5#g\e(B" . "\e$,15v6-5u\e(B")
850 ("\e$(5#h\e(B" . "\e$,15w6-5_6-5p6-5o\e(B")
851 ("\e$(5#i\e(B" . "\e$,15w6-5_6-5o\e(B")
852 ("\e$(5#j\e(B" . "\e$,15w6-5_6-5u\e(B")
853 ("\e$(5#k\e(B" . "\e$,15w6-5_\e(B")
854 ("\e$(5#l\e(B" . "\e$,15w6-5`\e(B")
855 ("\e$(5#m\e(B" . "\e$,15x6-5h\e(B")
856 ("\e$(5#n\e(B" . "\e$,15x6-5p\e(B")
857 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
858 ;;2370 \e$(5#p#q#r#s#t#u#v#w#x#y#z#{#|#}#~\e(B
859 ("\e$(5#p\e(B" . "\e$,15y6-5c\e(B")
860 ("\e$(5#q\e(B" . "\e$,15y6-5h\e(B")
861 ("\e$(5#r\e(B" . "\e$,15y6-5n\e(B")
862 ("\e$(5#s\e(B" . "\e$,15y6-5o\e(B")
863 ("\e$(5#t\e(B" . "\e$,15y6-5p\e(B")
864 ("\e$(5#u\e(B" . "\e$,15y6-5r\e(B")
865 ("\e$(5#v\e(B" . "\e$,15y6-5u\e(B")
866 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
867 ;;2420 \e$(5$!$"$#$$$%$&$'$($)$*$+$,$-$.$/\e(B
868 ("\e$(5$!\e(B" . "\e$,15U6-5d6-5p6-5o\e(B")
869 ("\e$(5$"\e(B" . "\e$,15U6-5d6-5u\e(B")
870 ("\e$(5$#\e(B" . "\e$,15U6-5d6-5o\e(B")
871 ("\e$(5$$\e(B" . "\e$,15U6-5h6-5o\e(B")
872 ("\e$(5$%\e(B" . "\e$,15U6-5p6-5o\e(B")
873 ("\e$(5$&\e(B" . "\e$,15U6-5u6-5o\e(B")
874 ("\e$(5$'\e(B" . "\e$,15U6-5U\e(B")
875 ("\e$(5$(\e(B" . "\e$,15U6-5d\e(B")
876 ("\e$(5$)\e(B" . "\e$,15U6-5h\e(B")
877 ("\e$(5$*\e(B" . "\e$,15U6-5n\e(B")
878 ("\e$(5$+\e(B" . "\e$,15U6-5o\e(B")
879 ("\e$(5$,\e(B" . "\e$,15U6-5r\e(B")
880 ("\e$(5$-\e(B" . "\e$,15U6-5u\e(B")
881 ("\e$(5$.\e(B" . "\e$,15U6-5w\e(B")
882 ("\e$(5$/\e(B" . "\e$,15X6-5h\e(B")
883 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
884 ;;2430 \e$(5$0$1$2$3$4$5$6$7$8$9$:$;$<$=$>$?\e(B
885 ("\e$(5$0\e(B" . "\e$,15Y6-5U6-5d6-5o\e(B")
886 ("\e$(5$1\e(B" . "\e$,15Y6-5U6-5w6-5u\e(B")
887 ("\e$(5$2\e(B" . "\e$,15Y6-5U6-5d\e(B")
888 ("\e$(5$3\e(B" . "\e$,15Y6-5U6-5w\e(B")
889 ("\e$(5$4\e(B" . "\e$,15Y6-5X6-5p\e(B")
890 ("\e$(5$5\e(B" . "\e$,15Y6-5U6-5o\e(B")
891 ("\e$(5$6\e(B" . "\e$,15Y6-5V6-5o\e(B")
892 ("\e$(5$7\e(B" . "\e$,15Y6-5W6-5o\e(B")
893 ("\e$(5$8\e(B" . "\e$,15Y6-5X6-5o\e(B")
894 ("\e$(5$9\e(B" . "\e$,15Y6-5U\e(B")
895 ("\e$(5$:\e(B" . "\e$,15Y6-5V\e(B")
896 ("\e$(5$;\e(B" . "\e$,15Y6-5W\e(B")
897 ("\e$(5$<\e(B" . "\e$,15Y6-5X\e(B")
898 ("\e$(5$=\e(B" . "\e$,15Y6-5Y\e(B")
899 ("\e$(5$>\e(B" . "\e$,15Y6-5h\e(B")
900 ("\e$(5$?\e(B" . "\e$,15Y6-5n\e(B")
901 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
902 ;;2440 \e$(5$@$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O\e(B
903 ("\e$(5$@\e(B" . "\e$,15Y6-5o\e(B")
904 ("\e$(5$A\e(B" . "\e$,15Z6-5Z\e(B")
905 ("\e$(5$B\e(B" . "\e$,15Z6-5^\e(B")
906 ("\e$(5$C\e(B" . "\e$,15[6-5o\e(B")
907 ("\e$(5$D\e(B" . "\e$,15\6-5p\e(B")
908 ("\e$(5$E\e(B" . "\e$,15\6-5^\e(B")
909 ("\e$(5$F\e(B" . "\e$,15^6-5Z\e(B")
910 ("\e$(5$G\e(B" . "\e$,15^6-5\\e(B")
911 ("\e$(5$H\e(B" . "\e$,15_6-5U\e(B")
912 ("\e$(5$I\e(B" . "\e$,15_6-5_\e(B")
913 ("\e$(5$J\e(B" . "\e$,15_6-5`\e(B")
914 ("\e$(5$K\e(B" . "\e$,15_6-5o\e(B")
915 ("\e$(5$L\e(B" . "\e$,15`6-5o\e(B")
916 ("\e$(5$M\e(B" . "\e$,15a6-5W6-5o\e(B")
917 ("\e$(5$N\e(B" . "\e$,15a6-5X6-5p\e(B")
918 ("\e$(5$O\e(B" . "\e$,15a6-5p6-5o\e(B")
919 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
920 ;;2450 \e$(5$P$Q$R$S$T$U$V$W$X$Y$Z$[$\$]$^$_\e(B
921 ("\e$(5$P\e(B" . "\e$,15a6-5W\e(B")
922 ("\e$(5$Q\e(B" . "\e$,15a6-5X\e(B")
923 ("\e$(5$R\e(B" . "\e$,15a6-5a\e(B")
924 ("\e$(5$S\e(B" . "\e$,15a6-5n\e(B")
925 ("\e$(5$T\e(B" . "\e$,15a6-5o\e(B")
926 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
927 ;;2460 \e$(5$`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o\e(B
928 ("\e$(5$`\e(B" . "\e$,15b6-5o\e(B")
929 ("\e$(5$a\e(B" . "\e$,15d6-5d\e(B")
930 ("\e$(5$b\e(B" . "\e$,15d6-5h\e(B")
931 ("\e$(5$c\e(B" . "\e$,15f6-5f6-5o\e(B")
932 ("\e$(5$d\e(B" . "\e$,15f6-5g6-5o\e(B")
933 ("\e$(5$e\e(B" . "\e$,15f6-5m6-5o\e(B")
934 ("\e$(5$f\e(B" . "\e$,15f6-5p6-5o\e(B")
935 ("\e$(5$g\e(B" . "\e$,15f6-5u6-5o\e(B")
936 ("\e$(5$h\e(B" . "\e$,15f6-5W6-5p\e(B")
937 ("\e$(5$i\e(B" . "\e$,15f6-5X6-5p\e(B")
938 ("\e$(5$j\e(B" . "\e$,15f6-5f6-5u\e(B")
939 ("\e$(5$k\e(B" . "\e$,15f6-5g6-5u\e(B")
940 ("\e$(5$l\e(B" . "\e$,15f6-5W\e(B")
941 ("\e$(5$m\e(B" . "\e$,15f6-5X\e(B")
942 ("\e$(5$n\e(B" . "\e$,15f6-5f\e(B")
943 ("\e$(5$o\e(B" . "\e$,15f6-5g\e(B")
944 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
945 ;;2470 \e$(5$p$q$r$s$t$u$v$w$x$y$z${$|$}$~\e(B
946 ("\e$(5$p\e(B" . "\e$,15f6-5h\e(B")
947 ("\e$(5$q\e(B" . "\e$,15f6-5l\e(B")
948 ("\e$(5$r\e(B" . "\e$,15f6-5m\e(B")
949 ("\e$(5$s\e(B" . "\e$,15f6-5n\e(B")
950 ("\e$(5$t\e(B" . "\e$,15f6-5o\e(B")
951 ("\e$(5$u\e(B" . "\e$,15f6-5u\e(B")
952 ("\e$(5$v\e(B" . "\e$,15g6-5h\e(B")
953 ("\e$(5$w\e(B" . "\e$,15h6-5h\e(B")
954 ("\e$(5$x\e(B" . "\e$,15j6-5d\e(B")
955 ("\e$(5$y\e(B" . "\e$,15j6-5h\e(B")
956 ("\e$(5$z\e(B" . "\e$,15j6-5r\e(B")
957 ("\e$(5${\e(B" . "\e$,15l6-5h\e(B")
958 ("\e$(5$|\e(B" . "\e$,15l6-5l\e(B")
959 ("\e$(5$}\e(B" . "\e$,15l6-5u\e(B")
960 ("\e$(5$~\e(B" . "\e$,15m6-5h\e(B")))
961
962 (defconst indian-2-column-to-ucs-regexp
963 "\e$(5!j!j\e(B\\|\e$(5"8"q\e(B\\|[\e$(5#&#'!*#*\e(B]\e$(5"p\e(B\\|[\e$(5!!\e(B-\e$(5$~\e(B]")
964
965 (put 'indian-2-column-to-ucs-chartable 'char-table-extra-slots 1)
966 (defconst indian-2-column-to-ucs-chartable
967 (let ((table (make-char-table 'indian-2-column-to-ucs-chartable))
968 (alist nil))
969 (dolist (elt indian-2-colum-to-ucs)
970 (if (= (length (car elt)) 1)
971 (aset table (aref (car elt) 0) (cdr elt))
972 (setq alist (cons elt alist))))
973 (set-char-table-extra-slot table 0 alist)
974 table))
975
976 (defun indian-2-column-to-ucs-region (from to)
977 "Convert old Emacs Devanagari characters to UCS."
978 (interactive "r")
979 (save-excursion
980 (save-restriction
981 (let ((pos from)
982 (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0)))
983 (narrow-to-region from to)
984 (decompose-region from to)
985 (goto-char (point-min))
986 (while (re-search-forward indian-2-column-to-ucs-regexp nil t)
987 (let ((len (- (match-end 0) (match-beginning 0)))
988 subst)
989 (if (= len 1)
990 (setq subst (aref indian-2-column-to-ucs-chartable (char-after (match-beginning 0))))
991 (setq subst (assoc (match-string 0) alist)))
992 (replace-match (if subst subst "?"))))
993 (indian-compose-region (point-min) (point-max))))))
994
995 (provide 'ind-util)
996
997 ;;; ind-util.el ends here