static int
map_over_uint8_byte_table (Lisp_Uint8_Byte_Table *ct, Emchar ofs, int place,
- Lisp_Object ccs,
int (*fn) (struct chartab_range *range,
Lisp_Object val, void *arg),
void *arg)
c1 = c + unit;
for (; c < c1 && retval == 0; c++)
{
- if ( NILP (ccs) || charset_code_point (ccs, c) >= 0 )
- {
- rainj.ch = c;
- retval = (fn) (&rainj, UINT8_DECODE (ct->property[i]), arg);
- }
+ rainj.ch = c;
+ retval = (fn) (&rainj, UINT8_DECODE (ct->property[i]), arg);
}
}
else
static int
map_over_uint16_byte_table (Lisp_Uint16_Byte_Table *ct, Emchar ofs, int place,
- Lisp_Object ccs,
int (*fn) (struct chartab_range *range,
Lisp_Object val, void *arg),
void *arg)
c1 = c + unit;
for (; c < c1 && retval == 0; c++)
{
- if ( NILP (ccs) || charset_code_point (ccs, c) >= 0 )
- {
- rainj.ch = c;
- retval = (fn) (&rainj, UINT16_DECODE (ct->property[i]),
- arg);
- }
+ rainj.ch = c;
+ retval = (fn) (&rainj, UINT16_DECODE (ct->property[i]), arg);
}
}
else
static int
map_over_byte_table (Lisp_Byte_Table *ct, Emchar ofs, int place,
- Lisp_Object ccs,
int (*fn) (struct chartab_range *range,
Lisp_Object val, void *arg),
void *arg)
{
retval
= map_over_uint8_byte_table (XUINT8_BYTE_TABLE(v),
- c, place - 1, ccs, fn, arg);
+ c, place - 1, fn, arg);
c += unit;
}
else if (UINT16_BYTE_TABLE_P (v))
{
retval
= map_over_uint16_byte_table (XUINT16_BYTE_TABLE(v),
- c, place - 1, ccs, fn, arg);
+ c, place - 1, fn, arg);
c += unit;
}
else if (BYTE_TABLE_P (v))
{
retval = map_over_byte_table (XBYTE_TABLE(v),
- c, place - 1, ccs, fn, arg);
+ c, place - 1, fn, arg);
c += unit;
}
else if (!UNBOUNDP (v))
for (; c < c1 && retval == 0; c++)
{
- if ( NILP (ccs) || charset_code_point (ccs, c) >= 0 )
- {
- rainj.ch = c;
- retval = (fn) (&rainj, v, arg);
- }
+ rainj.ch = c;
+ retval = (fn) (&rainj, v, arg);
}
}
else
struct chartab_range range;
decode_char_table_range (character, &range);
- switch (range.type)
- {
- case CHARTAB_RANGE_ALL:
- cit->table = value;
- break;
- case CHARTAB_RANGE_DEFAULT:
- cit->default_value = value;
- break;
- case CHARTAB_RANGE_CHARSET:
- {
- Emchar c;
- Lisp_Object encoding_table = XCHARSET_ENCODING_TABLE (range.charset);
-
- if ( CHAR_TABLEP (encoding_table) )
- {
- for (c = 0; c < 1 << 24; c++)
- {
- if ( INTP (get_char_id_table (XCHAR_TABLE(encoding_table),
- c)) )
- put_char_id_table_0 (cit, c, value);
- }
- }
- else
- {
- for (c = 0; c < 1 << 24; c++)
- {
- if ( charset_code_point (range.charset, c) >= 0 )
- put_char_id_table_0 (cit, c, value);
- }
- }
- }
- break;
- case CHARTAB_RANGE_ROW:
- {
- int cell_min, cell_max, i;
-
- if (XCHARSET_DIMENSION (range.charset) < 2)
- signal_simple_error ("Charset in row vector must be multi-byte",
- range.charset);
- else
- {
- switch (XCHARSET_CHARS (range.charset))
- {
- case 94:
- cell_min = 33; cell_max = 126;
- break;
- case 96:
- cell_min = 32; cell_max = 127;
- break;
- case 128:
- cell_min = 0; cell_max = 127;
- break;
- case 256:
- cell_min = 0; cell_max = 255;
- break;
- default:
- abort ();
- }
- }
- if (XCHARSET_DIMENSION (range.charset) == 2)
- check_int_range (range.row, cell_min, cell_max);
- else if (XCHARSET_DIMENSION (range.charset) == 3)
- {
- check_int_range (range.row >> 8 , cell_min, cell_max);
- check_int_range (range.row & 0xFF, cell_min, cell_max);
- }
- else if (XCHARSET_DIMENSION (range.charset) == 4)
- {
- check_int_range ( range.row >> 16 , cell_min, cell_max);
- check_int_range ((range.row >> 8) & 0xFF, cell_min, cell_max);
- check_int_range ( range.row & 0xFF, cell_min, cell_max);
- }
- else
- abort ();
-
- for (i = cell_min; i <= cell_max; i++)
- {
- Emchar ch = DECODE_CHAR (range.charset, (range.row << 8) | i);
- if ( charset_code_point (range.charset, ch) >= 0 )
- put_char_id_table_0 (cit, ch, value);
- }
- }
- break;
- case CHARTAB_RANGE_CHAR:
- put_char_id_table_0 (cit, range.ch, value);
- break;
- }
+ put_char_table (cit, &range, value);
}
#endif /* MULE */
#endif /* not UTF2000 */
+#ifdef UTF2000
+struct map_char_table_for_charset_arg
+{
+ int (*fn) (struct chartab_range *range, Lisp_Object val, void *arg);
+ Lisp_Char_Table *ct;
+ void *arg;
+};
+
+static int
+map_char_table_for_charset_fun (struct chartab_range *range,
+ Lisp_Object val, void *arg)
+{
+ struct map_char_table_for_charset_arg *closure =
+ (struct map_char_table_for_charset_arg *) arg;
+ Lisp_Object ret;
+
+ switch (range->type)
+ {
+ case CHARTAB_RANGE_ALL:
+ break;
+
+ case CHARTAB_RANGE_DEFAULT:
+ break;
+
+ case CHARTAB_RANGE_CHARSET:
+ break;
+
+ case CHARTAB_RANGE_ROW:
+ break;
+
+ case CHARTAB_RANGE_CHAR:
+ ret = get_char_table (range->ch, closure->ct);
+ if (!UNBOUNDP (ret))
+ return (closure->fn) (range, ret, closure->arg);
+ break;
+
+ default:
+ abort ();
+ }
+
+ return 0;
+}
+#endif
+
/* Map FN (with client data ARG) over range RANGE in char table CT.
Mapping stops the first time FN returns non-zero, and that value
becomes the return value of map_char_table(). */
return retval;
}
if (UINT8_BYTE_TABLE_P (ct->table))
- return map_over_uint8_byte_table (XUINT8_BYTE_TABLE(ct->table), 0, 3,
- Qnil, fn, arg);
+ return map_over_uint8_byte_table (XUINT8_BYTE_TABLE(ct->table),
+ 0, 3, fn, arg);
else if (UINT16_BYTE_TABLE_P (ct->table))
- return map_over_uint16_byte_table (XUINT16_BYTE_TABLE(ct->table), 0, 3,
- Qnil, fn, arg);
+ return map_over_uint16_byte_table (XUINT16_BYTE_TABLE(ct->table),
+ 0, 3, fn, arg);
else if (BYTE_TABLE_P (ct->table))
- return map_over_byte_table (XBYTE_TABLE(ct->table), 0, 3,
- Qnil, fn, arg);
+ return map_over_byte_table (XBYTE_TABLE(ct->table),
+ 0, 3, fn, arg);
else if (!UNBOUNDP (ct->table))
#if 0
{
#ifdef MULE
case CHARTAB_RANGE_CHARSET:
#ifdef UTF2000
- if (UINT8_BYTE_TABLE_P (ct->table))
- return map_over_uint8_byte_table (XUINT8_BYTE_TABLE(ct->table), 0, 3,
- range->charset, fn, arg);
- else if (UINT16_BYTE_TABLE_P (ct->table))
- return map_over_uint16_byte_table (XUINT16_BYTE_TABLE(ct->table), 0, 3,
- range->charset, fn, arg);
- else if (BYTE_TABLE_P (ct->table))
- return map_over_byte_table (XBYTE_TABLE(ct->table), 0, 3,
- range->charset, fn, arg);
- else if (!UNBOUNDP (ct->table))
- {
-#if 0
- struct chartab_range rainj;
- int unit = 1 << 24;
- Emchar c = 0;
- Emchar c1 = c + unit;
- int retval;
-
- rainj.type = CHARTAB_RANGE_CHAR;
+ {
+ Lisp_Object encoding_table
+ = XCHARSET_ENCODING_TABLE (range->charset);
- for (retval = 0; c < c1 && retval == 0; c++)
- {
- if ( charset_code_point (range->charset, c) >= 0 )
- {
- rainj.ch = c;
- retval = (fn) (&rainj, ct->table, arg);
- }
- }
-#else
- return (fn) (range, ct->table, arg);
-#endif
- }
+ if (!NILP (encoding_table))
+ {
+ struct chartab_range rainj;
+ struct map_char_table_for_charset_arg mcarg;
+
+ mcarg.fn = fn;
+ mcarg.ct = ct;
+ mcarg.arg = arg;
+ rainj.type = CHARTAB_RANGE_ALL;
+ return map_char_table (XCHAR_TABLE(encoding_table),
+ &rainj,
+ &map_char_table_for_charset_fun,
+ &mcarg);
+ }
+ }
return 0;
#else
return map_over_other_charset (ct,
for (retval =0, i = cell_min; i <= cell_max && retval == 0; i++)
{
Emchar ch = DECODE_CHAR (range->charset, (range->row << 8) | i);
- Lisp_Object val
- = get_byte_table (get_byte_table
- (get_byte_table
- (get_byte_table
- (ct->table,
- (unsigned char)(ch >> 24)),
- (unsigned char) (ch >> 16)),
- (unsigned char) (ch >> 8)),
- (unsigned char) ch);
-
- if (!UNBOUNDP (val))
+
+ if ( charset_code_point (range->charset, ch) >= 0 )
{
+ Lisp_Object val
+ = get_byte_table (get_byte_table
+ (get_byte_table
+ (get_byte_table
+ (ct->table,
+ (unsigned char)(ch >> 24)),
+ (unsigned char) (ch >> 16)),
+ (unsigned char) (ch >> 8)),
+ (unsigned char) ch);
+
+ if (UNBOUNDP (val))
+ val = ct->default_value;
rainj.ch = ch;
retval = (fn) (&rainj, val, arg);
}