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