summaryrefslogtreecommitdiff
path: root/src/casetab.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2002-08-20 11:23:38 +0000
committerKenichi Handa <handa@m17n.org>2002-08-20 11:23:38 +0000
commit3fed3018d3c5a5366bbe714736d89760eca4cb2c (patch)
tree0125a307b69d8477ba4f3b0de3be1602601c61f5 /src/casetab.c
parent5464b4a741f6676e9a5e9c13de189b5416605a26 (diff)
downloademacs-3fed3018d3c5a5366bbe714736d89760eca4cb2c.tar.gz
(set_canon, set_identity, shuffle): Simplified.
Diffstat (limited to 'src/casetab.c')
-rw-r--r--src/casetab.c47
1 files changed, 16 insertions, 31 deletions
diff --git a/src/casetab.c b/src/casetab.c
index 1660b57241b..6abb1e2b096 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -186,6 +186,20 @@ set_canon (case_table, range, elt)
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 @@ set_canon (case_table, range, elt)
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 @@ shuffle (table, range, elt)
if (NATNUMP (elt))
{
- Lisp_Object tem;
+ Lisp_Object tem = Faref (table, elt);
if (CONSP (range))
{
@@ -252,9 +240,6 @@ shuffle (table, range, elt)
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);
}