comparison src/buffer.h @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents 576fb035e263
children 3078fd1074e8
comparison
equal deleted inserted replaced
445:34f3776fcf0e 446:1ccc32a20af4
33 #define INCLUDED_buffer_h_ 33 #define INCLUDED_buffer_h_
34 34
35 #ifdef MULE 35 #ifdef MULE
36 #include "mule-charset.h" 36 #include "mule-charset.h"
37 #endif 37 #endif
38
39 #include "casetab.h"
40 #include "chartab.h"
38 41
39 /************************************************************************/ 42 /************************************************************************/
40 /* */ 43 /* */
41 /* definition of Lisp buffer object */ 44 /* definition of Lisp buffer object */
42 /* */ 45 /* */
1684 1687
1685 /* The _1 macros are named as such because they assume that you have 1688 /* The _1 macros are named as such because they assume that you have
1686 already guaranteed that the character values are all in the range 1689 already guaranteed that the character values are all in the range
1687 0 - 255. Bad lossage will happen otherwise. */ 1690 0 - 255. Bad lossage will happen otherwise. */
1688 1691
1689 # define MAKE_TRT_TABLE() Fmake_string (make_int (256), make_char (0)) 1692 #define MAKE_TRT_TABLE() Fmake_char_table (Qgeneric)
1690 # define TRT_TABLE_AS_STRING(table) XSTRING_DATA (table) 1693 INLINE_HEADER Emchar TRT_TABLE_CHAR_1 (Lisp_Object table, Emchar c);
1691 # define TRT_TABLE_CHAR_1(table, ch) \ 1694 INLINE_HEADER Emchar
1692 string_char (XSTRING (table), (Charcount) ch) 1695 TRT_TABLE_CHAR_1 (Lisp_Object table, Emchar ch)
1693 # define SET_TRT_TABLE_CHAR_1(table, ch1, ch2) \ 1696 {
1694 set_string_char (XSTRING (table), (Charcount) ch1, ch2) 1697 Lisp_Object TRT_char;
1695 1698 TRT_char = get_char_table (ch, XCHAR_TABLE (table));
1696 #ifdef MULE 1699 if (NILP (TRT_char))
1697 # define MAKE_MIRROR_TRT_TABLE() make_opaque (OPAQUE_CLEAR, 256) 1700 return ch;
1698 # define MIRROR_TRT_TABLE_AS_STRING(table) ((Bufbyte *) XOPAQUE_DATA (table)) 1701 else
1699 # define MIRROR_TRT_TABLE_CHAR_1(table, ch) \ 1702 return XCHAR (TRT_char);
1700 ((Emchar) (MIRROR_TRT_TABLE_AS_STRING (table)[ch])) 1703 }
1701 # define SET_MIRROR_TRT_TABLE_CHAR_1(table, ch1, ch2) \ 1704 #define SET_TRT_TABLE_CHAR_1(table, ch1, ch2) \
1702 (MIRROR_TRT_TABLE_AS_STRING (table)[ch1] = (Bufbyte) (ch2)) 1705 Fput_char_table (make_char (ch1), make_char (ch2), table);
1703 #endif
1704
1705 # define IN_TRT_TABLE_DOMAIN(c) (((EMACS_UINT) (c)) <= 255)
1706
1707 #ifdef MULE
1708 #define MIRROR_DOWNCASE_TABLE_AS_STRING(buf) \
1709 MIRROR_TRT_TABLE_AS_STRING (buf->mirror_downcase_table)
1710 #define MIRROR_UPCASE_TABLE_AS_STRING(buf) \
1711 MIRROR_TRT_TABLE_AS_STRING (buf->mirror_upcase_table)
1712 #define MIRROR_CANON_TABLE_AS_STRING(buf) \
1713 MIRROR_TRT_TABLE_AS_STRING (buf->mirror_case_canon_table)
1714 #define MIRROR_EQV_TABLE_AS_STRING(buf) \
1715 MIRROR_TRT_TABLE_AS_STRING (buf->mirror_case_eqv_table)
1716 #else
1717 #define MIRROR_DOWNCASE_TABLE_AS_STRING(buf) \
1718 TRT_TABLE_AS_STRING (buf->downcase_table)
1719 #define MIRROR_UPCASE_TABLE_AS_STRING(buf) \
1720 TRT_TABLE_AS_STRING (buf->upcase_table)
1721 #define MIRROR_CANON_TABLE_AS_STRING(buf) \
1722 TRT_TABLE_AS_STRING (buf->case_canon_table)
1723 #define MIRROR_EQV_TABLE_AS_STRING(buf) \
1724 TRT_TABLE_AS_STRING (buf->case_eqv_table)
1725 #endif
1726 1706
1727 INLINE_HEADER Emchar TRT_TABLE_OF (Lisp_Object trt, Emchar c); 1707 INLINE_HEADER Emchar TRT_TABLE_OF (Lisp_Object trt, Emchar c);
1728 INLINE_HEADER Emchar 1708 INLINE_HEADER Emchar
1729 TRT_TABLE_OF (Lisp_Object trt, Emchar c) 1709 TRT_TABLE_OF (Lisp_Object trt, Emchar c)
1730 { 1710 {
1731 return IN_TRT_TABLE_DOMAIN (c) ? TRT_TABLE_CHAR_1 (trt, c) : c; 1711 return TRT_TABLE_CHAR_1 (trt, c);
1732 } 1712 }
1733 1713
1734 /* Macros used below. */ 1714 /* Macros used below. */
1735 #define DOWNCASE_TABLE_OF(buf, c) TRT_TABLE_OF (buf->downcase_table, c) 1715 #define DOWNCASE_TABLE_OF(buf, c) \
1736 #define UPCASE_TABLE_OF(buf, c) TRT_TABLE_OF (buf->upcase_table, c) 1716 TRT_TABLE_OF (XCASE_TABLE_DOWNCASE (buf->case_table), c)
1717 #define UPCASE_TABLE_OF(buf, c) \
1718 TRT_TABLE_OF (XCASE_TABLE_UPCASE (buf->case_table), c)
1737 1719
1738 /* 1 if CH is upper case. */ 1720 /* 1 if CH is upper case. */
1739 1721
1740 INLINE_HEADER int UPPERCASEP (struct buffer *buf, Emchar ch); 1722 INLINE_HEADER int UPPERCASEP (struct buffer *buf, Emchar ch);
1741 INLINE_HEADER int 1723 INLINE_HEADER int