GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#define EMACS_CHARACTER_H
#include <verify.h>
+#include "lisp.h"
INLINE_HEADER_BEGIN
/* Maximum leading code of multibyte characters. */
#define MAX_MULTIBYTE_LEADING_CODE 0xF8
+/* Unicode character values. */
+enum
+{
+ NO_BREAK_SPACE = 0x00A0,
+ SOFT_HYPHEN = 0x00AD,
+ ZERO_WIDTH_NON_JOINER = 0x200C,
+ ZERO_WIDTH_JOINER = 0x200D,
+ HYPHEN = 0x2010,
+ NON_BREAKING_HYPHEN = 0x2011,
+ LEFT_SINGLE_QUOTATION_MARK = 0x2018,
+ RIGHT_SINGLE_QUOTATION_MARK = 0x2019,
+ PARAGRAPH_SEPARATOR = 0x2029,
+ LEFT_POINTING_ANGLE_BRACKET = 0x2329,
+ RIGHT_POINTING_ANGLE_BRACKET = 0x232A,
+ LEFT_ANGLE_BRACKET = 0x3008,
+ RIGHT_ANGLE_BRACKET = 0x3009,
+ OBJECT_REPLACEMENT_CHARACTER = 0xFFFC,
+};
+
+/* UTF-8 encodings. Use \x escapes, so they are portable to pre-C11
+ compilers and can be concatenated with ordinary string literals. */
+#define uLSQM "\xE2\x80\x98" /* U+2018 LEFT SINGLE QUOTATION MARK */
+#define uRSQM "\xE2\x80\x99" /* U+2019 RIGHT SINGLE QUOTATION MARK */
+
/* Nonzero iff C is a character that corresponds to a raw 8-bit
byte. */
#define CHAR_BYTE8_P(c) ((c) > MAX_5_BYTE_CHAR)
do { \
Lisp_Object tmp = XCAR (x); \
CHECK_CHARACTER (tmp); \
- XSETCAR ((x), tmp); \
} while (false)
#define CHECK_CHARACTER_CDR(x) \
do { \
Lisp_Object tmp = XCDR (x); \
CHECK_CHARACTER (tmp); \
- XSETCDR ((x), tmp); \
} while (false)
/* Nonzero iff C is a character of code less than 0x100. */
: (c) <= 0xE01EF ? (c) - 0xE0100 + 17 \
: 0)
-/* If C is a high surrogate, return 1. If C is a low surrogate,
- return 2. Otherwise, return 0. */
+/* Return true if C is a surrogate. */
-#define CHAR_SURROGATE_PAIR_P(c) \
- ((c) < 0xD800 ? 0 \
- : (c) <= 0xDBFF ? 1 \
- : (c) <= 0xDFFF ? 2 \
- : 0)
+INLINE bool
+char_surrogate_p (int c)
+{
+ return 0xD800 <= c && c <= 0xDFFF;
+}
/* Data type for Unicode general category.
extern Lisp_Object Vchar_unify_table;
extern Lisp_Object string_escape_byte8 (Lisp_Object);
+extern bool alphabeticp (int);
+extern bool decimalnump (int);
+extern bool graphicp (int);
+extern bool printablep (int);
+
/* Return a translation table of id number ID. */
#define GET_TRANSLATION_TABLE(id) \
(XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)]))