aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.h
diff options
context:
space:
mode:
authorDmitry Antipov2013-03-06 15:26:30 +0400
committerDmitry Antipov2013-03-06 15:26:30 +0400
commit1af1a51aada18d88fac7b2ba09231428c6a65d7c (patch)
tree0de56c02accf7de21dff3d26da734374ab2c9b6f /src/coding.h
parent34fd7a48dde735b199d618c06ea87a5e8f193406 (diff)
downloademacs-1af1a51aada18d88fac7b2ba09231428c6a65d7c.tar.gz
emacs-1af1a51aada18d88fac7b2ba09231428c6a65d7c.zip
Coding system support cleanup and minor refactoring.
* coding.h (enum coding_result_code): Remove CODING_RESULT_INCONSISTENT_EOL and CODING_RESULT_INSUFFICIENT_MEM. (toplevel): Remove unused CODING_MODE_INHIBIT_INCONSISTENT_EOL. (CODING_MODE_LAST_BLOCK, CODING_MODE_SELECTIVE_DISPLAY) (CODING_MODE_DIRECTION, CODING_MODE_FIXED_DESTINATION) (CODING_MODE_SAFE_ENCODING): Rearrange bit values. (decode_coding_region, encode_coding_region, decode_coding_string): Remove unused compatibility macros. * coding.c (Qinconsistent_eol, Qinsufficient_memory): Remove. (record_conversion_result): Adjust user. (syms_of_coding): Likewise. (ALLOC_CONVERSION_WORK_AREA): Use SAFE_ALLOCA. (decode_coding, encode_coding): Add USE_SAFE_ALLOCA and SAFE_FREE. (decode_coding_object): Simplify since xrealloc never returns NULL. Add eassert.
Diffstat (limited to 'src/coding.h')
-rw-r--r--src/coding.h34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/coding.h b/src/coding.h
index eb95fa13ddb..28a7d776b63 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -272,37 +272,31 @@ enum coding_result_code
272 CODING_RESULT_SUCCESS, 272 CODING_RESULT_SUCCESS,
273 CODING_RESULT_INSUFFICIENT_SRC, 273 CODING_RESULT_INSUFFICIENT_SRC,
274 CODING_RESULT_INSUFFICIENT_DST, 274 CODING_RESULT_INSUFFICIENT_DST,
275 CODING_RESULT_INCONSISTENT_EOL,
276 CODING_RESULT_INVALID_SRC, 275 CODING_RESULT_INVALID_SRC,
277 CODING_RESULT_INTERRUPT, 276 CODING_RESULT_INTERRUPT
278 CODING_RESULT_INSUFFICIENT_MEM
279 }; 277 };
280 278
281 279
282/* Macros used for the member `mode' of the struct coding_system. */ 280/* Macros used for the member `mode' of the struct coding_system. */
283 281
284/* If set, recover the original CR or LF of the already decoded text
285 when the decoding routine encounters an inconsistent eol format. */
286#define CODING_MODE_INHIBIT_INCONSISTENT_EOL 0x01
287
288/* If set, the decoding/encoding routines treat the current data as 282/* If set, the decoding/encoding routines treat the current data as
289 the last block of the whole text to be converted, and do the 283 the last block of the whole text to be converted, and do the
290 appropriate finishing job. */ 284 appropriate finishing job. */
291#define CODING_MODE_LAST_BLOCK 0x02 285#define CODING_MODE_LAST_BLOCK 0x01
292 286
293/* If set, it means that the current source text is in a buffer which 287/* If set, it means that the current source text is in a buffer which
294 enables selective display. */ 288 enables selective display. */
295#define CODING_MODE_SELECTIVE_DISPLAY 0x04 289#define CODING_MODE_SELECTIVE_DISPLAY 0x02
296 290
297/* This flag is used by the decoding/encoding routines on the fly. If 291/* This flag is used by the decoding/encoding routines on the fly. If
298 set, it means that right-to-left text is being processed. */ 292 set, it means that right-to-left text is being processed. */
299#define CODING_MODE_DIRECTION 0x08 293#define CODING_MODE_DIRECTION 0x04
300 294
301#define CODING_MODE_FIXED_DESTINATION 0x10 295#define CODING_MODE_FIXED_DESTINATION 0x08
302 296
303/* If set, it means that the encoding routines produces some safe 297/* If set, it means that the encoding routines produces some safe
304 ASCII characters (usually '?') for unsupported characters. */ 298 ASCII characters (usually '?') for unsupported characters. */
305#define CODING_MODE_SAFE_ENCODING 0x20 299#define CODING_MODE_SAFE_ENCODING 0x10
306 300
307 /* For handling composition sequence. */ 301 /* For handling composition sequence. */
308#include "composite.h" 302#include "composite.h"
@@ -725,22 +719,6 @@ extern Lisp_Object from_unicode (Lisp_Object str);
725 719
726/* Macros for backward compatibility. */ 720/* Macros for backward compatibility. */
727 721
728#define decode_coding_region(coding, from, to) \
729 decode_coding_object (coding, Fcurrent_buffer (), \
730 from, CHAR_TO_BYTE (from), \
731 to, CHAR_TO_BYTE (to), Fcurrent_buffer ())
732
733
734#define encode_coding_region(coding, from, to) \
735 encode_coding_object (coding, Fcurrent_buffer (), \
736 from, CHAR_TO_BYTE (from), \
737 to, CHAR_TO_BYTE (to), Fcurrent_buffer ())
738
739
740#define decode_coding_string(coding, string, nocopy) \
741 decode_coding_object (coding, string, 0, 0, SCHARS (string), \
742 SBYTES (string), Qt)
743
744#define encode_coding_string(coding, string, nocopy) \ 722#define encode_coding_string(coding, string, nocopy) \
745 (STRING_MULTIBYTE(string) ? \ 723 (STRING_MULTIBYTE(string) ? \
746 (encode_coding_object (coding, string, 0, 0, SCHARS (string), \ 724 (encode_coding_object (coding, string, 0, 0, SCHARS (string), \