diff options
Diffstat (limited to 'src/coding.h')
| -rw-r--r-- | src/coding.h | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/src/coding.h b/src/coding.h index 192be58f083..d40209be68f 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Header for coding system handler. | 1 | /* Header for coding system handler. |
| 2 | Copyright (C) 2001-2012 Free Software Foundation, Inc. | 2 | Copyright (C) 2001-2013 Free Software Foundation, Inc. |
| 3 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | 3 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 4 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 4 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
| 5 | National Institute of Advanced Industrial Science and Technology (AIST) | 5 | National Institute of Advanced Industrial Science and Technology (AIST) |
| @@ -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" |
| @@ -446,9 +440,13 @@ struct coding_system | |||
| 446 | /* How may heading bytes we can skip for decoding. This is set to | 440 | /* How may heading bytes we can skip for decoding. This is set to |
| 447 | -1 in setup_coding_system, and updated by detect_coding. So, | 441 | -1 in setup_coding_system, and updated by detect_coding. So, |
| 448 | when this is equal to the byte length of the text being | 442 | when this is equal to the byte length of the text being |
| 449 | converted, we can skip the actual conversion process. */ | 443 | converted, we can skip the actual conversion process except for |
| 444 | the eol format. */ | ||
| 450 | ptrdiff_t head_ascii; | 445 | ptrdiff_t head_ascii; |
| 451 | 446 | ||
| 447 | /* Used internally in coding.c. See the comment of detect_ascii. */ | ||
| 448 | int eol_seen; | ||
| 449 | |||
| 452 | /* The following members are set by encoding/decoding routine. */ | 450 | /* The following members are set by encoding/decoding routine. */ |
| 453 | ptrdiff_t produced, produced_char, consumed, consumed_char; | 451 | ptrdiff_t produced, produced_char, consumed, consumed_char; |
| 454 | 452 | ||
| @@ -721,26 +719,13 @@ extern wchar_t *to_unicode (Lisp_Object str, Lisp_Object *buf); | |||
| 721 | failure modes. STR itself is not modified. */ | 719 | failure modes. STR itself is not modified. */ |
| 722 | extern Lisp_Object from_unicode (Lisp_Object str); | 720 | extern Lisp_Object from_unicode (Lisp_Object str); |
| 723 | 721 | ||
| 722 | /* Convert WSTR to an Emacs string. */ | ||
| 723 | extern Lisp_Object from_unicode_buffer (const wchar_t* wstr); | ||
| 724 | |||
| 724 | #endif /* WINDOWSNT || CYGWIN */ | 725 | #endif /* WINDOWSNT || CYGWIN */ |
| 725 | 726 | ||
| 726 | /* Macros for backward compatibility. */ | 727 | /* Macros for backward compatibility. */ |
| 727 | 728 | ||
| 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) \ | 729 | #define encode_coding_string(coding, string, nocopy) \ |
| 745 | (STRING_MULTIBYTE(string) ? \ | 730 | (STRING_MULTIBYTE(string) ? \ |
| 746 | (encode_coding_object (coding, string, 0, 0, SCHARS (string), \ | 731 | (encode_coding_object (coding, string, 0, 0, SCHARS (string), \ |
| @@ -767,7 +752,7 @@ extern Lisp_Object Qcoding_system_p; | |||
| 767 | extern Lisp_Object Qraw_text, Qemacs_mule, Qno_conversion, Qundecided; | 752 | extern Lisp_Object Qraw_text, Qemacs_mule, Qno_conversion, Qundecided; |
| 768 | extern Lisp_Object Qbuffer_file_coding_system; | 753 | extern Lisp_Object Qbuffer_file_coding_system; |
| 769 | 754 | ||
| 770 | extern Lisp_Object Qunix, Qdos, Qmac; | 755 | extern Lisp_Object Qunix, Qdos; |
| 771 | 756 | ||
| 772 | extern Lisp_Object Qtranslation_table; | 757 | extern Lisp_Object Qtranslation_table; |
| 773 | extern Lisp_Object Qtranslation_table_id; | 758 | extern Lisp_Object Qtranslation_table_id; |