summaryrefslogtreecommitdiff
path: root/src/casetab.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-04-17 23:02:52 +0000
committerRichard M. Stallman <rms@gnu.org>1994-04-17 23:02:52 +0000
commita85da0edd85a67628ad8251a77751fbd1048fc64 (patch)
tree4018f654acb28bc1f0f80c5579696abc7517393a /src/casetab.c
parentca6785de1c64c1ff3009e13aa30a65259d4d14a7 (diff)
downloademacs-a85da0edd85a67628ad8251a77751fbd1048fc64.tar.gz
(set_case_table): Handle nil for EQV with non-nil CANON.
(Fcase_table_p): Accept nil for EQV with non-nil CANON.
Diffstat (limited to 'src/casetab.c')
-rw-r--r--src/casetab.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/casetab.c b/src/casetab.c
index 5b99d44940f..5a225d4d600 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -47,7 +47,8 @@ See `set-case-table' for more information on these data structures.")
return (STRING256_P (down)
&& (NILP (up) || STRING256_P (up))
&& ((NILP (canon) && NILP (eqv))
- || (STRING256_P (canon) && STRING256_P (eqv)))
+ || (STRING256_P (canon)
+ && (NILP (eqv) || STRING256_P (eqv))))
? Qt : Qnil);
}
@@ -99,11 +100,11 @@ UPCASE maps each character to its upper-case equivalent;\n\
you may use nil and the upcase table will be deduced from DOWNCASE.\n\
CANONICALIZE maps each character to a canonical equivalent;\n\
any two characters that are related by case-conversion have the same\n\
- canonical equivalent character.\n\
+ canonical equivalent character; it may be nil, in which case it is\n\
+ deduced from DOWNCASE and UPCASE.\n\
EQUIVALENCES is a map that cyclicly permutes each equivalence class\n\
- (of characters with the same canonical equivalent).\n\
-Both CANONICALIZE and EQUIVALENCES may be nil, in which case\n\
- both are deduced from DOWNCASE and UPCASE.")
+ (of characters with the same canonical equivalent); it may be nil,\n\
+ in which case it is deduced from CANONICALIZE.")
(table)
Lisp_Object table;
{
@@ -146,13 +147,17 @@ set_case_table (table, standard)
unsigned char *downvec = XSTRING (down)->data;
canon = Fmake_string (make_number (256), make_number (0));
- eqv = Fmake_string (make_number (256), make_number (0));
/* Set up the CANON vector; for each character,
this sequence of upcasing and downcasing ought to
get the "preferred" lowercase equivalent. */
for (i = 0; i < 256; i++)
XSTRING (canon)->data[i] = downvec[upvec[downvec[i]]];
+ }
+
+ if (NILP (eqv))
+ {
+ eqv = Fmake_string (make_number (256), make_number (0));
compute_trt_inverse (XSTRING (canon)->data, XSTRING (eqv)->data);
}