Mercurial > emacs
comparison src/coding.c @ 89863:428fc37b2ae6
Add many prototypes for static functions.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Thu, 11 Mar 2004 11:21:39 +0000 |
| parents | 7160ded23e55 |
| children | 9a279ff9d245 |
comparison
equal
deleted
inserted
replaced
| 89862:2c945addc36a | 89863:428fc37b2ae6 |
|---|---|
| 408 Lisp_Object Vtranslation_table_for_input; | 408 Lisp_Object Vtranslation_table_for_input; |
| 409 | 409 |
| 410 /* Two special coding systems. */ | 410 /* Two special coding systems. */ |
| 411 Lisp_Object Vsjis_coding_system; | 411 Lisp_Object Vsjis_coding_system; |
| 412 Lisp_Object Vbig5_coding_system; | 412 Lisp_Object Vbig5_coding_system; |
| 413 | |
| 414 static void record_conversion_result (struct coding_system *coding, | |
| 415 enum coding_result_code result); | |
| 416 static int detect_coding_utf_8 P_ ((struct coding_system *, | |
| 417 struct coding_detection_info *info)); | |
| 418 static void decode_coding_utf_8 P_ ((struct coding_system *)); | |
| 419 static int encode_coding_utf_8 P_ ((struct coding_system *)); | |
| 420 | |
| 421 static int detect_coding_utf_16 P_ ((struct coding_system *, | |
| 422 struct coding_detection_info *info)); | |
| 423 static void decode_coding_utf_16 P_ ((struct coding_system *)); | |
| 424 static int encode_coding_utf_16 P_ ((struct coding_system *)); | |
| 425 | |
| 426 static int detect_coding_iso_2022 P_ ((struct coding_system *, | |
| 427 struct coding_detection_info *info)); | |
| 428 static void decode_coding_iso_2022 P_ ((struct coding_system *)); | |
| 429 static int encode_coding_iso_2022 P_ ((struct coding_system *)); | |
| 430 | |
| 431 static int detect_coding_emacs_mule P_ ((struct coding_system *, | |
| 432 struct coding_detection_info *info)); | |
| 433 static void decode_coding_emacs_mule P_ ((struct coding_system *)); | |
| 434 static int encode_coding_emacs_mule P_ ((struct coding_system *)); | |
| 435 | |
| 436 static int detect_coding_sjis P_ ((struct coding_system *, | |
| 437 struct coding_detection_info *info)); | |
| 438 static void decode_coding_sjis P_ ((struct coding_system *)); | |
| 439 static int encode_coding_sjis P_ ((struct coding_system *)); | |
| 440 | |
| 441 static int detect_coding_big5 P_ ((struct coding_system *, | |
| 442 struct coding_detection_info *info)); | |
| 443 static void decode_coding_big5 P_ ((struct coding_system *)); | |
| 444 static int encode_coding_big5 P_ ((struct coding_system *)); | |
| 445 | |
| 446 static int detect_coding_ccl P_ ((struct coding_system *, | |
| 447 struct coding_detection_info *info)); | |
| 448 static void decode_coding_ccl P_ ((struct coding_system *)); | |
| 449 static int encode_coding_ccl P_ ((struct coding_system *)); | |
| 450 | |
| 451 static void decode_coding_raw_text P_ ((struct coding_system *)); | |
| 452 static int encode_coding_raw_text P_ ((struct coding_system *)); | |
| 453 | |
| 454 | 413 |
| 455 /* ISO2022 section */ | 414 /* ISO2022 section */ |
| 456 | 415 |
| 457 #define CODING_ISO_INITIAL(coding, reg) \ | 416 #define CODING_ISO_INITIAL(coding, reg) \ |
| 458 (XINT (AREF (AREF (CODING_ID_ATTRS ((coding)->id), \ | 417 (XINT (AREF (AREF (CODING_ID_ATTRS ((coding)->id), \ |
| 855 do { \ | 814 do { \ |
| 856 EMIT_TWO_BYTES (c1, c2); \ | 815 EMIT_TWO_BYTES (c1, c2); \ |
| 857 EMIT_TWO_BYTES (c3, c4); \ | 816 EMIT_TWO_BYTES (c3, c4); \ |
| 858 } while (0) | 817 } while (0) |
| 859 | 818 |
| 819 | |
| 820 /* Prototypes for static functions. */ | |
| 821 static void record_conversion_result P_ ((struct coding_system *coding, | |
| 822 enum coding_result_code result)); | |
| 823 static int detect_coding_utf_8 P_ ((struct coding_system *, | |
| 824 struct coding_detection_info *info)); | |
| 825 static void decode_coding_utf_8 P_ ((struct coding_system *)); | |
| 826 static int encode_coding_utf_8 P_ ((struct coding_system *)); | |
| 827 | |
| 828 static int detect_coding_utf_16 P_ ((struct coding_system *, | |
| 829 struct coding_detection_info *info)); | |
| 830 static void decode_coding_utf_16 P_ ((struct coding_system *)); | |
| 831 static int encode_coding_utf_16 P_ ((struct coding_system *)); | |
| 832 | |
| 833 static int detect_coding_iso_2022 P_ ((struct coding_system *, | |
| 834 struct coding_detection_info *info)); | |
| 835 static void decode_coding_iso_2022 P_ ((struct coding_system *)); | |
| 836 static int encode_coding_iso_2022 P_ ((struct coding_system *)); | |
| 837 | |
| 838 static int detect_coding_emacs_mule P_ ((struct coding_system *, | |
| 839 struct coding_detection_info *info)); | |
| 840 static void decode_coding_emacs_mule P_ ((struct coding_system *)); | |
| 841 static int encode_coding_emacs_mule P_ ((struct coding_system *)); | |
| 842 | |
| 843 static int detect_coding_sjis P_ ((struct coding_system *, | |
| 844 struct coding_detection_info *info)); | |
| 845 static void decode_coding_sjis P_ ((struct coding_system *)); | |
| 846 static int encode_coding_sjis P_ ((struct coding_system *)); | |
| 847 | |
| 848 static int detect_coding_big5 P_ ((struct coding_system *, | |
| 849 struct coding_detection_info *info)); | |
| 850 static void decode_coding_big5 P_ ((struct coding_system *)); | |
| 851 static int encode_coding_big5 P_ ((struct coding_system *)); | |
| 852 | |
| 853 static int detect_coding_ccl P_ ((struct coding_system *, | |
| 854 struct coding_detection_info *info)); | |
| 855 static void decode_coding_ccl P_ ((struct coding_system *)); | |
| 856 static int encode_coding_ccl P_ ((struct coding_system *)); | |
| 857 | |
| 858 static void decode_coding_raw_text P_ ((struct coding_system *)); | |
| 859 static int encode_coding_raw_text P_ ((struct coding_system *)); | |
| 860 | |
| 861 static void coding_set_source P_ ((struct coding_system *)); | |
| 862 static void coding_set_destination P_ ((struct coding_system *)); | |
| 863 static void coding_alloc_by_realloc P_ ((struct coding_system *, EMACS_INT)); | |
| 864 static void coding_alloc_by_making_gap P_ ((struct coding_system *, | |
| 865 EMACS_INT)); | |
| 866 static unsigned char *alloc_destination P_ ((struct coding_system *, | |
| 867 EMACS_INT, unsigned char *)); | |
| 868 static void setup_iso_safe_charsets P_ ((Lisp_Object)); | |
| 869 static unsigned char *encode_designation_at_bol P_ ((struct coding_system *, | |
| 870 int *, int *, | |
| 871 unsigned char *)); | |
| 872 static int detect_eol P_ ((const unsigned char *, | |
| 873 EMACS_INT, enum coding_category)); | |
| 874 static Lisp_Object adjust_coding_eol_type P_ ((struct coding_system *, int)); | |
| 875 static void decode_eol P_ ((struct coding_system *)); | |
| 876 static Lisp_Object get_translation_table P_ ((Lisp_Object, int, int *)); | |
| 877 static Lisp_Object get_translation P_ ((Lisp_Object, int *, int *, | |
| 878 int, int *, int *)); | |
| 879 static int produce_chars P_ ((struct coding_system *, Lisp_Object, int)); | |
| 880 static INLINE void produce_composition P_ ((struct coding_system *, int *, | |
| 881 EMACS_INT)); | |
| 882 static INLINE void produce_charset P_ ((struct coding_system *, int *, | |
| 883 EMACS_INT)); | |
| 884 static void produce_annotation P_ ((struct coding_system *, EMACS_INT)); | |
| 885 static int decode_coding P_ ((struct coding_system *)); | |
| 886 static INLINE int *handle_composition_annotation P_ ((EMACS_INT, EMACS_INT, | |
| 887 struct coding_system *, | |
| 888 int *, EMACS_INT *)); | |
| 889 static INLINE int *handle_charset_annotation P_ ((EMACS_INT, EMACS_INT, | |
| 890 struct coding_system *, | |
| 891 int *, EMACS_INT *)); | |
| 892 static void consume_chars P_ ((struct coding_system *, Lisp_Object, int)); | |
| 893 static int encode_coding P_ ((struct coding_system *)); | |
| 894 static Lisp_Object make_conversion_work_buffer P_ ((int)); | |
| 895 static Lisp_Object code_conversion_restore P_ ((Lisp_Object)); | |
| 896 static INLINE int char_encodable_p P_ ((int, Lisp_Object)); | |
| 897 static Lisp_Object make_subsidiaries P_ ((Lisp_Object)); | |
| 860 | 898 |
| 861 static void | 899 static void |
| 862 record_conversion_result (struct coding_system *coding, | 900 record_conversion_result (struct coding_system *coding, |
| 863 enum coding_result_code result) | 901 enum coding_result_code result) |
| 864 { | 902 { |
| 5207 | 5245 |
| 5208 #define MAX_EOL_CHECK_COUNT 3 | 5246 #define MAX_EOL_CHECK_COUNT 3 |
| 5209 | 5247 |
| 5210 static int | 5248 static int |
| 5211 detect_eol (source, src_bytes, category) | 5249 detect_eol (source, src_bytes, category) |
| 5212 unsigned char *source; | 5250 const unsigned char *source; |
| 5213 EMACS_INT src_bytes; | 5251 EMACS_INT src_bytes; |
| 5214 enum coding_category category; | 5252 enum coding_category category; |
| 5215 { | 5253 { |
| 5216 unsigned char *src = source, *src_end = src + src_bytes; | 5254 const unsigned char *src = source, *src_end = src + src_bytes; |
| 5217 unsigned char c; | 5255 unsigned char c; |
| 5218 int total = 0; | 5256 int total = 0; |
| 5219 int eol_seen = EOL_SEEN_NONE; | 5257 int eol_seen = EOL_SEEN_NONE; |
| 5220 | 5258 |
| 5221 if ((1 << category) & CATEGORY_MASK_UTF_16) | 5259 if ((1 << category) & CATEGORY_MASK_UTF_16) |
| 6083 { | 6121 { |
| 6084 int c = *src++; | 6122 int c = *src++; |
| 6085 | 6123 |
| 6086 coding->charbuf[coding->charbuf_used++] = (c & 0x80 ? - c : c); | 6124 coding->charbuf[coding->charbuf_used++] = (c & 0x80 ? - c : c); |
| 6087 } | 6125 } |
| 6088 produce_chars (coding); | 6126 produce_chars (coding, Qnil, 1); |
| 6089 } | 6127 } |
| 6090 else | 6128 else |
| 6091 { | 6129 { |
| 6092 /* Record unprocessed bytes in coding->carryover. We are | 6130 /* Record unprocessed bytes in coding->carryover. We are |
| 6093 sure that the number of data is less than the size of | 6131 sure that the number of data is less than the size of |
| 6428 | 6466 |
| 6429 | 6467 |
| 6430 /* Return a working buffer of code convesion. MULTIBYTE specifies the | 6468 /* Return a working buffer of code convesion. MULTIBYTE specifies the |
| 6431 multibyteness of returning buffer. */ | 6469 multibyteness of returning buffer. */ |
| 6432 | 6470 |
| 6433 Lisp_Object | 6471 static Lisp_Object |
| 6434 make_conversion_work_buffer (multibyte) | 6472 make_conversion_work_buffer (multibyte) |
| 6473 int multibyte; | |
| 6435 { | 6474 { |
| 6436 Lisp_Object name, workbuf; | 6475 Lisp_Object name, workbuf; |
| 6437 struct buffer *current; | 6476 struct buffer *current; |
| 6438 | 6477 |
| 6439 if (reused_workbuf_in_use++) | 6478 if (reused_workbuf_in_use++) |
