Commit 4a0d8b4c authored by Paul Eggert's avatar Paul Eggert

Port to ISO/IEC TS 18661-1:2014

* src/character.h (CHARACTER_WIDTH): Rename from CHAR_WIDTH.
All uses changed.
parent 3988ceaa
......@@ -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 ();
}
......
......@@ -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))))
......
......@@ -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;
......
......@@ -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;
};
......
......@@ -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)
......
......@@ -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;
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment