comparison src/mule-charset.h @ 337:fbbf69b4e8a7 r21-0-66

Import from CVS: tag r21-0-66
author cvs
date Mon, 13 Aug 2007 10:51:02 +0200
parents 70ad99077275
children cc15677e0335
comparison
equal deleted inserted replaced
336:fe0a93612022 337:fbbf69b4e8a7
325 /************************************************************************/ 325 /************************************************************************/
326 326
327 #define MIN_LEADING_BYTE 0x80 327 #define MIN_LEADING_BYTE 0x80
328 /* These need special treatment in a string and/or character */ 328 /* These need special treatment in a string and/or character */
329 #define LEADING_BYTE_ASCII 0x8E /* Omitted in a buffer */ 329 #define LEADING_BYTE_ASCII 0x8E /* Omitted in a buffer */
330 #ifdef ENABLE_COMPOSITE_CHARS
330 #define LEADING_BYTE_COMPOSITE 0x80 /* for a composite character */ 331 #define LEADING_BYTE_COMPOSITE 0x80 /* for a composite character */
332 #endif
331 #define LEADING_BYTE_CONTROL_1 0x8F /* represent normal 80-9F */ 333 #define LEADING_BYTE_CONTROL_1 0x8F /* represent normal 80-9F */
332 334
333 /** The following are for 1-byte characters in an official charset. **/ 335 /** The following are for 1-byte characters in an official charset. **/
334 336
335 #define LEADING_BYTE_LATIN_ISO8859_1 0x81 /* Right half of ISO 8859-1 */ 337 #define LEADING_BYTE_LATIN_ISO8859_1 0x81 /* Right half of ISO 8859-1 */
674 else if (c < MIN_CHAR_PRIVATE_TYPE9NX9N) 676 else if (c < MIN_CHAR_PRIVATE_TYPE9NX9N)
675 return CHAR_FIELD1 (c) + FIELD1_TO_OFFICIAL_LEADING_BYTE; 677 return CHAR_FIELD1 (c) + FIELD1_TO_OFFICIAL_LEADING_BYTE;
676 else if (c < MIN_CHAR_COMPOSITION) 678 else if (c < MIN_CHAR_COMPOSITION)
677 return CHAR_FIELD1 (c) + FIELD1_TO_PRIVATE_LEADING_BYTE; 679 return CHAR_FIELD1 (c) + FIELD1_TO_PRIVATE_LEADING_BYTE;
678 else 680 else
679 return LEADING_BYTE_COMPOSITE; 681 {
682 #ifdef ENABLE_COMPOSITE_CHARS
683 return LEADING_BYTE_COMPOSITE;
684 #else
685 abort();
686 return 0;
687 #endif /* ENABLE_COMPOSITE_CHARS */
688 }
680 } 689 }
681 690
682 #define CHAR_CHARSET(c) CHARSET_BY_LEADING_BYTE (CHAR_LEADING_BYTE (c)) 691 #define CHAR_CHARSET(c) CHARSET_BY_LEADING_BYTE (CHAR_LEADING_BYTE (c))
683 692
684 /* Return a character whose charset is CHARSET and position-codes 693 /* Return a character whose charset is CHARSET and position-codes
695 { 704 {
696 if (EQ (charset, Vcharset_ascii)) 705 if (EQ (charset, Vcharset_ascii))
697 return c1; 706 return c1;
698 else if (EQ (charset, Vcharset_control_1)) 707 else if (EQ (charset, Vcharset_control_1))
699 return c1 | 0x80; 708 return c1 | 0x80;
709 #ifdef ENABLE_COMPOSITE_CHARS
700 else if (EQ (charset, Vcharset_composite)) 710 else if (EQ (charset, Vcharset_composite))
701 return (0x1F << 14) | ((c1) << 7) | (c2); 711 return (0x1F << 14) | ((c1) << 7) | (c2);
712 #endif
702 else if (XCHARSET_DIMENSION (charset) == 1) 713 else if (XCHARSET_DIMENSION (charset) == 1)
703 return ((XCHARSET_LEADING_BYTE (charset) - 714 return ((XCHARSET_LEADING_BYTE (charset) -
704 FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) | (c1); 715 FIELD2_TO_OFFICIAL_LEADING_BYTE) << 7) | (c1);
705 else if (!XCHARSET_PRIVATE_P (charset)) 716 else if (!XCHARSET_PRIVATE_P (charset))
706 return ((XCHARSET_LEADING_BYTE (charset) - 717 return ((XCHARSET_LEADING_BYTE (charset) -
736 #define BREAKUP_CHAR(c, charset, c1, c2) \ 747 #define BREAKUP_CHAR(c, charset, c1, c2) \
737 breakup_char_1 (c, &(charset), &(c1), &(c2)) 748 breakup_char_1 (c, &(charset), &(c1), &(c2))
738 749
739 750
740 751
752 #ifdef ENABLE_COMPOSITE_CHARS
741 /************************************************************************/ 753 /************************************************************************/
742 /* Composite characters */ 754 /* Composite characters */
743 /************************************************************************/ 755 /************************************************************************/
744 756
745 Emchar lookup_composite_char (Bufbyte *str, int len); 757 Emchar lookup_composite_char (Bufbyte *str, int len);
746 Lisp_Object composite_char_string (Emchar ch); 758 Lisp_Object composite_char_string (Emchar ch);
759 #endif /* ENABLE_COMPOSITE_CHARS */
747 760
748 761
749 /************************************************************************/ 762 /************************************************************************/
750 /* Exported functions */ 763 /* Exported functions */
751 /************************************************************************/ 764 /************************************************************************/