]> git.eshelyaron.com Git - emacs.git/commitdiff
Give names to Unicode code points in C code
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 11 Aug 2015 22:53:18 +0000 (15:53 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 11 Aug 2015 22:53:56 +0000 (15:53 -0700)
* 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.

src/bidi.c
src/character.h
src/composite.c
src/doc.c
src/lread.c
src/xdisp.c

index e06430c8b84da772aab7f97ab53402d03d0bfb9b..bcc15b8c8f513d66a94b18258436dd18a3f68ac7 100644 (file)
@@ -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
index 859d717a0bac2c42ff133d1fd4b45e61b36527f1..0b2c419de9911ba1b7abeee4c5d8767fc41ef475 100644 (file)
@@ -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)
index 1c18165599df5cccd9100fc8dd5852c86a9b1bd2..88cef222d3a3d3a120f63b3750c44ca88da789b8 100644 (file)
@@ -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)))));
 }
index a079cd27493530f890e65e8282b19fa88e5ca734..cb52266ef58d6d2cd51e5b86502b8a8844ba01d2 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -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,
   };
index 11c8d0031c964d8825c225e3dc732cbf5f42461b..fe4d3672b449d1bbefba565e36b8430c04ff2122 100644 (file)
@@ -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));
 
index 711fe080b03ea4fb2c558e4943b52c004d244403..7371216d387cda5b0feaad5cae423345ca9ec03e 100644 (file)
@@ -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;
            }