Commit e6e1f521 authored by Kenichi Handa's avatar Kenichi Handa
Browse files

Include "character.h" instead of "charset.h".

(Faref): Call CHAR_TABLE_REF for a char table.
(Faset): Call CHAR_TABLE_SET for a char table.
parent 9f504898
......@@ -25,7 +25,7 @@ Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include "lisp.h"
#include "puresize.h"
#include "charset.h"
#include "character.h"
#include "buffer.h"
#include "keyboard.h"
#include "frame.h"
......@@ -1845,77 +1845,8 @@ or a byte-code object. IDX starts at 0. */)
}
else if (CHAR_TABLE_P (array))
{
Lisp_Object val;
val = Qnil;
if (idxval < 0)
args_out_of_range (array, idx);
if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
{
/* For ASCII and 8-bit European characters, the element is
stored in the top table. */
val = XCHAR_TABLE (array)->contents[idxval];
if (NILP (val))
val = XCHAR_TABLE (array)->defalt;
while (NILP (val)) /* Follow parents until we find some value. */
{
array = XCHAR_TABLE (array)->parent;
if (NILP (array))
return Qnil;
val = XCHAR_TABLE (array)->contents[idxval];
if (NILP (val))
val = XCHAR_TABLE (array)->defalt;
}
return val;
}
else
{
int code[4], i;
Lisp_Object sub_table;
SPLIT_CHAR (idxval, code[0], code[1], code[2]);
if (code[1] < 32) code[1] = -1;
else if (code[2] < 32) code[2] = -1;
/* Here, the possible range of CODE[0] (== charset ID) is
128..MAX_CHARSET. Since the top level char table contains
data for multibyte characters after 256th element, we must
increment CODE[0] by 128 to get a correct index. */
code[0] += 128;
code[3] = -1; /* anchor */
try_parent_char_table:
sub_table = array;
for (i = 0; code[i] >= 0; i++)
{
val = XCHAR_TABLE (sub_table)->contents[code[i]];
if (SUB_CHAR_TABLE_P (val))
sub_table = val;
else
{
if (NILP (val))
val = XCHAR_TABLE (sub_table)->defalt;
if (NILP (val))
{
array = XCHAR_TABLE (array)->parent;
if (!NILP (array))
goto try_parent_char_table;
}
return val;
}
}
/* Here, VAL is a sub char table. We try the default value
and parent. */
val = XCHAR_TABLE (val)->defalt;
if (NILP (val))
{
array = XCHAR_TABLE (array)->parent;
if (!NILP (array))
goto try_parent_char_table;
}
return val;
}
CHECK_CHARACTER (idx);
return CHAR_TABLE_REF (array, idxval);
}
else
{
......@@ -1978,44 +1909,8 @@ IDX starts at 0. */)
}
else if (CHAR_TABLE_P (array))
{
if (idxval < 0)
args_out_of_range (array, idx);
if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
XCHAR_TABLE (array)->contents[idxval] = newelt;
else
{
int code[4], i;
Lisp_Object val;
SPLIT_CHAR (idxval, code[0], code[1], code[2]);
if (code[1] < 32) code[1] = -1;
else if (code[2] < 32) code[2] = -1;
/* See the comment of the corresponding part in Faref. */
code[0] += 128;
code[3] = -1; /* anchor */
for (i = 0; code[i + 1] >= 0; i++)
{
val = XCHAR_TABLE (array)->contents[code[i]];
if (SUB_CHAR_TABLE_P (val))
array = val;
else
{
Lisp_Object temp;
/* VAL is a leaf. Create a sub char table with the
default value VAL or XCHAR_TABLE (array)->defalt
and look into it. */
temp = make_sub_char_table (NILP (val)
? XCHAR_TABLE (array)->defalt
: val);
XCHAR_TABLE (array)->contents[code[i]] = temp;
array = temp;
}
}
XCHAR_TABLE (array)->contents[code[i]] = newelt;
}
CHECK_CHARACTER (idx);
CHAR_TABLE_SET (array, idxval, newelt);
}
else if (STRING_MULTIBYTE (array))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment