annotate lisp/language/lao.el @ 110120:3d32b7120396

play/cookie1.el (read-cookie): Fix off-by-one error (bug#6921).
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 26 Aug 2010 17:33:52 +0200
parents 1d1d5d9bd884
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98037
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
1 ;;; lao.el --- support for Lao -*- coding: utf-8; no-byte-compile: t -*-
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
3 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
79710
d82b84af645c Add missing FSF copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78309
diff changeset
4 ;; Free Software Foundation, Inc.
d82b84af645c Add missing FSF copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78309
diff changeset
5 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
6 ;; 2007, 2008, 2009, 2010
62396
197607499a29 Fix copyrights.
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
197607499a29 Fix copyrights.
Kenichi Handa <handa@m17n.org>
parents: 52401
diff changeset
8 ;; Registration Number H14PRO021
89483
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89299
diff changeset
9 ;; Copyright (C) 2003
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89299
diff changeset
10 ;; National Institute of Advanced Industrial Science and Technology (AIST)
2f877ed80fa6 *** empty log message ***
Kenichi Handa <handa@m17n.org>
parents: 88123 89299
diff changeset
11 ;; Registration Number H13PRO009
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
12
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
13 ;; Keywords: multilingual, Lao
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
14
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
15 ;; This file is part of GNU Emacs.
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
16
94665
55b7f25d920a Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
17 ;; GNU Emacs is free software: you can redistribute it and/or modify
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
18 ;; it under the terms of the GNU General Public License as published by
94665
55b7f25d920a Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
19 ;; the Free Software Foundation, either version 3 of the License, or
55b7f25d920a Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
20 ;; (at your option) any later version.
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
21
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
22 ;; GNU Emacs is distributed in the hope that it will be useful,
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
23 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
24 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
25 ;; GNU General Public License for more details.
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
26
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
27 ;; You should have received a copy of the GNU General Public License
94665
55b7f25d920a Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
28 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
29
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 33778
diff changeset
30 ;;; Commentary:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 33778
diff changeset
31
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
32 ;;; Code:
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
33
88414
fad0f879877f Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents: 42152
diff changeset
34 (define-coding-system 'lao
fad0f879877f Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents: 42152
diff changeset
35 "8-bit encoding for ASCII (MSB=0) and LAO (MSB=1)."
fad0f879877f Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents: 42152
diff changeset
36 :coding-type 'charset
fad0f879877f Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents: 42152
diff changeset
37 :mnemonic ?L
fad0f879877f Call define-coding-system instead of make-coding-system. All CCL program deleted.
Kenichi Handa <handa@m17n.org>
parents: 42152
diff changeset
38 :charset-list '(lao))
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
39
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
40 (set-language-info-alist
22983
7a010b8c0d99 ("LANUGAGE-ENVIRONMENT"): Delete property setup-function or change
Kenichi Handa <handa@m17n.org>
parents: 20739
diff changeset
41 "Lao" '((charset lao)
20739
5f2c7f919bbf Adjusted for the change of make-coding-system. Register
Kenichi Handa <handa@m17n.org>
parents: 20156
diff changeset
42 (coding-system lao)
5f2c7f919bbf Adjusted for the change of make-coding-system. Register
Kenichi Handa <handa@m17n.org>
parents: 20156
diff changeset
43 (coding-priority lao)
22983
7a010b8c0d99 ("LANUGAGE-ENVIRONMENT"): Delete property setup-function or change
Kenichi Handa <handa@m17n.org>
parents: 20739
diff changeset
44 (input-method . "lao")
7a010b8c0d99 ("LANUGAGE-ENVIRONMENT"): Delete property setup-function or change
Kenichi Handa <handa@m17n.org>
parents: 20739
diff changeset
45 (unibyte-display . lao)
7a010b8c0d99 ("LANUGAGE-ENVIRONMENT"): Delete property setup-function or change
Kenichi Handa <handa@m17n.org>
parents: 20739
diff changeset
46 (features lao-util)
17841
084d922fcd78 Coding system names changed as follows:
Kenichi Handa <handa@m17n.org>
parents: 17772
diff changeset
47 (documentation . t)))
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
48
98037
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
49 (let ((consonant "ກ-ຮໜໝ")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
50 (tone "່-໌")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
51 (vowel-upper-lower "ັິ-ົໍ")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
52 (semivowel-lower "ຼ")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
53 (fallback-rule [nil 0 compose-gstring-for-graphic]))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
54 ;; target characters regexp
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
55 ;; ----------------- ------
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
56 (dolist (l `((,vowel-upper-lower . "[c].[t]?")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
57 (,tone . "[c].")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
58 (,semivowel-lower . "[c].[v][t]?")
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
59 (,semivowel-lower . "[c].[t]")))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
60 (let* ((chars (car l))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
61 (len (length chars))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
62 ;; Replace `c', `t', `v' to consonant, tone, and vowel.
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
63 (regexp (mapconcat #'(lambda (c)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
64 (cond ((= c ?c) consonant)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
65 ((= c ?t) tone)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
66 ((= c ?v) vowel-upper-lower)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
67 (t (string c))))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
68 (cdr l) ""))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
69 ;; Element of composition-function-table.
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
70 (elt (list (vector regexp 1 'lao-composition-function)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
71 fallback-rule))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
72 ch)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
73 (dotimes (i len)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
74 (setq ch (aref chars i))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
75 (if (and (> i 1) (= (aref chars (1- i)) ?-))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
76 ;; End of character range.
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
77 (set-char-table-range composition-function-table
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
78 (cons (aref chars (- i 2)) ch) elt)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
79 (if (or (= (1+ i) len)
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
80 (and (/= ch ?-) (/= (aref chars (1+ i)) ?-)))
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
81 ;; A character not forming a range.
31c8c0a7d56c Fix setting of composition-function-table.
Kenichi Handa <handa@m17n.org>
parents: 94665
diff changeset
82 (set-char-table-range composition-function-table ch elt)))))))
26893
78d4a8d767d5 Register lao-composition-function in
Kenichi Handa <handa@m17n.org>
parents: 23158
diff changeset
83
33778
6d966e8b4bbe Use provide.
Dave Love <fx@gnu.org>
parents: 26893
diff changeset
84 (provide 'lao)
6d966e8b4bbe Use provide.
Dave Love <fx@gnu.org>
parents: 26893
diff changeset
85
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 92178
diff changeset
86 ;; arch-tag: ba540fd9-6352-4449-a9cd-669afd21fa57
17083
9e6a3e03ed4c Initial revision
Kenichi Handa <handa@m17n.org>
parents:
diff changeset
87 ;;; lao.el ends here