Commit 6e85d753 authored by Kenichi Handa's avatar Kenichi Handa

(Fset_terminal_coding_system_internal): Set

CODING_FLAG_ISO_SAFE in terminal_coding.flags.
(ENCODE_ISO_CHARACTER_DIMENSION1): Check
CODING_SPEC_ISO_EXPECTED_CHARSETS.
(ENCODE_ISO_CHARACTER_DIMENSION2): Likewise.
parent e6de76f8
......@@ -1204,8 +1204,7 @@ decode_coding_iso2022 (coding, source, destination,
break; \
} \
else if (coding->flags & CODING_FLAG_ISO_SAFE \
&& (CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) \
== CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION)) \
&& !CODING_SPEC_ISO_EXPECTED_CHARSETS (coding)[charset]) \
{ \
/* We should not encode this character, instead produce one or \
two `?'s. */ \
......@@ -1248,8 +1247,7 @@ decode_coding_iso2022 (coding, source, destination,
break; \
} \
else if (coding->flags & CODING_FLAG_ISO_SAFE \
&& (CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) \
== CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION)) \
&& !CODING_SPEC_ISO_EXPECTED_CHARSETS (coding)[charset]) \
{ \
/* We should not encode this character, instead produce one or \
two `?'s. */ \
......@@ -2380,9 +2378,9 @@ setup_coding_system (coding_system, coding)
CODING_SPEC_ISO_INVOCATION (coding, 1)
= (coding->flags & CODING_FLAG_ISO_SEVEN_BITS ? -1 : 1);
/* Not single shifting at first. */
CODING_SPEC_ISO_SINGLE_SHIFTING(coding) = 0;
CODING_SPEC_ISO_SINGLE_SHIFTING (coding) = 0;
/* Beginning of buffer should also be regarded as bol. */
CODING_SPEC_ISO_BOL(coding) = 1;
CODING_SPEC_ISO_BOL (coding) = 1;
/* Checks FLAGS[REG] (REG = 0, 1, 2 3) and decide designations.
FLAGS[REG] can be one of below:
......@@ -2397,6 +2395,7 @@ setup_coding_system (coding_system, coding)
for (charset = 0; charset <= MAX_CHARSET; charset++)
CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset)
= CODING_SPEC_ISO_NO_REQUESTED_DESIGNATION;
bzero (CODING_SPEC_ISO_EXPECTED_CHARSETS (coding), MAX_CHARSET + 1);
for (i = 0; i < 4; i++)
{
if (INTEGERP (flags[i])
......@@ -2405,6 +2404,7 @@ setup_coding_system (coding_system, coding)
{
CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = charset;
CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) = i;
CODING_SPEC_ISO_EXPECTED_CHARSETS (coding)[charset] = 1;
}
else if (EQ (flags[i], Qt))
{
......@@ -2422,6 +2422,7 @@ setup_coding_system (coding_system, coding)
{
CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = charset;
CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) =i;
CODING_SPEC_ISO_EXPECTED_CHARSETS (coding)[charset] = 1;
}
else
CODING_SPEC_ISO_INITIAL_DESIGNATION (coding, i) = -1;
......@@ -2432,8 +2433,12 @@ setup_coding_system (coding_system, coding)
&& (charset = XINT (XCONS (tail)->car),
CHARSET_VALID_P (charset))
|| (charset = get_charset_id (XCONS (tail)->car)) >= 0)
{
CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset)
= i;
CODING_SPEC_ISO_EXPECTED_CHARSETS (coding)[charset]
= 1;
}
else if (EQ (XCONS (tail)->car, Qt))
default_reg_bits |= 1 << i;
tail = XCONS (tail)->cdr;
......@@ -2456,7 +2461,6 @@ setup_coding_system (coding_system, coding)
default_reg_bits &= 3;
}
if (! (coding->flags & CODING_FLAG_ISO_SAFE))
for (charset = 0; charset <= MAX_CHARSET; charset++)
if (CHARSET_VALID_P (charset)
&& (CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset)
......@@ -3585,6 +3589,9 @@ DEFUN ("set-terminal-coding-system-internal",
{
CHECK_SYMBOL (coding_system, 0);
setup_coding_system (Fcheck_coding_system (coding_system), &terminal_coding);
/* We had better not send unexpected characters to terminal. */
terminal_coding.flags |= CODING_FLAG_ISO_SAFE;
return Qnil;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment