diff options
| author | Kenichi Handa | 2002-07-31 07:11:47 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2002-07-31 07:11:47 +0000 |
| commit | 88dad6e7cba24726c9cd5b1c247510ff27351ab9 (patch) | |
| tree | 9f33be63959fa47a901a3e30c9ff1d8eeaba695b /src | |
| parent | 11e68d6cda4d1705d3dabaf90b2a50ae3e86a7aa (diff) | |
| download | emacs-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.c | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -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 | |||
| 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. |
| @@ -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); |