Typo.
[bpt/emacs.git] / lisp / language / ind-util.el
CommitLineData
cd4e9344
RS
1;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- coding: iso-2022-7bit; -*-
2
38141d20 3;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
d4877ac1 4;; Free Software Foundation, Inc.
cd4e9344 5
c7357293 6;; Maintainer: KAWABATA, Taichi <kawabata@m17n.org>
cd4e9344
RS
7;; Keywords: multilingual, Indian, Devanagari
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
b4aa6026 13;; the Free Software Foundation; either version 3, or (at your option)
cd4e9344
RS
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
3a35cf56
LK
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
cd4e9344
RS
25
26;;; Commentary:
27
28;; This file provides conversion between UCS and various
29;; transliteration schemes, such as ITRANS, kyoto-harvard and aiba
30;; methods. It also provides conversion between IS 13194 and UCS.
31;; Finally, this program provides the compatibility support with
32;; old implementation of Devanagari script.
33
34;;; Code:
35
36;;; Transliteration
37
38;; The followings provide the various transliteration schemes (such as
39;; ITRANS, kyoto-harvard, and Aiba) of Indian scripts. They are also
40;; used in quail/indian.el for typing Indian script in Emacs.
41
42(eval-and-compile
cd4e9344 43
48cb5913 44(defun indian-regexp-of-hashtbl-keys (hashtbl)
cd4e9344 45 "Returns the regular expression of hashtable keys."
462a7ed6
SM
46 (let (keys)
47 (maphash (lambda (key val) (push key keys)) hashtbl)
48 (regexp-opt keys)))
cd4e9344
RS
49
50(defvar indian-dev-base-table
51 '(
52 (;; VOWELS (18)
53 (?\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)
c7357293
KH
54 (?\e$,15K\e(B ?\e$,16#\e(B) (?\e$,15L\e(B ?\e$,16B\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)
55 (?\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$,16$\e(B) (?\e$,16A\e(B ?\e$,16C\e(B))
cd4e9344
RS
56 (;; CONSONANTS (currently 42, including special cases)
57 ?\e$,15U\e(B ?\e$,15V\e(B ?\e$,15W\e(B ?\e$,15X\e(B ?\e$,15Y\e(B ;; GUTTRULS
a1506d29
JB
58 ?\e$,15Z\e(B ?\e$,15[\e(B ?\e$,15\\e(B ?\e$,15]\e(B ?\e$,15^\e(B ;; PALATALS
59 ?\e$,15_\e(B ?\e$,15`\e(B ?\e$,15a\e(B ?\e$,15b\e(B ?\e$,15c\e(B ;; CEREBRALS
60 ?\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
61 ?\e$,15j\e(B ?\e$,15k\e(B ?\e$,15l\e(B ?\e$,15m\e(B ?\e$,15n\e(B ;; LABIALS
cd4e9344 62 ?\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
a1506d29
JB
63 ?\e$,15v\e(B ?\e$,15w\e(B ?\e$,15x\e(B ?\e$,15y\e(B ;; SIBILANTS
64 ?\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
cd4e9344 65 "\e$,15\6-5^\e(B" "\e$,15U6-5w\e(B")
a1506d29 66 (;; Misc Symbols (7)
cd4e9344
RS
67 ?\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)
68 (;; Digits (10)
69 ?\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)
70 (;; Inscript-extra (4) (#, $, ^, *, ])
71 "\e$,16-5p\e(B" "\e$,15p6-\e(B" "\e$,15d6-5p\e(B" "\e$,15v6-5p\e(B" "\e$,15|\e(B")))
72
c7357293
KH
73;; Punjabi is also known as Gurmukhi.
74(defvar indian-pnj-base-table
75 '(
76 (;; VOWELS
77 (?\e$,18%\e(B nil) (?\e$,18&\e(B ?\e$,18^\e(B) (?\e$,18'\e(B ?\e$,18_\e(B) (?\e$,18(\e(B ?\e$,18`\e(B) (?\e$,18)\e(B ?\e$,18a\e(B) (?\e$,18*\e(B ?\e$,18b\e(B)
78 nil nil nil nil (?\e$,18/\e(B ?\e$,18g\e(B) (?\e$,180\e(B ?\e$,18h\e(B)
79 nil nil (?\e$,183\e(B ?\e$,18k\e(B) (?\e$,184\e(B ?\e$,18l\e(B) nil nil)
80 (;; CONSONANTS
81 ?\e$,185\e(B ?\e$,186\e(B ?\e$,187\e(B ?\e$,188\e(B ?\e$,189\e(B ;; GUTTRULS
82 ?\e$,18:\e(B ?\e$,18;\e(B ?\e$,18<\e(B ?\e$,18=\e(B ?\e$,18>\e(B ;; PALATALS
83 ?\e$,18?\e(B ?\e$,18@\e(B ?\e$,18A\e(B ?\e$,18B\e(B ?\e$,18C\e(B ;; CEREBRALS
84 ?\e$,18D\e(B ?\e$,18E\e(B ?\e$,18F\e(B ?\e$,18G\e(B ?\e$,18H\e(B nil ;; DENTALS
85 ?\e$,18J\e(B ?\e$,18K\e(B ?\e$,18L\e(B ?\e$,18M\e(B ?\e$,18N\e(B ;; LABIALS
86 ?\e$,18O\e(B ?\e$,18P\e(B nil ?\e$,18R\e(B ?\e$,18S\e(B nil ?\e$,18U\e(B ;; SEMIVOWELS
87 ?\e$,18V\e(B nil ?\e$,18X\e(B ?\e$,18Y\e(B ;; SIBILANTS
88 nil ?\e$,18y\e(B ?\e$,18z\e(B ?\e$,18{\e(B ?\e$,18|\e(B nil ?\e$,18~\e(B nil ;; NUKTAS
89 "\e$,18<8m8>\e(B" nil)
90 (;; Misc Symbols (7)
91 nil ?\e$,18"\e(B nil nil ?\e$,18m\e(B nil nil) ;; ek onkar, etc.
92 (;; Digits
93 ?\e$,19&\e(B ?\e$,19'\e(B ?\e$,19(\e(B ?\e$,19)\e(B ?\e$,19*\e(B ?\e$,19+\e(B ?\e$,19,\e(B ?\e$,19-\e(B ?\e$,19.\e(B ?\e$,19/\e(B)
94 (;; Inscript-extra (4) (#, $, ^, *, ])
95 "\e$,18m8P\e(B" "\e$,18P8m\e(B" "\e$,18D8m8P\e(B" "\e$,18V8m8P\e(B" "\e$,18\\e(B")))
96
97(defvar indian-gjr-base-table
98 '(
99 (;; VOWELS
100 (?\e$,19E\e(B nil) (?\e$,19F\e(B ?\e$,19~\e(B) (?\e$,19G\e(B ?\e$,19\7f\e(B) (?\e$,19H\e(B ?\e$,1: \e(B) (?\e$,19I\e(B ?\e$,1:!\e(B) (?\e$,19J\e(B ?\e$,1:"\e(B)
101 (?\e$,19K\e(B ?\e$,1:#\e(B) nil (?\e$,19M\e(B ?\e$,1:%\e(B) nil (?\e$,19O\e(B ?\e$,1:'\e(B) (?\e$,19P\e(B ?\e$,1:(\e(B)
102 (?\e$,19Q\e(B ?\e$,1:)\e(B) nil (?\e$,19S\e(B ?\e$,1:+\e(B) (?\e$,19T\e(B ?\e$,1:,\e(B) (?\e$,1:@\e(B ?\e$,1:$\e(B) nil)
103 (;; CONSONANTS
104 ?\e$,19U\e(B ?\e$,19V\e(B ?\e$,19W\e(B ?\e$,19X\e(B ?\e$,19Y\e(B ;; GUTTRULS
105 ?\e$,19Z\e(B ?\e$,19[\e(B ?\e$,19\\e(B ?\e$,19]\e(B ?\e$,19^\e(B ;; PALATALS
106 ?\e$,19_\e(B ?\e$,19`\e(B ?\e$,19a\e(B ?\e$,19b\e(B ?\e$,19c\e(B ;; CEREBRALS
107 ?\e$,19d\e(B ?\e$,19e\e(B ?\e$,19f\e(B ?\e$,19g\e(B ?\e$,19h\e(B nil ;; DENTALS
108 ?\e$,19j\e(B ?\e$,19k\e(B ?\e$,19l\e(B ?\e$,19m\e(B ?\e$,19n\e(B ;; LABIALS
109 ?\e$,19o\e(B ?\e$,19p\e(B nil ?\e$,19r\e(B ?\e$,19s\e(B nil ?\e$,19u\e(B ;; SEMIVOWELS
110 ?\e$,19v\e(B ?\e$,19w\e(B ?\e$,19x\e(B ?\e$,19y\e(B ;; SIBILANTS
111 nil nil nil nil nil nil nil nil ;; NUKTAS
112 "\e$,19\:-9^\e(B" "\e$,19U:-9w\e(B")
113 (;; Misc Symbols (7)
114 ?\e$,19A\e(B ?\e$,19B\e(B ?\e$,19C\e(B ?\e$,19}\e(B ?\e$,1:-\e(B ?\e$,1:0\e(B nil)
115 (;; Digits
116 ?\e$,1:F\e(B ?\e$,1:G\e(B ?\e$,1:H\e(B ?\e$,1:I\e(B ?\e$,1:J\e(B ?\e$,1:K\e(B ?\e$,1:L\e(B ?\e$,1:M\e(B ?\e$,1:N\e(B ?\e$,1:O\e(B)
117 (;; Inscript-extra (4) (#, $, ^, *, ])
118 "\e$,1:-9p\e(B" "\e$,19p:-\e(B" "\e$,19d:-9p\e(B" "\e$,19v:-9p\e(B" "\e$,19|\e(B")))
119
120(defvar indian-ori-base-table
121 '(
122 (;; VOWELS
123 (?\e$,1:e\e(B nil) (?\e$,1:f\e(B ?\e$,1;>\e(B) (?\e$,1:g\e(B ?\e$,1;?\e(B) (?\e$,1:h\e(B ?\e$,1;@\e(B) (?\e$,1:i\e(B ?\e$,1;A\e(B) (?\e$,1:j\e(B ?\e$,1;B\e(B)
124 (?\e$,1:k\e(B ?\e$,1;C\e(B) (?\e$,1:l\e(B nil) nil nil (?\e$,1:o\e(B ?\e$,1;G\e(B) (?\e$,1:p\e(B ?\e$,1;H\e(B)
125 nil nil (?\e$,1:s\e(B ?\e$,1;K\e(B) (?\e$,1:t\e(B ?\e$,1;L\e(B) (?\e$,1;`\e(B nil) (?\e$,1;a\e(B nil))
126 (;; CONSONANTS
127 ?\e$,1:u\e(B ?\e$,1:v\e(B ?\e$,1:w\e(B ?\e$,1:x\e(B ?\e$,1:y\e(B ;; GUTTRULS
128 ?\e$,1:z\e(B ?\e$,1:{\e(B ?\e$,1:|\e(B ?\e$,1:}\e(B ?\e$,1:~\e(B ;; PALATALS
129 ?\e$,1:\7f\e(B ?\e$,1; \e(B ?\e$,1;!\e(B ?\e$,1;"\e(B ?\e$,1;#\e(B ;; CEREBRALS
130 ?\e$,1;$\e(B ?\e$,1;%\e(B ?\e$,1;&\e(B ?\e$,1;'\e(B ?\e$,1;(\e(B nil ;; DENTALS
131 ?\e$,1;*\e(B ?\e$,1;+\e(B ?\e$,1;,\e(B ?\e$,1;-\e(B ?\e$,1;.\e(B ;; LABIALS
132 ?\e$,1;/\e(B ?\e$,1;0\e(B nil ?\e$,1;2\e(B ?\e$,1;3\e(B nil nil ;; SEMIVOWELS
133 ?\e$,1;6\e(B ?\e$,1;7\e(B ?\e$,1;8\e(B ?\e$,1;9\e(B ;; SIBILANTS
134 nil nil nil nil ?\e$,1;\\e(B ?\e$,1;]\e(B nil ?\e$,1;_\e(B ;; NUKTAS
135 "\e$,1:|;M:~\e(B" "\e$,1:u;M;7\e(B")
136 (;; Misc Symbols
137 ?\e$,1:a\e(B ?\e$,1:b\e(B ?\e$,1:c\e(B ?\e$,1;=\e(B ?\e$,1;M\e(B nil nil)
138 (;; Digits
139 ?\e$,1;f\e(B ?\e$,1;g\e(B ?\e$,1;h\e(B ?\e$,1;i\e(B ?\e$,1;j\e(B ?\e$,1;k\e(B ?\e$,1;l\e(B ?\e$,1;m\e(B ?\e$,1;n\e(B ?\e$,1;o\e(B)
140 (;; Inscript-extra (4) (#, $, ^, *, ])
141 "\e$,1;M;0\e(B" "\e$,1;0;M\e(B" "\e$,1;$;M;0\e(B" "\e$,1;6;M;0\e(B" "\e$,1;<\e(B")))
142
143(defvar indian-bng-base-table
144 '(
145 (;; VOWELS
146 (?\e$,16e\e(B nil) (?\e$,16f\e(B ?\e$,17>\e(B) (?\e$,16g\e(B ?\e$,17?\e(B) (?\e$,16h\e(B ?\e$,17@\e(B) (?\e$,16i\e(B ?\e$,17A\e(B) (?\e$,16j\e(B ?\e$,17B\e(B)
147 (?\e$,16k\e(B ?\e$,17C\e(B) (?\e$,16l\e(B ?\e$,17b\e(B) nil nil (?\e$,16o\e(B ?\e$,17G\e(B) (?\e$,16p\e(B ?\e$,17H\e(B)
148 nil nil (?\e$,16s\e(B ?\e$,17K\e(B) (?\e$,16t\e(B ?\e$,17L\e(B) (?\e$,17`\e(B ?\e$,17D\e(B) (?\e$,17a\e(B ?\e$,17c\e(B))
149 (;; CONSONANTS
150 ?\e$,16u\e(B ?\e$,16v\e(B ?\e$,16w\e(B ?\e$,16x\e(B ?\e$,16y\e(B ;; GUTTRULS
151 ?\e$,16z\e(B ?\e$,16{\e(B ?\e$,16|\e(B ?\e$,16}\e(B ?\e$,16~\e(B ;; PALATALS
152 ?\e$,16\7f\e(B ?\e$,17 \e(B ?\e$,17!\e(B ?\e$,17"\e(B ?\e$,17#\e(B ;; CEREBRALS
153 ?\e$,17$\e(B ?\e$,17%\e(B ?\e$,17&\e(B ?\e$,17'\e(B ?\e$,17(\e(B nil ;; DENTALS
154 ?\e$,17*\e(B ?\e$,17+\e(B ?\e$,17,\e(B ?\e$,17-\e(B ?\e$,17.\e(B ;; LABIALS
155 ?\e$,17/\e(B ?\e$,170\e(B nil ?\e$,172\e(B nil nil nil ;; SEMIVOWELS
156 ?\e$,176\e(B ?\e$,177\e(B ?\e$,178\e(B ?\e$,179\e(B ;; SIBILANTS
157 nil nil nil nil ?\e$,17\\e(B ?\e$,17]\e(B nil ?\e$,17_\e(B ;; NUKTAS
158 "\e$,16|7M6~\e(B" "\e$,16u7M77\e(B")
159 (;; Misc Symbols
160 ?\e$,16a\e(B ?\e$,16b\e(B ?\e$,16c\e(B nil ?\e$,17M\e(B nil nil)
161 (;; Digits
162 ?\e$,17f\e(B ?\e$,17g\e(B ?\e$,17h\e(B ?\e$,17i\e(B ?\e$,17j\e(B ?\e$,17k\e(B ?\e$,17l\e(B ?\e$,17m\e(B ?\e$,17n\e(B ?\e$,17o\e(B)
163 (;; Inscript-extra (4) (#, $, ^, *, ])
164 "\e$,17M70\e(B" "\e$,1707M\e(B" "\e$,17$7M70\e(B" "\e$,1767M70\e(B" "\e$,17<\e(B")))
165
166(defvar indian-asm-base-table
167 '(
168 (;; VOWELS
169 (?\e$,16e\e(B nil) (?\e$,16f\e(B ?\e$,17>\e(B) (?\e$,16g\e(B ?\e$,17?\e(B) (?\e$,16h\e(B ?\e$,17@\e(B) (?\e$,16i\e(B ?\e$,17A\e(B) (?\e$,16j\e(B ?\e$,17B\e(B)
170 (?\e$,16k\e(B ?\e$,17C\e(B) (?\e$,16l\e(B ?\e$,17b\e(B) nil nil (?\e$,16o\e(B ?\e$,17G\e(B) (?\e$,16p\e(B ?\e$,17H\e(B)
171 nil nil (?\e$,16s\e(B ?\e$,17K\e(B) (?\e$,16t\e(B ?\e$,17L\e(B) (?\e$,17`\e(B ?\e$,17D\e(B) (?\e$,17a\e(B ?\e$,17c\e(B))
172 (;; CONSONANTS
173 ?\e$,16u\e(B ?\e$,16v\e(B ?\e$,16w\e(B ?\e$,16x\e(B ?\e$,16y\e(B ;; GUTTRULS
174 ?\e$,16z\e(B ?\e$,16{\e(B ?\e$,16|\e(B ?\e$,16}\e(B ?\e$,16~\e(B ;; PALATALS
175 ?\e$,16\7f\e(B ?\e$,17 \e(B ?\e$,17!\e(B ?\e$,17"\e(B ?\e$,17#\e(B ;; CEREBRALS
176 ?\e$,17$\e(B ?\e$,17%\e(B ?\e$,17&\e(B ?\e$,17'\e(B ?\e$,17(\e(B nil ;; DENTALS
177 ?\e$,17*\e(B ?\e$,17+\e(B ?\e$,17,\e(B ?\e$,17-\e(B ?\e$,17.\e(B ;; LABIALS
178 ?\e$,17/\e(B ?\e$,17p\e(B nil ?\e$,172\e(B nil nil ?\e$,17q\e(B ;; SEMIVOWELS
179 ?\e$,176\e(B ?\e$,177\e(B ?\e$,178\e(B ?\e$,179\e(B ;; SIBILANTS
180 nil nil nil nil ?\e$,17\\e(B ?\e$,17]\e(B nil ?\e$,17_\e(B ;; NUKTAS
181 "\e$,16|7M6~\e(B" "\e$,16u7M77\e(B")
182 (;; Misc Symbols
183 ?\e$,16a\e(B ?\e$,16b\e(B ?\e$,16c\e(B nil ?\e$,17M\e(B nil nil)
184 (;; Digits
185 ?\e$,17f\e(B ?\e$,17g\e(B ?\e$,17h\e(B ?\e$,17i\e(B ?\e$,17j\e(B ?\e$,17k\e(B ?\e$,17l\e(B ?\e$,17m\e(B ?\e$,17n\e(B ?\e$,17o\e(B)
186 (;; Inscript-extra (4) (#, $, ^, *, ])
187 "\e$,17M7p\e(B" "\e$,17p7M\e(B" "\e$,17$7M7p\e(B" "\e$,1767M7p\e(B" "\e$,17<\e(B")))
188
189(defvar indian-tlg-base-table
190 '(
191 (;; VOWELS
192 (?\e$,1=E\e(B nil) (?\e$,1=F\e(B ?\e$,1=~\e(B) (?\e$,1=G\e(B ?\e$,1=\7f\e(B) (?\e$,1=H\e(B ?\e$,1> \e(B) (?\e$,1=I\e(B ?\e$,1>!\e(B) (?\e$,1=J\e(B ?\e$,1>"\e(B)
193 (?\e$,1=K\e(B ?\e$,1>#\e(B) (?\e$,1=L\e(B nil) nil (?\e$,1=O\e(B ?\e$,1>'\e(B) (?\e$,1=N\e(B ?\e$,1>&\e(B) (?\e$,1=P\e(B ?\e$,1>(\e(B)
194 nil (?\e$,1=S\e(B ?\e$,1>+\e(B) (?\e$,1=R\e(B ?\e$,1>*\e(B) (?\e$,1=T\e(B ?\e$,1>,\e(B) (?\e$,1>@\e(B ?\e$,1>$\e(B) (?\e$,1>A\e(B nil))
195 (;; CONSONANTS
196 ?\e$,1=U\e(B ?\e$,1=V\e(B ?\e$,1=W\e(B ?\e$,1=X\e(B ?\e$,1=Y\e(B ;; GUTTRULS
197 ?\e$,1=Z\e(B ?\e$,1=[\e(B ?\e$,1=\\e(B ?\e$,1=]\e(B ?\e$,1=^\e(B ;; PALATALS
198 ?\e$,1=_\e(B ?\e$,1=`\e(B ?\e$,1=a\e(B ?\e$,1=b\e(B ?\e$,1=c\e(B ;; CEREBRALS
199 ?\e$,1=d\e(B ?\e$,1=e\e(B ?\e$,1=f\e(B ?\e$,1=g\e(B ?\e$,1=h\e(B nil ;; DENTALS
200 ?\e$,1=j\e(B ?\e$,1=k\e(B ?\e$,1=l\e(B ?\e$,1=m\e(B ?\e$,1=n\e(B ;; LABIALS
201 ?\e$,1=o\e(B ?\e$,1=p\e(B ?\e$,1=q\e(B ?\e$,1=r\e(B ?\e$,1=s\e(B nil ?\e$,1=u\e(B ;; SEMIVOWELS
202 ?\e$,1=v\e(B ?\e$,1=w\e(B ?\e$,1=x\e(B ?\e$,1=y\e(B ;; SIBILANTS
203 nil nil nil nil nil nil nil nil ;; NUKTAS
204 "\e$,1=\>-=^\e(B" "\e$,1=U>-=w\e(B")
205 (;; Misc Symbols
206 ?\e$,1=A\e(B ?\e$,1=B\e(B ?\e$,1=C\e(B nil ?\e$,1>-\e(B nil nil)
207 (;; Digits
208 ?\e$,1>F\e(B ?\e$,1>G\e(B ?\e$,1>H\e(B ?\e$,1>I\e(B ?\e$,1>J\e(B ?\e$,1>K\e(B ?\e$,1>L\e(B ?\e$,1>M\e(B ?\e$,1>N\e(B ?\e$,1>O\e(B)
209 (;; Inscript-extra (4) (#, $, ^, *, ])
210 "\e$,1>-=p\e(B" "\e$,1=p>-\e(B" "\e$,1=d>-=p\e(B" "\e$,1=v>-=p\e(B" nil)))
211
212(defvar indian-knd-base-table
213 '(
214 (;; VOWELS
215 (?\e$,1>e\e(B nil) (?\e$,1>f\e(B ?\e$,1?>\e(B) (?\e$,1>g\e(B ?\e$,1??\e(B) (?\e$,1>h\e(B ?\e$,1?@\e(B) (?\e$,1>i\e(B ?\e$,1?A\e(B) (?\e$,1>j\e(B ?\e$,1?B\e(B)
216 (?\e$,1>k\e(B ?\e$,1?C\e(B) (?\e$,1>l\e(B nil) nil (?\e$,1>o\e(B ?\e$,1?G\e(B) (?\e$,1>n\e(B ?\e$,1?F\e(B) (?\e$,1>p\e(B ?\e$,1?H\e(B)
217 nil (?\e$,1>s\e(B ?\e$,1?K\e(B) (?\e$,1>r\e(B ?\e$,1?J\e(B) (?\e$,1>t\e(B ?\e$,1?L\e(B) (?\e$,1?`\e(B ?\e$,1?D\e(B) (?\e$,1?a\e(B nil))
218 (;; CONSONANTS
219 ?\e$,1>u\e(B ?\e$,1>v\e(B ?\e$,1>w\e(B ?\e$,1>x\e(B ?\e$,1>y\e(B ;; GUTTRULS
220 ?\e$,1>z\e(B ?\e$,1>{\e(B ?\e$,1>|\e(B ?\e$,1>}\e(B ?\e$,1>~\e(B ;; PALATALS
221 ?\e$,1>\7f\e(B ?\e$,1? \e(B ?\e$,1?!\e(B ?\e$,1?"\e(B ?\e$,1?#\e(B ;; CEREBRALS
222 ?\e$,1?$\e(B ?\e$,1?%\e(B ?\e$,1?&\e(B ?\e$,1?'\e(B ?\e$,1?(\e(B nil ;; DENTALS
223 ?\e$,1?*\e(B ?\e$,1?+\e(B ?\e$,1?,\e(B ?\e$,1?-\e(B ?\e$,1?.\e(B ;; LABIALS
224 ?\e$,1?/\e(B ?\e$,1?0\e(B ?\e$,1?1\e(B ?\e$,1?2\e(B ?\e$,1?3\e(B nil ?\e$,1?5\e(B ;; SEMIVOWELS
225 ?\e$,1?6\e(B ?\e$,1?7\e(B ?\e$,1?8\e(B ?\e$,1?9\e(B ;; SIBILANTS
226 nil nil nil nil nil nil ?\e$,1?^\e(B nil ;; NUKTAS
227 "\e$,1>|?M>~\e(B" "\e$,1>u?M?7\e(B")
228 (;; Misc Symbols
229 nil ?\e$,1>b\e(B ?\e$,1>c\e(B nil ?\e$,1?M\e(B nil nil)
230 (;; Digits
231 ?\e$,1?f\e(B ?\e$,1?g\e(B ?\e$,1?h\e(B ?\e$,1?i\e(B ?\e$,1?j\e(B ?\e$,1?k\e(B ?\e$,1?l\e(B ?\e$,1?m\e(B ?\e$,1?n\e(B ?\e$,1?o\e(B)
232 (;; Inscript-extra (4) (#, $, ^, *, ])
233 "\e$,1?M?0\e(B" "\e$,1?0?M\e(B" "\e$,1?$?M?0\e(B" "\e$,1?6?M?0\e(B" nil)))
234
235(defvar indian-mlm-base-table
236 '(
237 (;; VOWELS
238 (?\e$,1@%\e(B nil) (?\e$,1@&\e(B ?\e$,1@^\e(B) (?\e$,1@'\e(B ?\e$,1@_\e(B) (?\e$,1@(\e(B ?\e$,1@`\e(B) (?\e$,1@)\e(B ?\e$,1@a\e(B) (?\e$,1@*\e(B ?\e$,1@b\e(B)
239 (?\e$,1@+\e(B ?\e$,1@c\e(B) (?\e$,1@,\e(B nil) nil (?\e$,1@/\e(B ?\e$,1@g\e(B) (?\e$,1@.\e(B ?\e$,1@f\e(B) (?\e$,1@0\e(B ?\e$,1@h\e(B)
240 nil (?\e$,1@3\e(B ?\e$,1@k\e(B) (?\e$,1@2\e(B ?\e$,1@j\e(B) (?\e$,1@4\e(B ?\e$,1@l\e(B) nil nil)
241 (;; CONSONANTS
242 ?\e$,1@5\e(B ?\e$,1@6\e(B ?\e$,1@7\e(B ?\e$,1@8\e(B ?\e$,1@9\e(B ;; GUTTRULS
243 ?\e$,1@:\e(B ?\e$,1@;\e(B ?\e$,1@<\e(B ?\e$,1@=\e(B ?\e$,1@>\e(B ;; PALATALS
244 ?\e$,1@?\e(B ?\e$,1@@\e(B ?\e$,1@A\e(B ?\e$,1@B\e(B ?\e$,1@C\e(B ;; CEREBRALS
245 ?\e$,1@D\e(B ?\e$,1@E\e(B ?\e$,1@F\e(B ?\e$,1@G\e(B ?\e$,1@H\e(B nil ;; DENTALS
246 ?\e$,1@J\e(B ?\e$,1@K\e(B ?\e$,1@L\e(B ?\e$,1@M\e(B ?\e$,1@N\e(B ;; LABIALS
247 ?\e$,1@O\e(B ?\e$,1@P\e(B ?\e$,1@Q\e(B ?\e$,1@R\e(B ?\e$,1@S\e(B ?\e$,1@T\e(B ?\e$,1@U\e(B ;; SEMIVOWELS
248 ?\e$,1@V\e(B ?\e$,1@W\e(B ?\e$,1@X\e(B ?\e$,1@Y\e(B ;; SIBILANTS
249 nil nil nil nil nil nil nil nil ;; NUKTAS
250 "\e$,1@<@m@>\e(B" "\e$,1@5@m@W\e(B")
251 (;; Misc Symbols
252 nil ?\e$,1@"\e(B ?\e$,1@#\e(B nil ?\e$,1@m\e(B nil nil)
253 (;; Digits
254 ?\e$,1A&\e(B ?\e$,1A'\e(B ?\e$,1A(\e(B ?\e$,1A)\e(B ?\e$,1A*\e(B ?\e$,1A+\e(B ?\e$,1A,\e(B ?\e$,1A-\e(B ?\e$,1A.\e(B ?\e$,1A/\e(B)
255 (;; Inscript-extra (4) (#, $, ^, *, ])
256 "\e$,1@m@P\e(B" "\e$,1@P@m\e(B" "\e$,1@D@m@P\e(B" "\e$,1@V@m@P\e(B" nil)))
257
258(defvar indian-tml-base-table
259 '(
260 (;; VOWELS
261 (?\e$,1<%\e(B nil) (?\e$,1<&\e(B ?\e$,1<^\e(B) (?\e$,1<'\e(B ?\e$,1<_\e(B) (?\e$,1<(\e(B ?\e$,1<`\e(B) (?\e$,1<)\e(B ?\e$,1<a\e(B) (?\e$,1<*\e(B ?\e$,1<b\e(B)
262 nil nil nil (?\e$,1</\e(B ?\e$,1<g\e(B) (?\e$,1<.\e(B ?\e$,1<f\e(B) (?\e$,1<0\e(B ?\e$,1<h\e(B)
263 nil (?\e$,1<3\e(B ?\e$,1<k\e(B) (?\e$,1<2\e(B ?\e$,1<j\e(B) (?\e$,1<4\e(B ?\e$,1<l\e(B) nil nil)
264 (;; CONSONANTS
265 ?\e$,1<5\e(B nil nil nil ?\e$,1<9\e(B ;; GUTTRULS
266 ?\e$,1<:\e(B nil ?\e$,1<<\e(B nil ?\e$,1<>\e(B ;; PALATALS
267 ?\e$,1<?\e(B nil nil nil ?\e$,1<C\e(B ;; CEREBRALS
268 ?\e$,1<D\e(B nil nil nil ?\e$,1<H\e(B ?\e$,1<I\e(B ;; DENTALS
269 ?\e$,1<J\e(B nil nil nil ?\e$,1<N\e(B ;; LABIALS
270 ?\e$,1<O\e(B ?\e$,1<P\e(B ?\e$,1<Q\e(B ?\e$,1<R\e(B ?\e$,1<S\e(B ?\e$,1<T\e(B ?\e$,1<U\e(B ;; SEMIVOWELS
271 nil ?\e$,1<W\e(B ?\e$,1<X\e(B ?\e$,1<Y\e(B ;; SIBILANTS
272 nil nil nil nil nil nil nil nil ;; NUKTAS
273 "\e$,1<<<m<>\e(B" "\e$,1<5<m<W\e(B")
274 (;; Misc Symbols
275 nil ?\e$,1<"\e(B ?\e$,1<#\e(B nil ?\e$,1<m\e(B nil nil)
276 (;; Digits
277 nil ?\e$,1='\e(B ?\e$,1=(\e(B ?\e$,1=)\e(B ?\e$,1=*\e(B ?\e$,1=+\e(B ?\e$,1=,\e(B ?\e$,1=-\e(B ?\e$,1=.\e(B ?\e$,1=/\e(B)
278 (;; Inscript-extra (4) (#, $, ^, *, ])
279 "\e$,1<m<P\e(B" "\e$,1<P<m\e(B" "\e$,1<D<m<P\e(B" nil nil)))
cd4e9344
RS
280
281(defvar indian-base-table-to-language-alist
282 '((indian-dev-base-table . "Devanagari")
a1506d29 283 (indian-pnj-base-table . "Punjabi")
cd4e9344
RS
284 (indian-ori-base-table . "Oriya")
285 (indian-bng-base-table . "Bengali")
286 (indian-asm-base-table . "Assamese")
287 (indian-tlg-base-table . "Telugu")
288 (indian-knd-base-table . "Kannada")
289 (indian-mlm-base-table . "Malayalam")
290 (indian-tml-base-table . "Tamil")))
291
292(defvar indian-itrans-v5-table
293 '(;; for encode/decode
294 (;; vowels -- 18
295 "a" ("aa" "A") "i" ("ii" "I") "u" ("uu" "U")
b057ab61
KH
296 ("RRi" "R^i") ("LLi" "L^i") (".c" "e.c") "E" "e" "ai"
297 "o.c" "O" "o" "au" ("RRI" "R^I") ("LLI" "L^I"))
a1506d29 298 (;; consonants -- 40
cd4e9344
RS
299 "k" "kh" "g" "gh" ("~N" "N^")
300 "ch" ("Ch" "chh") "j" "jh" ("~n" "JN")
301 "T" "Th" "D" "Dh" "N"
a1506d29 302 "t" "th" "d" "dh" "n" "nh"
cd4e9344
RS
303 "p" "ph" "b" "bh" "m"
304 "y" "r" "rh" "l" ("L" "ld") nil ("v" "w")
305 "sh" ("Sh" "shh") "s" "h"
306 "q" "K" "G" ("J" "z") ".D" ".Dh" "f" ("Y" "yh")
307 ("GY" "dny") "x")
308 (;; misc -- 7
309 ".N" (".n" "M") "H" ".a" ".h" ("AUM" "OM") "..")))
310
311(defvar indian-kyoto-harvard-table
312 '(;; for encode/decode
313 (;; vowel
314 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu")
315 "R" ("L" "lR") nil nil "e" "ai"
316 nil nil "o" "au" ("q" "RR" "Q") ("E" "LL" "lRR"))
317 (;; consonant
318 "k" "kh" "g" "gh" "G"
319 "c" "ch" "j" "jh" "J"
320 "T" "Th" "D" "Dh" "N"
321 "t" "th" "d" "dh" "n" nil
322 "p" "ph" "b" "bh" "m"
323 "y" "r" nil "l" "L" nil "v"
324 ("z" "Z") "S" "s" "h"
325 nil nil nil nil nil nil nil nil
326 nil nil)
327 (;; misc
328 nil "M" "H" "'" nil "." nil)))
329
330(defvar indian-harvard-table
331 '(;; for encode/decode
332 (;; vowel
333 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu")
334 "R" ("L" "lR") nil nil "e" "ai"
335 nil nil "o" "au" ("RR" "q" "Q") ("LL" "E" "lRR"))
336 (;; consonant
337 "k" "kh" "g" "gh" "G"
338 "c" "ch" "j" "jh" "J"
339 "T" "Th" "D" "Dh" "N"
340 "t" "th" "d" "dh" "n" nil
341 "p" "ph" "b" "bh" "m"
342 "y" "r" nil "l" "L" nil "v"
343 ("z" "Z") "S" "s" "h"
344 nil nil nil nil nil nil nil nil
345 nil nil)
346 (;; misc
347 nil "M" "H" "'" nil "." nil)))
348
349(defvar indian-tokyo-table
350 '(;; for encode/decode
351 (;; vowel
352 "a" ("A" "aa") "i" ("I" "ii") "u" ("U" "uu")
353 "R" ("L" "lR") nil nil "e" "ai"
354 nil nil "o" "au" ("Q" "RR" "q") ("E" "LL" "lRR"))
355 (;; consonant
356 "k" "kh" "g" "gh" "G"
357 "c" "ch" "j" "jh" "J"
358 "T" "Th" "D" "Dh" "N"
359 "t" "th" "d" "dh" "n" nil
360 "p" "ph" "b" "bh" "m"
361 "y" "r" nil "l" "L" nil "v"
362 ("Z" "z") "S" "s" "h"
363 nil nil nil nil nil nil nil nil
364 nil nil)
365 (;; misc
366 nil "M" "H" "'" nil "." nil)))
367
368(defvar indian-aiba-table
369 '(;; for encode/decode
370 (;; vowel
371 "a" "aa" "i" "ii" "u" "uu"
372 ".r" ".l" nil nil "e" "ai"
373 nil nil "o" "au" "~r" "~l")
374 (;; consonant
375 "k" "kh" "g" "gh" "^n"
376 "c" "ch" "j" "jh" "~n"
377 ".t" ".th" ".d" ".dh" ".n"
378 "t" "th" "d" "dh" "n" nil
379 "p" "ph" "b" "bh" "m"
380 "y" "r" nil "l" nil nil "v"
381 "^s" ".s" "s" "h"
382 nil nil nil nil nil nil nil nil
383 nil nil)
384 (;; misc
385 nil ".m" ".h" "'" nil "." nil)))
386
387(defun mapthread (function seq1 &rest seqrest)
388 "Apply FUNCTION to each element of SEQ1 and return result list.
389If there are several SEQRESTs, FUNCTION is called with that many
390arguments, with all possible combinations of these multiple SEQUENCES.
391Thus, if SEQ1 contains 3 elements and SEQ2 contains 5 elements, then
392FUNCTION will be called 15 times."
393 (if seqrest
a1506d29 394 (mapcar
cd4e9344 395 (lambda (x)
a1506d29
JB
396 (apply
397 'mapthread
da490c95 398 `(lambda (&rest y) (apply ',function x y))
cd4e9344
RS
399 seqrest))
400 seq1)
401 (mapcar function seq1)))
402
403(defun indian--puthash-char (char trans-char hashtbls)
404 (let ((encode-hash (car hashtbls)) ;; char -> trans
405 (decode-hash (cdr hashtbls)) ;; trans -> char
406 )
407 ;; char -- nil / char / string (/ list of vowel & matra)
408 ;; trans-char -- nil / string / list of strings
409 (when (and char trans-char)
410 (if (stringp trans-char) (setq trans-char (list trans-char)))
19150538 411 (if (characterp char) (setq char (char-to-string char)))
cd4e9344 412 (puthash char (car trans-char) encode-hash)
462a7ed6
SM
413 (dolist (trans trans-char)
414 (puthash trans char decode-hash)))))
cd4e9344 415
e6432b68
DL
416(defun indian--map (f l1 l2)
417 (while l1
418 (funcall f (pop l1) (pop l2))))
419
cd4e9344 420(defun indian--puthash-v (v trans-v hashtbls)
a1506d29 421 (indian--map
e6432b68
DL
422 (lambda (v trans-v)
423 (indian--puthash-char (car v) trans-v hashtbls))
cd4e9344
RS
424 v trans-v))
425
426(defun indian--puthash-c (c trans-c halant hashtbls)
e6432b68
DL
427 (indian--map
428 (lambda (c trans-c)
19150538 429 (if (characterp c) (setq c (char-to-string c)))
e6432b68 430 (indian--puthash-char (concat c halant) trans-c hashtbls))
cd4e9344
RS
431 c trans-c))
432
433(defun indian--puthash-m (m trans-m hashtbls)
e6432b68
DL
434 (indian--map
435 (lambda (m trans-m)
436 (indian--puthash-char m trans-m hashtbls))
cd4e9344
RS
437 m trans-m))
438
439(defun indian--puthash-cv (c trans-c v trans-v hashtbls)
e6432b68
DL
440 (indian--map
441 (lambda (c trans-c)
442 (indian--map
443 (lambda (v trans-v)
444 (when (and c trans-c v trans-v)
19150538
DL
445 (if (characterp c) (setq c (char-to-string c)))
446 (setq v (if (characterp (cadr v)) (char-to-string (cadr v)) ""))
e6432b68
DL
447 (if (stringp trans-c) (setq trans-c (list trans-c)))
448 (if (stringp trans-v) (setq trans-v (list trans-v)))
a1506d29 449 (indian--puthash-char
e6432b68
DL
450 (concat c v)
451 (apply 'append
452 (mapthread 'concat trans-c trans-v))
453 hashtbls)))
454 v trans-v))
cd4e9344
RS
455 c trans-c))
456
457(defun indian-make-hash (table trans-table)
458 "Indian Transliteration Hash for decode/encode"
b1432379
SM
459 (let* ((encode-hash (make-hash-table :test 'equal))
460 (decode-hash (make-hash-table :test 'equal))
cd4e9344
RS
461 (hashtbls (cons encode-hash decode-hash))
462 (vowels (elt table 0))
463 (consonants (elt table 1))
464 (misc (elt table 2))
465 (digits (elt table 3))
466 (halant (char-to-string (elt misc 4)))
467 (trans-vowels (elt trans-table 0))
468 (trans-consonants (elt trans-table 1))
469 (trans-misc (elt trans-table 2))
470 (trans-digits '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")))
471 (indian--puthash-v vowels trans-vowels hashtbls)
472 (indian--puthash-c consonants trans-consonants halant hashtbls)
a1506d29 473 (indian--puthash-cv consonants trans-consonants
cd4e9344
RS
474 vowels trans-vowels hashtbls)
475 (indian--puthash-m misc trans-misc hashtbls)
476 (indian--puthash-m digits trans-digits hashtbls)
477 hashtbls))
478
479(defvar indian-dev-itrans-v5-hash
480 (indian-make-hash indian-dev-base-table
481 indian-itrans-v5-table))
482(defvar indian-dev-kyoto-harvard-hash
483 (indian-make-hash indian-dev-base-table
484 indian-kyoto-harvard-table))
485(defvar indian-dev-aiba-hash
486 (indian-make-hash indian-dev-base-table
487 indian-aiba-table))
488
c7357293
KH
489(defvar indian-pnj-itrans-v5-hash
490 (indian-make-hash indian-pnj-base-table
491 indian-itrans-v5-table))
492
493(defvar indian-gjr-itrans-v5-hash
494 (indian-make-hash indian-gjr-base-table
495 indian-itrans-v5-table))
496
497(defvar indian-ori-itrans-v5-hash
498 (indian-make-hash indian-ori-base-table
499 indian-itrans-v5-table))
500
501(defvar indian-bng-itrans-v5-hash
502 (indian-make-hash indian-bng-base-table
503 indian-itrans-v5-table))
504
505(defvar indian-asm-itrans-v5-hash
506 (indian-make-hash indian-asm-base-table
507 indian-itrans-v5-table))
508
509(defvar indian-tlg-itrans-v5-hash
510 (indian-make-hash indian-tlg-base-table
511 indian-itrans-v5-table))
512
513(defvar indian-knd-itrans-v5-hash
514 (indian-make-hash indian-knd-base-table
515 indian-itrans-v5-table))
516
517(defvar indian-mlm-itrans-v5-hash
518 (indian-make-hash indian-mlm-base-table
519 indian-itrans-v5-table))
520
521(defvar indian-tml-itrans-v5-hash
522 (indian-make-hash indian-tml-base-table
523 indian-itrans-v5-table))
cd4e9344
RS
524)
525
526(defmacro indian-translate-region (from to hashtable encode-p)
527 `(save-excursion
528 (save-restriction
a1506d29
JB
529 (let ((regexp ,(indian-regexp-of-hashtbl-keys
530 (if encode-p (car (eval hashtable))
cd4e9344
RS
531 (cdr (eval hashtable))))))
532 (narrow-to-region from to)
533 (goto-char (point-min))
534 (while (re-search-forward regexp nil t)
a1506d29 535 (let ((matchstr (gethash (match-string 0)
e6432b68
DL
536 (if ,encode-p
537 (car ,hashtable)
538 (cdr ,hashtable)))))
cd4e9344
RS
539 (if matchstr (replace-match matchstr))))))))
540
541;;;
542
543(defun indian-dev-itrans-v5-encode-region (from to)
544 (interactive "r")
a1506d29 545 (indian-translate-region
cd4e9344
RS
546 from to indian-dev-itrans-v5-hash t))
547
548(defun indian-dev-itrans-v5-decode-region (from to)
549 (interactive "r")
550 (indian-translate-region
551 from to indian-dev-itrans-v5-hash nil))
552
553(defun indian-dev-kyoto-harvard-encode-region (from to)
554 (interactive "r")
a1506d29 555 (indian-translate-region
cd4e9344
RS
556 from to indian-dev-kyoto-harvard-hash t))
557
558(defun indian-dev-kyoto-harvard-decode-region (from to)
559 (interactive "r")
560 (indian-translate-region
561 from to indian-dev-kyoto-harvard-hash nil))
562
563(defun indian-dev-aiba-encode-region (from to)
564 (interactive "r")
a1506d29 565 (indian-translate-region
cd4e9344
RS
566 from to indian-dev-aiba-hash t))
567
568(defun indian-dev-aiba-decode-region (from to)
569 (interactive "r")
570 (indian-translate-region
571 from to indian-dev-aiba-hash nil))
572
573
574
575
576;;; IS 13194 utilities
577
578;; The followings provide conversion between IS 13194 (ISCII) and UCS.
579
3ff57641 580(let
8f924df7 581 ;;Unicode vs IS13194 ;; only Devanagari is supported now.
3ff57641
DL
582 ((ucs-devanagari-to-is13194-alist
583 '((?\x0900 . "[U+0900]")
584 (?\x0901 . "\e(5!\e(B")
585 (?\x0902 . "\e(5"\e(B")
586 (?\x0903 . "\e(5#\e(B")
587 (?\x0904 . "[U+0904]")
588 (?\x0905 . "\e(5$\e(B")
589 (?\x0906 . "\e(5%\e(B")
590 (?\x0907 . "\e(5&\e(B")
591 (?\x0908 . "\e(5'\e(B")
592 (?\x0909 . "\e(5(\e(B")
593 (?\x090a . "\e(5)\e(B")
594 (?\x090b . "\e(5*\e(B")
595 (?\x090c . "\e(5&i\e(B")
596 (?\x090d . "\e(5.\e(B")
597 (?\x090e . "\e(5+\e(B")
598 (?\x090f . "\e(5,\e(B")
599 (?\x0910 . "\e(5-\e(B")
600 (?\x0911 . "\e(52\e(B")
601 (?\x0912 . "\e(5/\e(B")
602 (?\x0913 . "\e(50\e(B")
603 (?\x0914 . "\e(51\e(B")
604 (?\x0915 . "\e(53\e(B")
605 (?\x0916 . "\e(54\e(B")
606 (?\x0917 . "\e(55\e(B")
607 (?\x0918 . "\e(56\e(B")
608 (?\x0919 . "\e(57\e(B")
609 (?\x091a . "\e(58\e(B")
610 (?\x091b . "\e(59\e(B")
611 (?\x091c . "\e(5:\e(B")
612 (?\x091d . "\e(5;\e(B")
613 (?\x091e . "\e(5<\e(B")
614 (?\x091f . "\e(5=\e(B")
615 (?\x0920 . "\e(5>\e(B")
616 (?\x0921 . "\e(5?\e(B")
617 (?\x0922 . "\e(5@\e(B")
618 (?\x0923 . "\e(5A\e(B")
619 (?\x0924 . "\e(5B\e(B")
620 (?\x0925 . "\e(5C\e(B")
621 (?\x0926 . "\e(5D\e(B")
622 (?\x0927 . "\e(5E\e(B")
623 (?\x0928 . "\e(5F\e(B")
624 (?\x0929 . "\e(5G\e(B")
625 (?\x092a . "\e(5H\e(B")
626 (?\x092b . "\e(5I\e(B")
627 (?\x092c . "\e(5J\e(B")
628 (?\x092d . "\e(5K\e(B")
629 (?\x092e . "\e(5L\e(B")
630 (?\x092f . "\e(5M\e(B")
631 (?\x0930 . "\e(5O\e(B")
632 (?\x0931 . "\e(5P\e(B")
633 (?\x0932 . "\e(5Q\e(B")
634 (?\x0933 . "\e(5R\e(B")
635 (?\x0934 . "\e(5S\e(B")
636 (?\x0935 . "\e(5T\e(B")
637 (?\x0936 . "\e(5U\e(B")
638 (?\x0937 . "\e(5V\e(B")
639 (?\x0938 . "\e(5W\e(B")
640 (?\x0939 . "\e(5X\e(B")
641 (?\x093a . "[U+093a]")
642 (?\x093b . "[U+093b]")
643 (?\x093c . "\e(5i\e(B")
644 (?\x093d . "\e(5ji\e(B")
645 (?\x093e . "\e(5Z\e(B")
646 (?\x093f . "\e(5[\e(B")
647 (?\x0940 . "\e(5\\e(B")
648 (?\x0941 . "\e(5]\e(B")
649 (?\x0942 . "\e(5^\e(B")
650 (?\x0943 . "\e(5_\e(B")
651 (?\x0944 . "\e(5_i\e(B")
652 (?\x0945 . "\e(5c\e(B")
653 (?\x0946 . "\e(5`\e(B")
654 (?\x0947 . "\e(5a\e(B")
655 (?\x0948 . "\e(5b\e(B")
656 (?\x0949 . "\e(5g\e(B")
657 (?\x094a . "\e(5d\e(B")
658 (?\x094b . "\e(5e\e(B")
659 (?\x094c . "\e(5f\e(B")
660 (?\x094d . "\e(5h\e(B")
661 (?\x094e . "[U+094e]")
662 (?\x094f . "[U+094f]")
663 (?\x0950 . "\e(5!i\e(B")
664 (?\x0951 . "\e(5p5\e(B")
665 (?\x0952 . "\e(5p8\e(B")
666 (?\x0953 . "[DEVANAGARI GRAVE ACCENT]")
667 (?\x0954 . "[DEVANAGARI ACUTE ACCENT]")
668 (?\x0955 . "[U+0955]")
669 (?\x0956 . "[U+0956]")
670 (?\x0957 . "[U+0957]")
671 (?\x0958 . "\e(53i\e(B")
672 (?\x0959 . "\e(54i\e(B")
673 (?\x095a . "\e(55i\e(B")
674 (?\x095b . "\e(5:i\e(B")
675 (?\x095c . "\e(5?i\e(B")
676 (?\x095d . "\e(5@i\e(B")
677 (?\x095e . "\e(5Ii\e(B")
678 (?\x095f . "\e(5N\e(B")
679 (?\x0960 . "\e(5*i\e(B")
680 (?\x0961 . "\e(5'i\e(B")
681 (?\x0962 . "\e(5[i\e(B")
682 (?\x0963 . "\e(5ei\e(B")
683 (?\x0964 . "\e(5j\e(B")
684 (?\x0965 . "\e(5jj\e(B")
685 (?\x0966 . "\e(5q\e(B")
686 (?\x0967 . "\e(5r\e(B")
687 (?\x0968 . "\e(5s\e(B")
688 (?\x0969 . "\e(5t\e(B")
689 (?\x096a . "\e(5u\e(B")
690 (?\x096b . "\e(5v\e(B")
691 (?\x096c . "\e(5w\e(B")
692 (?\x096d . "\e(5x\e(B")
693 (?\x096e . "\e(5y\e(B")
694 (?\x096f . "\e(5z\e(B")
695 (?\x0970 . "[U+0970]")
696 (?\x0971 . "[U+0971]")
697 (?\x0972 . "[U+0972]")
698 (?\x0973 . "[U+0973]")
699 (?\x0974 . "[U+0974]")
700 (?\x0975 . "[U+0975]")
701 (?\x0976 . "[U+0976]")
702 (?\x0977 . "[U+0977]")
703 (?\x0978 . "[U+0978]")
704 (?\x0979 . "[U+0979]")
705 (?\x097a . "[U+097a]")
706 (?\x097b . "[U+097b]")
707 (?\x097c . "[U+097c]")
708 (?\x097d . "[U+097d]")
709 (?\x097e . "[U+097e]")
710 (?\x097f . "[U+097f]")))
711 (ucs-bengali-to-is13194-alist nil)
712 (ucs-assamese-to-is13194-alist nil)
713 (ucs-gurmukhi-to-is13194-alist nil)
714 (ucs-gujarati-to-is13194-alist nil)
715 (ucs-oriya-to-is13194-alist nil)
716 (ucs-tamil-to-is13194-alist nil)
717 (ucs-telugu-to-is13194-alist nil)
6b61353c
KH
718 (ucs-malayalam-to-is13194-alist nil)
719 (ucs-kannada-to-is13194-alist nil))
3ff57641 720 (dolist (script '(devanagari bengali assamese gurmukhi gujarati
6b61353c 721 oriya tamil telugu malayalam kannada))
f47a2e09
DL
722 (let ((hashtable (intern (concat "is13194-to-ucs-"
723 (symbol-name script) "-hashtbl" )))
724 (regexp (intern (concat "is13194-to-ucs-"
725 (symbol-name script) "-regexp"))))
cd4e9344 726 (set hashtable (make-hash-table :test 'equal :size 128))
3ff57641
DL
727 (dolist (x (eval (intern (concat "ucs-" (symbol-name script)
728 "-to-is13194-alist"))))
729 (put-char-code-property (car x) 'script script)
730 (put-char-code-property (car x) 'iscii (cdr x))
731 (puthash (cdr x) (char-to-string (car x)) (eval hashtable)))
8f924df7
KH
732 (set regexp (indian-regexp-of-hashtbl-keys (eval hashtable))))))
733
734(defvar is13194-default-repertory 'devanagari)
cd4e9344
RS
735
736(defvar is13194-repertory-to-ucs-script
8f924df7
KH
737 `((DEF ?\x40 ,is13194-default-repertory)
738 (RMN ?\x41 ,is13194-default-repertory)
cd4e9344
RS
739 (DEV ?\x42 devanagari)
740 (BNG ?\x43 bengali)
741 (TML ?\x44 tamil)
742 (TLG ?\x45 telugu)
743 (ASM ?\x46 bengali)
744 (ORI ?\x47 oriya)
745 (KND ?\x48 kannada)
746 (MLM ?\x49 malayalam)
747 (GJR ?\x4a gujarati)
748 (PNJ ?\x4b gurmukhi)))
749
750;; for guiding find-variable function.
751(defvar is13194-to-ucs-devanagari-hashtbl nil)
752(defvar is13194-to-ucs-devanagari-regexp nil)
753(defvar is13194-to-ucs-bengali-hashtbl nil)
754(defvar is13194-to-ucs-bengali-regexp nil)
755(defvar is13194-to-ucs-assamese-hashtbl nil)
756(defvar is13194-to-ucs-assamese-regexp nil)
757(defvar is13194-to-ucs-gurmukhi-hashtbl nil)
758(defvar is13194-to-ucs-gurmukhi-regexp nil)
759(defvar is13194-to-ucs-gujarati-hashtbl nil)
760(defvar is13194-to-ucs-gujarati-regexp nil)
761(defvar is13194-to-ucs-oriya-hashtbl nil)
762(defvar is13194-to-ucs-oriya-regexp nil)
763(defvar is13194-to-ucs-tamil-hashtbl nil)
764(defvar is13194-to-ucs-tamil-regexp nil)
765(defvar is13194-to-ucs-telugu-hashtbl nil)
766(defvar is13194-to-ucs-telugu-regexp nil)
767(defvar is13194-to-ucs-malayalam-hashtbl nil)
768(defvar is13194-to-ucs-malayalam-regexp nil)
6b61353c
KH
769(defvar is13194-to-ucs-kannada-hashtbl nil)
770(defvar is13194-to-ucs-kannada-regexp nil)
cd4e9344 771
cd4e9344
RS
772(defvar ucs-to-is13194-regexp
773 ;; only Devanagari is supported now.
19150538 774 (concat "[" (char-to-string #x0900)
8f924df7 775 "-" (char-to-string #x097f) "]")
cd4e9344
RS
776 "Regexp that matches to conversion")
777
778(defun ucs-to-iscii-region (from to)
a1506d29 779 "Converts the indian UCS characters in the region to ISCII.
cd4e9344
RS
780Returns new end position."
781 (interactive "r")
782 ;; only Devanagari is supported now.
783 (save-excursion
784 (save-restriction
785 (narrow-to-region from to)
786 (goto-char (point-min))
f47a2e09
DL
787 (let* ((current-repertory is13194-default-repertory))
788 (while (re-search-forward ucs-to-is13194-regexp nil t)
789 (replace-match
790 (get-char-code-property (string-to-char (match-string 0))
791 'iscii))))
cd4e9344
RS
792 (point-max))))
793
794(defun iscii-to-ucs-region (from to)
a1506d29 795 "Converts the ISCII characters in the region to UCS.
cd4e9344
RS
796Returns new end position."
797 (interactive "r")
798 ;; only Devanagari is supported now.
799 (save-excursion
800 (save-restriction
801 (narrow-to-region from to)
802 (goto-char (point-min))
f47a2e09
DL
803 (let* ((current-repertory is13194-default-repertory)
804 (current-hashtable
805 (intern (concat "is13194-to-ucs-"
806 (symbol-name current-repertory) "-hashtbl")))
807 (current-regexp
808 (intern (concat "is13194-to-ucs-"
809 (symbol-name current-repertory) "-regexp")))
810 (re (eval current-regexp))
12bb15ad 811 (hash (eval current-hashtable)))
f47a2e09
DL
812 (while (re-search-forward re nil t)
813 (replace-match (gethash (match-string 0) hash ""))))
cd4e9344
RS
814 (point-max))))
815
816;;;###autoload
817(defun indian-compose-region (from to)
6acef79f 818 "Compose the region according to `composition-function-table'."
cd4e9344
RS
819 (interactive "r")
820 (save-excursion
821 (save-restriction
6acef79f 822 (let ((pos from) newpos func (max to))
f47a2e09
DL
823 (narrow-to-region from to)
824 (while (< pos max)
6acef79f
KH
825 (setq func (aref composition-function-table (char-after pos)))
826 (if (fboundp func)
827 (setq newpos (funcall func pos nil)
828 pos (if (and (integerp newpos) (> newpos pos))
829 newpos (1+ pos)))
830 (setq pos (1+ pos))))))))
cd4e9344
RS
831
832;;;###autoload
833(defun indian-compose-string (string)
a1506d29 834 (with-temp-buffer
cd4e9344
RS
835 (insert string)
836 (indian-compose-region (point-min) (point-max))
837 (buffer-string)))
838
839;;;###autoload
840(defun in-is13194-post-read-conversion (len)
841 (let ((pos (point)) endpos)
842 (setq endpos (iscii-to-ucs-region pos (+ pos len)))
cd4e9344
RS
843 (- endpos pos)))
844
845;;;###autoload
846(defun in-is13194-pre-write-conversion (from to)
847 (let ((buf (current-buffer)))
848 (set-buffer (generate-new-buffer " *temp*"))
849 (if (stringp from)
850 (insert from)
851 (insert-buffer-substring buf from to))
852 (ucs-to-iscii-region (point-min) (point-max))
853 nil))
854
855
856
857
858;;; Backward Compatibility support programs
859
f47a2e09 860;; The following provides the conversion from old-implementation of
cd4e9344
RS
861;; Emacs Devanagari script to UCS.
862
863(defconst indian-2-colum-to-ucs
864 '(
865 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
866 ;;2120 \e$(6!!!"!#!$!%!&!'!(!)!*!+!,!-!.!/\e(B
867 ("\e$(6!!\e(B" . "\e$,15A\e(B")
868 ("\e$(6!"\e(B" . "\e$,15B\e(B")
869 ("\e$(6!#\e(B" . "\e$,15C\e(B")
870 ("\e$(6!$\e(B" . "\e$,15E\e(B")
871 ("\e$(6!%\e(B" . "\e$,15F\e(B")
872 ("\e$(6!&\e(B" . "\e$,15G\e(B")
873 ("\e$(6!'\e(B" . "\e$,15H\e(B")
874 ("\e$(6!(\e(B" . "\e$,15I\e(B")
875 ("\e$(6!)\e(B" . "\e$,15J\e(B")
876 ("\e$(6!*\e(B" . "\e$,15K\e(B")
877 ("\e$(6!*"p\e(B" . "\e$,15p6#\e(B")
878 ("\e$(6!+\e(B" . "\e$,15N\e(B")
879 ("\e$(6!,\e(B" . "\e$,15O\e(B")
880 ("\e$(6!-\e(B" . "\e$,15P\e(B")
881 ("\e$(6!.\e(B" . "\e$,15M\e(B")
882 ("\e$(6!/\e(B" . "\e$,15R\e(B")
cd4e9344 883 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
884 ;;2130 \e$(6!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>!?\e(B
885 ("\e$(6!0\e(B" . "\e$,15S\e(B")
886 ("\e$(6!1\e(B" . "\e$,15T\e(B")
887 ("\e$(6!2\e(B" . "\e$,15Q\e(B")
888 ("\e$(6!3\e(B" . "\e$,15U\e(B")
889 ("\e$(6!4\e(B" . "\e$,15V\e(B")
890 ("\e$(6!5\e(B" . "\e$,15W\e(B")
891 ("\e$(6!6\e(B" . "\e$,15X\e(B")
892 ("\e$(6!7\e(B" . "\e$,15Y\e(B")
893 ("\e$(6!8\e(B" . "\e$,15Z\e(B")
894 ("\e$(6!9\e(B" . "\e$,15[\e(B")
895 ("\e$(6!:\e(B" . "\e$,15\\e(B")
896 ("\e$(6!;\e(B" . "\e$,15]\e(B")
897 ("\e$(6!<\e(B" . "\e$,15^\e(B")
898 ("\e$(6!=\e(B" . "\e$,15_\e(B")
899 ("\e$(6!>\e(B" . "\e$,15`\e(B")
900 ("\e$(6!?\e(B" . "\e$,15a\e(B")
cd4e9344 901 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
902 ;;2140 \e$(6!@!A!B!C!D!E!F!G!H!I!J!K!L!M!N!O\e(B
903 ("\e$(6!@\e(B" . "\e$,15b\e(B")
904 ("\e$(6!A\e(B" . "\e$,15c\e(B")
905 ("\e$(6!B\e(B" . "\e$,15d\e(B")
906 ("\e$(6!C\e(B" . "\e$,15e\e(B")
907 ("\e$(6!D\e(B" . "\e$,15f\e(B")
908 ("\e$(6!E\e(B" . "\e$,15g\e(B")
909 ("\e$(6!F\e(B" . "\e$,15h\e(B")
910 ("\e$(6!G\e(B" . "\e$,15i\e(B")
911 ("\e$(6!H\e(B" . "\e$,15j\e(B")
912 ("\e$(6!I\e(B" . "\e$,15k\e(B")
913 ("\e$(6!J\e(B" . "\e$,15l\e(B")
914 ("\e$(6!K\e(B" . "\e$,15m\e(B")
915 ("\e$(6!L\e(B" . "\e$,15n\e(B")
916 ("\e$(6!M\e(B" . "\e$,15o\e(B")
917 ("\e$(6!N\e(B" . "\e$,16?\e(B")
918 ("\e$(6!O\e(B" . "\e$,15p\e(B")
cd4e9344 919 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
920 ;;2150 \e$(6!P!Q!R!S!T!U!V!W!X!Y!Z![!\!]!^!_\e(B
921 ("\e$(6!P\e(B" . "\e$,15q\e(B")
922 ("\e$(6!Q\e(B" . "\e$,15r\e(B")
923 ("\e$(6!R\e(B" . "\e$,15s\e(B")
924 ("\e$(6!S\e(B" . "\e$,15t\e(B")
925 ("\e$(6!T\e(B" . "\e$,15u\e(B")
926 ("\e$(6!U\e(B" . "\e$,15v\e(B")
927 ("\e$(6!V\e(B" . "\e$,15w\e(B")
928 ("\e$(6!W\e(B" . "\e$,15x\e(B")
929 ("\e$(6!X\e(B" . "\e$,15y\e(B")
930 ("\e$(6!Z\e(B" . "\e$,15~\e(B")
931 ("\e$(6![\e(B" . "\e$,15\7f\e(B")
932 ("\e$(6!\\e(B" . "\e$,16 \e(B")
933 ("\e$(6!]\e(B" . "\e$,16!\e(B")
934 ("\e$(6!^\e(B" . "\e$,16"\e(B")
935 ("\e$(6!_\e(B" . "\e$,16#\e(B")
cd4e9344 936 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
937 ;;2160 \e$(6!`!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o\e(B
938 ("\e$(6!`\e(B" . "\e$,16&\e(B")
939 ("\e$(6!a\e(B" . "\e$,16'\e(B")
940 ("\e$(6!b\e(B" . "\e$,16(\e(B")
941 ("\e$(6!c\e(B" . "\e$,16%\e(B")
942 ("\e$(6!d\e(B" . "\e$,16*\e(B")
943 ("\e$(6!e\e(B" . "\e$,16+\e(B")
944 ("\e$(6!f\e(B" . "\e$,16,\e(B")
945 ("\e$(6!g\e(B" . "\e$,16)\e(B")
946 ("\e$(6!h\e(B" . "\e$,16-\e(B")
947 ("\e$(6!i\e(B" . "\e$,15|\e(B")
948 ("\e$(6!j\e(B" . "\e$,16D\e(B")
949 ("\e$(6!j!j\e(B" . "\e$,16E\e(B")
cd4e9344 950 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
951 ;;2170 \e$(6!p!q!r!s!t!u!v!w!x!y!z!{!|!}!~\e(B
952 ("\e$(6!q\e(B" . "\e$,16F\e(B")
953 ("\e$(6!r\e(B" . "\e$,16G\e(B")
954 ("\e$(6!s\e(B" . "\e$,16H\e(B")
955 ("\e$(6!t\e(B" . "\e$,16I\e(B")
956 ("\e$(6!u\e(B" . "\e$,16J\e(B")
957 ("\e$(6!v\e(B" . "\e$,16K\e(B")
958 ("\e$(6!w\e(B" . "\e$,16L\e(B")
959 ("\e$(6!x\e(B" . "\e$,16M\e(B")
960 ("\e$(6!y\e(B" . "\e$,16N\e(B")
961 ("\e$(6!z\e(B" . "\e$,16O\e(B")
cd4e9344 962 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
963 ;;2220 \e$(6"!"""#"$"%"&"'"(")"*"+","-"."/\e(B
964 ("\e$(6"!\e(B" . "\e$,16;6-5p\e(B")
965 ("\e$(6""\e(B" . "\e$,16>6-5p\e(B")
966 ("\e$(6"#\e(B" . "\e$,15U6-5p\e(B")
967 ("\e$(6"$\e(B" . "\e$,15W6-5p\e(B")
968 ("\e$(6"%\e(B" . "\e$,15d6-5p\e(B")
969 ("\e$(6"&\e(B" . "\e$,15j6-5p\e(B")
970 ("\e$(6"'\e(B" . "\e$,15k6-5p\e(B")
971 ("\e$(6")\e(B" . "\e$,15v6-5p\e(B")
972 ("\e$(6",\e(B" . "\e$,15p6!\e(B")
973 ("\e$(6"-\e(B" . "\e$,15p6"\e(B")
974 ("\e$(6".\e(B" . "\e$,15q6!\e(B")
975 ("\e$(6"/\e(B" . "\e$,15q6"\e(B")
cd4e9344 976 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
977 ;;2230 \e$(6"0"1"2"3"4"5"6"7"8"9":";"<"=">"?\e(B
978 ("\e$(6"3\e(B" . "\e$,15U6-\e(B")
979 ("\e$(6"4\e(B" . "\e$,15V6-\e(B")
980 ("\e$(6"5\e(B" . "\e$,15W6-\e(B")
981 ("\e$(6"6\e(B" . "\e$,15X6-\e(B")
982 ("\e$(6"8\e(B" . "\e$,15Z6-\e(B")
983 ("\e$(6"8"q\e(B" . "\e$,15Z6-5p6-\e(B")
984 ("\e$(6":\e(B" . "\e$,15\6-\e(B")
985 ("\e$(6";\e(B" . "\e$,15]6-\e(B")
986 ("\e$(6"<\e(B" . "\e$,15^6-\e(B")
987 ("\e$(6"<\e(B" . "\e$,15^6-\e(B")
cd4e9344 988 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
989 ;;2240 \e$(6"@"A"B"C"D"E"F"G"H"I"J"K"L"M"N"O\e(B
990 ("\e$(6"A\e(B" . "\e$,15c6-\e(B")
991 ("\e$(6"B\e(B" . "\e$,15d6-\e(B")
992 ("\e$(6"C\e(B" . "\e$,15e6-\e(B")
993 ("\e$(6"E\e(B" . "\e$,15g6-\e(B")
994 ("\e$(6"F\e(B" . "\e$,15h6-\e(B")
995 ("\e$(6"G\e(B" . "\e$,15i6-\e(B")
996 ("\e$(6"H\e(B" . "\e$,15j6-\e(B")
997 ("\e$(6"I\e(B" . "\e$,15k6-\e(B")
998 ("\e$(6"J\e(B" . "\e$,15l6-\e(B")
999 ("\e$(6"J\e(B" . "\e$,15l6-\e(B")
1000 ("\e$(6"K\e(B" . "\e$,15m6-\e(B")
1001 ("\e$(6"L\e(B" . "\e$,15n6-\e(B")
1002 ("\e$(6"M\e(B" . "\e$,15o6-\e(B")
1003 ("\e$(6"N\e(B" . "\e$,16?6-\e(B")
cd4e9344 1004 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1005 ;;2250 \e$(6"P"Q"R"S"T"U"V"W"X"Y"Z"["\"]"^"_\e(B
1006 ("\e$(6"Q\e(B" . "\e$,15r6-\e(B")
1007 ("\e$(6"R\e(B" . "\e$,15s6-\e(B")
1008 ("\e$(6"S\e(B" . "\e$,15t6-\e(B")
1009 ("\e$(6"T\e(B" . "\e$,15u6-\e(B")
1010 ("\e$(6"U\e(B" . "\e$,15v6-\e(B")
1011 ("\e$(6"V\e(B" . "\e$,15w6-\e(B")
1012 ("\e$(6"W\e(B" . "\e$,15x6-\e(B")
1013 ("\e$(6"]\e(B" . "\e$,16-5o\e(B")
cd4e9344 1014 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1015 ;;2260 \e$(6"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o\e(B
1016 ("\e$(6"`\e(B" . "\e$,15W6-5p6-\e(B")
1017 ("\e$(6"a\e(B" . "\e$,15X6-5h6-\e(B")
1018 ("\e$(6"c\e(B" . "\e$,15d6-5d6-\e(B")
1019 ("\e$(6"d\e(B" . "\e$,15d6-5p6-\e(B")
1020 ("\e$(6"e\e(B" . "\e$,15g6-5h6-\e(B")
1021 ("\e$(6"f\e(B" . "\e$,15g6-5p6-\e(B")
1022 ("\e$(6"g\e(B" . "\e$,15j6-5d6-\e(B")
1023 ("\e$(6"h\e(B" . "\e$,15v6-5Z6-\e(B")
1024 ("\e$(6"i\e(B" . "\e$,15v6-5p6-\e(B")
1025 ("\e$(6"j\e(B" . "\e$,15v6-5u6-\e(B")
1026 ("\e$(6"k\e(B" . "\e$,15h6-5h6-\e(B")
1027 ("\e$(6"l\e(B" . "\e$,15U6-5w6-\e(B")
1028 ("\e$(6"m\e(B" . "\e$,15\6-5^6-\e(B")
cd4e9344 1029 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1030 ;;2270 \e$(6"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~\e(B
1031 ("\e$(6"p\e(B" . "\e$,15p6-\e(B")
1032 ("\e$(6"q\e(B" . "\e$,16-5p\e(B")
1033 ("\e$(6"r\e(B" . "\e$,16-5p\e(B")
1034 ("\e$(6"s\e(B" . "\e$,1686-\e(B")
1035 ("\e$(6"t\e(B" . "\e$,1696-\e(B")
1036 ("\e$(6"u\e(B" . "\e$,16:6-\e(B")
1037 ("\e$(6"y\e(B" . "\e$,16>6-\e(B")
1038 ("\e$(6"z\e(B" . "\e$,16;6-\e(B")
cd4e9344 1039 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1040 ;;2320 \e$(6#!#"###$#%#&#'#(#)#*#+#,#-#.#/\e(B
1041 ("\e$(6#!\e(B" . "\e$,160\e(B")
1042 ("\e$(6#&\e(B" . "\e$,15L\e(B")
1043 ("\e$(6#&"p\e(B" . "\e$,15p6$\e(B")
1044 ("\e$(6#'\e(B" . "\e$,16A\e(B")
1045 ("\e$(6#'"p\e(B" . "\e$,15p6C\e(B")
1046 ("\e$(6#*\e(B" . "\e$,16@\e(B")
1047 ("\e$(6#*"p\e(B" . "\e$,15p6B\e(B")
cd4e9344 1048 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1049 ;;2330 \e$(6#0#1#2#3#4#5#6#7#8#9#:#;#<#=#>#?\e(B
1050 ("\e$(6#3\e(B" . "\e$,168\e(B")
1051 ("\e$(6#4\e(B" . "\e$,169\e(B")
1052 ("\e$(6#5\e(B" . "\e$,16:\e(B")
1053 ("\e$(6#:\e(B" . "\e$,16;\e(B")
1054 ("\e$(6#?\e(B" . "\e$,16<\e(B")
cd4e9344 1055 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1056 ;;2340 \e$(6#@#A#B#C#D#E#F#G#H#I#J#K#L#M#N#O\e(B
1057 ("\e$(6#@\e(B" . "\e$,16=\e(B")
1058 ("\e$(6#I\e(B" . "\e$,16>\e(B")
1059 ("\e$(6#J\e(B" . "\e$,15}\e(B")
1060 ("\e$(6#K\e(B" . "\e$,16$\e(B")
1061 ("\e$(6#L\e(B" . "\e$,16B\e(B")
1062 ("\e$(6#M\e(B" . "\e$,16C\e(B")
cd4e9344 1063 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1064 ;;2350 \e$(6#P#Q#R#S#T#U#V#W#X#Y#Z#[#\#]#^#_\e(B
1065 ("\e$(6#P\e(B" . "\e$,15n6-5h\e(B")
1066 ("\e$(6#Q\e(B" . "\e$,15n6-5r\e(B")
1067 ("\e$(6#R\e(B" . "\e$,15y6#\e(B")
cd4e9344 1068 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1069 ;;2360 \e$(6#`#a#b#c#d#e#f#g#h#i#j#k#l#m#n#o\e(B
1070 ("\e$(6#`\e(B" . "\e$,15r6-5r\e(B")
1071 ("\e$(6#a\e(B" . "\e$,15u6-5h\e(B")
1072 ("\e$(6#b\e(B" . "\e$,15u6-5u\e(B")
1073 ("\e$(6#c\e(B" . "\e$,15v6-5Z\e(B")
1074 ("\e$(6#d\e(B" . "\e$,15v6-5h\e(B")
1075 ("\e$(6#e\e(B" . "\e$,15v6-5l\e(B")
1076 ("\e$(6#f\e(B" . "\e$,15v6-5r\e(B")
1077 ("\e$(6#g\e(B" . "\e$,15v6-5u\e(B")
1078 ("\e$(6#h\e(B" . "\e$,15w6-5_6-5p6-5o\e(B")
1079 ("\e$(6#i\e(B" . "\e$,15w6-5_6-5o\e(B")
1080 ("\e$(6#j\e(B" . "\e$,15w6-5_6-5u\e(B")
1081 ("\e$(6#k\e(B" . "\e$,15w6-5_\e(B")
1082 ("\e$(6#l\e(B" . "\e$,15w6-5`\e(B")
1083 ("\e$(6#m\e(B" . "\e$,15x6-5h\e(B")
1084 ("\e$(6#n\e(B" . "\e$,15x6-5p\e(B")
cd4e9344 1085 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1086 ;;2370 \e$(6#p#q#r#s#t#u#v#w#x#y#z#{#|#}#~\e(B
1087 ("\e$(6#p\e(B" . "\e$,15y6-5c\e(B")
1088 ("\e$(6#q\e(B" . "\e$,15y6-5h\e(B")
1089 ("\e$(6#r\e(B" . "\e$,15y6-5n\e(B")
1090 ("\e$(6#s\e(B" . "\e$,15y6-5o\e(B")
1091 ("\e$(6#t\e(B" . "\e$,15y6-5p\e(B")
1092 ("\e$(6#u\e(B" . "\e$,15y6-5r\e(B")
1093 ("\e$(6#v\e(B" . "\e$,15y6-5u\e(B")
cd4e9344 1094 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1095 ;;2420 \e$(6$!$"$#$$$%$&$'$($)$*$+$,$-$.$/\e(B
1096 ("\e$(6$!\e(B" . "\e$,15U6-5d6-5p6-5o\e(B")
1097 ("\e$(6$"\e(B" . "\e$,15U6-5d6-5u\e(B")
1098 ("\e$(6$#\e(B" . "\e$,15U6-5d6-5o\e(B")
1099 ("\e$(6$$\e(B" . "\e$,15U6-5h6-5o\e(B")
1100 ("\e$(6$%\e(B" . "\e$,15U6-5p6-5o\e(B")
1101 ("\e$(6$&\e(B" . "\e$,15U6-5u6-5o\e(B")
1102 ("\e$(6$'\e(B" . "\e$,15U6-5U\e(B")
1103 ("\e$(6$(\e(B" . "\e$,15U6-5d\e(B")
1104 ("\e$(6$)\e(B" . "\e$,15U6-5h\e(B")
1105 ("\e$(6$*\e(B" . "\e$,15U6-5n\e(B")
1106 ("\e$(6$+\e(B" . "\e$,15U6-5o\e(B")
1107 ("\e$(6$,\e(B" . "\e$,15U6-5r\e(B")
1108 ("\e$(6$-\e(B" . "\e$,15U6-5u\e(B")
1109 ("\e$(6$.\e(B" . "\e$,15U6-5w\e(B")
1110 ("\e$(6$/\e(B" . "\e$,15X6-5h\e(B")
cd4e9344 1111 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1112 ;;2430 \e$(6$0$1$2$3$4$5$6$7$8$9$:$;$<$=$>$?\e(B
1113 ("\e$(6$0\e(B" . "\e$,15Y6-5U6-5d6-5o\e(B")
1114 ("\e$(6$1\e(B" . "\e$,15Y6-5U6-5w6-5u\e(B")
1115 ("\e$(6$2\e(B" . "\e$,15Y6-5U6-5d\e(B")
1116 ("\e$(6$3\e(B" . "\e$,15Y6-5U6-5w\e(B")
1117 ("\e$(6$4\e(B" . "\e$,15Y6-5X6-5p\e(B")
1118 ("\e$(6$5\e(B" . "\e$,15Y6-5U6-5o\e(B")
1119 ("\e$(6$6\e(B" . "\e$,15Y6-5V6-5o\e(B")
1120 ("\e$(6$7\e(B" . "\e$,15Y6-5W6-5o\e(B")
1121 ("\e$(6$8\e(B" . "\e$,15Y6-5X6-5o\e(B")
1122 ("\e$(6$9\e(B" . "\e$,15Y6-5U\e(B")
1123 ("\e$(6$:\e(B" . "\e$,15Y6-5V\e(B")
1124 ("\e$(6$;\e(B" . "\e$,15Y6-5W\e(B")
1125 ("\e$(6$<\e(B" . "\e$,15Y6-5X\e(B")
1126 ("\e$(6$=\e(B" . "\e$,15Y6-5Y\e(B")
1127 ("\e$(6$>\e(B" . "\e$,15Y6-5h\e(B")
1128 ("\e$(6$?\e(B" . "\e$,15Y6-5n\e(B")
cd4e9344 1129 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1130 ;;2440 \e$(6$@$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O\e(B
1131 ("\e$(6$@\e(B" . "\e$,15Y6-5o\e(B")
1132 ("\e$(6$A\e(B" . "\e$,15Z6-5Z\e(B")
1133 ("\e$(6$B\e(B" . "\e$,15Z6-5^\e(B")
1134 ("\e$(6$C\e(B" . "\e$,15[6-5o\e(B")
1135 ("\e$(6$D\e(B" . "\e$,15\6-5p\e(B")
1136 ("\e$(6$E\e(B" . "\e$,15\6-5^\e(B")
1137 ("\e$(6$F\e(B" . "\e$,15^6-5Z\e(B")
1138 ("\e$(6$G\e(B" . "\e$,15^6-5\\e(B")
1139 ("\e$(6$H\e(B" . "\e$,15_6-5U\e(B")
1140 ("\e$(6$I\e(B" . "\e$,15_6-5_\e(B")
1141 ("\e$(6$J\e(B" . "\e$,15_6-5`\e(B")
1142 ("\e$(6$K\e(B" . "\e$,15_6-5o\e(B")
1143 ("\e$(6$L\e(B" . "\e$,15`6-5o\e(B")
1144 ("\e$(6$M\e(B" . "\e$,15a6-5W6-5o\e(B")
1145 ("\e$(6$N\e(B" . "\e$,15a6-5X6-5p\e(B")
1146 ("\e$(6$O\e(B" . "\e$,15a6-5p6-5o\e(B")
cd4e9344 1147 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1148 ;;2450 \e$(6$P$Q$R$S$T$U$V$W$X$Y$Z$[$\$]$^$_\e(B
1149 ("\e$(6$P\e(B" . "\e$,15a6-5W\e(B")
1150 ("\e$(6$Q\e(B" . "\e$,15a6-5X\e(B")
1151 ("\e$(6$R\e(B" . "\e$,15a6-5a\e(B")
1152 ("\e$(6$S\e(B" . "\e$,15a6-5n\e(B")
1153 ("\e$(6$T\e(B" . "\e$,15a6-5o\e(B")
cd4e9344 1154 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1155 ;;2460 \e$(6$`$a$b$c$d$e$f$g$h$i$j$k$l$m$n$o\e(B
1156 ("\e$(6$`\e(B" . "\e$,15b6-5o\e(B")
1157 ("\e$(6$a\e(B" . "\e$,15d6-5d\e(B")
1158 ("\e$(6$b\e(B" . "\e$,15d6-5h\e(B")
1159 ("\e$(6$c\e(B" . "\e$,15f6-5f6-5o\e(B")
1160 ("\e$(6$d\e(B" . "\e$,15f6-5g6-5o\e(B")
1161 ("\e$(6$e\e(B" . "\e$,15f6-5m6-5o\e(B")
1162 ("\e$(6$f\e(B" . "\e$,15f6-5p6-5o\e(B")
1163 ("\e$(6$g\e(B" . "\e$,15f6-5u6-5o\e(B")
1164 ("\e$(6$h\e(B" . "\e$,15f6-5W6-5p\e(B")
1165 ("\e$(6$i\e(B" . "\e$,15f6-5X6-5p\e(B")
1166 ("\e$(6$j\e(B" . "\e$,15f6-5f6-5u\e(B")
1167 ("\e$(6$k\e(B" . "\e$,15f6-5g6-5u\e(B")
1168 ("\e$(6$l\e(B" . "\e$,15f6-5W\e(B")
1169 ("\e$(6$m\e(B" . "\e$,15f6-5X\e(B")
1170 ("\e$(6$n\e(B" . "\e$,15f6-5f\e(B")
1171 ("\e$(6$o\e(B" . "\e$,15f6-5g\e(B")
cd4e9344 1172 ;; 0 1 2 3 4 5 6 7 8 9 a b c d e f
6acef79f
KH
1173 ;;2470 \e$(6$p$q$r$s$t$u$v$w$x$y$z${$|$}$~\e(B
1174 ("\e$(6$p\e(B" . "\e$,15f6-5h\e(B")
1175 ("\e$(6$q\e(B" . "\e$,15f6-5l\e(B")
1176 ("\e$(6$r\e(B" . "\e$,15f6-5m\e(B")
1177 ("\e$(6$s\e(B" . "\e$,15f6-5n\e(B")
1178 ("\e$(6$t\e(B" . "\e$,15f6-5o\e(B")
1179 ("\e$(6$u\e(B" . "\e$,15f6-5u\e(B")
1180 ("\e$(6$v\e(B" . "\e$,15g6-5h\e(B")
1181 ("\e$(6$w\e(B" . "\e$,15h6-5h\e(B")
1182 ("\e$(6$x\e(B" . "\e$,15j6-5d\e(B")
1183 ("\e$(6$y\e(B" . "\e$,15j6-5h\e(B")
1184 ("\e$(6$z\e(B" . "\e$,15j6-5r\e(B")
1185 ("\e$(6${\e(B" . "\e$,15l6-5h\e(B")
1186 ("\e$(6$|\e(B" . "\e$,15l6-5l\e(B")
1187 ("\e$(6$}\e(B" . "\e$,15l6-5u\e(B")
1188 ("\e$(6$~\e(B" . "\e$,15m6-5h\e(B")))
cd4e9344
RS
1189
1190(defconst indian-2-column-to-ucs-regexp
6acef79f 1191 "\e$(6!j!j\e(B\\|\e$(6"8"q\e(B\\|[\e$(6#&#'!*#*\e(B]\e$(6"p\e(B\\|[\e$(6!!\e(B-\e$(6$~\e(B]")
cd4e9344
RS
1192
1193(put 'indian-2-column-to-ucs-chartable 'char-table-extra-slots 1)
1194(defconst indian-2-column-to-ucs-chartable
1195 (let ((table (make-char-table 'indian-2-column-to-ucs-chartable))
f47a2e09 1196 (alist nil))
cd4e9344
RS
1197 (dolist (elt indian-2-colum-to-ucs)
1198 (if (= (length (car elt)) 1)
f47a2e09
DL
1199 (aset table (aref (car elt) 0) (cdr elt))
1200 (setq alist (cons elt alist))))
cd4e9344
RS
1201 (set-char-table-extra-slot table 0 alist)
1202 table))
1203
2ba14a8f 1204;;;###autoload
cd4e9344
RS
1205(defun indian-2-column-to-ucs-region (from to)
1206 "Convert old Emacs Devanagari characters to UCS."
1207 (interactive "r")
1208 (save-excursion
1209 (save-restriction
1210 (let ((pos from)
f47a2e09
DL
1211 (alist (char-table-extra-slot indian-2-column-to-ucs-chartable 0)))
1212 (narrow-to-region from to)
1213 (decompose-region from to)
1214 (goto-char (point-min))
1215 (while (re-search-forward indian-2-column-to-ucs-regexp nil t)
1216 (let ((len (- (match-end 0) (match-beginning 0)))
1217 subst)
1218 (if (= len 1)
1219 (setq subst (aref indian-2-column-to-ucs-chartable
e6432b68 1220 (char-after (match-beginning 0))))
8f924df7 1221 (setq subst (cdr (assoc (match-string 0) alist))))
f47a2e09
DL
1222 (replace-match (if subst subst "?"))))
1223 (indian-compose-region (point-min) (point-max))))))
a1506d29 1224
cd4e9344 1225(provide 'ind-util)
a1506d29 1226
6b61353c 1227;;; arch-tag: 59aacd71-46c2-4cb3-bb26-e12bbad55545
cd4e9344 1228;;; ind-util.el ends here