comparison lisp/language/lao-util.el @ 89483:2f877ed80fa6

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Mon, 08 Sep 2003 12:53:41 +0000
parents 375f2633d815 6a0cc62928b5
children 68c22ea6027c
comparison
equal deleted inserted replaced
88123:375f2633d815 89483:2f877ed80fa6
1 ;;; lao-util.el --- utilities for Lao -*- coding: iso-2022-7bit; -*- 1 ;;; lao-util.el --- utilities for Lao -*- coding: iso-2022-7bit; -*-
2 2
3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN. 3 ;; Copyright (C) 1997 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation. 4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2001 Free Software Foundation, Inc. 5 ;; Copyright (C) 2001 Free Software Foundation, Inc.
6 6 ;; Copyright (C) 2003
7 ;; Keywords: multilingual, Lao 7 ;; National Institute of Advanced Industrial Science and Technology (AIST)
8 ;; Registration Number H13PRO009
9
10 ;; Keywords: multilingual, Lao, i18n
8 11
9 ;; This file is part of GNU Emacs. 12 ;; This file is part of GNU Emacs.
10 13
11 ;; GNU Emacs is free software; you can redistribute it and/or modify 14 ;; 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 15 ;; it under the terms of the GNU General Public License as published by
126 (?(1y(B special "DIGIT NINE") 129 (?(1y(B special "DIGIT NINE")
127 (?(1z(B invalid nil) 130 (?(1z(B invalid nil)
128 (?(1{(B invalid nil) 131 (?(1{(B invalid nil)
129 (?(1|(B consonant "LETTER NHOR NHUU" "MOUSE") 132 (?(1|(B consonant "LETTER NHOR NHUU" "MOUSE")
130 (?(1}(B consonant "LETTER MHOR MHAR" "DOG") 133 (?(1}(B consonant "LETTER MHOR MHAR" "DOG")
131 (?(1~(B invalid nil) 134 (?(1~(B invalid nil)))
132 ;; Unicode equivalents
133 (?$,1D!(B consonant "LETTER KOR KAI'" "CHICKEN")
134 (?$,1D"(B consonant "LETTER KHOR KHAI'" "EGG")
135 (?$,1D$(B consonant "LETTER QHOR QHWARGN" "BUFFALO")
136 (?$,1D'(B consonant "LETTER NGOR NGUU" "SNAKE")
137 (?$,1D((B consonant "LETTER JOR JUA" "BUDDHIST NOVICE")
138 (?$,1D*(B consonant "LETTER XOR X\"ARNG" "ELEPHANT")
139 (?$,1D-(B consonant "LETTER YOR YUNG" "MOSQUITO")
140 (?$,1D4(B consonant "LETTER DOR DANG" "NOSE")
141 (?$,1D5(B consonant "LETTER TOR TAR" "EYE")
142 (?$,1D6(B consonant "LETTER THOR THUNG" "TO ASK,QUESTION")
143 (?$,1D7(B consonant "LETTER DHOR DHARM" "FLAG")
144 (?$,1D9(B consonant "LETTER NOR NOK" "BIRD")
145 (?$,1D:(B consonant "LETTER BOR BED" "FISHHOOK")
146 (?$,1D;(B consonant "LETTER POR PAR" "FISH")
147 (?$,1D<(B consonant "LETTER HPOR HPER\"" "BEE")
148 (?$,1D=(B consonant "LETTER FHOR FHAR" "WALL")
149 (?$,1D>(B consonant "LETTER PHOR PHUU" "MOUNTAIN")
150 (?$,1D?(B consonant "LETTER FOR FAI" "FIRE")
151 (?$,1DA(B consonant "LETTER MOR MAR\"" "HORSE")
152 (?$,1DB(B consonant "LETTER GNOR GNAR" "MEDICINE")
153 (?$,1DC(B consonant "LETTER ROR ROD" "CAR")
154 (?$,1DE(B consonant "LETTER LOR LIING" "MONKEY")
155 (?$,1DG(B consonant "LETTER WOR WII" "HAND FAN")
156 (?$,1DJ(B consonant "LETTER SOR SEA" "TIGER")
157 (?$,1DK(B consonant "LETTER HHOR HHAI" "JAR")
158 (?$,1DM(B consonant "LETTER OR OOW" "TAKE")
159 (?$,1DN(B consonant "LETTER HOR HEA" "BOAT")
160 (?$,1DO(B special "ELLIPSIS")
161 (?$,1DP(B vowel-base "VOWEL SIGN SARA A")
162 (?$,1DQ(B vowel-upper "VOWEL SIGN MAI KAN")
163 (?$,1DR(B vowel-base "VOWEL SIGN SARA AR")
164 (?$,1DS(B vowel-base "VOWEL SIGN SARA AM")
165 (?$,1DT(B vowel-upper "VOWEL SIGN SARA I")
166 (?$,1DU(B vowel-upper "VOWEL SIGN SARA II")
167 (?$,1DV(B vowel-upper "VOWEL SIGN SARA EU")
168 (?$,1DW(B vowel-upper "VOWEL SIGN SARA UR")
169 (?$,1DX(B vowel-lower "VOWEL SIGN SARA U")
170 (?$,1DY(B vowel-lower "VOWEL SIGN SARA UU")
171 (?$,1D[(B vowel-upper "VOWEL SIGN MAI KONG")
172 (?$,1D\(B semivowel-lower "SEMIVOWEL SIGN LO")
173 (?$,1D](B vowel-base "SEMIVOWEL SIGN SARA IA")
174 (?$,1D`(B vowel-base "VOWEL SIGN SARA EE")
175 (?$,1Da(B vowel-base "VOWEL SIGN SARA AA")
176 (?$,1Db(B vowel-base "VOWEL SIGN SARA OO")
177 (?$,1Dc(B vowel-base "VOWEL SIGN SARA EI MAI MUAN\"")
178 (?$,1Dd(B vowel-base "VOWEL SIGN SARA AI MAI MAY")
179 (?$,1Df(B special "KO LA (REPETITION)")
180 (?$,1Dh(B tone "TONE MAI EK")
181 (?$,1Di(B tone "TONE MAI THO")
182 (?$,1Dj(B tone "TONE MAI TI")
183 (?$,1Dk(B tone "TONE MAI JADTAWAR")
184 (?$,1Dl(B tone "CANCELLATION MARK")
185 (?$,1Dm(B vowel-upper "VOWEL SIGN SARA OR")
186 (?$,1Dp(B special "DIGIT ZERO")
187 (?$,1Dq(B special "DIGIT ONE")
188 (?$,1Dr(B special "DIGIT TWO")
189 (?$,1Ds(B special "DIGIT THREE")
190 (?$,1Dt(B special "DIGIT FOUR")
191 (?$,1Du(B special "DIGIT FIVE")
192 (?$,1Dv(B special "DIGIT SIX")
193 (?$,1Dw(B special "DIGIT SEVEN")
194 (?$,1Dx(B special "DIGIT EIGHT")
195 (?$,1Dy(B special "DIGIT NINE")
196 (?$,1D|(B consonant "LETTER NHOR NHUU" "MOUSE")
197 (?$,1D}(B consonant "LETTER MHOR MHAR" "DOG")))
198 elm) 135 elm)
199 (while l 136 (while l
200 (setq elm (car l) l (cdr l)) 137 (setq elm (car l) l (cdr l))
201 (let ((char (car elm)) 138 (let ((char (car elm))
202 (ptype (nth 1 elm))) 139 (ptype (nth 1 elm)))
217 ;; T 154 ;; T
218 ;; V T V T 155 ;; V T V T
219 ;; CV -> C, CT -> C, CVT -> C, Cv -> C, CvT -> C 156 ;; CV -> C, CT -> C, CVT -> C, Cv -> C, CvT -> C
220 ;; v v 157 ;; v v
221 ;; T 158 ;; T
222 ;; V T V T 159 ;; V T V T
223 ;; CsV -> C, CsT -> C, CsVT -> C, Csv -> C, CvT -> C 160 ;; CsV -> C, CsT -> C, CsVT -> C, Csv -> C, CsvT -> C
224 ;; s s s s s 161 ;; s s s s s
225 ;; v v 162 ;; v v
226 163
227 164
228 ;; where C: consonant, V: vowel upper, v: vowel lower, 165 ;; where C: consonant, V: vowel upper, v: vowel lower,
229 ;; T: tone mark, s: semivowel lower 166 ;; T: tone mark, s: semivowel lower
230 167
420 ("(1`VM(B" (?(1`(B 0 ?(1V(B ?(1M(B)) 357 ("(1`VM(B" (?(1`(B 0 ?(1V(B ?(1M(B))
421 ("(1`WM(B" (?(1`(B 0 ?(1W(B ?(1M(B)) 358 ("(1`WM(B" (?(1`(B 0 ?(1W(B ?(1M(B))
422 ("(1d(B" (?(1d(B 0)) 359 ("(1d(B" (?(1d(B 0))
423 ("(1c(B" (?(1c(B 0)) 360 ("(1c(B" (?(1c(B 0))
424 ("(1`[R(B" (?(1`(B 0 ?(1[(B ?(1R(B)) 361 ("(1`[R(B" (?(1`(B 0 ?(1[(B ?(1R(B))
425 ("(1S(B" (0 ?(1S(B)) 362 ("(1S(B" (0 ?(1S(B)))
426
427 ;; Unicode equivalents
428 ("$,1DP(B" (0 ?$,1DP(B) (0 ?$,1DQ(B))
429 ("$,1DR(B" (0 ?$,1DR(B))
430 ("$,1DT(B" (0 ?$,1DU(B))
431 ("$,1DU(B" (0 ?$,1DU(B))
432 ("$,1DV(B" (0 ?$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1D[(B ?$,1DR(B))
455 ("$,1DS(B" (0 ?$,1DS(B)))
456 "Alist of Lao vowel string vs the corresponding re-ordering rule. 363 "Alist of Lao vowel string vs the corresponding re-ordering rule.
457 Each element has this form: 364 Each element has this form:
458 (VOWEL NO-MAA-SAKOD-RULE WITH-MAA-SAKOD-RULE (MAA-SAKOD-0 RULE-0) ...) 365 (VOWEL NO-MAA-SAKOD-RULE WITH-MAA-SAKOD-RULE (MAA-SAKOD-0 RULE-0) ...)
459 366
460 VOWEL is a vowel string (e.g. \"(1`Q]P(B\"). 367 VOWEL is a vowel string (e.g. \"(1`Q]P(B\").
581 (if (< from to) 488 (if (< from to)
582 (concat lao-str (substring str from to)) 489 (concat lao-str (substring str from to))
583 lao-str))) 490 lao-str)))
584 491
585 ;;;###autoload 492 ;;;###autoload
586 (defun lao-post-read-conversion (len) 493 (defun lao-composition-function (pos &optional string)
587 (lao-compose-region (point) (+ (point) len)) 494 (setq pos (1- pos))
588 len) 495 (with-category-table lao-category-table
589 496 (if string
590 ;;;###autoload 497 (if (and (>= pos 0)
591 (defun lao-composition-function (from to pattern &optional string) 498 (eq (string-match lao-composition-pattern string pos) pos))
592 "Compose Lao text in the region FROM and TO. 499 (prog1 (match-end 0)
593 The text matches the regular expression PATTERN. 500 (compose-string string pos (match-end 0))))
594 Optional 4th argument STRING, if non-nil, is a string containing text 501 (if (>= pos (point-min))
595 to compose. 502 (save-excursion
596 503 (goto-char pos)
597 The return value is number of composed characters." 504 (if (looking-at lao-composition-pattern)
598 (if (< (1+ from) to) 505 (prog1 (match-end 0)
599 (progn 506 (compose-region pos (match-end 0)))))))))
600 (if string
601 (compose-string string from to)
602 (compose-region from to))
603 (- to from))))
604 507
605 ;;;###autoload 508 ;;;###autoload
606 (defun lao-compose-region (from to) 509 (defun lao-compose-region (from to)
607 (interactive "r") 510 (interactive "r")
608 (save-restriction 511 (save-restriction