X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/a84225d29c40a8cf3f860d2b58517102eef33436..0a2aedfe6d650e825a50f25f972bac20d669f5cb:/src/character.h?ds=sidebyside diff --git a/src/character.h b/src/character.h index 67d4bca4a2..586f330fba 100644 --- a/src/character.h +++ b/src/character.h @@ -9,8 +9,8 @@ This file is part of GNU Emacs. 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 @@ -24,6 +24,7 @@ along with GNU Emacs. If not, see . */ #define EMACS_CHARACTER_H #include +#include "lisp.h" INLINE_HEADER_BEGIN @@ -134,14 +135,12 @@ enum 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. */ @@ -613,14 +612,13 @@ sanitize_char_width (EMACS_INT width) : (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.