aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa1998-08-28 12:22:39 +0000
committerKenichi Handa1998-08-28 12:22:39 +0000
commit9b6a601f87535e51228a8febf2d0a37752ac3feb (patch)
tree8870b1b0b7b1a7b4f389b284172b998dd08f26b5 /src
parent3124bc0ed3b0182f1c339dc0fe85a79f2474415a (diff)
downloademacs-9b6a601f87535e51228a8febf2d0a37752ac3feb.tar.gz
emacs-9b6a601f87535e51228a8febf2d0a37752ac3feb.zip
(Fchar_bytes): Now always return 1.
(char_bytes): New function.
Diffstat (limited to 'src')
-rw-r--r--src/charset.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/charset.c b/src/charset.c
index 819045842b5..5bb3f6ee901 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1015,29 +1015,39 @@ The conversion is done based on `nonascii-translation-table' (which see)\n\
1015} 1015}
1016 1016
1017DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, 1017DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
1018 "Return byte length of multi-byte form of CHAR.") 1018 "Return 1 regardless of the argument CHAR.
1019This is now an obsolte function. We keep is just for backward compatibility.")
1019 (ch) 1020 (ch)
1020 Lisp_Object ch; 1021 Lisp_Object ch;
1021{ 1022{
1022 Lisp_Object val; 1023 Lisp_Object val;
1023 int bytes;
1024 1024
1025 CHECK_NUMBER (ch, 0); 1025 CHECK_NUMBER (ch, 0);
1026 if (COMPOSITE_CHAR_P (XFASTINT (ch))) 1026 return make_number (1);
1027}
1028
1029/* Return how many bytes C will occupy in a multibyte buffer.
1030 Don't call this function directly, instead use macro CHAR_BYTES. */
1031int
1032char_bytes (c)
1033 int c;
1034{
1035 int bytes;
1036
1037 if (COMPOSITE_CHAR_P (c))
1027 { 1038 {
1028 unsigned int id = COMPOSITE_CHAR_ID (XFASTINT (ch)); 1039 unsigned int id = COMPOSITE_CHAR_ID (c);
1029 1040
1030 bytes = (id < n_cmpchars ? cmpchar_table[id]->len : 1); 1041 bytes = (id < n_cmpchars ? cmpchar_table[id]->len : 1);
1031 } 1042 }
1032 else 1043 else
1033 { 1044 {
1034 int charset = CHAR_CHARSET (XFASTINT (ch)); 1045 int charset = CHAR_CHARSET (c);
1035 1046
1036 bytes = CHARSET_DEFINED_P (charset) ? CHARSET_BYTES (charset) : 1; 1047 bytes = CHARSET_DEFINED_P (charset) ? CHARSET_BYTES (charset) : 1;
1037 } 1048 }
1038 1049
1039 XSETFASTINT (val, bytes); 1050 return make_number (bytes);
1040 return val;
1041} 1051}
1042 1052
1043/* Return the width of character of which multi-byte form starts with 1053/* Return the width of character of which multi-byte form starts with