aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2016-09-13 15:29:26 -0700
committerPaul Eggert2016-09-13 15:31:04 -0700
commit4a0d8b4cadcfef8c39581031bd00b3175ca37b43 (patch)
tree11d941293684a649b7765e2afe06edeff5a25d60 /src
parent3988ceaa1cfa2022443906750cbb30127a1e161f (diff)
downloademacs-4a0d8b4cadcfef8c39581031bd00b3175ca37b43.tar.gz
emacs-4a0d8b4cadcfef8c39581031bd00b3175ca37b43.zip
Port to ISO/IEC TS 18661-1:2014
* src/character.h (CHARACTER_WIDTH): Rename from CHAR_WIDTH. All uses changed.
Diffstat (limited to 'src')
-rw-r--r--src/character.c4
-rw-r--r--src/character.h5
-rw-r--r--src/composite.c8
-rw-r--r--src/dispextern.h2
-rw-r--r--src/indent.c2
-rw-r--r--src/menu.c2
-rw-r--r--src/term.c6
-rw-r--r--src/xdisp.c2
8 files changed, 16 insertions, 15 deletions
diff --git a/src/character.c b/src/character.c
index b19e41d660a..75a7dab6845 100644
--- a/src/character.c
+++ b/src/character.c
@@ -278,7 +278,7 @@ If the multibyte character does not represent a byte, return -1. */)
278static ptrdiff_t 278static ptrdiff_t
279char_width (int c, struct Lisp_Char_Table *dp) 279char_width (int c, struct Lisp_Char_Table *dp)
280{ 280{
281 ptrdiff_t width = CHAR_WIDTH (c); 281 ptrdiff_t width = CHARACTER_WIDTH (c);
282 282
283 if (dp) 283 if (dp)
284 { 284 {
@@ -291,7 +291,7 @@ char_width (int c, struct Lisp_Char_Table *dp)
291 ch = AREF (disp, i); 291 ch = AREF (disp, i);
292 if (CHARACTERP (ch)) 292 if (CHARACTERP (ch))
293 { 293 {
294 int w = CHAR_WIDTH (XFASTINT (ch)); 294 int w = CHARACTER_WIDTH (XFASTINT (ch));
295 if (INT_ADD_WRAPV (width, w, &width)) 295 if (INT_ADD_WRAPV (width, w, &width))
296 string_overflow (); 296 string_overflow ();
297 } 297 }
diff --git a/src/character.h b/src/character.h
index 2cb76b0f2d5..b72b61d7054 100644
--- a/src/character.h
+++ b/src/character.h
@@ -588,9 +588,10 @@ sanitize_char_width (EMACS_INT width)
588 588
589/* Return the width of character C. The width is measured by how many 589/* Return the width of character C. The width is measured by how many
590 columns C will occupy on the screen when displayed in the current 590 columns C will occupy on the screen when displayed in the current
591 buffer. */ 591 buffer. The name CHARACTER_WIDTH avoids a collision with <limits.h>
592 CHAR_WIDTH when enabled; see ISO/IEC TS 18661-1:2014. */
592 593
593#define CHAR_WIDTH(c) \ 594#define CHARACTER_WIDTH(c) \
594 (ASCII_CHAR_P (c) \ 595 (ASCII_CHAR_P (c) \
595 ? ASCII_CHAR_WIDTH (c) \ 596 ? ASCII_CHAR_WIDTH (c) \
596 : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c)))) 597 : sanitize_char_width (XINT (CHAR_TABLE_REF (Vchar_width_table, c))))
diff --git a/src/composite.c b/src/composite.c
index 8aa69746595..da921358e9f 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,
335 ch = XINT (key_contents[i]); 335 ch = XINT (key_contents[i]);
336 /* TAB in a composition means display glyphs with padding 336 /* TAB in a composition means display glyphs with padding
337 space on the left or right. */ 337 space on the left or right. */
338 this_width = (ch == '\t' ? 1 : CHAR_WIDTH (ch)); 338 this_width = (ch == '\t' ? 1 : CHARACTER_WIDTH (ch));
339 if (cmp->width < this_width) 339 if (cmp->width < this_width)
340 cmp->width = this_width; 340 cmp->width = this_width;
341 } 341 }
@@ -346,7 +346,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
346 double leftmost = 0.0, rightmost; 346 double leftmost = 0.0, rightmost;
347 347
348 ch = XINT (key_contents[0]); 348 ch = XINT (key_contents[0]);
349 rightmost = ch != '\t' ? CHAR_WIDTH (ch) : 1; 349 rightmost = ch != '\t' ? CHARACTER_WIDTH (ch) : 1;
350 350
351 for (i = 1; i < glyph_len; i += 2) 351 for (i = 1; i < glyph_len; i += 2)
352 { 352 {
@@ -356,7 +356,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
356 356
357 rule = XINT (key_contents[i]); 357 rule = XINT (key_contents[i]);
358 ch = XINT (key_contents[i + 1]); 358 ch = XINT (key_contents[i + 1]);
359 this_width = ch != '\t' ? CHAR_WIDTH (ch) : 1; 359 this_width = ch != '\t' ? CHARACTER_WIDTH (ch) : 1;
360 360
361 /* A composition rule is specified by an integer value 361 /* A composition rule is specified by an integer value
362 that encodes global and new reference points (GREF and 362 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
1383 { 1383 {
1384 c = XINT (LGSTRING_CHAR (gstring, from + i)); 1384 c = XINT (LGSTRING_CHAR (gstring, from + i));
1385 cmp_it->nbytes += CHAR_BYTES (c); 1385 cmp_it->nbytes += CHAR_BYTES (c);
1386 cmp_it->width += CHAR_WIDTH (c); 1386 cmp_it->width += CHARACTER_WIDTH (c);
1387 } 1387 }
1388 } 1388 }
1389 return c; 1389 return c;
diff --git a/src/dispextern.h b/src/dispextern.h
index f2c42de6cd2..79bc9353ec5 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2237,7 +2237,7 @@ struct composition_it
2237 /* Indices of the glyphs for the current grapheme cluster. */ 2237 /* Indices of the glyphs for the current grapheme cluster. */
2238 int from, to; 2238 int from, to;
2239 /* Width of the current grapheme cluster in units of columns it will 2239 /* Width of the current grapheme cluster in units of columns it will
2240 occupy on display; see CHAR_WIDTH. */ 2240 occupy on display; see CHARACTER_WIDTH. */
2241 int width; 2241 int width;
2242}; 2242};
2243 2243
diff --git a/src/indent.c b/src/indent.c
index f8c180d3e2b..cc5bf37f1df 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
296 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \ 296 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \
297 width = sanitize_char_width (ASIZE (DISP_CHAR_VECTOR (dp, ch))); \ 297 width = sanitize_char_width (ASIZE (DISP_CHAR_VECTOR (dp, ch))); \
298 else \ 298 else \
299 width = CHAR_WIDTH (ch); \ 299 width = CHARACTER_WIDTH (ch); \
300 } \ 300 } \
301 } while (0) 301 } while (0)
302 302
diff --git a/src/menu.c b/src/menu.c
index 90bb19a2e94..638810b36f8 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1045,7 +1045,7 @@ menu_item_width (const unsigned char *str)
1045 int ch_len; 1045 int ch_len;
1046 int ch = STRING_CHAR_AND_LENGTH (p, ch_len); 1046 int ch = STRING_CHAR_AND_LENGTH (p, ch_len);
1047 1047
1048 len += CHAR_WIDTH (ch); 1048 len += CHARACTER_WIDTH (ch);
1049 p += ch_len; 1049 p += ch_len;
1050 } 1050 }
1051 return len; 1051 return len;
diff --git a/src/term.c b/src/term.c
index 54a97e95b79..426674f4470 100644
--- a/src/term.c
+++ b/src/term.c
@@ -593,7 +593,7 @@ encode_terminal_code (struct glyph *src, int src_len,
593 continue; 593 continue;
594 if (char_charset (c, charset_list, NULL)) 594 if (char_charset (c, charset_list, NULL))
595 { 595 {
596 if (CHAR_WIDTH (c) == 0 596 if (CHARACTER_WIDTH (c) == 0
597 && i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t') 597 && i > 0 && COMPOSITION_GLYPH (cmp, i - 1) == '\t')
598 /* Should be left-padded */ 598 /* Should be left-padded */
599 { 599 {
@@ -1626,7 +1626,7 @@ produce_glyphs (struct it *it)
1626 1626
1627 if (char_charset (it->char_to_display, charset_list, NULL)) 1627 if (char_charset (it->char_to_display, charset_list, NULL))
1628 { 1628 {
1629 it->pixel_width = CHAR_WIDTH (it->char_to_display); 1629 it->pixel_width = CHARACTER_WIDTH (it->char_to_display);
1630 it->nglyphs = it->pixel_width; 1630 it->nglyphs = it->pixel_width;
1631 if (it->glyph_row) 1631 if (it->glyph_row)
1632 append_glyph (it); 1632 append_glyph (it);
@@ -1832,7 +1832,7 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
1832 } 1832 }
1833 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) 1833 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
1834 { 1834 {
1835 len = CHAR_WIDTH (it->c); 1835 len = CHARACTER_WIDTH (it->c);
1836 if (len == 0) 1836 if (len == 0)
1837 len = 1; 1837 len = 1;
1838 else if (len > 4) 1838 else if (len > 4)
diff --git a/src/xdisp.c b/src/xdisp.c
index d1e884820b6..4bf1470e46c 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)
26927 } 26927 }
26928 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX) 26928 else if (it->glyphless_method == GLYPHLESS_DISPLAY_EMPTY_BOX)
26929 { 26929 {
26930 width = CHAR_WIDTH (it->c); 26930 width = CHARACTER_WIDTH (it->c);
26931 if (width == 0) 26931 if (width == 0)
26932 width = 1; 26932 width = 1;
26933 else if (width > 4) 26933 else if (width > 4)