70
|
1 ;; Ethiopic language utilities for Mule
|
|
2 ;; Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
|
3
|
|
4 ;; This file is part of XEmacs.
|
|
5 ;; This file contains Ethiopic characters.
|
|
6
|
|
7 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
8 ;; under the terms of the GNU General Public License as published by
|
|
9 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
10 ;; any later version.
|
|
11
|
|
12 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
15 ;; General Public License for more details.
|
|
16
|
|
17 ;; You should have received a copy of the GNU General Public License
|
|
18 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
19 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 ;; Boston, MA 02111-1307, USA.
|
|
21
|
|
22 ;;; 94.10.13 created for Mule Ver.2.1 by TAKAHASHI Naoto <ntakahas@etl.go.jp>
|
|
23 ;;; 94.12.27 modified for Mule Ver.2.2 by TAKAHASHI Naoto <ntakahas@etl.go.jp>
|
|
24 ;;; 95.7.24 modified for Mule Ver.2.3 by TAKAHASHI Naoto <ntakahas@etl.go.jp>
|
|
25
|
|
26 ;;
|
|
27 ;; ETHIOPIC UTILITY FUNCTIONS
|
|
28 ;;
|
|
29
|
|
30 ;; To automatically convert Ethiopic text to SERA format when sending mail,
|
|
31 ;; (add-hook 'mail-send-hook 'fidel-to-sera-mail)
|
|
32 ;;
|
|
33 ;; To automatically convert SERA format to Ethiopic when receiving mail,
|
|
34 ;; (add-hook 'rmail-show-message-hook 'sera-to-fidel-mail)
|
|
35 ;;
|
|
36 ;; To automatically convert Ethiopic text to SERA format when posting news,
|
|
37 ;; (add-hook 'news-inews-hook 'fidel-to-sera-mail)
|
|
38 ;;
|
|
39 ;; If the filename ends in ".sera", editing will be done in fidel
|
|
40 ;; while file I/O will be done in sera.
|
|
41 ;;
|
|
42 ;; The following two functions have been removed.
|
|
43 ;; fidel-to-sera-for-disksave
|
|
44 ;; sera-to-fidel-for-disksave
|
|
45
|
|
46 ;;
|
|
47 ;; SERA to FIDEL
|
|
48 ;;
|
|
49
|
|
50 (defconst sera-to-fidel-table
|
|
51 [
|
|
52 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
|
|
53 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
|
|
54 ;;; SP ! " # $ % & ' ( ) * + , - . /
|
|
55 nil nil nil nil nil nil nil ("") nil nil nil nil ("$(2$Q(B") nil ("$(2$P(B") nil
|
|
56 ;;; 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @
|
|
57 nil nil nil nil nil nil nil nil nil nil ("$(2$S(B") ("$(2$R(B") nil nil nil nil nil
|
|
58 ;;; A
|
|
59 ("$(2"V(B" (?2 "$(2#b(B"))
|
|
60 ;;; B
|
|
61 ("$(2!F(B" (?e "$(2!A(B") (?u "$(2!B(B") (?i "$(2!C(B") (?a "$(2!D(B") (?E "$(2!E(B") (?o "$(2!G(B") (?| "$(2!F(B")
|
|
62 (?W "$(2!H(B" (?a "$(2!H(B")
|
|
63 (?e "$(2!F#L(B") (?u "$(2!F#M(B") (?i "$(2!F#N(B") (?E "$(2!F#P(B") (?' "$(2!F#M(B")))
|
|
64 ;;; C
|
|
65 ("$(2"8(B" (?e "$(2"3(B") (?u "$(2"4(B") (?i "$(2"5(B") (?a "$(2"6(B") (?E "$(2"7(B") (?o "$(2"9(B") (?| "$(2"8(B")
|
|
66 (?W "$(2":(B" (?a "$(2":(B")
|
|
67 (?e "$(2"8#L(B") (?u "$(2"8#M(B") (?i "$(2"8#N(B") (?E "$(2"8#P(B") (?' "$(2"8#M(B")))
|
|
68 ;;; D
|
|
69 ("$(2$0(B" (?e "$(2$+(B") (?u "$(2$,(B") (?i "$(2$-(B") (?a "$(2$.(B") (?E "$(2$/(B") (?o "$(2$1(B") (?| "$(2$0(B"))
|
|
70 ;;; E
|
|
71 ("$(2"W(B" (?2 "$(2#c(B"))
|
|
72 ;;; F
|
|
73 ("$(2"@(B" (?e "$(2";(B") (?u "$(2"<(B") (?i "$(2"=(B") (?a "$(2">(B") (?E "$(2"?(B") (?o "$(2"A(B") (?| "$(2"@(B")
|
|
74 (?W "$(2"B(B" (?a "$(2"B(B")
|
|
75 (?e "$(2"@#L(B") (?u "$(2"@#M(B") (?i "$(2"@#N(B") (?E "$(2"@#P(B") (?' "$(2"@#M(B")))
|
|
76 ;;; G
|
|
77 ("$(2$>(B" (?e "$(2$9(B") (?u "$(2$:(B") (?i "$(2$;(B") (?a "$(2$<(B") (?E "$(2$=(B") (?o "$(2$?(B") (?| "$(2$>(B"))
|
|
78 ;;; H
|
|
79 ("$(2$"(B" (?e "$(2#{(B") (?u "$(2#|(B") (?i "$(2#}(B") (?a "$(2#~(B") (?E "$(2$!(B") (?o "$(2$#(B") (?| "$(2$"(B"))
|
|
80 ;;; I
|
|
81 ("$(2"X(B" (?2 "$(2#d(B"))
|
|
82 ;;; J
|
|
83 ("$(2$7(B" (?e "$(2$2(B") (?u "$(2$3(B") (?i "$(2$4(B") (?a "$(2$5(B") (?E "$(2$6(B") (?o "$(2$8(B") (?| "$(2$7(B"))
|
|
84 ;;; K
|
|
85 ("$(2"x(B" (?e "$(2"s(B") (?u "$(2"t(B") (?i "$(2"u(B") (?a "$(2"v(B") (?E "$(2"w(B") (?o "$(2"y(B") (?| "$(2"x(B")
|
|
86 (?W "$(2"{(B" (?e "$(2"z(B") (?u "$(2"{(B") (?i "$(2"|(B") (?a "$(2"}(B") (?E "$(2"~(B")))
|
|
87 ;;; L
|
|
88 ("$(2!&(B" (?e "$(2!!(B") (?u "$(2!"(B") (?i "$(2!#(B") (?a "$(2!$(B") (?E "$(2!%(B") (?o "$(2!'(B") (?| "$(2!&(B")
|
|
89 (?W "$(2!((B" (?a "$(2!((B")
|
|
90 (?e "$(2!&#L(B") (?u "$(2!&#M(B") (?i "$(2!&#N(B") (?E "$(2!&#P(B") (?' "$(2!&#M(B")))
|
|
91 ;;; M
|
|
92 ("$(2!.(B" (?e "$(2!)(B") (?u "$(2!*(B") (?i "$(2!+(B") (?a "$(2!,(B") (?E "$(2!-(B") (?o "$(2!/(B") (?| "$(2!.(B")
|
|
93 (?W "$(2!0(B" (?a "$(2!0(B")
|
|
94 (?e "$(2!.#L(B") (?u "$(2!.#M(B") (?i "$(2!.#N(B") (?E "$(2!.#P(B") (?' "$(2!.#M(B")))
|
|
95 ;;; N
|
|
96 ("$(2!n(B" (?e "$(2!i(B") (?u "$(2!j(B") (?i "$(2!k(B") (?a "$(2!l(B") (?E "$(2!m(B") (?o "$(2!o(B") (?| "$(2!n(B")
|
|
97 (?W "$(2!p(B" (?a "$(2!p(B")
|
|
98 (?e "$(2!n#L(B") (?u "$(2!n#M(B") (?i "$(2!n#N(B") (?E "$(2!n#P(B") (?' "$(2!n#M(B")))
|
|
99 ;;; O
|
|
100 ("$(2"Y(B" (?2 "$(2#e(B"))
|
|
101 ;;; P
|
|
102 ("$(2$E(B" (?e "$(2$@(B") (?u "$(2$A(B") (?i "$(2$B(B") (?a "$(2$C(B") (?E "$(2$D(B") (?o "$(2$F(B") (?| "$(2$E(B"))
|
|
103 ;;; Q
|
|
104 ("$(2#2(B" (?e "$(2#-(B") (?u "$(2#.(B") (?i "$(2#/(B") (?a "$(2#0(B") (?E "$(2#1(B") (?o "$(2#3(B") (?| "$(2#2(B")
|
|
105 (?W "$(2#5(B" (?e "$(2#4(B") (?u "$(2#5(B") (?i "$(2#6(B") (?a "$(2#7(B") (?E "$(2#8(B")))
|
|
106 ;;; R
|
|
107 ("$(2!6(B" (?e "$(2!1(B") (?u "$(2!2(B") (?i "$(2!3(B") (?a "$(2!4(B") (?E "$(2!5(B") (?o "$(2!7(B") (?| "$(2!6(B")
|
|
108 (?W "$(2!8(B" (?a "$(2!8(B")
|
|
109 (?e "$(2!6#L(B") (?u "$(2!6#M(B") (?i "$(2!6#N(B") (?E "$(2!6#P(B") (?' "$(2!6#M(B")))
|
|
110 ;;; S
|
|
111 ("$(2"P(B" (?e "$(2"K(B") (?u "$(2"L(B") (?i "$(2"M(B") (?a "$(2"N(B") (?E "$(2"O(B") (?o "$(2"Q(B") (?| "$(2"P(B")
|
|
112 (?W "$(2"R(B" (?a "$(2"R(B")
|
|
113 (?e "$(2"P#L(B") (?u "$(2"P#M(B") (?i "$(2"P#N(B") (?E "$(2"P#P(B") (?' "$(2"P#M(B"))
|
|
114 (?2 "$(2#](B" (?| "$(2#](B")
|
|
115 (?e "$(2#X(B") (?u "$(2#Y(B") (?i "$(2#Z(B") (?a "$(2#[(B") (?E "$(2#\(B") (?o "$(2#^(B")
|
|
116 (?W "$(2"R(B"
|
|
117 (?a "$(2"R(B")
|
|
118 (?e "$(2#]#L(B") (?u "$(2#]#M(B") (?i "$(2#]#N(B") (?E "$(2#]#P(B") (?' "$(2#]#M(B"))))
|
|
119
|
|
120 ;;; T
|
|
121 ("$(2"0(B" (?e "$(2"+(B") (?u "$(2",(B") (?i "$(2"-(B") (?a "$(2".(B") (?E "$(2"/(B") (?o "$(2"1(B") (?| "$(2"0(B")
|
|
122 (?W "$(2"2(B" (?a "$(2"2(B")
|
|
123 (?e "$(2"0#L(B") (?u "$(2"0#M(B") (?i "$(2"0#N(B") (?E "$(2"0#P(B") (?' "$(2"0#M(B")))
|
|
124 ;;; U
|
|
125 ("$(2"T(B" (?2 "$(2#`(B"))
|
|
126 ;;; V
|
|
127 ("$(2!N(B" (?e "$(2!I(B") (?u "$(2!J(B") (?i "$(2!K(B") (?a "$(2!L(B") (?E "$(2!M(B") (?o "$(2!O(B") (?| "$(2!N(B")
|
|
128 (?W "$(2!P(B" (?a "$(2!P(B")
|
|
129 (?e "$(2!N#L(B") (?u "$(2!N#M(B") (?i "$(2!N#N(B") (?E "$(2!N#P(B") (?' "$(2!N#M(B")))
|
|
130 ;;; W
|
|
131 ("$(2#M(B" (?e "$(2#L(B") (?u "$(2#M(B") (?i "$(2#N(B") (?a "$(2#O(B") (?E "$(2#P(B"))
|
|
132 ;;; X
|
|
133 ("$(2#y(B" (?e "$(2#t(B") (?u "$(2#u(B") (?i "$(2#v(B") (?a "$(2#w(B") (?E "$(2#x(B") (?o "$(2#z(B") (?| "$(2#y(B"))
|
|
134 ;;; Y
|
|
135 ("$(2$)(B" (?e "$(2$$(B") (?u "$(2$%(B") (?i "$(2$&(B") (?a "$(2$'(B") (?E "$(2$((B") (?o "$(2$*(B") (?| "$(2$)(B"))
|
|
136 ;;; Z
|
|
137 ("$(2!~(B" (?e "$(2!y(B") (?u "$(2!z(B") (?i "$(2!{(B") (?a "$(2!|(B") (?E "$(2!}(B") (?o "$(2"!(B") (?| "$(2!~(B")
|
|
138 (?W "$(2""(B" (?a "$(2""(B")
|
|
139 (?e "$(2!~#L(B") (?u "$(2!~#M(B") (?i "$(2!~#N(B") (?E "$(2!~#P(B") (?' "$(2!~#M(B")))
|
|
140 ;;; [ \ ] ^ _
|
|
141 nil nil nil nil nil
|
|
142 ;;; `
|
|
143 ("`"
|
|
144 (?e "$(2#_(B") (?u "$(2#`(B") (?U "$(2#`(B") (?i "$(2#a(B") (?a "$(2#b(B") (?A "$(2#b(B")
|
|
145 (?E "$(2#c(B") (?I "$(2#d(B") (?o "$(2#e(B") (?O "$(2#e(B")
|
|
146 (?s "$(2#V(B"
|
|
147 (?e "$(2#Q(B") (?u "$(2#R(B") (?i "$(2#S(B") (?a "$(2#T(B") (?E "$(2#U(B") (?o "$(2#W(B") (?| "$(2#V(B")
|
|
148 (?W "$(2"J(B" (?a "$(2"J(B")
|
|
149 (?e "$(2#V#L(B") (?u "$(2#V#M(B") (?i "$(2#V#N(B") (?E "$(2#V#P(B") (?' "$(2#V#M(B")))
|
|
150 (?S "$(2#](B"
|
|
151 (?e "$(2#X(B") (?u "$(2#Y(B") (?i "$(2#Z(B") (?a "$(2#[(B") (?E "$(2#\(B") (?o "$(2#^(B") (?| "$(2#](B")
|
|
152 (?W "$(2"R(B" (?a "$(2"R(B")
|
|
153 (?e "$(2#]#L(B") (?u "$(2#]#M(B") (?i "$(2#]#N(B") (?E "$(2#]#P(B") (?' "$(2#]#M(B")))
|
|
154 (?h "$(2#k(B"
|
|
155 (?e "$(2#f(B") (?u "$(2#g(B") (?i "$(2#h(B") (?a "$(2#i(B") (?E "$(2#j(B") (?o "$(2#l(B") (?| "$(2#k(B")
|
|
156 (?W "$(2"c(B" (?e "$(2"b(B") (?u "$(2"c(B") (?i "$(2"d(B") (?a "$(2"e(B") (?E "$(2"f(B")))
|
|
157 (?k "$(2#r(B"
|
|
158 (?e "$(2#m(B") (?u "$(2#n(B") (?i "$(2#o(B") (?a "$(2#p(B") (?E "$(2#q(B") (?o "$(2#s(B") (?| "$(2#r(B")))
|
|
159 ;;; a
|
|
160 ("$(2"S(B" (?2 "$(2#b(B"))
|
|
161
|
|
162 ;;; b
|
|
163 ("$(2!F(B" (?e "$(2!A(B") (?u "$(2!B(B") (?i "$(2!C(B") (?a "$(2!D(B") (?E "$(2!E(B") (?o "$(2!G(B") (?| "$(2!F(B")
|
|
164 (?W "$(2!H(B" (?a "$(2!H(B")
|
|
165 (?e "$(2!F#L(B") (?u "$(2!F#M(B") (?i "$(2!F#N(B") (?E "$(2!F#P(B") (?' "$(2!F#M(B")))
|
|
166 ;;; c
|
|
167 ("$(2!^(B" (?e "$(2!Y(B") (?u "$(2!Z(B") (?i "$(2![(B") (?a "$(2!\(B") (?E "$(2!](B") (?o "$(2!_(B") (?| "$(2!^(B")
|
|
168 (?W "$(2!`(B" (?a "$(2!`(B")
|
|
169 (?e "$(2!^#L(B") (?u "$(2!^#M(B") (?i "$(2!^#N(B") (?E "$(2!^#P(B") (?' "$(2!^#M(B")))
|
|
170 ;;; d
|
|
171 ("$(2"((B" (?e "$(2"#(B") (?u "$(2"$(B") (?i "$(2"%(B") (?a "$(2"&(B") (?E "$(2"'(B") (?o "$(2")(B") (?| "$(2"((B")
|
|
172 (?W "$(2"*(B" (?a "$(2"*(B")
|
|
173 (?e "$(2"(#L(B") (?u "$(2"(#M(B") (?i "$(2"(#N(B") (?E "$(2"(#P(B") (?' "$(2"(#M(B")))
|
|
174 ;;; e
|
|
175 ("$(2"S(B" (?2 "$(2#_(B") (?3 "$(2"Z(B"))
|
|
176 ;;; f
|
|
177 ("$(2"@(B" (?e "$(2";(B") (?u "$(2"<(B") (?i "$(2"=(B") (?a "$(2">(B") (?E "$(2"?(B") (?o "$(2"A(B") (?| "$(2"@(B")
|
|
178 (?W "$(2"B(B" (?a "$(2"B(B")
|
|
179 (?e "$(2"@#L(B") (?u "$(2"@#M(B") (?i "$(2"@#N(B") (?E "$(2"@#P(B") (?' "$(2"@#M(B")))
|
|
180 ;;; g
|
|
181 ("$(2#>(B" (?e "$(2#9(B") (?u "$(2#:(B") (?i "$(2#;(B") (?a "$(2#<(B") (?E "$(2#=(B") (?o "$(2#?(B") (?| "$(2#>(B")
|
|
182 (?W "$(2#A(B" (?e "$(2#@(B") (?u "$(2#A(B") (?i "$(2#B(B") (?a "$(2#C(B") (?E "$(2#D(B")))
|
|
183 ;;; h
|
|
184 ("$(2"`(B" (?e "$(2"[(B") (?u "$(2"\(B") (?i "$(2"](B") (?a "$(2"^(B") (?E "$(2"_(B") (?o "$(2"a(B") (?| "$(2"`(B")
|
|
185 (?W "$(2"c(B" (?e "$(2"b(B") (?u "$(2"c(B") (?i "$(2"d(B") (?a "$(2"e(B") (?E "$(2"f(B"))
|
|
186 (?2 "$(2#k(B" (?e "$(2#f(B") (?u "$(2#g(B") (?i "$(2#h(B") (?a "$(2#i(B") (?E "$(2#j(B") (?o "$(2#l(B")
|
|
187 (?| "$(2#k(B")
|
|
188 (?W "$(2"c(B" (?e "$(2"b(B") (?u "$(2"c(B") (?i "$(2"d(B") (?a "$(2"e(B") (?E "$(2"f(B"))))
|
|
189 ;;; i
|
|
190 ("$(2"U(B" (?2 "$(2#a(B"))
|
|
191 ;;; j
|
|
192 ("$(2$7(B" (?e "$(2$2(B") (?u "$(2$3(B") (?i "$(2$4(B") (?a "$(2$5(B") (?E "$(2$6(B") (?o "$(2$8(B") (?| "$(2$7(B"))
|
|
193 ;;; k
|
|
194 ("$(2"l(B" (?e "$(2"g(B") (?u "$(2"h(B") (?i "$(2"i(B") (?a "$(2"j(B") (?E "$(2"k(B") (?o "$(2"m(B") (?| "$(2"l(B")
|
|
195 (?W "$(2"o(B" (?e "$(2"n(B") (?u "$(2"o(B") (?i "$(2"p(B") (?a "$(2"q(B") (?E "$(2"r(B"))
|
|
196 (?2 "$(2#r(B" (?e "$(2#m(B") (?u "$(2#n(B") (?i "$(2#o(B") (?a "$(2#p(B") (?E "$(2#q(B") (?o "$(2#s(B")
|
|
197 (?| "$(2#r(B")))
|
|
198 ;;; l
|
|
199 ("$(2!&(B" (?e "$(2!!(B") (?u "$(2!"(B") (?i "$(2!#(B") (?a "$(2!$(B") (?E "$(2!%(B") (?o "$(2!'(B") (?| "$(2!&(B")
|
|
200 (?W "$(2!((B" (?a "$(2!((B")
|
|
201 (?e "$(2!&#L(B") (?u "$(2!&#M(B") (?i "$(2!&#N(B") (?E "$(2!&#P(B") (?' "$(2!&#M(B")))
|
|
202 ;;; m
|
|
203 ("$(2!.(B" (?e "$(2!)(B") (?u "$(2!*(B") (?i "$(2!+(B") (?a "$(2!,(B") (?E "$(2!-(B") (?o "$(2!/(B") (?| "$(2!.(B")
|
|
204 (?W "$(2!0(B" (?a "$(2!0(B")
|
|
205 (?e "$(2!.#L(B") (?u "$(2!.#M(B") (?i "$(2!.#N(B") (?E "$(2!.#P(B") (?' "$(2!.#M(B")))
|
|
206 ;;; n
|
|
207 ("$(2!f(B" (?e "$(2!a(B") (?u "$(2!b(B") (?i "$(2!c(B") (?a "$(2!d(B") (?E "$(2!e(B") (?o "$(2!g(B") (?| "$(2!f(B")
|
|
208 (?W "$(2!h(B" (?a "$(2!h(B")
|
|
209 (?e "$(2!f#L(B") (?u "$(2!f#M(B") (?i "$(2!f#N(B") (?E "$(2!f#P(B") (?' "$(2!f#M(B")))
|
|
210 ;;; o
|
|
211 ("$(2"Y(B" (?2 "$(2#e(B"))
|
|
212 ;;; p
|
|
213 ("$(2$L(B" (?e "$(2$G(B") (?u "$(2$H(B") (?i "$(2$I(B") (?a "$(2$J(B") (?E "$(2$K(B") (?o "$(2$M(B") (?| "$(2$L(B"))
|
|
214 ;;; q
|
|
215 ("$(2#&(B" (?e "$(2#!(B") (?u "$(2#"(B") (?i "$(2##(B") (?a "$(2#$(B") (?E "$(2#%(B") (?o "$(2#'(B") (?| "$(2#&(B")
|
|
216 (?W "$(2#)(B" (?e "$(2#((B") (?u "$(2#)(B") (?i "$(2#*(B") (?a "$(2#+(B") (?E "$(2#,(B")))
|
|
217 ;;; r
|
|
218 ("$(2!6(B" (?e "$(2!1(B") (?u "$(2!2(B") (?i "$(2!3(B") (?a "$(2!4(B") (?E "$(2!5(B") (?o "$(2!7(B") (?| "$(2!6(B")
|
|
219 (?W "$(2!8(B" (?a "$(2!8(B")
|
|
220 (?e "$(2!6#L(B") (?u "$(2!6#M(B") (?i "$(2!6#N(B") (?E "$(2!6#P(B") (?' "$(2!6#M(B")))
|
|
221 ;;; s
|
|
222 ("$(2"H(B" (?e "$(2"C(B") (?u "$(2"D(B") (?i "$(2"E(B") (?a "$(2"F(B") (?E "$(2"G(B") (?o "$(2"I(B") (?| "$(2"H(B")
|
|
223 (?W "$(2"J(B" (?a "$(2"J(B")
|
|
224 (?e "$(2"H#L(B") (?u "$(2"H#M(B") (?i "$(2"H#N(B") (?E "$(2"H#P(B") (?' "$(2"H#M(B"))
|
|
225 (?2 "$(2#V(B" (?e "$(2#Q(B") (?u "$(2#R(B") (?i "$(2#S(B") (?a "$(2#T(B") (?E "$(2#U(B") (?o "$(2#W(B")
|
|
226 (?| "$(2#V(B")
|
|
227 (?W "$(2"J(B" (?a "$(2"J(B")
|
|
228 (?e "$(2#V#L(B") (?u "$(2#V#M(B") (?i "$(2#V#N(B") (?E "$(2#V#P(B")
|
|
229 (?' "$(2#V#M(B"))))
|
|
230 ;;; t
|
|
231 ("$(2!V(B" (?e "$(2!Q(B") (?u "$(2!R(B") (?i "$(2!S(B") (?a "$(2!T(B") (?E "$(2!U(B") (?o "$(2!W(B") (?| "$(2!V(B")
|
|
232 (?W "$(2!X(B" (?a "$(2!X(B")
|
|
233 (?e "$(2!V#L(B") (?u "$(2!V#M(B") (?i "$(2!V#N(B") (?E "$(2!V#P(B") (?' "$(2!V#M(B")))
|
|
234 ;;; u
|
|
235 ("$(2"T(B" (?2 "$(2#`(B"))
|
|
236 ;;; v
|
|
237 ("$(2!N(B" (?e "$(2!I(B") (?u "$(2!J(B") (?i "$(2!K(B") (?a "$(2!L(B") (?E "$(2!M(B") (?o "$(2!O(B") (?| "$(2!N(B")
|
|
238 (?W "$(2!P(B" (?a "$(2!P(B")
|
|
239 (?e "$(2!N#L(B") (?u "$(2!N#M(B") (?i "$(2!N#N(B") (?E "$(2!N#P(B") (?' "$(2!N#M(B")))
|
|
240 ;;; w
|
|
241 ("$(2#J(B" (?e "$(2#E(B") (?u "$(2#F(B") (?i "$(2#G(B") (?a "$(2#H(B") (?E "$(2#I(B") (?o "$(2#K(B") (?| "$(2#J(B")
|
|
242 (?W "$(2#M(B" (?e "$(2#L(B") (?u "$(2#M(B") (?i "$(2#N(B") (?a "$(2#O(B") (?E "$(2#P(B")))
|
|
243 ;;; x
|
|
244 ("$(2!>(B" (?e "$(2!9(B") (?u "$(2!:(B") (?i "$(2!;(B") (?a "$(2!<(B") (?E "$(2!=(B") (?o "$(2!?(B") (?| "$(2!>(B")
|
|
245 (?W "$(2!@(B" (?a "$(2!@(B")
|
|
246 (?e "$(2!>#L(B") (?u "$(2!>#M(B") (?i "$(2!>#N(B") (?E "$(2!>#P(B") (?' "$(2!>#M(B")))
|
|
247 ;;; y
|
|
248 ("$(2$)(B" (?e "$(2$$(B") (?u "$(2$%(B") (?i "$(2$&(B") (?a "$(2$'(B") (?E "$(2$((B") (?o "$(2$*(B") (?| "$(2$)(B"))
|
|
249 ;;; z
|
|
250 ("$(2!v(B" (?e "$(2!q(B") (?u "$(2!r(B") (?i "$(2!s(B") (?a "$(2!t(B") (?E "$(2!u(B") (?o "$(2!w(B") (?| "$(2!v(B")
|
|
251 (?W "$(2!x(B" (?a "$(2!x(B")
|
|
252 (?e "$(2!v#L(B") (?u "$(2!v#M(B") (?i "$(2!v#N(B") (?E "$(2!v#P(B") (?' "$(2!v#M(B")))
|
|
253 ])
|
|
254
|
|
255 ;;;###autoload
|
|
256 (defun sera-to-fidel-region (beg end &optional ascii-mode force)
|
|
257 "Translates the characters in region from SERA to FIDEL.
|
|
258
|
|
259 If the 1st optional parameter ASCII-MODE is non-NIL, assumes that the
|
|
260 region begins in ASCII script.
|
|
261
|
|
262 If the 2nd optional parametr FORCE is non-NIL, translates even if the
|
|
263 buffer is read-only."
|
|
264
|
|
265 (interactive "r\nP")
|
|
266 (save-excursion
|
|
267 (save-restriction
|
|
268 (narrow-to-region beg end)
|
|
269 (sera-to-fidel-buffer ascii-mode force))))
|
|
270
|
|
271 ;;;###autoload
|
|
272 (defun sera-to-fidel-buffer (&optional ascii-mode force)
|
|
273 "Translates the current buffer from SERA to FIDEL.
|
|
274
|
|
275 If the 1st optional parameter ASCII-MODE is non-NIL, assumes that the
|
|
276 current buffer begins in ASCII script.
|
|
277
|
|
278 If the 2nd optional panametr FORCE is non-NIL, translates even if the
|
|
279 buffer is read-only."
|
|
280
|
|
281 (interactive "P")
|
|
282 (if (and buffer-read-only
|
|
283 (not force)
|
|
284 (not (y-or-n-p "Buffer is read-only. Force to convert? ")))
|
|
285 (error ""))
|
|
286 (let (start pre fol hard table table2 (buffer-read-only nil))
|
|
287 (goto-char (point-min))
|
|
288 (while (not (eobp))
|
|
289 (setq start (point))
|
|
290 (forward-char 1)
|
|
291 (setq pre (preceding-char)
|
|
292 fol (following-char))
|
|
293
|
|
294 (if ascii-mode
|
|
295 (cond
|
|
296
|
|
297 ;; ascii mode, pre != \
|
|
298 ((/= pre ?\\ ))
|
|
299
|
|
300 ;; ascii mode, pre = \, fol = !
|
|
301 ((= fol ?!)
|
|
302 (backward-delete-char 1)
|
|
303 (delete-char 1)
|
|
304 (setq ascii-mode nil
|
|
305 hard (not hard)))
|
|
306
|
|
307 ;; hard ascii mode, pre = \, fol != !
|
|
308 (hard)
|
|
309
|
|
310 ;; soft ascii mode, pre = \, fol = {\ _ * < > 0..9 ~}
|
|
311 ((or (backward-delete-char 1) ; always nil
|
|
312 (eobp)
|
|
313 (sera-to-fidel-backslash)))
|
|
314
|
|
315 ;; soft ascii mode, pre = \, fol = SPC
|
|
316 ((= fol 32)
|
|
317 (delete-char 1)
|
|
318 (setq ascii-mode nil))
|
|
319
|
|
320 ;; soft ascii mode, pre = \, fol = .
|
|
321 ((= fol ?.)
|
|
322 (delete-char 1)
|
|
323 (insert ?$(2$P(B))
|
|
324
|
|
325 ;; soft ascii mode, pre = \, fol = ,
|
|
326 ((= fol ?,)
|
|
327 (delete-char 1)
|
|
328 (insert ?$(2$Q(B))
|
|
329
|
|
330 ;; soft ascii mode, pre = \, fol = ;
|
|
331 ((= fol ?\;)
|
|
332 (delete-char 1)
|
|
333 (insert ?$(2$R(B))
|
|
334
|
|
335 ;; soft ascii mode, pre = \, fol = :
|
|
336 ((= fol ?:)
|
|
337 (delete-char 1)
|
|
338 (insert ?$(2$S(B))
|
|
339
|
|
340 ;; soft ascii mode, pre = \, fol = others
|
|
341 (t
|
|
342 (setq ascii-mode nil)))
|
|
343
|
|
344 (cond
|
|
345
|
|
346 ;; very special: skip "<" to ">" (or "&" to ";") if in w3-mode
|
|
347 ((and (boundp 'sera-being-called-by-w3)
|
|
348 sera-being-called-by-w3
|
|
349 (or (= pre ?<) (= pre ?&)))
|
|
350 (search-forward (if (= pre ?<) ">" ";")
|
|
351 nil 0))
|
|
352
|
|
353 ;; ethio mode, pre != sera
|
|
354 ((or (< pre ?') (> pre ?z)))
|
|
355
|
|
356 ;; ethio mode, pre != \
|
|
357 ((/= pre ?\\ )
|
|
358 (setq table (aref sera-to-fidel-table pre))
|
|
359 (while (setq table2 (cdr (assoc (following-char) table)))
|
|
360 (setq table table2)
|
|
361 (forward-char 1))
|
|
362 (if (car table)
|
|
363 (progn
|
|
364 (delete-region start (point))
|
|
365 (insert (car table)))))
|
|
366
|
|
367 ;; ethio mode, pre = \, fol = !
|
|
368 ((= fol ?!)
|
|
369 (backward-delete-char 1)
|
|
370 (delete-char 1)
|
|
371 (setq ascii-mode t
|
|
372 hard (not hard)))
|
|
373
|
|
374 ;; hard ethio mode, pre = \, fol != !
|
|
375 (hard)
|
|
376
|
|
377 ;; soft ethio mode, pre = \, fol = {\ _ * < > 0..9 ~}
|
|
378 ((or (backward-delete-char 1) ; always nil
|
|
379 (eobp)
|
|
380 (sera-to-fidel-backslash)))
|
|
381
|
|
382 ;; soft ethio mode, pre = \, fol = SPC
|
|
383 ((= fol 32)
|
|
384 (delete-char 1)
|
|
385 (setq ascii-mode t))
|
|
386
|
|
387 ;; soft ethio mode, pre = \, fol = {. , ; : | ' `}
|
|
388 ((memq fol '(?. ?, ?\; ?: ?| ?' ?`))
|
|
389 (forward-char 1))
|
|
390
|
|
391 ;; soft ethio mode, pre = \, fol = others
|
|
392 (t
|
|
393 (setq ascii-mode t))))))
|
|
394 (goto-char (point-min)))
|
|
395
|
|
396 (defun sera-to-fidel-backslash nil
|
|
397 "Handle SERA backslash escapes common to ethio- and ascii-mode.
|
|
398 Returns t if something has been processed."
|
|
399 (let ((ch (following-char))
|
|
400 (converted t))
|
|
401 (if (and (>= ch ?1) (<= ch ?9))
|
|
402 (ethio-convert-digit)
|
|
403 (delete-char 1)
|
|
404 (cond
|
|
405 ((= ch ?\\ )
|
|
406 (insert ?\\ ))
|
|
407 ((= ch ?_)
|
|
408 (insert ?$(2$O(B))
|
|
409 ((= ch ?*)
|
|
410 (insert ?$(2$T(B))
|
|
411 ((= ch ?<)
|
|
412 (insert ?$(2$U(B))
|
|
413 ((= ch ?>)
|
|
414 (insert ?$(2$V(B))
|
|
415 ((= ch ?~)
|
|
416 (setq ch (following-char))
|
|
417 (delete-char 1)
|
|
418 (cond
|
|
419 ((= ch ?e)
|
|
420 (insert "$(2$k(B"))
|
|
421 ((= ch ?E)
|
|
422 (insert "$(2$l(B"))
|
|
423 ((= ch ?a)
|
|
424 (insert "$(2$m(B"))
|
|
425 ((= ch ?A)
|
|
426 (insert "$(2$n(B"))))
|
|
427 (t
|
|
428 (insert ch)
|
|
429 (backward-char 1)
|
|
430 (setq converted nil))))
|
|
431 converted))
|
|
432
|
|
433 (defun ethio-convert-digit nil
|
|
434 "Convert Arabic digits to Ethiopic digits."
|
|
435 (let (ch z)
|
|
436 (while (and (>= (setq ch (following-char)) ?1)
|
|
437 (<= ch ?9))
|
|
438 (delete-char 1)
|
|
439
|
|
440 ;; count up following zeros
|
|
441 (setq z 0)
|
|
442 (while (= (following-char) ?0)
|
|
443 (delete-char 1)
|
|
444 (setq z (1+ z)))
|
|
445
|
|
446 (cond
|
|
447
|
|
448 ;; first digit is 10, 20, ..., or 90
|
|
449 ((= (mod z 2) 1)
|
|
450 ;; (- ch 40) means ?1 -> 9, ?2 -> 10, etc.
|
|
451 (insert (aref [?$(2$`(B ?$(2$a(B ?$(2$b(B ?$(2$c(B ?$(2$d(B ?$(2$e(B ?$(2$f(B ?$(2$g(B ?$(2$h(B] (- ch ?1)))
|
|
452 (setq z (1- z)))
|
|
453
|
|
454 ;; first digit is 2, 3, ..., or 9
|
|
455 ((/= ch ?1)
|
|
456 (insert (aref [?$(2$X(B ?$(2$Y(B ?$(2$Z(B ?$(2$[(B ?$(2$\(B ?$(2$](B ?$(2$^(B ?$(2$_(B] (- ch ?2))))
|
|
457
|
|
458 ;; single 1
|
|
459 ((= z 0)
|
|
460 (insert "$(2$W(B")))
|
|
461
|
|
462 ;; 100
|
|
463 (if (= (mod z 4) 2)
|
|
464 (insert"$(2$i(B"))
|
|
465
|
|
466 ;; 10000
|
|
467 (insert-char ?$(2$j(B (/ z 4)))))
|
|
468
|
|
469 ;;;###autoload
|
|
470 (defun sera-to-fidel-mail (&optional arg)
|
|
471 "Does SERA to FIDEL conversion for reading/writing mail and news.
|
|
472
|
|
473 If the buffer contains the markers \"<sera>\" and \"</sera>\",
|
|
474 converts the segment between the two markers in Ethio start mode and
|
|
475 the subject field in ASCII start mode.
|
|
476
|
|
477 If invoked interactively and there is no marker, converts both the
|
|
478 whole body and the subject field in Ethio start mode.
|
|
479
|
|
480 For backward compatibility, \"<ethiopic>\" and \"<>\" can be used instead of
|
|
481 \"<sera>\" and \"</sera>\"."
|
|
482
|
|
483 (interactive "p")
|
|
484 (let* ((buffer-read-only nil) border)
|
|
485
|
|
486 (save-excursion
|
|
487 (goto-char (point-min))
|
|
488 (setq border
|
|
489 (search-forward
|
|
490 (if (eq major-mode 'rmail-mode)
|
|
491 "\n\n"
|
|
492 (concat "\n" mail-header-separator "\n"))))
|
|
493
|
|
494 (cond
|
|
495
|
|
496 ;; with markers
|
|
497 ((re-search-forward "^<sera>\n" nil t)
|
|
498 (goto-char (match-beginning 0))
|
|
499 (while (re-search-forward "^<sera>\n" nil t)
|
|
500 (replace-match "" nil t)
|
|
501 (sera-to-fidel-region
|
|
502 (point)
|
|
503 (progn
|
|
504 (if (re-search-forward "^</sera>\n" nil 0)
|
|
505 (replace-match "" nil t))
|
|
506 (point))))
|
|
507
|
|
508 (goto-char (point-min))
|
|
509 (if (re-search-forward "^Subject: " border t)
|
|
510 (sera-to-fidel-region
|
|
511 (point)
|
|
512 (progn (end-of-line) (point))
|
|
513 'ascii-start)))
|
|
514
|
|
515 ;; backward compatibility
|
|
516 ((re-search-forward "^<ethiopic>\n" nil t)
|
|
517 (goto-char (match-beginning 0))
|
|
518 (while (re-search-forward "^<ethiopic>\n" nil t)
|
|
519 (replace-match "" nil t)
|
|
520 (sera-to-fidel-region
|
|
521 (setq border (point))
|
|
522 (progn
|
|
523 (if (re-search-forward "^<>\n" nil 0)
|
|
524 (replace-match "" nil t))
|
|
525 (point))))
|
|
526
|
|
527 (goto-char (point-min))
|
|
528 (if (re-search-forward "^Subject: " border t)
|
|
529 (sera-to-fidel-region
|
|
530 (point)
|
|
531 (progn (end-of-line) (point))
|
|
532 'ascii-start)))
|
|
533
|
|
534 ;; interactive & no markers
|
|
535 (arg
|
|
536 (sera-to-fidel-region border (point-max))
|
|
537 (goto-char (point-min))
|
|
538 (if (re-search-forward "^Subject: " border t)
|
|
539 (sera-to-fidel-region
|
|
540 (point)
|
|
541 (progn (end-of-line) (point))))))
|
|
542
|
|
543 ;; adjust the rmail marker
|
|
544 (if (eq major-mode 'rmail-mode)
|
|
545 (set-marker
|
|
546 (aref rmail-message-vector (1+ rmail-current-message))
|
|
547 (point-max))))))
|
|
548
|
|
549 ;;;###autoload
|
|
550 (defun sera-to-fidel-marker nil
|
|
551 "If the buffer contains the markers \"<sera>\" and \"</sera>\",
|
|
552 converts the segment between the two markers from SERA to Fidel
|
|
553 in Ethio start mode. The markers will not be removed."
|
|
554
|
|
555 (interactive)
|
|
556 (if (and buffer-read-only
|
|
557 (not (y-or-n-p "Buffer is read-only. Force to convert? ")))
|
|
558 (error ""))
|
|
559 (save-excursion
|
|
560 (goto-char (point-min))
|
|
561 (while (re-search-forward "<sera>" nil t)
|
|
562 (sera-to-fidel-region
|
|
563 (point)
|
|
564 (if (re-search-forward "</sera>" nil t)
|
|
565 (match-beginning 0)
|
|
566 (point-max))
|
|
567 nil
|
|
568 'force))))
|
|
569
|
|
570 ;;
|
|
571 ;; FIDEL to SERA
|
|
572 ;;
|
|
573
|
|
574 (defconst fidel-to-sera-map
|
|
575 ["le" "lu" "li" "la" "lE" "l" "lo" "lWa"
|
|
576 "me" "mu" "mi" "ma" "mE" "m" "mo" "mWa"
|
|
577 "re" "ru" "ri" "ra" "rE" "r" "ro" "rWa"
|
|
578 "xe" "xu" "xi" "xa" "xE" "x" "xo" "xWa"
|
|
579 "be" "bu" "bi" "ba" "bE" "b" "bo" "bWa"
|
|
580 "ve" "vu" "vi" "va" "vE" "v" "vo" "vWa"
|
|
581 "te" "tu" "ti" "ta" "tE" "t" "to" "tWa"
|
|
582 "ce" "cu" "ci" "ca" "cE" "c" "co" "cWa"
|
|
583 "ne" "nu" "ni" "na" "nE" "n" "no" "nWa"
|
|
584 "Ne" "Nu" "Ni" "Na" "NE" "N" "No" "NWa"
|
|
585 "ze" "zu" "zi" "za" "zE" "z" "zo" "zWa"
|
|
586 "Ze" "Zu" "Zi" "Za" "ZE" "Z" "Zo" "ZWa"
|
|
587 "de" "du" "di" "da" "dE" "d" "do" "dWa"
|
|
588 "Te" "Tu" "Ti" "Ta" "TE" "T" "To" "TWa"
|
|
589 "Ce" "Cu" "Ci" "Ca" "CE" "C" "Co" "CWa"
|
|
590 "fe" "fu" "fi" "fa" "fE" "f" "fo" "fWa"
|
|
591 "se" "su" "si" "sa" "sE" "s" "so" "sWa"
|
|
592 "Se" "Su" "Si" "Sa" "SE" "S" "So" "SWa"
|
|
593 "a" "u" "i" "A" "E" "I" "o" "e3"
|
|
594 "he" "hu" "hi" "ha" "hE" "h" "ho" "hWe" "hWu" "hWi" "hWa" "hWE"
|
|
595 "ke" "ku" "ki" "ka" "kE" "k" "ko" "kWe" "kWu" "kWi" "kWa" "kWE"
|
|
596 "Ke" "Ku" "Ki" "Ka" "KE" "K" "Ko" "KWe" "KWu" "KWi" "KWa" "KWE"
|
|
597 "qe" "qu" "qi" "qa" "qE" "q" "qo" "qWe" "qWu" "qWi" "qWa" "qWE"
|
|
598 "Qe" "Qu" "Qi" "Qa" "QE" "Q" "Qo" "QWe" "QWu" "QWi" "QWa" "QWE"
|
|
599 "ge" "gu" "gi" "ga" "gE" "g" "go" "gWe" "gWu" "gWi" "gWa" "gWE"
|
|
600 "we" "wu" "wi" "wa" "wE" "w" "wo" "wWe" "wWu" "wWi" "wWa" "wWE"
|
|
601 "`se" "`su" "`si" "`sa" "`sE" "`s" "`so"
|
|
602 "`Se" "`Su" "`Si" "`Sa" "`SE" "`S" "`So"
|
|
603 "`e" "`u" "`i" "`a" "`E" "`I" "`o"
|
|
604 "`he" "`hu" "`hi" "`ha" "`hE" "`h" "`ho"
|
|
605 "`ke" "`ku" "`ki" "`ka" "`kE" "`k" "`ko"
|
|
606 "Xe" "Xu" "Xi" "Xa" "XE" "X" "Xo"
|
|
607 "He" "Hu" "Hi" "Ha" "HE" "H" "Ho"
|
|
608 "ye" "yu" "yi" "ya" "yE" "y" "yo"
|
|
609 "De" "Du" "Di" "Da" "DE" "D" "Do"
|
|
610 "je" "ju" "ji" "ja" "jE" "j" "jo"
|
|
611 "Ge" "Gu" "Gi" "Ga" "GE" "G" "Go"
|
|
612 "Pe" "Pu" "Pi" "Pa" "PE" "P" "Po"
|
|
613 "pe" "pu" "pi" "pa" "pE" "p" "po"
|
|
614 " " "\\_" "." "," ";" ":" "\\*" "\\<" "\\>"
|
|
615 "1" "2" "3" "4" "5" "6" "7" "8" "9"
|
|
616 "10" "20" "30" "40" "50" "60" "70" "80" "90"
|
|
617 "100" "10000"
|
|
618 "\\~e" "\\~E" "\\~a" "\\~A"])
|
|
619
|
|
620 (defvar ethio-use-tigrigna-style nil
|
|
621 "*If non-NIL, use \"e\" instead of \"a\" for the first lone vowel
|
|
622 translation in sera-to-fidel and fidel-to-sera conversions.")
|
|
623
|
|
624 (defvar ethio-quote-vowel-always nil
|
|
625 "*If non-NIL, lone vowels are always transcribed by \"an apostrophe
|
|
626 + the vowel\" except at word initial. Otherwise, they are quoted by
|
|
627 an apostrophe only if the preceding Ethiopic character is a lone
|
|
628 consonant.")
|
|
629
|
|
630 (defvar ethio-W-sixth-always nil
|
|
631 "*If non-NIL, the Wu-form of a 12-form consonant is transcribed by
|
|
632 \"W'\" instead of \"Wu\".")
|
|
633
|
|
634 (defvar ethio-numeric-reduction 0
|
|
635 "*Degree of reduction in transcribing Ethiopic digits by Arabic
|
|
636 digits. For example, $(2$`$_$i$g$](B ({10}{9}{100}{80}{7}) will be
|
|
637 transcribed by:
|
|
638 \10\9\100\80\7 if ETHIO-NUMERIC-REDUCTION is 0,
|
|
639 \109100807 is 1,
|
|
640 \10900807 is 2.")
|
|
641
|
|
642 ;;;###autoload
|
|
643 (defun fidel-to-sera-region (begin end &optional ascii-mode force)
|
|
644 "Replaces all the FIDEL characters in the region to sera format.
|
|
645
|
|
646 If the 1st optional parameter ASCII-MODE is non-NIL, converts the
|
|
647 region so that it begins in ASCII script.
|
|
648
|
|
649 If the 2nd optional parameter FORCE is non-NIL, converts even if the
|
|
650 buffer is read-only."
|
|
651
|
|
652 (interactive "r\nP")
|
|
653 (save-excursion
|
|
654 (save-restriction
|
|
655 (narrow-to-region begin end)
|
|
656 (fidel-to-sera-buffer ascii-mode force))))
|
|
657
|
|
658 ;;;###autoload
|
|
659 (defun fidel-to-sera-buffer (&optional ascii-mode force)
|
|
660 "Replace all the FIDEL characters in the current buffer to sera format.
|
|
661
|
|
662 If the 1st optional parameter ASCII-MODE is non-NIL,
|
|
663 convert the current buffer so that it begins in ASCII script.
|
|
664
|
|
665 If the 2nd optional parameter FORCE is non-NIL, converts even if the
|
|
666 buffer is read-only.
|
|
667
|
|
668 See also the description of the variables ethio-use-tigrigna-style,
|
|
669 ethio-quote-vowel-on-demand and ethio-numeric-reduction."
|
|
670
|
|
671 (interactive "P")
|
|
672 (if (and buffer-read-only
|
|
673 (not force)
|
|
674 (not (y-or-n-p "Buffer is read-only. Force to convert? ")))
|
|
675 (error ""))
|
|
676
|
|
677 ;; user's preference in transcription
|
|
678 (aset fidel-to-sera-map 144 (if ethio-use-tigrigna-style "e" "a"))
|
|
679 (let ((i 160)
|
|
680 (x (if ethio-W-sixth-always
|
|
681 '("hW'" "kW'" "KW'" "qW'" "QW'" "gW'" "wW'")
|
|
682 '("hWu" "kWu" "KWu" "qWu" "QWu" "gWu" "wWu"))))
|
|
683 (while x
|
|
684 (aset fidel-to-sera-map i (car x))
|
|
685 (setq i (+ i 12)
|
|
686 x (cdr x))))
|
|
687
|
|
688 ;; main conversion routine
|
|
689 (let ((lonec nil) ; if lonec = t, previous char was a lone consonant.
|
|
690 (fidel nil) ; if fidel = t, previous char was a fidel.
|
|
691 (digit nil) ; if digit = t, previous char was an Ethiopic digit.
|
|
692 (buffer-read-only nil)
|
|
693 ch)
|
|
694 (goto-char (point-min))
|
|
695 (while (not (eobp))
|
|
696 (setq ch (following-char))
|
|
697
|
|
698 ;; ethiopic charactes
|
|
699 (if (= (char-charset ch) 'ethiopic)
|
|
700 (progn
|
|
701 (setq ch (char-to-ethiocode ch))
|
|
702 (delete-char 1)
|
|
703
|
|
704 (cond
|
|
705
|
|
706 ;; fidels
|
|
707 ((<= ch 326)
|
|
708 (if ascii-mode
|
|
709 (insert "\\ "))
|
|
710 (if (and (memq ch '(144 145 146 147 148 150 151)) ; (auiAEoe3)
|
|
711 (or lonec
|
|
712 (and ethio-quote-vowel-always
|
|
713 fidel)))
|
|
714 (insert "'"))
|
|
715 (insert (aref fidel-to-sera-map ch))
|
|
716 (setq ascii-mode nil
|
|
717 lonec (ethio-lone-consonant-p ch)
|
|
718 fidel t
|
|
719 digit nil))
|
|
720
|
|
721 ;; punctuations and symbols
|
|
722 ((or (< ch 336) (> ch 355))
|
|
723 (if (and ascii-mode
|
|
724 (memq ch '(329 330 331 332))) ; (.,;:)
|
|
725 (insert "\\"))
|
|
726 (insert (aref fidel-to-sera-map ch))
|
|
727 (setq lonec nil
|
|
728 fidel nil
|
|
729 digit nil))
|
|
730
|
|
731 ;; now CH must be an ethiopic digit
|
|
732
|
|
733 ;; reduction = 0 or leading digit
|
|
734 ((or (= ethio-numeric-reduction 0)
|
|
735 (not digit))
|
|
736 (insert "\\" (aref fidel-to-sera-map ch))
|
|
737 (setq lonec nil
|
|
738 fidel nil
|
|
739 digit t))
|
|
740
|
|
741 ;; reduction = 2 and following 10s, 100s, 10000s
|
|
742 ((and (= ethio-numeric-reduction 2)
|
|
743 (memq ch '(345 354 355)))
|
|
744 (insert (substring (aref fidel-to-sera-map ch) 1))
|
|
745 (setq lonec nil
|
|
746 fidel nil
|
|
747 digit t))
|
|
748
|
|
749 ;; ordinary following digits
|
|
750 (t
|
|
751 (insert (aref fidel-to-sera-map ch))
|
|
752 (setq lonec nil
|
|
753 fidel nil
|
|
754 digit t))))
|
|
755
|
|
756 ;; non-ethiopic characters
|
|
757 (cond
|
|
758
|
|
759 ;; backslash is always quoted
|
|
760 ((= ch ?\\ )
|
|
761 (insert "\\"))
|
|
762
|
|
763 ;; nothing to do if in ascii-mode
|
|
764 (ascii-mode)
|
|
765
|
|
766 ;; ethio-mode -> ascii-mode
|
|
767 ((or (and (>= ch ?a) (<= ch ?z))
|
|
768 (and (>= ch ?A) (<= ch ?Z))
|
|
769 (memq ch '(?| ?' ?`)))
|
|
770 (insert "\\ ")
|
|
771 (setq ascii-mode t))
|
|
772
|
|
773 ;; ascii punctuations in ethio-mode
|
|
774 ((memq ch '(?. ?, ?\; ?:))
|
|
775 (insert "\\")))
|
|
776
|
|
777 (forward-char 1)
|
|
778 (setq lonec nil
|
|
779 fidel nil
|
|
780 digit nil)))
|
|
781
|
|
782 ;; a few modifications for readability
|
|
783 (goto-char (point-min))
|
|
784 (while (re-search-forward "\\([]!\"#$%&()*+/<=>?@[^_-]+\\)\\\\ " nil t)
|
|
785 (replace-match "\\\\ \\1"))
|
|
786
|
|
787 (goto-char (point-min))
|
|
788 (while (re-search-forward "\n\\([ \t]*\\)\\\\ " nil t)
|
|
789 (replace-match "\\\\\n\\1")))
|
|
790
|
|
791 (goto-char (point-min)))
|
|
792
|
|
793 (defun ethio-lone-consonant-p (code)
|
|
794 "If the ethiocode CODE is an Ethiopic lone consonant, return t."
|
|
795 (cond
|
|
796 ((< code 144)
|
|
797 (= (mod code 8) 5))
|
|
798 ((< code 153)
|
|
799 nil)
|
|
800 ((< code 236)
|
|
801 (= (mod code 12) 1))
|
|
802 ((< code 327)
|
|
803 (= (mod code 7) 3))))
|
|
804
|
|
805 ;;;###autoload
|
|
806 (defun fidel-to-sera-mail nil
|
|
807 "Does FIDEL to SERA conversion for reading/writing mail and news.
|
|
808
|
|
809 If the buffer contains at least one Ethiopic character,
|
|
810 1) inserts the string \"<sera>\" right after the header-body separator,
|
|
811 2) inserts \"</sera>\" at the end of the buffer,
|
|
812 3) converts the body into SERA in Ethiopic start mode, and
|
|
813 4) converts the subject field in ASCII start mode."
|
|
814
|
|
815 (interactive)
|
|
816 (save-excursion
|
|
817 (goto-char (point-min))
|
|
818 (if (re-search-forward "\\cE" nil t)
|
|
819 (let ((buffer-read-only nil) border)
|
|
820
|
|
821 (goto-char (point-min))
|
|
822 (setq border
|
|
823 (search-forward
|
|
824 (if (eq major-mode 'rmail-mode)
|
|
825 "\n\n"
|
|
826 (concat "\n" mail-header-separator "\n"))))
|
|
827 (insert "<sera>\n")
|
|
828
|
|
829 (fidel-to-sera-region (point) (point-max))
|
|
830
|
|
831 (goto-char (point-max))
|
|
832 (if (/= (preceding-char) ?\n)
|
|
833 (insert "\n"))
|
|
834 (insert "</sera>\n")
|
|
835
|
|
836 (goto-char (point-min))
|
|
837 (if (re-search-forward "^Subject: " border t)
|
|
838 (fidel-to-sera-region
|
|
839 (point)
|
|
840 (progn (end-of-line) (point))
|
|
841 'ascii-start))
|
|
842
|
|
843 ;; adjust the rmail marker
|
|
844 (if (eq major-mode 'rmail-mode)
|
|
845 (set-marker
|
|
846 (aref rmail-message-vector (1+ rmail-current-message))
|
|
847 (point-max))))
|
|
848
|
|
849 (message "No Ethiopic characters in this buffer."))))
|
|
850
|
|
851 ;;;###autoload
|
|
852 (defun fidel-to-sera-marker nil
|
|
853 "If the buffer contains the markers \"<sera>\" and \"</sera>\",
|
|
854 converts the segment between the two markers from Fidel to SERA
|
|
855 in Ethio start mode. The markers will not be removed."
|
|
856
|
|
857 (interactive)
|
|
858 (if (and buffer-read-only
|
|
859 (not (y-or-n-p "Buffer is read-only. Force to convert? ")))
|
|
860 (error ""))
|
|
861 (save-excursion
|
|
862 (goto-char (point-min))
|
|
863 (while (re-search-forward "^<sera>\n" nil t)
|
|
864 (fidel-to-sera-region
|
|
865 (point)
|
|
866 (if (re-search-forward "^</sera>\n" nil t)
|
|
867 (match-beginning 0)
|
|
868 (point-max))
|
|
869 nil
|
|
870 'force))))
|
|
871
|
|
872 ;;
|
|
873 ;; file I/O hooks
|
|
874 ;;
|
|
875
|
|
876 (if (not (assoc "\\.sera$" auto-mode-alist))
|
|
877 (setq auto-mode-alist
|
|
878 (cons '("\\.sera$" . sera-to-fidel-find-file) auto-mode-alist)))
|
|
879 (add-hook 'write-file-hooks 'fidel-to-sera-write-file)
|
|
880 (add-hook 'after-save-hook 'sera-to-fidel-after-save)
|
|
881
|
|
882 ;;;###autoload
|
|
883 (defun sera-to-fidel-find-file nil
|
|
884 "Intended to be called when a file whose name ends in \".sera\" is read in."
|
|
885 (sera-to-fidel-buffer nil 'force)
|
|
886 (set-buffer-modified-p nil)
|
|
887 nil)
|
|
888
|
|
889 ;;;###autoload
|
|
890 (defun fidel-to-sera-write-file nil
|
|
891 "Intended to be used as write-file-hooks for the files
|
|
892 whose name ends in \".sera\"."
|
|
893 (if (string-match "\\.sera$" (buffer-file-name))
|
|
894 (save-excursion
|
|
895 (fidel-to-sera-buffer nil 'force)
|
|
896 (set-buffer-modified-p nil)))
|
|
897 nil)
|
|
898
|
|
899 ;;;###autoload
|
|
900 (defun sera-to-fidel-after-save nil
|
|
901 "Intended to be used as after-save-hook for the files
|
|
902 whose name ends in \".sera\"."
|
|
903 (if (string-match "\\.sera$" (buffer-file-name))
|
|
904 (save-excursion
|
|
905 (sera-to-fidel-buffer nil 'force)
|
|
906 (set-buffer-modified-p nil)))
|
|
907 nil)
|
|
908
|
|
909 ;;
|
|
910 ;; vowel modification
|
|
911 ;;
|
|
912
|
|
913 ;;;###autoload
|
|
914 (defun ethio-modify-vowel nil
|
|
915 "Modify the vowel of the FIDEL that is under the cursor."
|
|
916 (interactive)
|
|
917 (let ((ch (following-char)) newch base vowel)
|
|
918 (if (= (char-charset ch) 'ethiopic)
|
|
919 (setq ch (char-to-ethiocode ch))
|
|
920 (error "Not a valid character."))
|
|
921 (if (or (and (>= ch 144) (<= ch 151)) ; lone vowels
|
|
922 (and (>= ch 250) (<= ch 256)) ; secondary lone vowels
|
|
923 (>= ch 327)) ; not FIDEL
|
|
924 (error "Not a valid character."))
|
|
925 (message "Modify vowel to: ")
|
|
926 (if (null (setq vowel (memq (read-char) '(?e ?u ?i ?a ?E ?' ?o))))
|
|
927 (error "Not a valid vowel.")
|
|
928 ;; ?e -> 0, ?u -> 1, ?i -> 2, ?a -> 3, ?E -> 4, ?' -> 5, ?o -> 6
|
|
929 (setq vowel (- 7 (length vowel))))
|
|
930
|
|
931 (cond
|
|
932
|
|
933 ;; 8-form consonant
|
|
934 ((<= ch 143)
|
|
935 (setq base (* (/ ch 8) 8))
|
|
936 (cond
|
|
937 ((< (mod ch 8) 7) ; e-form <= ch <= o-form
|
|
938 (setq newch (+ base vowel)))
|
|
939 ((= vowel 3) ; 3 = a
|
|
940 (setq newch (+ base 7))) ; (+ base 7) = Wa-form
|
|
941 ((= vowel 5) ; 5 = '
|
|
942 (setq newch
|
|
943 (cons (+ base 5) ; (+ base 5) = lone consonant
|
|
944 232))) ; 232 = Wu
|
|
945 (t
|
|
946 (setq newch
|
|
947 (cons (+ base 5) ; (+ base 5) = lone consonant
|
|
948 (+ 231 vowel)))))) ; 231 = We
|
|
949
|
|
950 ;; 12-form consonant
|
|
951 ((<= ch 235)
|
|
952 (setq ch (- ch 152) ; 152 = 12-form consonant offset
|
|
953 base (* (/ ch 12) 12))
|
|
954 (cond
|
|
955 ((< (mod ch 12) 7) ; e-form <= ch <= o-form
|
|
956 (setq newch (+ base vowel 152)))
|
|
957 ((< vowel 5) ; We-form <= ch <= WE-form
|
|
958 (setq newch (+ base vowel 159))) ; 159 = 152 (offset) + 7 (We-form)
|
|
959 ((= vowel 5) ; 5 = ' (= u in this case)
|
|
960 (setq newch (+ base 160))) ; 160 = 152 (offset) + 8 (Wu-form)
|
|
961 (t
|
|
962 (error "Not a valid vowel."))))
|
|
963
|
|
964 ;; 7-form consonant
|
|
965 (t ; 236 = 7-form consonant offset
|
|
966 (setq newch (+ (* (/ (- ch 236) 7) 7) vowel 236))))
|
|
967
|
|
968 (delete-char 1)
|
|
969
|
|
970 (cond
|
|
971 ((consp newch)
|
|
972 (insert (ethiocode-to-char (car newch))
|
|
973 (ethiocode-to-char (cdr newch)))
|
|
974 (backward-char 2))
|
|
975 (t
|
|
976 (insert (ethiocode-to-char newch))
|
|
977 (backward-char 1)))))
|
|
978
|
|
979 (defun ethiocode-to-char (code)
|
|
980 (make-char 'ethiopic (+ (/ code 94) 33) (+ (mod code 94) 33)))
|
|
981
|
|
982 (defun char-to-ethiocode (ch)
|
|
983 (and (eq (char-charset ch) 'ethiopic)
|
|
984 (+ (* (- (char-octet ch 0) 33) 94)
|
|
985 (- (char-octet ch 1) 33))))
|
|
986
|
|
987 ;;
|
|
988 ;; space replacement
|
|
989 ;;
|
|
990
|
|
991 ;;;###autoload
|
|
992 (defun ethio-replace-space (ch begin end)
|
|
993 "In the specified region, replace spaces between two Ethiopic characters."
|
|
994 (interactive "*cReplace spaces to: 1 (sg col), 2 (dbl col), 3 (Ethiopic)\nr")
|
|
995 (if (not (memq ch '(?1 ?2 ?3)))
|
|
996 (error ""))
|
|
997 (save-excursion
|
|
998 (save-restriction
|
|
999 (narrow-to-region begin end)
|
|
1000 (goto-char (point-min))
|
|
1001
|
|
1002 (cond
|
|
1003
|
|
1004 ((= ch ?1)
|
|
1005
|
|
1006 ;; A double column space or an Ethiopic word separator is always
|
|
1007 ;; converted to an ASCII space.
|
|
1008 (while (re-search-forward "[$(2$N$O(B]" nil t)
|
|
1009 (replace-match " " nil nil)))
|
|
1010
|
|
1011 ((= ch ?2)
|
|
1012
|
|
1013 ;; An Ethiopic word separator is always converted to
|
|
1014 ;; a double column space.
|
|
1015 (while (search-forward "$(2$O(B" nil t)
|
|
1016 (replace-match "$(2$N(B"))
|
|
1017
|
|
1018 (goto-char (point-min))
|
|
1019
|
|
1020 ;; ASCII spaces are converted only if they are placed
|
|
1021 ;; between two Ethiopic characters.
|
|
1022 (while (re-search-forward "\\(\\cE\\)\\( \\)\\( *\\cE\\)" nil t)
|
|
1023
|
|
1024 ;; Converting the first ASCII space
|
|
1025 (replace-match "\\1$(2$N(B\\3")
|
|
1026
|
|
1027 ;; A double column space is \cE, so going back to the just
|
|
1028 ;; converted double column space makes it possible to find
|
|
1029 ;; the following ASCII spaces.
|
|
1030 (goto-char (match-beginning 2))))
|
|
1031
|
|
1032 ((= ch ?3)
|
|
1033
|
|
1034 ;; If more than one consecutive space (either ASCII or double
|
|
1035 ;; width) is found between two Ethiopic characters, the first
|
|
1036 ;; space will be converted to an Ethiopic word separator.
|
|
1037 (let (pred succ)
|
|
1038 (while (re-search-forward "[ $(2$N(B]\\([ $(2$N(B]*\\)" nil t)
|
|
1039 (and (setq pred (char-before (match-beginning 0)))
|
|
1040 (= (char-charset pred) 'ethiopic)
|
|
1041 (setq succ (char-after (match-end 0)))
|
|
1042 (= (char-charset succ) 'ethiopic)
|
|
1043 (replace-match "$(2$O(B\\1" nil nil)))))))))
|
|
1044
|
|
1045 ;;
|
|
1046 ;; special characters
|
|
1047 ;;
|
|
1048
|
|
1049 ;;;###autoload
|
|
1050 (defun ethio-input-special-character (arg)
|
|
1051 "Allow the user to input special characters."
|
|
1052 (interactive "*cInput number: 1.$(2$k(B 2.$(2$l(B 3.$(2$m(B 4.$(2$n(B")
|
|
1053 (cond
|
|
1054 ((= arg ?1)
|
|
1055 (insert ?$(2$k(B))
|
|
1056 ((= arg ?2)
|
|
1057 (insert ?$(2$l(B))
|
|
1058 ((= arg ?3)
|
|
1059 (insert ?$(2$m(B))
|
|
1060 ((= arg ?4)
|
|
1061 (insert ?$(2$n(B))
|
|
1062 (t
|
|
1063 (error ""))))
|
|
1064
|
|
1065 ;;
|
|
1066 ;; key bindings
|
|
1067 ;;
|
|
1068
|
|
1069 (define-key global-map [f4] 'sera-to-fidel-buffer)
|
|
1070 (define-key global-map [(shift f4)] 'sera-to-fidel-region)
|
|
1071 (define-key global-map [(control f4)] 'sera-to-fidel-marker)
|
|
1072 (define-key global-map [f5] 'fidel-to-sera-buffer)
|
|
1073 (define-key global-map [(shift f5)] 'fidel-to-sera-region)
|
|
1074 (define-key global-map [(control f5)] 'fidel-to-sera-marker)
|
|
1075 (define-key global-map [f6] 'ethio-modify-vowel)
|
|
1076 (define-key global-map [f7] 'ethio-replace-space)
|
|
1077 (define-key global-map [(shift f2)] 'ethio-replace-space) ; as requested
|
|
1078 (define-key global-map [f8] 'ethio-input-special-character)
|
|
1079
|
|
1080 (add-hook
|
|
1081 'rmail-mode-hook
|
|
1082 '(lambda nil
|
|
1083 (define-key rmail-mode-map [(control f4)] 'sera-to-fidel-mail)
|
|
1084 (define-key rmail-mode-map [(control f5)] 'fidel-to-sera-mail)))
|
|
1085
|
|
1086 (add-hook
|
|
1087 'mail-mode-hook
|
|
1088 '(lambda nil
|
|
1089 (define-key mail-mode-map [(control f4)] 'sera-to-fidel-mail)
|
|
1090 (define-key mail-mode-map [(control f5)] 'fidel-to-sera-mail)))
|
|
1091
|
|
1092 ;;
|
|
1093 (provide 'ethio)
|