up = Fmake_char_table (Qcase_table, Qnil);
map_char_table (set_identity, Qnil, table, up);
map_char_table (shuffle, Qnil, table, up);
- XCHAR_TABLE (table)->extras[0] = up;
+ char_table_set_extras (table, 0, up);
}
if (NILP (canon))
{
canon = Fmake_char_table (Qcase_table, Qnil);
- XCHAR_TABLE (table)->extras[1] = canon;
+ char_table_set_extras (table, 1, canon);
map_char_table (set_canon, Qnil, table, table);
}
eqv = Fmake_char_table (Qcase_table, Qnil);
map_char_table (set_identity, Qnil, canon, eqv);
map_char_table (shuffle, Qnil, canon, eqv);
- XCHAR_TABLE (table)->extras[2] = eqv;
+ char_table_set_extras (table, 2, eqv);
}
/* This is so set_image_of_range_1 in regex.c can find the EQV table. */
- XCHAR_TABLE (canon)->extras[2] = eqv;
+ char_table_set_extras (canon, 2, eqv);
if (standard)
{
down = Fmake_char_table (Qcase_table, Qnil);
Vascii_downcase_table = down;
- XCHAR_TABLE (down)->purpose = Qcase_table;
+ CSET (XCHAR_TABLE (down), purpose, Qcase_table);
for (i = 0; i < 128; i++)
{
CHAR_TABLE_SET (down, i, make_number (c));
}
- XCHAR_TABLE (down)->extras[1] = Fcopy_sequence (down);
+ char_table_set_extras (down, 1, Fcopy_sequence (down));
up = Fmake_char_table (Qcase_table, Qnil);
- XCHAR_TABLE (down)->extras[0] = up;
+ char_table_set_extras (down, 0, up);
for (i = 0; i < 128; i++)
{
CHAR_TABLE_SET (up, i, make_number (c));
}
- XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up);
+ char_table_set_extras (down, 2, Fcopy_sequence (up));
/* Fill in what isn't filled in. */
set_case_table (down, 1);
EMACS_UINT hash;
if (NILP (XCHAR_TABLE (table)->extras[1]))
- XCHAR_TABLE (table)->extras[1]
- = make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
- make_float (DEFAULT_REHASH_SIZE),
- make_float (DEFAULT_REHASH_THRESHOLD),
- Qnil, Qnil, Qnil);
+ char_table_set_extras
+ (table, 1,
+ make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
+ make_float (DEFAULT_REHASH_SIZE),
+ make_float (DEFAULT_REHASH_THRESHOLD),
+ Qnil, Qnil, Qnil));
h = XHASH_TABLE (XCHAR_TABLE (table)->extras[1]);
i = hash_lookup (h, category_set, &hash);
if (i >= 0)
table = copy_char_table (table);
if (! NILP (XCHAR_TABLE (table)->defalt))
- XCHAR_TABLE (table)->defalt
- = Fcopy_sequence (XCHAR_TABLE (table)->defalt);
- XCHAR_TABLE (table)->extras[0]
- = Fcopy_sequence (XCHAR_TABLE (table)->extras[0]);
+ CSET (XCHAR_TABLE (table), defalt,
+ Fcopy_sequence (XCHAR_TABLE (table)->defalt));
+ char_table_set_extras
+ (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0]));
map_char_table (copy_category_entry, Qnil, table, table);
return table;
int i;
val = Fmake_char_table (Qcategory_table, Qnil);
- XCHAR_TABLE (val)->defalt = MAKE_CATEGORY_SET;
+ CSET (XCHAR_TABLE (val), defalt, MAKE_CATEGORY_SET);
for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
- XCHAR_TABLE (val)->contents[i] = MAKE_CATEGORY_SET;
+ char_table_set_contents (val, i, MAKE_CATEGORY_SET);
Fset_char_table_extra_slot (val, make_number (0),
Fmake_vector (make_number (95), Qnil));
return val;
Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil);
/* Set a category set which contains nothing to the default. */
- XCHAR_TABLE (Vstandard_category_table)->defalt = MAKE_CATEGORY_SET;
+ CSET (XCHAR_TABLE (Vstandard_category_table), defalt, MAKE_CATEGORY_SET);
Fset_char_table_extra_slot (Vstandard_category_table, make_number (0),
Fmake_vector (make_number (95), Qnil));
}
size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras;
vector = Fmake_vector (make_number (size), init);
XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
- XCHAR_TABLE (vector)->parent = Qnil;
- XCHAR_TABLE (vector)->purpose = purpose;
+ CSET (XCHAR_TABLE (vector), parent, Qnil);
+ CSET (XCHAR_TABLE (vector), purpose, purpose);
XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
return vector;
}
{
val = XSUB_CHAR_TABLE (table)->contents[i];
if (SUB_CHAR_TABLE_P (val))
- XSUB_CHAR_TABLE (copy)->contents[i] = copy_sub_char_table (val);
+ sub_char_table_set_contents (copy, i, copy_sub_char_table (val));
else
- XSUB_CHAR_TABLE (copy)->contents[i] = val;
+ sub_char_table_set_contents (copy, i, val);
}
return copy;
copy = Fmake_vector (make_number (size), Qnil);
XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
- XCHAR_TABLE (copy)->defalt = XCHAR_TABLE (table)->defalt;
- XCHAR_TABLE (copy)->parent = XCHAR_TABLE (table)->parent;
- XCHAR_TABLE (copy)->purpose = XCHAR_TABLE (table)->purpose;
+ CSET (XCHAR_TABLE (copy), defalt, XCHAR_TABLE (table)->defalt);
+ CSET (XCHAR_TABLE (copy), parent, XCHAR_TABLE (table)->parent);
+ CSET (XCHAR_TABLE (copy), purpose, XCHAR_TABLE (table)->purpose);
for (i = 0; i < chartab_size[0]; i++)
- XCHAR_TABLE (copy)->contents[i]
- = (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
- ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i])
- : XCHAR_TABLE (table)->contents[i]);
- XCHAR_TABLE (copy)->ascii = char_table_ascii (copy);
+ char_table_set_contents
+ (copy, i,
+ (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
+ ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i])
+ : XCHAR_TABLE (table)->contents[i]));
+ CSET (XCHAR_TABLE (copy), ascii, char_table_ascii (copy));
size -= VECSIZE (struct Lisp_Char_Table) - 1;
for (i = 0; i < size; i++)
- XCHAR_TABLE (copy)->extras[i] = XCHAR_TABLE (table)->extras[i];
+ char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
XSETCHAR_TABLE (copy, XCHAR_TABLE (copy));
return copy;
Lisp_Object sub;
if (depth == 3)
- tbl->contents[i] = val;
+ sub_char_table_set_contents (table, i, val);
else
{
sub = tbl->contents[i];
sub = make_sub_char_table (depth + 1,
min_char + i * chartab_chars[depth],
sub);
- tbl->contents[i] = sub;
+ sub_char_table_set_contents (table, i, sub);
}
}
sub_char_table_set (sub, c, val, is_uniprop);
if (ASCII_CHAR_P (c)
&& SUB_CHAR_TABLE_P (tbl->ascii))
- {
- XSUB_CHAR_TABLE (tbl->ascii)->contents[c] = val;
- }
+ sub_char_table_set_contents (tbl->ascii, c, val);
else
{
int i = CHARTAB_IDX (c, 0, 0);
if (! SUB_CHAR_TABLE_P (sub))
{
sub = make_sub_char_table (1, i * chartab_chars[0], sub);
- tbl->contents[i] = sub;
+ char_table_set_contents (table, i, sub);
}
sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table));
if (ASCII_CHAR_P (c))
- tbl->ascii = char_table_ascii (table);
+ CSET (tbl, ascii, char_table_ascii (table));
}
return val;
}
if (c > to)
break;
if (from <= c && c + chars_in_block - 1 <= to)
- tbl->contents[i] = val;
+ sub_char_table_set_contents (table, i, val);
else
{
Lisp_Object sub = tbl->contents[i];
else
{
sub = make_sub_char_table (depth + 1, c, sub);
- tbl->contents[i] = sub;
+ sub_char_table_set_contents (table, i, sub);
}
}
sub_char_table_set_range (sub, from, to, val, is_uniprop);
if (c > to)
break;
if (from <= c && c + chartab_chars[0] - 1 <= to)
- tbl->contents[i] = val;
+ char_table_set_contents (table, i, val);
else
{
Lisp_Object sub = tbl->contents[i];
if (! SUB_CHAR_TABLE_P (sub))
{
sub = make_sub_char_table (1, i * chartab_chars[0], sub);
- tbl->contents[i] = sub;
+ char_table_set_contents (table, i, sub);
}
sub_char_table_set_range (sub, from, to, val, is_uniprop);
}
}
if (ASCII_CHAR_P (from))
- tbl->ascii = char_table_ascii (table);
+ CSET (tbl, ascii, char_table_ascii (table));
}
return val;
}
error ("Attempt to make a chartable be its own parent");
}
- XCHAR_TABLE (char_table)->parent = parent;
+ CSET (XCHAR_TABLE (char_table), parent, parent);
return parent;
}
|| XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
args_out_of_range (char_table, n);
- return XCHAR_TABLE (char_table)->extras[XINT (n)] = value;
+ char_table_set_extras (char_table, XINT (n), value);
+ return value;
}
\f
DEFUN ("char-table-range", Fchar_table_range, Schar_table_range,
{
int i;
- XCHAR_TABLE (char_table)->ascii = value;
+ CSET (XCHAR_TABLE (char_table), ascii, value);
for (i = 0; i < chartab_size[0]; i++)
- XCHAR_TABLE (char_table)->contents[i] = value;
+ char_table_set_contents (char_table, i, value);
}
else if (EQ (range, Qnil))
- XCHAR_TABLE (char_table)->defalt = value;
+ CSET (XCHAR_TABLE (char_table), defalt, value);
else if (CHARACTERP (range))
char_table_set (char_table, XINT (range), value);
else if (CONSP (range))
{
elt = XCHAR_TABLE (char_table)->contents[i];
if (SUB_CHAR_TABLE_P (elt))
- XCHAR_TABLE (char_table)->contents[i]
- = optimize_sub_char_table (elt, test);
+ char_table_set_contents
+ (char_table, i, optimize_sub_char_table (elt, test));
}
/* Reset the `ascii' cache, in case it got optimized away. */
- XCHAR_TABLE (char_table)->ascii = char_table_ascii (char_table);
+ CSET (XCHAR_TABLE (char_table), ascii, char_table_ascii (char_table));
return Qnil;
}
/* This is to get a value of FROM in PARENT
without checking the parent of PARENT. */
- XCHAR_TABLE (parent)->parent = Qnil;
+ CSET (XCHAR_TABLE (parent), parent, Qnil);
val = CHAR_TABLE_REF (parent, from);
- XCHAR_TABLE (parent)->parent = temp;
+ CSET (XCHAR_TABLE (parent), parent, temp);
XSETCDR (range, make_number (c - 1));
val = map_sub_char_table (c_function, function,
parent, arg, val, range,
temp = XCHAR_TABLE (parent)->parent;
/* This is to get a value of FROM in PARENT without checking the
parent of PARENT. */
- XCHAR_TABLE (parent)->parent = Qnil;
+ CSET (XCHAR_TABLE (parent), parent, Qnil);
val = CHAR_TABLE_REF (parent, from);
- XCHAR_TABLE (parent)->parent = temp;
+ CSET (XCHAR_TABLE (parent), parent, temp);
val = map_sub_char_table (c_function, function, parent, arg, val, range,
parent);
table = parent;
int min_char = (XINT (XSUB_CHAR_TABLE (table)->min_char)
+ chartab_chars[2] * idx);
Lisp_Object sub = make_sub_char_table (3, min_char, Qnil);
- struct Lisp_Sub_Char_Table *subtbl = XSUB_CHAR_TABLE (sub);
const unsigned char *p, *pend;
- XSUB_CHAR_TABLE (table)->contents[idx] = sub;
+ sub_char_table_set_contents (table, idx, sub);
p = SDATA (val), pend = p + SBYTES (val);
if (*p == 1)
{
while (p < pend && idx < chartab_chars[2])
{
int v = STRING_CHAR_ADVANCE (p);
- subtbl->contents[idx++] = v > 0 ? make_number (v) : Qnil;
+ sub_char_table_set_contents
+ (sub, idx++, v > 0 ? make_number (v) : Qnil);
}
}
else if (*p == 2)
}
}
while (count-- > 0)
- subtbl->contents[idx++] = make_number (v);
+ sub_char_table_set_contents (sub, idx++, make_number (v));
}
}
/* It seems that we don't need this function because C code won't need
args[0] = XCHAR_TABLE (table)->extras[4];
args[1] = Fmake_vector (make_number (1), value);
- XCHAR_TABLE (table)->extras[4] = Fvconcat (2, args);
+ char_table_set_extras (table, 4, Fvconcat (2, args));
}
return make_number (i);
}
: ! NILP (val))
return Qnil;
/* Prepare ASCII values in advance for CHAR_TABLE_REF. */
- XCHAR_TABLE (table)->ascii = char_table_ascii (table);
+ CSET (XCHAR_TABLE (table), ascii, char_table_ascii (table));
return table;
}