int i;
/* At first, set several fields to default values. */
- coding->require_flushing = 0;
coding->last_block = 0;
coding->selective = 0;
coding->composing = 0;
}
if (VECTORP (eol_type))
- coding->eol_type = CODING_EOL_UNDECIDED;
+ {
+ coding->eol_type = CODING_EOL_UNDECIDED;
+ coding->common_flags = CODING_REQUIRE_DETECTION_MASK;
+ }
else if (XFASTINT (eol_type) == 1)
- coding->eol_type = CODING_EOL_CRLF;
+ {
+ coding->eol_type = CODING_EOL_CRLF;
+ coding->common_flags
+ = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
+ }
else if (XFASTINT (eol_type) == 2)
- coding->eol_type = CODING_EOL_CR;
+ {
+ coding->eol_type = CODING_EOL_CR;
+ coding->common_flags
+ = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
+ }
else
- coding->eol_type = CODING_EOL_LF;
+ {
+ coding->eol_type = CODING_EOL_LF;
+ coding->common_flags = 0;
+ }
type = XVECTOR (coding_spec)->contents[0];
switch (XFASTINT (type))
{
case 0:
coding->type = coding_type_emacs_mule;
+ if (!NILP (coding->post_read_conversion))
+ coding->common_flags |= CODING_REQUIRE_DECODING_MASK;
+ if (!NILP (coding->pre_write_conversion))
+ coding->common_flags |= CODING_REQUIRE_ENCODING_MASK;
break;
case 1:
coding->type = coding_type_sjis;
+ coding->common_flags
+ |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
break;
case 2:
coding->type = coding_type_iso2022;
+ coding->common_flags
+ |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
{
Lisp_Object val, temp;
Lisp_Object *flags;
? 2 : 0)));
}
}
- coding->require_flushing = 1;
+ coding->common_flags |= CODING_REQUIRE_FLUSHING_MASK;
break;
case 3:
coding->type = coding_type_big5;
+ coding->common_flags
+ |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
coding->flags
= (NILP (XVECTOR (coding_spec)->contents[4])
? CODING_FLAG_BIG5_HKU
case 4:
coding->type = coding_type_ccl;
+ coding->common_flags
+ |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
{
Lisp_Object val = XVECTOR (coding_spec)->contents[4];
if (CONSP (val)
else
goto label_invalid_coding_system;
}
- coding->require_flushing = 1;
+ coding->common_flags |= CODING_REQUIRE_FLUSHING_MASK;
break;
case 5:
default:
if (EQ (type, Qt))
- coding->type = coding_type_undecided;
+ {
+ coding->type = coding_type_undecided;
+ coding->common_flags |= CODING_REQUIRE_DETECTION_MASK;
+ }
else
coding->type = coding_type_no_conversion;
break;
label_invalid_coding_system:
coding->type = coding_type_no_conversion;
+ coding->common_flags = 0;
coding->eol_type = CODING_EOL_LF;
coding->symbol = coding->pre_write_conversion = coding->post_read_conversion
= Qnil;
insval = call1 (coding->post_read_conversion, make_number (len));
CHECK_NUMBER (insval, 0);
if (pos >= beg + len)
- pos = beg + XINT (insval);
+ pos += XINT (insval) - len;
else if (pos > beg)
pos = beg;
TEMP_SET_PT (pos);