/* Preamble for uniprop (Unicode character property) tables. See the
comment of "Unicode character property tables". */
-/* Purpose of uniprop tables. */
-static Lisp_Object Qchar_code_property_table;
-
/* Types of decoder and encoder functions for uniprop values. */
typedef Lisp_Object (*uniprop_decoder_t) (Lisp_Object, Lisp_Object);
typedef Lisp_Object (*uniprop_encoder_t) (Lisp_Object, Lisp_Object);
static Lisp_Object
make_sub_char_table (int depth, int min_char, Lisp_Object defalt)
{
- Lisp_Object table;
- int size = (PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents)
- + chartab_size[depth]);
-
- table = Fmake_vector (make_number (size), defalt);
- XSETPVECTYPE (XVECTOR (table), PVEC_SUB_CHAR_TABLE);
- XSUB_CHAR_TABLE (table)->depth = make_number (depth);
- XSUB_CHAR_TABLE (table)->min_char = make_number (min_char);
+ int i;
+ Lisp_Object table = make_uninit_sub_char_table (depth, min_char);
+ for (i = 0; i < chartab_size[depth]; i++)
+ XSUB_CHAR_TABLE (table)->contents[i] = defalt;
return table;
}
static Lisp_Object
copy_sub_char_table (Lisp_Object table)
{
- int depth = XINT (XSUB_CHAR_TABLE (table)->depth);
- int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char);
+ int depth = XSUB_CHAR_TABLE (table)->depth;
+ int min_char = XSUB_CHAR_TABLE (table)->min_char;
Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil);
int i;
sub_char_table_ref (Lisp_Object table, int c, bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- int depth = XINT (tbl->depth);
- int min_char = XINT (tbl->min_char);
Lisp_Object val;
- int idx = CHARTAB_IDX (c, depth, min_char);
+ int idx = CHARTAB_IDX (c, tbl->depth, tbl->min_char);
val = tbl->contents[idx];
if (is_uniprop && UNIPROP_COMPRESSED_FORM_P (val))
Lisp_Object defalt, bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- int depth = XINT (tbl->depth);
- int min_char = XINT (tbl->min_char);
+ int depth = tbl->depth, min_char = tbl->min_char;
int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx;
Lisp_Object val;
sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- int depth = XINT ((tbl)->depth);
- int min_char = XINT ((tbl)->min_char);
+ int depth = tbl->depth, min_char = tbl->min_char;
int i = CHARTAB_IDX (c, depth, min_char);
Lisp_Object sub;
bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- int depth = XINT ((tbl)->depth);
- int min_char = XINT ((tbl)->min_char);
+ int depth = tbl->depth, min_char = tbl->min_char;
int chars_in_block = chartab_chars[depth];
int i, c, lim = chartab_size[depth];
return value;
}
-/* Look up the element in TABLE at index CH, and return it as an
- integer. If the element is not a character, return CH itself. */
-
-int
-char_table_translate (Lisp_Object table, int ch)
-{
- Lisp_Object value;
- value = Faref (table, make_number (ch));
- if (! CHARACTERP (value))
- return ch;
- return XINT (value);
-}
-
static Lisp_Object
optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- int depth = XINT (tbl->depth);
+ int i, depth = tbl->depth;
Lisp_Object elt, this;
- int i;
bool optimizable;
elt = XSUB_CHAR_TABLE (table)->contents[0];
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- depth = XINT (tbl->depth);
- min_char = XINT (tbl->min_char);
+ depth = tbl->depth;
+ min_char = tbl->min_char;
max_char = min_char + chartab_chars[depth - 1] - 1;
}
else
unsigned from, unsigned to)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
- int depth = XINT (tbl->depth);
- int c, i;
+ int i, c = tbl->min_char, depth = tbl->depth;
if (depth < 3)
- for (i = 0, c = XINT (tbl->min_char); i < chartab_size[depth];
- i++, c += chartab_chars[depth])
+ for (i = 0; i < chartab_size[depth]; i++, c += chartab_chars[depth])
{
Lisp_Object this;
}
}
else
- for (i = 0, c = XINT (tbl->min_char); i < chartab_size[depth]; i++, c ++)
+ for (i = 0; i < chartab_size[depth]; i++, c++)
{
Lisp_Object this;
unsigned code;
uniprop_table_uncompress (Lisp_Object table, int idx)
{
Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[idx];
- int min_char = (XINT (XSUB_CHAR_TABLE (table)->min_char)
- + chartab_chars[2] * idx);
+ int min_char = XSUB_CHAR_TABLE (table)->min_char + chartab_chars[2] * idx;
Lisp_Object sub = make_sub_char_table (3, min_char, Qnil);
const unsigned char *p, *pend;
break;
value = make_number (i);
if (i == size)
- {
- Lisp_Object args[2];
-
- args[0] = XCHAR_TABLE (table)->extras[4];
- args[1] = Fmake_vector (make_number (1), value);
- set_char_table_extras (table, 4, Fvconcat (2, args));
- }
+ set_char_table_extras (table, 4, Fvconcat (2, ((Lisp_Object []) {
+ XCHAR_TABLE (table)->extras[4], Fmake_vector (make_number (1), value) })));
return make_number (i);
}
{
struct gcpro gcpro1;
GCPRO1 (val);
- result = Fload (concat2 (build_string ("international/"), table),
- Qt, Qt, Qt, Qt);
+ AUTO_STRING (intl, "international/");
+ result = Fload (concat2 (intl, table), Qt, Qt, Qt, Qt);
UNGCPRO;
if (NILP (result))
return Qnil;
void
syms_of_chartab (void)
{
+ /* Purpose of uniprop tables. */
DEFSYM (Qchar_code_property_table, "char-code-property-table");
defsubr (&Smake_char_table);