diff options
| author | Paul Eggert | 2015-08-11 15:53:18 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-08-11 15:53:56 -0700 |
| commit | d6640d6e4c4f1a85edf924bca0f8a90d1aa6341a (patch) | |
| tree | 4590c28d3a3810f8615bd1bef52773063d8fa8ac /src | |
| parent | 85f7e5115f9f409126d355997e8103ea5126ada2 (diff) | |
| download | emacs-d6640d6e4c4f1a85edf924bca0f8a90d1aa6341a.tar.gz emacs-d6640d6e4c4f1a85edf924bca0f8a90d1aa6341a.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/bidi.c | 8 | ||||
| -rw-r--r-- | src/character.h | 19 | ||||
| -rw-r--r-- | src/composite.c | 2 | ||||
| -rw-r--r-- | src/doc.c | 1 | ||||
| -rw-r--r-- | src/lread.c | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 5 |
6 files changed, 31 insertions, 12 deletions
diff --git a/src/bidi.c b/src/bidi.c index e06430c8b84..bcc15b8c8f5 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -1313,13 +1313,13 @@ bidi_fetch_char (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t *disp_pos, | |||
| 1313 | /* `(space ...)' display specs are handled as paragraph | 1313 | /* `(space ...)' display specs are handled as paragraph |
| 1314 | separators for the purposes of the reordering; see UAX#9 | 1314 | separators for the purposes of the reordering; see UAX#9 |
| 1315 | section 3 and clause HL1 in section 4.3 there. */ | 1315 | section 3 and clause HL1 in section 4.3 there. */ |
| 1316 | ch = 0x2029; | 1316 | ch = PARAGRAPH_SEPARATOR; |
| 1317 | } | 1317 | } |
| 1318 | else | 1318 | else |
| 1319 | { | 1319 | { |
| 1320 | /* All other display specs are handled as the Unicode Object | 1320 | /* All other display specs are handled as the Unicode Object |
| 1321 | Replacement Character. */ | 1321 | Replacement Character. */ |
| 1322 | ch = 0xFFFC; | 1322 | ch = OBJECT_REPLACEMENT_CHARACTER; |
| 1323 | } | 1323 | } |
| 1324 | disp_end_pos = compute_display_string_end (*disp_pos, string); | 1324 | disp_end_pos = compute_display_string_end (*disp_pos, string); |
| 1325 | if (disp_end_pos < 0) | 1325 | if (disp_end_pos < 0) |
| @@ -2482,8 +2482,8 @@ typedef struct bpa_stack_entry { | |||
| 2482 | 2482 | ||
| 2483 | #define CANONICAL_EQU(c) \ | 2483 | #define CANONICAL_EQU(c) \ |
| 2484 | ( ASCII_CHAR_P (c) ? c \ | 2484 | ( ASCII_CHAR_P (c) ? c \ |
| 2485 | : (c) == 0x2329 ? 0x3008 \ | 2485 | : (c) == LEFT_POINTING_ANGLE_BRACKET ? LEFT_ANGLE_BRACKET \ |
| 2486 | : (c) == 0x232a ? 0x3009 \ | 2486 | : (c) == RIGHT_POINTING_ANGLE_BRACKET ? RIGHT_ANGLE_BRACKET \ |
| 2487 | : c ) | 2487 | : c ) |
| 2488 | 2488 | ||
| 2489 | #ifdef ENABLE_CHECKING | 2489 | #ifdef ENABLE_CHECKING |
diff --git a/src/character.h b/src/character.h index 859d717a0ba..0b2c419de99 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -59,6 +59,25 @@ INLINE_HEADER_BEGIN | |||
| 59 | /* Maximum leading code of multibyte characters. */ | 59 | /* Maximum leading code of multibyte characters. */ |
| 60 | #define MAX_MULTIBYTE_LEADING_CODE 0xF8 | 60 | #define MAX_MULTIBYTE_LEADING_CODE 0xF8 |
| 61 | 61 | ||
| 62 | /* Unicode character values. */ | ||
| 63 | enum | ||
| 64 | { | ||
| 65 | NO_BREAK_SPACE = 0x00A0, | ||
| 66 | SOFT_HYPHEN = 0x00AD, | ||
| 67 | ZERO_WIDTH_NON_JOINER = 0x200C, | ||
| 68 | ZERO_WIDTH_JOINER = 0x200D, | ||
| 69 | HYPHEN = 0x2010, | ||
| 70 | NON_BREAKING_HYPHEN = 0x2011, | ||
| 71 | LEFT_SINGLE_QUOTATION_MARK = 0x2018, | ||
| 72 | RIGHT_SINGLE_QUOTATION_MARK = 0x2019, | ||
| 73 | PARAGRAPH_SEPARATOR = 0x2029, | ||
| 74 | LEFT_POINTING_ANGLE_BRACKET = 0x2329, | ||
| 75 | RIGHT_POINTING_ANGLE_BRACKET = 0x232A, | ||
| 76 | LEFT_ANGLE_BRACKET = 0x3008, | ||
| 77 | RIGHT_ANGLE_BRACKET = 0x3009, | ||
| 78 | OBJECT_REPLACEMENT_CHARACTER = 0xFFFC, | ||
| 79 | }; | ||
| 80 | |||
| 62 | /* Nonzero iff C is a character that corresponds to a raw 8-bit | 81 | /* Nonzero iff C is a character that corresponds to a raw 8-bit |
| 63 | byte. */ | 82 | byte. */ |
| 64 | #define CHAR_BYTE8_P(c) ((c) > MAX_5_BYTE_CHAR) | 83 | #define CHAR_BYTE8_P(c) ((c) > MAX_5_BYTE_CHAR) |
diff --git a/src/composite.c b/src/composite.c index 1c18165599d..88cef222d3a 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -927,7 +927,7 @@ char_composable_p (int c) | |||
| 927 | { | 927 | { |
| 928 | Lisp_Object val; | 928 | Lisp_Object val; |
| 929 | return (c > ' ' | 929 | return (c > ' ' |
| 930 | && (c == 0x200C || c == 0x200D | 930 | && (c == ZERO_WIDTH_NON_JOINER || c == ZERO_WIDTH_JOINER |
| 931 | || (val = CHAR_TABLE_REF (Vunicode_category_table, c), | 931 | || (val = CHAR_TABLE_REF (Vunicode_category_table, c), |
| 932 | (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So))))); | 932 | (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So))))); |
| 933 | } | 933 | } |
| @@ -689,7 +689,6 @@ the same file name is found in the `doc-directory'. */) | |||
| 689 | "\xE2\x80\x98" and "\xE2\x80\x99", respectively. */ | 689 | "\xE2\x80\x98" and "\xE2\x80\x99", respectively. */ |
| 690 | enum | 690 | enum |
| 691 | { | 691 | { |
| 692 | LEFT_SINGLE_QUOTATION_MARK = 0x2018, | ||
| 693 | uLSQM0 = 0xE2, uLSQM1 = 0x80, uLSQM2 = 0x98, | 692 | uLSQM0 = 0xE2, uLSQM1 = 0x80, uLSQM2 = 0x98, |
| 694 | uRSQM0 = 0xE2, uRSQM1 = 0x80, uRSQM2 = 0x99, | 693 | uRSQM0 = 0xE2, uRSQM1 = 0x80, uRSQM2 = 0x99, |
| 695 | }; | 694 | }; |
diff --git a/src/lread.c b/src/lread.c index 11c8d0031c9..fe4d3672b44 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1885,7 +1885,7 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1885 | 1885 | ||
| 1886 | /* Ignore whitespace here, so we can detect eof. */ | 1886 | /* Ignore whitespace here, so we can detect eof. */ |
| 1887 | if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' | 1887 | if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' |
| 1888 | || c == 0xa0) /* NBSP */ | 1888 | || c == NO_BREAK_SPACE) |
| 1889 | goto read_next; | 1889 | goto read_next; |
| 1890 | 1890 | ||
| 1891 | if (!NILP (Vpurify_flag) && c == '(') | 1891 | if (!NILP (Vpurify_flag) && c == '(') |
| @@ -2793,7 +2793,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2793 | uninterned_symbol = 1; | 2793 | uninterned_symbol = 1; |
| 2794 | c = READCHAR; | 2794 | c = READCHAR; |
| 2795 | if (!(c > 040 | 2795 | if (!(c > 040 |
| 2796 | && c != 0xa0 /* NBSP */ | 2796 | && c != NO_BREAK_SPACE |
| 2797 | && (c >= 0200 | 2797 | && (c >= 0200 |
| 2798 | || strchr ("\"';()[]#`,", c) == NULL))) | 2798 | || strchr ("\"';()[]#`,", c) == NULL))) |
| 2799 | { | 2799 | { |
| @@ -3127,7 +3127,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3127 | default: | 3127 | default: |
| 3128 | default_label: | 3128 | default_label: |
| 3129 | if (c <= 040) goto retry; | 3129 | if (c <= 040) goto retry; |
| 3130 | if (c == 0xa0) /* NBSP */ | 3130 | if (c == NO_BREAK_SPACE) |
| 3131 | goto retry; | 3131 | goto retry; |
| 3132 | 3132 | ||
| 3133 | read_symbol: | 3133 | read_symbol: |
| @@ -3167,7 +3167,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3167 | c = READCHAR; | 3167 | c = READCHAR; |
| 3168 | } | 3168 | } |
| 3169 | while (c > 040 | 3169 | while (c > 040 |
| 3170 | && c != 0xa0 /* NBSP */ | 3170 | && c != NO_BREAK_SPACE |
| 3171 | && (c >= 0200 | 3171 | && (c >= 0200 |
| 3172 | || strchr ("\"';()[]#`,", c) == NULL)); | 3172 | || strchr ("\"';()[]#`,", c) == NULL)); |
| 3173 | 3173 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 711fe080b03..7371216d387 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -6890,9 +6890,10 @@ get_next_display_element (struct it *it) | |||
| 6890 | non-ASCII spaces and hyphens specially. */ | 6890 | non-ASCII spaces and hyphens specially. */ |
| 6891 | if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) | 6891 | if (! ASCII_CHAR_P (c) && ! NILP (Vnobreak_char_display)) |
| 6892 | { | 6892 | { |
| 6893 | if (c == 0xA0) | 6893 | if (c == NO_BREAK_SPACE) |
| 6894 | nonascii_space_p = true; | 6894 | nonascii_space_p = true; |
| 6895 | else if (c == 0xAD || c == 0x2010 || c == 0x2011) | 6895 | else if (c == SOFT_HYPHEN || c == HYPHEN |
| 6896 | || c == NON_BREAKING_HYPHEN) | ||
| 6896 | nonascii_hyphen_p = true; | 6897 | nonascii_hyphen_p = true; |
| 6897 | } | 6898 | } |
| 6898 | 6899 | ||