emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Kenichi Handa
Subject: [Emacs-diffs] Changes to emacs/src/ccl.c
Date: Thu, 28 Feb 2002 20:14:09 -0500

Index: emacs/src/ccl.c
diff -c emacs/src/ccl.c:1.75 emacs/src/ccl.c:1.76
*** emacs/src/ccl.c:1.75        Mon Nov 12 02:28:40 2001
--- emacs/src/ccl.c     Wed Nov 28 02:25:03 2001
***************
*** 1076,1085 ****
  
            if (stack_idx >= 256
                || prog_id < 0
!               || prog_id >= XVECTOR (Vccl_program_table)->size
!               || (slot = XVECTOR (Vccl_program_table)->contents[prog_id],
!                   !VECTORP (slot))
!               || !VECTORP (XVECTOR (slot)->contents[1]))
              {
                if (stack_idx > 0)
                  {
--- 1076,1084 ----
  
            if (stack_idx >= 256
                || prog_id < 0
!               || prog_id >= ASIZE (Vccl_program_table)
!               || (slot = AREF (Vccl_program_table, prog_id), !VECTORP (slot))
!               || !VECTORP (AREF (slot, 1)))
              {
                if (stack_idx > 0)
                  {
***************
*** 1092,1098 ****
            ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
            ccl_prog_stack_struct[stack_idx].ic = ic;
            stack_idx++;
!           ccl_prog = XVECTOR (XVECTOR (slot)->contents[1])->contents;
            ic = CCL_HEADER_MAIN;
          }
          break;
--- 1091,1097 ----
            ccl_prog_stack_struct[stack_idx].ccl_prog = ccl_prog;
            ccl_prog_stack_struct[stack_idx].ic = ic;
            stack_idx++;
!           ccl_prog = XVECTOR (AREF (slot, 1))->contents;
            ic = CCL_HEADER_MAIN;
          }
          break;
***************
*** 1430,1449 ****
                for (;i < j;i++)
                  {
  
!                   size = XVECTOR (Vcode_conversion_map_vector)->size;
                    point = XINT (ccl_prog[ic++]);
                    if (point >= size) continue;
!                   map =
!                     XVECTOR (Vcode_conversion_map_vector)->contents[point];
  
                    /* Check map varidity.  */
                    if (!CONSP (map)) continue;
                    map = XCDR (map);
                    if (!VECTORP (map)) continue;
!                   size = XVECTOR (map)->size;
                    if (size <= 1) continue;
  
!                   content = XVECTOR (map)->contents[0];
  
                    /* check map type,
                       [STARTPOINT VAL1 VAL2 ...] or
--- 1429,1447 ----
                for (;i < j;i++)
                  {
  
!                   size = ASIZE (Vcode_conversion_map_vector);
                    point = XINT (ccl_prog[ic++]);
                    if (point >= size) continue;
!                   map = AREF (Vcode_conversion_map_vector, point);
  
                    /* Check map varidity.  */
                    if (!CONSP (map)) continue;
                    map = XCDR (map);
                    if (!VECTORP (map)) continue;
!                   size = ASIZE (map);
                    if (size <= 1) continue;
  
!                   content = AREF (map, 0);
  
                    /* check map type,
                       [STARTPOINT VAL1 VAL2 ...] or
***************
*** 1453,1466 ****
                        point = XUINT (content);
                        point = op - point + 1;
                        if (!((point >= 1) && (point < size))) continue;
!                       content = XVECTOR (map)->contents[point];
                      }
                    else if (EQ (content, Qt))
                      {
                        if (size != 4) continue;
!                       if ((op >= XUINT (XVECTOR (map)->contents[2]))
!                           && (op < XUINT (XVECTOR (map)->contents[3])))
!                         content = XVECTOR (map)->contents[1];
                        else
                          continue;
                      }
--- 1451,1464 ----
                        point = XUINT (content);
                        point = op - point + 1;
                        if (!((point >= 1) && (point < size))) continue;
!                       content = AREF (map, point);
                      }
                    else if (EQ (content, Qt))
                      {
                        if (size != 4) continue;
!                       if ((op >= XUINT (AREF (map, 2)))
!                           && (op < XUINT (AREF (map, 3))))
!                         content = AREF (map, 1);
                        else
                          continue;
                      }
***************
*** 1586,1592 ****
                        break;
                      }
                  }
!               map_vector_size = XVECTOR (Vcode_conversion_map_vector)->size;
                
                do {
                  for (;map_set_rest_length > 0;i++, ic++, 
map_set_rest_length--)
--- 1584,1590 ----
                        break;
                      }
                  }
!               map_vector_size = ASIZE (Vcode_conversion_map_vector);
                
                do {
                  for (;map_set_rest_length > 0;i++, ic++, 
map_set_rest_length--)
***************
*** 1607,1623 ****
                        }
  
                      if (point >= map_vector_size) continue;
!                     map = (XVECTOR (Vcode_conversion_map_vector)
!                            ->contents[point]);
  
                      /* Check map varidity.  */
                      if (!CONSP (map)) continue;
                      map = XCDR (map);
                      if (!VECTORP (map)) continue;
!                     size = XVECTOR (map)->size;
                      if (size <= 1) continue;
  
!                     content = XVECTOR (map)->contents[0];
  
                      /* check map type,
                         [STARTPOINT VAL1 VAL2 ...] or
--- 1605,1620 ----
                        }
  
                      if (point >= map_vector_size) continue;
!                     map = AREF (Vcode_conversion_map_vector, point);
  
                      /* Check map varidity.  */
                      if (!CONSP (map)) continue;
                      map = XCDR (map);
                      if (!VECTORP (map)) continue;
!                     size = ASIZE (map);
                      if (size <= 1) continue;
  
!                     content = AREF (map, 0);
  
                      /* check map type,
                         [STARTPOINT VAL1 VAL2 ...] or
***************
*** 1627,1640 ****
                          point = XUINT (content);
                          point = op - point + 1;
                          if (!((point >= 1) && (point < size))) continue;
!                         content = XVECTOR (map)->contents[point];
                        }
                      else if (EQ (content, Qt))
                        {
                          if (size != 4) continue;
!                         if ((op >= XUINT (XVECTOR (map)->contents[2])) &&
!                             (op < XUINT (XVECTOR (map)->contents[3])))
!                           content = XVECTOR (map)->contents[1];
                          else
                            continue;
                        }
--- 1624,1637 ----
                          point = XUINT (content);
                          point = op - point + 1;
                          if (!((point >= 1) && (point < size))) continue;
!                         content = AREF (map, point);
                        }
                      else if (EQ (content, Qt))
                        {
                          if (size != 4) continue;
!                         if ((op >= XUINT (AREF (map, 2))) &&
!                             (op < XUINT (AREF (map, 3))))
!                           content = AREF (map, 1);
                          else
                            continue;
                        }
***************
*** 1707,1718 ****
                int size, point;
                j = XINT (ccl_prog[ic++]); /* map_id */
                op = reg[rrr];
!               if (j >= XVECTOR (Vcode_conversion_map_vector)->size)
                  {
                    reg[RRR] = -1;
                    break;
                  }
!               map = XVECTOR (Vcode_conversion_map_vector)->contents[j];
                if (!CONSP (map))
                  {
                    reg[RRR] = -1;
--- 1704,1715 ----
                int size, point;
                j = XINT (ccl_prog[ic++]); /* map_id */
                op = reg[rrr];
!               if (j >= ASIZE (Vcode_conversion_map_vector))
                  {
                    reg[RRR] = -1;
                    break;
                  }
!               map = AREF (Vcode_conversion_map_vector, j);
                if (!CONSP (map))
                  {
                    reg[RRR] = -1;
***************
*** 1724,1731 ****
                    reg[RRR] = -1;
                    break;
                  }
!               size = XVECTOR (map)->size;
!               point = XUINT (XVECTOR (map)->contents[0]);
                point = op - point + 1;
                reg[RRR] = 0;
                if ((size <= 1) ||
--- 1721,1728 ----
                    reg[RRR] = -1;
                    break;
                  }
!               size = ASIZE (map);
!               point = XUINT (AREF (map, 0));
                point = op - point + 1;
                reg[RRR] = 0;
                if ((size <= 1) ||
***************
*** 1734,1740 ****
                else
                  {
                    reg[RRR] = 0;
!                   content = XVECTOR (map)->contents[point];
                    if (NILP (content))
                      reg[RRR] = -1;
                    else if (NUMBERP (content))
--- 1731,1737 ----
                else
                  {
                    reg[RRR] = 0;
!                   content = AREF (map, point);
                    if (NILP (content))
                      reg[RRR] = -1;
                    else if (NUMBERP (content))
***************
*** 1875,1885 ****
    Lisp_Object result, contents, val;
  
    result = ccl;
!   veclen = XVECTOR (result)->size;
  
    for (i = 0; i < veclen; i++)
      {
!       contents = XVECTOR (result)->contents[i];
        if (INTEGERP (contents))
        continue;
        else if (CONSP (contents)
--- 1872,1882 ----
    Lisp_Object result, contents, val;
  
    result = ccl;
!   veclen = ASIZE (result);
  
    for (i = 0; i < veclen; i++)
      {
!       contents = AREF (result, i);
        if (INTEGERP (contents))
        continue;
        else if (CONSP (contents)
***************
*** 1895,1901 ****
  
          val = Fget (XCAR (contents), XCDR (contents));
          if (NATNUMP (val))
!           XVECTOR (result)->contents[i] = val;
          else
            unresolved = 1;
          continue;
--- 1892,1898 ----
  
          val = Fget (XCAR (contents), XCDR (contents));
          if (NATNUMP (val))
!           AREF (result, i) = val;
          else
            unresolved = 1;
          continue;
***************
*** 1910,1926 ****
  
          val = Fget (contents, Qtranslation_table_id);
          if (NATNUMP (val))
!           XVECTOR (result)->contents[i] = val;
          else
            {
              val = Fget (contents, Qcode_conversion_map_id);
              if (NATNUMP (val))
!               XVECTOR (result)->contents[i] = val;
              else
                {
                  val = Fget (contents, Qccl_program_idx);
                  if (NATNUMP (val))
!                   XVECTOR (result)->contents[i] = val;
                  else
                    unresolved = 1;
                }
--- 1907,1923 ----
  
          val = Fget (contents, Qtranslation_table_id);
          if (NATNUMP (val))
!           AREF (result, i) = val;
          else
            {
              val = Fget (contents, Qcode_conversion_map_id);
              if (NATNUMP (val))
!               AREF (result, i) = val;
              else
                {
                  val = Fget (contents, Qccl_program_idx);
                  if (NATNUMP (val))
!                   AREF (result, i) = val;
                  else
                    unresolved = 1;
                }
***************
*** 1955,1976 ****
  
    val = Fget (ccl_prog, Qccl_program_idx);
    if (! NATNUMP (val)
!       || XINT (val) >= XVECTOR (Vccl_program_table)->size)
      return Qnil;
!   slot = XVECTOR (Vccl_program_table)->contents[XINT (val)];
    if (! VECTORP (slot)
!       || XVECTOR (slot)->size != 3
!       || ! VECTORP (XVECTOR (slot)->contents[1]))
      return Qnil;
!   if (NILP (XVECTOR (slot)->contents[2]))
      {
!       val = resolve_symbol_ccl_program (XVECTOR (slot)->contents[1]);
        if (! VECTORP (val))
        return Qnil;
!       XVECTOR (slot)->contents[1] = val;
!       XVECTOR (slot)->contents[2] = Qt;
      }
!   return XVECTOR (slot)->contents[1];
  }
  
  /* Setup fields of the structure pointed by CCL appropriately for the
--- 1952,1973 ----
  
    val = Fget (ccl_prog, Qccl_program_idx);
    if (! NATNUMP (val)
!       || XINT (val) >= ASIZE (Vccl_program_table))
      return Qnil;
!   slot = AREF (Vccl_program_table, XINT (val));
    if (! VECTORP (slot)
!       || ASIZE (slot) != 3
!       || ! VECTORP (AREF (slot, 1)))
      return Qnil;
!   if (NILP (AREF (slot, 2)))
      {
!       val = resolve_symbol_ccl_program (AREF (slot, 1));
        if (! VECTORP (val))
        return Qnil;
!       AREF (slot, 1) = val;
!       AREF (slot, 2) = Qt;
      }
!   return AREF (slot, 1);
  }
  
  /* Setup fields of the structure pointed by CCL appropriately for the
***************
*** 2031,2037 ****
  
    val = Fget (object, Qccl_program_idx);
    return ((! NATNUMP (val)
!          || XINT (val) >= XVECTOR (Vccl_program_table)->size)
          ? Qnil : Qt);
  }
  
--- 2028,2034 ----
  
    val = Fget (object, Qccl_program_idx);
    return ((! NATNUMP (val)
!          || XINT (val) >= ASIZE (Vccl_program_table))
          ? Qnil : Qt);
  }
  
***************
*** 2061,2072 ****
      error ("Invalid CCL program");
  
    CHECK_VECTOR (reg);
!   if (XVECTOR (reg)->size != 8)
      error ("Length of vector REGISTERS is not 8");
  
    for (i = 0; i < 8; i++)
!     ccl.reg[i] = (INTEGERP (XVECTOR (reg)->contents[i])
!                 ? XINT (XVECTOR (reg)->contents[i])
                  : 0);
  
    ccl_driver (&ccl, (unsigned char *)0, (unsigned char *)0, 0, 0, (int *)0);
--- 2058,2069 ----
      error ("Invalid CCL program");
  
    CHECK_VECTOR (reg);
!   if (ASIZE (reg) != 8)
      error ("Length of vector REGISTERS is not 8");
  
    for (i = 0; i < 8; i++)
!     ccl.reg[i] = (INTEGERP (AREF (reg, i))
!                 ? XINT (AREF (reg, i))
                  : 0);
  
    ccl_driver (&ccl, (unsigned char *)0, (unsigned char *)0, 0, 0, (int *)0);
***************
*** 2075,2081 ****
      error ("Error in CCL program at %dth code", ccl.ic);
  
    for (i = 0; i < 8; i++)
!     XSETINT (XVECTOR (reg)->contents[i], ccl.reg[i]);
    return Qnil;
  }
  
--- 2072,2078 ----
      error ("Error in CCL program at %dth code", ccl.ic);
  
    for (i = 0; i < 8; i++)
!     XSETINT (AREF (reg, i), ccl.reg[i]);
    return Qnil;
  }
  
***************
*** 2119,2125 ****
      error ("Invalid CCL program");
  
    CHECK_VECTOR (status);
!   if (XVECTOR (status)->size != 9)
      error ("Length of vector STATUS is not 9");
    CHECK_STRING (str);
  
--- 2116,2122 ----
      error ("Invalid CCL program");
  
    CHECK_VECTOR (status);
!   if (ASIZE (status) != 9)
      error ("Length of vector STATUS is not 9");
    CHECK_STRING (str);
  
***************
*** 2127,2140 ****
  
    for (i = 0; i < 8; i++)
      {
!       if (NILP (XVECTOR (status)->contents[i]))
!       XSETINT (XVECTOR (status)->contents[i], 0);
!       if (INTEGERP (XVECTOR (status)->contents[i]))
!       ccl.reg[i] = XINT (XVECTOR (status)->contents[i]);
      }
!   if (INTEGERP (XVECTOR (status)->contents[i]))
      {
!       i = XFASTINT (XVECTOR (status)->contents[8]);
        if (ccl.ic < i && i < ccl.size)
        ccl.ic = i;
      }
--- 2124,2137 ----
  
    for (i = 0; i < 8; i++)
      {
!       if (NILP (AREF (status, i)))
!       XSETINT (AREF (status, i), 0);
!       if (INTEGERP (AREF (status, i)))
!       ccl.reg[i] = XINT (AREF (status, i));
      }
!   if (INTEGERP (AREF (status, i)))
      {
!       i = XFASTINT (AREF (status, 8));
        if (ccl.ic < i && i < ccl.size)
        ccl.ic = i;
      }
***************
*** 2145,2152 ****
    produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
                         STRING_BYTES (XSTRING (str)), outbufsize, (int *) 0);
    for (i = 0; i < 8; i++)
!     XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]);
!   XSETINT (XVECTOR (status)->contents[8], ccl.ic);
    UNGCPRO;
  
    if (NILP (unibyte_p))
--- 2142,2149 ----
    produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
                         STRING_BYTES (XSTRING (str)), outbufsize, (int *) 0);
    for (i = 0; i < 8; i++)
!     XSET (AREF (status, i), Lisp_Int, ccl.reg[i]);
!   XSETINT (AREF (status, 8), ccl.ic);
    UNGCPRO;
  
    if (NILP (unibyte_p))
***************
*** 2178,2184 ****
       (name, ccl_prog)
       Lisp_Object name, ccl_prog;
  {
!   int len = XVECTOR (Vccl_program_table)->size;
    int idx;
    Lisp_Object resolved;
  
--- 2175,2181 ----
       (name, ccl_prog)
       Lisp_Object name, ccl_prog;
  {
!   int len = ASIZE (Vccl_program_table);
    int idx;
    Lisp_Object resolved;
  
***************
*** 2203,2218 ****
      {
        Lisp_Object slot;
  
!       slot = XVECTOR (Vccl_program_table)->contents[idx];
        if (!VECTORP (slot))
        /* This is the first unsed slot.  Register NAME here.  */
        break;
  
!       if (EQ (name, XVECTOR (slot)->contents[0]))
        {
          /* Update this slot.  */
!         XVECTOR (slot)->contents[1] = ccl_prog;
!         XVECTOR (slot)->contents[2] = resolved;
          return make_number (idx);
        }
      }
--- 2200,2215 ----
      {
        Lisp_Object slot;
  
!       slot = AREF (Vccl_program_table, idx);
        if (!VECTORP (slot))
        /* This is the first unsed slot.  Register NAME here.  */
        break;
  
!       if (EQ (name, AREF (slot, 0)))
        {
          /* Update this slot.  */
!         AREF (slot, 1) = ccl_prog;
!         AREF (slot, 2) = resolved;
          return make_number (idx);
        }
      }
***************
*** 2225,2232 ****
  
        new_table = Fmake_vector (make_number (len * 2), Qnil);
        for (j = 0; j < len; j++)
!       XVECTOR (new_table)->contents[j]
!         = XVECTOR (Vccl_program_table)->contents[j];
        Vccl_program_table = new_table;
      }
  
--- 2222,2229 ----
  
        new_table = Fmake_vector (make_number (len * 2), Qnil);
        for (j = 0; j < len; j++)
!       AREF (new_table, j)
!         = AREF (Vccl_program_table, j);
        Vccl_program_table = new_table;
      }
  
***************
*** 2234,2243 ****
      Lisp_Object elt;
  
      elt = Fmake_vector (make_number (3), Qnil);
!     XVECTOR (elt)->contents[0] = name;
!     XVECTOR (elt)->contents[1] = ccl_prog;
!     XVECTOR (elt)->contents[2] = resolved;
!     XVECTOR (Vccl_program_table)->contents[idx] = elt;
    }
  
    Fput (name, Qccl_program_idx, make_number (idx));
--- 2231,2240 ----
      Lisp_Object elt;
  
      elt = Fmake_vector (make_number (3), Qnil);
!     AREF (elt, 0) = name;
!     AREF (elt, 1) = ccl_prog;
!     AREF (elt, 2) = resolved;
!     AREF (Vccl_program_table, idx) = elt;
    }
  
    Fput (name, Qccl_program_idx, make_number (idx));
***************
*** 2261,2267 ****
       (symbol, map)
       Lisp_Object symbol, map;
  {
!   int len = XVECTOR (Vcode_conversion_map_vector)->size;
    int i;
    Lisp_Object index;
  
--- 2258,2264 ----
       (symbol, map)
       Lisp_Object symbol, map;
  {
!   int len = ASIZE (Vcode_conversion_map_vector);
    int i;
    Lisp_Object index;
  
***************
*** 2270,2276 ****
    
    for (i = 0; i < len; i++)
      {
!       Lisp_Object slot = XVECTOR (Vcode_conversion_map_vector)->contents[i];
  
        if (!CONSP (slot))
        break;
--- 2267,2273 ----
    
    for (i = 0; i < len; i++)
      {
!       Lisp_Object slot = AREF (Vcode_conversion_map_vector, i);
  
        if (!CONSP (slot))
        break;
***************
*** 2291,2305 ****
        int j;
  
        for (j = 0; j < len; j++)
!       XVECTOR (new_vector)->contents[j]
!         = XVECTOR (Vcode_conversion_map_vector)->contents[j];
        Vcode_conversion_map_vector = new_vector;
      }
  
    index = make_number (i);
    Fput (symbol, Qcode_conversion_map, map);
    Fput (symbol, Qcode_conversion_map_id, index);
!   XVECTOR (Vcode_conversion_map_vector)->contents[i] = Fcons (symbol, map);
    return index;
  }
  
--- 2288,2302 ----
        int j;
  
        for (j = 0; j < len; j++)
!       AREF (new_vector, j)
!         = AREF (Vcode_conversion_map_vector, j);
        Vcode_conversion_map_vector = new_vector;
      }
  
    index = make_number (i);
    Fput (symbol, Qcode_conversion_map, map);
    Fput (symbol, Qcode_conversion_map_id, index);
!   AREF (Vcode_conversion_map_vector, i) = Fcons (symbol, map);
    return index;
  }
  



reply via email to

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