aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2002-03-05 00:07:51 +0000
committerKenichi Handa2002-03-05 00:07:51 +0000
commit1889b23802236ef49d376f1cb1cd6e21cb9a4f52 (patch)
tree9604aa7d5afc35bd2d3920f13a5e868f49e08ab7 /src
parented5d25fe5e9ffce2359ba166d277570e87c959e6 (diff)
downloademacs-1889b23802236ef49d376f1cb1cd6e21cb9a4f52.tar.gz
emacs-1889b23802236ef49d376f1cb1cd6e21cb9a4f52.zip
(c_string_width): Add return type `int'.
(char_string_with_unification): Arg ADVANCED deleted.
Diffstat (limited to 'src')
-rw-r--r--src/character.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/character.c b/src/character.c
index 51527ee7dbb..c8936a0586a 100644
--- a/src/character.c
+++ b/src/character.c
@@ -80,9 +80,9 @@ int _fetch_multibyte_char_len;
80 80
81 81
82int 82int
83char_string_with_unification (c, p, advanced) 83char_string_with_unification (c, p)
84 int c; 84 int c;
85 unsigned char *p, **advanced; 85 unsigned char *p;
86{ 86{
87 int bytes; 87 int bytes;
88 88
@@ -109,8 +109,7 @@ char_string_with_unification (c, p, advanced)
109 p[4] = (0x80 | (c & 0x3F)); 109 p[4] = (0x80 | (c & 0x3F));
110 bytes = 5; 110 bytes = 5;
111 } 111 }
112 if (advanced) 112
113 *advanced = p + bytes;
114 return bytes; 113 return bytes;
115} 114}
116 115
@@ -120,7 +119,7 @@ string_char_with_unification (p, advanced, len)
120 unsigned char *p, **advanced; 119 unsigned char *p, **advanced;
121 int *len; 120 int *len;
122{ 121{
123 int c, unified; 122 int c;
124 unsigned char *saved_p = p; 123 unsigned char *saved_p = p;
125 124
126 if (*p < 0x80 || ! (*p & 0x20) || ! (*p & 0x10)) 125 if (*p < 0x80 || ! (*p & 0x20) || ! (*p & 0x10))
@@ -304,23 +303,12 @@ Tab is taken to occupy `tab-width' columns. */)
304 303
305/* Return width of string STR of length LEN when displayed in the 304/* Return width of string STR of length LEN when displayed in the
306 current buffer. The width is measured by how many columns it 305 current buffer. The width is measured by how many columns it
307 occupies on the screen. */
308
309int
310strwidth (str, len)
311 unsigned char *str;
312 int len;
313{
314 return c_string_width (str, len, -1, NULL, NULL);
315}
316
317/* Return width of string STR of length LEN when displayed in the
318 current buffer. The width is measured by how many columns it
319 occupies on the screen. If PRECISION > 0, return the width of 306 occupies on the screen. If PRECISION > 0, return the width of
320 longest substring that doesn't exceed PRECISION, and set number of 307 longest substring that doesn't exceed PRECISION, and set number of
321 characters and bytes of the substring in *NCHARS and *NBYTES 308 characters and bytes of the substring in *NCHARS and *NBYTES
322 respectively. */ 309 respectively. */
323 310
311int
324c_string_width (str, len, precision, nchars, nbytes) 312c_string_width (str, len, precision, nchars, nbytes)
325 unsigned char *str; 313 unsigned char *str;
326 int precision, *nchars, *nbytes; 314 int precision, *nchars, *nbytes;
@@ -369,6 +357,18 @@ c_string_width (str, len, precision, nchars, nbytes)
369 return width; 357 return width;
370} 358}
371 359
360/* Return width of string STR of length LEN when displayed in the
361 current buffer. The width is measured by how many columns it
362 occupies on the screen. */
363
364int
365strwidth (str, len)
366 unsigned char *str;
367 int len;
368{
369 return c_string_width (str, len, -1, NULL, NULL);
370}
371
372/* Return width of Lisp string STRING when displayed in the current 372/* Return width of Lisp string STRING when displayed in the current
373 buffer. The width is measured by how many columns it occupies on 373 buffer. The width is measured by how many columns it occupies on
374 the screen while paying attention to compositions. If PRECISION > 374 the screen while paying attention to compositions. If PRECISION >
@@ -382,7 +382,6 @@ lisp_string_width (string, precision, nchars, nbytes)
382 int precision, *nchars, *nbytes; 382 int precision, *nchars, *nbytes;
383{ 383{
384 int len = XSTRING (string)->size; 384 int len = XSTRING (string)->size;
385 int len_byte = STRING_BYTES (XSTRING (string));
386 unsigned char *str = XSTRING (string)->data; 385 unsigned char *str = XSTRING (string)->data;
387 int i = 0, i_byte = 0; 386 int i = 0, i_byte = 0;
388 int width = 0; 387 int width = 0;
@@ -747,7 +746,6 @@ string_count_byte8 (string)
747 Lisp_Object string; 746 Lisp_Object string;
748{ 747{
749 int multibyte = STRING_MULTIBYTE (string); 748 int multibyte = STRING_MULTIBYTE (string);
750 int nchars = XSTRING (string)->size;
751 int nbytes = STRING_BYTES (XSTRING (string)); 749 int nbytes = STRING_BYTES (XSTRING (string));
752 unsigned char *p = XSTRING (string)->data; 750 unsigned char *p = XSTRING (string)->data;
753 unsigned char *pend = p + nbytes; 751 unsigned char *pend = p + nbytes;
@@ -815,7 +813,7 @@ string_escape_byte8 (string)
815 { 813 {
816 c = STRING_CHAR_ADVANCE (src); 814 c = STRING_CHAR_ADVANCE (src);
817 c = CHAR_TO_BYTE8 (c); 815 c = CHAR_TO_BYTE8 (c);
818 sprintf (dst, "\\%03o", c); 816 sprintf ((char *) dst, "\\%03o", c);
819 dst += 4; 817 dst += 4;
820 } 818 }
821 else 819 else
@@ -827,7 +825,7 @@ string_escape_byte8 (string)
827 c = *src++; 825 c = *src++;
828 if (c >= 0x80) 826 if (c >= 0x80)
829 { 827 {
830 sprintf (dst, "\\%03o", c); 828 sprintf ((char *) dst, "\\%03o", c);
831 dst += 4; 829 dst += 4;
832 } 830 }
833 else 831 else