changeset 88368:1b036641f108

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.
author Kenichi Handa <handa@m17n.org>
date Fri, 01 Mar 2002 01:25:08 +0000
parents bc14316e7ce2
children 8f5d9817e9d3
files src/data.c
diffstat 1 files changed, 5 insertions(+), 110 deletions(-) [+]
line wrap: on
line diff
--- a/src/data.c	Fri Mar 01 01:18:37 2002 +0000
+++ b/src/data.c	Fri Mar 01 01:25:08 2002 +0000
@@ -25,7 +25,7 @@
 #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 @@
     }
   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 @@
     }
   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))
     {