Commit 5a0fd72f authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(set_case_table): Handle nil for EQV with non-nil CANON.

(Fcase_table_p): Accept nil for EQV with non-nil CANON.
parent 762f2b92
...@@ -47,7 +47,8 @@ See `set-case-table' for more information on these data structures.") ...@@ -47,7 +47,8 @@ See `set-case-table' for more information on these data structures.")
return (STRING256_P (down) return (STRING256_P (down)
&& (NILP (up) || STRING256_P (up)) && (NILP (up) || STRING256_P (up))
&& ((NILP (canon) && NILP (eqv)) && ((NILP (canon) && NILP (eqv))
|| (STRING256_P (canon) && STRING256_P (eqv))) || (STRING256_P (canon)
&& (NILP (eqv) || STRING256_P (eqv))))
? Qt : Qnil); ? Qt : Qnil);
} }
...@@ -99,11 +100,11 @@ UPCASE maps each character to its upper-case equivalent;\n\ ...@@ -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\ you may use nil and the upcase table will be deduced from DOWNCASE.\n\
CANONICALIZE maps each character to a canonical equivalent;\n\ CANONICALIZE maps each character to a canonical equivalent;\n\
any two characters that are related by case-conversion have the same\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\ EQUIVALENCES is a map that cyclicly permutes each equivalence class\n\
(of characters with the same canonical equivalent).\n\ (of characters with the same canonical equivalent); it may be nil,\n\
Both CANONICALIZE and EQUIVALENCES may be nil, in which case\n\ in which case it is deduced from CANONICALIZE.")
both are deduced from DOWNCASE and UPCASE.")
(table) (table)
Lisp_Object table; Lisp_Object table;
{ {
...@@ -146,13 +147,17 @@ set_case_table (table, standard) ...@@ -146,13 +147,17 @@ set_case_table (table, standard)
unsigned char *downvec = XSTRING (down)->data; unsigned char *downvec = XSTRING (down)->data;
canon = Fmake_string (make_number (256), make_number (0)); 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, /* Set up the CANON vector; for each character,
this sequence of upcasing and downcasing ought to this sequence of upcasing and downcasing ought to
get the "preferred" lowercase equivalent. */ get the "preferred" lowercase equivalent. */
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
XSTRING (canon)->data[i] = downvec[upvec[downvec[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); compute_trt_inverse (XSTRING (canon)->data, XSTRING (eqv)->data);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment