diff options
| author | Kenichi Handa | 2003-05-29 13:17:04 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-05-29 13:17:04 +0000 |
| commit | 5e5c78beb4172678f8318c6cfdced304fef94022 (patch) | |
| tree | 58ab0aedeffee49eb23841f6bd58ab71d3ed1c83 /src | |
| parent | 81f41166afbb0912a83aa05e11a194a832f44257 (diff) | |
| download | emacs-5e5c78beb4172678f8318c6cfdced304fef94022.tar.gz emacs-5e5c78beb4172678f8318c6cfdced304fef94022.zip | |
(setup_coding_system): If coding has
post-read-conversion or pre-write-conversion, set
CODING_REQUIRE_DECODING_MASK and CODING_REQUIRE_ENCODING_MASK
respectively.
(decode_coding_gap): Run post-read-conversion if any.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/coding.c b/src/coding.c index 30c04ae0e3d..8e5efe82746 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -4823,6 +4823,10 @@ setup_coding_system (coding_system, coding) | |||
| 4823 | coding->head_ascii = -1; | 4823 | coding->head_ascii = -1; |
| 4824 | coding->common_flags | 4824 | coding->common_flags |
| 4825 | = (VECTORP (eol_type) ? CODING_REQUIRE_DETECTION_MASK : 0); | 4825 | = (VECTORP (eol_type) ? CODING_REQUIRE_DETECTION_MASK : 0); |
| 4826 | if (! NILP (CODING_ATTR_POST_READ (attrs))) | ||
| 4827 | coding->common_flags |= CODING_REQUIRE_DECODING_MASK; | ||
| 4828 | if (! NILP (CODING_ATTR_PRE_WRITE (attrs))) | ||
| 4829 | coding->common_flags |= CODING_REQUIRE_ENCODING_MASK; | ||
| 4826 | 4830 | ||
| 4827 | val = CODING_ATTR_SAFE_CHARSETS (attrs); | 4831 | val = CODING_ATTR_SAFE_CHARSETS (attrs); |
| 4828 | coding->max_charset_id = XSTRING (val)->size - 1; | 4832 | coding->max_charset_id = XSTRING (val)->size - 1; |
| @@ -6227,6 +6231,7 @@ decode_coding_gap (coding, chars, bytes) | |||
| 6227 | EMACS_INT chars, bytes; | 6231 | EMACS_INT chars, bytes; |
| 6228 | { | 6232 | { |
| 6229 | int count = specpdl_ptr - specpdl; | 6233 | int count = specpdl_ptr - specpdl; |
| 6234 | Lisp_Object attrs; | ||
| 6230 | Lisp_Object buffer; | 6235 | Lisp_Object buffer; |
| 6231 | 6236 | ||
| 6232 | buffer = Fcurrent_buffer (); | 6237 | buffer = Fcurrent_buffer (); |
| @@ -6238,7 +6243,7 @@ decode_coding_gap (coding, chars, bytes) | |||
| 6238 | coding->src_pos = -chars; | 6243 | coding->src_pos = -chars; |
| 6239 | coding->src_pos_byte = -bytes; | 6244 | coding->src_pos_byte = -bytes; |
| 6240 | coding->src_multibyte = chars < bytes; | 6245 | coding->src_multibyte = chars < bytes; |
| 6241 | coding->dst_object = coding->src_object; | 6246 | coding->dst_object = buffer; |
| 6242 | coding->dst_pos = PT; | 6247 | coding->dst_pos = PT; |
| 6243 | coding->dst_pos_byte = PT_BYTE; | 6248 | coding->dst_pos_byte = PT_BYTE; |
| 6244 | coding->dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); | 6249 | coding->dst_multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
| @@ -6249,6 +6254,23 @@ decode_coding_gap (coding, chars, bytes) | |||
| 6249 | 6254 | ||
| 6250 | decode_coding (coding); | 6255 | decode_coding (coding); |
| 6251 | 6256 | ||
| 6257 | attrs = CODING_ID_ATTRS (coding->id); | ||
| 6258 | if (! NILP (CODING_ATTR_POST_READ (attrs))) | ||
| 6259 | { | ||
| 6260 | struct gcpro gcpro1; | ||
| 6261 | EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE; | ||
| 6262 | Lisp_Object val; | ||
| 6263 | |||
| 6264 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); | ||
| 6265 | GCPRO1 (buffer); | ||
| 6266 | val = call1 (CODING_ATTR_POST_READ (attrs), | ||
| 6267 | make_number (coding->produced_char)); | ||
| 6268 | UNGCPRO; | ||
| 6269 | CHECK_NATNUM (val); | ||
| 6270 | coding->produced_char += Z - prev_Z; | ||
| 6271 | coding->produced += Z_BYTE - prev_Z_BYTE; | ||
| 6272 | } | ||
| 6273 | |||
| 6252 | unbind_to (count, Qnil); | 6274 | unbind_to (count, Qnil); |
| 6253 | return coding->result; | 6275 | return coding->result; |
| 6254 | } | 6276 | } |