}
else
{
- Lisp_Object charset;
+ Lisp_Object charset, value;
unsigned int c1, c2, s1, s2;
#ifdef UTF2000
- if ( (c1 =
- get_byte_from_character_table
- (ch, XCHARSET_TO_BYTE1_TABLE (Vcharset_latin_jisx0201))) )
+ if (INTP (value =
+ get_char_code_table
+ (ch, XCHARSET_ENCODING_TABLE (Vcharset_latin_jisx0201))))
{
charset = Vcharset_latin_jisx0201;
+ c1 = XINT (value);
c2 = 0;
}
else
{
int reg;
- BREAKUP_CHAR (ch, charset, byte1, byte2);
- ensure_correct_direction (XCHARSET_DIRECTION (charset),
- codesys, dst, flags, 0);
-
/* Now determine which register to use. */
reg = -1;
for (i = 0; i < 4; i++)
{
- if (EQ (charset, str->iso2022.charset[i]) ||
- EQ (charset,
- CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i)))
+ if ((CHARSETP (charset = str->iso2022.charset[i])
+ && (byte1 = charset_get_byte1 (charset, ch))) ||
+ (CHARSETP
+ (charset
+ = CODING_SYSTEM_ISO2022_INITIAL_CHARSET (codesys, i))
+ && (byte1 = charset_get_byte1 (charset, ch))))
{
reg = i;
+ byte2 = charset_get_byte2 (charset, ch);
break;
}
}
-
+ if (reg == -1)
+ {
+ Lisp_Object original_default_coded_charset_priority_list
+ = Vdefault_coded_charset_priority_list;
+
+ while (!EQ (Vdefault_coded_charset_priority_list, Qnil))
+ {
+ BREAKUP_CHAR (ch, charset, byte1, byte2);
+ if (XCHARSET_FINAL (charset))
+ goto found;
+ Vdefault_coded_charset_priority_list
+ = Fcdr (Fmemq (XCHARSET_NAME (charset),
+ Vdefault_coded_charset_priority_list));
+ }
+ BREAKUP_CHAR (ch, charset, byte1, byte2);
+ found:
+ Vdefault_coded_charset_priority_list
+ = original_default_coded_charset_priority_list;
+ }
+ ensure_correct_direction (XCHARSET_DIRECTION (charset),
+ codesys, dst, flags, 0);
+
if (reg == -1)
{
if (XCHARSET_GRAPHIC (charset) != 0)