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