: AREF (raw_text_eol_type, 2));
}
+/* Return true if CODING corresponds to raw-text coding-system. */
+
+bool
+raw_text_coding_system_p (struct coding_system *coding)
+{
+ return (coding->decoder == decode_coding_raw_text
+ && coding->encoder == encode_coding_raw_text) ? true : false;
+}
+
/* If CODING_SYSTEM doesn't specify end-of-line format, return one of
the subsidiary that has the same eol-spec as PARENT (if it is not
{ /* An encoded byte sequence, let's try to decode it. */
struct coding_system *coding
= TERMINAL_KEYBOARD_CODING (terminal);
- unsigned char src[MAX_ENCODED_BYTES];
- unsigned char dest[MAX_ENCODED_BYTES * MAX_MULTIBYTE_LENGTH];
- int i;
- for (i = 0; i < n; i++)
- src[i] = XINT (events[i]);
- if (meta_key != 2)
- for (i = 0; i < n; i++)
- src[i] &= ~0x80;
- coding->destination = dest;
- coding->dst_bytes = sizeof dest;
- decode_coding_c_string (coding, src, n, Qnil);
- eassert (coding->produced_char <= n);
- if (coding->produced_char == 0)
- { /* The encoded sequence is incomplete. */
- if (n < MAX_ENCODED_BYTES) /* Avoid buffer overflow. */
- continue; /* Read on! */
+
+ if (raw_text_coding_system_p (coding))
+ {
+ int i;
+ if (meta_key != 2)
+ for (i = 0; i < n; i++)
+ events[i] = make_number (XINT (events[i]) & ~0x80);
}
else
{
- const unsigned char *p = coding->destination;
- eassert (coding->carryover_bytes == 0);
- n = 0;
- while (n < coding->produced_char)
- events[n++] = make_number (STRING_CHAR_ADVANCE (p));
+ unsigned char src[MAX_ENCODED_BYTES];
+ unsigned char dest[MAX_ENCODED_BYTES * MAX_MULTIBYTE_LENGTH];
+ int i;
+ for (i = 0; i < n; i++)
+ src[i] = XINT (events[i]);
+ if (meta_key != 2)
+ for (i = 0; i < n; i++)
+ src[i] &= ~0x80;
+ coding->destination = dest;
+ coding->dst_bytes = sizeof dest;
+ decode_coding_c_string (coding, src, n, Qnil);
+ eassert (coding->produced_char <= n);
+ if (coding->produced_char == 0)
+ { /* The encoded sequence is incomplete. */
+ if (n < MAX_ENCODED_BYTES) /* Avoid buffer overflow. */
+ continue; /* Read on! */
+ }
+ else
+ {
+ const unsigned char *p = coding->destination;
+ eassert (coding->carryover_bytes == 0);
+ n = 0;
+ while (n < coding->produced_char)
+ events[n++] = make_number (STRING_CHAR_ADVANCE (p));
+ }
}
}
/* Now `events' should hold decoded events.