Mercurial > hg > xemacs-beta
comparison src/mule-charset.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 576fb035e263 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
399 | 399 |
400 #define LEADING_BYTE_PRIVATE_P(lb) ((lb) >= MIN_LEADING_BYTE_PRIVATE_1) | 400 #define LEADING_BYTE_PRIVATE_P(lb) ((lb) >= MIN_LEADING_BYTE_PRIVATE_1) |
401 | 401 |
402 /* Is this a prefix for a private leading byte? */ | 402 /* Is this a prefix for a private leading byte? */ |
403 | 403 |
404 INLINE int LEADING_BYTE_PREFIX_P (unsigned char lb); | 404 INLINE_HEADER int LEADING_BYTE_PREFIX_P (unsigned char lb); |
405 INLINE int | 405 INLINE_HEADER int |
406 LEADING_BYTE_PREFIX_P (unsigned char lb) | 406 LEADING_BYTE_PREFIX_P (unsigned char lb) |
407 { | 407 { |
408 return (lb == PRE_LEADING_BYTE_PRIVATE_1 || | 408 return (lb == PRE_LEADING_BYTE_PRIVATE_1 || |
409 lb == PRE_LEADING_BYTE_PRIVATE_2); | 409 lb == PRE_LEADING_BYTE_PRIVATE_2); |
410 } | 410 } |
555 /* Table of charsets indexed by leading byte. */ | 555 /* Table of charsets indexed by leading byte. */ |
556 Lisp_Object charset_by_leading_byte[128]; | 556 Lisp_Object charset_by_leading_byte[128]; |
557 | 557 |
558 /* Table of charsets indexed by type/final-byte/direction. */ | 558 /* Table of charsets indexed by type/final-byte/direction. */ |
559 Lisp_Object charset_by_attributes[4][128][2]; | 559 Lisp_Object charset_by_attributes[4][128][2]; |
560 Bufbyte next_allocated_1_byte_leading_byte; | |
561 Bufbyte next_allocated_2_byte_leading_byte; | |
560 }; | 562 }; |
561 | 563 |
562 extern struct charset_lookup *chlook; | 564 extern struct charset_lookup *chlook; |
563 | 565 |
564 #ifdef ERROR_CHECK_TYPECHECK | 566 #ifdef ERROR_CHECK_TYPECHECK |
565 /* int not Bufbyte even though that is the actual type of a leading byte. | 567 /* int not Bufbyte even though that is the actual type of a leading byte. |
566 This way, out-ot-range values will get caught rather than automatically | 568 This way, out-of-range values will get caught rather than automatically |
567 truncated. */ | 569 truncated. */ |
568 INLINE Lisp_Object CHARSET_BY_LEADING_BYTE (int lb); | 570 INLINE_HEADER Lisp_Object CHARSET_BY_LEADING_BYTE (int lb); |
569 INLINE Lisp_Object | 571 INLINE_HEADER Lisp_Object |
570 CHARSET_BY_LEADING_BYTE (int lb) | 572 CHARSET_BY_LEADING_BYTE (int lb) |
571 { | 573 { |
572 assert (lb >= 0x80 && lb <= 0xFF); | 574 assert (lb >= 0x80 && lb <= 0xFF); |
573 return chlook->charset_by_leading_byte[lb - 128]; | 575 return chlook->charset_by_leading_byte[lb - 128]; |
574 } | 576 } |
590 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (first_byte)) | 592 XCHARSET_REP_BYTES (CHARSET_BY_LEADING_BYTE (first_byte)) |
591 but it's faster this way. */ | 593 but it's faster this way. */ |
592 extern const Bytecount rep_bytes_by_first_byte[0xA0]; | 594 extern const Bytecount rep_bytes_by_first_byte[0xA0]; |
593 | 595 |
594 /* Number of bytes in the string representation of a character. */ | 596 /* Number of bytes in the string representation of a character. */ |
595 INLINE int REP_BYTES_BY_FIRST_BYTE (int fb); | 597 INLINE_HEADER int REP_BYTES_BY_FIRST_BYTE (int fb); |
596 INLINE int | 598 INLINE_HEADER int |
597 REP_BYTES_BY_FIRST_BYTE (int fb) | 599 REP_BYTES_BY_FIRST_BYTE (int fb) |
598 { | 600 { |
599 #ifdef ERROR_CHECK_TYPECHECK | 601 #ifdef ERROR_CHECK_TYPECHECK |
600 assert (0 <= fb && fb < 0xA0); | 602 assert (0 <= fb && fb < 0xA0); |
601 #endif | 603 #endif |
673 NOTE: This takes advantage of the fact that | 675 NOTE: This takes advantage of the fact that |
674 FIELD2_TO_OFFICIAL_LEADING_BYTE and | 676 FIELD2_TO_OFFICIAL_LEADING_BYTE and |
675 FIELD2_TO_PRIVATE_LEADING_BYTE are the same. | 677 FIELD2_TO_PRIVATE_LEADING_BYTE are the same. |
676 */ | 678 */ |
677 | 679 |
678 INLINE Bufbyte CHAR_LEADING_BYTE (Emchar c); | 680 INLINE_HEADER Bufbyte CHAR_LEADING_BYTE (Emchar c); |
679 INLINE Bufbyte | 681 INLINE_HEADER Bufbyte |
680 CHAR_LEADING_BYTE (Emchar c) | 682 CHAR_LEADING_BYTE (Emchar c) |
681 { | 683 { |
682 if (CHAR_ASCII_P (c)) | 684 if (CHAR_ASCII_P (c)) |
683 return LEADING_BYTE_ASCII; | 685 return LEADING_BYTE_ASCII; |
684 else if (c < 0xA0) | 686 else if (c < 0xA0) |
708 NOTE: This takes advantage of the fact that | 710 NOTE: This takes advantage of the fact that |
709 FIELD2_TO_OFFICIAL_LEADING_BYTE and | 711 FIELD2_TO_OFFICIAL_LEADING_BYTE and |
710 FIELD2_TO_PRIVATE_LEADING_BYTE are the same. | 712 FIELD2_TO_PRIVATE_LEADING_BYTE are the same. |
711 */ | 713 */ |
712 | 714 |
713 INLINE Emchar MAKE_CHAR (Lisp_Object charset, int c1, int c2); | 715 INLINE_HEADER Emchar MAKE_CHAR (Lisp_Object charset, int c1, int c2); |
714 INLINE Emchar | 716 INLINE_HEADER Emchar |
715 MAKE_CHAR (Lisp_Object charset, int c1, int c2) | 717 MAKE_CHAR (Lisp_Object charset, int c1, int c2) |
716 { | 718 { |
717 if (EQ (charset, Vcharset_ascii)) | 719 if (EQ (charset, Vcharset_ascii)) |
718 return c1; | 720 return c1; |
719 else if (EQ (charset, Vcharset_control_1)) | 721 else if (EQ (charset, Vcharset_control_1)) |
746 XCHARSET_DIMENSION (charset) == 1 \ | 748 XCHARSET_DIMENSION (charset) == 1 \ |
747 ? ((c1) = CHAR_FIELD3 (c), (c2) = 0) \ | 749 ? ((c1) = CHAR_FIELD3 (c), (c2) = 0) \ |
748 : ((c1) = CHAR_FIELD2 (c), \ | 750 : ((c1) = CHAR_FIELD2 (c), \ |
749 (c2) = CHAR_FIELD3 (c)) | 751 (c2) = CHAR_FIELD3 (c)) |
750 | 752 |
751 INLINE void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2); | 753 INLINE_HEADER void breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2); |
752 INLINE void | 754 INLINE_HEADER void |
753 breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) | 755 breakup_char_1 (Emchar c, Lisp_Object *charset, int *c1, int *c2) |
754 { | 756 { |
755 *charset = CHAR_CHARSET (c); | 757 *charset = CHAR_CHARSET (c); |
756 BREAKUP_CHAR_1_UNSAFE (c, *charset, *c1, *c2); | 758 BREAKUP_CHAR_1_UNSAFE (c, *charset, *c1, *c2); |
757 } | 759 } |
784 | 786 |
785 Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char); | 787 Emchar Lstream_get_emchar_1 (Lstream *stream, int first_char); |
786 int Lstream_fput_emchar (Lstream *stream, Emchar ch); | 788 int Lstream_fput_emchar (Lstream *stream, Emchar ch); |
787 void Lstream_funget_emchar (Lstream *stream, Emchar ch); | 789 void Lstream_funget_emchar (Lstream *stream, Emchar ch); |
788 | 790 |
789 int copy_internal_to_external (CONST Bufbyte *internal, Bytecount len, | 791 int copy_internal_to_external (const Bufbyte *internal, Bytecount len, |
790 unsigned char *external); | 792 unsigned char *external); |
791 Bytecount copy_external_to_internal (CONST unsigned char *external, | 793 Bytecount copy_external_to_internal (const unsigned char *external, |
792 int len, Bufbyte *internal); | 794 int len, Bufbyte *internal); |
793 | 795 |
794 #endif /* INCLUDED_mule_charset_h_ */ | 796 #endif /* INCLUDED_mule_charset_h_ */ |