]> code.delx.au - gnu-emacs/blob - lisp/language/european.el
2004-05-13 Marcelo Toledo <marcelo@marcelotoledo.org>
[gnu-emacs] / lisp / language / european.el
1 ;;; european.el --- support for European languages -*- coding: iso-2022-7bit; -*-
2
3 ;; Copyright (C) 1995, 1997, 2001 Electrotechnical Laboratory, JAPAN.
4 ;; Licensed to the Free Software Foundation.
5 ;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
6
7 ;; Keywords: multilingual, European
8
9 ;; This file is part of GNU Emacs.
10
11 ;; 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
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;; For European scripts, all the ISO Latin character sets are
29 ;; supported, along with various others.
30
31 ;;; Code:
32
33 ;; Latin-1 (ISO-8859-1)
34
35 (set-language-info-alist
36 "Latin-1" '((charset ascii latin-iso8859-1)
37 (coding-system iso-latin-1)
38 (coding-priority iso-latin-1)
39 (nonascii-translation . latin-iso8859-1)
40 (unibyte-syntax . "latin-1")
41 (unibyte-display . iso-latin-1)
42 (input-method . "latin-1-prefix")
43 (sample-text
44 . "Hello, Hej, Tere, Hei, Bonjour, Gr\e,A|_\e(B Gott, Ciao, \e,A!\e(BHola!")
45 (documentation . "\
46 This language environment is a generic one for the Latin-1 (ISO-8859-1)
47 character set which supports the following European languages:
48 Albanian, Basque, Breton, Catalan, Danish, Dutch, English, Faeroese,
49 Finnish, French (with restrictions -- see Latin-9), Frisian, Galician,
50 German, Greenlandic, Icelandic, Irish Gaelic (new orthography),
51 Italian, Latin, Luxemburgish, Norwegian, Portuguese, Rhaeto-Romanic,
52 Scottish Gaelic, Spanish, and Swedish.
53 We also have specific language environments for the following languages:
54 For Dutch, \"Dutch\".
55 For German, \"German\".
56 For French, \"French\".
57 For Italian, \"Italian\".
58 For Slovenian, \"Slovenian\".
59 For Spanish, \"Spanish\".
60
61 Latin-1 also covers several written languages outside Europe, including
62 Indonesian/Malay, Tagalog (Philippines), Swahili and Afrikaans."))
63 '("European"))
64
65 (eval-and-compile
66 (setq
67 non-iso-charset-alist
68 (cp-make-coding-system
69 windows-1252
70 [?\\e$,1tL\e(B nil ?\\e$,1rz\e(B ?\\e$,1!R\e(B ?\\e$,1r~\e(B ?\\e$,1s&\e(B ?\\e$,1s \e(B ?\\e$,1s!\e(B ?\\e$,1$f\e(B ?\\e$,1s0\e(B ?\\e$,1! \e(B ?\\e$,1s9\e(B ?\\e$,1 r\e(B nil ?\\e$,1!=\e(B nil nil
71 ?\\e$,1rx\e(B ?\\e$,1ry\e(B ?\\e$,1r|\e(B ?\\e$,1r}\e(B ?\\e$,1s"\e(B ?\\e$,1rs\e(B ?\\e$,1rt\e(B ?\\e$,1$|\e(B ?\\e$,1ub\e(B ?\\e$,1!!\e(B ?\\e$,1s:\e(B ?\\e$,1 s\e(B nil ?\\e$,1!>\e(B ?\\e$,1!8\e(B ?\\e,A \e(B ?\\e,A!\e(B
72 ?\\e,A"\e(B ?\\e,A#\e(B ?\\e,A$\e(B ?\\e,A%\e(B ?\\e,A&\e(B ?\\e,A'\e(B ?\\e,A(\e(B ?\\e,A)\e(B ?\\e,A*\e(B ?\\e,A+\e(B ?\\e,A,\e(B ?\\e,A-\e(B ?\\e,A.\e(B ?\\e,A/\e(B ?\\e,A0\e(B ?\\e,A1\e(B ?\\e,A2\e(B
73 ?\\e,A3\e(B ?\\e,A4\e(B ?\\e,A5\e(B ?\\e,A6\e(B ?\\e,A7\e(B ?\\e,A8\e(B ?\\e,A9\e(B ?\\e,A:\e(B ?\\e,A;\e(B ?\\e,A<\e(B ?\\e,A=\e(B ?\\e,A>\e(B ?\\e,A?\e(B ?\\e,A@\e(B ?\\e,AA\e(B ?\\e,AB\e(B ?\\e,AC\e(B
74 ?\\e,AD\e(B ?\\e,AE\e(B ?\\e,AF\e(B ?\\e,AG\e(B ?\\e,AH\e(B ?\\e,AI\e(B ?\\e,AJ\e(B ?\\e,AK\e(B ?\\e,AL\e(B ?\\e,AM\e(B ?\\e,AN\e(B ?\\e,AO\e(B ?\\e,AP\e(B ?\\e,AQ\e(B ?\\e,AR\e(B ?\\e,AS\e(B ?\\e,AT\e(B
75 ?\\e,AU\e(B ?\\e,AV\e(B ?\\e,AW\e(B ?\\e,AX\e(B ?\\e,AY\e(B ?\\e,AZ\e(B ?\\e,A[\e(B ?\\e,A\\e(B ?\\e,A]\e(B ?\\e,A^\e(B ?\\e,A_\e(B ?\\e,A`\e(B ?\\e,Aa\e(B ?\\e,Ab\e(B ?\\e,Ac\e(B ?\\e,Ad\e(B ?\\e,Ae\e(B
76 ?\\e,Af\e(B ?\\e,Ag\e(B ?\\e,Ah\e(B ?\\e,Ai\e(B ?\\e,Aj\e(B ?\\e,Ak\e(B ?\\e,Al\e(B ?\\e,Am\e(B ?\\e,An\e(B ?\\e,Ao\e(B ?\\e,Ap\e(B ?\\e,Aq\e(B ?\\e,Ar\e(B ?\\e,As\e(B ?\\e,At\e(B ?\\e,Au\e(B ?\\e,Av\e(B
77 ?\\e,Aw\e(B ?\\e,Ax\e(B ?\\e,Ay\e(B ?\\e,Az\e(B ?\\e,A{\e(B ?\\e,A|\e(B ?\\e,A}\e(B ?\\e,A~\e(B ?\\e,A\7f\e(B])))
78 \f
79 ;; Latin-2 (ISO-8859-2)
80
81 (make-coding-system
82 'iso-latin-2 2 ?2
83 "ISO 2022 based 8-bit encoding for Latin-2 (MIME:ISO-8859-2)."
84 '(ascii latin-iso8859-2 nil nil
85 nil nil nil nil nil nil nil nil nil nil nil t)
86 '((safe-charsets ascii latin-iso8859-2)
87 (mime-charset . iso-8859-2)))
88
89 (define-coding-system-alias 'iso-8859-2 'iso-latin-2)
90 (define-coding-system-alias 'latin-2 'iso-latin-2)
91
92 (set-language-info-alist
93 "Latin-2" '((charset ascii latin-iso8859-2)
94 (coding-system iso-latin-2)
95 (coding-priority iso-latin-2)
96 (nonascii-translation . latin-iso8859-2)
97 (unibyte-syntax . "latin-2")
98 (unibyte-display . iso-latin-2)
99 (input-method . "latin-2-prefix")
100 (documentation . "\
101 This language environment is a generic one for the Latin-2 (ISO-8859-2)
102 character set which supports the following languages:
103 Albanian, Czech, English, German, Hungarian, Polish, Romanian,
104 Serbo-Croatian or Croatian, Slovak, Slovene, Sorbian (upper and lower),
105 and Swedish.
106 We also have specific language environments for the following languages:
107 For Czech, \"Czech\".
108 For Croatian, \"Croatian\".
109 For Romanian, \"Romanian\".
110 For Slovak, \"Slovak\"."))
111 '("European"))
112
113 \f
114 ;; Latin-3 (ISO-8859-3)
115
116 (make-coding-system
117 'iso-latin-3 2 ?3
118 "ISO 2022 based 8-bit encoding for Latin-3 (MIME:ISO-8859-3)."
119 '(ascii latin-iso8859-3 nil nil
120 nil nil nil nil nil nil nil nil nil nil nil t)
121 '((safe-charsets ascii latin-iso8859-3)
122 (mime-charset . iso-8859-3)))
123
124 (define-coding-system-alias 'iso-8859-3 'iso-latin-3)
125 (define-coding-system-alias 'latin-3 'iso-latin-3)
126
127 (set-language-info-alist
128 "Latin-3" '((charset ascii latin-iso8859-3)
129 (coding-system iso-latin-3)
130 (coding-priority iso-latin-3)
131 (nonascii-translation . latin-iso8859-3)
132 (unibyte-syntax . "latin-3")
133 (unibyte-display . iso-latin-3)
134 (input-method . "latin-3-prefix")
135 (documentation . "\
136 These languages are supported with the Latin-3 (ISO-8859-3) character set:
137 Afrikaans, Catalan, Dutch, English, Esperanto, French, Galician,
138 German, Italian, Maltese, Spanish, and Turkish."))
139 '("European"))
140
141 \f
142 ;; Latin-4 (ISO-8859-4)
143
144 (make-coding-system
145 'iso-latin-4 2 ?4
146 "ISO 2022 based 8-bit encoding for Latin-4 (MIME:ISO-8859-4)."
147 '(ascii latin-iso8859-4 nil nil
148 nil nil nil nil nil nil nil nil nil nil nil t)
149 '((safe-charsets ascii latin-iso8859-4)
150 (mime-charset . iso-8859-4)))
151
152 (define-coding-system-alias 'iso-8859-4 'iso-latin-4)
153 (define-coding-system-alias 'latin-4 'iso-latin-4)
154
155 (set-language-info-alist
156 "Latin-4" '((charset ascii latin-iso8859-4)
157 (coding-system iso-8859-4)
158 (coding-priority iso-8859-4)
159 (nonascii-translation . latin-iso8859-4)
160 (unibyte-syntax . "latin-4")
161 (unibyte-display . iso-8859-4)
162 (input-method . "latin-4-postfix")
163 (documentation . "\
164 These languages are supported with the Latin-4 (ISO-8859-4) character set:
165 Danish, English, Estonian, Finnish, German, Greenlandic, Lappish,
166 Latvian, Lithuanian, and Norwegian."))
167 '("European"))
168
169 \f
170 ;; Latin-5 (ISO-8859-9)
171
172 (make-coding-system
173 'iso-latin-5 2 ?9
174 "ISO 2022 based 8-bit encoding for Latin-5 (MIME:ISO-8859-9)."
175 '(ascii latin-iso8859-9 nil nil
176 nil nil nil nil nil nil nil nil nil nil nil t)
177 '((safe-charsets ascii latin-iso8859-9)
178 (mime-charset . iso-8859-9)))
179
180 (define-coding-system-alias 'iso-8859-9 'iso-latin-5)
181 (define-coding-system-alias 'latin-5 'iso-latin-5)
182
183 (set-language-info-alist
184 "Latin-5" '((charset ascii latin-iso8859-9)
185 (coding-system iso-latin-5)
186 (coding-priority iso-latin-5)
187 (nonascii-translation . latin-iso8859-9)
188 (unibyte-syntax . "latin-5")
189 (unibyte-display . iso-latin-5)
190 (input-method . "latin-5-postfix")
191 (documentation . "Support for Turkish language."))
192 '("European"))
193
194 \f
195 ;; Latin-8 (ISO-8859-14)
196
197 (make-coding-system
198 'iso-latin-8 2 ?W ; `W' for `Welsh', since `C'
199 ; for `Celtic' is taken.
200 "ISO 2022 based 8-bit encoding for Latin-8 (MIME:ISO-8859-14)."
201 '(ascii latin-iso8859-14 nil nil
202 nil nil nil nil nil nil nil nil nil nil nil t t)
203 '((safe-charsets ascii latin-iso8859-14)
204 (mime-charset . iso-8859-14)))
205
206 (define-coding-system-alias 'iso-8859-14 'iso-latin-8)
207 (define-coding-system-alias 'latin-8 'iso-latin-8)
208
209 (set-language-info-alist
210 "Latin-8" '((charset ascii latin-iso8859-14)
211 (coding-system iso-latin-8)
212 (coding-priority iso-latin-8)
213 (nonascii-translation . latin-iso8859-14)
214 (unibyte-syntax . "latin-8")
215 (unibyte-display . iso-latin-8)
216 (input-method . "latin-8-prefix")
217 ;; Fixme: Welsh/Ga{e}lic greetings
218 (sample-text . "\e,_"\e(B \e,_p\e(B \e,_^\e(B")
219 (documentation . "\
220 This language environment is a generic one for the Latin-8 (ISO-8859-14)
221 character set which supports the Celtic languages, including those not
222 covered by other ISO-8859 character sets:
223 Welsh, Manx Gaelic and Irish Gaelic (old orthography)."))
224 '("European"))
225 \f
226 ;; Latin-9 (ISO-8859-15)
227
228 (make-coding-system
229 'iso-latin-9 2 ?0 ; `0' for `Latin-0'
230 "ISO 2022 based 8-bit encoding for Latin-9 (MIME:ISO-8859-15)."
231 '(ascii latin-iso8859-15 nil nil
232 nil nil nil nil nil nil nil nil nil nil nil t t)
233 '((safe-charsets ascii latin-iso8859-15)
234 (mime-charset . iso-8859-15)))
235
236 (define-coding-system-alias 'iso-8859-15 'iso-latin-9)
237 (define-coding-system-alias 'latin-9 'iso-latin-9)
238 (define-coding-system-alias 'latin-0 'iso-latin-9)
239
240 (set-language-info-alist
241 "Latin-9" '((charset ascii latin-iso8859-15)
242 (coding-system iso-latin-9)
243 (coding-priority iso-latin-9)
244 (nonascii-translation . latin-iso8859-15)
245 (unibyte-syntax . "latin-9")
246 (unibyte-display . iso-latin-9)
247 (input-method . "latin-9-prefix")
248 (sample-text
249 . "AVE. \e,b&(48<=>\e(B \e,b$\e(B")
250 (documentation . "\
251 This language environment is a generic one for the Latin-9 (ISO-8859-15)
252 character set which supports the same languages as Latin-1 with the
253 addition of the Euro sign and some additional French and Finnish letters.
254 Latin-9 is sometimes nicknamed `Latin-0'."))
255 '("European"))
256 \f
257 (set-language-info-alist
258 "Dutch" '((tutorial . "TUTORIAL.nl")
259 (charset ascii latin-iso8859-1)
260 (coding-system iso-latin-1 iso-latin-9)
261 (coding-priority iso-latin-1)
262 (nonascii-translation . latin-iso8859-1)
263 (unibyte-syntax . "latin-1")
264 (unibyte-display . iso-latin-1)
265 (input-method . "dutch")
266 (sample-text . "Er is een aantal manieren waarop je dit kan doen")
267 (documentation . "\
268 This language environment is almost the same as Latin-1,
269 but it selects the Dutch tutorial and input method."))
270 '("European"))
271
272 (set-language-info-alist
273 "German" '((tutorial . "TUTORIAL.de")
274 (charset ascii latin-iso8859-1)
275 (coding-system iso-latin-1 iso-latin-9)
276 (coding-priority iso-latin-1)
277 (input-method . "german-postfix")
278 (nonascii-translation . latin-iso8859-1)
279 (unibyte-syntax . "latin-1")
280 (unibyte-display . iso-latin-1)
281 (sample-text . "\
282 German (Deutsch Nord) Guten Tag
283 German (Deutsch S\e,A|\e(Bd) Gr\e,A|_\e(B Gott")
284 (documentation . "\
285 This language environment is almost the same as Latin-1,
286 but sets the default input method to \"german-postfix\".
287 Additionally, it selects the German tutorial."))
288 '("European"))
289
290 (set-language-info-alist
291 "French" '((tutorial . "TUTORIAL.fr")
292 (charset ascii latin-iso8859-1)
293 (coding-system iso-latin-1 iso-latin-9)
294 (coding-priority iso-latin-1)
295 (nonascii-translation . latin-iso8859-1)
296 (unibyte-syntax . "latin-1")
297 (unibyte-display . iso-latin-1)
298 (input-method . "latin-1-prefix")
299 (sample-text . "French (Fran\e,Ag\e(Bais) Bonjour, Salut")
300 (documentation . "\
301 This language environment is almost the same as Latin-1,
302 but it selects the French tutorial and input method."))
303 '("European"))
304
305 (set-language-info-alist
306 "Italian" '((tutorial . "TUTORIAL.it")
307 (charset ascii latin-iso8859-1)
308 (coding-system iso-latin-1 iso-latin-9)
309 (coding-priority iso-latin-1)
310 (nonascii-translation . latin-iso8859-1)
311 (unibyte-syntax . "latin-1")
312 (unibyte-display . iso-latin-1)
313 (input-method . "italian-postfix")
314 (sample-text . "Salve, ciao!")
315 (documentation . "\
316 This language environment is almost the same as Latin-1,
317 but sets the default input method to \"italian-postfix\".
318 Additionally, it selects the Italian tutorial."))
319 '("European"))
320
321 (set-language-info-alist
322 "Slovenian" '((charset . (ascii latin-iso8859-2))
323 (coding-system . (iso-8859-2))
324 (coding-priority . (iso-8859-2))
325 (nonascii-translation . latin-iso8859-2)
326 (input-method . "slovenian")
327 (unibyte-syntax . "latin-2")
328 (unibyte-display . iso-8859-2)
329 (tutorial . "TUTORIAL.sl")
330 (sample-text . "\e,B.\e(Belimo vam uspe\e,B9\e(Ben dan!")
331 (documentation . "\
332 This language environment is almost the same as Latin-2,
333 but it selects the Slovenian tutorial and input method."))
334 '("European"))
335
336 (set-language-info-alist
337 "Spanish" '((tutorial . "TUTORIAL.es")
338 (charset ascii latin-iso8859-1)
339 (coding-system iso-latin-1 iso-latin-9)
340 (coding-priority iso-latin-1)
341 (input-method . "spanish-postfix")
342 (nonascii-translation . latin-iso8859-1)
343 (unibyte-syntax . "latin-1")
344 (unibyte-display . iso-latin-1)
345 (sample-text . "Spanish (Espa\e,Aq\e(Bol) \e,A!\e(BHola!")
346 (documentation . "\
347 This language environment is almost the same as Latin-1,
348 but it sets the default input method to \"spanish-postfix\",
349 and it selects the Spanish tutorial."))
350 '("European"))
351
352 ;; For Turkish, the character set ISO-8859-9 (Latin-5) is used. But,
353 ;; before the introduction of ISO-8859-9 in 1988, ISO-8859-3 (Latin-3)
354 ;; was used for Turkish. Those who use Latin-3 for Turkish should use
355 ;; "Latin-3" language environment.
356
357 (set-language-info-alist
358 "Turkish" '((charset ascii latin-iso8859-9)
359 (coding-system iso-latin-5 iso-latin-3)
360 (coding-priority iso-latin-5)
361 (nonascii-translation . latin-iso8859-9)
362 (unibyte-syntax . "latin-5")
363 (unibyte-display . iso-latin-5)
364 (input-method . "turkish-postfix")
365 (sample-text . "Turkish (T\e,M|\e(Brk\e,Mg\e(Be) Merhaba")
366 (documentation . t)))
367
368 ;; Polish ISO 8859-2 environment.
369 ;; Maintainer: Wlodek Bzyl <matwb@univ.gda.pl>
370 ;; Keywords: multilingual, Polish
371
372 (set-language-info-alist
373 "Polish" '((charset . (ascii latin-iso8859-2))
374 (coding-system . (iso-8859-2))
375 (coding-priority . (iso-8859-2))
376 (input-method . "polish-slash")
377 (nonascii-translation . latin-iso8859-2)
378 (unibyte-syntax . "latin-2")
379 (unibyte-display . iso-8859-2)
380 (tutorial . "TUTORIAL.pl")
381 (sample-text . "P\e,Bs\e(Bjd\e,B<\e(B, ki\e,Bq\e(B-\e,B?\e(Be t\e,Bj\e(B chmurno\e,B6f\e(B w g\e,B31\e(Bb flaszy")
382 (documentation . t))
383 '("European"))
384
385 (set-language-info-alist
386 "Welsh" `((coding-system utf-8 latin-8) ; the input method is Unicode-based
387 (coding-priority utf-8 latin-8)
388 (nonascii-translation . latin-iso8859-14)
389 (input-method . "welsh")
390 (documentation . "Support for Welsh, using Unicode."))
391 '("European"))
392
393 (set-language-info-alist
394 "Latin-6" `((coding-system latin-6)
395 (coding-priority latin-6)
396 (nonascii-translation . ,(get 'decode-iso-latin-6 'translation-table))
397 (input-method . "latin-prefix")
398 (features code-pages)
399 (documentation . "Support for Latin-6."))
400 '("European"))
401
402 (set-language-info-alist
403 "Latin-7" `((coding-system latin-7)
404 (coding-priority latin-7)
405 (nonascii-translation . ,(get 'decode-iso-latin-7
406 'translation-table))
407 (input-method . "latin-prefix")
408 (features code-pages)
409 (documentation . "Support for Latin-7, e.g. Latvian, Lithuanian."))
410 '("European"))
411
412 (set-language-info-alist
413 "Lithuanian" `((coding-system latin-7)
414 (coding-priority latin-7)
415 (input-method . "lithuanian-keyboard")
416 (nonascii-translation . ,(get 'decode-iso-latin-7
417 'translation-table))
418 (features code-pages)
419 (documentation . "Support for Lithuanian."))
420 '("European"))
421
422 (set-language-info-alist
423 "Latvian" `((coding-system latin-7)
424 (coding-priority latin-7)
425 (input-method . "latvian-keyboard")
426 (nonascii-translation . ,(get 'decode-iso-latin-7
427 'translation-table))
428 (features code-pages)
429 (documentation . "Support for Latvian."))
430 '("European"))
431
432 (set-language-info-alist
433 "Swedish" '((tutorial . "TUTORIAL.sv")
434 (charset ascii latin-iso8859-1)
435 (coding-system iso-latin-1)
436 (coding-priority iso-latin-1)
437 (nonascii-translation . latin-iso8859-1)
438 (unibyte-syntax . "latin-1")
439 (unibyte-display . iso-latin-1)
440 (sample-text . "Goddag Hej")
441 (documentation . "Support for Swedish"))
442 '("European"))
443
444 (set-language-info-alist
445 "Croatian" '((charset . (ascii latin-iso8859-2))
446 (coding-system . (iso-8859-2))
447 (coding-priority . (iso-8859-2))
448 (input-method . "croatian")
449 (nonascii-translation . latin-iso8859-2)
450 (unibyte-syntax . "latin-2")
451 (unibyte-display . iso-8859-2)
452 (documentation . "Support for Croatian with Latin-2 encoding."))
453 '("European"))
454
455 (set-language-info-alist
456 "Brazilian Portuguese" '((tutorial . "TUTORIAL.pt_BR")
457 (charset ascii latin-iso8859-1)
458 (coding-system iso-latin-1 iso-latin-9)
459 (coding-priority iso-latin-1)
460 (nonascii-translation . latin-iso8859-1)
461 (unibyte-syntax . "latin-1")
462 (unibyte-display . iso-latin-1)
463 (input-method . "latin-1-prefix")
464 (sample-text . "Oi")
465 (documentation . "Support for Brazilian Portuguese."))
466 '("European"))
467 \f
468 ;; Definitions for the Mac Roman character sets and coding system.
469 ;; The Mac Roman encoding uses all 128 code points in the range 128 to
470 ;; 255 for actual characters. Emacs decodes them to one of the
471 ;; following character sets.
472 ;; ascii, latin-iso8859-1, mule-unicode-0100-24ff,
473 ;; mule-unicode-2500-33ff, mule-unicode-e000-ffff
474
475 (let
476 ((encoding-vector (make-vector 256 nil))
477 (i 0)
478 (vec ;; mac-roman (128..255) -> UCS mapping
479 [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS
480 #x00C5 ;; 129:LATIN CAPITAL LETTER A WITH RING ABOVE
481 #x00C7 ;; 130:LATIN CAPITAL LETTER C WITH CEDILLA
482 #x00C9 ;; 131:LATIN CAPITAL LETTER E WITH ACUTE
483 #x00D1 ;; 132:LATIN CAPITAL LETTER N WITH TILDE
484 #x00D6 ;; 133:LATIN CAPITAL LETTER O WITH DIAERESIS
485 #x00DC ;; 134:LATIN CAPITAL LETTER U WITH DIAERESIS
486 #x00E1 ;; 135:LATIN SMALL LETTER A WITH ACUTE
487 #x00E0 ;; 136:LATIN SMALL LETTER A WITH GRAVE
488 #x00E2 ;; 137:LATIN SMALL LETTER A WITH CIRCUMFLEX
489 #x00E4 ;; 138:LATIN SMALL LETTER A WITH DIAERESIS
490 #x00E3 ;; 139:LATIN SMALL LETTER A WITH TILDE
491 #x00E5 ;; 140:LATIN SMALL LETTER A WITH RING ABOVE
492 #x00E7 ;; 141:LATIN SMALL LETTER C WITH CEDILLA
493 #x00E9 ;; 142:LATIN SMALL LETTER E WITH ACUTE
494 #x00E8 ;; 143:LATIN SMALL LETTER E WITH GRAVE
495 #x00EA ;; 144:LATIN SMALL LETTER E WITH CIRCUMFLEX
496 #x00EB ;; 145:LATIN SMALL LETTER E WITH DIAERESIS
497 #x00ED ;; 146:LATIN SMALL LETTER I WITH ACUTE
498 #x00EC ;; 147:LATIN SMALL LETTER I WITH GRAVE
499 #x00EE ;; 148:LATIN SMALL LETTER I WITH CIRCUMFLEX
500 #x00EF ;; 149:LATIN SMALL LETTER I WITH DIAERESIS
501 #x00F1 ;; 150:LATIN SMALL LETTER N WITH TILDE
502 #x00F3 ;; 151:LATIN SMALL LETTER O WITH ACUTE
503 #x00F2 ;; 152:LATIN SMALL LETTER O WITH GRAVE
504 #x00F4 ;; 153:LATIN SMALL LETTER O WITH CIRCUMFLEX
505 #x00F6 ;; 154:LATIN SMALL LETTER O WITH DIAERESIS
506 #x00F5 ;; 155:LATIN SMALL LETTER O WITH TILDE
507 #x00FA ;; 156:LATIN SMALL LETTER U WITH ACUTE
508 #x00F9 ;; 157:LATIN SMALL LETTER U WITH GRAVE
509 #x00FB ;; 158:LATIN SMALL LETTER U WITH CIRCUMFLEX
510 #x00FC ;; 159:LATIN SMALL LETTER U WITH DIAERESIS
511 #x2020 ;; 160:DAGGER
512 #x00B0 ;; 161:DEGREE SIGN
513 #x00A2 ;; 162:CENT SIGN
514 #x00A3 ;; 163:POUND SIGN
515 #x00A7 ;; 164:SECTION SIGN
516 #x2022 ;; 165:BULLET
517 #x00B6 ;; 166:PILCROW SIGN
518 #x00DF ;; 167:LATIN SMALL LETTER SHARP S
519 #x00AE ;; 168:REGISTERED SIGN
520 #x00A9 ;; 169:COPYRIGHT SIGN
521 #x2122 ;; 170:TRADE MARK SIGN
522 #x00B4 ;; 171:ACUTE ACCENT
523 #x00A8 ;; 172:DIAERESIS
524 #x2260 ;; 173:NOT EQUAL TO
525 #x00C6 ;; 174:LATIN CAPITAL LETTER AE
526 #x00D8 ;; 175:LATIN CAPITAL LETTER O WITH STROKE
527 #x221E ;; 176:INFINITY
528 #x00B1 ;; 177:PLUS-MINUS SIGN
529 #x2264 ;; 178:LESS-THAN OR EQUAL TO
530 #x2265 ;; 179:GREATER-THAN OR EQUAL TO
531 #x00A5 ;; 180:YEN SIGN
532 #x00B5 ;; 181:MICRO SIGN
533 #x2202 ;; 182:PARTIAL DIFFERENTIAL
534 #x2211 ;; 183:N-ARY SUMMATION
535 #x220F ;; 184:N-ARY PRODUCT
536 #x03C0 ;; 185:GREEK SMALL LETTER PI
537 #x222B ;; 186:INTEGRAL
538 #x00AA ;; 187:FEMININE ORDINAL INDICATOR
539 #x00BA ;; 188:MASCULINE ORDINAL INDICATOR
540 #x03A9 ;; 189:GREEK CAPITAL LETTER OMEGA
541 #x00E6 ;; 190:LATIN SMALL LETTER AE
542 #x00F8 ;; 191:LATIN SMALL LETTER O WITH STROKE
543 #x00BF ;; 192:INVERTED QUESTION MARK
544 #x00A1 ;; 193:INVERTED EXCLAMATION MARK
545 #x00AC ;; 194:NOT SIGN
546 #x221A ;; 195:SQUARE ROOT
547 #x0192 ;; 196:LATIN SMALL LETTER F WITH HOOK
548 #x2248 ;; 197:ALMOST EQUAL TO
549 #x2206 ;; 198:INCREMENT
550 #x00AB ;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
551 #x00BB ;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
552 #x2026 ;; 201:HORIZONTAL ELLIPSIS
553 #x00A0 ;; 202:NO-BREAK SPACE
554 #x00C0 ;; 203:LATIN CAPITAL LETTER A WITH GRAVE
555 #x00C3 ;; 204:LATIN CAPITAL LETTER A WITH TILDE
556 #x00D5 ;; 205:LATIN CAPITAL LETTER O WITH TILDE
557 #x0152 ;; 206:LATIN CAPITAL LIGATURE OE
558 #x0153 ;; 207:LATIN SMALL LIGATURE OE
559 #x2013 ;; 208:EN DASH
560 #x2014 ;; 209:EM DASH
561 #x201C ;; 210:LEFT DOUBLE QUOTATION MARK
562 #x201D ;; 211:RIGHT DOUBLE QUOTATION MARK
563 #x2018 ;; 212:LEFT SINGLE QUOTATION MARK
564 #x2019 ;; 213:RIGHT SINGLE QUOTATION MARK
565 #x00F7 ;; 214:DIVISION SIGN
566 #x25CA ;; 215:LOZENGE
567 #x00FF ;; 216:LATIN SMALL LETTER Y WITH DIAERESIS
568 #x0178 ;; 217:LATIN CAPITAL LETTER Y WITH DIAERESIS
569 #x2044 ;; 218:FRACTION SLASH
570 #x20AC ;; 219:EURO SIGN
571 #x2039 ;; 220:SINGLE LEFT-POINTING ANGLE QUOTATION MARK
572 #x203A ;; 221:SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
573 #xFB01 ;; 222:LATIN SMALL LIGATURE FI
574 #xFB02 ;; 223:LATIN SMALL LIGATURE FL
575 #x2021 ;; 224:DOUBLE DAGGER
576 #x00B7 ;; 225:MIDDLE DOT
577 #x201A ;; 226:SINGLE LOW-9 QUOTATION MARK
578 #x201E ;; 227:DOUBLE LOW-9 QUOTATION MARK
579 #x2030 ;; 228:PER MILLE SIGN
580 #x00C2 ;; 229:LATIN CAPITAL LETTER A WITH CIRCUMFLEX
581 #x00CA ;; 230:LATIN CAPITAL LETTER E WITH CIRCUMFLEX
582 #x00C1 ;; 231:LATIN CAPITAL LETTER A WITH ACUTE
583 #x00CB ;; 232:LATIN CAPITAL LETTER E WITH DIAERESIS
584 #x00C8 ;; 233:LATIN CAPITAL LETTER E WITH GRAVE
585 #x00CD ;; 234:LATIN CAPITAL LETTER I WITH ACUTE
586 #x00CE ;; 235:LATIN CAPITAL LETTER I WITH CIRCUMFLEX
587 #x00CF ;; 236:LATIN CAPITAL LETTER I WITH DIAERESIS
588 #x00CC ;; 237:LATIN CAPITAL LETTER I WITH GRAVE
589 #x00D3 ;; 238:LATIN CAPITAL LETTER O WITH ACUTE
590 #x00D4 ;; 239:LATIN CAPITAL LETTER O WITH CIRCUMFLEX
591 #xF8FF ;; 240:Apple logo
592 #x00D2 ;; 241:LATIN CAPITAL LETTER O WITH GRAVE
593 #x00DA ;; 242:LATIN CAPITAL LETTER U WITH ACUTE
594 #x00DB ;; 243:LATIN CAPITAL LETTER U WITH CIRCUMFLEX
595 #x00D9 ;; 244:LATIN CAPITAL LETTER U WITH GRAVE
596 #x0131 ;; 245:LATIN SMALL LETTER DOTLESS I
597 #x02C6 ;; 246:MODIFIER LETTER CIRCUMFLEX ACCENT
598 #x02DC ;; 247:SMALL TILDE
599 #x00AF ;; 248:MACRON
600 #x02D8 ;; 249:BREVE
601 #x02D9 ;; 250:DOT ABOVE
602 #x02DA ;; 251:RING ABOVE
603 #x00B8 ;; 252:CEDILLA
604 #x02DD ;; 253:DOUBLE ACUTE ACCENT
605 #x02DB ;; 254:OGONEK
606 #x02C7 ;; 255:CARON
607 ])
608 translation-table)
609 (while (< i 128)
610 (aset encoding-vector i i)
611 (setq i (1+ i)))
612 (while (< i 256)
613 (aset encoding-vector i
614 (decode-char 'ucs (aref vec (- i 128))))
615 (setq i (1+ i)))
616 (setq translation-table
617 (make-translation-table-from-vector encoding-vector))
618 (define-translation-table 'mac-roman-decoder translation-table)
619 (define-translation-table 'mac-roman-encoder
620 (char-table-extra-slot translation-table 0)))
621
622 (define-ccl-program decode-mac-roman
623 `(4
624 ((loop
625 (read r1)
626 (if (r1 < 128) ;; ASCII
627 (r0 = ,(charset-id 'ascii))
628 (if (r1 < 160)
629 (r0 = ,(charset-id 'eight-bit-control))
630 (r0 = ,(charset-id 'eight-bit-graphic))))
631 (translate-character mac-roman-decoder r0 r1)
632 (write-multibyte-character r0 r1)
633 (repeat))))
634 "CCL program to decode Mac Roman")
635
636 (define-ccl-program encode-mac-roman
637 `(1
638 ((loop
639 (read-multibyte-character r0 r1)
640 (translate-character ucs-mule-to-mule-unicode r0 r1)
641 (translate-character mac-roman-encoder r0 r1)
642 (if (r0 != ,(charset-id 'ascii))
643 (if (r0 != ,(charset-id 'eight-bit-graphic))
644 (if (r0 != ,(charset-id 'eight-bit-control))
645 (r1 = ??))))
646 (write-repeat r1))))
647 "CCL program to encode Mac Roman")
648
649 (make-coding-system
650 'mac-roman 4 ?M
651 "Mac Roman Encoding (MIME:MACINTOSH)."
652 '(decode-mac-roman . encode-mac-roman)
653 (list (cons 'safe-chars (get 'mac-roman-encoder 'translation-table))
654 '(valid-codes (0 . 255))
655 '(mime-charset . macintosh))) ; per IANA, rfc1345
656
657 (defconst diacritic-composition-pattern "\\C^\\c^+")
658
659 (defun diacritic-compose-region (beg end)
660 "Compose diacritic characters in the region.
661 When called from a program, expects two arguments,
662 positions (integers or markers) specifying the region."
663 (interactive "r")
664 (save-restriction
665 (narrow-to-region beg end)
666 (goto-char (point-min))
667 (while (re-search-forward diacritic-composition-pattern nil t)
668 (compose-region (match-beginning 0) (match-end 0)))))
669
670 (defun diacritic-compose-string (string)
671 "Compose diacritic characters in STRING and return the resulting string."
672 (let ((idx 0))
673 (while (setq idx (string-match diacritic-composition-pattern string idx))
674 (compose-string string idx (match-end 0))
675 (setq idx (match-end 0))))
676 string)
677
678 (defun diacritic-compose-buffer ()
679 "Compose diacritic characters in the current buffer."
680 (interactive)
681 (diacritic-compose-region (point-min) (point-max)))
682
683 (defun diacritic-post-read-conversion (len)
684 (diacritic-compose-region (point) (+ (point) len))
685 len)
686
687 (defun diacritic-composition-function (from to pattern &optional string)
688 "Compose diacritic text in the region FROM and TO.
689 The text matches the regular expression PATTERN.
690 Optional 4th argument STRING, if non-nil, is a string containing text
691 to compose.
692
693 The return value is the number of composed characters."
694 (when (< (1+ from) to)
695 (if string
696 (compose-string string from to)
697 (compose-region from to))
698 (- to from)))
699
700 ;; Register a function to compose Unicode diacrtics and marks.
701 (let ((patterns '(("\\C^\\c^+" . diacritic-composition-function))))
702 (let ((c #x300))
703 (while (<= c #x362)
704 (aset composition-function-table (decode-char 'ucs c) patterns)
705 (setq c (1+ c)))
706 (setq c #x20d0)
707 (while (<= c #x20e3)
708 (aset composition-function-table (decode-char 'ucs c) patterns)
709 (setq c (1+ c)))))
710
711 (provide 'european)
712
713 ;;; arch-tag: 9e018b12-fb02-4120-907b-9adeaf84b5c2
714 ;;; european.el ends here