changeset 89031:5fd1f8a7e007

(set_canon, set_identity, shuffle): Simplified.
author Kenichi Handa <handa@m17n.org>
date Tue, 20 Aug 2002 11:23:38 +0000
parents 28c841bc7706
children d0f9990cefeb
files src/casetab.c
diffstat 1 files changed, 16 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/casetab.c	Tue Aug 20 11:13:34 2002 +0000
+++ b/src/casetab.c	Tue Aug 20 11:23:38 2002 +0000
@@ -186,6 +186,20 @@
   int from, to;
 
   if (NATNUMP (elt))
+    Fset_char_table_range (canon, range, Faref (case_table, Faref (up, elt)));
+}
+
+/* Set elements of char-table TABLE for characters in RANGE to
+   themselves.  This is done only when ELT is a character.  This is
+   called in map_char_table.  */
+
+static void
+set_identity (table, range, elt)
+     Lisp_Object table, range, elt;
+{
+  int from, to;
+
+  if (NATNUMP (elt))
     {
       if (CONSP (range))
 	{
@@ -196,36 +210,10 @@
 	from = to = XINT (range);
 
       for (; from <= to; from++)
-	{
-	  Lisp_Object val1, val2;
-
-	  val1 = Faref (up, elt);
-	  if (EQ (val1, Qt))
-	    val1 = elt;
-	  else if (! NATNUMP (val1))
-	    continue;
-	  val2 = Faref (case_table, val1);
-	  if (EQ (val2, Qt))
-	    val2 = val1;
-	  else if (! NATNUMP (val2))
-	    continue;
-	  Faset (canon, make_number (from), val2);
-	}
+	CHAR_TABLE_SET (table, from, make_number (from));
     }
 }
 
-/* Set elements of char-table TABLE for characters in RANGE to
-   themselves.  This is done only when ELT is a character.  This is
-   called in map_char_table.  */
-
-static void
-set_identity (table, range, elt)
-     Lisp_Object table, range, elt;
-{
-  if (EQ (elt, Qt) || NATNUMP (elt))
-    Fset_char_table_range (table, range, Qt);
-}
-
 /* Permute the elements of TABLE (which is initially an identity
    mapping) so that it has one cycle for each equivalence class
    induced by the translation table on which map_char_table is
@@ -239,7 +227,7 @@
 
   if (NATNUMP (elt))
     {
-      Lisp_Object tem;
+      Lisp_Object tem = Faref (table, elt);
 
       if (CONSP (range))
 	{
@@ -252,9 +240,6 @@
       for (; from <= to; from++)
 	if (from != XINT (elt))
 	  {
-	    tem = Faref (table, elt);
-	    if (EQ (tem, Qt))
-	      tem = elt;
 	    Faset (table, elt, make_number (from));
 	    Faset (table, make_number (from), tem);
 	  }