comparison src/fns.c @ 88953:b18e038d980f

(Fstring_to_multibyte): New function. (syms_of_fns): Declare Fstring_to_multibyte as Lisp subroutine.
author Kenichi Handa <handa@m17n.org>
date Wed, 31 Jul 2002 07:11:47 +0000
parents d9795fd5a98f
children 90ed3c3cd1cc
comparison
equal deleted inserted replaced
88952:f74c5b0985f1 88953:b18e038d980f
1053 string = new_string; 1053 string = new_string;
1054 XSTRING (string)->intervals = NULL_INTERVAL; 1054 XSTRING (string)->intervals = NULL_INTERVAL;
1055 } 1055 }
1056 return string; 1056 return string;
1057 } 1057 }
1058
1059
1060 DEFUN ("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.
1063 If STRING is multibyte, the result is STRING itself.
1064 Otherwise it is a newly created string, with no text properties.
1065
1066 If STRING is unibyte and contains an 8-bit byte, it is converted to
1067 the 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
1059 DEFUN ("copy-alist", Fcopy_alist, Scopy_alist, 1, 1, 0, 1093 DEFUN ("copy-alist", Fcopy_alist, Scopy_alist, 1, 1, 0,
1060 doc: /* Return a copy of ALIST. 1094 doc: /* Return a copy of ALIST.
1061 This is an alist which represents the same mapping from objects to objects, 1095 This is an alist which represents the same mapping from objects to objects,
1062 but does not share the alist structure with ALIST. 1096 but does not share the alist structure with ALIST.
4896 defsubr (&Scopy_sequence); 4930 defsubr (&Scopy_sequence);
4897 defsubr (&Sstring_make_multibyte); 4931 defsubr (&Sstring_make_multibyte);
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);
4904 defsubr (&Snth); 4939 defsubr (&Snth);
4905 defsubr (&Selt); 4940 defsubr (&Selt);