Incorporate some decomposition information in ucd table
authorChristophe Rhodes <csr21@cantab.net>
Fri, 15 Mar 2013 21:44:31 +0000 (21:44 +0000)
committerChristophe Rhodes <csr21@cantab.net>
Sat, 18 May 2013 19:04:03 +0000 (20:04 +0100)
commitf41b718f89090d00e2625f103e29281061800729
treed9d6991d961c279593ebab5e5924035ec0026129
parent33179e55e91c2584641436a59aa18c13aee09da7
Incorporate some decomposition information in ucd table

Oh boy.  This one is quite intricate.  We have two bytes free in
the 8-byte entries for information about characters, so use one of
them to indicate if the character has a decomposition, and if so of
what kind it is.  Adapt the ucd.lisp tools-for-build code to
parse and preserve that information.

However, this causes there to be more than 256 distinct possible
classes of character known to the system: not a problem in principle,
but Teemu Kalvas' implementation of the double indirection depended on
having a one-byte index.  But since Unicode characters are limited to
21 bits, with a careful packing scheme we can in fact steal 3 more bits
for the index, at the cost of needing to do an extra memory reference
and some arithmetic to reconstruct the index.  (In the process, change
the endianness of the ucd.dat filesystem representation, because it's
easier that way).

But wait, there's more.  Before, there were only two kinds of
lower-case characters: those whose upper-case transformation
lowercase back to the original character, and those where there is
no round-trip.  (The former are cl:lower-case-p, the latter aren't).
This gave rise to straightforward implementations of lower-case-p
and friends; in the new world, where there are multiple different
kinds of lower-case characters (with various decomposition classes)
we need to adjust the implementations, still fairly straightforward,
of lower-case-p and related functions.

The extra information provided in the ucd table by this commit
is largely useless on its own; the next step is to incorporate
the actual decomposition data.  Stay tuned.
src/code/target-char.lisp
tools-for-build/ucd.lisp