summaryrefslogtreecommitdiff
path: root/src/casetab.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-05-15 03:22:38 +0000
committerRichard M. Stallman <rms@gnu.org>1997-05-15 03:22:38 +0000
commit4edca269ccde1781aa4750d0b82f2c252b3fa5b7 (patch)
tree0574637390ccf3db5d19b0043a46b128f1710255 /src/casetab.c
parent55c4d99f912fc990cfb3bbff985aaa388f8fcd05 (diff)
downloademacs-4edca269ccde1781aa4750d0b82f2c252b3fa5b7.tar.gz
(compute_trt_identity): Use make_sub_char_table.
(compute_trt_identity, compute_trt_shuffle): Set up bytes[0] with the charset code. Check for a sub-char-table when deciding to recurse. Terminate the loop properly for a sub-char-table.
Diffstat (limited to 'src/casetab.c')
-rw-r--r--src/casetab.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/casetab.c b/src/casetab.c
index 4e901cc1cb4..adf871764f6 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -177,21 +177,21 @@ compute_trt_identity (bytes, depth, trt, inverse)
struct Lisp_Char_Table *trt, *inverse;
{
register int i;
+ int lim = (depth == 0 ? CHAR_TABLE_ORDINARY_SLOTS : SUB_CHAR_TABLE_ORDINARY_SLOTS);
- for (i = 0; i < CHAR_TABLE_ORDINARY_SLOTS; i++)
+ for (i = 0; i < lim; i++)
{
if (NATNUMP (trt->contents[i]))
{
bytes[depth] = i;
XSETFASTINT (inverse->contents[i],
(depth == 0 && i < CHAR_TABLE_SINGLE_BYTE_SLOTS ? i
- : MAKE_NON_ASCII_CHAR (bytes[0]-128,
- bytes[1], bytes[2])));
+ : MAKE_NON_ASCII_CHAR (bytes[0], bytes[1], bytes[2])));
}
- else if (CHAR_TABLE_P (trt->contents[i]))
+ else if (SUB_CHAR_TABLE_P (trt->contents[i]))
{
- bytes[depth] = i;
- inverse->contents[i] = Fmake_char_table (Qnil, Qnil);
+ bytes[depth] = i - 128;
+ inverse->contents[i] = make_sub_char_table (Qnil);
compute_trt_identity (bytes, depth + 1,
XCHAR_TABLE (trt->contents[i]),
XCHAR_TABLE (inverse->contents[i]));
@@ -210,14 +210,14 @@ compute_trt_shuffle (bytes, depth, ibase, trt, inverse)
{
register int i;
Lisp_Object j, tem, q;
+ int lim = (depth == 0 ? CHAR_TABLE_ORDINARY_SLOTS : SUB_CHAR_TABLE_ORDINARY_SLOTS);
- for (i = 0; i < CHAR_TABLE_SINGLE_BYTE_SLOTS; i++)
+ for (i = 0; i < lim; i++)
{
bytes[depth] = i;
XSETFASTINT (j,
(depth == 0 && i < CHAR_TABLE_SINGLE_BYTE_SLOTS ? i
- : MAKE_NON_ASCII_CHAR (bytes[0]-128,
- bytes[1], bytes[2])));
+ : MAKE_NON_ASCII_CHAR (bytes[0], bytes[1], bytes[2])));
q = trt->contents[i];
if (NATNUMP (q) && XFASTINT (q) != XFASTINT (j))
{
@@ -225,9 +225,9 @@ compute_trt_shuffle (bytes, depth, ibase, trt, inverse)
Faset (ibase, q, j);
Faset (ibase, j, tem);
}
- else if (CHAR_TABLE_P (q))
+ else if (SUB_CHAR_TABLE_P (q))
{
- bytes[depth] = i;
+ bytes[depth] = i - 128;
compute_trt_shuffle (bytes, depth + 1, ibase,
XCHAR_TABLE (trt->contents[i]),
XCHAR_TABLE (inverse->contents[i]));