* lisp/ielm.el (ielm-menu): New menu.
[emacs.git] / leim / quail / indian.el
blobd953a219104f54bddd1105de019cd34080e9fb65
1 ;;; indian.el --- Quail packages for inputting Indian
3 ;; Copyright (C) 2000-2013 Free Software Foundation, Inc.
5 ;; Author: KAWABATA, Taichi <kawabata@m17n.org>
7 ;; Keywords: multilingual, input method, Indian, Devanagari
9 ;; This file is part of GNU Emacs.
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
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
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.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 ;;; Commentary:
26 ;; History:
28 ;; 2000.12.12
29 ;; Totally re-written from devanagari.el to handle multiple Indian Scripts.
31 ;;; Code:
33 (require 'quail)
34 (require 'ind-util)
36 ;;;
37 ;;; Input by transliteration
38 ;;;
40 (defun quail-define-indian-trans-package (hashtbls pkgname
41 lang title doc)
42 (funcall 'quail-define-package pkgname lang title t doc
43 nil nil nil nil nil nil t nil)
44 (maphash
45 (lambda (key val)
46 (quail-defrule key (if (= (length val) 1)
47 (string-to-char val)
48 (vector val))))
49 (cdr hashtbls)))
51 ;; This needs to be seen by quail-update-leim-list-file, but cannot be
52 ;; commented out because quail-update-leim-list-file ignores
53 ;; commented-out lines.
54 (if nil
55 (quail-define-package "devanagari-itrans" "Devanagari" "DevIT" t "Devanagari ITRANS"))
56 (quail-define-indian-trans-package
57 indian-dev-itrans-v5-hash "devanagari-itrans" "Devanagari" "DevIT"
58 "Devanagari transliteration by ITRANS method.")
59 (quail-defrule "..." ?॥)
60 (quail-defrule "\\'" ?॑)
61 (quail-defrule "\\_" ?॒)
62 (quail-defrule "\\__" ?_)
63 (quail-defrule "\\''" ?')
65 (if nil
66 (quail-define-package "devanagari-kyoto-harvard" "Devanagari" "DevKH" t "Devanagari Kyoto-Harvard"))
67 (quail-define-indian-trans-package
68 indian-dev-kyoto-harvard-hash
69 "devanagari-kyoto-harvard" "Devanagari" "DevKH"
70 "Devanagari transliteration by Kyoto-Harvard method.")
72 (if nil
73 (quail-define-package "devanagari-aiba" "Devanagari" "DevAB" t "Devanagari Aiba"))
74 (quail-define-indian-trans-package
75 indian-dev-aiba-hash "devanagari-aiba" "Devanagari" "DevAB"
76 "Devanagari transliteration by Aiba-method.")
78 (if nil
79 (quail-define-package "punjabi-itrans" "Punjabi" "PnjIT" t "Punjabi ITRANS"))
80 (quail-define-indian-trans-package
81 indian-pnj-itrans-v5-hash "punjabi-itrans" "Punjabi" "PnjIT"
82 "Punjabi transliteration by ITRANS method.")
84 (if nil
85 (quail-define-package "gujarati-itrans" "Gujarati" "GjrIT" t "Gujarati ITRANS"))
86 (quail-define-indian-trans-package
87 indian-gjr-itrans-v5-hash "gujarati-itrans" "Gujarati" "GjrIT"
88 "Gujarati transliteration by ITRANS method.")
90 (if nil
91 (quail-define-package "oriya-itrans" "Oriya" "OriIT" t "Oriya ITRANS"))
92 (quail-define-indian-trans-package
93 indian-ori-itrans-v5-hash "oriya-itrans" "Oriya" "OriIT"
94 "Oriya transliteration by ITRANS method.")
96 (if nil
97 (quail-define-package "bengali-itrans" "Bengali" "BngIT" t "Bengali ITRANS"))
98 (quail-define-indian-trans-package
99 indian-bng-itrans-v5-hash "bengali-itrans" "Bengali" "BngIT"
100 "Bengali transliteration by ITRANS method.")
102 (if nil
103 (quail-define-package "assamese-itrans" "Assamese" "AsmIT" t "Assamese ITRANS"))
104 (quail-define-indian-trans-package
105 indian-asm-itrans-v5-hash "assamese-itrans" "Assamese" "AsmIT"
106 "Assamese transliteration by ITRANS method.")
108 (if nil
109 (quail-define-package "telugu-itrans" "Telugu" "TlgIT" t "Telugu ITRANS"))
110 (quail-define-indian-trans-package
111 indian-tlg-itrans-v5-hash "telugu-itrans" "Telugu" "TlgIT"
112 "Telugu transliteration by ITRANS method.")
114 (if nil
115 (quail-define-package "kannada-itrans" "Kannada" "KndIT" t "Kannada ITRANS"))
116 (quail-define-indian-trans-package
117 indian-knd-itrans-v5-hash "kannada-itrans" "Kannada" "KndIT"
118 "Kannada transliteration by ITRANS method.")
120 (if nil
121 (quail-define-package "malayalam-itrans" "Malayalam" "MlmIT" t "Malayalam ITRANS"))
122 (quail-define-indian-trans-package
123 indian-mlm-itrans-v5-hash "malayalam-itrans" "Malayalam" "MlmIT"
124 "Malayalam transliteration by ITRANS method.")
126 (defvar quail-tamil-itrans-syllable-table
127 (let ((vowels
128 '(("அ" nil "a")
129 ("ஆ" "ா" "A")
130 ("இ" "ி" "i")
131 ("ஈ" "ீ" "I")
132 ("உ" "ு" "u")
133 ("ஊ" "ூ" "U")
134 ("எ" "ெ" "e")
135 ("ஏ" "ே" "E")
136 ("ஐ" "ை" "ai")
137 ("ஒ" "ொ" "o")
138 ("ஓ" "ோ" "O")
139 ("ஔ" "ௌ" "au")))
140 (consonants
141 '(("க" "k") ; U+0B95
142 ("ங" "N^") ; U+0B99
143 ("ச" "ch") ; U+0B9A
144 ("ஞ" "JN") ; U+0B9E
145 ("ட" "T") ; U+0B9F
146 ("ண" "N") ; U+0BA3
147 ("த" "t") ; U+0BA4
148 ("ந" "n") ; U+0BA8
149 ("ப" "p") ; U+0BAA
150 ("ம" "m") ; U+0BAE
151 ("ய" "y") ; U+0BAF
152 ("ர" "r") ; U+0BB0
153 ("ல" "l") ; U+0BB2
154 ("வ" "v") ; U+0BB5
155 ("ழ" "z") ; U+0BB4
156 ("ள" "L") ; U+0BB3
157 ("ற" "rh") ; U+0BB1
158 ("ன" "nh") ; U+0BA9
159 ("ஜ" "j") ; U+0B9C
160 ("ஶ" nil) ; U+0BB6
161 ("ஷ" "Sh") ; U+0BB7
162 ("ஸ" "s") ; U+0BB8
163 ("ஹ" "h") ; U+0BB9
164 ("க்ஷ" "x" ) ; U+0B95
166 (virama #x0BCD)
167 clm)
168 (with-temp-buffer
169 (insert "\n")
170 (insert " +")
171 (insert-char ?- 74)
172 (insert "\n |")
173 (setq clm 6)
174 (dolist (v vowels)
175 (insert (propertize "\t" 'display (list 'space :align-to clm))
176 (car v))
177 (setq clm (+ clm 6)))
178 (insert "\n |")
179 (setq clm 6)
180 (dolist (v vowels)
181 (insert (propertize "\t" 'display (list 'space :align-to clm))
182 (nth 2 v))
183 (setq clm (+ clm 6)))
184 (dolist (c consonants)
185 (insert "\n----+")
186 (insert-char ?- 74)
187 (insert "\n")
188 (insert (car c) virama
189 (propertize "\t" 'display '(space :align-to 4))
190 "|")
191 (setq clm 6)
192 (dolist (v vowels)
193 (insert (propertize "\t" 'display (list 'space :align-to clm))
194 (car c) (or (nth 1 v) ""))
195 (setq clm (+ clm 6)))
196 (insert "\n" (or (nth 1 c) "")
197 (propertize "\t" 'display '(space :align-to 4))
198 "|")
199 (setq clm 6)
201 (dolist (v vowels)
202 (apply 'insert (propertize "\t" 'display (list 'space :align-to clm))
203 (if (nth 1 c) (list (nth 1 c) (nth 2 v)) (list "")))
204 (setq clm (+ clm 6))))
205 (insert "\n")
206 (insert "----+")
207 (insert-char ?- 74)
208 (insert "\n")
209 (buffer-string))))
211 (defvar quail-tamil-itrans-numerics-and-symbols-table
212 (let ((numerics '((?௰ "பத்து") (?௱ "நூறு") (?௲ "ஆயிரம்")))
213 (symbols '((?௳ "நாள்") (?௴ "மாதம்") (?௵ "வருடம்")
214 (?௶ "பற்று") (?௷ "வரவு") (?௸ "மேற்படி")
215 (?௹ "ரூபாய்") (?௺ "எண்")))
216 clm)
217 (with-temp-buffer
218 (insert "\n" (make-string 18 ?-) "+" (make-string 60 ?-) "\n")
219 (insert
220 (propertize "\t" 'display '(space :align-to 5)) "numerics"
221 (propertize "\t" 'display '(space :align-to 18)) "|"
222 (propertize "\t" 'display '(space :align-to 45)) "symbols")
223 (insert "\n" (make-string 18 ?-) "+" (make-string 60 ?-) "\n")
224 (dotimes (i 2)
225 (setq clm 0)
226 (dolist (elm numerics)
227 (if (> clm 0)
228 (insert (propertize "\t" 'display (list 'space :align-to clm))))
229 (insert (nth i elm))
230 (setq clm (+ clm 5)))
231 (insert (propertize "\t" 'display '(space :align-to 18)) "|")
232 (setq clm 19)
233 (dolist (elm symbols)
234 (if (> clm 19)
235 (insert (propertize "\t" 'display (list 'space :align-to clm))))
236 (insert (nth i elm))
237 (setq clm (+ clm 8)))
238 (insert "\n"))
239 (insert (make-string 18 ?-) "+" (make-string 60 ?-) "\n")
240 (insert "\n")
241 (buffer-string))))
243 (defvar quail-tamil-itrans-various-signs-and-digits-table
244 (let ((various '((?ஃ . "H") ("ஸ்ரீ" . "srii") (?ௐ)))
245 (digits "௦௧௨௩௪௫௬௭௮௯")
246 (width 6) clm)
247 (with-temp-buffer
248 (insert "\n" (make-string 18 ?-) "+" (make-string 60 ?-) "\n")
249 (insert
250 (propertize "\t" 'display '(space :align-to 5)) "various"
251 (propertize "\t" 'display '(space :align-to 18)) "|"
252 (propertize "\t" 'display '(space :align-to 45)) "digits")
254 (insert "\n" (make-string 18 ?-) "+" (make-string 60 ?-) "\n")
255 (setq clm 0 )
257 (dotimes (i (length various))
258 (insert (propertize "\t" 'display (list 'space :align-to clm))
259 (car (nth i various)))
260 (setq clm (+ clm width)))
261 (insert (propertize "\t" 'display '(space :align-to 18)) "|")
262 (setq clm 20)
263 (dotimes (i 10)
264 (insert (propertize "\t" 'display (list 'space :align-to clm))
265 (aref digits i))
266 (setq clm (+ clm width)))
267 (insert "\n")
268 (setq clm 0)
269 (dotimes (i (length various))
270 (insert (propertize "\t" 'display (list 'space :align-to clm))
271 (or (cdr (nth i various)) ""))
272 (setq clm (+ clm width)))
273 (insert (propertize "\t" 'display '(space :align-to 18)) "|")
274 (setq clm 20)
275 (dotimes (i 10)
276 (insert (propertize "\t" 'display (list 'space :align-to clm))
277 (format "%d" i))
278 (setq clm (+ clm width)))
279 (insert "\n" (make-string 18 ?-) "+" (make-string 60 ?-) "\n")
280 (buffer-string))))
282 (if nil
283 (quail-define-package "tamil-itrans" "Tamil" "TmlIT" t "Tamil ITRANS"))
284 (quail-define-indian-trans-package
285 indian-tml-itrans-v5-hash "tamil-itrans" "Tamil" "TmlIT"
286 "Tamil transliteration by ITRANS method.
288 You can input characters using the following mapping tables.
289 Example: To enter வணக்கம், type vaNakkam.
291 ### Basic syllables (consonants + vowels) ###
292 \\<quail-tamil-itrans-syllable-table>
294 ### Miscellaneous (various signs + digits) ###
295 \\<quail-tamil-itrans-various-signs-and-digits-table>
297 ### Others (numerics + symbols) ###
299 Characters below have no ITRANS method associated with them.
300 Their descriptions are included for easy reference.
301 \\<quail-tamil-itrans-numerics-and-symbols-table>
303 Full key sequences are listed below:")
306 ;;; Input by Inscript
309 (defun quail-define-inscript-package (char-tables key-tables pkgname lang
310 title docstring)
311 (funcall 'quail-define-package pkgname lang title nil docstring
312 nil nil nil t nil nil nil nil)
313 (let (char-table key-table char key)
314 (while (and char-tables key-tables)
315 (setq char-table (car char-tables)
316 char-tables (cdr char-tables)
317 key-table (car key-tables)
318 key-tables (cdr key-tables))
319 (while (and char-table key-table)
320 (setq char (car char-table)
321 char-table (cdr char-table)
322 key (car key-table)
323 key-table (cdr key-table))
324 (if (and (consp char) (consp key))
325 (setq char-table (append char char-table)
326 key-table (append key key-table))
327 (if (and key char)
328 (quail-defrule
329 (if (characterp key) (char-to-string key) key)
330 (if (stringp char) (vector char) char))))))))
334 (defvar inscript-dev-keytable
336 (;; VOWELS (18)
337 (?D nil) (?E ?e) (?F ?f) (?R ?r) (?G ?g) (?T ?t)
338 (?+ ?=) ("F]" "f]") (?! ?@) (?Z ?z) (?S ?s) (?W ?w)
339 (?| ?\\) (?~ ?`) (?A ?a) (?Q ?q) ("+]" "=]") ("R]" "r]"))
340 (;; CONSONANTS (42)
341 ?k ?K ?i ?I ?U ;; GRUTTALS
342 ?\; ?: ?p ?P ?} ;; PALATALS
343 ?' ?\" ?\[ ?{ ?C ;; CEREBRALS
344 ?l ?L ?o ?O ?v ?V ;; DENTALS
345 ?h ?H ?y ?Y ?c ;; LABIALS
346 ?/ ?j ?J ?n ?N "N]" ?b ;; SEMIVOWELS
347 ?M ?< ?m ?u ;; SIBILANTS
348 "k]" "K]" "i]" "p]" "[]" "{]" "H]" "/]" ;; NUKTAS
349 ?% ?&)
350 (;; Misc Symbols (7)
351 ?X ?x ?_ ">]" ?d "X]" ?>)
352 (;; Digits
353 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)
354 (;; Inscripts
355 ?# ?$ ?^ ?* ?\])))
357 (defvar inscript-mlm-keytable
359 (;; VOWELS (18)
360 (?D nil) (?E ?e) (?F ?f) (?R ?r) (?G ?g) (?T ?t)
361 (?+ ?=) ("F]" "f]") (?! ?@) (?S ?s) (?Z ?z) (?W ?w)
362 (?| ?\\) (?~ ?`) (?A ?a) (?Q ?q) ("+]" "=]") ("R]" "r]"))
363 (;; CONSONANTS (42)
364 ?k ?K ?i ?I ?U ;; GRUTTALS
365 ?\; ?: ?p ?P ?} ;; PALATALS
366 ?' ?\" ?\[ ?{ ?C ;; CEREBRALS
367 ?l ?L ?o ?O ?v ?V ;; DENTALS
368 ?h ?H ?y ?Y ?c ;; LABIALS
369 ?/ ?j ?J ?n ?N "N]" ?b ;; SEMIVOWELS
370 ?M ?< ?m ?u ;; SIBILANTS
371 "k]" "K]" "i]" "p]" "[]" "{]" "H]" "/]" ;; NUKTAS
372 ?% ?&)
373 (;; Misc Symbols (7)
374 ?X ?x ?_ ">]" ?d "X]" ?>)
375 (;; Digits
376 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)
377 (;; Inscripts
378 ?# ?$ ?^ ?* ?\])))
380 (defvar inscript-tml-keytable
382 (;; VOWELS (18)
383 (?D nil) (?E ?e) (?F ?f) (?R ?r) (?G ?g) (?T ?t)
384 nil nil nil (?S ?s) (?Z ?z) (?W ?w)
385 nil (?A ?a) (?~ ?`) (?Q ?q) nil nil)
386 (;; CONSONANTS (42)
387 ?k ?K ?i ?I ?U ;; GRUTTALS
388 ?\; ?: ?p ?P ?} ;; PALATALS
389 ?' ?\" ?\[ ?{ ?C ;; CEREBRALS
390 ?l ?L ?o ?O ?v ?V ;; DENTALS
391 ?h ?H ?y ?Y ?c ;; LABIALS
392 ?/ ?j ?J ?n ?N "N]" ?b ;; SEMIVOWELS
393 ?M ?< ?m ?u ;; SIBILANTS
394 "k]" "K]" "i]" "p]" "[]" "{]" "H]" "/]" ;; NUKTAS
395 ?% ?&)
396 (;; Misc Symbols (7)
397 ?X ?x ?_ ">]" ?d "X]" ?>)
398 (;; Digits
399 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9)
400 (;; Inscripts
401 ?# ?$ ?^ ?* ?\])))
403 (if nil
404 (quail-define-package "devanagari-inscript" "Devanagari" "DevIS" t "Devanagari keyboard Inscript"))
405 (quail-define-inscript-package
406 indian-dev-base-table inscript-dev-keytable
407 "devanagari-inscript" "Devanagari" "DevIS"
408 "Devanagari keyboard Inscript.")
410 (if nil
411 (quail-define-package "punjabi-inscript" "Punjabi" "PnjIS" t "Punjabi keyboard Inscript"))
412 (quail-define-inscript-package
413 indian-pnj-base-table inscript-dev-keytable
414 "punjabi-inscript" "Punjabi" "PnjIS"
415 "Punjabi keyboard Inscript.")
417 (if nil
418 (quail-define-package "gujarati-inscript" "Gujarati" "GjrIS" t "Gujarati keyboard Inscript"))
419 (quail-define-inscript-package
420 indian-gjr-base-table inscript-dev-keytable
421 "gujarati-inscript" "Gujarati" "GjrIS"
422 "Gujarati keyboard Inscript.")
424 (if nil
425 (quail-define-package "oriya-inscript" "Oriya" "OriIS" t "Oriya keyboard Inscript"))
426 (quail-define-inscript-package
427 indian-ori-base-table inscript-dev-keytable
428 "oriya-inscript" "Oriya" "OriIS"
429 "Oriya keyboard Inscript.")
431 (if nil
432 (quail-define-package "bengali-inscript" "Bengali" "BngIS" t "Bengali keyboard Inscript"))
433 (quail-define-inscript-package
434 indian-bng-base-table inscript-dev-keytable
435 "bengali-inscript" "Bengali" "BngIS"
436 "Bengali keyboard Inscript.")
438 (if nil
439 (quail-define-package "assamese-inscript" "Assamese" "AsmIS" t "Assamese keyboard Inscript"))
440 (quail-define-inscript-package
441 indian-asm-base-table inscript-dev-keytable
442 "assamese-inscript" "Assamese" "AsmIS"
443 "Assamese keyboard Inscript.")
445 (if nil
446 (quail-define-package "telugu-inscript" "Telugu" "TlgIS" t "Telugu keyboard Inscript"))
447 (quail-define-inscript-package
448 indian-tlg-base-table inscript-dev-keytable
449 "telugu-inscript" "Telugu" "TlgIS"
450 "Telugu keyboard Inscript.")
452 (if nil
453 (quail-define-package "kannada-inscript" "Kannada" "KndIS" t "Kannada keyboard Inscript"))
454 (quail-define-inscript-package
455 indian-knd-base-table inscript-dev-keytable
456 "kannada-inscript" "Kannada" "KndIS"
457 "Kannada keyboard Inscript.")
459 (if nil
460 (quail-define-package "malayalam-inscript" "Malayalam" "MlmIS" t "Malayalam keyboard Inscript"))
461 (quail-define-inscript-package
462 indian-mlm-base-table inscript-mlm-keytable
463 "malayalam-inscript" "Malayalam" "MlmIS"
464 "Malayalam keyboard Inscript.")
466 (if nil
467 (quail-define-package "tamil-inscript" "Tamil" "TmlIS" t "Tamil keyboard Inscript"))
468 (quail-define-inscript-package
469 indian-tml-base-table inscript-tml-keytable
470 "tamil-inscript" "Tamil" "TmlIS"
471 "Tamil keyboard Inscript.")
473 ;;; indian.el ends here