emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/data.c


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/data.c
Date: Wed, 20 Apr 2005 03:50:30 -0400

Index: emacs/src/data.c
diff -c emacs/src/data.c:1.249 emacs/src/data.c:1.250
*** emacs/src/data.c:1.249      Tue Feb 15 06:33:15 2005
--- emacs/src/data.c    Wed Apr 20 07:50:30 2005
***************
*** 1979,1988 ****
--- 1979,1998 ----
        args_out_of_range (array, idx);
        if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
        {
+         if (! SINGLE_BYTE_CHAR_P (idxval))
+           args_out_of_range (array, idx);
          /* For ASCII and 8-bit European characters, the element is
               stored in the top table.  */
          val = XCHAR_TABLE (array)->contents[idxval];
          if (NILP (val))
+           {
+             int default_slot
+               = (idxval < 0x80 ? CHAR_TABLE_DEFAULT_SLOT_ASCII
+                  : idxval < 0xA0 ? CHAR_TABLE_DEFAULT_SLOT_8_BIT_CONTROL
+                  : CHAR_TABLE_DEFAULT_SLOT_8_BIT_GRAPHIC);
+             val = XCHAR_TABLE (array)->contents[default_slot];
+           }
+         if (NILP (val))
            val = XCHAR_TABLE (array)->defalt;
          while (NILP (val))    /* Follow parents until we find some value.  */
            {
***************
*** 1999,2004 ****
--- 2009,2015 ----
        {
          int code[4], i;
          Lisp_Object sub_table;
+         Lisp_Object current_default;
  
          SPLIT_CHAR (idxval, code[0], code[1], code[2]);
          if (code[1] < 32) code[1] = -1;
***************
*** 2012,2027 ****
          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;
--- 2023,2043 ----
          code[3] = -1;         /* anchor */
  
        try_parent_char_table:
+         current_default = XCHAR_TABLE (array)->defalt;
          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;
!                 if (! NILP (XCHAR_TABLE (sub_table)->defalt))
!                   current_default = XCHAR_TABLE (sub_table)->defalt;
!               }
              else
                {
                  if (NILP (val))
!                   val = current_default;
                  if (NILP (val))
                    {
                      array = XCHAR_TABLE (array)->parent;
***************
*** 2031,2039 ****
                  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;
--- 2047,2058 ----
                  return val;
                }
            }
!         /* Reaching here means IDXVAL is a generic character in
!            which each character or a group has independent value.
!            Essentially it's nonsense to get a value for such a
!            generic character, but for backward compatibility, we try
!            the default value and parent.  */
!         val = current_default;
          if (NILP (val))
            {
              array = XCHAR_TABLE (array)->parent;
***************
*** 2102,2108 ****
        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;
--- 2121,2131 ----
        if (idxval < 0)
        args_out_of_range (array, idx);
        if (idxval < CHAR_TABLE_ORDINARY_SLOTS)
!       {
!         if (! SINGLE_BYTE_CHAR_P (idxval))
!           args_out_of_range (array, idx);
!         XCHAR_TABLE (array)->contents[idxval] = newelt;
!       }
        else
        {
          int code[4], i;
***************
*** 2125,2136 ****
                  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;
                }
--- 2148,2156 ----
                  Lisp_Object temp;
  
                  /* VAL is a leaf.  Create a sub char table with the
!                    initial value VAL and look into it.  */
  
!                 temp = make_sub_char_table (val);
                  XCHAR_TABLE (array)->contents[code[i]] = temp;
                  array = temp;
                }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]