X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f15c8583198c3d6c26ca0c0a5b6fb019f98d6c3c..02ca5db040b57ca4a36c317fcb3fb56f43ab371e:/src/character.h diff --git a/src/character.h b/src/character.h index 7d902952db..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 @@ -59,6 +60,30 @@ 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) @@ -110,14 +135,12 @@ INLINE_HEADER_BEGIN 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. */ @@ -589,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. @@ -662,6 +684,8 @@ 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) \