(ediff-copy-list): Use `defalias' instead of
[emacs.git] / lisp / language / ind-util.el
blobaa40f6d02fb4668f2b85d3239fdaab9b1bb8daa9
1 ;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: iso-2022-7bit; -*-
3 ;; Copyright (C) 2001 Free Software Foundation, Inc.
5 ;; Maintainer: KAWABATA, Taichi <batta@beige.ocn.ne.jp>
6 ;; Keywords: multilingual, Indian, Devanagari
8 ;; This file is part of GNU Emacs.
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.
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.
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.
25 ;;; Commentary:
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.
33 ;;; Code:
35 ;;; Transliteration
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.
41 (eval-and-compile
43 (defun indian-regexp-of-hashtbl-keys (hashtbl)
44 "Returns the regular expression of hashtable keys."
45 (let ((max-specpdl-size 1000))
46 (regexp-opt
47 (sort
48 (let (dummy)
49 (maphash (function (lambda (key val) (setq dummy (cons key dummy))))
50 hashtbl)
51 dummy)
52 (function (lambda (x y) (> (length x) (length y))))))))
54 (defvar indian-dev-base-table
56 (;; VOWELS (18)
57 (?\e$,15E\e(B nil) (?\e$,15F\e(B ?\e$,15~\e(B) (?\e$,15G\e(B ?\e$,15\x7f\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)
58 (?\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)
59 (?\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))
60 (;; CONSONANTS (currently 42, including special cases)
61 ?\e$,15U\e(B ?\e$,15V\e(B ?\e$,15W\e(B ?\e$,15X\e(B ?\e$,15Y\e(B ;; GUTTRULS
62 ?\e$,15Z\e(B ?\e$,15[\e(B ?\e$,15\\e(B ?\e$,15]\e(B ?\e$,15^\e(B ;; PALATALS
63 ?\e$,15_\e(B ?\e$,15`\e(B ?\e$,15a\e(B ?\e$,15b\e(B ?\e$,15c\e(B ;; CEREBRALS
64 ?\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
65 ?\e$,15j\e(B ?\e$,15k\e(B ?\e$,15l\e(B ?\e$,15m\e(B ?\e$,15n\e(B ;; LABIALS
66 ?\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
67 ?\e$,15v\e(B ?\e$,15w\e(B ?\e$,15x\e(B ?\e$,15y\e(B ;; SIBILANTS
68 ?\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
69 "\e$,15\6-5^\e(B" "\e$,15U6-5w\e(B")
70 (;; Misc Symbols (7)
71 ?\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)
72 (;; Digits (10)
73 ?\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)
74 (;; Inscript-extra (4) (#, $, ^, *, ])
75 "\e$,16-5p\e(B" "\e$,15p6-\e(B" "\e$,15d6-5p\e(B" "\e$,15v6-5p\e(B" "\e$,15|\e(B")))
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)
86 (defvar indian-base-table-to-language-alist
87 '((indian-dev-base-table . "Devanagari")
88 (indian-pnj-base-table . "Punjabi")
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")))
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"))
103 (;; consonants -- 40
104 "k" "kh" "g" "gh" ("~N" "N^")
105 "ch" ("Ch" "chh") "j" "jh" ("~n" "JN")
106 "T" "Th" "D" "Dh" "N"
107 "t" "th" "d" "dh" "n" "nh"
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") "..")))
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)))
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)))
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)))
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)))
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
199 (mapcar
200 (lambda (x)
201 (apply
202 'mapthread
203 `(lambda (&rest y) (apply ',function x y))
204 seqrest))
205 seq1)
206 (mapcar function seq1)))
208 (defun indian--puthash-char (char trans-char hashtbls)
209 (let ((encode-hash (car hashtbls)) ;; char -> trans
210 (decode-hash (cdr hashtbls)) ;; trans -> char
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)))
216 (if (char-valid-p char) (setq char (char-to-string char)))
217 (puthash char (car trans-char) encode-hash)
218 (mapc
219 (lambda (trans)
220 (puthash trans char decode-hash))
221 trans-char))))
223 (defun indian--map (f l1 l2)
224 (while l1
225 (funcall f (pop l1) (pop l2))))
227 (defun indian--puthash-v (v trans-v hashtbls)
228 (indian--map
229 (lambda (v trans-v)
230 (indian--puthash-char (car v) trans-v hashtbls))
231 v trans-v))
233 (defun indian--puthash-c (c trans-c halant hashtbls)
234 (indian--map
235 (lambda (c trans-c)
236 (if (char-valid-p c) (setq c (char-to-string c)))
237 (indian--puthash-char (concat c halant) trans-c hashtbls))
238 c trans-c))
240 (defun indian--puthash-m (m trans-m hashtbls)
241 (indian--map
242 (lambda (m trans-m)
243 (indian--puthash-char m trans-m hashtbls))
244 m trans-m))
246 (defun indian--puthash-cv (c trans-c v trans-v hashtbls)
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)
252 (if (char-valid-p c) (setq c (char-to-string c)))
253 (setq v (if (char-valid-p (cadr v)) (char-to-string (cadr v)) ""))
254 (if (stringp trans-c) (setq trans-c (list trans-c)))
255 (if (stringp trans-v) (setq trans-v (list trans-v)))
256 (indian--puthash-char
257 (concat c v)
258 (apply 'append
259 (mapthread 'concat trans-c trans-v))
260 hashtbls)))
261 v trans-v))
262 c trans-c))
264 (defun indian-make-hash (table trans-table)
265 "Indian Transliteration Hash for decode/encode"
266 (let* ((encode-hash (make-hash-table :test 'equal))
267 (decode-hash (make-hash-table :test '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)
280 (indian--puthash-cv consonants trans-consonants
281 vowels trans-vowels hashtbls)
282 (indian--puthash-m misc trans-misc hashtbls)
283 (indian--puthash-m digits trans-digits hashtbls)
284 hashtbls))
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))
298 (defmacro indian-translate-region (from to hashtable encode-p)
299 `(save-excursion
300 (save-restriction
301 (let ((regexp ,(indian-regexp-of-hashtbl-keys
302 (if encode-p (car (eval hashtable))
303 (cdr (eval hashtable))))))
304 (narrow-to-region from to)
305 (goto-char (point-min))
306 (while (re-search-forward regexp nil t)
307 (let ((matchstr (gethash (match-string 0)
308 (if ,encode-p
309 (car ,hashtable)
310 (cdr ,hashtable)))))
311 (if matchstr (replace-match matchstr))))))))
315 (defun indian-dev-itrans-v5-encode-region (from to)
316 (interactive "r")
317 (indian-translate-region
318 from to indian-dev-itrans-v5-hash t))
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))
325 (defun indian-dev-kyoto-harvard-encode-region (from to)
326 (interactive "r")
327 (indian-translate-region
328 from to indian-dev-kyoto-harvard-hash t))
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))
335 (defun indian-dev-aiba-encode-region (from to)
336 (interactive "r")
337 (indian-translate-region
338 from to indian-dev-aiba-hash t))
340 (defun indian-dev-aiba-decode-region (from to)
341 (interactive "r")
342 (indian-translate-region
343 from to indian-dev-aiba-hash nil))
348 ;;; IS 13194 utilities
350 ;; The followings provide conversion between IS 13194 (ISCII) and UCS.
352 (defvar ucs-devanagari-to-is13194-alist
353 '(;;Unicode vs IS13194 ;; only Devanagari is supported now.
354 (?\x0900 . "[U+0900]")
355 (?\x0901 . "\e(5!\e(B")
356 (?\x0902 . "\e(5"\e(B")
357 (?\x0903 . "\e(5#\e(B")
358 (?\x0904 . "[U+0904]")
359 (?\x0905 . "\e(5$\e(B")
360 (?\x0906 . "\e(5%\e(B")
361 (?\x0907 . "\e(5&\e(B")
362 (?\x0908 . "\e(5'\e(B")
363 (?\x0909 . "\e(5(\e(B")
364 (?\x090a . "\e(5)\e(B")
365 (?\x090b . "\e(5*\e(B")
366 (?\x090c . "\e(5&i\e(B")
367 (?\x090d . "\e(5.\e(B")
368 (?\x090e . "\e(5+\e(B")
369 (?\x090f . "\e(5,\e(B")
370 (?\x0910 . "\e(5-\e(B")
371 (?\x0911 . "\e(52\e(B")
372 (?\x0912 . "\e(5/\e(B")
373 (?\x0913 . "\e(50\e(B")
374 (?\x0914 . "\e(51\e(B")
375 (?\x0915 . "\e(53\e(B")
376 (?\x0916 . "\e(54\e(B")
377 (?\x0917 . "\e(55\e(B")
378 (?\x0918 . "\e(56\e(B")
379 (?\x0919 . "\e(57\e(B")
380 (?\x091a . "\e(58\e(B")
381 (?\x091b . "\e(59\e(B")
382 (?\x091c . "\e(5:\e(B")
383 (?\x091d . "\e(5;\e(B")
384 (?\x091e . "\e(5<\e(B")
385 (?\x091f . "\e(5=\e(B")
386 (?\x0920 . "\e(5>\e(B")
387 (?\x0921 . "\e(5?\e(B")
388 (?\x0922 . "\e(5@\e(B")
389 (?\x0923 . "\e(5A\e(B")
390 (?\x0924 . "\e(5B\e(B")
391 (?\x0925 . "\e(5C\e(B")
392 (?\x0926 . "\e(5D\e(B")
393 (?\x0927 . "\e(5E\e(B")
394 (?\x0928 . "\e(5F\e(B")
395 (?\x0929 . "\e(5G\e(B")
396 (?\x092a . "\e(5H\e(B")
397 (?\x092b . "\e(5I\e(B")
398 (?\x092c . "\e(5J\e(B")
399 (?\x092d . "\e(5K\e(B")
400 (?\x092e . "\e(5L\e(B")
401 (?\x092f . "\e(5M\e(B")
402 (?\x0930 . "\e(5O\e(B")
403 (?\x0931 . "\e(5P\e(B")
404 (?\x0932 . "\e(5Q\e(B")
405 (?\x0933 . "\e(5R\e(B")
406 (?\x0934 . "\e(5S\e(B")
407 (?\x0935 . "\e(5T\e(B")
408 (?\x0936 . "\e(5U\e(B")
409 (?\x0937 . "\e(5V\e(B")
410 (?\x0938 . "\e(5W\e(B")
411 (?\x0939 . "\e(5X\e(B")
412 (?\x093a . "[U+093a]")
413 (?\x093b . "[U+093b]")
414 (?\x093c . "\e(5i\e(B")
415 (?\x093d . "\e(5ji\e(B")
416 (?\x093e . "\e(5Z\e(B")
417 (?\x093f . "\e(5[\e(B")
418 (?\x0940 . "\e(5\\e(B")
419 (?\x0941 . "\e(5]\e(B")
420 (?\x0942 . "\e(5^\e(B")
421 (?\x0943 . "\e(5_\e(B")
422 (?\x0944 . "\e(5_i\e(B")
423 (?\x0945 . "\e(5c\e(B")
424 (?\x0946 . "\e(5`\e(B")
425 (?\x0947 . "\e(5a\e(B")
426 (?\x0948 . "\e(5b\e(B")
427 (?\x0949 . "\e(5g\e(B")
428 (?\x094a . "\e(5d\e(B")
429 (?\x094b . "\e(5e\e(B")
430 (?\x094c . "\e(5f\e(B")
431 (?\x094d . "\e(5h\e(B")
432 (?\x094e . "[U+094e]")
433 (?\x094f . "[U+094f]")
434 (?\x0950 . "\e(5!i\e(B")
435 (?\x0951 . "\e(5p5\e(B")
436 (?\x0952 . "\e(5p8\e(B")
437 (?\x0953 . "[DEVANAGARI GRAVE ACCENT]")
438 (?\x0954 . "[DEVANAGARI ACUTE ACCENT]")
439 (?\x0955 . "[U+0955]")
440 (?\x0956 . "[U+0956]")
441 (?\x0957 . "[U+0957]")
442 (?\x0958 . "\e(53i\e(B")
443 (?\x0959 . "\e(54i\e(B")
444 (?\x095a . "\e(55i\e(B")
445 (?\x095b . "\e(5:i\e(B")
446 (?\x095c . "\e(5?i\e(B")
447 (?\x095d . "\e(5@i\e(B")
448 (?\x095e . "\e(5Ii\e(B")
449 (?\x095f . "\e(5N\e(B")
450 (?\x0960 . "\e(5*i\e(B")
451 (?\x0961 . "\e(5'i\e(B")
452 (?\x0962 . "\e(5[i\e(B")
453 (?\x0963 . "\e(5ei\e(B")
454 (?\x0964 . "\e(5j\e(B")
455 (?\x0965 . "\e(5jj\e(B")
456 (?\x0966 . "\e(5q\e(B")
457 (?\x0967 . "\e(5r\e(B")
458 (?\x0968 . "\e(5s\e(B")
459 (?\x0969 . "\e(5t\e(B")
460 (?\x096a . "\e(5u\e(B")
461 (?\x096b . "\e(5v\e(B")
462 (?\x096c . "\e(5w\e(B")
463 (?\x096d . "\e(5x\e(B")
464 (?\x096e . "\e(5y\e(B")
465 (?\x096f . "\e(5z\e(B")
466 (?\x0970 . "[U+0970]")
467 (?\x0971 . "[U+0971]")
468 (?\x0972 . "[U+0972]")
469 (?\x0973 . "[U+0973]")
470 (?\x0974 . "[U+0974]")
471 (?\x0975 . "[U+0975]")
472 (?\x0976 . "[U+0976]")
473 (?\x0977 . "[U+0977]")
474 (?\x0978 . "[U+0978]")
475 (?\x0979 . "[U+0979]")
476 (?\x097a . "[U+097a]")
477 (?\x097b . "[U+097b]")
478 (?\x097c . "[U+097c]")
479 (?\x097d . "[U+097d]")
480 (?\x097e . "[U+097e]")
481 (?\x097f . "[U+097f]")))
483 (defvar ucs-bengali-to-is13194-alist nil)
484 (defvar ucs-assamese-to-is13194-alist nil)
485 (defvar ucs-gurmukhi-to-is13194-alist nil)
486 (defvar ucs-gujarati-to-is13194-alist nil)
487 (defvar ucs-oriya-to-is13194-alist nil)
488 (defvar ucs-tamil-to-is13194-alist nil)
489 (defvar ucs-telugu-to-is13194-alist nil)
490 (defvar ucs-malayalam-to-is13194-alist nil)
492 (defvar is13194-default-repartory 'devanagari)
494 (defvar is13194-repertory-to-ucs-script
495 `((DEF ?\x40 ,is13194-default-repartory)
496 (RMN ?\x41 ,is13194-default-repartory)
497 (DEV ?\x42 devanagari)
498 (BNG ?\x43 bengali)
499 (TML ?\x44 tamil)
500 (TLG ?\x45 telugu)
501 (ASM ?\x46 bengali)
502 (ORI ?\x47 oriya)
503 (KND ?\x48 kannada)
504 (MLM ?\x49 malayalam)
505 (GJR ?\x4a gujarati)
506 (PNJ ?\x4b gurmukhi)))
508 ;; for guiding find-variable function.
509 (defvar is13194-to-ucs-devanagari-hashtbl nil)
510 (defvar is13194-to-ucs-devanagari-regexp nil)
511 (defvar is13194-to-ucs-bengali-hashtbl nil)
512 (defvar is13194-to-ucs-bengali-regexp nil)
513 (defvar is13194-to-ucs-assamese-hashtbl nil)
514 (defvar is13194-to-ucs-assamese-regexp nil)
515 (defvar is13194-to-ucs-gurmukhi-hashtbl nil)
516 (defvar is13194-to-ucs-gurmukhi-regexp nil)
517 (defvar is13194-to-ucs-gujarati-hashtbl nil)
518 (defvar is13194-to-ucs-gujarati-regexp nil)
519 (defvar is13194-to-ucs-oriya-hashtbl nil)
520 (defvar is13194-to-ucs-oriya-regexp nil)
521 (defvar is13194-to-ucs-tamil-hashtbl nil)
522 (defvar is13194-to-ucs-tamil-regexp nil)
523 (defvar is13194-to-ucs-telugu-hashtbl nil)
524 (defvar is13194-to-ucs-telugu-regexp nil)
525 (defvar is13194-to-ucs-malayalam-hashtbl nil)
526 (defvar is13194-to-ucs-malayalam-regexp nil)
528 (mapc
529 (function (lambda (script)
530 (let ((hashtable (intern (concat "is13194-to-ucs-"
531 (symbol-name script) "-hashtbl" )))
532 (regexp (intern (concat "is13194-to-ucs-"
533 (symbol-name script) "-regexp"))))
534 (set hashtable (make-hash-table :test 'equal :size 128))
535 (mapc
536 (function (lambda (x)
537 (put-char-code-property (decode-char 'ucs (car x))
538 'script script)
539 (put-char-code-property (decode-char 'ucs (car x))
540 'iscii (cdr x))
541 (puthash (cdr x) (char-to-string (decode-char 'ucs (car x)))
542 (eval hashtable))))
543 (eval (intern (concat "ucs-" (symbol-name script)
544 "-to-is13194-alist"))))
545 (set regexp (indian-regexp-of-hashtbl-keys (eval hashtable))))))
546 '(devanagari bengali assamese gurmukhi gujarati
547 oriya tamil telugu malayalam))
549 (defvar ucs-to-is13194-regexp
550 ;; only Devanagari is supported now.
551 (concat "[" (char-to-string (decode-char 'ucs #x0900))
552 "-" (char-to-string (decode-char 'ucs #x097f)) "]")
553 "Regexp that matches to conversion")
555 (defun ucs-to-iscii-region (from to)
556 "Converts the indian UCS characters in the region to ISCII.
557 Returns new end position."
558 (interactive "r")
559 ;; only Devanagari is supported now.
560 (save-excursion
561 (save-restriction
562 (narrow-to-region from to)
563 (goto-char (point-min))
564 (let* ((current-repertory is13194-default-repartory))
565 (while (re-search-forward ucs-to-is13194-regexp nil t)
566 (replace-match
567 (get-char-code-property (string-to-char (match-string 0))
568 'iscii))))
569 (point-max))))
571 (defun iscii-to-ucs-region (from to)
572 "Converts the ISCII characters in the region to UCS.
573 Returns new end position."
574 (interactive "r")
575 ;; only Devanagari is supported now.
576 (save-excursion
577 (save-restriction
578 (narrow-to-region from to)
579 (goto-char (point-min))
580 (let* ((current-repertory is13194-default-repartory)
581 (current-hashtable
582 (intern (concat "is13194-to-ucs-"
583 (symbol-name current-repertory) "-hashtbl")))
584 (current-regexp
585 (intern (concat "is13194-to-ucs-"
586 (symbol-name current-repertory) "-regexp"))))
587 (while (re-search-forward (eval current-regexp) nil t)
588 (replace-match
589 (gethash (match-string 0) (eval current-hashtable) ""))))
590 (point-max))))
592 ;;;###autoload
593 (defun indian-compose-region (from to)
594 "Compose the region according to `composition-function-table'. "
595 (interactive "r")
596 (save-excursion
597 (save-restriction
598 (let ((pos from) chars (max to))
599 (narrow-to-region from to)
600 (while (< pos max)
601 (setq chars (compose-chars-after pos))
602 (if chars (setq pos (+ pos chars)) (setq pos (1+ pos))))))))
604 ;;;###autoload
605 (defun indian-compose-string (string)
606 (with-temp-buffer
607 (insert string)
608 (indian-compose-region (point-min) (point-max))
609 (buffer-string)))
611 ;;;###autoload
612 (defun in-is13194-post-read-conversion (len)
613 (let ((pos (point)) endpos)
614 (setq endpos (iscii-to-ucs-region pos (+ pos len)))
615 (indian-compose-region pos endpos)
616 (- endpos pos)))
618 ;;;###autoload
619 (defun in-is13194-pre-write-conversion (from to)
620 (let ((buf (current-buffer)))
621 (set-buffer (generate-new-buffer " *temp*"))
622 (if (stringp from)
623 (insert from)
624 (insert-buffer-substring buf from to))
625 (ucs-to-iscii-region (point-min) (point-max))
626 nil))
631 ;;; Backward Compatibility support programs
633 ;; The followings provides the conversion from old-implementation of
634 ;; Emacs Devanagari script to UCS.
636 (defconst indian-2-colum-to-ucs
638 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
639 ;;2120 \e$(5!!!"!#!$!%!&!'!(!)!*!+!,!-!.!/\e(B
640 ("\e$(5!!\e(B" . "\e$,15A\e(B")
641 ("\e$(5!"\e(B" . "\e$,15B\e(B")
642 ("\e$(5!#\e(B" . "\e$,15C\e(B")
643 ("\e$(5!$\e(B" . "\e$,15E\e(B")
644 ("\e$(5!%\e(B" . "\e$,15F\e(B")
645 ("\e$(5!&\e(B" . "\e$,15G\e(B")
646 ("\e$(5!'\e(B" . "\e$,15H\e(B")
647 ("\e$(5!(\e(B" . "\e$,15I\e(B")
648 ("\e$(5!)\e(B" . "\e$,15J\e(B")
649 ("\e$(5!*\e(B" . "\e$,15K\e(B")
650 ("\e$(5!*"p\e(B" . "\e$,15p6#\e(B")
651 ("\e$(5!+\e(B" . "\e$,15N\e(B")
652 ("\e$(5!,\e(B" . "\e$,15O\e(B")
653 ("\e$(5!-\e(B" . "\e$,15P\e(B")
654 ("\e$(5!.\e(B" . "\e$,15M\e(B")
655 ("\e$(5!/\e(B" . "\e$,15R\e(B")
656 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
657 ;;2130 \e$(5!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?\e(B
658 ("\e$(5!0\e(B" . "\e$,15S\e(B")
659 ("\e$(5!1\e(B" . "\e$,15T\e(B")
660 ("\e$(5!2\e(B" . "\e$,15Q\e(B")
661 ("\e$(5!3\e(B" . "\e$,15U\e(B")
662 ("\e$(5!4\e(B" . "\e$,15V\e(B")
663 ("\e$(5!5\e(B" . "\e$,15W\e(B")
664 ("\e$(5!6\e(B" . "\e$,15X\e(B")
665 ("\e$(5!7\e(B" . "\e$,15Y\e(B")
666 ("\e$(5!8\e(B" . "\e$,15Z\e(B")
667 ("\e$(5!9\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$,15`\e(B")
673 ("\e$(5!?\e(B" . "\e$,15a\e(B")
674 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
675 ;;2140 \e$(5!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O\e(B
676 ("\e$(5!@\e(B" . "\e$,15b\e(B")
677 ("\e$(5!A\e(B" . "\e$,15c\e(B")
678 ("\e$(5!B\e(B" . "\e$,15d\e(B")
679 ("\e$(5!C\e(B" . "\e$,15e\e(B")
680 ("\e$(5!D\e(B" . "\e$,15f\e(B")
681 ("\e$(5!E\e(B" . "\e$,15g\e(B")
682 ("\e$(5!F\e(B" . "\e$,15h\e(B")
683 ("\e$(5!G\e(B" . "\e$,15i\e(B")
684 ("\e$(5!H\e(B" . "\e$,15j\e(B")
685 ("\e$(5!I\e(B" . "\e$,15k\e(B")
686 ("\e$(5!J\e(B" . "\e$,15l\e(B")
687 ("\e$(5!K\e(B" . "\e$,15m\e(B")
688 ("\e$(5!L\e(B" . "\e$,15n\e(B")
689 ("\e$(5!M\e(B" . "\e$,15o\e(B")
690 ("\e$(5!N\e(B" . "\e$,16?\e(B")
691 ("\e$(5!O\e(B" . "\e$,15p\e(B")
692 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
693 ;;2150 \e$(5!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_\e(B
694 ("\e$(5!P\e(B" . "\e$,15q\e(B")
695 ("\e$(5!Q\e(B" . "\e$,15r\e(B")
696 ("\e$(5!R\e(B" . "\e$,15s\e(B")
697 ("\e$(5!S\e(B" . "\e$,15t\e(B")
698 ("\e$(5!T\e(B" . "\e$,15u\e(B")
699 ("\e$(5!U\e(B" . "\e$,15v\e(B")
700 ("\e$(5!V\e(B" . "\e$,15w\e(B")
701 ("\e$(5!W\e(B" . "\e$,15x\e(B")
702 ("\e$(5!X\e(B" . "\e$,15y\e(B")
703 ("\e$(5!Z\e(B" . "\e$,15~\e(B")
704 ("\e$(5![\e(B" . "\e$,15\x7f\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 ("\e$(5!_\e(B" . "\e$,16#\e(B")
709 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
710 ;;2160 \e$(5!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o\e(B
711 ("\e$(5!`\e(B" . "\e$,16&\e(B")
712 ("\e$(5!a\e(B" . "\e$,16'\e(B")
713 ("\e$(5!b\e(B" . "\e$,16(\e(B")
714 ("\e$(5!c\e(B" . "\e$,16%\e(B")
715 ("\e$(5!d\e(B" . "\e$,16*\e(B")
716 ("\e$(5!e\e(B" . "\e$,16+\e(B")
717 ("\e$(5!f\e(B" . "\e$,16,\e(B")
718 ("\e$(5!g\e(B" . "\e$,16)\e(B")
719 ("\e$(5!h\e(B" . "\e$,16-\e(B")
720 ("\e$(5!i\e(B" . "\e$,15|\e(B")
721 ("\e$(5!j\e(B" . "\e$,16D\e(B")
722 ("\e$(5!j!j\e(B" . "\e$,16E\e(B")
723 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
724 ;;2170 \e$(5!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~\e(B
725 ("\e$(5!q\e(B" . "\e$,16F\e(B")
726 ("\e$(5!r\e(B" . "\e$,16G\e(B")
727 ("\e$(5!s\e(B" . "\e$,16H\e(B")
728 ("\e$(5!t\e(B" . "\e$,16I\e(B")
729 ("\e$(5!u\e(B" . "\e$,16J\e(B")
730 ("\e$(5!v\e(B" . "\e$,16K\e(B")
731 ("\e$(5!w\e(B" . "\e$,16L\e(B")
732 ("\e$(5!x\e(B" . "\e$,16M\e(B")
733 ("\e$(5!y\e(B" . "\e$,16N\e(B")
734 ("\e$(5!z\e(B" . "\e$,16O\e(B")
735 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
736 ;;2220 \e$(5"!"""#"$"%"&"'"(")"*"+","-"."/\e(B
737 ("\e$(5"!\e(B" . "\e$,16;6-5p\e(B")
738 ("\e$(5""\e(B" . "\e$,16>6-5p\e(B")
739 ("\e$(5"#\e(B" . "\e$,15U6-5p\e(B")
740 ("\e$(5"$\e(B" . "\e$,15W6-5p\e(B")
741 ("\e$(5"%\e(B" . "\e$,15d6-5p\e(B")
742 ("\e$(5"&\e(B" . "\e$,15j6-5p\e(B")
743 ("\e$(5"'\e(B" . "\e$,15k6-5p\e(B")
744 ("\e$(5")\e(B" . "\e$,15v6-5p\e(B")
745 ("\e$(5",\e(B" . "\e$,15p6!\e(B")
746 ("\e$(5"-\e(B" . "\e$,15p6"\e(B")
747 ("\e$(5".\e(B" . "\e$,15q6!\e(B")
748 ("\e$(5"/\e(B" . "\e$,15q6"\e(B")
749 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
750 ;;2230 \e$(5"0"1"2"3"4"5"6"7"8"9":";"<"=">"?\e(B
751 ("\e$(5"3\e(B" . "\e$,15U6-\e(B")
752 ("\e$(5"4\e(B" . "\e$,15V6-\e(B")
753 ("\e$(5"5\e(B" . "\e$,15W6-\e(B")
754 ("\e$(5"6\e(B" . "\e$,15X6-\e(B")
755 ("\e$(5"8\e(B" . "\e$,15Z6-\e(B")
756 ("\e$(5"8"q\e(B" . "\e$,15Z6-5p6-\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 ("\e$(5"<\e(B" . "\e$,15^6-\e(B")
761 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
762 ;;2240 \e$(5"@"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O\e(B
763 ("\e$(5"A\e(B" . "\e$,15c6-\e(B")
764 ("\e$(5"B\e(B" . "\e$,15d6-\e(B")
765 ("\e$(5"C\e(B" . "\e$,15e6-\e(B")
766 ("\e$(5"E\e(B" . "\e$,15g6-\e(B")
767 ("\e$(5"F\e(B" . "\e$,15h6-\e(B")
768 ("\e$(5"G\e(B" . "\e$,15i6-\e(B")
769 ("\e$(5"H\e(B" . "\e$,15j6-\e(B")
770 ("\e$(5"I\e(B" . "\e$,15k6-\e(B")
771 ("\e$(5"J\e(B" . "\e$,15l6-\e(B")
772 ("\e$(5"J\e(B" . "\e$,15l6-\e(B")
773 ("\e$(5"K\e(B" . "\e$,15m6-\e(B")
774 ("\e$(5"L\e(B" . "\e$,15n6-\e(B")
775 ("\e$(5"M\e(B" . "\e$,15o6-\e(B")
776 ("\e$(5"N\e(B" . "\e$,16?6-\e(B")
777 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
778 ;;2250 \e$(5"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_\e(B
779 ("\e$(5"Q\e(B" . "\e$,15r6-\e(B")
780 ("\e$(5"R\e(B" . "\e$,15s6-\e(B")
781 ("\e$(5"S\e(B" . "\e$,15t6-\e(B")
782 ("\e$(5"T\e(B" . "\e$,15u6-\e(B")
783 ("\e$(5"U\e(B" . "\e$,15v6-\e(B")
784 ("\e$(5"V\e(B" . "\e$,15w6-\e(B")
785 ("\e$(5"W\e(B" . "\e$,15x6-\e(B")
786 ("\e$(5"]\e(B" . "\e$,16-5o\e(B")
787 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
788 ;;2260 \e$(5"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o\e(B
789 ("\e$(5"`\e(B" . "\e$,15W6-5p6-\e(B")
790 ("\e$(5"a\e(B" . "\e$,15X6-5h6-\e(B")
791 ("\e$(5"c\e(B" . "\e$,15d6-5d6-\e(B")
792 ("\e$(5"d\e(B" . "\e$,15d6-5p6-\e(B")
793 ("\e$(5"e\e(B" . "\e$,15g6-5h6-\e(B")
794 ("\e$(5"f\e(B" . "\e$,15g6-5p6-\e(B")
795 ("\e$(5"g\e(B" . "\e$,15j6-5d6-\e(B")
796 ("\e$(5"h\e(B" . "\e$,15v6-5Z6-\e(B")
797 ("\e$(5"i\e(B" . "\e$,15v6-5p6-\e(B")
798 ("\e$(5"j\e(B" . "\e$,15v6-5u6-\e(B")
799 ("\e$(5"k\e(B" . "\e$,15h6-5h6-\e(B")
800 ("\e$(5"l\e(B" . "\e$,15U6-5w6-\e(B")
801 ("\e$(5"m\e(B" . "\e$,15\6-5^6-\e(B")
802 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
803 ;;2270 \e$(5"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~\e(B
804 ("\e$(5"p\e(B" . "\e$,15p6-\e(B")
805 ("\e$(5"q\e(B" . "\e$,16-5p\e(B")
806 ("\e$(5"r\e(B" . "\e$,16-5p\e(B")
807 ("\e$(5"s\e(B" . "\e$,1686-\e(B")
808 ("\e$(5"t\e(B" . "\e$,1696-\e(B")
809 ("\e$(5"u\e(B" . "\e$,16:6-\e(B")
810 ("\e$(5"y\e(B" . "\e$,16>6-\e(B")
811 ("\e$(5"z\e(B" . "\e$,16;6-\e(B")
812 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
813 ;;2320 \e$(5#!#"###$#%#&#'#(#)#*#+#,#-#.#/\e(B
814 ("\e$(5#!\e(B" . "\e$,160\e(B")
815 ("\e$(5#&\e(B" . "\e$,15L\e(B")
816 ("\e$(5#&"p\e(B" . "\e$,15p6$\e(B")
817 ("\e$(5#'\e(B" . "\e$,16A\e(B")
818 ("\e$(5#'"p\e(B" . "\e$,15p6C\e(B")
819 ("\e$(5#*\e(B" . "\e$,16@\e(B")
820 ("\e$(5#*"p\e(B" . "\e$,15p6B\e(B")
821 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
822 ;;2330 \e$(5#0#1#2#3#4#5#6#7#8#9#:#;#<#=#>#?\e(B
823 ("\e$(5#3\e(B" . "\e$,168\e(B")
824 ("\e$(5#4\e(B" . "\e$,169\e(B")
825 ("\e$(5#5\e(B" . "\e$,16:\e(B")
826 ("\e$(5#:\e(B" . "\e$,16;\e(B")
827 ("\e$(5#?\e(B" . "\e$,16<\e(B")
828 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
829 ;;2340 \e$(5#@#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O\e(B
830 ("\e$(5#@\e(B" . "\e$,16=\e(B")
831 ("\e$(5#I\e(B" . "\e$,16>\e(B")
832 ("\e$(5#J\e(B" . "\e$,15}\e(B")
833 ("\e$(5#K\e(B" . "\e$,16$\e(B")
834 ("\e$(5#L\e(B" . "\e$,16B\e(B")
835 ("\e$(5#M\e(B" . "\e$,16C\e(B")
836 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
837 ;;2350 \e$(5#P#Q#R#S#T#U#V#W#X#Y#Z#[#\#]#^#_\e(B
838 ("\e$(5#P\e(B" . "\e$,15n6-5h\e(B")
839 ("\e$(5#Q\e(B" . "\e$,15n6-5r\e(B")
840 ("\e$(5#R\e(B" . "\e$,15y6#\e(B")
841 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
842 ;;2360 \e$(5#`#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o\e(B
843 ("\e$(5#`\e(B" . "\e$,15r6-5r\e(B")
844 ("\e$(5#a\e(B" . "\e$,15u6-5h\e(B")
845 ("\e$(5#b\e(B" . "\e$,15u6-5u\e(B")
846 ("\e$(5#c\e(B" . "\e$,15v6-5Z\e(B")
847 ("\e$(5#d\e(B" . "\e$,15v6-5h\e(B")
848 ("\e$(5#e\e(B" . "\e$,15v6-5l\e(B")
849 ("\e$(5#f\e(B" . "\e$,15v6-5r\e(B")
850 ("\e$(5#g\e(B" . "\e$,15v6-5u\e(B")
851 ("\e$(5#h\e(B" . "\e$,15w6-5_6-5p6-5o\e(B")
852 ("\e$(5#i\e(B" . "\e$,15w6-5_6-5o\e(B")
853 ("\e$(5#j\e(B" . "\e$,15w6-5_6-5u\e(B")
854 ("\e$(5#k\e(B" . "\e$,15w6-5_\e(B")
855 ("\e$(5#l\e(B" . "\e$,15w6-5`\e(B")
856 ("\e$(5#m\e(B" . "\e$,15x6-5h\e(B")
857 ("\e$(5#n\e(B" . "\e$,15x6-5p\e(B")
858 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
859 ;;2370 \e$(5#p#q#r#s#t#u#v#w#x#y#z#{#|#}#~\e(B
860 ("\e$(5#p\e(B" . "\e$,15y6-5c\e(B")
861 ("\e$(5#q\e(B" . "\e$,15y6-5h\e(B")
862 ("\e$(5#r\e(B" . "\e$,15y6-5n\e(B")
863 ("\e$(5#s\e(B" . "\e$,15y6-5o\e(B")
864 ("\e$(5#t\e(B" . "\e$,15y6-5p\e(B")
865 ("\e$(5#u\e(B" . "\e$,15y6-5r\e(B")
866 ("\e$(5#v\e(B" . "\e$,15y6-5u\e(B")
867 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
868 ;;2420 \e$(5$!$"$#$$$%$&$'$($)$*$+$,$-$.$/\e(B
869 ("\e$(5$!\e(B" . "\e$,15U6-5d6-5p6-5o\e(B")
870 ("\e$(5$"\e(B" . "\e$,15U6-5d6-5u\e(B")
871 ("\e$(5$#\e(B" . "\e$,15U6-5d6-5o\e(B")
872 ("\e$(5$$\e(B" . "\e$,15U6-5h6-5o\e(B")
873 ("\e$(5$%\e(B" . "\e$,15U6-5p6-5o\e(B")
874 ("\e$(5$&\e(B" . "\e$,15U6-5u6-5o\e(B")
875 ("\e$(5$'\e(B" . "\e$,15U6-5U\e(B")
876 ("\e$(5$(\e(B" . "\e$,15U6-5d\e(B")
877 ("\e$(5$)\e(B" . "\e$,15U6-5h\e(B")
878 ("\e$(5$*\e(B" . "\e$,15U6-5n\e(B")
879 ("\e$(5$+\e(B" . "\e$,15U6-5o\e(B")
880 ("\e$(5$,\e(B" . "\e$,15U6-5r\e(B")
881 ("\e$(5$-\e(B" . "\e$,15U6-5u\e(B")
882 ("\e$(5$.\e(B" . "\e$,15U6-5w\e(B")
883 ("\e$(5$/\e(B" . "\e$,15X6-5h\e(B")
884 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
885 ;;2430 \e$(5$0$1$2$3$4$5$6$7$8$9$:$;$<$=$>$?\e(B
886 ("\e$(5$0\e(B" . "\e$,15Y6-5U6-5d6-5o\e(B")
887 ("\e$(5$1\e(B" . "\e$,15Y6-5U6-5w6-5u\e(B")
888 ("\e$(5$2\e(B" . "\e$,15Y6-5U6-5d\e(B")
889 ("\e$(5$3\e(B" . "\e$,15Y6-5U6-5w\e(B")
890 ("\e$(5$4\e(B" . "\e$,15Y6-5X6-5p\e(B")
891 ("\e$(5$5\e(B" . "\e$,15Y6-5U6-5o\e(B")
892 ("\e$(5$6\e(B" . "\e$,15Y6-5V6-5o\e(B")
893 ("\e$(5$7\e(B" . "\e$,15Y6-5W6-5o\e(B")
894 ("\e$(5$8\e(B" . "\e$,15Y6-5X6-5o\e(B")
895 ("\e$(5$9\e(B" . "\e$,15Y6-5U\e(B")
896 ("\e$(5$:\e(B" . "\e$,15Y6-5V\e(B")
897 ("\e$(5$;\e(B" . "\e$,15Y6-5W\e(B")
898 ("\e$(5$<\e(B" . "\e$,15Y6-5X\e(B")
899 ("\e$(5$=\e(B" . "\e$,15Y6-5Y\e(B")
900 ("\e$(5$>\e(B" . "\e$,15Y6-5h\e(B")
901 ("\e$(5$?\e(B" . "\e$,15Y6-5n\e(B")
902 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
903 ;;2440 \e$(5$@$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O\e(B
904 ("\e$(5$@\e(B" . "\e$,15Y6-5o\e(B")
905 ("\e$(5$A\e(B" . "\e$,15Z6-5Z\e(B")
906 ("\e$(5$B\e(B" . "\e$,15Z6-5^\e(B")
907 ("\e$(5$C\e(B" . "\e$,15[6-5o\e(B")
908 ("\e$(5$D\e(B" . "\e$,15\6-5p\e(B")
909 ("\e$(5$E\e(B" . "\e$,15\6-5^\e(B")
910 ("\e$(5$F\e(B" . "\e$,15^6-5Z\e(B")
911 ("\e$(5$G\e(B" . "\e$,15^6-5\\e(B")
912 ("\e$(5$H\e(B" . "\e$,15_6-5U\e(B")
913 ("\e$(5$I\e(B" . "\e$,15_6-5_\e(B")
914 ("\e$(5$J\e(B" . "\e$,15_6-5`\e(B")
915 ("\e$(5$K\e(B" . "\e$,15_6-5o\e(B")
916 ("\e$(5$L\e(B" . "\e$,15`6-5o\e(B")
917 ("\e$(5$M\e(B" . "\e$,15a6-5W6-5o\e(B")
918 ("\e$(5$N\e(B" . "\e$,15a6-5X6-5p\e(B")
919 ("\e$(5$O\e(B" . "\e$,15a6-5p6-5o\e(B")
920 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
921 ;;2450 \e$(5$P$Q$R$S$T$U$V$W$X$Y$Z$[$\$]$^$_\e(B
922 ("\e$(5$P\e(B" . "\e$,15a6-5W\e(B")
923 ("\e$(5$Q\e(B" . "\e$,15a6-5X\e(B")
924 ("\e$(5$R\e(B" . "\e$,15a6-5a\e(B")
925 ("\e$(5$S\e(B" . "\e$,15a6-5n\e(B")
926 ("\e$(5$T\e(B" . "\e$,15a6-5o\e(B")
927 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
928 ;;2460 \e$(5$`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o\e(B
929 ("\e$(5$`\e(B" . "\e$,15b6-5o\e(B")
930 ("\e$(5$a\e(B" . "\e$,15d6-5d\e(B")
931 ("\e$(5$b\e(B" . "\e$,15d6-5h\e(B")
932 ("\e$(5$c\e(B" . "\e$,15f6-5f6-5o\e(B")
933 ("\e$(5$d\e(B" . "\e$,15f6-5g6-5o\e(B")
934 ("\e$(5$e\e(B" . "\e$,15f6-5m6-5o\e(B")
935 ("\e$(5$f\e(B" . "\e$,15f6-5p6-5o\e(B")
936 ("\e$(5$g\e(B" . "\e$,15f6-5u6-5o\e(B")
937 ("\e$(5$h\e(B" . "\e$,15f6-5W6-5p\e(B")
938 ("\e$(5$i\e(B" . "\e$,15f6-5X6-5p\e(B")
939 ("\e$(5$j\e(B" . "\e$,15f6-5f6-5u\e(B")
940 ("\e$(5$k\e(B" . "\e$,15f6-5g6-5u\e(B")
941 ("\e$(5$l\e(B" . "\e$,15f6-5W\e(B")
942 ("\e$(5$m\e(B" . "\e$,15f6-5X\e(B")
943 ("\e$(5$n\e(B" . "\e$,15f6-5f\e(B")
944 ("\e$(5$o\e(B" . "\e$,15f6-5g\e(B")
945 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
946 ;;2470 \e$(5$p$q$r$s$t$u$v$w$x$y$z${$|$}$~\e(B
947 ("\e$(5$p\e(B" . "\e$,15f6-5h\e(B")
948 ("\e$(5$q\e(B" . "\e$,15f6-5l\e(B")
949 ("\e$(5$r\e(B" . "\e$,15f6-5m\e(B")
950 ("\e$(5$s\e(B" . "\e$,15f6-5n\e(B")
951 ("\e$(5$t\e(B" . "\e$,15f6-5o\e(B")
952 ("\e$(5$u\e(B" . "\e$,15f6-5u\e(B")
953 ("\e$(5$v\e(B" . "\e$,15g6-5h\e(B")
954 ("\e$(5$w\e(B" . "\e$,15h6-5h\e(B")
955 ("\e$(5$x\e(B" . "\e$,15j6-5d\e(B")
956 ("\e$(5$y\e(B" . "\e$,15j6-5h\e(B")
957 ("\e$(5$z\e(B" . "\e$,15j6-5r\e(B")
958 ("\e$(5${\e(B" . "\e$,15l6-5h\e(B")
959 ("\e$(5$|\e(B" . "\e$,15l6-5l\e(B")
960 ("\e$(5$}\e(B" . "\e$,15l6-5u\e(B")
961 ("\e$(5$~\e(B" . "\e$,15m6-5h\e(B")))
963 (defconst indian-2-column-to-ucs-regexp
964 "\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]")
966 (put 'indian-2-column-to-ucs-chartable 'char-table-extra-slots 1)
967 (defconst indian-2-column-to-ucs-chartable
968 (let ((table (make-char-table 'indian-2-column-to-ucs-chartable))
969 (alist nil))
970 (dolist (elt indian-2-colum-to-ucs)
971 (if (= (length (car elt)) 1)
972 (aset table (aref (car elt) 0) (cdr elt))
973 (setq alist (cons elt alist))))
974 (set-char-table-extra-slot table 0 alist)
975 table))
977 (defun indian-2-column-to-ucs-region (from to)
978 "Convert old Emacs Devanagari characters to UCS."
979 (interactive "r")
980 (save-excursion
981 (save-restriction
982 (let ((pos from)
983 (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0)))
984 (narrow-to-region from to)
985 (decompose-region from to)
986 (goto-char (point-min))
987 (while (re-search-forward indian-2-column-to-ucs-regexp nil t)
988 (let ((len (- (match-end 0) (match-beginning 0)))
989 subst)
990 (if (= len 1)
991 (setq subst (aref indian-2-column-to-ucs-chartable
992 (char-after (match-beginning 0))))
993 (setq subst (assoc (match-string 0) alist)))
994 (replace-match (if subst subst "?"))))
995 (indian-compose-region (point-min) (point-max))))))
997 ;;;###autoload
998 (defun indian-glyph-char (index &optional script)
999 "Return character of charset `indian-glyph' made from glyph index INDEX.
1000 The variable `indian-default-script' specifies the script of the glyph.
1001 Optional argument SCRIPT, if non-nil, overrides `indian-default-script'.
1002 See also the function `indian-char-glyph'."
1003 (or script
1004 (setq script indian-default-script))
1005 (let ((offset (get script 'indian-glyph-code-offset)))
1006 (or (integerp offset)
1007 (error "Invalid script name: %s" script))
1008 (or (and (>= index 0) (< index 256))
1009 (error "Invalid glyph index: %d" index))
1010 (setq index (+ offset index))
1011 (make-char 'indian-glyph (+ (/ index 96) 32) (+ (% index 96) 32))))
1013 (defvar indian-glyph-max-char
1014 (indian-glyph-char
1015 255 (aref indian-script-table (1- (length indian-script-table))))
1016 "The maximum valid code of characters in the charset `indian-glyph'.")
1018 ;;;###autoload
1019 (defun indian-char-glyph (char)
1020 "Return information about the glyph code for CHAR of `indian-glyph' charset.
1021 The value is (INDEX . SCRIPT), where INDEX is the glyph index
1022 in the font that Indian script name SCRIPT specifies.
1023 See also the function `indian-glyph-char'."
1024 (let ((split (split-char char))
1025 code)
1026 (or (eq (car split) 'indian-glyph)
1027 (error "Charset of `%c' is not indian-glyph" char))
1028 (or (<= char indian-glyph-max-char)
1029 (error "Invalid indian-glyph char: %d" char))
1030 (setq code (+ (* (- (nth 1 split) 32) 96) (nth 2 split) -32))
1031 (cons (% code 256) (aref indian-script-table (/ code 256)))))
1033 (provide 'ind-util)
1035 ;;; ind-util.el ends here