/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
- Copyright (C) 1985, 86, 88, 93, 94, 95 Free Software Foundation, Inc.
+ Copyright (C) 1985,86,88,93,94,95,97, 1998 Free Software Foundation, Inc.
This file is part of GNU Emacs.
if (idxval < 0)
args_out_of_range (array, idx);
- if (idxval < CHAR_TABLE_SINGLE_BYTE_SLOTS)
+ if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
{
/* For ASCII and 8-bit European characters, the element is
stored in the top table. */
if (idxval < 0)
args_out_of_range (array, idx);
- if (idxval < CHAR_TABLE_SINGLE_BYTE_SLOTS)
+ if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
XCHAR_TABLE (array)->contents[idxval] = newelt;
else
{
}
else if (STRING_MULTIBYTE (array))
{
- Lisp_Object val;
+ Lisp_Object new_len;
int c, idxval_byte, actual_len;
+ unsigned char *p, *str;
if (idxval < 0 || idxval >= XSTRING (array)->size)
args_out_of_range (array, idx);
idxval_byte = string_char_to_byte (array, idxval);
+ p = &XSTRING (array)->data[idxval_byte];
- c = STRING_CHAR_AND_LENGTH (&XSTRING (array)->data[idxval_byte],
- XSTRING (array)->size_byte - idxval_byte,
- actual_len);
- if (actual_len != 1)
- error ("Attempt to store a multibyte character into a string");
+ actual_len
+ = MULTIBYTE_FORM_LENGTH (p, XSTRING (array)->size_byte - idxval_byte);
+ new_len = Fchar_bytes (newelt);
+ if (actual_len != XINT (new_len))
+ error ("Attempt to change byte length of a string");
- CHECK_NUMBER (newelt, 2);
- XSTRING (array)->data[idxval_byte] = XINT (newelt);
+ CHAR_STRING (XINT (newelt), p, str);
+ if (p != str)
+ bcopy (str, p, actual_len);
}
else
{
defsubr (&Snatnump);
defsubr (&Ssymbolp);
defsubr (&Sstringp);
+ defsubr (&Smultibyte_string_p);
defsubr (&Svectorp);
defsubr (&Schar_table_p);
defsubr (&Svector_or_char_table_p);