Mercurial > emacs
comparison src/coding.c @ 83239:025da3ba778e
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-753
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-754
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-755
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-756
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-757
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-81
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-279
| author | Karoly Lorentey <lorentey@elte.hu> |
|---|---|
| date | Thu, 06 Jan 2005 15:05:01 +0000 |
| parents | 223c12363c0c 2eadf4401d2d |
| children | 3dcba0bc766b |
comparison
equal
deleted
inserted
replaced
| 83238:223c12363c0c | 83239:025da3ba778e |
|---|---|
| 145 Below is a template for these functions. */ | 145 Below is a template for these functions. */ |
| 146 #if 0 | 146 #if 0 |
| 147 static void | 147 static void |
| 148 decode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) | 148 decode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) |
| 149 struct coding_system *coding; | 149 struct coding_system *coding; |
| 150 unsigned char *source, *destination; | 150 const unsigned char *source; |
| 151 unsigned char *destination; | |
| 151 int src_bytes, dst_bytes; | 152 int src_bytes, dst_bytes; |
| 152 { | 153 { |
| 153 ... | 154 ... |
| 154 } | 155 } |
| 155 #endif | 156 #endif |
| 794 */ | 795 */ |
| 795 static INLINE int | 796 static INLINE int |
| 796 decode_composition_emacs_mule (coding, src, src_end, | 797 decode_composition_emacs_mule (coding, src, src_end, |
| 797 destination, dst_end, dst_bytes) | 798 destination, dst_end, dst_bytes) |
| 798 struct coding_system *coding; | 799 struct coding_system *coding; |
| 799 unsigned char *src, *src_end, **destination, *dst_end; | 800 const unsigned char *src, *src_end; |
| 801 unsigned char **destination, *dst_end; | |
| 800 int dst_bytes; | 802 int dst_bytes; |
| 801 { | 803 { |
| 802 unsigned char *dst = *destination; | 804 unsigned char *dst = *destination; |
| 803 int method, data_len, nchars; | 805 int method, data_len, nchars; |
| 804 unsigned char *src_base = src++; | 806 const unsigned char *src_base = src++; |
| 805 /* Store components of composition. */ | 807 /* Store components of composition. */ |
| 806 int component[COMPOSITION_DATA_MAX_BUNCH_LENGTH]; | 808 int component[COMPOSITION_DATA_MAX_BUNCH_LENGTH]; |
| 807 int ncomponent; | 809 int ncomponent; |
| 808 /* Store multibyte form of characters to be composed. This is for | 810 /* Store multibyte form of characters to be composed. This is for |
| 809 Emacs 20 style composition sequence. */ | 811 Emacs 20 style composition sequence. */ |
| 940 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ | 942 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ |
| 941 | 943 |
| 942 static void | 944 static void |
| 943 decode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) | 945 decode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) |
| 944 struct coding_system *coding; | 946 struct coding_system *coding; |
| 945 unsigned char *source, *destination; | 947 const unsigned char *source; |
| 948 unsigned char *destination; | |
| 946 int src_bytes, dst_bytes; | 949 int src_bytes, dst_bytes; |
| 947 { | 950 { |
| 948 unsigned char *src = source; | 951 const unsigned char *src = source; |
| 949 unsigned char *src_end = source + src_bytes; | 952 const unsigned char *src_end = source + src_bytes; |
| 950 unsigned char *dst = destination; | 953 unsigned char *dst = destination; |
| 951 unsigned char *dst_end = destination + dst_bytes; | 954 unsigned char *dst_end = destination + dst_bytes; |
| 952 /* SRC_BASE remembers the start position in source in each loop. | 955 /* SRC_BASE remembers the start position in source in each loop. |
| 953 The loop will be exited when there's not enough source code, or | 956 The loop will be exited when there's not enough source code, or |
| 954 when there's not enough destination area to produce a | 957 when there's not enough destination area to produce a |
| 955 character. */ | 958 character. */ |
| 956 unsigned char *src_base; | 959 const unsigned char *src_base; |
| 957 | 960 |
| 958 coding->produced_char = 0; | 961 coding->produced_char = 0; |
| 959 while ((src_base = src) < src_end) | 962 while ((src_base = src) < src_end) |
| 960 { | 963 { |
| 961 unsigned char tmp[MAX_MULTIBYTE_LENGTH], *p; | 964 unsigned char tmp[MAX_MULTIBYTE_LENGTH]; |
| 965 const unsigned char *p; | |
| 962 int bytes; | 966 int bytes; |
| 963 | 967 |
| 964 if (*src == '\r') | 968 if (*src == '\r') |
| 965 { | 969 { |
| 966 int c = *src++; | 970 int c = *src++; |
| 1110 unsigned char *, int, int)); | 1114 unsigned char *, int, int)); |
| 1111 | 1115 |
| 1112 static void | 1116 static void |
| 1113 encode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) | 1117 encode_coding_emacs_mule (coding, source, destination, src_bytes, dst_bytes) |
| 1114 struct coding_system *coding; | 1118 struct coding_system *coding; |
| 1115 unsigned char *source, *destination; | 1119 const unsigned char *source; |
| 1120 unsigned char *destination; | |
| 1116 int src_bytes, dst_bytes; | 1121 int src_bytes, dst_bytes; |
| 1117 { | 1122 { |
| 1118 unsigned char *src = source; | 1123 const unsigned char *src = source; |
| 1119 unsigned char *src_end = source + src_bytes; | 1124 const unsigned char *src_end = source + src_bytes; |
| 1120 unsigned char *dst = destination; | 1125 unsigned char *dst = destination; |
| 1121 unsigned char *dst_end = destination + dst_bytes; | 1126 unsigned char *dst_end = destination + dst_bytes; |
| 1122 unsigned char *src_base; | 1127 const unsigned char *src_base; |
| 1123 int c; | 1128 int c; |
| 1124 int char_offset; | 1129 int char_offset; |
| 1125 int *data; | 1130 int *data; |
| 1126 | 1131 |
| 1127 Lisp_Object translation_table; | 1132 Lisp_Object translation_table; |
| 1804 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ | 1809 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ |
| 1805 | 1810 |
| 1806 static void | 1811 static void |
| 1807 decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | 1812 decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) |
| 1808 struct coding_system *coding; | 1813 struct coding_system *coding; |
| 1809 unsigned char *source, *destination; | 1814 const unsigned char *source; |
| 1815 unsigned char *destination; | |
| 1810 int src_bytes, dst_bytes; | 1816 int src_bytes, dst_bytes; |
| 1811 { | 1817 { |
| 1812 unsigned char *src = source; | 1818 const unsigned char *src = source; |
| 1813 unsigned char *src_end = source + src_bytes; | 1819 const unsigned char *src_end = source + src_bytes; |
| 1814 unsigned char *dst = destination; | 1820 unsigned char *dst = destination; |
| 1815 unsigned char *dst_end = destination + dst_bytes; | 1821 unsigned char *dst_end = destination + dst_bytes; |
| 1816 /* Charsets invoked to graphic plane 0 and 1 respectively. */ | 1822 /* Charsets invoked to graphic plane 0 and 1 respectively. */ |
| 1817 int charset0 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 0); | 1823 int charset0 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 0); |
| 1818 int charset1 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 1); | 1824 int charset1 = CODING_SPEC_ISO_PLANE_CHARSET (coding, 1); |
| 1819 /* SRC_BASE remembers the start position in source in each loop. | 1825 /* SRC_BASE remembers the start position in source in each loop. |
| 1820 The loop will be exited when there's not enough source code | 1826 The loop will be exited when there's not enough source code |
| 1821 (within macro ONE_MORE_BYTE), or when there's not enough | 1827 (within macro ONE_MORE_BYTE), or when there's not enough |
| 1822 destination area to produce a character (within macro | 1828 destination area to produce a character (within macro |
| 1823 EMIT_CHAR). */ | 1829 EMIT_CHAR). */ |
| 1824 unsigned char *src_base; | 1830 const unsigned char *src_base; |
| 1825 int c, charset; | 1831 int c, charset; |
| 1826 Lisp_Object translation_table; | 1832 Lisp_Object translation_table; |
| 1827 Lisp_Object safe_chars; | 1833 Lisp_Object safe_chars; |
| 1828 | 1834 |
| 1829 safe_chars = coding_safe_chars (coding->symbol); | 1835 safe_chars = coding_safe_chars (coding->symbol); |
| 2590 | 2596 |
| 2591 static unsigned char * | 2597 static unsigned char * |
| 2592 encode_designation_at_bol (coding, translation_table, src, src_end, dst) | 2598 encode_designation_at_bol (coding, translation_table, src, src_end, dst) |
| 2593 struct coding_system *coding; | 2599 struct coding_system *coding; |
| 2594 Lisp_Object translation_table; | 2600 Lisp_Object translation_table; |
| 2595 unsigned char *src, *src_end, *dst; | 2601 const unsigned char *src, *src_end; |
| 2602 unsigned char *dst; | |
| 2596 { | 2603 { |
| 2597 int charset, c, found = 0, reg; | 2604 int charset, c, found = 0, reg; |
| 2598 /* Table of charsets to be designated to each graphic register. */ | 2605 /* Table of charsets to be designated to each graphic register. */ |
| 2599 int r[4]; | 2606 int r[4]; |
| 2600 | 2607 |
| 2631 /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ | 2638 /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */ |
| 2632 | 2639 |
| 2633 static void | 2640 static void |
| 2634 encode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | 2641 encode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) |
| 2635 struct coding_system *coding; | 2642 struct coding_system *coding; |
| 2636 unsigned char *source, *destination; | 2643 const unsigned char *source; |
| 2644 unsigned char *destination; | |
| 2637 int src_bytes, dst_bytes; | 2645 int src_bytes, dst_bytes; |
| 2638 { | 2646 { |
| 2639 unsigned char *src = source; | 2647 const unsigned char *src = source; |
| 2640 unsigned char *src_end = source + src_bytes; | 2648 const unsigned char *src_end = source + src_bytes; |
| 2641 unsigned char *dst = destination; | 2649 unsigned char *dst = destination; |
| 2642 unsigned char *dst_end = destination + dst_bytes; | 2650 unsigned char *dst_end = destination + dst_bytes; |
| 2643 /* Since the maximum bytes produced by each loop is 20, we subtract 19 | 2651 /* Since the maximum bytes produced by each loop is 20, we subtract 19 |
| 2644 from DST_END to assure overflow checking is necessary only at the | 2652 from DST_END to assure overflow checking is necessary only at the |
| 2645 head of loop. */ | 2653 head of loop. */ |
| 2647 /* SRC_BASE remembers the start position in source in each loop. | 2655 /* SRC_BASE remembers the start position in source in each loop. |
| 2648 The loop will be exited when there's not enough source text to | 2656 The loop will be exited when there's not enough source text to |
| 2649 analyze multi-byte codes (within macro ONE_MORE_CHAR), or when | 2657 analyze multi-byte codes (within macro ONE_MORE_CHAR), or when |
| 2650 there's not enough destination area to produce encoded codes | 2658 there's not enough destination area to produce encoded codes |
| 2651 (within macro EMIT_BYTES). */ | 2659 (within macro EMIT_BYTES). */ |
| 2652 unsigned char *src_base; | 2660 const unsigned char *src_base; |
| 2653 int c; | 2661 int c; |
| 2654 Lisp_Object translation_table; | 2662 Lisp_Object translation_table; |
| 2655 Lisp_Object safe_chars; | 2663 Lisp_Object safe_chars; |
| 2656 | 2664 |
| 2657 if (coding->flags & CODING_FLAG_ISO_SAFE) | 2665 if (coding->flags & CODING_FLAG_ISO_SAFE) |
| 3041 | 3049 |
| 3042 static void | 3050 static void |
| 3043 decode_coding_sjis_big5 (coding, source, destination, | 3051 decode_coding_sjis_big5 (coding, source, destination, |
| 3044 src_bytes, dst_bytes, sjis_p) | 3052 src_bytes, dst_bytes, sjis_p) |
| 3045 struct coding_system *coding; | 3053 struct coding_system *coding; |
| 3046 unsigned char *source, *destination; | 3054 const unsigned char *source; |
| 3055 unsigned char *destination; | |
| 3047 int src_bytes, dst_bytes; | 3056 int src_bytes, dst_bytes; |
| 3048 int sjis_p; | 3057 int sjis_p; |
| 3049 { | 3058 { |
| 3050 unsigned char *src = source; | 3059 const unsigned char *src = source; |
| 3051 unsigned char *src_end = source + src_bytes; | 3060 const unsigned char *src_end = source + src_bytes; |
| 3052 unsigned char *dst = destination; | 3061 unsigned char *dst = destination; |
| 3053 unsigned char *dst_end = destination + dst_bytes; | 3062 unsigned char *dst_end = destination + dst_bytes; |
| 3054 /* SRC_BASE remembers the start position in source in each loop. | 3063 /* SRC_BASE remembers the start position in source in each loop. |
| 3055 The loop will be exited when there's not enough source code | 3064 The loop will be exited when there's not enough source code |
| 3056 (within macro ONE_MORE_BYTE), or when there's not enough | 3065 (within macro ONE_MORE_BYTE), or when there's not enough |
| 3057 destination area to produce a character (within macro | 3066 destination area to produce a character (within macro |
| 3058 EMIT_CHAR). */ | 3067 EMIT_CHAR). */ |
| 3059 unsigned char *src_base; | 3068 const unsigned char *src_base; |
| 3060 Lisp_Object translation_table; | 3069 Lisp_Object translation_table; |
| 3061 | 3070 |
| 3062 if (NILP (Venable_character_translation)) | 3071 if (NILP (Venable_character_translation)) |
| 3063 translation_table = Qnil; | 3072 translation_table = Qnil; |
| 3064 else | 3073 else |
| 3314 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ | 3323 /* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */ |
| 3315 | 3324 |
| 3316 static void | 3325 static void |
| 3317 decode_eol (coding, source, destination, src_bytes, dst_bytes) | 3326 decode_eol (coding, source, destination, src_bytes, dst_bytes) |
| 3318 struct coding_system *coding; | 3327 struct coding_system *coding; |
| 3319 unsigned char *source, *destination; | 3328 const unsigned char *source; |
| 3329 unsigned char *destination; | |
| 3320 int src_bytes, dst_bytes; | 3330 int src_bytes, dst_bytes; |
| 3321 { | 3331 { |
| 3322 unsigned char *src = source; | 3332 const unsigned char *src = source; |
| 3323 unsigned char *dst = destination; | 3333 unsigned char *dst = destination; |
| 3324 unsigned char *src_end = src + src_bytes; | 3334 const unsigned char *src_end = src + src_bytes; |
| 3325 unsigned char *dst_end = dst + dst_bytes; | 3335 unsigned char *dst_end = dst + dst_bytes; |
| 3326 Lisp_Object translation_table; | 3336 Lisp_Object translation_table; |
| 3327 /* SRC_BASE remembers the start position in source in each loop. | 3337 /* SRC_BASE remembers the start position in source in each loop. |
| 3328 The loop will be exited when there's not enough source code | 3338 The loop will be exited when there's not enough source code |
| 3329 (within macro ONE_MORE_BYTE), or when there's not enough | 3339 (within macro ONE_MORE_BYTE), or when there's not enough |
| 3330 destination area to produce a character (within macro | 3340 destination area to produce a character (within macro |
| 3331 EMIT_CHAR). */ | 3341 EMIT_CHAR). */ |
| 3332 unsigned char *src_base; | 3342 const unsigned char *src_base; |
| 3333 int c; | 3343 int c; |
| 3334 | 3344 |
| 3335 translation_table = Qnil; | 3345 translation_table = Qnil; |
| 3336 switch (coding->eol_type) | 3346 switch (coding->eol_type) |
| 3337 { | 3347 { |
