*** empty log message ***
[m17n/m17n-db.git] / MIM / ta-lk-renganathan.mim
1 ;; ta-lk-renganathan.mim -- Tamil input method with Renganathan layout
2 ;; Copyright (C) 2008
3 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
4 ;;   Registration Number H15PRO112
5
6 ;; This file is part of the m17n database; a sub-part of the m17n
7 ;; library.
8
9 ;; The m17n library is free software; you can redistribute it and/or
10 ;; modify it under the terms of the GNU Lesser General Public License
11 ;; as published by the Free Software Foundation; either version 2.1 of
12 ;; the License, or (at your option) any later version.
13
14 ;; The m17n library is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 ;; Lesser General Public License for more details.
18
19 ;; You should have received a copy of the GNU Lesser General Public
20 ;; License along with the m17n library; if not, write to the Free
21 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02110-1301, USA.
23
24 (input-method ta lk-renganathan (version "1.6.0"))
25
26 (description "Tamil input method with Renganathan layout.
27 For the detail, see the page: <http://www.locallanguages.lk/>
28 ")
29
30 (title "க")
31
32 (variable
33  (use-surrounding-text (_"Surrounding text vs. preedit
34 If 1, try to use surrounding text.  Otherwise, use preedit.")
35                        0 1 0))
36
37 (macro
38  (pre-proc
39   (cond
40    ((= @-1 0x200C)
41     (delete @-1)))
42   (cond
43    ((= @+0 0x200C)
44     (delete @+1))))
45
46  (post-proc
47   (cond
48    ((& (>= @-1 0x0B95) (<= @-1 0x0BB9)  ; a consonant
49        (>= @+0 0x0BC6) (<= @+0 0x0BCC)) ; a left/two-part vowel sign
50     ;; prevent syllable formation
51     0x200C)
52
53    ((& (| (< @-2 0x0B95) (> @-2 0x0BB9))  ; not a consonant
54        (>= @-1 0x0BC6) (<= @-1 0x0BCC)    ; a left/two-part vowel sign
55        (>= @+0 0x0B95) (<= @+0 0x0BB9)    ; a consonant
56        (| (< @+1 0x0BBE) (> @+1 0x0BD7))) ; not a vowel sign
57     ;; exchange @-1 and @+0
58     (set vs @-1)
59     (set c @+0)
60     (delete @-1)
61     (delete @+1)
62     (insert c)
63     (insert vs))
64
65    ((& (= @-1 0x200C)
66        (| (< @-2 0x0B95) (> @-2 0x0BB9) ; not a constant
67           (< @+0 0x0BC6) (> @+0 0x0BCC))) ; not a left/two-part vowel sign
68     ;; delete unnecessary ZWNJ
69     (delete @-1))
70
71    ((& (= @+0 0x200C)
72        (| (< @-1 0x0B95) (> @-1 0x0BB9) ; not a constant
73           (< @+1 0x0BC6) (> @+1 0x0BCC))) ; not a left/two-part vowel sign
74     ;; delete unnecessary ZWNJ
75     (delete @+1))))
76
77  (consonant-proc
78   (move @<)
79   (cond
80    ((= @-1 0x200C)
81     (delete @-1)))
82   (set vs 0)
83   (cond
84    ((& (>= @-1 0x0BC6) (<= @-1 0x0BC8)) ; a left vowel sign
85     (cond
86      ((= @-2 0x200C)
87       (set vs @-1)
88       (delete @-2))
89      ((| (< @-2 0x0B95) (> @-2 0x0BB9)) ; not a consonant
90       (set vs @-1)
91       (delete @-1)))))
92
93   (move @>)
94   (cond
95    ((& (= @+0 0x200C)
96        (| (< @+1 0x0BC6) (> @+1 0x0BCC))) ; not a left vowel sign
97     (delete @+1)))
98
99   (cond
100    ((= vs 0x0BC6)
101     (cond
102      ((= @+0 0x0BBE)
103       (delete @+1)
104       0x0BCA)
105      ((| (= @+0 0x0BB3) (= @+0 0x0BD7))
106       (delete @+1)
107       0x0BCC)
108      (1
109       0x0BC6)))
110    ((= vs 0x0BC7)
111     (cond
112      ((= @+0 0x0BBE)
113       (delete @+1)
114       0x0BCB)
115      (1
116       0x0BC7)))
117    ((= vs 0x0BC8)
118     0x0BC8))
119
120   (cond
121    ((& (>= @-1 0x0B95) (<= @-1 0x0BB9)  ; a consonant
122        (>= @+0 0x0BC6) (<= @+0 0x0BCC)) ; a left vowel sign
123     0x200C)))
124
125  (check-surrounding-text
126   (cond
127    ((& (= @+0 0x0B95) (= @+1 0x0BCD) (= @+2 0x0BB7)) ; k.ssa follows
128     0x0B95 0x0BCD 0x0BB7
129     (delete @+3))
130    ((& (>= @+0 0x0B95) (<= @+0 0x0BB9)) ; a consonant follows
131     (set c @+0)
132     (insert c)
133     (delete @+1))
134    ((& (>= @-1 0x0B95) (<= @-1 0x0BB9)) ; a consonant precedes
135     0x200C)))
136  )
137
138 (map
139  (starter
140   ("q") ("w") ("e") ("r") ("t") ("y") ("u") ("i") ("o") ("p") ("[") ("]")
141   ("a") ("s") ("d") ("f") ("g") ("h") ("j") ("k") ("l") (";")
142   ("z") ("x") ("c") ("v") ("b") ("n") ("m") ("`")
143   ("Q") ("W") ("E") ("R") ("T") ("Y") ("U") ("I") ("O") ("P") ("{") ("}")
144   ("A") ("S") ("D") ("F") ("G") ("H") ("J") ("K") ("L")
145   ("Z") ("X") ("C") ("V") ("B") ("N") ("M")
146   ((A-q)) ((A-w)) ((A-e)) ((A-r)) ((A-t)) ((A-y)) ((A-u)) ((A-i))
147   ((A-1)) ((A-2)) ((A-3)) ((A-4)) ((A-5)) ((A-6)) ((A-7)) ((A-8)) ((A-9))
148   ((A-0)) ((A-`)) ((A-=)) ((A--))
149   ((BackSpace)) ((Delete)))
150
151  (composite
152   ("f;" "க்")                               ; 0B95 0BCD
153   ("f;W" "க்‌ஷ")                        ; 0B95 0BCD 200C 0BB7
154   ("Zh" "ஒளா")                            ; 0B92 0BB3 0BBE
155   ("Zp" "ஒளி")                            ; 0B92 0BB3 0BBF
156   ("ZP" "ஒளீ")                            ; 0B92 0BB3 0BC0
157   ("Z[" "ஒளு")                            ; 0B92 0BB3 0BC1
158   ("Z{" "ஒளூ")                            ; 0B92 0BB3 0BC2
159   ("Z;" "ஒள்")                            ; 0B92 0BB3 0BCD
160   ("xs" "ஔ")                          ; 0B94
161   ("xsh" "ஒளா")                           ; 0B92 0BB3 0BBE
162   ("xsp" "ஒளி")                           ; 0B92 0BB3 0BBF
163   ("xsP" "ஒளீ")                           ; 0B92 0BB3 0BC0
164   ("xs[" "ஒளு")                           ; 0B92 0BB3 0BC1
165   ("xs{" "ஒளூ")                           ; 0B92 0BB3 0BC2
166   ("xs;" "ஒள்")                           ; 0B92 0BB3 0BCD
167   )
168
169  (consonant
170   ("f" "க")                           ; 0B95
171   ("q" "ங")                           ; 0B99
172   ("r" "ச")                           ; 0B9A
173   ("E" "ஜ")                           ; 0B9C
174   ("]" "ஞ")                           ; 0B9E
175   ("l" "ட")                           ; 0B9F
176   ("z" "ண")                           ; 0BA3
177   ("j" "த")                           ; 0BA4
178   ("e" "ந")                           ; 0BA8
179   ("d" "ன")                           ; 0BA9
180   ("g" "ப")                           ; 0BAA
181   ("k" "ம")                           ; 0BAE
182   ("a" "ய")                           ; 0BAF
183   ("u" "ர")                           ; 0BB0
184   ("w" "ற")                           ; 0BB1
185   ("y" "ல")                           ; 0BB2
186   ("o" "ழ")                           ; 0BB4
187   ("t" "வ")                           ; 0BB5
188   ("U" "ஶ")                           ; 0BB6
189   ("Q" "ஸ")                           ; 0BB8
190   ("R" "ஹ")                           ; 0BB9
191
192   ("T" "க்ஷ")                             ; 0B95 0BCD 0BB7
193   )
194
195  (sign
196   ("p" "ி")                           ; 0BBF
197   ("P" "ீ")                           ; 0BC0
198   ("[" "ு")                           ; 0BC1
199   ("{" "ூ")                           ; 0BC2
200   (";" "்")                           ; 0BCD
201   )
202
203  (lla
204   ("s"))
205
206  (ssa
207   ("W"))
208
209  (aa
210   ("h"))
211
212  (e
213   ("n"))
214
215  (ee
216   ("N"))
217
218  (ai
219   ("i"))
220
221  (backspace
222   ((BackSpace)))
223
224  (delete
225   ((Delete)))
226
227  (misc
228   ("`" "ஃ")                           ; 0B83
229   ("m" "அ")                           ; 0B85
230   ("M" "ஆ")                           ; 0B86
231   ("b" "இ")                           ; 0B87
232   ("B" "ஈ")                           ; 0B88
233   ("c" "உ")                           ; 0B89
234   ("C" "ஊ")                           ; 0B8A
235   ("v" "எ")                           ; 0B8E
236   ("V" "ஏ")                           ; 0B8F
237   ("I" "ஐ")                           ; 0B90
238   ("x" "ஒ")                           ; 0B92
239   ("X" "ஓ")                           ; 0B93
240   ("Z" "ஔ")                           ; 0B94
241
242   ("O" "ௐ")                           ; 0BD0
243
244   ((A-0) "௦")                         ; 0BE6
245   ((A-1) "௧")                         ; 0BE7
246   ((A-2) "௨")                         ; 0BE8
247   ((A-3) "௩")                         ; 0BE9
248   ((A-4) "௪")                         ; 0BEA
249   ((A-5) "௫")                         ; 0BEB
250   ((A-6) "௬")                         ; 0BEC
251   ((A-7) "௭")                         ; 0BED
252   ((A-8) "௮")                         ; 0BEE
253   ((A-9) "௯")                         ; 0BEF
254   ((A-q) "௰")                         ; 0BF0
255   ((A-w) "௱")                         ; 0BF1
256   ((A-e) "௲")                         ; 0BF2
257   ((A-y) "௳")                         ; 0BF3
258   ((A-u) "௴")                         ; 0BF4
259   ((A-i) "௵")                         ; 0BF5
260   ((A-r) "௶")                         ; 0BF6
261   ((A-t) "௷")                         ; 0BF7
262   ((A-`) "௸")                         ; 0BF8
263   ((A-=) "௹")                         ; 0BF9
264   ((A--) "௺")                         ; 0BFA
265
266   ("Y" "ஶ்ரீ")                          ; 0BB6 0BCD 0BB0 0BC0
267
268   ("}" ";")                             ; 003B
269
270   ("A" "")
271   ("S" "")
272   ("D" "")
273   ("F" "")
274   ("G" "")
275   ("H" "")
276   ("J" "")
277   ("K" "")
278   ("L" "")
279   ))
280
281 (state
282  (init
283   (starter
284    (pushback 1)
285    (cond
286     ((& (= use-surrounding-text 1) (= @-0 -1))
287      (shift surrounding-text))
288     (1
289      (shift preedit)))))
290
291  (surrounding-text
292   (consonant
293    (consonant-proc)
294    (commit))
295
296   (lla
297    (cond
298     ((= @-1 0x200C)
299      (delete @-1)))
300
301    (cond
302     ((& (>= @-2 0x0B95) (<= @-2 0x0BB9) ; a consonant
303         (= @-1 0x0BC6))
304      (delete @-1)
305      0x0BCC
306      (cond
307       ((= @+0 0x200C)
308        (delete @+1))))
309     ((= @-1 0x0B92)
310      (delete @-1)
311      0x0B94
312      (cond
313       ((= @+0 0x200C)
314        (delete @+1))))
315     (1
316      0x0BB3
317      (consonant-proc)))
318
319    (commit))
320
321   (ssa
322    (cond
323     ((= @-1 0x200C)
324      (delete @-1)))
325
326    (cond
327     ((& (= @-2 0x0B95) (= @-1 0x0BCD))
328      0x200C))
329    0x0BB7
330    (consonant-proc)
331
332    (commit))
333
334   (sign
335    (cond
336     ((= @+0 0x200C)
337      (delete @+1)))
338    (move @<)
339    (cond
340     ((= @-1 0x200C)
341      (delete @-1)))
342
343    (cond
344     ((= @-1 0x0B94)
345      (delete @-1)
346      0x0B92 0x0BB3)
347     ((= @-1 0x0BCC)
348      (delete @-1)
349      0x0BC6 0x0BB3))
350
351    (commit))
352
353   (aa
354    (pre-proc)
355
356    (cond
357     ((= @-1 0x0BC6)
358      (cond
359       ((& (| (< @-3 0x0B95) (> @-3 0x0BB9)) ; not a consonant
360           (= @-2 0x200C))
361        (delete @-2))
362       (1
363        (delete @-1)))
364      0x0BCA)
365
366     ((= @-1 0x0BC7)
367      (cond
368       ((& (| (< @-3 0x0B95) (> @-3 0x0BB9)) ; not a consonant
369           (= @-2 0x200C))
370        (delete @-2))
371       (1
372        (delete @-1)))
373      0x0BCB)
374
375     ((= @-1 0x0B94)
376      (delete @-1)
377      0x0B92 0x0BB3 0x0BBE)
378
379     ((= @-1 0x0BCC)
380      (delete @-1)
381      0x0BC6 0x0BB3 0x0BBE)
382
383     (1
384      0x0BBE))
385
386    (commit))
387
388   (e
389    (pre-proc)
390
391    (cond
392     ;; additional check-surrounding-text for this vowel sign
393     ((& (>= @+0 0x0B95) (<= @+0 0x0BB9) ; a consonant
394         (= @+1 0x0BB3))
395      (set c @+0)
396      (delete @+2)
397      (insert c)
398      0x0BCC)
399
400     ;; ordinary check-surrounding-text
401     (1
402      (check-surrounding-text)
403      (cond
404       ((= @+0 0x0BBE)
405        (delete @+1)
406        0x0BCA)
407       ((= @+0 0x0BD7)
408        (delete @+1)
409        0x0BCC)
410       (1
411        0x0BC6))))
412
413    (commit))
414
415   (ee
416    (pre-proc)
417
418    (check-surrounding-text)
419    (cond
420     ((= @+0 0x0BBE)
421      (delete @+1)
422      0x0BCB)
423     (1
424      0x0BC7))
425
426    (commit))
427
428   (ai
429    (pre-proc)
430
431    (check-surrounding-text)
432    0x0BC8
433
434    (commit))
435
436   (backspace
437    (pre-proc)
438
439    (cond
440     ((& (>= @-4 0x0B95) (<= @-4 0x0BB9) ; a consonant
441         (= @-3 0x0BC6)
442         (= @-2 0x0BB3)
443         (| (& (>= @-1 0x0BBE) (<= @-1 0x0BC2)) ; a right/above/below vowel sign
444            (= @-1 0x0BCD)))
445      (delete @-3)
446      0x0BCC)
447
448     ((& (= @-4 0x0BB6) (= @-3 0x0BCD) (= @-2 0x0BB0) (= @-1 0x0BC0)) ; shrii
449      (delete @-4))
450
451     ((& (= @-3 0x0B92)
452         (= @-2 0x0BB3)
453         (| (& (>= @-1 0x0BBE) (<= @-1 0x0BC2)) ; a right/above/below vowel sign
454            (= @-1 0x0BCD)))
455      (delete @-3)
456      0x0B94)
457
458     ((& (= @-3 0x0B95) (= @-2 0x0BCD) (= @-1 0x0BB7)) ; k.ssa
459      (delete @-3))
460
461     ((| (= @-1 0x0BCA) (= @-1 0x0BCC))  ; vowel sign e/ai
462      (delete @-1)
463      0x0BC6)
464
465     ((= @-1 0x0BCB)                     ; vowel sign ee
466      (delete @-1)
467      0x0BC7)
468
469     ((& (>= @-1 0x0BC6) (<= @-1 0x0BC8)) ; a left vowel sign
470      (set vs @-1)
471      (delete @-1)
472      (cond
473       ((& (>= @-1 0x0B95) (<= @-1 0x0BB9)) ; a consonant
474        (cond
475         ((& (= @-3 0x0B95) (= @-2 0x0BCD) (= @-1 0x0BB7)) ; k.ssa
476          (delete @-3))
477         (1
478          (delete @-1)))
479
480        (cond
481         ((& (>= @+0 0x0B95) (<= @+0 0x0BB9)    ; a consonant follows
482             (| (< @+1 0x0BBE) (> @+1 0x0BD7))) ; not a vowel sign
483          ;; visual  : E C1 | C2  ->  E C2 |
484          ;; logical : C1 E | C2  ->  C2 E |
485          (cond
486           ((& (= @+0 0x0B95) (= @+1 0x0BCD) (= @+2 0x0BB7)) ; k.ssa
487            (delete @+3)
488            0x0B95 0x0BCD 0x0BB7)
489           (1
490            (set c @+0)
491            (delete @+1)
492            (insert c)))
493          (insert vs))
494
495         ((& (>= @-1 0x0B95) (<= @-1 0x0BB9)) ; a consonant precedes
496          ;; visual  : C1 E C2 | X  ->  C1 E | X
497          ;; logical : C1 C2 E | X  ->  C1 N E | X
498          0x200C
499          (insert vs))
500
501         (1
502          ;; visual  : X1 E C | X2  ->  X1 E | X2
503          ;; logical : X1 C E | X2  ->  X1 E | X2
504          (insert vs))))
505
506       ((= @-1 0x200C)
507        (delete @-1))))
508
509     (1
510      (delete @-1)))
511
512    (post-proc)
513    (commit))
514
515   (delete
516    (pre-proc)
517
518    (cond
519     ((& (= @+0 0x0BB6) (= @+1 0x0BCD) (= @+2 0x0BB0) (= @+3 0x0C0)) ; shrii
520      (delete @+4))
521
522     ((& (= @+0 0x0B95) (= @+1 0x0BCD) (= @+2 0x0BB7)) ; k.ssa
523      (cond
524       ((& (>= @+3 0x0BC6) (<= @+3 0x0BC8)) ; a left vowel sign
525        (delete @+4)
526        0x0B95 0x0BCD 0x0BB7)
527       ((| (= @+3 0x0BCA) (= @+3 0x0BCB)) ; vowel sign e/ee
528        (delete @+4)
529        0x0B95 0x0BCD 0x0BB7 0x0BBE)
530       ((| (& (>= @+3 0x0BBE) (<= @+3 0x0BC2)) ; vowel sign aa .. uu
531           (= @+3 0x0BCC)                      ; vowel sign ai
532           (= @+3 0x0BCD))                     ; virama
533        (delete @+4))
534       (1
535        (delete @+3))))
536
537     ((& (>= @+0 0x0B95) (<= @+0 0x0BB9)) ; a consonant
538      (set c @+0)
539      (cond
540       ((& (>= @+1 0x0BC6) (<= @+1 0x0BC8)) ; a left vowel sign
541        (delete @+2)
542        (insert c))
543       ((| (= @+1 0x0BCA) (= @+1 0x0BCB)) ; vowel sign e/ee
544        (delete @+2)
545        (insert c)
546        0x0BBE)
547       ((| (& (>= @+1 0x0BBE) (<= @+1 0x0BC2)) ; vowel sign aa .. uu
548           (= @+1 0x0BCC)                      ; vowel sign ai
549           (= @+1 0x0BCD))                     ; virama
550        (delete @+2))
551       (1
552        (delete @+1))))
553
554     ((| (= @+0 0x0BCA) (= @+0 0x0BCB))  ; vowel sign e/ee
555      (delete @+1)
556      0x0BBE)
557
558     ((= @+0 0x0BCC)                     ; vowel sign ai
559      (delete @+1)
560      0x0BB3)
561
562     (1
563      (delete @+1)))
564
565    (post-proc)
566    (commit))
567
568   (misc
569    (move @<)
570    (cond
571     ((= @-1 0x200C)
572      (delete @-1)))
573    (move @>)
574    (cond
575     ((= @+0 0x200C)
576      (delete @+1)))
577    (commit)))
578
579  (preedit
580   (consonant (shift c-state))
581   (composite (commit))
582   (sign (commit))
583   (misc (commit))
584   (lla "ள" (shift c-state))           ; 0BB3
585   (ssa "ஷ" (shift c-state))           ; 0BB7
586   (aa "ா" (commit))                   ; 0BBE
587   (e  "ெ" (shift e-state))            ; 0BC6
588   (ee "ே" (shift ee-state))           ; 0BC7
589   (ai "ை" (shift ai-state)))          ; 0BC8
590
591  (c-state
592   (sign (shift c-s-state))
593   (aa "ா" (shift c-s-state))          ; 0BBE
594   (backspace (undo)))
595
596  (c-s-state
597   (sign
598    (cond
599     ((= @-2 0x0BCC)
600      (move @-)
601      (delete @-)
602      0x0BC6 0x0BB3
603      (move @+))
604     (1
605      (commit)
606      (shift preedit))))
607   (aa
608    "ா"
609    (cond
610     ((= @-2 0x0BCC)
611      (move @-)
612      (delete @-)
613      0x0BC6 0x0BB3
614      (move @+))
615     (1
616      (commit)
617      (shift preedit))))
618   (backspace (undo)))
619
620  (e-state
621   (consonant (move @<) (delete @+) (move @>) "ெ" (shift e-c-state))
622   (lla (delete @-) "ளெ" (shift e-c-state))
623   (ssa (delete @-) "ஷெ" (shift e-c-state))
624   (backspace (delete @-) (shift preedit))
625   (nil (undo -1)))
626
627  (ee-state
628   (consonant (move @<) (delete @+) (move @>) "ே" (shift ee-c-state))
629   (lla (delete @-) "ளே" (shift ee-c-state))
630   (ssa (delete @-) "ஷே" (shift ee-c-state))
631   (backspace (delete @-) (shift preedit))
632   (nil (undo -1)))
633
634  (ai-state
635   (consonant (move @<) (delete @+) (move @>) "ை" (shift c-s-state))
636   (lla (delete @-) "ளை" (shift c-s-state))
637   (ssa (delete @-) "ஷை" (shift c-s-state))
638   (backspace (delete @-) (shift preedit))
639   (nil (undo -1)))
640
641  (e-c-state
642   (aa (delete @-) "ொ" (shift c-s-state))
643   (lla (delete @-) "ௌ" (shift c-s-state))
644   (backspace (delete @<) "ெ" (shift e-state)))
645
646  (ee-c-state
647   (aa (delete @-) "ோ" (shift c-s-state))
648   (backspace (delete @<) "ே" (shift ee-state)))
649  )
650
651 ;; Local Variables:
652 ;; coding: utf-8
653 ;; mode: emacs-lisp
654 ;; End: