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
commit405b0b5ad1109e65b080ba0a5c4bc109d902070b (patch)
tree18874f88ee4b1002c28948c8e06fb8417f7baa78 /src/casetab.c
parent790ac1c79d7e2652b17efdd0d22d0e25af02871d (diff)
downloademacs-405b0b5ad1109e65b080ba0a5c4bc109d902070b.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);
}