(CHAR96): Deleted.
[chise/xemacs-chise.git-] / src / mule-charset.c
1 /* Functions to handle multilingual characters.
2    Copyright (C) 1992, 1995 Free Software Foundation, Inc.
3    Copyright (C) 1995 Sun Microsystems, Inc.
4
5 This file is part of XEmacs.
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 the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 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
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  */
21
22 /* Synched up with: FSF 20.3.  Not in FSF. */
23
24 /* Rewritten by Ben Wing <ben@xemacs.org>. */
25
26 #include <config.h>
27 #include "lisp.h"
28
29 #include "buffer.h"
30 #include "chartab.h"
31 #include "elhash.h"
32 #include "lstream.h"
33 #include "device.h"
34 #include "faces.h"
35 #include "mule-ccl.h"
36
37 /* The various pre-defined charsets. */
38
39 Lisp_Object Vcharset_ascii;
40 Lisp_Object Vcharset_control_1;
41 Lisp_Object Vcharset_latin_iso8859_1;
42 Lisp_Object Vcharset_latin_iso8859_2;
43 Lisp_Object Vcharset_latin_iso8859_3;
44 Lisp_Object Vcharset_latin_iso8859_4;
45 Lisp_Object Vcharset_thai_tis620;
46 Lisp_Object Vcharset_greek_iso8859_7;
47 Lisp_Object Vcharset_arabic_iso8859_6;
48 Lisp_Object Vcharset_hebrew_iso8859_8;
49 Lisp_Object Vcharset_katakana_jisx0201;
50 Lisp_Object Vcharset_latin_jisx0201;
51 Lisp_Object Vcharset_cyrillic_iso8859_5;
52 Lisp_Object Vcharset_latin_iso8859_9;
53 Lisp_Object Vcharset_japanese_jisx0208_1978;
54 Lisp_Object Vcharset_chinese_gb2312;
55 Lisp_Object Vcharset_japanese_jisx0208;
56 Lisp_Object Vcharset_korean_ksc5601;
57 Lisp_Object Vcharset_japanese_jisx0212;
58 Lisp_Object Vcharset_chinese_cns11643_1;
59 Lisp_Object Vcharset_chinese_cns11643_2;
60 #ifdef UTF2000
61 Lisp_Object Vcharset_ucs_bmp;
62 Lisp_Object Vcharset_latin_viscii_lower;
63 Lisp_Object Vcharset_latin_viscii_upper;
64 #endif
65 Lisp_Object Vcharset_chinese_big5_1;
66 Lisp_Object Vcharset_chinese_big5_2;
67
68 #ifdef ENABLE_COMPOSITE_CHARS
69 Lisp_Object Vcharset_composite;
70
71 /* Hash tables for composite chars.  One maps string representing
72    composed chars to their equivalent chars; one goes the
73    other way. */
74 Lisp_Object Vcomposite_char_char2string_hash_table;
75 Lisp_Object Vcomposite_char_string2char_hash_table;
76
77 static int composite_char_row_next;
78 static int composite_char_col_next;
79
80 #endif /* ENABLE_COMPOSITE_CHARS */
81
82 /* Table of charsets indexed by leading byte. */
83 Lisp_Object charset_by_leading_byte[NUM_LEADING_BYTES];
84
85 /* Table of charsets indexed by type/final-byte/direction. */
86 #ifdef UTF2000
87 Lisp_Object charset_by_attributes[4][128];
88 #else
89 Lisp_Object charset_by_attributes[4][128][2];
90 #endif
91
92 #ifndef UTF2000
93 /* Table of number of bytes in the string representation of a character
94    indexed by the first byte of that representation.
95
96    rep_bytes_by_first_byte(c) is more efficient than the equivalent
97    canonical computation:
98
99    (BYTE_ASCII_P (c) ? 1 : XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (c))) */
100
101 Bytecount rep_bytes_by_first_byte[0xA0] =
102 { /* 0x00 - 0x7f are for straight ASCII */
103   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
104   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
105   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
106   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
107   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
108   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
109   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
110   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
111   /* 0x80 - 0x8f are for Dimension-1 official charsets */
112 #ifdef CHAR_IS_UCS4
113   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
114 #else
115   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 #endif
117   /* 0x90 - 0x9d are for Dimension-2 official charsets */
118   /* 0x9e is for Dimension-1 private charsets */
119   /* 0x9f is for Dimension-2 private charsets */
120   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4
121 };
122 #endif
123
124 #ifdef UTF2000
125 Emchar_to_byte_table*
126 make_byte_from_character_table ()
127 {
128   Emchar_to_byte_table* table
129     = (Emchar_to_byte_table*) xmalloc (sizeof (Emchar_to_byte_table));
130
131   table->base = NULL;
132   return table;
133 }
134
135 void
136 put_byte_from_character_table (Emchar ch, unsigned char val,
137                                Emchar_to_byte_table* table)
138 {
139   if (table->base == NULL)
140     {
141       table->base = xmalloc (128);
142       table->offset = ch - (ch % 128);
143       table->size = 128;
144       table->base[ch - table->offset] = val;
145     }
146   else
147     {
148       int i = ch - table->offset;
149
150       if (i < 0)
151         {
152           size_t new_size = table->size - i;
153           size_t j;
154
155           new_size += 128 - (new_size % 128);
156           table->base = xrealloc (table->base, new_size);
157           memmove (table->base + (new_size - table->size), table->base,
158                    table->size);
159           for (j = 0; j < (new_size - table->size); j++)
160             table->base[j] = 0;
161           table->offset -= (new_size - table->size);
162           table->base[ch - table->offset] = val;
163           table->size = new_size;
164         }
165       else if (i >= table->size)
166         {
167           size_t new_size = i + 1;
168           size_t j;
169
170           new_size += 128 - (new_size % 128);
171           table->base = xrealloc (table->base, new_size);
172           for (j = table->size; j < new_size; j++)
173             table->base[j] = 0;
174           table->base[i] = val;
175           table->size = new_size;
176         }
177       else
178         {
179           table->base[i] = val;
180         }
181     }
182 }
183
184 unsigned char
185 get_byte_from_character_table (Emchar ch, Emchar_to_byte_table* table)
186 {
187   size_t i = ch - table->offset;
188   if (i < table->size)
189     return table->base[i];
190   else
191     return 0;
192 }
193
194 Lisp_Object latin_jisx0201_to_ucs;
195 Lisp_Object latin_iso8859_2_to_ucs;
196 Lisp_Object latin_iso8859_3_to_ucs;
197 Lisp_Object latin_iso8859_4_to_ucs;
198 Lisp_Object latin_iso8859_9_to_ucs;
199 Lisp_Object latin_viscii_lower_to_ucs;
200 Lisp_Object latin_viscii_upper_to_ucs;
201
202 #if 0
203 Emchar latin_tcvn5712_to_ucs[96] =
204 {
205   0x00A0 /* 0xA0  NO-BREAK SPACE */,
206   0x0102 /* 0xA1  LATIN CAPITAL LETTER A WITH BREVE */,
207   0x00C2 /* 0xA2  LATIN CAPITAL LETTER A WITH CIRCUMFLEX */,
208   0x00CA /* 0xA3  LATIN CAPITAL LETTER E WITH CIRCUMFLEX */,
209   0x00D4 /* 0xA4  LATIN CAPITAL LETTER O WITH CIRCUMFLEX */,
210   0x01A0 /* 0xA5  LATIN CAPITAL LETTER O WITH HORN */,
211   0x01AF /* 0xA6  LATIN CAPITAL LETTER U WITH HORN */,
212   0x0110 /* 0xA7  LATIN CAPITAL LETTER D WITH STROKE */,
213   0x0103 /* 0xA8  LATIN SMALL LETTER A WITH BREVE */,
214   0x00E2 /* 0xA9  LATIN SMALL LETTER A WITH CIRCUMFLEX */,
215   0x00EA /* 0xAA  LATIN SMALL LETTER E WITH CIRCUMFLEX */,
216   0x00F4 /* 0xAB  LATIN SMALL LETTER O WITH CIRCUMFLEX */,
217   0x01A1 /* 0xAC  LATIN SMALL LETTER O WITH HORN */,
218   0x01B0 /* 0xAD  LATIN SMALL LETTER U WITH HORN */,
219   0x0111 /* 0xAE  LATIN SMALL LETTER D WITH STROKE */,
220   0x1EB0 /* 0xAF  LATIN CAPITAL LETTER A WITH BREVE AND GRAVE */,
221   0x0300 /* 0xB0  COMBINING GRAVE ACCENT */,
222   0x0309 /* 0xB1  COMBINING HOOK ABOVE */,
223   0x0303 /* 0xB2  COMBINING TILDE */,
224   0x0301 /* 0xB3  COMBINING ACUTE ACCENT */,
225   0x0323 /* 0xB4  COMBINING DOT BELOW */,
226   0x00E0 /* 0xB5  LATIN SMALL LETTER A WITH GRAVE */,
227   0x1EA3 /* 0xB6  LATIN SMALL LETTER A WITH HOOK ABOVE */,
228   0x00E3 /* 0xB7  LATIN SMALL LETTER A WITH TILDE */,
229   0x00E1 /* 0xB8  LATIN SMALL LETTER A WITH ACUTE */,
230   0x1EA1 /* 0xB9  LATIN SMALL LETTER A WITH DOT BELOW */,
231   0x1EB2 /* 0xBA  LATIN CAPITAL LETTER A WITH BREVE AND HOOK ABOVE */,
232   0x1EB1 /* 0xBB  LATIN SMALL LETTER A WITH BREVE AND GRAVE */,
233   0x1EB3 /* 0xBC  LATIN SMALL LETTER A WITH BREVE AND HOOK ABOVE */,
234   0x1EB5 /* 0xBD  LATIN SMALL LETTER A WITH BREVE AND TILDE */,
235   0x1EAF /* 0xBE  LATIN SMALL LETTER A WITH BREVE AND ACUTE */,
236   0x1EB4 /* 0xBF  LATIN CAPITAL LETTER A WITH BREVE AND TILDE */,
237   0x1EAE /* 0xC0  LATIN CAPITAL LETTER A WITH BREVE AND ACUTE */,
238   0x1EA6 /* 0xC1  LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE */,
239   0x1EA8 /* 0xC2  LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */,
240   0x1EAA /* 0xC3  LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE */,
241   0x1EA4 /* 0xC4  LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE */,
242   0x1EC0 /* 0xC5  LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE */,
243   0x1EB7 /* 0xC6  LATIN SMALL LETTER A WITH BREVE AND DOT BELOW */,
244   0x1EA7 /* 0xC7  LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE */,
245   0x1EA9 /* 0xC8  LATIN SMALL LETTER A WITH CIRCUMFLEX AND HOOK ABOVE */,
246   0x1EAB /* 0xC9  LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE */,
247   0x1EA5 /* 0xCA  LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE */,
248   0x1EAD /* 0xCB  LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW */,
249   0x00E8 /* 0xCC  LATIN SMALL LETTER E WITH GRAVE */,
250   0x1EC2 /* 0xCD  LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */,
251   0x1EBB /* 0xCE  LATIN SMALL LETTER E WITH HOOK ABOVE */,
252   0x1EBD /* 0xCF  LATIN SMALL LETTER E WITH TILDE */,
253   0x00E9 /* 0xD0  LATIN SMALL LETTER E WITH ACUTE */,
254   0x1EB9 /* 0xD1  LATIN SMALL LETTER E WITH DOT BELOW */,
255   0x1EC1 /* 0xD2  LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE */,
256   0x1EC3 /* 0xD3  LATIN SMALL LETTER E WITH CIRCUMFLEX AND HOOK ABOVE */,
257   0x1EC5 /* 0xD4  LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE */,
258   0x1EBF /* 0xD5  LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE */,
259   0x1EC7 /* 0xD6  LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW */,
260   0x00EC /* 0xD7  LATIN SMALL LETTER I WITH GRAVE */,
261   0x1EC9 /* 0xD8  LATIN SMALL LETTER I WITH HOOK ABOVE */,
262   0x1EC4 /* 0xD9  LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE */,
263   0x1EBE /* 0xDA  LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE */,
264   0x1ED2 /* 0xDB  LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE */,
265   0x0129 /* 0xDC  LATIN SMALL LETTER I WITH TILDE */,
266   0x00ED /* 0xDD  LATIN SMALL LETTER I WITH ACUTE */,
267   0x1ECB /* 0xDE  LATIN SMALL LETTER I WITH DOT BELOW */,
268   0x00F2 /* 0xDF  LATIN SMALL LETTER O WITH GRAVE */,
269   0x1ED4 /* 0xE0  LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */,
270   0x1ECF /* 0xE1  LATIN SMALL LETTER O WITH HOOK ABOVE */,
271   0x00F5 /* 0xE2  LATIN SMALL LETTER O WITH TILDE */,
272   0x00F3 /* 0xE3  LATIN SMALL LETTER O WITH ACUTE */,
273   0x1ECD /* 0xE4  LATIN SMALL LETTER O WITH DOT BELOW */,
274   0x1ED3 /* 0xE5  LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE */,
275   0x1ED5 /* 0xE6  LATIN SMALL LETTER O WITH CIRCUMFLEX AND HOOK ABOVE */,
276   0x1ED7 /* 0xE7  LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE */,
277   0x1ED1 /* 0xE8  LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE */,
278   0x1ED9 /* 0xE9  LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELOW */,
279   0x1EDD /* 0xEA  LATIN SMALL LETTER O WITH HORN AND GRAVE */,
280   0x1EDF /* 0xEB  LATIN SMALL LETTER O WITH HORN AND HOOK ABOVE */,
281   0x1EE1 /* 0xEC  LATIN SMALL LETTER O WITH HORN AND TILDE */,
282   0x1EDB /* 0xED  LATIN SMALL LETTER O WITH HORN AND ACUTE */,
283   0x1EE3 /* 0xEE  LATIN SMALL LETTER O WITH HORN AND DOT BELOW */,
284   0x00F9 /* 0xEF  LATIN SMALL LETTER U WITH GRAVE */,
285   0x1ED6 /* 0xF0  LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE */,
286   0x1EE7 /* 0xF1  LATIN SMALL LETTER U WITH HOOK ABOVE */,
287   0x0169 /* 0xF2  LATIN SMALL LETTER U WITH TILDE */,
288   0x00FA /* 0xF3  LATIN SMALL LETTER U WITH ACUTE */,
289   0x1EE5 /* 0xF4  LATIN SMALL LETTER U WITH DOT BELOW */,
290   0x1EEB /* 0xF5  LATIN SMALL LETTER U WITH HORN AND GRAVE */,
291   0x1EED /* 0xF6  LATIN SMALL LETTER U WITH HORN AND HOOK ABOVE */,
292   0x1EEF /* 0xF7  LATIN SMALL LETTER U WITH HORN AND TILDE */,
293   0x1EE9 /* 0xF8  LATIN SMALL LETTER U WITH HORN AND ACUTE */,
294   0x1EF1 /* 0xF9  LATIN SMALL LETTER U WITH HORN AND DOT BELOW */,
295   0x1EF3 /* 0xFA  LATIN SMALL LETTER Y WITH GRAVE */,
296   0x1EF7 /* 0xFB  LATIN SMALL LETTER Y WITH HOOK ABOVE */,
297   0x1EF9 /* 0xFC  LATIN SMALL LETTER Y WITH TILDE */,
298   0x00FD /* 0xFD  LATIN SMALL LETTER Y WITH ACUTE */,
299   0x1EF5 /* 0xFE  LATIN SMALL LETTER Y WITH DOT BELOW */,
300   0x1ED0 /* 0xFF  LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE */
301 };
302 #endif
303
304 Lisp_Object Vutf_2000_version;
305 #endif
306
307 #ifndef UTF2000
308 int leading_code_private_11;
309 #endif
310
311 Lisp_Object Qcharsetp;
312
313 /* Qdoc_string, Qdimension, Qchars defined in general.c */
314 Lisp_Object Qregistry, Qfinal, Qgraphic;
315 Lisp_Object Qdirection;
316 Lisp_Object Qreverse_direction_charset;
317 Lisp_Object Qleading_byte;
318 Lisp_Object Qshort_name, Qlong_name;
319
320 Lisp_Object Qascii,
321   Qcontrol_1,
322   Qlatin_iso8859_1,
323   Qlatin_iso8859_2,
324   Qlatin_iso8859_3,
325   Qlatin_iso8859_4,
326   Qthai_tis620,
327   Qgreek_iso8859_7,
328   Qarabic_iso8859_6,
329   Qhebrew_iso8859_8,
330   Qkatakana_jisx0201,
331   Qlatin_jisx0201,
332   Qcyrillic_iso8859_5,
333   Qlatin_iso8859_9,
334   Qjapanese_jisx0208_1978,
335   Qchinese_gb2312,
336   Qjapanese_jisx0208,
337   Qkorean_ksc5601,
338   Qjapanese_jisx0212,
339   Qchinese_cns11643_1,
340   Qchinese_cns11643_2,
341 #ifdef UTF2000
342   Qucs_bmp,
343   Qlatin_viscii_lower,
344   Qlatin_viscii_upper,
345 #endif
346   Qchinese_big5_1,
347   Qchinese_big5_2,
348   Qcomposite;
349
350 Lisp_Object Ql2r, Qr2l;
351
352 Lisp_Object Vcharset_hash_table;
353
354 static Charset_ID next_allocated_1_byte_leading_byte;
355 static Charset_ID next_allocated_2_byte_leading_byte;
356
357 /* Composite characters are characters constructed by overstriking two
358    or more regular characters.
359
360    1) The old Mule implementation involves storing composite characters
361       in a buffer as a tag followed by all of the actual characters
362       used to make up the composite character.  I think this is a bad
363       idea; it greatly complicates code that wants to handle strings
364       one character at a time because it has to deal with the possibility
365       of great big ungainly characters.  It's much more reasonable to
366       simply store an index into a table of composite characters.
367
368    2) The current implementation only allows for 16,384 separate
369       composite characters over the lifetime of the XEmacs process.
370       This could become a potential problem if the user
371       edited lots of different files that use composite characters.
372       Due to FSF bogosity, increasing the number of allowable
373       composite characters under Mule would decrease the number
374       of possible faces that can exist.  Mule already has shrunk
375       this to 2048, and further shrinkage would become uncomfortable.
376       No such problems exist in XEmacs.
377
378       Composite characters could be represented as 0x80 C1 C2 C3,
379       where each C[1-3] is in the range 0xA0 - 0xFF.  This allows
380       for slightly under 2^20 (one million) composite characters
381       over the XEmacs process lifetime, and you only need to
382       increase the size of a Mule character from 19 to 21 bits.
383       Or you could use 0x80 C1 C2 C3 C4, allowing for about
384       85 million (slightly over 2^26) composite characters. */
385
386 \f
387 /************************************************************************/
388 /*                       Basic Emchar functions                         */
389 /************************************************************************/
390
391 /* Convert a non-ASCII Mule character C into a one-character Mule-encoded
392    string in STR.  Returns the number of bytes stored.
393    Do not call this directly.  Use the macro set_charptr_emchar() instead.
394  */
395
396 Bytecount
397 non_ascii_set_charptr_emchar (Bufbyte *str, Emchar c)
398 {
399   Bufbyte *p;
400 #ifndef UTF2000
401   Charset_ID lb;
402   int c1, c2;
403   Lisp_Object charset;
404 #endif
405
406   p = str;
407 #ifdef UTF2000
408   if ( c <= 0x7f )
409     {
410       *p++ = c;
411     }
412   else if ( c <= 0x7ff )
413     {
414       *p++ = (c >> 6) | 0xc0;
415       *p++ = (c & 0x3f) | 0x80;
416     }
417   else if ( c <= 0xffff )
418     {
419       *p++ =  (c >> 12) | 0xe0;
420       *p++ = ((c >>  6) & 0x3f) | 0x80;
421       *p++ =  (c        & 0x3f) | 0x80;
422     }
423   else if ( c <= 0x1fffff )
424     {
425       *p++ =  (c >> 18) | 0xf0;
426       *p++ = ((c >> 12) & 0x3f) | 0x80;
427       *p++ = ((c >>  6) & 0x3f) | 0x80;
428       *p++ =  (c        & 0x3f) | 0x80;
429     }
430   else if ( c <= 0x3ffffff )
431     {
432       *p++ =  (c >> 24) | 0xf8;
433       *p++ = ((c >> 18) & 0x3f) | 0x80;
434       *p++ = ((c >> 12) & 0x3f) | 0x80;
435       *p++ = ((c >>  6) & 0x3f) | 0x80;
436       *p++ =  (c        & 0x3f) | 0x80;
437     }
438   else
439     {
440       *p++ =  (c >> 30) | 0xfc;
441       *p++ = ((c >> 24) & 0x3f) | 0x80;
442       *p++ = ((c >> 18) & 0x3f) | 0x80;
443       *p++ = ((c >> 12) & 0x3f) | 0x80;
444       *p++ = ((c >>  6) & 0x3f) | 0x80;
445       *p++ =  (c        & 0x3f) | 0x80;
446     }
447 #else
448   BREAKUP_CHAR (c, charset, c1, c2);
449   lb = CHAR_LEADING_BYTE (c);
450   if (LEADING_BYTE_PRIVATE_P (lb))
451     *p++ = PRIVATE_LEADING_BYTE_PREFIX (lb);
452   *p++ = lb;
453   if (EQ (charset, Vcharset_control_1))
454     c1 += 0x20;
455   *p++ = c1 | 0x80;
456   if (c2)
457     *p++ = c2 | 0x80;
458 #endif
459   return (p - str);
460 }
461
462 /* Return the first character from a Mule-encoded string in STR,
463    assuming it's non-ASCII.  Do not call this directly.
464    Use the macro charptr_emchar() instead. */
465
466 Emchar
467 non_ascii_charptr_emchar (CONST Bufbyte *str)
468 {
469 #ifdef UTF2000
470   Bufbyte b;
471   Emchar ch;
472   int len;
473
474   b = *str++;
475   if ( b >= 0xfc )
476     {
477       ch = (b & 0x01);
478       len = 5;
479     }
480   else if ( b >= 0xf8 )
481     {
482       ch = b & 0x03;
483       len = 4;
484     }
485   else if ( b >= 0xf0 )
486     {
487       ch = b & 0x07;
488       len = 3;
489     }
490   else if ( b >= 0xe0 )
491     {
492       ch = b & 0x0f;
493       len = 2;
494     }
495   else if ( b >= 0xc0 )
496     {
497       ch = b & 0x1f;
498       len = 1;
499     }
500   else
501     {
502       ch = b;
503       len = 0;
504     }
505   for( ; len > 0; len-- )
506     {
507       b = *str++;
508       ch = ( ch << 6 ) | ( b & 0x3f );
509     }
510   return ch;
511 #else
512   Bufbyte i0 = *str, i1, i2 = 0;
513   Lisp_Object charset;
514
515   if (i0 == LEADING_BYTE_CONTROL_1)
516     return (Emchar) (*++str - 0x20);
517
518   if (LEADING_BYTE_PREFIX_P (i0))
519     i0 = *++str;
520
521   i1 = *++str & 0x7F;
522
523   charset = CHARSET_BY_LEADING_BYTE (i0);
524   if (XCHARSET_DIMENSION (charset) == 2)
525     i2 = *++str & 0x7F;
526
527   return MAKE_CHAR (charset, i1, i2);
528 #endif
529 }
530
531 /* Return whether CH is a valid Emchar, assuming it's non-ASCII.
532    Do not call this directly.  Use the macro valid_char_p() instead. */
533
534 #ifndef UTF2000
535 int
536 non_ascii_valid_char_p (Emchar ch)
537 {
538   int f1, f2, f3;
539
540   /* Must have only lowest 19 bits set */
541   if (ch & ~0x7FFFF)
542     return 0;
543
544   f1 = CHAR_FIELD1 (ch);
545   f2 = CHAR_FIELD2 (ch);
546   f3 = CHAR_FIELD3 (ch);
547
548   if (f1 == 0)
549     {
550       Lisp_Object charset;
551
552       if (f2 < MIN_CHAR_FIELD2_OFFICIAL ||
553           (f2 > MAX_CHAR_FIELD2_OFFICIAL && f2 < MIN_CHAR_FIELD2_PRIVATE) ||
554            f2 > MAX_CHAR_FIELD2_PRIVATE)
555         return 0;
556       if (f3 < 0x20)
557         return 0;
558
559       if (f3 != 0x20 && f3 != 0x7F)
560         return 1;
561
562       /*
563          NOTE: This takes advantage of the fact that
564          FIELD2_TO_OFFICIAL_LEADING_BYTE and
565          FIELD2_TO_PRIVATE_LEADING_BYTE are the same.
566          */
567       charset = CHARSET_BY_LEADING_BYTE (f2 + FIELD2_TO_OFFICIAL_LEADING_BYTE);
568       return (XCHARSET_CHARS (charset) == 96);
569     }
570   else
571     {
572       Lisp_Object charset;
573
574       if (f1 < MIN_CHAR_FIELD1_OFFICIAL ||
575           (f1 > MAX_CHAR_FIELD1_OFFICIAL && f1 < MIN_CHAR_FIELD1_PRIVATE) ||
576           f1 > MAX_CHAR_FIELD1_PRIVATE)
577         return 0;
578       if (f2 < 0x20 || f3 < 0x20)
579         return 0;
580
581 #ifdef ENABLE_COMPOSITE_CHARS
582       if (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE == LEADING_BYTE_COMPOSITE)
583         {
584           if (UNBOUNDP (Fgethash (make_int (ch),
585                                   Vcomposite_char_char2string_hash_table,
586                                   Qunbound)))
587             return 0;
588           return 1;
589         }
590 #endif /* ENABLE_COMPOSITE_CHARS */
591
592       if (f2 != 0x20 && f2 != 0x7F && f3 != 0x20 && f3 != 0x7F)
593         return 1;
594
595       if (f1 <= MAX_CHAR_FIELD1_OFFICIAL)
596         charset =
597           CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_OFFICIAL_LEADING_BYTE);
598       else
599         charset =
600           CHARSET_BY_LEADING_BYTE (f1 + FIELD1_TO_PRIVATE_LEADING_BYTE);
601
602       return (XCHARSET_CHARS (charset) == 96);
603     }
604 }
605 #endif
606
607 \f
608 /************************************************************************/
609 /*                       Basic string functions                         */
610 /************************************************************************/
611
612 /* Copy the character pointed to by PTR into STR, assuming it's
613    non-ASCII.  Do not call this directly.  Use the macro
614    charptr_copy_char() instead. */
615
616 Bytecount
617 non_ascii_charptr_copy_char (CONST Bufbyte *ptr, Bufbyte *str)
618 {
619   Bufbyte *strptr = str;
620   *strptr = *ptr++;
621   switch (REP_BYTES_BY_FIRST_BYTE (*strptr))
622     {
623       /* Notice fallthrough. */
624 #ifdef UTF2000
625     case 6: *++strptr = *ptr++;
626     case 5: *++strptr = *ptr++;
627 #endif
628     case 4: *++strptr = *ptr++;
629     case 3: *++strptr = *ptr++;
630     case 2: *++strptr = *ptr;
631       break;
632     default:
633       abort ();
634     }
635   return strptr + 1 - str;
636 }
637
638 \f
639 /************************************************************************/
640 /*                        streams of Emchars                            */
641 /************************************************************************/
642
643 /* Treat a stream as a stream of Emchar's rather than a stream of bytes.
644    The functions below are not meant to be called directly; use
645    the macros in insdel.h. */
646
647 Emchar
648 Lstream_get_emchar_1 (Lstream *stream, int ch)
649 {
650   Bufbyte str[MAX_EMCHAR_LEN];
651   Bufbyte *strptr = str;
652
653   str[0] = (Bufbyte) ch;
654   switch (REP_BYTES_BY_FIRST_BYTE (ch))
655     {
656       /* Notice fallthrough. */
657 #ifdef UTF2000
658     case 6:
659       ch = Lstream_getc (stream);
660       assert (ch >= 0);
661       *++strptr = (Bufbyte) ch;
662     case 5:
663       ch = Lstream_getc (stream);
664       assert (ch >= 0);
665       *++strptr = (Bufbyte) ch;
666 #endif
667     case 4:
668       ch = Lstream_getc (stream);
669       assert (ch >= 0);
670       *++strptr = (Bufbyte) ch;
671     case 3:
672       ch = Lstream_getc (stream);
673       assert (ch >= 0);
674       *++strptr = (Bufbyte) ch;
675     case 2:
676       ch = Lstream_getc (stream);
677       assert (ch >= 0);
678       *++strptr = (Bufbyte) ch;
679       break;
680     default:
681       abort ();
682     }
683   return charptr_emchar (str);
684 }
685
686 int
687 Lstream_fput_emchar (Lstream *stream, Emchar ch)
688 {
689   Bufbyte str[MAX_EMCHAR_LEN];
690   Bytecount len = set_charptr_emchar (str, ch);
691   return Lstream_write (stream, str, len);
692 }
693
694 void
695 Lstream_funget_emchar (Lstream *stream, Emchar ch)
696 {
697   Bufbyte str[MAX_EMCHAR_LEN];
698   Bytecount len = set_charptr_emchar (str, ch);
699   Lstream_unread (stream, str, len);
700 }
701
702 \f
703 /************************************************************************/
704 /*                            charset object                            */
705 /************************************************************************/
706
707 static Lisp_Object
708 mark_charset (Lisp_Object obj, void (*markobj) (Lisp_Object))
709 {
710   struct Lisp_Charset *cs = XCHARSET (obj);
711
712   markobj (cs->short_name);
713   markobj (cs->long_name);
714   markobj (cs->doc_string);
715   markobj (cs->registry);
716   markobj (cs->ccl_program);
717   return cs->name;
718 }
719
720 static void
721 print_charset (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
722 {
723   struct Lisp_Charset *cs = XCHARSET (obj);
724   char buf[200];
725
726   if (print_readably)
727     error ("printing unreadable object #<charset %s 0x%x>",
728            string_data (XSYMBOL (CHARSET_NAME (cs))->name),
729            cs->header.uid);
730
731   write_c_string ("#<charset ", printcharfun);
732   print_internal (CHARSET_NAME (cs), printcharfun, 0);
733   write_c_string (" ", printcharfun);
734   print_internal (CHARSET_SHORT_NAME (cs), printcharfun, 1);
735   write_c_string (" ", printcharfun);
736   print_internal (CHARSET_LONG_NAME (cs), printcharfun, 1);
737   write_c_string (" ", printcharfun);
738   print_internal (CHARSET_DOC_STRING (cs), printcharfun, 1);
739   sprintf (buf, " %s %s cols=%d g%d final='%c' reg=",
740            CHARSET_TYPE (cs) == CHARSET_TYPE_94    ? "94" :
741            CHARSET_TYPE (cs) == CHARSET_TYPE_96    ? "96" :
742            CHARSET_TYPE (cs) == CHARSET_TYPE_94X94 ? "94x94" :
743            "96x96",
744            CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? "l2r" : "r2l",
745            CHARSET_COLUMNS (cs),
746            CHARSET_GRAPHIC (cs),
747            CHARSET_FINAL (cs));
748   write_c_string (buf, printcharfun);
749   print_internal (CHARSET_REGISTRY (cs), printcharfun, 0);
750   sprintf (buf, " 0x%x>", cs->header.uid);
751   write_c_string (buf, printcharfun);
752 }
753
754 static const struct lrecord_description charset_description[] = {
755   { XD_LISP_OBJECT, offsetof(struct Lisp_Charset, name), 7 },
756   { XD_END }
757 };
758
759 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
760                                mark_charset, print_charset, 0, 0, 0,
761                                charset_description,
762                                struct Lisp_Charset);
763 /* Make a new charset. */
764
765 static Lisp_Object
766 make_charset (Charset_ID id, Lisp_Object name,
767               unsigned char type, unsigned char columns, unsigned char graphic,
768               Bufbyte final, unsigned char direction, Lisp_Object short_name,
769               Lisp_Object long_name, Lisp_Object doc,
770               Lisp_Object reg,
771               Lisp_Object decoding_table,
772               Emchar ucs_min, Emchar ucs_max, Emchar code_offset)
773 {
774   Lisp_Object obj;
775   struct Lisp_Charset *cs =
776     alloc_lcrecord_type (struct Lisp_Charset, &lrecord_charset);
777   XSETCHARSET (obj, cs);
778
779   CHARSET_ID            (cs) = id;
780   CHARSET_NAME          (cs) = name;
781   CHARSET_SHORT_NAME    (cs) = short_name;
782   CHARSET_LONG_NAME     (cs) = long_name;
783   CHARSET_DIRECTION     (cs) = direction;
784   CHARSET_TYPE          (cs) = type;
785   CHARSET_COLUMNS       (cs) = columns;
786   CHARSET_GRAPHIC       (cs) = graphic;
787   CHARSET_FINAL         (cs) = final;
788   CHARSET_DOC_STRING    (cs) = doc;
789   CHARSET_REGISTRY      (cs) = reg;
790   CHARSET_CCL_PROGRAM   (cs) = Qnil;
791   CHARSET_REVERSE_DIRECTION_CHARSET (cs) = Qnil;
792 #ifdef UTF2000
793   CHARSET_DECODING_TABLE(cs) = decoding_table;
794   CHARSET_UCS_MIN(cs) = ucs_min;
795   CHARSET_UCS_MAX(cs) = ucs_max;
796   CHARSET_CODE_OFFSET(cs) = code_offset;
797 #endif
798   
799   switch ( CHARSET_TYPE (cs) )
800     {
801     case CHARSET_TYPE_94:
802       CHARSET_DIMENSION (cs) = 1;
803       CHARSET_CHARS (cs) = 94;
804 #ifdef UTF2000
805       if (!EQ (decoding_table, Qnil))
806         {
807           size_t i;
808           CHARSET_TO_BYTE1_TABLE(cs) = make_byte_from_character_table();
809           for (i = 0; i < 94; i++)
810             {
811               Lisp_Object c = XVECTOR_DATA(decoding_table)[i];
812
813               if (!EQ (c, Qnil))
814                 put_byte_from_character_table (XCHAR (c), i + 33,
815                                                CHARSET_TO_BYTE1_TABLE(cs));
816             }
817         }
818       else
819         CHARSET_TO_BYTE1_TABLE(cs) = NULL;
820       CHARSET_TO_BYTE2_TABLE(cs) = NULL;
821 #endif
822       break;
823     case CHARSET_TYPE_96:
824       CHARSET_DIMENSION (cs) = 1;
825       CHARSET_CHARS (cs) = 96;
826 #ifdef UTF2000
827       if (!EQ (decoding_table, Qnil))
828         {
829           size_t i;
830           CHARSET_TO_BYTE1_TABLE(cs) = make_byte_from_character_table();
831           for (i = 0; i < 96; i++)
832             {
833               Lisp_Object c = XVECTOR_DATA(decoding_table)[i];
834
835               if (!EQ (c, Qnil))
836                 put_byte_from_character_table (XCHAR (c), i + 32,
837                                                CHARSET_TO_BYTE1_TABLE(cs));
838             }
839         }
840       else
841         CHARSET_TO_BYTE1_TABLE(cs) = NULL;
842       CHARSET_TO_BYTE2_TABLE(cs) = NULL;
843 #endif
844       break;
845     case CHARSET_TYPE_94X94:
846       CHARSET_DIMENSION (cs) = 2;
847       CHARSET_CHARS (cs) = 94;
848 #ifdef UTF2000
849       CHARSET_TO_BYTE1_TABLE(cs) = NULL;
850       CHARSET_TO_BYTE2_TABLE(cs) = NULL;
851 #endif
852       break;
853     case CHARSET_TYPE_96X96:
854       CHARSET_DIMENSION (cs) = 2;
855       CHARSET_CHARS (cs) = 96;
856 #ifdef UTF2000
857       CHARSET_TO_BYTE1_TABLE(cs) = NULL;
858       CHARSET_TO_BYTE2_TABLE(cs) = NULL;
859 #endif
860       break;
861 #ifdef UTF2000
862     case CHARSET_TYPE_128X128:
863       CHARSET_DIMENSION (cs) = 2;
864       CHARSET_CHARS (cs) = 128;
865 #ifdef UTF2000
866       CHARSET_TO_BYTE1_TABLE(cs) = NULL;
867       CHARSET_TO_BYTE2_TABLE(cs) = NULL;
868 #endif
869       break;
870     case CHARSET_TYPE_256X256:
871       CHARSET_DIMENSION (cs) = 2;
872       CHARSET_CHARS (cs) = 256;
873 #ifdef UTF2000
874       CHARSET_TO_BYTE1_TABLE(cs) = NULL;
875       CHARSET_TO_BYTE2_TABLE(cs) = NULL;
876 #endif
877       break;
878 #endif
879     }
880
881 #ifndef UTF2000
882   if (id == LEADING_BYTE_ASCII)
883     CHARSET_REP_BYTES (cs) = 1;
884   else if (id < 0xA0)
885     CHARSET_REP_BYTES (cs) = CHARSET_DIMENSION (cs) + 1;
886   else
887     CHARSET_REP_BYTES (cs) = CHARSET_DIMENSION (cs) + 2;
888 #endif
889   
890   if (final)
891     {
892       /* some charsets do not have final characters.  This includes
893          ASCII, Control-1, Composite, and the two faux private
894          charsets. */
895 #if UTF2000
896       assert (NILP (charset_by_attributes[type][final]));
897       charset_by_attributes[type][final] = obj;
898 #else
899       assert (NILP (charset_by_attributes[type][final][direction]));
900       charset_by_attributes[type][final][direction] = obj;
901 #endif
902     }
903
904   assert (NILP (charset_by_leading_byte[id - MIN_LEADING_BYTE]));
905   charset_by_leading_byte[id - MIN_LEADING_BYTE] = obj;
906 #ifndef UTF2000
907   if (id < 0xA0)
908     /* official leading byte */
909     rep_bytes_by_first_byte[id] = CHARSET_REP_BYTES (cs);
910 #endif
911
912   /* Some charsets are "faux" and don't have names or really exist at
913      all except in the leading-byte table. */
914   if (!NILP (name))
915     Fputhash (name, obj, Vcharset_hash_table);
916   return obj;
917 }
918
919 static int
920 get_unallocated_leading_byte (int dimension)
921 {
922   Charset_ID lb;
923
924   if (dimension == 1)
925     {
926       if (next_allocated_1_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_1)
927         lb = 0;
928       else
929         lb = next_allocated_1_byte_leading_byte++;
930     }
931   else
932     {
933       if (next_allocated_2_byte_leading_byte > MAX_LEADING_BYTE_PRIVATE_2)
934         lb = 0;
935       else
936         lb = next_allocated_2_byte_leading_byte++;
937     }
938
939   if (!lb)
940     signal_simple_error
941       ("No more character sets free for this dimension",
942        make_int (dimension));
943
944   return lb;
945 }
946
947 #ifdef UTF2000
948 unsigned char
949 charset_get_byte1 (Lisp_Object charset, Emchar ch)
950 {
951   Emchar_to_byte_table* table;
952   int d;
953
954   if ((table = XCHARSET_TO_BYTE1_TABLE (charset)) != NULL)
955     return get_byte_from_character_table (ch, table);
956   else if ((CHARSET_UCS_MIN (XCHARSET (charset)) <= ch)
957            && (ch <= CHARSET_UCS_MAX (XCHARSET (charset))))
958     return ch - CHARSET_UCS_MIN (XCHARSET (charset))
959       +  CHARSET_CODE_OFFSET (XCHARSET (charset));
960   else if (XCHARSET_DIMENSION (charset) == 1)
961     {
962       if (XCHARSET_CHARS (charset) == 94)
963         {
964           if (((d = ch - (MIN_CHAR_94
965                           + (XCHARSET_FINAL (charset) - '0') * 94)) >= 0)
966               && (d < 94))
967             return d + 33;
968         }
969       else if (XCHARSET_CHARS (charset) == 96)
970         {
971           if (((d = ch - (MIN_CHAR_96
972                           + (XCHARSET_FINAL (charset) - '0') * 96)) >= 0)
973               && (d < 96))
974             return d + 32;
975         }
976       else
977         return 0;
978     }
979   else if (XCHARSET_DIMENSION (charset) == 2)
980     {
981       if (XCHARSET_CHARS (charset) == 94)
982         {
983           if (((d = ch - (MIN_CHAR_94x94
984                           + (XCHARSET_FINAL (charset) - '0') * 94 * 94)) >= 0)
985               && (d < 94 * 94))
986             return (d / 94) + 33;
987         }
988       else if (XCHARSET_CHARS (charset) == 96)
989         {
990           if (((d = ch - (MIN_CHAR_96x96
991                           + (XCHARSET_FINAL (charset) - '0') * 96 * 96)) >= 0)
992               && (d < 96 * 96))
993             return (d / 96) + 32;
994         }
995     }
996   return 0;
997 }
998
999 unsigned char
1000 charset_get_byte2 (Lisp_Object charset, Emchar ch)
1001 {
1002   if (XCHARSET_DIMENSION (charset) == 1)
1003     return 0;
1004   else
1005     {
1006       Emchar_to_byte_table* table;
1007
1008       if ((table = XCHARSET_TO_BYTE2_TABLE (charset)) != NULL)
1009         return get_byte_from_character_table (ch, table);
1010       else if (EQ (charset, Vcharset_ucs_bmp))
1011         return (ch >> 8) & 0xff;
1012       else if (XCHARSET_CHARS (charset) == 94)
1013         return (MIN_CHAR_94x94
1014                 + (XCHARSET_FINAL (charset) - '0') * 94 * 94 <= ch)
1015           && (ch < MIN_CHAR_94x94
1016               + (XCHARSET_FINAL (charset) - '0' + 1) * 94 * 94) ?
1017           ((ch - MIN_CHAR_94x94) % 94) + 33 : 0;
1018       else /* if (XCHARSET_CHARS (charset) == 96) */
1019         return (MIN_CHAR_96x96
1020                 + (XCHARSET_FINAL (charset) - '0') * 96 * 96 <= ch)
1021           && (ch < MIN_CHAR_96x96
1022               + (XCHARSET_FINAL (charset) - '0' + 1) * 96 * 96) ?
1023           ((ch - MIN_CHAR_96x96) % 96) + 32 : 0;
1024     }
1025 }
1026
1027 Lisp_Object Vdefault_coded_charset_priority_list;
1028 #endif
1029
1030 \f
1031 /************************************************************************/
1032 /*                      Basic charset Lisp functions                    */
1033 /************************************************************************/
1034
1035 DEFUN ("charsetp", Fcharsetp, 1, 1, 0, /*
1036 Return non-nil if OBJECT is a charset.
1037 */
1038        (object))
1039 {
1040   return CHARSETP (object) ? Qt : Qnil;
1041 }
1042
1043 DEFUN ("find-charset", Ffind_charset, 1, 1, 0, /*
1044 Retrieve the charset of the given name.
1045 If CHARSET-OR-NAME is a charset object, it is simply returned.
1046 Otherwise, CHARSET-OR-NAME should be a symbol.  If there is no such charset,
1047 nil is returned.  Otherwise the associated charset object is returned.
1048 */
1049        (charset_or_name))
1050 {
1051   if (CHARSETP (charset_or_name))
1052     return charset_or_name;
1053
1054   CHECK_SYMBOL (charset_or_name);
1055   return Fgethash (charset_or_name, Vcharset_hash_table, Qnil);
1056 }
1057
1058 DEFUN ("get-charset", Fget_charset, 1, 1, 0, /*
1059 Retrieve the charset of the given name.
1060 Same as `find-charset' except an error is signalled if there is no such
1061 charset instead of returning nil.
1062 */
1063        (name))
1064 {
1065   Lisp_Object charset = Ffind_charset (name);
1066
1067   if (NILP (charset))
1068     signal_simple_error ("No such charset", name);
1069   return charset;
1070 }
1071
1072 /* We store the charsets in hash tables with the names as the key and the
1073    actual charset object as the value.  Occasionally we need to use them
1074    in a list format.  These routines provide us with that. */
1075 struct charset_list_closure
1076 {
1077   Lisp_Object *charset_list;
1078 };
1079
1080 static int
1081 add_charset_to_list_mapper (Lisp_Object key, Lisp_Object value,
1082                             void *charset_list_closure)
1083 {
1084   /* This function can GC */
1085   struct charset_list_closure *chcl =
1086     (struct charset_list_closure*) charset_list_closure;
1087   Lisp_Object *charset_list = chcl->charset_list;
1088
1089   *charset_list = Fcons (XCHARSET_NAME (value), *charset_list);
1090   return 0;
1091 }
1092
1093 DEFUN ("charset-list", Fcharset_list, 0, 0, 0, /*
1094 Return a list of the names of all defined charsets.
1095 */
1096        ())
1097 {
1098   Lisp_Object charset_list = Qnil;
1099   struct gcpro gcpro1;
1100   struct charset_list_closure charset_list_closure;
1101
1102   GCPRO1 (charset_list);
1103   charset_list_closure.charset_list = &charset_list;
1104   elisp_maphash (add_charset_to_list_mapper, Vcharset_hash_table,
1105                  &charset_list_closure);
1106   UNGCPRO;
1107
1108   return charset_list;
1109 }
1110
1111 DEFUN ("charset-name", Fcharset_name, 1, 1, 0, /*
1112 Return the name of the given charset.
1113 */
1114        (charset))
1115 {
1116   return XCHARSET_NAME (Fget_charset (charset));
1117 }
1118
1119 DEFUN ("make-charset", Fmake_charset, 3, 3, 0, /*
1120 Define a new character set.
1121 This function is for use with Mule support.
1122 NAME is a symbol, the name by which the character set is normally referred.
1123 DOC-STRING is a string describing the character set.
1124 PROPS is a property list, describing the specific nature of the
1125 character set.  Recognized properties are:
1126
1127 'short-name     Short version of the charset name (ex: Latin-1)
1128 'long-name      Long version of the charset name (ex: ISO8859-1 (Latin-1))
1129 'registry       A regular expression matching the font registry field for
1130                 this character set.
1131 'dimension      Number of octets used to index a character in this charset.
1132                 Either 1 or 2.  Defaults to 1.
1133 'columns        Number of columns used to display a character in this charset.
1134                 Only used in TTY mode. (Under X, the actual width of a
1135                 character can be derived from the font used to display the
1136                 characters.) If unspecified, defaults to the dimension
1137                 (this is almost always the correct value).
1138 'chars          Number of characters in each dimension (94 or 96).
1139                 Defaults to 94.  Note that if the dimension is 2, the
1140                 character set thus described is 94x94 or 96x96.
1141 'final          Final byte of ISO 2022 escape sequence.  Must be
1142                 supplied.  Each combination of (DIMENSION, CHARS) defines a
1143                 separate namespace for final bytes.  Note that ISO
1144                 2022 restricts the final byte to the range
1145                 0x30 - 0x7E if dimension == 1, and 0x30 - 0x5F if
1146                 dimension == 2.  Note also that final bytes in the range
1147                 0x30 - 0x3F are reserved for user-defined (not official)
1148                 character sets.
1149 'graphic        0 (use left half of font on output) or 1 (use right half
1150                 of font on output).  Defaults to 0.  For example, for
1151                 a font whose registry is ISO8859-1, the left half
1152                 (octets 0x20 - 0x7F) is the `ascii' character set, while
1153                 the right half (octets 0xA0 - 0xFF) is the `latin-1'
1154                 character set.  With 'graphic set to 0, the octets
1155                 will have their high bit cleared; with it set to 1,
1156                 the octets will have their high bit set.
1157 'direction      'l2r (left-to-right) or 'r2l (right-to-left).
1158                 Defaults to 'l2r.
1159 'ccl-program    A compiled CCL program used to convert a character in
1160                 this charset into an index into the font.  This is in
1161                 addition to the 'graphic property.  The CCL program
1162                 is passed the octets of the character, with the high
1163                 bit cleared and set depending upon whether the value
1164                 of the 'graphic property is 0 or 1.
1165 */
1166        (name, doc_string, props))
1167 {
1168   int id, dimension = 1, chars = 94, graphic = 0, final = 0, columns = -1;
1169   int direction = CHARSET_LEFT_TO_RIGHT;
1170   int type;
1171   Lisp_Object registry = Qnil;
1172   Lisp_Object charset;
1173   Lisp_Object rest, keyword, value;
1174   Lisp_Object ccl_program = Qnil;
1175   Lisp_Object short_name = Qnil, long_name = Qnil;
1176
1177   CHECK_SYMBOL (name);
1178   if (!NILP (doc_string))
1179     CHECK_STRING (doc_string);
1180
1181   charset = Ffind_charset (name);
1182   if (!NILP (charset))
1183     signal_simple_error ("Cannot redefine existing charset", name);
1184
1185   EXTERNAL_PROPERTY_LIST_LOOP (rest, keyword, value, props)
1186     {
1187       if (EQ (keyword, Qshort_name))
1188         {
1189           CHECK_STRING (value);
1190           short_name = value;
1191         }
1192
1193       if (EQ (keyword, Qlong_name))
1194         {
1195           CHECK_STRING (value);
1196           long_name = value;
1197         }
1198
1199       else if (EQ (keyword, Qdimension))
1200         {
1201           CHECK_INT (value);
1202           dimension = XINT (value);
1203           if (dimension < 1 || dimension > 2)
1204             signal_simple_error ("Invalid value for 'dimension", value);
1205         }
1206
1207       else if (EQ (keyword, Qchars))
1208         {
1209           CHECK_INT (value);
1210           chars = XINT (value);
1211           if (chars != 94 && chars != 96)
1212             signal_simple_error ("Invalid value for 'chars", value);
1213         }
1214
1215       else if (EQ (keyword, Qcolumns))
1216         {
1217           CHECK_INT (value);
1218           columns = XINT (value);
1219           if (columns != 1 && columns != 2)
1220             signal_simple_error ("Invalid value for 'columns", value);
1221         }
1222
1223       else if (EQ (keyword, Qgraphic))
1224         {
1225           CHECK_INT (value);
1226           graphic = XINT (value);
1227           if (graphic < 0 || graphic > 1)
1228             signal_simple_error ("Invalid value for 'graphic", value);
1229         }
1230
1231       else if (EQ (keyword, Qregistry))
1232         {
1233           CHECK_STRING (value);
1234           registry = value;
1235         }
1236
1237       else if (EQ (keyword, Qdirection))
1238         {
1239           if (EQ (value, Ql2r))
1240             direction = CHARSET_LEFT_TO_RIGHT;
1241           else if (EQ (value, Qr2l))
1242             direction = CHARSET_RIGHT_TO_LEFT;
1243           else
1244             signal_simple_error ("Invalid value for 'direction", value);
1245         }
1246
1247       else if (EQ (keyword, Qfinal))
1248         {
1249           CHECK_CHAR_COERCE_INT (value);
1250           final = XCHAR (value);
1251           if (final < '0' || final > '~')
1252             signal_simple_error ("Invalid value for 'final", value);
1253         }
1254
1255       else if (EQ (keyword, Qccl_program))
1256         {
1257           CHECK_VECTOR (value);
1258           ccl_program = value;
1259         }
1260
1261       else
1262         signal_simple_error ("Unrecognized property", keyword);
1263     }
1264
1265   if (!final)
1266     error ("'final must be specified");
1267   if (dimension == 2 && final > 0x5F)
1268     signal_simple_error
1269       ("Final must be in the range 0x30 - 0x5F for dimension == 2",
1270        make_char (final));
1271
1272   if (dimension == 1)
1273     type = (chars == 94) ? CHARSET_TYPE_94    : CHARSET_TYPE_96;
1274   else
1275     type = (chars == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
1276
1277   if (!NILP (CHARSET_BY_ATTRIBUTES (type, final, CHARSET_LEFT_TO_RIGHT)) ||
1278       !NILP (CHARSET_BY_ATTRIBUTES (type, final, CHARSET_RIGHT_TO_LEFT)))
1279     error
1280       ("Character set already defined for this DIMENSION/CHARS/FINAL combo");
1281
1282 #ifdef UTF2000
1283   if (dimension == 1)
1284     {
1285       if (chars == 94)
1286         {
1287           /* id = CHARSET_ID_OFFSET_94 + final; */
1288           id = get_unallocated_leading_byte (dimension);
1289         }
1290       else if (chars == 96)
1291         {
1292           id = get_unallocated_leading_byte (dimension);
1293         }
1294       else
1295         {
1296           abort ();
1297         }
1298     }
1299   else if (dimension == 2)
1300     {
1301       if (chars == 94)
1302         {
1303           id = get_unallocated_leading_byte (dimension);
1304         }
1305       else if (chars == 96)
1306         {
1307           id = get_unallocated_leading_byte (dimension);
1308         }
1309       else
1310         {
1311           abort ();
1312         }
1313     }
1314   else
1315     {
1316       abort ();
1317     }
1318 #else
1319   id = get_unallocated_leading_byte (dimension);
1320 #endif
1321
1322   if (NILP (doc_string))
1323     doc_string = build_string ("");
1324
1325   if (NILP (registry))
1326     registry = build_string ("");
1327
1328   if (NILP (short_name))
1329     XSETSTRING (short_name, XSYMBOL (name)->name);
1330
1331   if (NILP (long_name))
1332     long_name = doc_string;
1333
1334   if (columns == -1)
1335     columns = dimension;
1336   charset = make_charset (id, name, type, columns, graphic,
1337                           final, direction, short_name, long_name,
1338                           doc_string, registry,
1339                           Qnil, 0, 0, 0);
1340   if (!NILP (ccl_program))
1341     XCHARSET_CCL_PROGRAM (charset) = ccl_program;
1342   return charset;
1343 }
1344
1345 DEFUN ("make-reverse-direction-charset", Fmake_reverse_direction_charset,
1346        2, 2, 0, /*
1347 Make a charset equivalent to CHARSET but which goes in the opposite direction.
1348 NEW-NAME is the name of the new charset.  Return the new charset.
1349 */
1350        (charset, new_name))
1351 {
1352   Lisp_Object new_charset = Qnil;
1353   int id, dimension, columns, graphic, final;
1354   int direction, type;
1355   Lisp_Object registry, doc_string, short_name, long_name;
1356   struct Lisp_Charset *cs;
1357
1358   charset = Fget_charset (charset);
1359   if (!NILP (XCHARSET_REVERSE_DIRECTION_CHARSET (charset)))
1360     signal_simple_error ("Charset already has reverse-direction charset",
1361                          charset);
1362
1363   CHECK_SYMBOL (new_name);
1364   if (!NILP (Ffind_charset (new_name)))
1365     signal_simple_error ("Cannot redefine existing charset", new_name);
1366
1367   cs = XCHARSET (charset);
1368
1369   type      = CHARSET_TYPE      (cs);
1370   columns   = CHARSET_COLUMNS   (cs);
1371   dimension = CHARSET_DIMENSION (cs);
1372   id = get_unallocated_leading_byte (dimension);
1373
1374   graphic = CHARSET_GRAPHIC (cs);
1375   final = CHARSET_FINAL (cs);
1376   direction = CHARSET_RIGHT_TO_LEFT;
1377   if (CHARSET_DIRECTION (cs) == CHARSET_RIGHT_TO_LEFT)
1378     direction = CHARSET_LEFT_TO_RIGHT;
1379   doc_string = CHARSET_DOC_STRING (cs);
1380   short_name = CHARSET_SHORT_NAME (cs);
1381   long_name = CHARSET_LONG_NAME (cs);
1382   registry = CHARSET_REGISTRY (cs);
1383
1384   new_charset = make_charset (id, new_name, type, columns,
1385                               graphic, final, direction, short_name, long_name,
1386                               doc_string, registry,
1387 #ifdef UTF2000
1388                               CHARSET_DECODING_TABLE(cs),
1389                               CHARSET_UCS_MIN(cs),
1390                               CHARSET_UCS_MAX(cs),
1391                               CHARSET_CODE_OFFSET(cs)
1392 #else
1393                               Qnil, 0, 0, 0
1394 #endif
1395 );
1396
1397   CHARSET_REVERSE_DIRECTION_CHARSET (cs) = new_charset;
1398   XCHARSET_REVERSE_DIRECTION_CHARSET (new_charset) = charset;
1399
1400   return new_charset;
1401 }
1402
1403 /* #### Reverse direction charsets not yet implemented.  */
1404 #if 0
1405 DEFUN ("charset-reverse-direction-charset", Fcharset_reverse_direction_charset,
1406        1, 1, 0, /*
1407 Return the reverse-direction charset parallel to CHARSET, if any.
1408 This is the charset with the same properties (in particular, the same
1409 dimension, number of characters per dimension, and final byte) as
1410 CHARSET but whose characters are displayed in the opposite direction.
1411 */
1412        (charset))
1413 {
1414   charset = Fget_charset (charset);
1415   return XCHARSET_REVERSE_DIRECTION_CHARSET (charset);
1416 }
1417 #endif
1418
1419 DEFUN ("charset-from-attributes", Fcharset_from_attributes, 3, 4, 0, /*
1420 Return a charset with the given DIMENSION, CHARS, FINAL, and DIRECTION.
1421 If DIRECTION is omitted, both directions will be checked (left-to-right
1422 will be returned if character sets exist for both directions).
1423 */
1424        (dimension, chars, final, direction))
1425 {
1426   int dm, ch, fi, di = -1;
1427   int type;
1428   Lisp_Object obj = Qnil;
1429
1430   CHECK_INT (dimension);
1431   dm = XINT (dimension);
1432   if (dm < 1 || dm > 2)
1433     signal_simple_error ("Invalid value for DIMENSION", dimension);
1434
1435   CHECK_INT (chars);
1436   ch = XINT (chars);
1437   if (ch != 94 && ch != 96)
1438     signal_simple_error ("Invalid value for CHARS", chars);
1439
1440   CHECK_CHAR_COERCE_INT (final);
1441   fi = XCHAR (final);
1442   if (fi < '0' || fi > '~')
1443     signal_simple_error ("Invalid value for FINAL", final);
1444
1445   if (EQ (direction, Ql2r))
1446     di = CHARSET_LEFT_TO_RIGHT;
1447   else if (EQ (direction, Qr2l))
1448     di = CHARSET_RIGHT_TO_LEFT;
1449   else if (!NILP (direction))
1450     signal_simple_error ("Invalid value for DIRECTION", direction);
1451
1452   if (dm == 2 && fi > 0x5F)
1453     signal_simple_error
1454       ("Final must be in the range 0x30 - 0x5F for dimension == 2", final);
1455
1456   if (dm == 1)
1457     type = (ch == 94) ? CHARSET_TYPE_94    : CHARSET_TYPE_96;
1458   else
1459     type = (ch == 94) ? CHARSET_TYPE_94X94 : CHARSET_TYPE_96X96;
1460
1461   if (di == -1)
1462     {
1463       obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_LEFT_TO_RIGHT);
1464       if (NILP (obj))
1465         obj = CHARSET_BY_ATTRIBUTES (type, fi, CHARSET_RIGHT_TO_LEFT);
1466     }
1467   else
1468     obj = CHARSET_BY_ATTRIBUTES (type, fi, di);
1469
1470   if (CHARSETP (obj))
1471     return XCHARSET_NAME (obj);
1472   return obj;
1473 }
1474
1475 DEFUN ("charset-short-name", Fcharset_short_name, 1, 1, 0, /*
1476 Return short name of CHARSET.
1477 */
1478        (charset))
1479 {
1480   return XCHARSET_SHORT_NAME (Fget_charset (charset));
1481 }
1482
1483 DEFUN ("charset-long-name", Fcharset_long_name, 1, 1, 0, /*
1484 Return long name of CHARSET.
1485 */
1486        (charset))
1487 {
1488   return XCHARSET_LONG_NAME (Fget_charset (charset));
1489 }
1490
1491 DEFUN ("charset-description", Fcharset_description, 1, 1, 0, /*
1492 Return description of CHARSET.
1493 */
1494        (charset))
1495 {
1496   return XCHARSET_DOC_STRING (Fget_charset (charset));
1497 }
1498
1499 DEFUN ("charset-dimension", Fcharset_dimension, 1, 1, 0, /*
1500 Return dimension of CHARSET.
1501 */
1502        (charset))
1503 {
1504   return make_int (XCHARSET_DIMENSION (Fget_charset (charset)));
1505 }
1506
1507 DEFUN ("charset-property", Fcharset_property, 2, 2, 0, /*
1508 Return property PROP of CHARSET.
1509 Recognized properties are those listed in `make-charset', as well as
1510 'name and 'doc-string.
1511 */
1512        (charset, prop))
1513 {
1514   struct Lisp_Charset *cs;
1515
1516   charset = Fget_charset (charset);
1517   cs = XCHARSET (charset);
1518
1519   CHECK_SYMBOL (prop);
1520   if (EQ (prop, Qname))        return CHARSET_NAME (cs);
1521   if (EQ (prop, Qshort_name))  return CHARSET_SHORT_NAME (cs);
1522   if (EQ (prop, Qlong_name))   return CHARSET_LONG_NAME (cs);
1523   if (EQ (prop, Qdoc_string))  return CHARSET_DOC_STRING (cs);
1524   if (EQ (prop, Qdimension))   return make_int (CHARSET_DIMENSION (cs));
1525   if (EQ (prop, Qcolumns))     return make_int (CHARSET_COLUMNS (cs));
1526   if (EQ (prop, Qgraphic))     return make_int (CHARSET_GRAPHIC (cs));
1527   if (EQ (prop, Qfinal))       return make_char (CHARSET_FINAL (cs));
1528   if (EQ (prop, Qchars))       return make_int (CHARSET_CHARS (cs));
1529   if (EQ (prop, Qregistry))    return CHARSET_REGISTRY (cs);
1530   if (EQ (prop, Qccl_program)) return CHARSET_CCL_PROGRAM (cs);
1531   if (EQ (prop, Qdirection))
1532     return CHARSET_DIRECTION (cs) == CHARSET_LEFT_TO_RIGHT ? Ql2r : Qr2l;
1533   if (EQ (prop, Qreverse_direction_charset))
1534     {
1535       Lisp_Object obj = CHARSET_REVERSE_DIRECTION_CHARSET (cs);
1536       if (NILP (obj))
1537         return Qnil;
1538       else
1539         return XCHARSET_NAME (obj);
1540     }
1541   signal_simple_error ("Unrecognized charset property name", prop);
1542   return Qnil; /* not reached */
1543 }
1544
1545 DEFUN ("charset-id", Fcharset_id, 1, 1, 0, /*
1546 Return charset identification number of CHARSET.
1547 */
1548         (charset))
1549 {
1550   return make_int(XCHARSET_LEADING_BYTE (Fget_charset (charset)));
1551 }
1552
1553 /* #### We need to figure out which properties we really want to
1554    allow to be set. */
1555
1556 DEFUN ("set-charset-ccl-program", Fset_charset_ccl_program, 2, 2, 0, /*
1557 Set the 'ccl-program property of CHARSET to CCL-PROGRAM.
1558 */
1559        (charset, ccl_program))
1560 {
1561   charset = Fget_charset (charset);
1562   CHECK_VECTOR (ccl_program);
1563   XCHARSET_CCL_PROGRAM (charset) = ccl_program;
1564   return Qnil;
1565 }
1566
1567 static void
1568 invalidate_charset_font_caches (Lisp_Object charset)
1569 {
1570   /* Invalidate font cache entries for charset on all devices. */
1571   Lisp_Object devcons, concons, hash_table;
1572   DEVICE_LOOP_NO_BREAK (devcons, concons)
1573     {
1574       struct device *d = XDEVICE (XCAR (devcons));
1575       hash_table = Fgethash (charset, d->charset_font_cache, Qunbound);
1576       if (!UNBOUNDP (hash_table))
1577         Fclrhash (hash_table);
1578     }
1579 }
1580
1581 DEFUN ("set-charset-registry", Fset_charset_registry, 2, 2, 0, /*
1582 Set the 'registry property of CHARSET to REGISTRY.
1583 */
1584        (charset, registry))
1585 {
1586   charset = Fget_charset (charset);
1587   CHECK_STRING (registry);
1588   XCHARSET_REGISTRY (charset) = registry;
1589   invalidate_charset_font_caches (charset);
1590   face_property_was_changed (Vdefault_face, Qfont, Qglobal);
1591   return Qnil;
1592 }
1593
1594 #ifdef UTF2000
1595 DEFUN ("charset-mapping-table", Fcharset_mapping_table, 1, 1, 0, /*
1596 Set the 'registry property of CHARSET to REGISTRY.
1597 */
1598        (charset))
1599 {
1600   return XCHARSET_DECODING_TABLE (Fget_charset (charset));
1601 }
1602 #endif
1603
1604 \f
1605 /************************************************************************/
1606 /*              Lisp primitives for working with characters             */
1607 /************************************************************************/
1608
1609 DEFUN ("make-char", Fmake_char, 2, 3, 0, /*
1610 Make a character from CHARSET and octets ARG1 and ARG2.
1611 ARG2 is required only for characters from two-dimensional charsets.
1612 For example, (make-char 'latin-iso8859-2 185) will return the Latin 2
1613 character s with caron.
1614 */
1615        (charset, arg1, arg2))
1616 {
1617   struct Lisp_Charset *cs;
1618   int a1, a2;
1619   int lowlim, highlim;
1620
1621   charset = Fget_charset (charset);
1622   cs = XCHARSET (charset);
1623
1624   if      (EQ (charset, Vcharset_ascii))     lowlim =  0, highlim = 127;
1625   else if (EQ (charset, Vcharset_control_1)) lowlim =  0, highlim =  31;
1626 #ifdef UTF2000
1627   else if (CHARSET_CHARS (cs) == 256)        lowlim =  0, highlim = 255;
1628 #endif
1629   else if (CHARSET_CHARS (cs) == 94)         lowlim = 33, highlim = 126;
1630   else  /* CHARSET_CHARS (cs) == 96) */      lowlim = 32, highlim = 127;
1631
1632   CHECK_INT (arg1);
1633   /* It is useful (and safe, according to Olivier Galibert) to strip
1634      the 8th bit off ARG1 and ARG2 becaue it allows programmers to
1635      write (make-char 'latin-iso8859-2 CODE) where code is the actual
1636      Latin 2 code of the character.  */
1637 #ifdef UTF2000
1638   a1 = XINT (arg1);
1639   if (highlim < 128)
1640     a1 &= 0x7f;
1641 #else
1642   a1 = XINT (arg1);
1643 #endif
1644   if (a1 < lowlim || a1 > highlim)
1645     args_out_of_range_3 (arg1, make_int (lowlim), make_int (highlim));
1646
1647   if (CHARSET_DIMENSION (cs) == 1)
1648     {
1649       if (!NILP (arg2))
1650         signal_simple_error
1651           ("Charset is of dimension one; second octet must be nil", arg2);
1652       return make_char (MAKE_CHAR (charset, a1, 0));
1653     }
1654
1655   CHECK_INT (arg2);
1656 #ifdef UTF2000
1657   a2 = XINT (arg2);
1658   if (highlim < 128)
1659     a2 &= 0x7f;
1660 #else
1661   a2 = XINT (arg2) & 0x7f;
1662 #endif
1663   if (a2 < lowlim || a2 > highlim)
1664     args_out_of_range_3 (arg2, make_int (lowlim), make_int (highlim));
1665
1666   return make_char (MAKE_CHAR (charset, a1, a2));
1667 }
1668
1669 DEFUN ("char-charset", Fchar_charset, 1, 1, 0, /*
1670 Return the character set of char CH.
1671 */
1672        (ch))
1673 {
1674   CHECK_CHAR_COERCE_INT (ch);
1675
1676   return XCHARSET_NAME (CHAR_CHARSET (XCHAR (ch)));
1677 }
1678
1679 DEFUN ("split-char", Fsplit_char, 1, 1, 0, /*
1680 Return list of charset and one or two position-codes of CHAR.
1681 */
1682        (character))
1683 {
1684   /* This function can GC */
1685   struct gcpro gcpro1, gcpro2;
1686   Lisp_Object charset = Qnil;
1687   Lisp_Object rc = Qnil;
1688   int c1, c2;
1689
1690   GCPRO2 (charset, rc);
1691   CHECK_CHAR_COERCE_INT (character);
1692
1693   BREAKUP_CHAR (XCHAR (character), charset, c1, c2);
1694
1695   if (XCHARSET_DIMENSION (Fget_charset (charset)) == 2)
1696     {
1697       rc = list3 (XCHARSET_NAME (charset), make_int (c1), make_int (c2));
1698     }
1699   else
1700     {
1701       rc = list2 (XCHARSET_NAME (charset), make_int (c1));
1702     }
1703   UNGCPRO;
1704
1705   return rc;
1706 }
1707
1708 \f
1709 #ifdef ENABLE_COMPOSITE_CHARS
1710 /************************************************************************/
1711 /*                     composite character functions                    */
1712 /************************************************************************/
1713
1714 Emchar
1715 lookup_composite_char (Bufbyte *str, int len)
1716 {
1717   Lisp_Object lispstr = make_string (str, len);
1718   Lisp_Object ch = Fgethash (lispstr,
1719                              Vcomposite_char_string2char_hash_table,
1720                              Qunbound);
1721   Emchar emch;
1722
1723   if (UNBOUNDP (ch))
1724     {
1725       if (composite_char_row_next >= 128)
1726         signal_simple_error ("No more composite chars available", lispstr);
1727       emch = MAKE_CHAR (Vcharset_composite, composite_char_row_next,
1728                         composite_char_col_next);
1729       Fputhash (make_char (emch), lispstr,
1730                 Vcomposite_char_char2string_hash_table);
1731       Fputhash (lispstr, make_char (emch),
1732                 Vcomposite_char_string2char_hash_table);
1733       composite_char_col_next++;
1734       if (composite_char_col_next >= 128)
1735         {
1736           composite_char_col_next = 32;
1737           composite_char_row_next++;
1738         }
1739     }
1740   else
1741     emch = XCHAR (ch);
1742   return emch;
1743 }
1744
1745 Lisp_Object
1746 composite_char_string (Emchar ch)
1747 {
1748   Lisp_Object str = Fgethash (make_char (ch),
1749                               Vcomposite_char_char2string_hash_table,
1750                               Qunbound);
1751   assert (!UNBOUNDP (str));
1752   return str;
1753 }
1754
1755 xxDEFUN ("make-composite-char", Fmake_composite_char, 1, 1, 0, /*
1756 Convert a string into a single composite character.
1757 The character is the result of overstriking all the characters in
1758 the string.
1759 */
1760        (string))
1761 {
1762   CHECK_STRING (string);
1763   return make_char (lookup_composite_char (XSTRING_DATA (string),
1764                                            XSTRING_LENGTH (string)));
1765 }
1766
1767 xxDEFUN ("composite-char-string", Fcomposite_char_string, 1, 1, 0, /*
1768 Return a string of the characters comprising a composite character.
1769 */
1770        (ch))
1771 {
1772   Emchar emch;
1773
1774   CHECK_CHAR (ch);
1775   emch = XCHAR (ch);
1776   if (CHAR_LEADING_BYTE (emch) != LEADING_BYTE_COMPOSITE)
1777     signal_simple_error ("Must be composite char", ch);
1778   return composite_char_string (emch);
1779 }
1780 #endif /* ENABLE_COMPOSITE_CHARS */
1781
1782 \f
1783 /************************************************************************/
1784 /*                            initialization                            */
1785 /************************************************************************/
1786
1787 void
1788 syms_of_mule_charset (void)
1789 {
1790   DEFSUBR (Fcharsetp);
1791   DEFSUBR (Ffind_charset);
1792   DEFSUBR (Fget_charset);
1793   DEFSUBR (Fcharset_list);
1794   DEFSUBR (Fcharset_name);
1795   DEFSUBR (Fmake_charset);
1796   DEFSUBR (Fmake_reverse_direction_charset);
1797   /*  DEFSUBR (Freverse_direction_charset); */
1798   DEFSUBR (Fcharset_from_attributes);
1799   DEFSUBR (Fcharset_short_name);
1800   DEFSUBR (Fcharset_long_name);
1801   DEFSUBR (Fcharset_description);
1802   DEFSUBR (Fcharset_dimension);
1803   DEFSUBR (Fcharset_property);
1804   DEFSUBR (Fcharset_id);
1805   DEFSUBR (Fset_charset_ccl_program);
1806   DEFSUBR (Fset_charset_registry);
1807 #ifdef UTF2000
1808   DEFSUBR (Fcharset_mapping_table);
1809 #endif
1810
1811   DEFSUBR (Fmake_char);
1812   DEFSUBR (Fchar_charset);
1813   DEFSUBR (Fsplit_char);
1814
1815 #ifdef ENABLE_COMPOSITE_CHARS
1816   DEFSUBR (Fmake_composite_char);
1817   DEFSUBR (Fcomposite_char_string);
1818 #endif
1819
1820   defsymbol (&Qcharsetp, "charsetp");
1821   defsymbol (&Qregistry, "registry");
1822   defsymbol (&Qfinal, "final");
1823   defsymbol (&Qgraphic, "graphic");
1824   defsymbol (&Qdirection, "direction");
1825   defsymbol (&Qreverse_direction_charset, "reverse-direction-charset");
1826   defsymbol (&Qshort_name, "short-name");
1827   defsymbol (&Qlong_name, "long-name");
1828
1829   defsymbol (&Ql2r, "l2r");
1830   defsymbol (&Qr2l, "r2l");
1831
1832   /* Charsets, compatible with FSF 20.3
1833      Naming convention is Script-Charset[-Edition] */
1834   defsymbol (&Qascii,                   "ascii");
1835   defsymbol (&Qcontrol_1,               "control-1");
1836   defsymbol (&Qlatin_iso8859_1,         "latin-iso8859-1");
1837   defsymbol (&Qlatin_iso8859_2,         "latin-iso8859-2");
1838   defsymbol (&Qlatin_iso8859_3,         "latin-iso8859-3");
1839   defsymbol (&Qlatin_iso8859_4,         "latin-iso8859-4");
1840   defsymbol (&Qthai_tis620,             "thai-tis620");
1841   defsymbol (&Qgreek_iso8859_7,         "greek-iso8859-7");
1842   defsymbol (&Qarabic_iso8859_6,        "arabic-iso8859-6");
1843   defsymbol (&Qhebrew_iso8859_8,        "hebrew-iso8859-8");
1844   defsymbol (&Qkatakana_jisx0201,       "katakana-jisx0201");
1845   defsymbol (&Qlatin_jisx0201,          "latin-jisx0201");
1846   defsymbol (&Qcyrillic_iso8859_5,      "cyrillic-iso8859-5");
1847   defsymbol (&Qlatin_iso8859_9,         "latin-iso8859-9");
1848   defsymbol (&Qjapanese_jisx0208_1978,  "japanese-jisx0208-1978");
1849   defsymbol (&Qchinese_gb2312,          "chinese-gb2312");
1850   defsymbol (&Qjapanese_jisx0208,       "japanese-jisx0208");
1851   defsymbol (&Qkorean_ksc5601,          "korean-ksc5601");
1852   defsymbol (&Qjapanese_jisx0212,       "japanese-jisx0212");
1853   defsymbol (&Qchinese_cns11643_1,      "chinese-cns11643-1");
1854   defsymbol (&Qchinese_cns11643_2,      "chinese-cns11643-2");
1855 #ifdef UTF2000
1856   defsymbol (&Qucs_bmp,                 "ucs-bmp");
1857   defsymbol (&Qlatin_viscii_lower,      "vietnamese-viscii-lower");
1858   defsymbol (&Qlatin_viscii_upper,      "vietnamese-viscii-upper");
1859 #endif
1860   defsymbol (&Qchinese_big5_1,          "chinese-big5-1");
1861   defsymbol (&Qchinese_big5_2,          "chinese-big5-2");
1862
1863   defsymbol (&Qcomposite,               "composite");
1864 }
1865
1866 void
1867 vars_of_mule_charset (void)
1868 {
1869   int i, j;
1870 #ifndef UTF2000
1871   int k;
1872 #endif
1873
1874   /* Table of charsets indexed by leading byte. */
1875   for (i = 0; i < countof (charset_by_leading_byte); i++)
1876     charset_by_leading_byte[i] = Qnil;
1877
1878 #ifdef UTF2000
1879   /* Table of charsets indexed by type/final-byte. */
1880   for (i = 0; i < countof (charset_by_attributes); i++)
1881     for (j = 0; j < countof (charset_by_attributes[0]); j++)
1882         charset_by_attributes[i][j] = Qnil;
1883 #else
1884   /* Table of charsets indexed by type/final-byte/direction. */
1885   for (i = 0; i < countof (charset_by_attributes); i++)
1886     for (j = 0; j < countof (charset_by_attributes[0]); j++)
1887       for (k = 0; k < countof (charset_by_attributes[0][0]); k++)
1888         charset_by_attributes[i][j][k] = Qnil;
1889 #endif
1890
1891   next_allocated_1_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_1;
1892 #ifdef UTF2000
1893   next_allocated_2_byte_leading_byte = LEADING_BYTE_CHINESE_BIG5_2 + 1;
1894 #else
1895   next_allocated_2_byte_leading_byte = MIN_LEADING_BYTE_PRIVATE_2;
1896 #endif
1897
1898 #ifndef UTF2000
1899   leading_code_private_11 = PRE_LEADING_BYTE_PRIVATE_1;
1900   DEFVAR_INT ("leading-code-private-11", &leading_code_private_11 /*
1901 Leading-code of private TYPE9N charset of column-width 1.
1902 */ );
1903   leading_code_private_11 = PRE_LEADING_BYTE_PRIVATE_1;
1904 #endif
1905
1906 #ifdef UTF2000
1907   Vutf_2000_version = build_string("0.8 (Kami)");
1908   DEFVAR_LISP ("utf-2000-version", &Vutf_2000_version /*
1909 Version number of UTF-2000.
1910 */ );
1911
1912   Vdefault_coded_charset_priority_list = Qnil;
1913   DEFVAR_LISP ("default-coded-charset-priority-list",
1914                &Vdefault_coded_charset_priority_list /*
1915 Default order of preferred coded-character-set.
1916 */ );
1917 #endif
1918 }
1919
1920 void
1921 complex_vars_of_mule_charset (void)
1922 {
1923   staticpro (&Vcharset_hash_table);
1924   Vcharset_hash_table =
1925     make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
1926
1927   /* Predefined character sets.  We store them into variables for
1928      ease of access. */
1929
1930 #ifdef UTF2000
1931   staticpro (&latin_jisx0201_to_ucs);
1932   latin_jisx0201_to_ucs = make_vector (94, Qnil);
1933   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x21 - 33]
1934     = make_char (0x0021) /* EXCLAMATION MARK */;
1935   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x22 - 33]
1936     = make_char (0x0022) /* QUOTATION MARK */;
1937   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x23 - 33]
1938     = make_char (0x0023) /* NUMBER SIGN */;
1939   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x24 - 33]
1940     = make_char (0x0024) /* DOLLAR SIGN */;
1941   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x25 - 33]
1942     = make_char (0x0025) /* PERCENT SIGN */;
1943   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x26 - 33]
1944     = make_char (0x0026) /* AMPERSAND */;
1945   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x27 - 33]
1946     = make_char (0x0027) /* APOSTROPHE */;
1947   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x28 - 33]
1948     = make_char (0x0028) /* LEFT PARENTHESIS */;
1949   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x29 - 33]
1950     = make_char (0x0029) /* RIGHT PARENTHESIS */;
1951   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x2A - 33]
1952     = make_char (0x002A) /* ASTERISK */;
1953   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x2B - 33]
1954     = make_char (0x002B) /* PLUS SIGN */;
1955   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x2C - 33]
1956     = make_char (0x002C) /* COMMA */;
1957   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x2D - 33]
1958     = make_char (0x002D) /* HYPHEN-MINUS */;
1959   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x2E - 33]
1960     = make_char (0x002E) /* FULL STOP */;
1961   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x2F - 33]
1962     = make_char (0x002F) /* SOLIDUS */;
1963   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x30 - 33]
1964     = make_char (0x0030) /* DIGIT ZERO */;
1965   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x31 - 33]
1966     = make_char (0x0031) /* DIGIT ONE */;
1967   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x32 - 33]
1968     = make_char (0x0032) /* DIGIT TWO */;
1969   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x33 - 33]
1970     = make_char (0x0033) /* DIGIT THREE */;
1971   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x34 - 33]
1972     = make_char (0x0034) /* DIGIT FOUR */;
1973   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x35 - 33]
1974     = make_char (0x0035) /* DIGIT FIVE */;
1975   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x36 - 33]
1976     = make_char (0x0036) /* DIGIT SIX */;
1977   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x37 - 33]
1978     = make_char (0x0037) /* DIGIT SEVEN */;
1979   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x38 - 33]
1980     = make_char (0x0038) /* DIGIT EIGHT */;
1981   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x39 - 33]
1982     = make_char (0x0039) /* DIGIT NINE */;
1983   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x3A - 33]
1984     = make_char (0x003A) /* COLON */;
1985   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x3B - 33]
1986     = make_char (0x003B) /* SEMICOLON */;
1987   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x3C - 33]
1988     = make_char (0x003C) /* LESS-THAN SIGN */;
1989   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x3D - 33]
1990     = make_char (0x003D) /* EQUALS SIGN */;
1991   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x3E - 33]
1992     = make_char (0x003E) /* GREATER-THAN SIGN */;
1993   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x3F - 33]
1994     = make_char (0x003F) /* QUESTION MARK */;
1995   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x40 - 33]
1996     = make_char (0x0040) /* COMMERCIAL AT */;
1997   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x41 - 33]
1998     = make_char (0x0041) /* LATIN CAPITAL LETTER A */;
1999   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x42 - 33]
2000     = make_char (0x0042) /* LATIN CAPITAL LETTER B */;
2001   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x43 - 33]
2002     = make_char (0x0043) /* LATIN CAPITAL LETTER C */;
2003   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x44 - 33]
2004     = make_char (0x0044) /* LATIN CAPITAL LETTER D */;
2005   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x45 - 33]
2006     = make_char (0x0045) /* LATIN CAPITAL LETTER E */;
2007   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x46 - 33]
2008     = make_char (0x0046) /* LATIN CAPITAL LETTER F */;
2009   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x47 - 33]
2010     = make_char (0x0047) /* LATIN CAPITAL LETTER G */;
2011   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x48 - 33]
2012     = make_char (0x0048) /* LATIN CAPITAL LETTER H */;
2013   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x49 - 33]
2014     = make_char (0x0049) /* LATIN CAPITAL LETTER I */;
2015   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x4A - 33]
2016     = make_char (0x004A) /* LATIN CAPITAL LETTER J */;
2017   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x4B - 33]
2018     = make_char (0x004B) /* LATIN CAPITAL LETTER K */;
2019   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x4C - 33]
2020     = make_char (0x004C) /* LATIN CAPITAL LETTER L */;
2021   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x4D - 33]
2022     = make_char (0x004D) /* LATIN CAPITAL LETTER M */;
2023   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x4E - 33]
2024     = make_char (0x004E) /* LATIN CAPITAL LETTER N */;
2025   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x4F - 33]
2026     = make_char (0x004F) /* LATIN CAPITAL LETTER O */;
2027   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x50 - 33]
2028     = make_char (0x0050) /* LATIN CAPITAL LETTER P */;
2029   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x51 - 33]
2030     = make_char (0x0051) /* LATIN CAPITAL LETTER Q */;
2031   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x52 - 33]
2032     = make_char (0x0052) /* LATIN CAPITAL LETTER R */;
2033   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x53 - 33]
2034     = make_char (0x0053) /* LATIN CAPITAL LETTER S */;
2035   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x54 - 33]
2036     = make_char (0x0054) /* LATIN CAPITAL LETTER T */;
2037   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x55 - 33]
2038     = make_char (0x0055) /* LATIN CAPITAL LETTER U */;
2039   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x56 - 33]
2040     = make_char (0x0056) /* LATIN CAPITAL LETTER V */;
2041   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x57 - 33]
2042     = make_char (0x0057) /* LATIN CAPITAL LETTER W */;
2043   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x58 - 33]
2044     = make_char (0x0058) /* LATIN CAPITAL LETTER X */;
2045   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x59 - 33]
2046     = make_char (0x0059) /* LATIN CAPITAL LETTER Y */;
2047   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x5A - 33]
2048     = make_char (0x005A) /* LATIN CAPITAL LETTER Z */;
2049   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x5B - 33]
2050     = make_char (0x005B) /* LEFT SQUARE BRACKET */;
2051   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x5C - 33]
2052     = make_char (0x00A5) /* YEN SIGN */;
2053   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x5D - 33]
2054     = make_char (0x005D) /* RIGHT SQUARE BRACKET */;
2055   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x5E - 33]
2056     = make_char (0x005E) /* CIRCUMFLEX ACCENT */;
2057   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x5F - 33]
2058     = make_char (0x005F) /* LOW LINE */;
2059   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x60 - 33]
2060     = make_char (0x0060) /* GRAVE ACCENT */;
2061   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x61 - 33]
2062     = make_char (0x0061) /* LATIN SMALL LETTER A */;
2063   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x62 - 33]
2064     = make_char (0x0062) /* LATIN SMALL LETTER B */;
2065   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x63 - 33]
2066     = make_char (0x0063) /* LATIN SMALL LETTER C */;
2067   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x64 - 33]
2068     = make_char (0x0064) /* LATIN SMALL LETTER D */;
2069   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x65 - 33]
2070     = make_char (0x0065) /* LATIN SMALL LETTER E */;
2071   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x66 - 33]
2072     = make_char (0x0066) /* LATIN SMALL LETTER F */;
2073   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x67 - 33]
2074     = make_char (0x0067) /* LATIN SMALL LETTER G */;
2075   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x68 - 33]
2076     = make_char (0x0068) /* LATIN SMALL LETTER H */;
2077   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x69 - 33]
2078     = make_char (0x0069) /* LATIN SMALL LETTER I */;
2079   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x6A - 33]
2080     = make_char (0x006A) /* LATIN SMALL LETTER J */;
2081   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x6B - 33]
2082     = make_char (0x006B) /* LATIN SMALL LETTER K */;
2083   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x6C - 33]
2084     = make_char (0x006C) /* LATIN SMALL LETTER L */;
2085   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x6D - 33]
2086     = make_char (0x006D) /* LATIN SMALL LETTER M */;
2087   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x6E - 33]
2088     = make_char (0x006E) /* LATIN SMALL LETTER N */;
2089   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x6F - 33]
2090     = make_char (0x006F) /* LATIN SMALL LETTER O */;
2091   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x70 - 33]
2092     = make_char (0x0070) /* LATIN SMALL LETTER P */;
2093   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x71 - 33]
2094     = make_char (0x0071) /* LATIN SMALL LETTER Q */;
2095   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x72 - 33]
2096     = make_char (0x0072) /* LATIN SMALL LETTER R */;
2097   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x73 - 33]
2098     = make_char (0x0073) /* LATIN SMALL LETTER S */;
2099   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x74 - 33]
2100     = make_char (0x0074) /* LATIN SMALL LETTER T */;
2101   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x75 - 33]
2102     = make_char (0x0075) /* LATIN SMALL LETTER U */;
2103   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x76 - 33]
2104     = make_char (0x0076) /* LATIN SMALL LETTER V */;
2105   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x77 - 33]
2106     = make_char (0x0077) /* LATIN SMALL LETTER W */;
2107   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x78 - 33]
2108     = make_char (0x0078) /* LATIN SMALL LETTER X */;
2109   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x79 - 33]
2110     = make_char (0x0079) /* LATIN SMALL LETTER Y */;
2111   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x7A - 33]
2112     = make_char (0x007A) /* LATIN SMALL LETTER Z */;
2113   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x7B - 33]
2114     = make_char (0x007B) /* LEFT CURLY BRACKET */;
2115   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x7C - 33]
2116     = make_char (0x007C) /* VERTICAL LINE */;
2117   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x7D - 33]
2118     = make_char (0x007D) /* RIGHT CURLY BRACKET */;
2119   XVECTOR_DATA(latin_jisx0201_to_ucs)[0x7E - 33]
2120     = make_char (0x203E) /* OVERLINE */;
2121   
2122   staticpro (&latin_iso8859_2_to_ucs);
2123   latin_iso8859_2_to_ucs = make_vector (96, Qnil);
2124   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA0 - 0xA0]
2125     = make_char (0x00A0) /* NO-BREAK SPACE */;
2126   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA1 - 0xA0]
2127     = make_char (0x0104) /* LATIN CAPITAL LETTER A WITH OGONEK */;
2128   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA2 - 0xA0]
2129     = make_char (0x02D8) /* BREVE */;
2130   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA3 - 0xA0]
2131     = make_char (0x0141) /* LATIN CAPITAL LETTER L WITH STROKE */;
2132   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA4 - 0xA0]
2133     = make_char (0x00A4) /* CURRENCY SIGN */;
2134   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA5 - 0xA0]
2135     = make_char (0x013D) /* LATIN CAPITAL LETTER L WITH CARON */;
2136   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA6 - 0xA0]
2137     = make_char (0x015A) /* LATIN CAPITAL LETTER S WITH ACUTE */;
2138   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA7 - 0xA0]
2139     = make_char (0x00A7) /* SECTION SIGN */;
2140   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA8 - 0xA0]
2141     = make_char (0x00A8) /* DIAERESIS */;
2142   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xA9 - 0xA0]
2143     = make_char (0x0160) /* LATIN CAPITAL LETTER S WITH CARON */;
2144   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xAA - 0xA0]
2145     = make_char (0x015E) /* LATIN CAPITAL LETTER S WITH CEDILLA */;
2146   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xAB - 0xA0]
2147     = make_char (0x0164) /* LATIN CAPITAL LETTER T WITH CARON */;
2148   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xAC - 0xA0]
2149     = make_char (0x0179) /* LATIN CAPITAL LETTER Z WITH ACUTE */;
2150   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xAD - 0xA0]
2151     = make_char (0x00AD) /* SOFT HYPHEN */;
2152   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xAE - 0xA0]
2153     = make_char (0x017D) /* LATIN CAPITAL LETTER Z WITH CARON */;
2154   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xAF - 0xA0]
2155     = make_char (0x017B) /* LATIN CAPITAL LETTER Z WITH DOT ABOVE */;
2156   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB0 - 0xA0]
2157     = make_char (0x00B0) /* DEGREE SIGN */;
2158   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB1 - 0xA0]
2159     = make_char (0x0105) /* LATIN SMALL LETTER A WITH OGONEK */;
2160   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB2 - 0xA0]
2161     = make_char (0x02DB) /* OGONEK */;
2162   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB3 - 0xA0]
2163     = make_char (0x0142) /* LATIN SMALL LETTER L WITH STROKE */;
2164   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB4 - 0xA0]
2165     = make_char (0x00B4) /* ACUTE ACCENT */;
2166   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB5 - 0xA0]
2167     = make_char (0x013E) /* LATIN SMALL LETTER L WITH CARON */;
2168   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB6 - 0xA0]
2169     = make_char (0x015B) /* LATIN SMALL LETTER S WITH ACUTE */;
2170   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB7 - 0xA0]
2171     = make_char (0x02C7) /* CARON */;
2172   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB8 - 0xA0]
2173     = make_char (0x00B8) /* CEDILLA */;
2174   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xB9 - 0xA0]
2175     = make_char (0x0161) /* LATIN SMALL LETTER S WITH CARON */;
2176   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xBA - 0xA0]
2177     = make_char (0x015F) /* LATIN SMALL LETTER S WITH CEDILLA */;
2178   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xBB - 0xA0]
2179     = make_char (0x0165) /* LATIN SMALL LETTER T WITH CARON */;
2180   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xBC - 0xA0]
2181     = make_char (0x017A) /* LATIN SMALL LETTER Z WITH ACUTE */;
2182   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xBD - 0xA0]
2183     = make_char (0x02DD) /* DOUBLE ACUTE ACCENT */;
2184   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xBE - 0xA0]
2185     = make_char (0x017E) /* LATIN SMALL LETTER Z WITH CARON */;
2186   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xBF - 0xA0]
2187     = make_char (0x017C) /* LATIN SMALL LETTER Z WITH DOT ABOVE */;
2188   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC0 - 0xA0]
2189     = make_char (0x0154) /* LATIN CAPITAL LETTER R WITH ACUTE */;
2190   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC1 - 0xA0]
2191     = make_char (0x00C1) /* LATIN CAPITAL LETTER A WITH ACUTE */;
2192   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC2 - 0xA0]
2193     = make_char (0x00C2) /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */;
2194   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC3 - 0xA0]
2195     = make_char (0x0102) /* LATIN CAPITAL LETTER A WITH BREVE */;
2196   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC4 - 0xA0]
2197     = make_char (0x00C4) /* LATIN CAPITAL LETTER A WITH DIAERESIS */;
2198   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC5 - 0xA0]
2199     = make_char (0x0139) /* LATIN CAPITAL LETTER L WITH ACUTE */;
2200   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC6 - 0xA0]
2201     = make_char (0x0106) /* LATIN CAPITAL LETTER C WITH ACUTE */;
2202   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC7 - 0xA0]
2203     = make_char (0x00C7) /* LATIN CAPITAL LETTER C WITH CEDILLA */;
2204   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC8 - 0xA0]
2205     = make_char (0x010C) /* LATIN CAPITAL LETTER C WITH CARON */;
2206   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xC9 - 0xA0]
2207     = make_char (0x00C9) /* LATIN CAPITAL LETTER E WITH ACUTE */;
2208   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xCA - 0xA0]
2209     = make_char (0x0118) /* LATIN CAPITAL LETTER E WITH OGONEK */;
2210   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xCB - 0xA0]
2211     = make_char (0x00CB) /* LATIN CAPITAL LETTER E WITH DIAERESIS */;
2212   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xCC - 0xA0]
2213     = make_char (0x011A) /* LATIN CAPITAL LETTER E WITH CARON */;
2214   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xCD - 0xA0]
2215     = make_char (0x00CD) /* LATIN CAPITAL LETTER I WITH ACUTE */;
2216   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xCE - 0xA0]
2217     = make_char (0x00CE) /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */;
2218   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xCF - 0xA0]
2219     = make_char (0x010E) /* LATIN CAPITAL LETTER D WITH CARON */;
2220   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD0 - 0xA0]
2221     = make_char (0x0110) /* LATIN CAPITAL LETTER D WITH STROKE */;
2222   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD1 - 0xA0]
2223     = make_char (0x0143) /* LATIN CAPITAL LETTER N WITH ACUTE */;
2224   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD2 - 0xA0]
2225     = make_char (0x0147) /* LATIN CAPITAL LETTER N WITH CARON */;
2226   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD3 - 0xA0]
2227     = make_char (0x00D3) /* LATIN CAPITAL LETTER O WITH ACUTE */;
2228   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD4 - 0xA0]
2229     = make_char (0x00D4) /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */;
2230   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD5 - 0xA0]
2231     = make_char (0x0150) /* LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */;
2232   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD6 - 0xA0]
2233     = make_char (0x00D6) /* LATIN CAPITAL LETTER O WITH DIAERESIS */;
2234   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD7 - 0xA0]
2235     = make_char (0x00D7) /* MULTIPLICATION SIGN */;
2236   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD8 - 0xA0]
2237     = make_char (0x0158) /* LATIN CAPITAL LETTER R WITH CARON */;
2238   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xD9 - 0xA0]
2239     = make_char (0x016E) /* LATIN CAPITAL LETTER U WITH RING ABOVE */;
2240   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xDA - 0xA0]
2241     = make_char (0x00DA) /* LATIN CAPITAL LETTER U WITH ACUTE */;
2242   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xDB - 0xA0]
2243     = make_char (0x0170) /* LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */;
2244   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xDC - 0xA0]
2245     = make_char (0x00DC) /* LATIN CAPITAL LETTER U WITH DIAERESIS */;
2246   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xDD - 0xA0]
2247     = make_char (0x00DD) /* LATIN CAPITAL LETTER Y WITH ACUTE */;
2248   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xDE - 0xA0]
2249     = make_char (0x0162) /* LATIN CAPITAL LETTER T WITH CEDILLA */;
2250   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xDF - 0xA0]
2251     = make_char (0x00DF) /* LATIN SMALL LETTER SHARP S */;
2252   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE0 - 0xA0]
2253     = make_char (0x0155) /* LATIN SMALL LETTER R WITH ACUTE */;
2254   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE1 - 0xA0]
2255     = make_char (0x00E1) /* LATIN SMALL LETTER A WITH ACUTE */;
2256   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE2 - 0xA0]
2257     = make_char (0x00E2) /* LATIN SMALL LETTER A WITH CIRCUMFLEX */;
2258   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE3 - 0xA0]
2259     = make_char (0x0103) /* LATIN SMALL LETTER A WITH BREVE */;
2260   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE4 - 0xA0]
2261     = make_char (0x00E4) /* LATIN SMALL LETTER A WITH DIAERESIS */;
2262   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE5 - 0xA0]
2263     = make_char (0x013A) /* LATIN SMALL LETTER L WITH ACUTE */;
2264   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE6 - 0xA0]
2265     = make_char (0x0107) /* LATIN SMALL LETTER C WITH ACUTE */;
2266   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE7 - 0xA0]
2267     = make_char (0x00E7) /* LATIN SMALL LETTER C WITH CEDILLA */;
2268   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE8 - 0xA0]
2269     = make_char (0x010D) /* LATIN SMALL LETTER C WITH CARON */;
2270   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xE9 - 0xA0]
2271     = make_char (0x00E9) /* LATIN SMALL LETTER E WITH ACUTE */;
2272   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xEA - 0xA0]
2273     = make_char (0x0119) /* LATIN SMALL LETTER E WITH OGONEK */;
2274   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xEB - 0xA0]
2275     = make_char (0x00EB) /* LATIN SMALL LETTER E WITH DIAERESIS */;
2276   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xEC - 0xA0]
2277     = make_char (0x011B) /* LATIN SMALL LETTER E WITH CARON */;
2278   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xED - 0xA0]
2279     = make_char (0x00ED) /* LATIN SMALL LETTER I WITH ACUTE */;
2280   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xEE - 0xA0]
2281     = make_char (0x00EE) /* LATIN SMALL LETTER I WITH CIRCUMFLEX */;
2282   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xEF - 0xA0]
2283     = make_char (0x010F) /* LATIN SMALL LETTER D WITH CARON */;
2284   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF0 - 0xA0]
2285     = make_char (0x0111) /* LATIN SMALL LETTER D WITH STROKE */;
2286   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF1 - 0xA0]
2287     = make_char (0x0144) /* LATIN SMALL LETTER N WITH ACUTE */;
2288   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF2 - 0xA0]
2289     = make_char (0x0148) /* LATIN SMALL LETTER N WITH CARON */;
2290   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF3 - 0xA0]
2291     = make_char (0x00F3) /* LATIN SMALL LETTER O WITH ACUTE */;
2292   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF4 - 0xA0]
2293     = make_char (0x00F4) /* LATIN SMALL LETTER O WITH CIRCUMFLEX */;
2294   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF5 - 0xA0]
2295     = make_char (0x0151) /* LATIN SMALL LETTER O WITH DOUBLE ACUTE */;
2296   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF6 - 0xA0]
2297     = make_char (0x00F6) /* LATIN SMALL LETTER O WITH DIAERESIS */;
2298   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF7 - 0xA0]
2299     = make_char (0x00F7) /* DIVISION SIGN */;
2300   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF8 - 0xA0]
2301     = make_char (0x0159) /* LATIN SMALL LETTER R WITH CARON */;
2302   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xF9 - 0xA0]
2303     = make_char (0x016F) /* LATIN SMALL LETTER U WITH RING ABOVE */;
2304   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xFA - 0xA0]
2305     = make_char (0x00FA) /* LATIN SMALL LETTER U WITH ACUTE */;
2306   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xFB - 0xA0]
2307     = make_char (0x0171) /* LATIN SMALL LETTER U WITH DOUBLE ACUTE */;
2308   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xFC - 0xA0]
2309     = make_char (0x00FC) /* LATIN SMALL LETTER U WITH DIAERESIS */;
2310   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xFD - 0xA0]
2311     = make_char (0x00FD) /* LATIN SMALL LETTER Y WITH ACUTE */;
2312   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xFE - 0xA0]
2313     = make_char (0x0163) /* LATIN SMALL LETTER T WITH CEDILLA */;
2314   XVECTOR_DATA(latin_iso8859_2_to_ucs)[0xFF - 0xA0]
2315     = make_char (0x02D9) /* DOT ABOVE */;
2316   
2317   staticpro (&latin_iso8859_3_to_ucs);
2318   latin_iso8859_3_to_ucs = make_vector (96, Qnil);
2319   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA0 - 0xA0]
2320     = make_char (0x00A0) /* NO-BREAK SPACE */;
2321   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA1 - 0xA0]
2322     = make_char (0x0126) /* LATIN CAPITAL LETTER H WITH STROKE */;
2323   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA2 - 0xA0]
2324     = make_char (0x02D8) /* BREVE */;
2325   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA3 - 0xA0]
2326     = make_char (0x00A3) /* POUND SIGN */;
2327   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA4 - 0xA0]
2328     = make_char (0x00A4) /* CURRENCY SIGN */;
2329   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA5 - 0xA0]
2330      = make_char (CHAR96('C', 0xA5));  */
2331   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA6 - 0xA0]
2332     = make_char (0x0124) /* LATIN CAPITAL LETTER H WITH CIRCUMFLEX */;
2333   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA7 - 0xA0]
2334     = make_char (0x00A7) /* SECTION SIGN */;
2335   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA8 - 0xA0]
2336     = make_char (0x00A8) /* DIAERESIS */;
2337   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xA9 - 0xA0]
2338     = make_char (0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */;
2339   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xAA - 0xA0]
2340     = make_char (0x015E) /* LATIN CAPITAL LETTER S WITH CEDILLA */;
2341   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xAB - 0xA0]
2342     = make_char (0x011E) /* LATIN CAPITAL LETTER G WITH BREVE */;
2343   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xAC - 0xA0]
2344     = make_char (0x0134) /* LATIN CAPITAL LETTER J WITH CIRCUMFLEX */;
2345   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xAD - 0xA0]
2346     = make_char (0x00AD) /* SOFT HYPHEN */;
2347   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xAE - 0xA0]
2348      = make_char (CHAR96('C', 0xAE)); */
2349   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xAF - 0xA0]
2350     = make_char (0x017B) /* LATIN CAPITAL LETTER Z WITH DOT ABOVE */;
2351   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB0 - 0xA0]
2352     = make_char (0x00B0) /* DEGREE SIGN */;
2353   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB1 - 0xA0]
2354     = make_char (0x0127) /* LATIN SMALL LETTER H WITH STROKE */;
2355   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB2 - 0xA0]
2356     = make_char (0x00B2) /* SUPERSCRIPT TWO */;
2357   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB3 - 0xA0]
2358     = make_char (0x00B3) /* SUPERSCRIPT THREE */;
2359   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB4 - 0xA0]
2360     = make_char (0x00B4) /* ACUTE ACCENT */;
2361   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB5 - 0xA0]
2362     = make_char (0x00B5) /* MICRO SIGN */;
2363   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB6 - 0xA0]
2364     = make_char (0x0125) /* LATIN SMALL LETTER H WITH CIRCUMFLEX */;
2365   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB7 - 0xA0]
2366     = make_char (0x00B7) /* MIDDLE DOT */;
2367   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB8 - 0xA0]
2368     = make_char (0x00B8) /* CEDILLA */;
2369   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xB9 - 0xA0]
2370     = make_char (0x0131) /* LATIN SMALL LETTER DOTLESS I */;
2371   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xBA - 0xA0]
2372     = make_char (0x015F) /* LATIN SMALL LETTER S WITH CEDILLA */;
2373   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xBB - 0xA0]
2374     = make_char (0x011F) /* LATIN SMALL LETTER G WITH BREVE */;
2375   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xBC - 0xA0]
2376     = make_char (0x0135) /* LATIN SMALL LETTER J WITH CIRCUMFLEX */;
2377   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xBD - 0xA0]
2378     = make_char (0x00BD) /* VULGAR FRACTION ONE HALF */;
2379   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xBE - 0xA0]
2380      = make_char (CHAR96('C', 0xBE)); */
2381   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xBF - 0xA0]
2382     = make_char (0x017C) /* LATIN SMALL LETTER Z WITH DOT ABOVE */;
2383   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC0 - 0xA0]
2384     = make_char (0x00C0) /* LATIN CAPITAL LETTER A WITH GRAVE */;
2385   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC1 - 0xA0]
2386     = make_char (0x00C1) /* LATIN CAPITAL LETTER A WITH ACUTE */;
2387   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC2 - 0xA0]
2388     = make_char (0x00C2) /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */;
2389   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC3 - 0xA0]
2390      = make_char (CHAR96('C', 0xC3)); */
2391   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC4 - 0xA0]
2392     = make_char (0x00C4) /* LATIN CAPITAL LETTER A WITH DIAERESIS */;
2393   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC5 - 0xA0]
2394     = make_char (0x010A) /* LATIN CAPITAL LETTER C WITH DOT ABOVE */;
2395   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC6 - 0xA0]
2396     = make_char (0x0108) /* LATIN CAPITAL LETTER C WITH CIRCUMFLEX */;
2397   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC7 - 0xA0]
2398     = make_char (0x00C7) /* LATIN CAPITAL LETTER C WITH CEDILLA */;
2399   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC8 - 0xA0]
2400     = make_char (0x00C8) /* LATIN CAPITAL LETTER E WITH GRAVE */;
2401   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xC9 - 0xA0]
2402     = make_char (0x00C9) /* LATIN CAPITAL LETTER E WITH ACUTE */;
2403   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xCA - 0xA0]
2404     = make_char (0x00CA) /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */;
2405   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xCB - 0xA0]
2406     = make_char (0x00CB) /* LATIN CAPITAL LETTER E WITH DIAERESIS */;
2407   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xCC - 0xA0]
2408     = make_char (0x00CC) /* LATIN CAPITAL LETTER I WITH GRAVE */;
2409   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xCD - 0xA0]
2410     = make_char (0x00CD) /* LATIN CAPITAL LETTER I WITH ACUTE */;
2411   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xCE - 0xA0]
2412     = make_char (0x00CE) /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */;
2413   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xCF - 0xA0]
2414     = make_char (0x00CF) /* LATIN CAPITAL LETTER I WITH DIAERESIS */;
2415   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD0 - 0xA0]
2416      = make_char (CHAR96('C', 0xD0)); */
2417   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD1 - 0xA0]
2418     = make_char (0x00D1) /* LATIN CAPITAL LETTER N WITH TILDE */;
2419   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD2 - 0xA0]
2420     = make_char (0x00D2) /* LATIN CAPITAL LETTER O WITH GRAVE */;
2421   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD3 - 0xA0]
2422     = make_char (0x00D3) /* LATIN CAPITAL LETTER O WITH ACUTE */;
2423   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD4 - 0xA0]
2424     = make_char (0x00D4) /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */;
2425   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD5 - 0xA0]
2426     = make_char (0x0120) /* LATIN CAPITAL LETTER G WITH DOT ABOVE */;
2427   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD6 - 0xA0]
2428     = make_char (0x00D6) /* LATIN CAPITAL LETTER O WITH DIAERESIS */;
2429   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD7 - 0xA0]
2430     = make_char (0x00D7) /* MULTIPLICATION SIGN */;
2431   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD8 - 0xA0]
2432     = make_char (0x011C) /* LATIN CAPITAL LETTER G WITH CIRCUMFLEX */;
2433   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xD9 - 0xA0]
2434     = make_char (0x00D9) /* LATIN CAPITAL LETTER U WITH GRAVE */;
2435   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xDA - 0xA0]
2436     = make_char (0x00DA) /* LATIN CAPITAL LETTER U WITH ACUTE */;
2437   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xDB - 0xA0]
2438     = make_char (0x00DB) /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */;
2439   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xDC - 0xA0]
2440     = make_char (0x00DC) /* LATIN CAPITAL LETTER U WITH DIAERESIS */;
2441   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xDD - 0xA0]
2442     = make_char (0x016C) /* LATIN CAPITAL LETTER U WITH BREVE */;
2443   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xDE - 0xA0]
2444     = make_char (0x015C) /* LATIN CAPITAL LETTER S WITH CIRCUMFLEX */;
2445   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xDF - 0xA0]
2446     = make_char (0x00DF) /* LATIN SMALL LETTER SHARP S */;
2447   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE0 - 0xA0]
2448     = make_char (0x00E0) /* LATIN SMALL LETTER A WITH GRAVE */;
2449   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE1 - 0xA0]
2450     = make_char (0x00E1) /* LATIN SMALL LETTER A WITH ACUTE */;
2451   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE2 - 0xA0]
2452     = make_char (0x00E2) /* LATIN SMALL LETTER A WITH CIRCUMFLEX */;
2453   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE3 - 0xA0]
2454      = make_char (CHAR96('C', 0xE3)); */
2455   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE4 - 0xA0]
2456     = make_char (0x00E4) /* LATIN SMALL LETTER A WITH DIAERESIS */;
2457   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE5 - 0xA0]
2458     = make_char (0x010B) /* LATIN SMALL LETTER C WITH DOT ABOVE */;
2459   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE6 - 0xA0]
2460     = make_char (0x0109) /* LATIN SMALL LETTER C WITH CIRCUMFLEX */;
2461   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE7 - 0xA0]
2462     = make_char (0x00E7) /* LATIN SMALL LETTER C WITH CEDILLA */;
2463   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE8 - 0xA0]
2464     = make_char (0x00E8) /* LATIN SMALL LETTER E WITH GRAVE */;
2465   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xE9 - 0xA0]
2466     = make_char (0x00E9) /* LATIN SMALL LETTER E WITH ACUTE */;
2467   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xEA - 0xA0]
2468     = make_char (0x00EA) /* LATIN SMALL LETTER E WITH CIRCUMFLEX */;
2469   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xEB - 0xA0]
2470     = make_char (0x00EB) /* LATIN SMALL LETTER E WITH DIAERESIS */;
2471   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xEC - 0xA0]
2472     = make_char (0x00EC) /* LATIN SMALL LETTER I WITH GRAVE */;
2473   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xED - 0xA0]
2474     = make_char (0x00ED) /* LATIN SMALL LETTER I WITH ACUTE */;
2475   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xEE - 0xA0]
2476     = make_char (0x00EE) /* LATIN SMALL LETTER I WITH CIRCUMFLEX */;
2477   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xEF - 0xA0]
2478     = make_char (0x00EF) /* LATIN SMALL LETTER I WITH DIAERESIS */;
2479   /* XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF0 - 0xA0]
2480      = make_char (CHAR96('C', 0xF0)); */
2481   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF1 - 0xA0]
2482     = make_char (0x00F1) /* LATIN SMALL LETTER N WITH TILDE */;
2483   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF2 - 0xA0]
2484     = make_char (0x00F2) /* LATIN SMALL LETTER O WITH GRAVE */;
2485   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF3 - 0xA0]
2486     = make_char (0x00F3) /* LATIN SMALL LETTER O WITH ACUTE */;
2487   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF4 - 0xA0]
2488     = make_char (0x00F4) /* LATIN SMALL LETTER O WITH CIRCUMFLEX */;
2489   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF5 - 0xA0]
2490     = make_char (0x0121) /* LATIN SMALL LETTER G WITH DOT ABOVE */;
2491   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF6 - 0xA0]
2492     = make_char (0x00F6) /* LATIN SMALL LETTER O WITH DIAERESIS */;
2493   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF7 - 0xA0]
2494     = make_char (0x00F7) /* DIVISION SIGN */;
2495   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF8 - 0xA0]
2496     = make_char (0x011D) /* LATIN SMALL LETTER G WITH CIRCUMFLEX */;
2497   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xF9 - 0xA0]
2498     = make_char (0x00F9) /* LATIN SMALL LETTER U WITH GRAVE */;
2499   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xFA - 0xA0]
2500     = make_char (0x00FA) /* LATIN SMALL LETTER U WITH ACUTE */;
2501   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xFB - 0xA0]
2502     = make_char (0x00FB) /* LATIN SMALL LETTER U WITH CIRCUMFLEX */;
2503   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xFC - 0xA0]
2504     = make_char (0x00FC) /* LATIN SMALL LETTER U WITH DIAERESIS */;
2505   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xFD - 0xA0]
2506     = make_char (0x016D) /* LATIN SMALL LETTER U WITH BREVE */;
2507   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xFE - 0xA0]
2508     = make_char (0x015D) /* LATIN SMALL LETTER S WITH CIRCUMFLEX */;
2509   XVECTOR_DATA(latin_iso8859_3_to_ucs)[0xFF - 0xA0]
2510     = make_char (0x02D9) /* DOT ABOVE */;
2511   
2512   staticpro (&latin_iso8859_4_to_ucs);
2513   latin_iso8859_4_to_ucs = make_vector (96, Qnil);
2514   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA0 - 0xA0]
2515     = make_char (0x00A0) /* NO-BREAK SPACE */;
2516   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA1 - 0xA0]
2517     = make_char (0x0104) /* LATIN CAPITAL LETTER A WITH OGONEK */;
2518   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA2 - 0xA0]
2519     = make_char (0x0138) /* LATIN SMALL LETTER KRA */;
2520   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA3 - 0xA0]
2521     = make_char (0x0156) /* LATIN CAPITAL LETTER R WITH CEDILLA */;
2522   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA4 - 0xA0]
2523     = make_char (0x00A4) /* CURRENCY SIGN */;
2524   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA5 - 0xA0]
2525     = make_char (0x0128) /* LATIN CAPITAL LETTER I WITH TILDE */;
2526   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA6 - 0xA0]
2527     = make_char (0x013B) /* LATIN CAPITAL LETTER L WITH CEDILLA */;
2528   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA7 - 0xA0]
2529     = make_char (0x00A7) /* SECTION SIGN */;
2530   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA8 - 0xA0]
2531     = make_char (0x00A8) /* DIAERESIS */;
2532   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xA9 - 0xA0]
2533     = make_char (0x0160) /* LATIN CAPITAL LETTER S WITH CARON */;
2534   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xAA - 0xA0]
2535     = make_char (0x0112) /* LATIN CAPITAL LETTER E WITH MACRON */;
2536   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xAB - 0xA0]
2537     = make_char (0x0122) /* LATIN CAPITAL LETTER G WITH CEDILLA */;
2538   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xAC - 0xA0]
2539     = make_char (0x0166) /* LATIN CAPITAL LETTER T WITH STROKE */;
2540   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xAD - 0xA0]
2541     = make_char (0x00AD) /* SOFT HYPHEN */;
2542   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xAE - 0xA0]
2543     = make_char (0x017D) /* LATIN CAPITAL LETTER Z WITH CARON */;
2544   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xAF - 0xA0]
2545     = make_char (0x00AF) /* MACRON */;
2546   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB0 - 0xA0]
2547     = make_char (0x00B0) /* DEGREE SIGN */;
2548   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB1 - 0xA0]
2549     = make_char (0x0105) /* LATIN SMALL LETTER A WITH OGONEK */;
2550   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB2 - 0xA0]
2551     = make_char (0x02DB) /* OGONEK */;
2552   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB3 - 0xA0]
2553     = make_char (0x0157) /* LATIN SMALL LETTER R WITH CEDILLA */;
2554   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB4 - 0xA0]
2555     = make_char (0x00B4) /* ACUTE ACCENT */;
2556   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB5 - 0xA0]
2557     = make_char (0x0129) /* LATIN SMALL LETTER I WITH TILDE */;
2558   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB6 - 0xA0]
2559     = make_char (0x013C) /* LATIN SMALL LETTER L WITH CEDILLA */;
2560   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB7 - 0xA0]
2561     = make_char (0x02C7) /* CARON */;
2562   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB8 - 0xA0]
2563     = make_char (0x00B8) /* CEDILLA */;
2564   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xB9 - 0xA0]
2565     = make_char (0x0161) /* LATIN SMALL LETTER S WITH CARON */;
2566   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xBA - 0xA0]
2567     = make_char (0x0113) /* LATIN SMALL LETTER E WITH MACRON */;
2568   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xBB - 0xA0]
2569     = make_char (0x0123) /* LATIN SMALL LETTER G WITH CEDILLA */;
2570   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xBC - 0xA0]
2571     = make_char (0x0167) /* LATIN SMALL LETTER T WITH STROKE */;
2572   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xBD - 0xA0]
2573     = make_char (0x014A) /* LATIN CAPITAL LETTER ENG */;
2574   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xBE - 0xA0]
2575     = make_char (0x017E) /* LATIN SMALL LETTER Z WITH CARON */;
2576   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xBF - 0xA0]
2577     = make_char (0x014B) /* LATIN SMALL LETTER ENG */;
2578   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC0 - 0xA0]
2579     = make_char (0x0100) /* LATIN CAPITAL LETTER A WITH MACRON */;
2580   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC1 - 0xA0]
2581     = make_char (0x00C1) /* LATIN CAPITAL LETTER A WITH ACUTE */;
2582   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC2 - 0xA0]
2583     = make_char (0x00C2) /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */;
2584   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC3 - 0xA0]
2585     = make_char (0x00C3) /* LATIN CAPITAL LETTER A WITH TILDE */;
2586   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC4 - 0xA0]
2587     = make_char (0x00C4) /* LATIN CAPITAL LETTER A WITH DIAERESIS */;
2588   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC5 - 0xA0]
2589     = make_char (0x00C5) /* LATIN CAPITAL LETTER A WITH RING ABOVE */;
2590   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC6 - 0xA0]
2591     = make_char (0x00C6) /* LATIN CAPITAL LETTER AE */;
2592   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC7 - 0xA0]
2593     = make_char (0x012E) /* LATIN CAPITAL LETTER I WITH OGONEK */;
2594   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC8 - 0xA0]
2595     = make_char (0x010C) /* LATIN CAPITAL LETTER C WITH CARON */;
2596   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xC9 - 0xA0]
2597     = make_char (0x00C9) /* LATIN CAPITAL LETTER E WITH ACUTE */;
2598   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xCA - 0xA0]
2599     = make_char (0x0118) /* LATIN CAPITAL LETTER E WITH OGONEK */;
2600   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xCB - 0xA0]
2601     = make_char (0x00CB) /* LATIN CAPITAL LETTER E WITH DIAERESIS */;
2602   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xCC - 0xA0]
2603     = make_char (0x0116) /* LATIN CAPITAL LETTER E WITH DOT ABOVE */;
2604   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xCD - 0xA0]
2605     = make_char (0x00CD) /* LATIN CAPITAL LETTER I WITH ACUTE */;
2606   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xCE - 0xA0]
2607     = make_char (0x00CE) /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */;
2608   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xCF - 0xA0]
2609     = make_char (0x012A) /* LATIN CAPITAL LETTER I WITH MACRON */;
2610   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD0 - 0xA0]
2611     = make_char (0x0110) /* LATIN CAPITAL LETTER D WITH STROKE */;
2612   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD1 - 0xA0]
2613     = make_char (0x0145) /* LATIN CAPITAL LETTER N WITH CEDILLA */;
2614   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD2 - 0xA0]
2615     = make_char (0x014C) /* LATIN CAPITAL LETTER O WITH MACRON */;
2616   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD3 - 0xA0]
2617     = make_char (0x0136) /* LATIN CAPITAL LETTER K WITH CEDILLA */;
2618   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD4 - 0xA0]
2619     = make_char (0x00D4) /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */;
2620   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD5 - 0xA0]
2621     = make_char (0x00D5) /* LATIN CAPITAL LETTER O WITH TILDE */;
2622   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD6 - 0xA0]
2623     = make_char (0x00D6) /* LATIN CAPITAL LETTER O WITH DIAERESIS */;
2624   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD7 - 0xA0]
2625     = make_char (0x00D7) /* MULTIPLICATION SIGN */;
2626   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD8 - 0xA0]
2627     = make_char (0x00D8) /* LATIN CAPITAL LETTER O WITH STROKE */;
2628   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xD9 - 0xA0]
2629     = make_char (0x0172) /* LATIN CAPITAL LETTER U WITH OGONEK */;
2630   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xDA - 0xA0]
2631     = make_char (0x00DA) /* LATIN CAPITAL LETTER U WITH ACUTE */;
2632   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xDB - 0xA0]
2633     = make_char (0x00DB) /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */;
2634   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xDC - 0xA0]
2635     = make_char (0x00DC) /* LATIN CAPITAL LETTER U WITH DIAERESIS */;
2636   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xDD - 0xA0]
2637     = make_char (0x0168) /* LATIN CAPITAL LETTER U WITH TILDE */;
2638   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xDE - 0xA0]
2639     = make_char (0x016A) /* LATIN CAPITAL LETTER U WITH MACRON */;
2640   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xDF - 0xA0]
2641     = make_char (0x00DF) /* LATIN SMALL LETTER SHARP S */;
2642   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE0 - 0xA0]
2643     = make_char (0x0101) /* LATIN SMALL LETTER A WITH MACRON */;
2644   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE1 - 0xA0]
2645     = make_char (0x00E1) /* LATIN SMALL LETTER A WITH ACUTE */;
2646   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE2 - 0xA0]
2647     = make_char (0x00E2) /* LATIN SMALL LETTER A WITH CIRCUMFLEX */;
2648   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE3 - 0xA0]
2649     = make_char (0x00E3) /* LATIN SMALL LETTER A WITH TILDE */;
2650   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE4 - 0xA0]
2651     = make_char (0x00E4) /* LATIN SMALL LETTER A WITH DIAERESIS */;
2652   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE5 - 0xA0]
2653     = make_char (0x00E5) /* LATIN SMALL LETTER A WITH RING ABOVE */;
2654   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE6 - 0xA0]
2655     = make_char (0x00E6) /* LATIN SMALL LETTER AE */;
2656   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE7 - 0xA0]
2657     = make_char (0x012F) /* LATIN SMALL LETTER I WITH OGONEK */;
2658   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE8 - 0xA0]
2659     = make_char (0x010D) /* LATIN SMALL LETTER C WITH CARON */;
2660   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xE9 - 0xA0]
2661     = make_char (0x00E9) /* LATIN SMALL LETTER E WITH ACUTE */;
2662   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xEA - 0xA0]
2663     = make_char (0x0119) /* LATIN SMALL LETTER E WITH OGONEK */;
2664   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xEB - 0xA0]
2665     = make_char (0x00EB) /* LATIN SMALL LETTER E WITH DIAERESIS */;
2666   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xEC - 0xA0]
2667     = make_char (0x0117) /* LATIN SMALL LETTER E WITH DOT ABOVE */;
2668   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xED - 0xA0]
2669     = make_char (0x00ED) /* LATIN SMALL LETTER I WITH ACUTE */;
2670   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xEE - 0xA0]
2671     = make_char (0x00EE) /* LATIN SMALL LETTER I WITH CIRCUMFLEX */;
2672   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xEF - 0xA0]
2673     = make_char (0x012B) /* LATIN SMALL LETTER I WITH MACRON */;
2674   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF0 - 0xA0]
2675     = make_char (0x0111) /* LATIN SMALL LETTER D WITH STROKE */;
2676   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF1 - 0xA0]
2677     = make_char (0x0146) /* LATIN SMALL LETTER N WITH CEDILLA */;
2678   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF2 - 0xA0]
2679     = make_char (0x014D) /* LATIN SMALL LETTER O WITH MACRON */;
2680   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF3 - 0xA0]
2681     = make_char (0x0137) /* LATIN SMALL LETTER K WITH CEDILLA */;
2682   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF4 - 0xA0]
2683     = make_char (0x00F4) /* LATIN SMALL LETTER O WITH CIRCUMFLEX */;
2684   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF5 - 0xA0]
2685     = make_char (0x00F5) /* LATIN SMALL LETTER O WITH TILDE */;
2686   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF6 - 0xA0]
2687     = make_char (0x00F6) /* LATIN SMALL LETTER O WITH DIAERESIS */;
2688   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF7 - 0xA0]
2689     = make_char (0x00F7) /* DIVISION SIGN */;
2690   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF8 - 0xA0]
2691     = make_char (0x00F8) /* LATIN SMALL LETTER O WITH STROKE */;
2692   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xF9 - 0xA0]
2693     = make_char (0x0173) /* LATIN SMALL LETTER U WITH OGONEK */;
2694   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xFA - 0xA0]
2695     = make_char (0x00FA) /* LATIN SMALL LETTER U WITH ACUTE */;
2696   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xFB - 0xA0]
2697     = make_char (0x00FB) /* LATIN SMALL LETTER U WITH CIRCUMFLEX */;
2698   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xFC - 0xA0]
2699     = make_char (0x00FC) /* LATIN SMALL LETTER U WITH DIAERESIS */;
2700   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xFD - 0xA0]
2701     = make_char (0x0169) /* LATIN SMALL LETTER U WITH TILDE */;
2702   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xFE - 0xA0]
2703     = make_char (0x016B) /* LATIN SMALL LETTER U WITH MACRON */;
2704   XVECTOR_DATA(latin_iso8859_4_to_ucs)[0xFF - 0xA0]
2705     = make_char (0x02D9) /* DOT ABOVE */;
2706   
2707   staticpro (&latin_iso8859_9_to_ucs);
2708   latin_iso8859_9_to_ucs = make_vector (96, Qnil);
2709   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA0 - 0xA0]
2710     = make_char (0x00A0) /* NO-BREAK SPACE */;
2711   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA1 - 0xA0]
2712     = make_char (0x00A1) /* INVERTED EXCLAMATION MARK */;
2713   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA2 - 0xA0]
2714     = make_char (0x00A2) /* CENT SIGN */;
2715   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA3 - 0xA0]
2716     = make_char (0x00A3) /* POUND SIGN */;
2717   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA4 - 0xA0]
2718     = make_char (0x00A4) /* CURRENCY SIGN */;
2719   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA5 - 0xA0]
2720     = make_char (0x00A5) /* YEN SIGN */;
2721   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA6 - 0xA0]
2722     = make_char (0x00A6) /* BROKEN BAR */;
2723   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA7 - 0xA0]
2724     = make_char (0x00A7) /* SECTION SIGN */;
2725   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA8 - 0xA0]
2726     = make_char (0x00A8) /* DIAERESIS */;
2727   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xA9 - 0xA0]
2728     = make_char (0x00A9) /* COPYRIGHT SIGN */;
2729   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xAA - 0xA0]
2730     = make_char (0x00AA) /* FEMININE ORDINAL INDICATOR */;
2731   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xAB - 0xA0]
2732     = make_char (0x00AB) /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */;
2733   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xAC - 0xA0]
2734     = make_char (0x00AC) /* NOT SIGN */;
2735   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xAD - 0xA0]
2736     = make_char (0x00AD) /* SOFT HYPHEN */;
2737   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xAE - 0xA0]
2738     = make_char (0x00AE) /* REGISTERED SIGN */;
2739   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xAF - 0xA0]
2740     = make_char (0x00AF) /* MACRON */;
2741   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB0 - 0xA0]
2742     = make_char (0x00B0) /* DEGREE SIGN */;
2743   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB1 - 0xA0]
2744     = make_char (0x00B1) /* PLUS-MINUS SIGN */;
2745   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB2 - 0xA0]
2746     = make_char (0x00B2) /* SUPERSCRIPT TWO */;
2747   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB3 - 0xA0]
2748     = make_char (0x00B3) /* SUPERSCRIPT THREE */;
2749   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB4 - 0xA0]
2750     = make_char (0x00B4) /* ACUTE ACCENT */;
2751   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB5 - 0xA0]
2752     = make_char (0x00B5) /* MICRO SIGN */;
2753   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB6 - 0xA0]
2754     = make_char (0x00B6) /* PILCROW SIGN */;
2755   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB7 - 0xA0]
2756     = make_char (0x00B7) /* MIDDLE DOT */;
2757   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB8 - 0xA0]
2758     = make_char (0x00B8) /* CEDILLA */;
2759   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xB9 - 0xA0]
2760     = make_char (0x00B9) /* SUPERSCRIPT ONE */;
2761   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xBA - 0xA0]
2762     = make_char (0x00BA) /* MASCULINE ORDINAL INDICATOR */;
2763   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xBB - 0xA0]
2764     = make_char (0x00BB) /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */;
2765   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xBC - 0xA0]
2766     = make_char (0x00BC) /* VULGAR FRACTION ONE QUARTER */;
2767   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xBD - 0xA0]
2768     = make_char (0x00BD) /* VULGAR FRACTION ONE HALF */;
2769   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xBE - 0xA0]
2770     = make_char (0x00BE) /* VULGAR FRACTION THREE QUARTERS */;
2771   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xBF - 0xA0]
2772     = make_char (0x00BF) /* INVERTED QUESTION MARK */;
2773   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC0 - 0xA0]
2774     = make_char (0x00C0) /* LATIN CAPITAL LETTER A WITH GRAVE */;
2775   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC1 - 0xA0]
2776     = make_char (0x00C1) /* LATIN CAPITAL LETTER A WITH ACUTE */;
2777   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC2 - 0xA0]
2778     = make_char (0x00C2) /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */;
2779   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC3 - 0xA0]
2780     = make_char (0x00C3) /* LATIN CAPITAL LETTER A WITH TILDE */;
2781   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC4 - 0xA0]
2782     = make_char (0x00C4) /* LATIN CAPITAL LETTER A WITH DIAERESIS */;
2783   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC5 - 0xA0]
2784     = make_char (0x00C5) /* LATIN CAPITAL LETTER A WITH RING ABOVE */;
2785   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC6 - 0xA0]
2786     = make_char (0x00C6) /* LATIN CAPITAL LETTER AE */;
2787   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC7 - 0xA0]
2788     = make_char (0x00C7) /* LATIN CAPITAL LETTER C WITH CEDILLA */;
2789   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC8 - 0xA0]
2790     = make_char (0x00C8) /* LATIN CAPITAL LETTER E WITH GRAVE */;
2791   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xC9 - 0xA0]
2792     = make_char (0x00C9) /* LATIN CAPITAL LETTER E WITH ACUTE */;
2793   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xCA - 0xA0]
2794     = make_char (0x00CA) /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */;
2795   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xCB - 0xA0]
2796     = make_char (0x00CB) /* LATIN CAPITAL LETTER E WITH DIAERESIS */;
2797   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xCC - 0xA0]
2798     = make_char (0x00CC) /* LATIN CAPITAL LETTER I WITH GRAVE */;
2799   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xCD - 0xA0]
2800     = make_char (0x00CD) /* LATIN CAPITAL LETTER I WITH ACUTE */;
2801   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xCE - 0xA0]
2802     = make_char (0x00CE) /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */;
2803   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xCF - 0xA0]
2804     = make_char (0x00CF) /* LATIN CAPITAL LETTER I WITH DIAERESIS */;
2805   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD0 - 0xA0]
2806     = make_char (0x011E) /* LATIN CAPITAL LETTER G WITH BREVE */;
2807   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD1 - 0xA0]
2808     = make_char (0x00D1) /* LATIN CAPITAL LETTER N WITH TILDE */;
2809   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD2 - 0xA0]
2810     = make_char (0x00D2) /* LATIN CAPITAL LETTER O WITH GRAVE */;
2811   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD3 - 0xA0]
2812     = make_char (0x00D3) /* LATIN CAPITAL LETTER O WITH ACUTE */;
2813   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD4 - 0xA0]
2814     = make_char (0x00D4) /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */;
2815   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD5 - 0xA0]
2816     = make_char (0x00D5) /* LATIN CAPITAL LETTER O WITH TILDE */;
2817   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD6 - 0xA0]
2818     = make_char (0x00D6) /* LATIN CAPITAL LETTER O WITH DIAERESIS */;
2819   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD7 - 0xA0]
2820     = make_char (0x00D7) /* MULTIPLICATION SIGN */;
2821   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD8 - 0xA0]
2822     = make_char (0x00D8) /* LATIN CAPITAL LETTER O WITH STROKE */;
2823   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xD9 - 0xA0]
2824     = make_char (0x00D9) /* LATIN CAPITAL LETTER U WITH GRAVE */;
2825   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xDA - 0xA0]
2826     = make_char (0x00DA) /* LATIN CAPITAL LETTER U WITH ACUTE */;
2827   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xDB - 0xA0]
2828     = make_char (0x00DB) /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */;
2829   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xDC - 0xA0]
2830     = make_char (0x00DC) /* LATIN CAPITAL LETTER U WITH DIAERESIS */;
2831   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xDD - 0xA0]
2832     = make_char (0x0130) /* LATIN CAPITAL LETTER I WITH DOT ABOVE */;
2833   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xDE - 0xA0]
2834     = make_char (0x015E) /* LATIN CAPITAL LETTER S WITH CEDILLA */;
2835   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xDF - 0xA0]
2836     = make_char (0x00DF) /* LATIN SMALL LETTER SHARP S */;
2837   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE0 - 0xA0]
2838     = make_char (0x00E0) /* LATIN SMALL LETTER A WITH GRAVE */;
2839   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE1 - 0xA0]
2840     = make_char (0x00E1) /* LATIN SMALL LETTER A WITH ACUTE */;
2841   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE2 - 0xA0]
2842     = make_char (0x00E2) /* LATIN SMALL LETTER A WITH CIRCUMFLEX */;
2843   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE3 - 0xA0]
2844     = make_char (0x00E3) /* LATIN SMALL LETTER A WITH TILDE */;
2845   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE4 - 0xA0]
2846     = make_char (0x00E4) /* LATIN SMALL LETTER A WITH DIAERESIS */;
2847   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE5 - 0xA0]
2848     = make_char (0x00E5) /* LATIN SMALL LETTER A WITH RING ABOVE */;
2849   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE6 - 0xA0]
2850     = make_char (0x00E6) /* LATIN SMALL LETTER AE */;
2851   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE7 - 0xA0]
2852     = make_char (0x00E7) /* LATIN SMALL LETTER C WITH CEDILLA */;
2853   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE8 - 0xA0]
2854     = make_char (0x00E8) /* LATIN SMALL LETTER E WITH GRAVE */;
2855   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xE9 - 0xA0]
2856     = make_char (0x00E9) /* LATIN SMALL LETTER E WITH ACUTE */;
2857   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xEA - 0xA0]
2858     = make_char (0x00EA) /* LATIN SMALL LETTER E WITH CIRCUMFLEX */;
2859   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xEB - 0xA0]
2860     = make_char (0x00EB) /* LATIN SMALL LETTER E WITH DIAERESIS */;
2861   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xEC - 0xA0]
2862     = make_char (0x00EC) /* LATIN SMALL LETTER I WITH GRAVE */;
2863   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xED - 0xA0]
2864     = make_char (0x00ED) /* LATIN SMALL LETTER I WITH ACUTE */;
2865   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xEE - 0xA0]
2866     = make_char (0x00EE) /* LATIN SMALL LETTER I WITH CIRCUMFLEX */;
2867   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xEF - 0xA0]
2868     = make_char (0x00EF) /* LATIN SMALL LETTER I WITH DIAERESIS */;
2869   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF0 - 0xA0]
2870     = make_char (0x011F) /* LATIN SMALL LETTER G WITH BREVE */;
2871   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF1 - 0xA0]
2872     = make_char (0x00F1) /* LATIN SMALL LETTER N WITH TILDE */;
2873   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF2 - 0xA0]
2874     = make_char (0x00F2) /* LATIN SMALL LETTER O WITH GRAVE */;
2875   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF3 - 0xA0]
2876     = make_char (0x00F3) /* LATIN SMALL LETTER O WITH ACUTE */;
2877   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF4 - 0xA0]
2878     = make_char (0x00F4) /* LATIN SMALL LETTER O WITH CIRCUMFLEX */;
2879   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF5 - 0xA0]
2880     = make_char (0x00F5) /* LATIN SMALL LETTER O WITH TILDE */;
2881   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF6 - 0xA0]
2882     = make_char (0x00F6) /* LATIN SMALL LETTER O WITH DIAERESIS */;
2883   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF7 - 0xA0]
2884     = make_char (0x00F7) /* DIVISION SIGN */;
2885   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF8 - 0xA0]
2886     = make_char (0x00F8) /* LATIN SMALL LETTER O WITH STROKE */;
2887   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xF9 - 0xA0]
2888     = make_char (0x00F9) /* LATIN SMALL LETTER U WITH GRAVE */;
2889   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xFA - 0xA0]
2890     = make_char (0x00FA) /* LATIN SMALL LETTER U WITH ACUTE */;
2891   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xFB - 0xA0]
2892     = make_char (0x00FB) /* LATIN SMALL LETTER U WITH CIRCUMFLEX */;
2893   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xFC - 0xA0]
2894     = make_char (0x00FC) /* LATIN SMALL LETTER U WITH DIAERESIS */;
2895   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xFD - 0xA0]
2896     = make_char (0x0131) /* LATIN SMALL LETTER DOTLESS I */;
2897   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xFE - 0xA0]
2898     = make_char (0x015F) /* LATIN SMALL LETTER S WITH CEDILLA */;
2899   XVECTOR_DATA(latin_iso8859_9_to_ucs)[0xFF - 0xA0]
2900     = make_char (0x00FF) /* LATIN SMALL LETTER Y WITH DIAERESIS */;
2901   
2902   staticpro (&latin_viscii_lower_to_ucs);
2903   latin_viscii_lower_to_ucs = make_vector (96, Qnil);
2904   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x20 - 32]
2905      = make_char (CHAR96('1', 0x20)); */
2906   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x21 - 32] = make_char (0x1eaf);
2907   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x22 - 32] = make_char (0x1eb1);
2908   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x23 - 32] = make_char (0x1eb7);
2909   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x24 - 32] = make_char (0x1ea5);
2910   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x25 - 32] = make_char (0x1ea7);
2911   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x26 - 32] = make_char (0x1ea9);
2912   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x27 - 32] = make_char (0x1ead);
2913   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x28 - 32] = make_char (0x1ebd);
2914   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x29 - 32] = make_char (0x1eb9);
2915   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x2a - 32] = make_char (0x1ebf);
2916   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x2b - 32] = make_char (0x1ec1);
2917   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x2c - 32] = make_char (0x1ec3);
2918   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x2d - 32] = make_char (0x1ec5);
2919   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x2e - 32] = make_char (0x1ec7);
2920   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x2f - 32] = make_char (0x1ed1);
2921   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x30 - 32] = make_char (0x1ed3);
2922   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x31 - 32] = make_char (0x1ed5);
2923   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x32 - 32] = make_char (0x1ed7);
2924   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x33 - 32]
2925      = make_char (CHAR96('1', 0x33)); */
2926   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x34 - 32]
2927      = make_char (CHAR96('1', 0x34)); */
2928   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x35 - 32] = make_char (0x1ed9);
2929   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x36 - 32] = make_char (0x1edd);
2930   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x37 - 32] = make_char (0x1edf);
2931   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x38 - 32] = make_char (0x1ecb);
2932   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x39 - 32]
2933      = make_char (CHAR96('1', 0x39));
2934      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x3A - 32]
2935      = make_char (CHAR96('1', 0x3A));
2936      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x3B - 32]
2937      = make_char (CHAR96('1', 0x3B));
2938      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x3C - 32]
2939      = make_char (CHAR96('1', 0x3C)); */
2940   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x3d - 32] = make_char (0x01a1);
2941   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x3e - 32] = make_char (0x1edb);
2942   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x3F - 32]
2943      = make_char (CHAR96('1', 0x3F));
2944      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x40 - 32]
2945      = make_char (CHAR96('1', 0x40));
2946      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x41 - 32]
2947      = make_char (CHAR96('1', 0x41));
2948      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x42 - 32]
2949      = make_char (CHAR96('1', 0x42));
2950      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x43 - 32]
2951      = make_char (CHAR96('1', 0x43));
2952      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x44 - 32]
2953      = make_char (CHAR96('1', 0x44));
2954      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x45 - 32]
2955      = make_char (CHAR96('1', 0x45)); */
2956   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x46 - 32] = make_char (0x1eb3);
2957   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x47 - 32] = make_char (0x1eb5);
2958   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x48 - 32]
2959      = make_char (CHAR96('1', 0x48));
2960      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x49 - 32]
2961      = make_char (CHAR96('1', 0x49));
2962      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x4A - 32]
2963      = make_char (CHAR96('1', 0x4A));
2964      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x4B - 32]
2965      = make_char (CHAR96('1', 0x4B));
2966      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x4C - 32]
2967      = make_char (CHAR96('1', 0x4C));
2968      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x4D - 32]
2969      = make_char (CHAR96('1', 0x4D));
2970      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x4E - 32]
2971      = make_char (CHAR96('1', 0x4E)); */
2972   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x4f - 32] = make_char (0x1ef3);
2973   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x50 - 32]
2974      = make_char (CHAR96('1', 0x50)); */
2975   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x51 - 32] = make_char (0x1ee9);
2976   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x52 - 32]
2977      = make_char (CHAR96('1', 0x52));
2978      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x53 - 32]
2979      = make_char (CHAR96('1', 0x53));
2980      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x54 - 32]
2981      = make_char (CHAR96('1', 0x54)); */
2982   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x55 - 32] = make_char (0x1ea1);
2983   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x56 - 32] = make_char (0x1ef7);
2984   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x57 - 32] = make_char (0x1eeb);
2985   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x58 - 32] = make_char (0x1eed);
2986   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x59 - 32]
2987      = make_char (CHAR96('1', 0x59));
2988      XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x5A - 32]
2989      = make_char (CHAR96('1', 0x5A)); */
2990   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x5b - 32] = make_char (0x1ef9);
2991   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x5c - 32] = make_char (0x1ef5);
2992   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x5D - 32]
2993      = make_char (CHAR96('1', 0x5D)); */
2994   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x5e - 32] = make_char (0x1ee1);
2995   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x5f - 32] = make_char (0x01b0);
2996   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x60 - 32] = make_char (0x00e0);
2997   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x61 - 32] = make_char (0x00e1);
2998   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x62 - 32] = make_char (0x00e2);
2999   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x63 - 32] = make_char (0x00e3);
3000   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x64 - 32] = make_char (0x1ea3);
3001   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x65 - 32] = make_char (0x0103);
3002   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x66 - 32] = make_char (0x1eef);
3003   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x67 - 32] = make_char (0x1eab);
3004   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x68 - 32] = make_char (0x00e8);
3005   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x69 - 32] = make_char (0x00e9);
3006   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x6a - 32] = make_char (0x00ea);
3007   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x6b - 32] = make_char (0x1ebb);
3008   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x6c - 32] = make_char (0x00ec);
3009   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x6d - 32] = make_char (0x00ed);
3010   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x6e - 32] = make_char (0x0129);
3011   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x6f - 32] = make_char (0x1ec9);
3012   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x70 - 32] = make_char (0x0111);
3013   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x71 - 32] = make_char (0x1ef1);
3014   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x72 - 32] = make_char (0x00f2);
3015   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x73 - 32] = make_char (0x00f3);
3016   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x74 - 32] = make_char (0x00f4);
3017   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x75 - 32] = make_char (0x00f5);
3018   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x76 - 32] = make_char (0x1ecf);
3019   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x77 - 32] = make_char (0x1ecd);
3020   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x78 - 32] = make_char (0x1ee5);
3021   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x79 - 32] = make_char (0x00f9);
3022   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x7a - 32] = make_char (0x00fa);
3023   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x7b - 32] = make_char (0x0169);
3024   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x7c - 32] = make_char (0x1ee7);
3025   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x7d - 32] = make_char (0x00fd);
3026   XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x7e - 32] = make_char (0x1ee3);
3027   /* XVECTOR_DATA(latin_viscii_lower_to_ucs)[0x7F - 32]
3028      = make_char (CHAR96('1', 0x7F)); */
3029
3030   staticpro (&latin_viscii_upper_to_ucs);
3031   latin_viscii_upper_to_ucs = make_vector (96, Qnil);
3032   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x20 - 32]
3033      = make_char (CHAR96('2', 0x20)); */
3034   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x21 - 32] = make_char (0x1eae);
3035   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x22 - 32] = make_char (0x1eb0);
3036   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x23 - 32] = make_char (0x1eb6);
3037   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x24 - 32] = make_char (0x1ea4);
3038   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x25 - 32] = make_char (0x1ea6);
3039   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x26 - 32] = make_char (0x1ea8);
3040   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x27 - 32] = make_char (0x1eac);
3041   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x28 - 32] = make_char (0x1ebc);
3042   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x29 - 32] = make_char (0x1eb8);
3043   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x2a - 32] = make_char (0x1ebe);
3044   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x2b - 32] = make_char (0x1ec0);
3045   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x2c - 32] = make_char (0x1ec2);
3046   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x2d - 32] = make_char (0x1ec4);
3047   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x2e - 32] = make_char (0x1ec6);
3048   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x2f - 32] = make_char (0x1ed0);
3049   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x30 - 32] = make_char (0x1ed2);
3050   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x31 - 32] = make_char (0x1ed4);
3051   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x32 - 32] = make_char (0x1ed6);
3052   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x33 - 32]
3053      = make_char (CHAR96('2', 0x33)); */
3054   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x34 - 32]
3055      = make_char (CHAR96('2', 0x34)); */
3056   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x35 - 32] = make_char (0x1ed8);
3057   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x36 - 32] = make_char (0x1edc);
3058   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x37 - 32] = make_char (0x1ede);
3059   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x38 - 32] = make_char (0x1eca);
3060   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x39 - 32]
3061      = make_char (CHAR96('2', 0x39));
3062      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x3a - 32]
3063      = make_char (CHAR96('2', 0x3a));
3064      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x3b - 32]
3065      = make_char (CHAR96('2', 0x3b));
3066      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x3c - 32]
3067      = make_char (CHAR96('2', 0x3c)); */
3068   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x3d - 32] = make_char (0x01a0);
3069   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x3e - 32] = make_char (0x1eda);
3070   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x3f - 32]
3071      = make_char (CHAR96('2', 0x3f));
3072      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x40 - 32]
3073      = make_char (CHAR96('2', 0x40));
3074      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x41 - 32]
3075      = make_char (CHAR96('2', 0x41));
3076      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x42 - 32]
3077      = make_char (CHAR96('2', 0x42));
3078      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x43 - 32]
3079      = make_char (CHAR96('2', 0x43));
3080      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x44 - 32]
3081      = make_char (CHAR96('2', 0x44));
3082      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x45 - 32]
3083      = make_char (CHAR96('2', 0x45)); */
3084   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x46 - 32] = make_char (0x1eb2);
3085   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x47 - 32] = make_char (0x1eb4);
3086   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x48 - 32]
3087      = make_char (CHAR96('2', 0x48));
3088      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x49 - 32]
3089      = make_char (CHAR96('2', 0x49));
3090      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x4a - 32]
3091      = make_char (CHAR96('2', 0x4a));
3092      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x4b - 32]
3093      = make_char (CHAR96('2', 0x4b));
3094      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x4c - 32]
3095      = make_char (CHAR96('2', 0x4c));
3096      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x4d - 32]
3097      = make_char (CHAR96('2', 0x4d));
3098      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x4e - 32]
3099      = make_char (CHAR96('2', 0x4e)); */
3100   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x4f - 32] = make_char (0x1ef2);
3101   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x50 - 32]
3102      = make_char (CHAR96('2', 0x50)); */
3103   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x51 - 32] = make_char (0x1ee8);
3104   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x52 - 32]
3105      = make_char (CHAR96('2', 0x52));
3106      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x53 - 32]
3107      = make_char (CHAR96('2', 0x53));
3108      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x54 - 32]
3109      = make_char (CHAR96('2', 0x54)); */
3110   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x55 - 32] = make_char (0x1ea0);
3111   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x56 - 32] = make_char (0x1ef6);
3112   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x57 - 32] = make_char (0x1eea);
3113   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x58 - 32] = make_char (0x1eec);
3114   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x59 - 32]
3115      = make_char (CHAR96('2', 0x59));
3116      XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x5a - 32]
3117      = make_char (CHAR96('2', 0x5a)); */
3118   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x5b - 32] = make_char (0x1ef8);
3119   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x5c - 32] = make_char (0x1ef4);
3120   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x5d - 32]
3121      = make_char (CHAR96('2', 0x5d)); */
3122   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x5e - 32] = make_char (0x1ee0);
3123   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x5f - 32] = make_char (0x01af);
3124   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x60 - 32] = make_char (0x00c0);
3125   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x61 - 32] = make_char (0x00c1);
3126   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x62 - 32] = make_char (0x00c2);
3127   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x63 - 32] = make_char (0x00c3);
3128   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x64 - 32] = make_char (0x1ea2);
3129   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x65 - 32] = make_char (0x0102);
3130   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x66 - 32] = make_char (0x1eee);
3131   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x67 - 32] = make_char (0x1eaa);
3132   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x68 - 32] = make_char (0x00c8);
3133   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x69 - 32] = make_char (0x00c9);
3134   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x6a - 32] = make_char (0x00ca);
3135   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x6b - 32] = make_char (0x1eba);
3136   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x6c - 32] = make_char (0x00cc);
3137   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x6d - 32] = make_char (0x00cd);
3138   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x6e - 32] = make_char (0x0128);
3139   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x6f - 32] = make_char (0x1ec8);
3140   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x70 - 32] = make_char (0x0110);
3141   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x71 - 32] = make_char (0x1ef0);
3142   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x72 - 32] = make_char (0x00d2);
3143   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x73 - 32] = make_char (0x00d3);
3144   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x74 - 32] = make_char (0x00d4);
3145   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x75 - 32] = make_char (0x00d5);
3146   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x76 - 32] = make_char (0x1ece);
3147   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x77 - 32] = make_char (0x1ecc);
3148   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x78 - 32] = make_char (0x1ee4);
3149   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x79 - 32] = make_char (0x00d9);
3150   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x7a - 32] = make_char (0x00da);
3151   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x7b - 32] = make_char (0x0168);
3152   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x7c - 32] = make_char (0x1ee6);
3153   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x7d - 32] = make_char (0x00dd);
3154   XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x7e - 32] = make_char (0x1ee2);
3155   /* XVECTOR_DATA(latin_viscii_upper_to_ucs)[0x7f - 32]
3156      = make_char (CHAR96('2', 0x7f)); */
3157
3158   Vcharset_ucs_bmp =
3159     make_charset (LEADING_BYTE_UCS_BMP, Qucs_bmp,
3160                   CHARSET_TYPE_256X256, 1, 0, 0,
3161                   CHARSET_LEFT_TO_RIGHT,
3162                   build_string ("BMP"),
3163                   build_string ("BMP"),
3164                   build_string ("BMP"),
3165                   build_string (""),
3166                   Qnil, 0, 0xFFFF, 0);
3167 #else
3168 # define latin_iso8859_2_to_ucs NULL
3169 # define latin_iso8859_3_to_ucs NULL
3170 # define latin_iso8859_4_to_ucs NULL
3171 # define latin_iso8859_9_to_ucs NULL
3172 # define latin_jisx0201_to_ucs NULL
3173 # define MIN_CHAR_THAI 0
3174 # define MAX_CHAR_THAI 0
3175 # define MIN_CHAR_GREEK 0
3176 # define MAX_CHAR_GREEK 0
3177 # define MIN_CHAR_HEBREW 0
3178 # define MAX_CHAR_HEBREW 0
3179 # define MIN_CHAR_HALFWIDTH_KATAKANA 0
3180 # define MAX_CHAR_HALFWIDTH_KATAKANA 0
3181 # define MIN_CHAR_CYRILLIC 0
3182 # define MAX_CHAR_CYRILLIC 0
3183 #endif
3184   Vcharset_ascii =
3185     make_charset (LEADING_BYTE_ASCII, Qascii,
3186                   CHARSET_TYPE_94, 1, 0, 'B',
3187                   CHARSET_LEFT_TO_RIGHT,
3188                   build_string ("ASCII"),
3189                   build_string ("ASCII)"),
3190                   build_string ("ASCII (ISO646 IRV)"),
3191                   build_string ("\\(iso8859-[0-9]*\\|-ascii\\)"),
3192                   Qnil, 0, 0x7F, 0);
3193   Vcharset_control_1 =
3194     make_charset (LEADING_BYTE_CONTROL_1, Qcontrol_1,
3195                   CHARSET_TYPE_94, 1, 1, 0,
3196                   CHARSET_LEFT_TO_RIGHT,
3197                   build_string ("C1"),
3198                   build_string ("Control characters"),
3199                   build_string ("Control characters 128-191"),
3200                   build_string (""),
3201                   Qnil, 0x80, 0x9F, 0);
3202   Vcharset_latin_iso8859_1 =
3203     make_charset (LEADING_BYTE_LATIN_ISO8859_1, Qlatin_iso8859_1,
3204                   CHARSET_TYPE_96, 1, 1, 'A',
3205                   CHARSET_LEFT_TO_RIGHT,
3206                   build_string ("Latin-1"),
3207                   build_string ("ISO8859-1 (Latin-1)"),
3208                   build_string ("ISO8859-1 (Latin-1)"),
3209                   build_string ("iso8859-1"),
3210                   Qnil, 0xA0, 0xFF, 32);
3211   Vcharset_latin_iso8859_2 =
3212     make_charset (LEADING_BYTE_LATIN_ISO8859_2, Qlatin_iso8859_2,
3213                   CHARSET_TYPE_96, 1, 1, 'B',
3214                   CHARSET_LEFT_TO_RIGHT,
3215                   build_string ("Latin-2"),
3216                   build_string ("ISO8859-2 (Latin-2)"),
3217                   build_string ("ISO8859-2 (Latin-2)"),
3218                   build_string ("iso8859-2"),
3219                   latin_iso8859_2_to_ucs, 0, 0, 32);
3220   Vcharset_latin_iso8859_3 =
3221     make_charset (LEADING_BYTE_LATIN_ISO8859_3, Qlatin_iso8859_3,
3222                   CHARSET_TYPE_96, 1, 1, 'C',
3223                   CHARSET_LEFT_TO_RIGHT,
3224                   build_string ("Latin-3"),
3225                   build_string ("ISO8859-3 (Latin-3)"),
3226                   build_string ("ISO8859-3 (Latin-3)"),
3227                   build_string ("iso8859-3"),
3228                   latin_iso8859_3_to_ucs, 0, 0, 32);
3229   Vcharset_latin_iso8859_4 =
3230     make_charset (LEADING_BYTE_LATIN_ISO8859_4, Qlatin_iso8859_4,
3231                   CHARSET_TYPE_96, 1, 1, 'D',
3232                   CHARSET_LEFT_TO_RIGHT,
3233                   build_string ("Latin-4"),
3234                   build_string ("ISO8859-4 (Latin-4)"),
3235                   build_string ("ISO8859-4 (Latin-4)"),
3236                   build_string ("iso8859-4"),
3237                   latin_iso8859_4_to_ucs, 0, 0, 32);
3238   Vcharset_thai_tis620 =
3239     make_charset (LEADING_BYTE_THAI_TIS620, Qthai_tis620,
3240                   CHARSET_TYPE_96, 1, 1, 'T',
3241                   CHARSET_LEFT_TO_RIGHT,
3242                   build_string ("TIS620"),
3243                   build_string ("TIS620 (Thai)"),
3244                   build_string ("TIS620.2529 (Thai)"),
3245                   build_string ("tis620"),
3246                   Qnil, MIN_CHAR_THAI, MAX_CHAR_THAI, 32);
3247   Vcharset_greek_iso8859_7 =
3248     make_charset (LEADING_BYTE_GREEK_ISO8859_7, Qgreek_iso8859_7,
3249                   CHARSET_TYPE_96, 1, 1, 'F',
3250                   CHARSET_LEFT_TO_RIGHT,
3251                   build_string ("ISO8859-7"),
3252                   build_string ("ISO8859-7 (Greek)"),
3253                   build_string ("ISO8859-7 (Greek)"),
3254                   build_string ("iso8859-7"),
3255                   Qnil, MIN_CHAR_GREEK, MAX_CHAR_GREEK, 32);
3256   Vcharset_arabic_iso8859_6 =
3257     make_charset (LEADING_BYTE_ARABIC_ISO8859_6, Qarabic_iso8859_6,
3258                   CHARSET_TYPE_96, 1, 1, 'G',
3259                   CHARSET_RIGHT_TO_LEFT,
3260                   build_string ("ISO8859-6"),
3261                   build_string ("ISO8859-6 (Arabic)"),
3262                   build_string ("ISO8859-6 (Arabic)"),
3263                   build_string ("iso8859-6"),
3264                   Qnil, 0, 0, 32);
3265   Vcharset_hebrew_iso8859_8 =
3266     make_charset (LEADING_BYTE_HEBREW_ISO8859_8, Qhebrew_iso8859_8,
3267                   CHARSET_TYPE_96, 1, 1, 'H',
3268                   CHARSET_RIGHT_TO_LEFT,
3269                   build_string ("ISO8859-8"),
3270                   build_string ("ISO8859-8 (Hebrew)"),
3271                   build_string ("ISO8859-8 (Hebrew)"),
3272                   build_string ("iso8859-8"),
3273                   Qnil, MIN_CHAR_HEBREW, MAX_CHAR_HEBREW, 32);
3274   Vcharset_katakana_jisx0201 =
3275     make_charset (LEADING_BYTE_KATAKANA_JISX0201, Qkatakana_jisx0201,
3276                   CHARSET_TYPE_94, 1, 1, 'I',
3277                   CHARSET_LEFT_TO_RIGHT,
3278                   build_string ("JISX0201 Kana"),
3279                   build_string ("JISX0201.1976 (Japanese Kana)"),
3280                   build_string ("JISX0201.1976 Japanese Kana"),
3281                   build_string ("jisx0201.1976"),
3282                   Qnil,
3283                   MIN_CHAR_HALFWIDTH_KATAKANA,
3284                   MAX_CHAR_HALFWIDTH_KATAKANA, 33);
3285   Vcharset_latin_jisx0201 =
3286     make_charset (LEADING_BYTE_LATIN_JISX0201, Qlatin_jisx0201,
3287                   CHARSET_TYPE_94, 1, 0, 'J',
3288                   CHARSET_LEFT_TO_RIGHT,
3289                   build_string ("JISX0201 Roman"),
3290                   build_string ("JISX0201.1976 (Japanese Roman)"),
3291                   build_string ("JISX0201.1976 Japanese Roman"),
3292                   build_string ("jisx0201.1976"),
3293                   latin_jisx0201_to_ucs, 0, 0, 33);
3294   Vcharset_cyrillic_iso8859_5 =
3295     make_charset (LEADING_BYTE_CYRILLIC_ISO8859_5, Qcyrillic_iso8859_5,
3296                   CHARSET_TYPE_96, 1, 1, 'L',
3297                   CHARSET_LEFT_TO_RIGHT,
3298                   build_string ("ISO8859-5"),
3299                   build_string ("ISO8859-5 (Cyrillic)"),
3300                   build_string ("ISO8859-5 (Cyrillic)"),
3301                   build_string ("iso8859-5"),
3302                   Qnil, MIN_CHAR_CYRILLIC, MAX_CHAR_CYRILLIC, 32);
3303   Vcharset_latin_iso8859_9 =
3304     make_charset (LEADING_BYTE_LATIN_ISO8859_9, Qlatin_iso8859_9,
3305                   CHARSET_TYPE_96, 1, 1, 'M',
3306                   CHARSET_LEFT_TO_RIGHT,
3307                   build_string ("Latin-5"),
3308                   build_string ("ISO8859-9 (Latin-5)"),
3309                   build_string ("ISO8859-9 (Latin-5)"),
3310                   build_string ("iso8859-9"),
3311                   latin_iso8859_9_to_ucs, 0, 0, 32);
3312   Vcharset_japanese_jisx0208_1978 =
3313     make_charset (LEADING_BYTE_JAPANESE_JISX0208_1978, Qjapanese_jisx0208_1978,
3314                   CHARSET_TYPE_94X94, 2, 0, '@',
3315                   CHARSET_LEFT_TO_RIGHT,
3316                   build_string ("JISX0208.1978"),
3317                   build_string ("JISX0208.1978 (Japanese)"),
3318                   build_string
3319                   ("JISX0208.1978 Japanese Kanji (so called \"old JIS\")"),
3320                   build_string ("\\(jisx0208\\|jisc6226\\)\\.1978"),
3321                   Qnil, 0, 0, 33);
3322   Vcharset_chinese_gb2312 =
3323     make_charset (LEADING_BYTE_CHINESE_GB2312, Qchinese_gb2312,
3324                   CHARSET_TYPE_94X94, 2, 0, 'A',
3325                   CHARSET_LEFT_TO_RIGHT,
3326                   build_string ("GB2312"),
3327                   build_string ("GB2312)"),
3328                   build_string ("GB2312 Chinese simplified"),
3329                   build_string ("gb2312"),
3330                   Qnil, 0, 0, 33);
3331   Vcharset_japanese_jisx0208 =
3332     make_charset (LEADING_BYTE_JAPANESE_JISX0208, Qjapanese_jisx0208,
3333                   CHARSET_TYPE_94X94, 2, 0, 'B',
3334                   CHARSET_LEFT_TO_RIGHT,
3335                   build_string ("JISX0208"),
3336                   build_string ("JISX0208.1983/1990 (Japanese)"),
3337                   build_string ("JISX0208.1983/1990 Japanese Kanji"),
3338                   build_string ("jisx0208.19\\(83\\|90\\)"),
3339                   Qnil, 0, 0, 33);
3340   Vcharset_korean_ksc5601 =
3341     make_charset (LEADING_BYTE_KOREAN_KSC5601, Qkorean_ksc5601,
3342                   CHARSET_TYPE_94X94, 2, 0, 'C',
3343                   CHARSET_LEFT_TO_RIGHT,
3344                   build_string ("KSC5601"),
3345                   build_string ("KSC5601 (Korean"),
3346                   build_string ("KSC5601 Korean Hangul and Hanja"),
3347                   build_string ("ksc5601"),
3348                   Qnil, 0, 0, 33);
3349   Vcharset_japanese_jisx0212 =
3350     make_charset (LEADING_BYTE_JAPANESE_JISX0212, Qjapanese_jisx0212,
3351                   CHARSET_TYPE_94X94, 2, 0, 'D',
3352                   CHARSET_LEFT_TO_RIGHT,
3353                   build_string ("JISX0212"),
3354                   build_string ("JISX0212 (Japanese)"),
3355                   build_string ("JISX0212 Japanese Supplement"),
3356                   build_string ("jisx0212"),
3357                   Qnil, 0, 0, 33);
3358
3359 #define CHINESE_CNS_PLANE_RE(n) "cns11643[.-]\\(.*[.-]\\)?" n "$"
3360   Vcharset_chinese_cns11643_1 =
3361     make_charset (LEADING_BYTE_CHINESE_CNS11643_1, Qchinese_cns11643_1,
3362                   CHARSET_TYPE_94X94, 2, 0, 'G',
3363                   CHARSET_LEFT_TO_RIGHT,
3364                   build_string ("CNS11643-1"),
3365                   build_string ("CNS11643-1 (Chinese traditional)"),
3366                   build_string
3367                   ("CNS 11643 Plane 1 Chinese traditional"),
3368                   build_string (CHINESE_CNS_PLANE_RE("1")),
3369                   Qnil, 0, 0, 33);
3370   Vcharset_chinese_cns11643_2 =
3371     make_charset (LEADING_BYTE_CHINESE_CNS11643_2, Qchinese_cns11643_2,
3372                   CHARSET_TYPE_94X94, 2, 0, 'H',
3373                   CHARSET_LEFT_TO_RIGHT,
3374                   build_string ("CNS11643-2"),
3375                   build_string ("CNS11643-2 (Chinese traditional)"),
3376                   build_string
3377                   ("CNS 11643 Plane 2 Chinese traditional"),
3378                   build_string (CHINESE_CNS_PLANE_RE("2")),
3379                   Qnil, 0, 0, 33);
3380 #ifdef UTF2000
3381   Vcharset_latin_viscii_lower =
3382     make_charset (LEADING_BYTE_LATIN_VISCII_LOWER, Qlatin_viscii_lower,
3383                   CHARSET_TYPE_96, 1, 1, '1',
3384                   CHARSET_LEFT_TO_RIGHT,
3385                   build_string ("VISCII lower"),
3386                   build_string ("VISCII lower (Vietnamese)"),
3387                   build_string ("VISCII lower (Vietnamese)"),
3388                   build_string ("VISCII1.1"),
3389                   latin_viscii_lower_to_ucs, 0, 0, 32);
3390   Vcharset_latin_viscii_upper =
3391     make_charset (LEADING_BYTE_LATIN_VISCII_UPPER, Qlatin_viscii_upper,
3392                   CHARSET_TYPE_96, 1, 1, '2',
3393                   CHARSET_LEFT_TO_RIGHT,
3394                   build_string ("VISCII upper"),
3395                   build_string ("VISCII upper (Vietnamese)"),
3396                   build_string ("VISCII upper (Vietnamese)"),
3397                   build_string ("VISCII1.1"),
3398                   latin_viscii_upper_to_ucs, 0, 0, 32);
3399 #endif
3400   Vcharset_chinese_big5_1 =
3401     make_charset (LEADING_BYTE_CHINESE_BIG5_1, Qchinese_big5_1,
3402                   CHARSET_TYPE_94X94, 2, 0, '0',
3403                   CHARSET_LEFT_TO_RIGHT,
3404                   build_string ("Big5"),
3405                   build_string ("Big5 (Level-1)"),
3406                   build_string
3407                   ("Big5 Level-1 Chinese traditional"),
3408                   build_string ("big5"),
3409                   Qnil, 0, 0, 33);
3410   Vcharset_chinese_big5_2 =
3411     make_charset (LEADING_BYTE_CHINESE_BIG5_2, Qchinese_big5_2,
3412                   CHARSET_TYPE_94X94, 2, 0, '1',
3413                   CHARSET_LEFT_TO_RIGHT,
3414                   build_string ("Big5"),
3415                   build_string ("Big5 (Level-2)"),
3416                   build_string
3417                   ("Big5 Level-2 Chinese traditional"),
3418                   build_string ("big5"),
3419                   Qnil, 0, 0, 33);
3420
3421 #ifdef ENABLE_COMPOSITE_CHARS
3422   /* #### For simplicity, we put composite chars into a 96x96 charset.
3423      This is going to lead to problems because you can run out of
3424      room, esp. as we don't yet recycle numbers. */
3425   Vcharset_composite =
3426     make_charset (LEADING_BYTE_COMPOSITE, Qcomposite,
3427                   CHARSET_TYPE_96X96, 2, 0, 0,
3428                   CHARSET_LEFT_TO_RIGHT,
3429                   build_string ("Composite"),
3430                   build_string ("Composite characters"),
3431                   build_string ("Composite characters"),
3432                   build_string (""));
3433
3434   composite_char_row_next = 32;
3435   composite_char_col_next = 32;
3436
3437   Vcomposite_char_string2char_hash_table =
3438     make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQUAL);
3439   Vcomposite_char_char2string_hash_table =
3440     make_lisp_hash_table (500, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
3441   staticpro (&Vcomposite_char_string2char_hash_table);
3442   staticpro (&Vcomposite_char_char2string_hash_table);
3443 #endif /* ENABLE_COMPOSITE_CHARS */
3444
3445 }