thai.el 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ;;; thai.el --- Quail package for inputting Thai characters -*-coding: iso-2022-7bit;-*-
  2. ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
  3. ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
  4. ;; National Institute of Advanced Industrial Science and Technology (AIST)
  5. ;; Registration Number H14PRO021
  6. ;; Keywords: multilingual, input method, Thai
  7. ;; This file is part of GNU Emacs.
  8. ;; GNU Emacs is free software: you can redistribute it and/or modify
  9. ;; it under the terms of the GNU General Public License as published by
  10. ;; the Free Software Foundation, either version 3 of the License, or
  11. ;; (at your option) any later version.
  12. ;; GNU Emacs is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;; GNU General Public License for more details.
  16. ;; You should have received a copy of the GNU General Public License
  17. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  18. ;;; Commentary:
  19. ;;; Code:
  20. (require 'quail)
  21. (defmacro thai-generate-quail-map (translation-table)
  22. (let (map)
  23. (dotimes (i (length translation-table))
  24. (let ((trans (aref translation-table i)))
  25. (when (not (eq trans 0))
  26. (if (> (length trans) 1)
  27. (setq trans (vector trans))
  28. (setq trans (aref trans 0)))
  29. (setq map (cons (list (char-to-string i) trans) map)))))
  30. `(quail-define-rules ,@map)))
  31. ;; Thai Kesmanee keyboard support.
  32. (quail-define-package
  33. "thai-kesmanee" "Thai" ",T!!(B>" t
  34. "Thai Kesmanee input method with TIS620 keyboard layout
  35. The difference from the ordinal Thai keyboard:
  36. ',T_(B' and ',To(B' are assigned to '\\' and '|' respectively,
  37. ',T#(B' and ',T%(B' are assigned to '`' and '~' respectively,
  38. Don't know where to assign characters ',Tz(B' and ',T{(B'."
  39. nil t t t t nil nil nil nil nil t)
  40. (thai-generate-quail-map
  41. [
  42. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
  43. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
  44. ;; This data is quite old.
  45. ;; 0 "#" "." ",Tr(B" ",Ts(B" ",Tt(B" ",TQi(B" ",T'(B" ; SPC .. '
  46. ;; ",Tv(B" ",Tw(B" ",Tu(B" ",Ty(B" ",TA(B" ",T"(B" ",Tc(B" ",T=(B" ; ( .. /
  47. ;; ",T((B" ",TE(B" "/" "_" ",T@(B" ",T6(B" ",TX(B" ",TV(B" ; 0 .. 7
  48. ;; ",T$(B" ",T5(B" ",T+(B" ",TG(B" ",T2(B" ",T*(B" ",TL(B" ",TF(B" ; 8 .. ?
  49. ;; ",Tq(B" ",TD(B" ",TZ(B" ",T)(B" ",T/(B" ",T.(B" ",Tb(B" ",T,(B" ; @ .. G
  50. ;; ",Tg(B" ",T3(B" ",Tk(B" ",TI(B" ",TH(B" ",Tn(B" ",Tl(B" ",TO(B" ; H .. O
  51. ;; ",T-(B" ",Tp(B" ",T1(B" ",T&(B" ",T8(B" ",Tj(B" ",TN(B" "\"" ; P .. W
  52. ;; ")" ",Tm(B" "(" ",T:(B" ",T_(B" ",TE(B" ",TY(B" ",Tx(B" ; X .. _
  53. ;; ",T#(B" ",T?(B" ",TT(B" ",Ta(B" ",T!(B" ",TS(B" ",T4(B" ",T`(B" ; ` .. g
  54. ;; ",Ti(B" ",TC(B" ",Th(B" ",TR(B" ",TJ(B" ",T7(B" ",TW(B" ",T9(B" ; h .. o
  55. ;; ",TB(B" ",Tf(B" ",T>(B" ",TK(B" ",TP(B" ",TU(B" ",TM(B" ",Td(B" ; p .. w
  56. ;; ",T;(B" ",TQ(B" ",T<(B" ",T0(B" ",To(B" "," ",T%(B" 0 ; x .. DEL
  57. ;; This is the correct data nowadays.
  58. 0 "+" "." ",Tr(B" ",Ts(B" ",Tt(B" ",T_(B" ",T'(B" ; SPC .. '
  59. ",Tv(B" ",Tw(B" ",Tu(B" ",Ty(B" ",TA(B" ",T"(B" ",Tc(B" ",T=(B" ; ( .. /
  60. ",T((B" ",Te(B" "/" "-" ",T@(B" ",T6(B" ",TX(B" ",TV(B" ; 0 .. 7
  61. ",T$(B" ",T5(B" ",T+(B" ",TG(B" ",T2(B" ",T*(B" ",TL(B" ",TF(B" ; 8 .. ?
  62. ",Tq(B" ",TD(B" ",TZ(B" ",T)(B" ",T/(B" ",T.(B" ",Tb(B" ",T,(B" ; @ .. G
  63. ",Tg(B" ",T3(B" ",Tk(B" ",TI(B" ",TH(B" "?" ",Tl(B" ",TO(B" ; H .. O
  64. ",T-(B" ",Tp(B" ",T1(B" ",T&(B" ",T8(B" ",Tj(B" ",TN(B" "\"" ; P .. W
  65. "\)" ",Tm(B" "\(" ",T:(B" ",T#(B" ",TE(B" ",TY(B" ",Tx(B" ; X .. _
  66. "_" ",T?(B" ",TT(B" ",Ta(B" ",T!(B" ",TS(B" ",T4(B" ",T`(B" ; ` .. g
  67. ",Ti(B" ",TC(B" ",Th(B" ",TR(B" ",TJ(B" ",T7(B" ",TW(B" ",T9(B" ; h .. o
  68. ",TB(B" ",Tf(B" ",T>(B" ",TK(B" ",TP(B" ",TU(B" ",TM(B" ",Td(B" ; p .. w
  69. ",T;(B" ",TQ(B" ",T<(B" ",T0(B" ",T%(B" "," "%" 0 ; x .. DEL
  70. ])
  71. ;; Thai Pattachote keyboard support.
  72. (quail-define-package
  73. "thai-pattachote" "Thai" ",T!;(B>" t
  74. "Thai Pattachote input method with TIS620 keyboard layout"
  75. nil t t t t nil nil nil nil nil t)
  76. (thai-generate-quail-map
  77. [
  78. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
  79. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; control codes
  80. 0 "+" ",T1(B" "/" "," "?" "_" ",T"(B" ; SPC .. '
  81. "(" ")" "." "%" ",TP(B" ",Tq(B" ",T((B" ",T>(B" ; ( .. /
  82. ",Tp(B" "=" ",Tr(B" ",Ts(B" ",Tt(B" ",Tu(B" ",TY(B" ",Tw(B" ; 0 .. 7
  83. ",Tx(B" ",Ty(B" ",T&(B" ",Td(B" ",T?(B" ",Tv(B" ",T2(B" ",TL(B" ; 8 .. ?
  84. "\"" ",Tk(B" ",TQ(B" ",T0(B" ",TS(B" ",Tf(B" ",T3(B" ",Tl(B" ; @ .. G
  85. ",TW(B" ",T+(B" ",T<(B" ",T*(B" ",Tb(B" ",TN(B" ",TH(B" ",T6(B" ; H .. O
  86. ",T2(B" ",Tj(B" ",T-(B" ",T8(B" ",TI(B" ",T=(B" ",T@(B" ",TD(B" ; P .. W
  87. ",T.(B" ",TV(B" ",T.(B" ",Tc(B" ",TZ(B" ",T2(B" ",TX(B" "-" ; X .. _
  88. ",T#(B" ",Ti(B" ",TT(B" ",TE(B" ",T'(B" ",TB(B" ",T!(B" ",TQ(B" ; ` .. g
  89. ",TU(B" ",TA(B" ",TR(B" ",T9(B" ",T`(B" ",TJ(B" ",T$(B" ",TG(B" ; h .. o
  90. ",Ta(B" ",Tg(B" ",TM(B" ",T7(B" ",TC(B" ",T4(B" ",TK(B" ",T5(B" ; p .. w
  91. ",T;(B" ",Th(B" ",T:(B" ",TO(B" ",Tm(B" ",TF(B" ",T%(B" 0 ; x .. DEL
  92. ])
  93. ;;; thai.el ends here