comparison src/text.h @ 5863:15041705c196

Provide `char-code-limit', implement the GNU equivalent in terms of it. src/ChangeLog addition: 2015-03-15 Aidan Kehoe <kehoea@parhasard.net> * text.h: Make CHAR_CODE_LIMIT available as a #define. * text.h (valid_ichar_p): Use it. * text.c: Make a fixnum Vchar_code_limit available here. * text.c (non_ascii_valid_ichar_p): Use CHAR_CODE_LIMIT. * text.c (vars_of_text): Make `char-code-limit' available to Lisp. tests/ChangeLog addition: 2015-03-15 Aidan Kehoe <kehoea@parhasard.net> * automated/mule-tests.el (test-chars): Use char-code-limit explicitly here, instead of hardcoding the corresponding values. lisp/ChangeLog addition: 2015-03-16 Aidan Kehoe <kehoea@parhasard.net> * obsolete.el (max-char): Make this available for compatiblity with GNU, implement it in terms of char-code-limit.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 16 Mar 2015 00:09:46 +0000
parents b3824b7f5627
children
comparison
equal deleted inserted replaced
5862:5b799fa6d75e 5863:15041705c196
119 #ifndef MULE 119 #ifndef MULE
120 120
121 #define rep_bytes_by_first_byte(fb) 1 121 #define rep_bytes_by_first_byte(fb) 1
122 #define byte_ascii_p(byte) 1 122 #define byte_ascii_p(byte) 1
123 #define MAX_ICHAR_LEN 1 123 #define MAX_ICHAR_LEN 1
124 /* Exclusive upper bound on character codes. */
125 #define CHAR_CODE_LIMIT 0x100
124 126
125 #else /* MULE */ 127 #else /* MULE */
126 128
127 /* These are carefully designed to work if BYTE is signed or unsigned. */ 129 /* These are carefully designed to work if BYTE is signed or unsigned. */
128 /* Note that SPC and DEL are considered ASCII, not control. */ 130 /* Note that SPC and DEL are considered ASCII, not control. */
210 212
211 #define ichar_multibyte_p(c) ((c) >= 0x80) 213 #define ichar_multibyte_p(c) ((c) >= 0x80)
212 214
213 #define ichar_ascii_p(c) (!ichar_multibyte_p (c)) 215 #define ichar_ascii_p(c) (!ichar_multibyte_p (c))
214 216
215 /* Maximum number of bytes per Emacs character when represented as text, in 217 /* Maximum number of bytes per Ichar when represented as text. */
216 any format.
217 */
218
219 #define MAX_ICHAR_LEN 4 218 #define MAX_ICHAR_LEN 4
219
220 /* Exclusive upper bound on char codes. */
221 #define CHAR_CODE_LIMIT 0x200000
220 222
221 #endif /* not MULE */ 223 #endif /* not MULE */
222 224
223 #ifdef MULE 225 #ifdef MULE
224 226
237 239
238 #else /* not MULE */ 240 #else /* not MULE */
239 241
240 /* This works when CH is negative, and correctly returns non-zero only when CH 242 /* This works when CH is negative, and correctly returns non-zero only when CH
241 is in the range [0, 255], inclusive. */ 243 is in the range [0, 255], inclusive. */
242 #define valid_ichar_p(ch) (! (ch & ~0xFF)) 244 #define valid_ichar_p(ch) (! (ch & ~(CHAR_CODE_LIMIT - 1)))
243 245
244 #endif /* not MULE */ 246 #endif /* not MULE */
245 247
246 /* For more discussion, see text.c, "handling non-default formats" */ 248 /* For more discussion, see text.c, "handling non-default formats" */
247 249