diff options
| author | Kenichi Handa | 2002-05-30 11:02:01 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-05-30 11:02:01 +0000 |
| commit | bf16eb23a04f3b06eee651b7ccc64e34cf894e6b (patch) | |
| tree | 79bd6d1b5f148f35d33936486e5ff4dc470bfb3d /src/coding.c | |
| parent | b1a794612519e631fae626d75ff66f14825b29bc (diff) | |
| download | emacs-bf16eb23a04f3b06eee651b7ccc64e34cf894e6b.tar.gz emacs-bf16eb23a04f3b06eee651b7ccc64e34cf894e6b.zip | |
(CODING_ISO_FLAG_USE_ROMAN): New macro
(CODING_ISO_FLAG_USE_OLDJIS): New macro.
(CODING_ISO_FLAG_FULL_SUPPORT): Macro definition changed.
(setup_iso_safe_charsets): Fix arguemtns to Fassq.
(DECODE_DESIGNATION): Pay attention to CODING_ISO_FLAG_USE_ROMAN
and CODING_ISO_FLAG_USE_OLDJIS.
(ENCODE_ISO_CHARACTER_DIMENSION1): Likewise.
(ENCODE_ISO_CHARACTER_DIMENSION2): Likewise.
(encode_coding_iso_2022): Change the 1st arg to
ENCODE_ISO_CHARACTER to a variable.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/coding.c b/src/coding.c index 1fc59a02bb1..7cc5f6bbd9c 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -556,7 +556,11 @@ enum iso_code_class_type | |||
| 556 | 556 | ||
| 557 | #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 | 557 | #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 |
| 558 | 558 | ||
| 559 | #define CODING_ISO_FLAG_FULL_SUPPORT 0x8000 | 559 | #define CODING_ISO_FLAG_USE_ROMAN 0x8000 |
| 560 | |||
| 561 | #define CODING_ISO_FLAG_USE_OLDJIS 0x10000 | ||
| 562 | |||
| 563 | #define CODING_ISO_FLAG_FULL_SUPPORT 0x100000 | ||
| 560 | 564 | ||
| 561 | /* A character to be produced on output if encoding of the original | 565 | /* A character to be produced on output if encoding of the original |
| 562 | character is prohibited by CODING_ISO_FLAG_SAFE. */ | 566 | character is prohibited by CODING_ISO_FLAG_SAFE. */ |
| @@ -2268,7 +2272,7 @@ setup_iso_safe_charsets (attrs) | |||
| 2268 | 2272 | ||
| 2269 | id = XCAR (tail); | 2273 | id = XCAR (tail); |
| 2270 | charset = CHARSET_FROM_ID (XINT (id)); | 2274 | charset = CHARSET_FROM_ID (XINT (id)); |
| 2271 | reg = Fcdr (Fassq (request, id)); | 2275 | reg = Fcdr (Fassq (id, request)); |
| 2272 | if (! NILP (reg)) | 2276 | if (! NILP (reg)) |
| 2273 | XSTRING (safe_charsets)->data[XINT (id)] = XINT (reg); | 2277 | XSTRING (safe_charsets)->data[XINT (id)] = XINT (reg); |
| 2274 | else if (charset->iso_chars_96) | 2278 | else if (charset->iso_chars_96) |
| @@ -2562,6 +2566,16 @@ detect_coding_iso_2022 (coding, mask) | |||
| 2562 | goto invalid_code; \ | 2566 | goto invalid_code; \ |
| 2563 | } \ | 2567 | } \ |
| 2564 | prev = CODING_ISO_DESIGNATION (coding, reg); \ | 2568 | prev = CODING_ISO_DESIGNATION (coding, reg); \ |
| 2569 | if (id == charset_jisx0201_roman) \ | ||
| 2570 | { \ | ||
| 2571 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_ROMAN) \ | ||
| 2572 | id = charset_ascii; \ | ||
| 2573 | } \ | ||
| 2574 | else if (id == charset_jisx0208_1978) \ | ||
| 2575 | { \ | ||
| 2576 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_OLDJIS) \ | ||
| 2577 | id = charset_jisx0208; \ | ||
| 2578 | } \ | ||
| 2565 | CODING_ISO_DESIGNATION (coding, reg) = id; \ | 2579 | CODING_ISO_DESIGNATION (coding, reg) = id; \ |
| 2566 | /* If there was an invalid designation to REG previously, and this \ | 2580 | /* If there was an invalid designation to REG previously, and this \ |
| 2567 | designation is ASCII to REG, we should keep this designation \ | 2581 | designation is ASCII to REG, we should keep this designation \ |
| @@ -3201,6 +3215,14 @@ decode_coding_iso_2022 (coding) | |||
| 3201 | #define ENCODE_ISO_CHARACTER_DIMENSION1(charset, c1) \ | 3215 | #define ENCODE_ISO_CHARACTER_DIMENSION1(charset, c1) \ |
| 3202 | do { \ | 3216 | do { \ |
| 3203 | int id = CHARSET_ID (charset); \ | 3217 | int id = CHARSET_ID (charset); \ |
| 3218 | \ | ||
| 3219 | if ((CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_ROMAN) \ | ||
| 3220 | && id == charset_ascii) \ | ||
| 3221 | { \ | ||
| 3222 | id = charset_jisx0201_roman; \ | ||
| 3223 | charset = CHARSET_FROM_ID (id); \ | ||
| 3224 | } \ | ||
| 3225 | \ | ||
| 3204 | if (CODING_ISO_SINGLE_SHIFTING (coding)) \ | 3226 | if (CODING_ISO_SINGLE_SHIFTING (coding)) \ |
| 3205 | { \ | 3227 | { \ |
| 3206 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) \ | 3228 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) \ |
| @@ -3237,6 +3259,14 @@ decode_coding_iso_2022 (coding) | |||
| 3237 | #define ENCODE_ISO_CHARACTER_DIMENSION2(charset, c1, c2) \ | 3259 | #define ENCODE_ISO_CHARACTER_DIMENSION2(charset, c1, c2) \ |
| 3238 | do { \ | 3260 | do { \ |
| 3239 | int id = CHARSET_ID (charset); \ | 3261 | int id = CHARSET_ID (charset); \ |
| 3262 | \ | ||
| 3263 | if ((CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_USE_OLDJIS) \ | ||
| 3264 | && id == charset_jisx0208) \ | ||
| 3265 | { \ | ||
| 3266 | id = charset_jisx0208_1978; \ | ||
| 3267 | charset = CHARSET_FROM_ID (id); \ | ||
| 3268 | } \ | ||
| 3269 | \ | ||
| 3240 | if (CODING_ISO_SINGLE_SHIFTING (coding)) \ | 3270 | if (CODING_ISO_SINGLE_SHIFTING (coding)) \ |
| 3241 | { \ | 3271 | { \ |
| 3242 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) \ | 3272 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_SEVEN_BITS) \ |
| @@ -3520,7 +3550,10 @@ encode_coding_iso_2022 (coding) | |||
| 3520 | if (ascii_compatible) | 3550 | if (ascii_compatible) |
| 3521 | EMIT_ONE_ASCII_BYTE (c); | 3551 | EMIT_ONE_ASCII_BYTE (c); |
| 3522 | else | 3552 | else |
| 3523 | ENCODE_ISO_CHARACTER (CHARSET_FROM_ID (charset_ascii), c); | 3553 | { |
| 3554 | struct charset *charset = CHARSET_FROM_ID (charset_ascii); | ||
| 3555 | ENCODE_ISO_CHARACTER (charset, c); | ||
| 3556 | } | ||
| 3524 | } | 3557 | } |
| 3525 | else | 3558 | else |
| 3526 | { | 3559 | { |