aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2002-07-31 07:11:47 +0000
committerKenichi Handa2002-07-31 07:11:47 +0000
commit88dad6e7cba24726c9cd5b1c247510ff27351ab9 (patch)
tree9f33be63959fa47a901a3e30c9ff1d8eeaba695b /src
parent11e68d6cda4d1705d3dabaf90b2a50ae3e86a7aa (diff)
downloademacs-88dad6e7cba24726c9cd5b1c247510ff27351ab9.tar.gz
emacs-88dad6e7cba24726c9cd5b1c247510ff27351ab9.zip
(Fstring_to_multibyte): New function.
(syms_of_fns): Declare Fstring_to_multibyte as Lisp subroutine.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/fns.c b/src/fns.c
index 9f2837943ad..0a1ce7d26da 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1055,6 +1055,40 @@ multibyte character of charset `eight-bit-control' or `eight-bit-graphic'. */)
1055 } 1055 }
1056 return string; 1056 return string;
1057} 1057}
1058
1059
1060DEFUN ("string-to-multibyte", Fstring_to_multibyte, Sstring_to_multibyte,
1061 1, 1, 0,
1062 doc: /* Return a multibyte string with the same individual chars as STRING.
1063If STRING is multibyte, the result is STRING itself.
1064Otherwise it is a newly created string, with no text properties.
1065
1066If STRING is unibyte and contains an 8-bit byte, it is converted to
1067the corresponding multibyte character of charset `eight-bit'. */)
1068 (string)
1069 Lisp_Object string;
1070{
1071 CHECK_STRING (string);
1072
1073 if (! STRING_MULTIBYTE (string))
1074 {
1075 Lisp_Object new_string;
1076 int nchars, nbytes;
1077
1078 nchars = XSTRING (string)->size;
1079 nbytes = parse_str_to_multibyte (XSTRING (string)->data,
1080 STRING_BYTES (XSTRING (string)));
1081 new_string = make_uninit_multibyte_string (nchars, nbytes);
1082 bcopy (XSTRING (string)->data, XSTRING (new_string)->data,
1083 STRING_BYTES (XSTRING (string)));
1084 if (nbytes != STRING_BYTES (XSTRING (string)))
1085 str_to_multibyte (XSTRING (new_string)->data, nbytes,
1086 STRING_BYTES (XSTRING (string)));
1087 string = new_string;
1088 XSTRING (string)->intervals = NULL_INTERVAL;
1089 }
1090 return string;
1091}
1058 1092
1059DEFUN ("copy-alist", Fcopy_alist, Scopy_alist, 1, 1, 0, 1093DEFUN ("copy-alist", Fcopy_alist, Scopy_alist, 1, 1, 0,
1060 doc: /* Return a copy of ALIST. 1094 doc: /* Return a copy of ALIST.
@@ -4898,6 +4932,7 @@ invoked by mouse clicks and mouse menu items. */);
4898 defsubr (&Sstring_make_unibyte); 4932 defsubr (&Sstring_make_unibyte);
4899 defsubr (&Sstring_as_multibyte); 4933 defsubr (&Sstring_as_multibyte);
4900 defsubr (&Sstring_as_unibyte); 4934 defsubr (&Sstring_as_unibyte);
4935 defsubr (&Sstring_to_multibyte);
4901 defsubr (&Scopy_alist); 4936 defsubr (&Scopy_alist);
4902 defsubr (&Ssubstring); 4937 defsubr (&Ssubstring);
4903 defsubr (&Snthcdr); 4938 defsubr (&Snthcdr);