comparison src/coding.c @ 51311:e723bcb43569

*** empty log message ***
author Kenichi Handa <handa@m17n.org>
date Wed, 28 May 2003 23:27:28 +0000
parents b020f1a52615
children 389d833cd25e
comparison
equal deleted inserted replaced
51310:a8358d5d67b3 51311:e723bcb43569
2034 default: 2034 default:
2035 goto label_invalid_code; 2035 goto label_invalid_code;
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;
2042 if (c1 >= 0x28 && c1 <= 0x2B) 2114 if (c1 >= 0x28 && c1 <= 0x2B)
2043 { /* designation of DIMENSION1_CHARS94 character set */ 2115 { /* designation of DIMENSION1_CHARS94 character set */