comparison src/mule-ccl.c @ 3690:d6a215ad08b8

[xemacs-hg @ 2006-11-20 19:21:47 by aidan] Eliminate a couple of CCL bugs with control-1 characters.
author aidan
date Mon, 20 Nov 2006 19:21:56 +0000
parents 551c008d3777
children aa28d959af41
comparison
equal deleted inserted replaced
3689:844f6af613f6 3690:d6a215ad08b8
848 848
849 /* On XEmacs, TranslateCharacter is not supported. Thus, this 849 /* On XEmacs, TranslateCharacter is not supported. Thus, this
850 macro is only used in the MuleToUnicode transformation. */ 850 macro is only used in the MuleToUnicode transformation. */
851 #define CCL_MAKE_CHAR(charset, code, c) \ 851 #define CCL_MAKE_CHAR(charset, code, c) \
852 do { \ 852 do { \
853 \
854 if (!POSSIBLE_LEADING_BYTE_P(charset)) \
855 CCL_INVALID_CMD; \
856 \
853 if ((charset) == LEADING_BYTE_ASCII) \ 857 if ((charset) == LEADING_BYTE_ASCII) \
854 { \ 858 { \
855 c = (code) & 0xFF; \ 859 c = (code) & 0xFF; \
856 } \ 860 } \
857 else if ((charset) == LEADING_BYTE_CONTROL_1) \ 861 else if ((charset) == LEADING_BYTE_CONTROL_1) \
858 { \ 862 { \
859 c = ((code) & 0xFF) - 0xA0; \ 863 c = ((code) & 0x1F) + 0x80; \
860 } \ 864 } \
861 else if (!NILP(charset_by_leading_byte(charset)) \ 865 else if (!NILP(charset_by_leading_byte(charset)) \
862 && ((code) >= 32) \ 866 && ((code) >= 32) \
863 && ((code) < 256 || ((code >> 8) & 0x7F) >= 32)) \ 867 && ((code) < 256 || ((code >> 8) & 0x7F) >= 32)) \
864 { \ 868 { \
1388 case CCL_WriteMultibyteChar2: 1392 case CCL_WriteMultibyteChar2:
1389 i = reg[RRR]; /* charset */ 1393 i = reg[RRR]; /* charset */
1390 if (i == LEADING_BYTE_ASCII) 1394 if (i == LEADING_BYTE_ASCII)
1391 i = reg[rrr] & 0xFF; 1395 i = reg[rrr] & 0xFF;
1392 else if (LEADING_BYTE_CONTROL_1 == i) 1396 else if (LEADING_BYTE_CONTROL_1 == i)
1393 i = ((reg[rrr] & 0xFF) - 0xA0); 1397 i = ((reg[rrr] & 0x1F) + 0x80);
1394 else if (POSSIBLE_LEADING_BYTE_P(i) && 1398 else if (POSSIBLE_LEADING_BYTE_P(i) &&
1395 !NILP(charset_by_leading_byte(i))) 1399 !NILP(charset_by_leading_byte(i)))
1396 { 1400 {
1397 if (XCHARSET_DIMENSION (charset_by_leading_byte (i)) == 1) 1401 if (XCHARSET_DIMENSION (charset_by_leading_byte (i)) == 1)
1398 i = (((i - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) 1402 i = (((i - FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7)