comparison src/text.h @ 5178:97eb4942aec8

merge
author Ben Wing <ben@xemacs.org>
date Mon, 29 Mar 2010 21:28:13 -0500
parents 6c6d78781d59
children 70ed8a0d8da8
comparison
equal deleted inserted replaced
5177:b785049378e3 5178:97eb4942aec8
45 char *strupr (char *); 45 char *strupr (char *);
46 #endif 46 #endif
47 47
48 BEGIN_C_DECLS 48 BEGIN_C_DECLS
49 49
50 /************************************************************************/
51 /* A short intro to the format of text and of characters */
52 /************************************************************************/
53
54 /*
55 "internally formatted text" and the term "internal format" in
56 general are likely to refer to the format of text in buffers and
57 strings; "externally formatted text" and the term "external format"
58 refer to any text format used in the O.S. or elsewhere outside of
59 XEmacs. The format of text and of a character are related and
60 there must be a one-to-one relationship (hopefully through a
61 relatively simple algorithmic means of conversion) between a string
62 of text and an equivalent array of characters, but the conversion
63 between the two is NOT necessarily trivial.
64
65 In a non-Mule XEmacs, allowed characters are numbered 0 through
66 255, where no fixed meaning is assigned to them, but (when
67 representing text, rather than bytes in a binary file) in practice
68 the lower half represents ASCII and the upper half some other 8-bit
69 character set (chosen by setting the font, case tables, syntax
70 tables, etc. appropriately for the character set through ad-hoc
71 means such as the `iso-8859-1' file and the
72 `standard-display-european' function).
73
74 For more info, see `text.c' and the Internals Manual.
75 */
76
50 /* ---------------------------------------------------------------------- */ 77 /* ---------------------------------------------------------------------- */
51 /* Super-basic character properties */ 78 /* Super-basic character properties */
52 /* ---------------------------------------------------------------------- */ 79 /* ---------------------------------------------------------------------- */
53 80
54 /* These properties define the specifics of how our current encoding fits 81 /* These properties define the specifics of how our current encoding fits
161 /* Maximum number of bytes per Emacs character when represented as text, in 188 /* Maximum number of bytes per Emacs character when represented as text, in
162 any format. 189 any format.
163 */ 190 */
164 191
165 #define MAX_ICHAR_LEN 4 192 #define MAX_ICHAR_LEN 4
193
194 #endif /* not MULE */
195
196 #ifdef MULE
197
198 MODULE_API int non_ascii_valid_ichar_p (Ichar ch);
199
200 /* Return whether the given Ichar is valid.
201 */
202
203 DECLARE_INLINE_HEADER (
204 int
205 valid_ichar_p (Ichar ch)
206 )
207 {
208 return (! (ch & ~0xFF)) || non_ascii_valid_ichar_p (ch);
209 }
210
211 #else /* not MULE */
212
213 /* This works when CH is negative, and correctly returns non-zero only when CH
214 is in the range [0, 255], inclusive. */
215 #define valid_ichar_p(ch) (! (ch & ~0xFF))
166 216
167 #endif /* not MULE */ 217 #endif /* not MULE */
168 218
169 /* For more discussion, see text.c, "handling non-default formats" */ 219 /* For more discussion, see text.c, "handling non-default formats" */
170 220
2008 #define eifree(ei) \ 2058 #define eifree(ei) \
2009 do { \ 2059 do { \
2010 if ((ei)->mallocp_) \ 2060 if ((ei)->mallocp_) \
2011 { \ 2061 { \
2012 if ((ei)->data_) \ 2062 if ((ei)->data_) \
2013 xfree ((ei)->data_); \ 2063 { \
2064 xfree ((ei)->data_); \
2065 (ei)->data_ = 0; \
2066 } \
2014 if ((ei)->extdata_) \ 2067 if ((ei)->extdata_) \
2015 xfree ((ei)->extdata_); \ 2068 { \
2069 xfree ((ei)->extdata_); \
2070 (ei)->extdata_ = 0; \
2071 } \
2016 eiinit_malloc (ei); \ 2072 eiinit_malloc (ei); \
2017 } \ 2073 } \
2018 else \ 2074 else \
2019 eiinit (ei); \ 2075 eiinit (ei); \
2020 } while (0) 2076 } while (0)