Give names to Unicode code points in C code
* src/character.h (NO_BREAK_SPACE, SOFT_HYPHEN) (ZERO_WIDTH_NON_JOINER, ZERO_WIDTH_JOINER, HYPHEN) (NON_BREAKING_HYPHEN, LEFT_SINGLE_QUOTATION_MARK) (RIGHT_SINGLE_QUOTATION_MARK, PARAGRAPH_SEPARATOR) (LEFT_POINTING_ANGLE_BRACKET, RIGHT_POINTING_ANGLE_BRACKET) (LEFT_ANGLE_BRACKET, RIGHT_ANGLE_BRACKET) (OBJECT_REPLACEMENT_CHARACTER): New named constants for Unicode code points. * src/bidi.c (bidi_fetch_char, CANONICAL_EQU): * src/composite.c (char_composable_p): * src/lread.c (readevalloop, read1): * src/xdisp.c (get_next_display_element): Use them. * src/doc.c (LEFT_SINGLE_QUOTATION_POINT): Remove; now in character.h.
This commit is contained in:
parent
85f7e5115f
commit
d6640d6e4c
6 changed files with 31 additions and 12 deletions
|
@ -1313,13 +1313,13 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos,
|
|||
/* `(space ...)' display specs are handled as paragraph
|
||||
separators for the purposes of the reordering; see UAX#9
|
||||
section 3 and clause HL1 in section 4.3 there. */
|
||||
ch = 0x2029;
|
||||
ch = PARAGRAPH_SEPARATOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* All other display specs are handled as the Unicode Object
|
||||
Replacement Character. */
|
||||
ch = 0xFFFC;
|
||||
ch = OBJECT_REPLACEMENT_CHARACTER;
|
||||
}
|
||||
disp_end_pos = compute_display_string_end (*disp_pos, string);
|
||||
if (disp_end_pos < 0)
|
||||
|
@ -2482,8 +2482,8 @@ typedef struct bpa_stack_entry {
|
|||
|
||||
#define CANONICAL_EQU(c) \
|
||||
( ASCII_CHAR_P (c) ? c \
|
||||
: (c) == 0x2329 ? 0x3008 \
|
||||
: (c) == 0x232a ? 0x3009 \
|
||||
: (c) == LEFT_POINTING_ANGLE_BRACKET ? LEFT_ANGLE_BRACKET \
|
||||
: (c) == RIGHT_POINTING_ANGLE_BRACKET ? RIGHT_ANGLE_BRACKET \
|
||||
: c )
|
||||
|
||||
#ifdef ENABLE_CHECKING
|
||||
|
|
|
@ -59,6 +59,25 @@ 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,
|
||||
};
|
||||
|
||||
/* Nonzero iff C is a character that corresponds to a raw 8-bit
|
||||
byte. */
|
||||
#define CHAR_BYTE8_P(c) ((c) > MAX_5_BYTE_CHAR)
|
||||
|
|
|
@ -927,7 +927,7 @@ char_composable_p (int c)
|
|||
{
|
||||
Lisp_Object val;
|
||||
return (c > ' '
|
||||
&& (c == 0x200C || c == 0x200D
|
||||
&& (c == ZERO_WIDTH_NON_JOINER || c == ZERO_WIDTH_JOINER
|
||||
|| (val = CHAR_TABLE_REF (Vunicode_category_table, c),
|
||||
(INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
|
||||
}
|
||||
|
|
|
@ -689,7 +689,6 @@ the same file name is found in the `doc-directory'. */)
|
|||
"\xE2\x80\x98" and "\xE2\x80\x99", respectively. */
|
||||
enum
|
||||
{
|
||||
LEFT_SINGLE_QUOTATION_MARK = 0x2018,
|
||||
uLSQM0 = 0xE2, uLSQM1 = 0x80, uLSQM2 = 0x98,
|
||||
uRSQM0 = 0xE2, uRSQM1 = 0x80, uRSQM2 = 0x99,
|
||||
};
|
||||
|
|
|
@ -1885,7 +1885,7 @@ readevalloop (Lisp_Object readcharfun,
|
|||
|
||||
/* Ignore whitespace here, so we can detect eof. */
|
||||
if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'
|
||||
|| c == 0xa0) /* NBSP */
|
||||
|| c == NO_BREAK_SPACE)
|
||||
goto read_next;
|
||||
|
||||
if (!NILP (Vpurify_flag) && c == '(')
|
||||
|
@ -2793,7 +2793,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
|
|||
uninterned_symbol = 1;
|
||||
c = READCHAR;
|
||||
if (!(c > 040
|
||||
&& c != 0xa0 /* NBSP */
|
||||
&& c != NO_BREAK_SPACE
|
||||
&& (c >= 0200
|
||||
|| strchr ("\"';()[]#`,", c) == NULL)))
|
||||
{
|
||||
|
@ -3127,7 +3127,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
|
|||
default:
|
||||
default_label:
|
||||
if (c <= 040) goto retry;
|
||||
if (c == 0xa0) /* NBSP */
|
||||
if (c == NO_BREAK_SPACE)
|
||||
goto retry;
|
||||
|
||||
read_symbol:
|
||||
|
@ -3167,7 +3167,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
|
|||
c = READCHAR;
|
||||
}
|
||||
while (c > 040
|
||||
&& c != 0xa0 /* NBSP */
|
||||
&& c != NO_BREAK_SPACE
|
||||
&& (c >= 0200
|
||||
|| strchr ("\"';()[]#`,", c) == NULL));
|
||||
|
||||
|
|
|
@ -6890,9 +6890,10 @@ get_next_display_element (struct it *it)
|
|||
non-ASCII spaces and hyphens specially. */
|
||||
if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display))
|
||||
{
|
||||
if (c == 0xA0)
|
||||
if (c == NO_BREAK_SPACE)
|
||||
nonascii_space_p = true;
|
||||
else if (c == 0xAD || c == 0x2010 || c == 0x2011)
|
||||
else if (c == SOFT_HYPHEN || c == HYPHEN
|
||||
|| c == NON_BREAKING_HYPHEN)
|
||||
nonascii_hyphen_p = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue