Mercurial > emacs
changeset 90841:fa02baec53ff
(Funibyte_string): New function.
(syms_of_character): Defsubr it.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 14 May 2007 11:55:50 +0000 |
parents | e8902bf405a5 |
children | e8254e8eb079 |
files | src/character.c |
diffstat | 1 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/character.c Sun May 13 21:33:57 2007 +0000 +++ b/src/character.c Mon May 14 11:55:50 2007 +0000 @@ -931,6 +931,29 @@ return make_string_from_bytes ((char *) buf, n, p - buf); } +DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0, + doc: /* Concatenate all the argument bytes and make the result a unibyte string. */) + (n, args) + int n; + Lisp_Object *args; +{ + int i; + unsigned char *buf = (unsigned char *) alloca (n); + unsigned char *p = buf; + unsigned c; + + for (i = 0; i < n; i++) + { + CHECK_NATNUM (args[i]); + c = XFASTINT (args[i]); + if (c >= 256) + args_out_of_range_3 (args[i], make_number (0), make_number (255)); + *p++ = c; + } + + return make_string_from_bytes ((char *) buf, n, p - buf); +} + void init_character_once () { @@ -956,6 +979,7 @@ defsubr (&Sstring_width); defsubr (&Schar_direction); defsubr (&Sstring); + defsubr (&Sunibyte_string); DEFVAR_LISP ("translation-table-vector", &Vtranslation_table_vector, doc: /*