aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2003-05-28 23:27:28 +0000
committerKenichi Handa2003-05-28 23:27:28 +0000
commit103e0180b37bc7df82a0c31be14c50f6758d1bf7 (patch)
tree88c79b0e0c0fcd0fc0072d7b02c6ac2828629e26 /src/coding.c
parent75a756f1471f181a1226f05eeea50a206eae5a70 (diff)
downloademacs-103e0180b37bc7df82a0c31be14c50f6758d1bf7.tar.gz
emacs-103e0180b37bc7df82a0c31be14c50f6758d1bf7.zip
*** empty log message ***
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/coding.c b/src/coding.c
index e329a228177..570715a2441 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2036,6 +2036,78 @@ decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes)
2036 } 2036 }
2037 continue; 2037 continue;
2038 2038
2039 case '%':
2040 if (COMPOSING_P (coding))
2041 DECODE_COMPOSITION_END ('1');
2042 ONE_MORE_BYTE (c1);
2043 if (c1 == '/')
2044 {
2045 /* CTEXT extended segment:
2046 ESC % / [0-4] M L --ENCODING-NAME-- \002 --BYTES--
2047 We keep these bytes as is for the moment.
2048 They may be decoded by post-read-conversion. */
2049 int dim, M, L;
2050 int size, required;
2051 int produced_chars;
2052
2053 ONE_MORE_BYTE (dim);
2054 ONE_MORE_BYTE (M);
2055 ONE_MORE_BYTE (L);
2056 size = ((M - 128) * 128) + (L - 128);
2057 required = 8 + size * 2;
2058 if (dst + required > (dst_bytes ? dst_end : src))
2059 goto label_end_of_loop;
2060 *dst++ = ISO_CODE_ESC;
2061 *dst++ = '%';
2062 *dst++ = '/';
2063 *dst++ = dim;
2064 produced_chars = 4;
2065 dst += CHAR_STRING (M, dst), produced_chars++;
2066 dst += CHAR_STRING (L, dst), produced_chars++;
2067 while (size-- > 0)
2068 {
2069 ONE_MORE_BYTE (c1);
2070 dst += CHAR_STRING (c1, dst), produced_chars++;
2071 }
2072 coding->produced_char += produced_chars;
2073 }
2074 else if (c1 == 'G')
2075 {
2076 unsigned char *d = dst;
2077 int produced_chars;
2078
2079 /* XFree86 extension for embedding UTF-8 in CTEXT:
2080 ESC % G --UTF-8-BYTES-- ESC % @
2081 We keep these bytes as is for the moment.
2082 They may be decoded by post-read-conversion. */
2083 if (d + 6 > (dst_bytes ? dst_end : src))
2084 goto label_end_of_loop;
2085 *d++ = ISO_CODE_ESC;
2086 *d++ = '%';
2087 *d++ = 'G';
2088 produced_chars = 3;
2089 while (d + 1 < (dst_bytes ? dst_end : src))
2090 {
2091 ONE_MORE_BYTE (c1);
2092 if (c1 == ISO_CODE_ESC
2093 && src + 1 < src_end
2094 && src[0] == '%'
2095 && src[1] == '@')
2096 break;
2097 d += CHAR_STRING (c1, d), produced_chars++;
2098 }
2099 if (d + 3 > (dst_bytes ? dst_end : src))
2100 goto label_end_of_loop;
2101 *d++ = ISO_CODE_ESC;
2102 *d++ = '%';
2103 *d++ = '@';
2104 dst = d;
2105 coding->produced_char += produced_chars + 3;
2106 }
2107 else
2108 goto label_invalid_code;
2109 continue;
2110
2039 default: 2111 default:
2040 if (! (coding->flags & CODING_FLAG_ISO_DESIGNATION)) 2112 if (! (coding->flags & CODING_FLAG_ISO_DESIGNATION))
2041 goto label_invalid_code; 2113 goto label_invalid_code;