aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-08-18 11:02:54 +0000
committerRichard M. Stallman1998-08-18 11:02:54 +0000
commit1bcc15674cc6c8953f931d05fec68f52c7aa10e3 (patch)
treed2dfe81dd0f089a8604c7131517eda380c0d85bd /src
parent82f08756d23b6edb8a2aedcbc479b133a27070b8 (diff)
downloademacs-1bcc15674cc6c8953f931d05fec68f52c7aa10e3.tar.gz
emacs-1bcc15674cc6c8953f931d05fec68f52c7aa10e3.zip
(Fmultibyte_char_to_unibyte): New function.
(syms_of_charset): defsubr it.
Diffstat (limited to 'src')
-rw-r--r--src/charset.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/charset.c b/src/charset.c
index e43492a67ae..819045842b5 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -994,6 +994,26 @@ The conversion is done based on `nonascii-translation-table' (which see)\n\
994 return make_number (c); 994 return make_number (c);
995} 995}
996 996
997DEFUN ("multibyte-char-to-unibyte", Fmultibyte_char_to_unibyte,
998 Smultibyte_char_to_unibyte, 1, 1, 0,
999 "Convert the multibyte character CH to unibyte character.\n\
1000The conversion is done based on `nonascii-translation-table' (which see)\n\
1001 or `nonascii-insert-offset' (which see).")
1002 (ch)
1003 Lisp_Object ch;
1004{
1005 int c;
1006
1007 CHECK_NUMBER (ch, 0);
1008 c = XINT (ch);
1009 if (c < 0)
1010 error ("Invalid multibyte character: %d", c);
1011 c = multibyte_char_to_unibyte (c, Qnil);
1012 if (c < 0)
1013 error ("Can't convert to unibyte character: %d", XINT (ch));
1014 return make_number (c);
1015}
1016
997DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, 1017DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
998 "Return byte length of multi-byte form of CHAR.") 1018 "Return byte length of multi-byte form of CHAR.")
999 (ch) 1019 (ch)
@@ -1819,6 +1839,7 @@ syms_of_charset ()
1819 defsubr (&Siso_charset); 1839 defsubr (&Siso_charset);
1820 defsubr (&Schar_valid_p); 1840 defsubr (&Schar_valid_p);
1821 defsubr (&Sunibyte_char_to_multibyte); 1841 defsubr (&Sunibyte_char_to_multibyte);
1842 defsubr (&Smultibyte_char_to_unibyte);
1822 defsubr (&Schar_bytes); 1843 defsubr (&Schar_bytes);
1823 defsubr (&Schar_width); 1844 defsubr (&Schar_width);
1824 defsubr (&Sstring_width); 1845 defsubr (&Sstring_width);