comparison src/character.c @ 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 b74794d7f11a
children ba60bd18bc0b
comparison
equal deleted inserted replaced
90840:e8902bf405a5 90841:fa02baec53ff
929 } 929 }
930 930
931 return make_string_from_bytes ((char *) buf, n, p - buf); 931 return make_string_from_bytes ((char *) buf, n, p - buf);
932 } 932 }
933 933
934 DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
935 doc: /* Concatenate all the argument bytes and make the result a unibyte string. */)
936 (n, args)
937 int n;
938 Lisp_Object *args;
939 {
940 int i;
941 unsigned char *buf = (unsigned char *) alloca (n);
942 unsigned char *p = buf;
943 unsigned c;
944
945 for (i = 0; i < n; i++)
946 {
947 CHECK_NATNUM (args[i]);
948 c = XFASTINT (args[i]);
949 if (c >= 256)
950 args_out_of_range_3 (args[i], make_number (0), make_number (255));
951 *p++ = c;
952 }
953
954 return make_string_from_bytes ((char *) buf, n, p - buf);
955 }
956
934 void 957 void
935 init_character_once () 958 init_character_once ()
936 { 959 {
937 } 960 }
938 961
954 defsubr (&Schar_bytes); 977 defsubr (&Schar_bytes);
955 defsubr (&Schar_width); 978 defsubr (&Schar_width);
956 defsubr (&Sstring_width); 979 defsubr (&Sstring_width);
957 defsubr (&Schar_direction); 980 defsubr (&Schar_direction);
958 defsubr (&Sstring); 981 defsubr (&Sstring);
982 defsubr (&Sunibyte_string);
959 983
960 DEFVAR_LISP ("translation-table-vector", &Vtranslation_table_vector, 984 DEFVAR_LISP ("translation-table-vector", &Vtranslation_table_vector,
961 doc: /* 985 doc: /*
962 Vector recording all translation tables ever defined. 986 Vector recording all translation tables ever defined.
963 Each element is a pair (SYMBOL . TABLE) relating the table to the 987 Each element is a pair (SYMBOL . TABLE) relating the table to the