emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 4a0d8b4: Port to ISO/IEC TS 18661-1:2014


From: Paul Eggert
Subject: [Emacs-diffs] master 4a0d8b4: Port to ISO/IEC TS 18661-1:2014
Date: Tue, 13 Sep 2016 22:31:10 +0000 (UTC)

branch: master
commit 4a0d8b4cadcfef8c39581031bd00b3175ca37b43
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Port to ISO/IEC TS 18661-1:2014
    
    * src/character.h (CHARACTER_WIDTH): Rename from CHAR_WIDTH.
    All uses changed.
---
 src/character.c  |    4 ++--
 src/character.h  |    5 +++--
 src/composite.c  |    8 ++++----
 src/dispextern.h |    2 +-
 src/indent.c     |    2 +-
 src/menu.c       |    2 +-
 src/term.c       |    6 +++---
 src/xdisp.c      |    2 +-
 8 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/character.c b/src/character.c
index b19e41d..75a7dab 100644
--- a/src/character.c
+++ b/src/character.c
@@ -278,7 +278,7 @@ If the multibyte character does not represent a byte, 
return -1.  */)
 static ptrdiff_t
 char_width (int c, struct Lisp_Char_Table *dp)
 {
-  ptrdiff_t width = CHAR_WIDTH (c);
+  ptrdiff_t width = CHARACTER_WIDTH (c);
 
   if (dp)
     {
@@ -291,7 +291,7 @@ char_width (int c, struct Lisp_Char_Table *dp)
            ch = AREF (disp, i);
            if (CHARACTERP (ch))
              {
-               int w = CHAR_WIDTH (XFASTINT (ch));
+               int w = CHARACTER_WIDTH (XFASTINT (ch));
                if (INT_ADD_WRAPV (width, w, &width))
                  string_overflow ();
              }
diff --git a/src/character.h b/src/character.h
index 2cb76b0..b72b61d 100644
--- a/src/character.h
+++ b/src/character.h
@@ -588,9 +588,10 @@ sanitize_char_width (EMACS_INT width)
 
 /* Return the width of character C.  The width is measured by how many
    columns C will occupy on the screen when displayed in the current
-   buffer.  */
+   buffer.  The name CHARACTER_WIDTH avoids a collision with <limits.h>
+   CHAR_WIDTH when enabled; see ISO/IEC TS 18661-1:2014.  */
 
-#define CHAR_WIDTH(c)          \
+#define CHARACTER_WIDTH(c)     \
   (ASCII_CHAR_P (c)            \
    ? ASCII_CHAR_WIDTH (c)      \
    : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c))))
diff --git a/src/composite.c b/src/composite.c
index 8aa6974..da92135 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -335,7 +335,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
          ch = XINT (key_contents[i]);
          /* TAB in a composition means display glyphs with padding
             space on the left or right.  */
-         this_width = (ch == '\t' ? 1 : CHAR_WIDTH (ch));
+         this_width = (ch == '\t' ? 1 : CHARACTER_WIDTH (ch));
          if (cmp->width < this_width)
            cmp->width = this_width;
        }
@@ -346,7 +346,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
       double leftmost = 0.0, rightmost;
 
       ch = XINT (key_contents[0]);
-      rightmost = ch != '\t' ? CHAR_WIDTH (ch) : 1;
+      rightmost = ch != '\t' ? CHARACTER_WIDTH (ch) : 1;
 
       for (i = 1; i < glyph_len; i += 2)
        {
@@ -356,7 +356,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
 
          rule = XINT (key_contents[i]);
          ch = XINT (key_contents[i + 1]);
-         this_width = ch != '\t' ? CHAR_WIDTH (ch) : 1;
+         this_width = ch != '\t' ? CHARACTER_WIDTH (ch) : 1;
 
          /* A composition rule is specified by an integer value
             that encodes global and new reference points (GREF and
@@ -1383,7 +1383,7 @@ composition_update_it (struct composition_it *cmp_it, 
ptrdiff_t charpos, ptrdiff
        {
          c = XINT (LGSTRING_CHAR (gstring, from + i));
          cmp_it->nbytes += CHAR_BYTES (c);
-         cmp_it->width += CHAR_WIDTH (c);
+         cmp_it->width += CHARACTER_WIDTH (c);
        }
     }
   return c;
diff --git a/src/dispextern.h b/src/dispextern.h
index f2c42de..79bc935 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2237,7 +2237,7 @@ struct composition_it
   /* Indices of the glyphs for the current grapheme cluster.  */
   int from, to;
   /* Width of the current grapheme cluster in units of columns it will
-     occupy on display; see CHAR_WIDTH.  */
+     occupy on display; see CHARACTER_WIDTH.  */
   int width;
 };
 
diff --git a/src/indent.c b/src/indent.c
index f8c180d..cc5bf37 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -296,7 +296,7 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, 
ptrdiff_t to, Lisp_Ob
        if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch)))             \
          width = sanitize_char_width (ASIZE (DISP_CHAR_VECTOR (dp, ch))); \
        else                                                            \
-         width = CHAR_WIDTH (ch);                                      \
+         width = CHARACTER_WIDTH (ch);                                 \
       }                                                                        
\
   } while (0)
 
diff --git a/src/menu.c b/src/menu.c
index 90bb19a..638810b 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1045,7 +1045,7 @@ menu_item_width (const unsigned char *str)
       int ch_len;
       int ch = STRING_CHAR_AND_LENGTH (p, ch_len);
 
-      len += CHAR_WIDTH (ch);
+      len += CHARACTER_WIDTH (ch);
       p += ch_len;
     }
   return len;
diff --git a/src/term.c b/src/term.c
index 54a97e9..426674f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -593,7 +593,7 @@ encode_terminal_code (struct glyph *src, int src_len,
                  continue;
                if (char_charset (c, charset_list, NULL))
                  {
-                   if (CHAR_WIDTH (c) == 0
+                   if (CHARACTER_WIDTH (c) == 0
                        && i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t')
                      /* Should be left-padded */
                      {
@@ -1626,7 +1626,7 @@ produce_glyphs (struct it *it)
 
       if (char_charset (it->char_to_display, charset_list, NULL))
        {
-         it->pixel_width = CHAR_WIDTH (it->char_to_display);
+         it->pixel_width = CHARACTER_WIDTH (it->char_to_display);
          it->nglyphs = it->pixel_width;
          if (it->glyph_row)
            append_glyph (it);
@@ -1832,7 +1832,7 @@ produce_glyphless_glyph (struct it *it, Lisp_Object 
acronym)
     }
   else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
     {
-      len = CHAR_WIDTH (it->c);
+      len = CHARACTER_WIDTH (it->c);
       if (len == 0)
        len = 1;
       else if (len > 4)
diff --git a/src/xdisp.c b/src/xdisp.c
index d1e8848..4bf1470 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -26927,7 +26927,7 @@ produce_glyphless_glyph (struct it *it, bool 
for_no_font, Lisp_Object acronym)
     }
   else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
     {
-      width = CHAR_WIDTH (it->c);
+      width = CHARACTER_WIDTH (it->c);
       if (width == 0)
        width = 1;
       else if (width > 4)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]