- if (c <= MAX_CHAR_BASIC_LATIN)
- {
- *charset = Vcharset_ascii;
- *c1 = c;
- *c2 = 0;
- }
- else if (c < 0xA0)
- {
- *charset = Vcharset_control_1;
- *c1 = c & 0x7f;
- *c2 = 0;
- }
- else if (c <= 0xff)
- {
- *charset = Vcharset_latin_iso8859_1;
- *c1 = c & 0x7f;
- *c2 = 0;
- }
- else if (c <= 0x17f)
- {
- *charset
- = CHARSET_BY_LEADING_BYTE (latin_a_char_to_charset[c - 0x100]);
-
- if (EQ (*charset, Vcharset_latin_iso8859_2))
- {
- *c1 = get_byte_from_character_table (c, ucs_to_latin_iso8859_2);
- *c2 = 0;
- }
- else if (EQ (*charset, Vcharset_latin_iso8859_3))
- {
- *c1 = get_byte_from_character_table (c, ucs_to_latin_iso8859_3);
- *c2 = 0;
- }
- else if (EQ (*charset, Vcharset_latin_iso8859_4))
- {
- *c1 = get_byte_from_character_table (c, ucs_to_latin_iso8859_4);
- *c2 = 0;
- }
- else if (EQ (*charset, Vcharset_latin_iso8859_9))
- {
- *c1 = get_byte_from_character_table (c, ucs_to_latin_iso8859_9);
- *c2 = 0;
- }
- else
- {
- *c1 = latin_a_char_to_byte1[c - 0x100];
- *c2 = latin_a_char_to_byte2[c - 0x100];
- }
- }
- else if (c < MIN_CHAR_GREEK)
- {
- if ( (*c1 = get_byte_from_character_table (c, ucs_to_latin_iso8859_2)) )
- {
- *charset = Vcharset_latin_iso8859_2;
- *c2 = 0;
- }
- else if ( (*c1 =
- get_byte_from_character_table (c, ucs_to_latin_iso8859_3)) )
- {
- *charset = Vcharset_latin_iso8859_3;
- *c2 = 0;
- }
- else if ( (*c1 =
- get_byte_from_character_table (c, ucs_to_latin_iso8859_4)) )
- {
- *charset = Vcharset_latin_iso8859_4;
- *c2 = 0;
- }
- else if ( (*c1 =
- get_byte_from_character_table (c, ucs_to_latin_iso8859_9)) )
- {
- *charset = Vcharset_latin_iso8859_9;
- *c2 = 0;
- }
- else if ( (*c1 =
- get_byte_from_character_table (c,
- ucs_to_latin_viscii_lower)) )
- {
- *charset = Vcharset_latin_viscii_lower;
- *c2 = 0;
- }
- else if ( (*c1 =
- get_byte_from_character_table (c,
- ucs_to_latin_viscii_upper)) )
- {
- *charset = Vcharset_latin_viscii_upper;
- *c2 = 0;
- }
- else
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- }
- else if (c <= MAX_CHAR_GREEK)
- {
- *charset = Vcharset_greek_iso8859_7;
- *c1 = c - MIN_CHAR_GREEK + 0x20;
- *c2 = 0;
- }
- else if (c < MIN_CHAR_CYRILLIC)
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- else if (c <= MAX_CHAR_CYRILLIC)
- {
- *charset = Vcharset_cyrillic_iso8859_5;
- *c1 = c - MIN_CHAR_CYRILLIC + 0x20;
- *c2 = 0;
- }
- else if (c < MIN_CHAR_HEBREW)
- {
- *charset = Vcharset_ucs_bmp;
- *c1 = c >> 8;
- *c2 = c & 0xff;
- }
- else if (c <= MAX_CHAR_HEBREW)
- {
- *charset = Vcharset_hebrew_iso8859_8;
- *c1 = c - MIN_CHAR_HEBREW + 0x20;
- *c2 = 0;
- }
- else if (c < MIN_CHAR_THAI)