aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2002-08-20 11:23:38 +0000
committerKenichi Handa2002-08-20 11:23:38 +0000
commit405b0b5ad1109e65b080ba0a5c4bc109d902070b (patch)
tree18874f88ee4b1002c28948c8e06fb8417f7baa78 /src
parent790ac1c79d7e2652b17efdd0d22d0e25af02871d (diff)
downloademacs-405b0b5ad1109e65b080ba0a5c4bc109d902070b.tar.gz
emacs-405b0b5ad1109e65b080ba0a5c4bc109d902070b.zip
(set_canon, set_identity, shuffle): Simplified.
Diffstat (limited to 'src')
-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)
186 int from, to; 186 int from, to;
187 187
188 if (NATNUMP (elt)) 188 if (NATNUMP (elt))
189 Fset_char_table_range (canon, range, Faref (case_table, Faref (up, elt)));
190}
191
192/* Set elements of char-table TABLE for characters in RANGE to
193 themselves. This is done only when ELT is a character. This is
194 called in map_char_table. */
195
196static void
197set_identity (table, range, elt)
198 Lisp_Object table, range, elt;
199{
200 int from, to;
201
202 if (NATNUMP (elt))
189 { 203 {
190 if (CONSP (range)) 204 if (CONSP (range))
191 { 205 {
@@ -196,36 +210,10 @@ set_canon (case_table, range, elt)
196 from = to = XINT (range); 210 from = to = XINT (range);
197 211
198 for (; from <= to; from++) 212 for (; from <= to; from++)
199 { 213 CHAR_TABLE_SET (table, from, make_number (from));
200 Lisp_Object val1, val2;
201
202 val1 = Faref (up, elt);
203 if (EQ (val1, Qt))
204 val1 = elt;
205 else if (! NATNUMP (val1))
206 continue;
207 val2 = Faref (case_table, val1);
208 if (EQ (val2, Qt))
209 val2 = val1;
210 else if (! NATNUMP (val2))
211 continue;
212 Faset (canon, make_number (from), val2);
213 }
214 } 214 }
215} 215}
216 216
217/* Set elements of char-table TABLE for characters in RANGE to
218 themselves. This is done only when ELT is a character. This is
219 called in map_char_table. */
220
221static void
222set_identity (table, range, elt)
223 Lisp_Object table, range, elt;
224{
225 if (EQ (elt, Qt) || NATNUMP (elt))
226 Fset_char_table_range (table, range, Qt);
227}
228
229/* Permute the elements of TABLE (which is initially an identity 217/* Permute the elements of TABLE (which is initially an identity
230 mapping) so that it has one cycle for each equivalence class 218 mapping) so that it has one cycle for each equivalence class
231 induced by the translation table on which map_char_table is 219 induced by the translation table on which map_char_table is
@@ -239,7 +227,7 @@ shuffle (table, range, elt)
239 227
240 if (NATNUMP (elt)) 228 if (NATNUMP (elt))
241 { 229 {
242 Lisp_Object tem; 230 Lisp_Object tem = Faref (table, elt);
243 231
244 if (CONSP (range)) 232 if (CONSP (range))
245 { 233 {
@@ -252,9 +240,6 @@ shuffle (table, range, elt)
252 for (; from <= to; from++) 240 for (; from <= to; from++)
253 if (from != XINT (elt)) 241 if (from != XINT (elt))
254 { 242 {
255 tem = Faref (table, elt);
256 if (EQ (tem, Qt))
257 tem = elt;
258 Faset (table, elt, make_number (from)); 243 Faset (table, elt, make_number (from));
259 Faset (table, make_number (from), tem); 244 Faset (table, make_number (from), tem);
260 } 245 }