1 1.1 lukem # 2 1.1.1.3 tron # Id: README,v 1.33 2001/01/02 18:46:19 mleisher Exp 3 1.1 lukem # 4 1.1 lukem 5 1.1 lukem MUTT UCData Package 2.5 6 1.1 lukem ----------------------- 7 1.1 lukem 8 1.1 lukem This is a package that supports ctype-like operations for Unicode UCS-2 text 9 1.1 lukem (and surrogates), case mapping, decomposition lookup, and provides a 10 1.1 lukem bidirectional reordering algorithm. To use it, you will need to get the 11 1.1 lukem latest "UnicodeData-*.txt" (or later) file from the Unicode Web or FTP site. 12 1.1 lukem 13 1.1 lukem The character information portion of the package consists of three parts: 14 1.1 lukem 15 1.1 lukem 1. A program called "ucgendat" which generates five data files from the 16 1.1 lukem UnicodeData-*.txt file. The files are: 17 1.1 lukem 18 1.1 lukem A. case.dat - the case mappings. 19 1.1 lukem B. ctype.dat - the character property tables. 20 1.1 lukem C. comp.dat - the character composition pairs. 21 1.1 lukem D. decomp.dat - the character decompositions. 22 1.1 lukem E. cmbcl.dat - the non-zero combining classes. 23 1.1 lukem F. num.dat - the codes representing numbers. 24 1.1 lukem 25 1.1 lukem 2. The "ucdata.[ch]" files which implement the functions needed to 26 1.1 lukem check to see if a character matches groups of properties, to map between 27 1.1 lukem upper, lower, and title case, to look up the decomposition of a 28 1.1 lukem character, look up the combining class of a character, and get the number 29 1.1 lukem value of a character. 30 1.1 lukem 31 1.1 lukem 3. The UCData.java class which provides the same API (with minor changes for 32 1.1 lukem the numbers) and loads the same binary data files as the C code. 33 1.1 lukem 34 1.1 lukem A short reference to the functions available is in the "api.txt" file. 35 1.1 lukem 36 1.1 lukem Techie Details 37 1.1 lukem ============== 38 1.1 lukem 39 1.1 lukem The "ucgendat" program parses files from the command line which are all in the 40 1.1 lukem Unicode Character Database (UCDB) format. An additional properties file, 41 1.1 lukem "MUTTUCData.txt", provides some extra properties for some characters. 42 1.1 lukem 43 1.1 lukem The program looks for the two character properties fields (2 and 4), the 44 1.1 lukem combining class field (3), the decomposition field (5), the numeric value 45 1.1 lukem field (8), and the case mapping fields (12, 13, and 14). The decompositions 46 1.1 lukem are recursively expanded before being written out. 47 1.1 lukem 48 1.1 lukem The decomposition table contains all the canonical decompositions. This means 49 1.1 lukem all decompositions that do not have tags such as "<compat>" or "<font>". 50 1.1 lukem 51 1.1 lukem The data is almost all stored as unsigned longs (32-bits assumed) and the 52 1.1 lukem routines that load the data take care of endian swaps when necessary. This 53 1.1 lukem also means that supplementary characters (>= 0x10000) can be placed in the 54 1.1 lukem data files the "ucgendat" program parses. 55 1.1 lukem 56 1.1 lukem The data is written as external files and broken into six parts so it can be 57 1.1 lukem selectively updated at runtime if necessary. 58 1.1 lukem 59 1.1 lukem The data files currently generated from the "ucgendat" program total about 56K 60 1.1 lukem in size all together. 61 1.1 lukem 62 1.1 lukem The format of the binary data files is documented in the "format.txt" file. 63 1.1 lukem 64 1.1 lukem ========================================================================== 65 1.1 lukem 66 1.1 lukem The "Pretty Good Bidi Algorithm" 67 1.1 lukem -------------------------------- 68 1.1 lukem 69 1.1 lukem This routine provides an alternative to the Unicode Bidi algorithm. The 70 1.1 lukem difference is that this version of the PGBA does not handle the explicit 71 1.1 lukem directional codes (LRE, RLE, LRO, RLO, PDF). It should now produce the same 72 1.1 lukem results as the Unicode BiDi algorithm for implicit reordering. Included are 73 1.1 lukem functions for doing cursor motion in both logical and visual order. 74 1.1 lukem 75 1.1 lukem This implementation is provided to demonstrate an effective alternate method 76 1.1 lukem for implicit reordering. To make this useful for an application, it probably 77 1.1 lukem needs some changes to the memory allocation and deallocation, as well as data 78 1.1 lukem structure additions for rendering. 79 1.1 lukem 80 1.1 lukem Mark Leisher <mleisher@crl.nmsu.edu> 81 1.1 lukem 19 November 1999 82 1.1 lukem 83 1.1 lukem ----------------------------------------------------------------------------- 84 1.1 lukem 85 1.1 lukem CHANGES 86 1.1 lukem ======= 87 1.1 lukem Version 2.5 88 1.1 lukem ----------- 89 1.1 lukem 1. Changed the number lookup to set the denominator to 1 in cases of digits. 90 1.1 lukem This restores functional compatibility with John Cowan's UCType package. 91 1.1 lukem 92 1.1 lukem 2. Added support for the AL property. 93 1.1 lukem 94 1.1 lukem 3. Modified load and reload functions to return error codes. 95 1.1 lukem 96 1.1 lukem Version 2.4 97 1.1 lukem ----------- 98 1.1 lukem 1. Improved some bidi algorithm documentation in the code. 99 1.1 lukem 100 1.1 lukem 2. Fixed a code mixup that produced a non-working version. 101 1.1 lukem 102 1.1 lukem Version 2.3 103 1.1 lukem ----------- 104 1.1 lukem 1. Fixed a misspelling in the ucpgba.h header file. 105 1.1 lukem 106 1.1 lukem 2. Fixed a bug which caused trailing weak non-digit sequences to be left out of 107 1.1 lukem the reordered string in the bidi algorithm. 108 1.1 lukem 109 1.1 lukem 3. Fixed a problem with weak sequences containing non-spacing marks in the 110 1.1 lukem bidi algorithm. 111 1.1 lukem 112 1.1 lukem 4. Fixed a problem with text runs of the opposite direction of the string 113 1.1 lukem surrounding a weak + neutral text run appearing in the wrong order in the 114 1.1 lukem bidi algorithm. 115 1.1 lukem 116 1.1 lukem 5. Added a default overall direction parameter to the reordering function for 117 1.1 lukem cases of strings with no strong directional characters in the bidi 118 1.1 lukem algorithm. 119 1.1 lukem 120 1.1 lukem 6. The bidi API documentation was improved. 121 1.1 lukem 122 1.1 lukem 7. Added a man page for the bidi API. 123 1.1 lukem 124 1.1 lukem Version 2.2 125 1.1 lukem ----------- 126 1.1 lukem 1. Fixed a problem with the bidi algorithm locating directional section 127 1.1 lukem boundaries. 128 1.1 lukem 129 1.1 lukem 2. Fixed a problem with the bidi algorithm starting the reordering correctly. 130 1.1 lukem 131 1.1 lukem 3. Fixed a problem with the bidi algorithm determining end boundaries for LTR 132 1.1 lukem segments. 133 1.1 lukem 134 1.1 lukem 4. Fixed a problem with the bidi algorithm reordering weak (digits and number 135 1.1 lukem separators) segments. 136 1.1 lukem 137 1.1 lukem 5. Added automatic switching of symmetrically paired characters when 138 1.1 lukem reversing RTL segments. 139 1.1 lukem 140 1.1 lukem 6. Added a missing symmetric character to the extra character properties in 141 1.1 lukem MUTTUCData.txt. 142 1.1 lukem 143 1.1 lukem 7. Added support for doing logical and visual cursor traversal. 144 1.1 lukem 145 1.1 lukem Version 2.1 146 1.1 lukem ----------- 147 1.1 lukem 1. Updated the ucgendat program to handle the Unicode 3.0 character database 148 1.1 lukem properties. The AL and BM bidi properties gets marked as strong RTL and 149 1.1 lukem Other Neutral, the NSM, LRE, RLE, PDF, LRO, and RLO controls all get marked 150 1.1 lukem as Other Neutral. 151 1.1 lukem 152 1.1 lukem 2. Fixed some problems with testing against signed values in the UCData.java 153 1.1 lukem code and some minor cleanup. 154 1.1 lukem 155 1.1 lukem 3. Added the "Pretty Good Bidi Algorithm." 156 1.1 lukem 157 1.1 lukem Version 2.0 158 1.1 lukem ----------- 159 1.1 lukem 1. Removed the old Java stuff for a new class that loads directly from the 160 1.1 lukem same data files as the C code does. 161 1.1 lukem 162 1.1 lukem 2. Fixed a problem with choosing the correct field when mapping case. 163 1.1 lukem 164 1.1 lukem 3. Adjust some search routines to start their search in the correct position. 165 1.1 lukem 166 1.1 lukem 4. Moved the copyright year to 1999. 167 1.1 lukem 168 1.1 lukem Version 1.9 169 1.1 lukem ----------- 170 1.1 lukem 1. Fixed a problem with an incorrect amount of storage being allocated for the 171 1.1 lukem combining class nodes. 172 1.1 lukem 173 1.1 lukem 2. Fixed an invalid initialization in the number code. 174 1.1 lukem 175 1.1 lukem 3. Changed the Java template file formatting a bit. 176 1.1 lukem 177 1.1 lukem 4. Added tables and function for getting decompositions in the Java class. 178 1.1 lukem 179 1.1 lukem Version 1.8 180 1.1 lukem ----------- 181 1.1 lukem 1. Fixed a problem with adding certain ranges. 182 1.1 lukem 183 1.1 lukem 2. Added two more macros for testing for identifiers. 184 1.1 lukem 185 1.1 lukem 3. Tested with the UnicodeData-2.1.5.txt file. 186 1.1 lukem 187 1.1 lukem Version 1.7 188 1.1 lukem ----------- 189 1.1 lukem 1. Fixed a problem with looking up decompositions in "ucgendat." 190 1.1 lukem 191 1.1 lukem Version 1.6 192 1.1 lukem ----------- 193 1.1 lukem 1. Added two new properties introduced with UnicodeData-2.1.4.txt. 194 1.1 lukem 195 1.1 lukem 2. Changed the "ucgendat.c" program a little to automatically align the 196 1.1 lukem property data on a 4-byte boundary when new properties are added. 197 1.1 lukem 198 1.1 lukem 3. Changed the "ucgendat.c" programs to only generate canonical 199 1.1 lukem decompositions. 200 1.1 lukem 201 1.1 lukem 4. Added two new macros ucisinitialpunct() and ucisfinalpunct() to check for 202 1.1 lukem initial and final punctuation characters. 203 1.1 lukem 204 1.1 lukem 5. Minor additions and changes to the documentation. 205 1.1 lukem 206 1.1 lukem Version 1.5 207 1.1 lukem ----------- 208 1.1 lukem 1. Changed all file open calls to include binary mode with "b" for DOS/WIN 209 1.1 lukem platforms. 210 1.1 lukem 211 1.1 lukem 2. Wrapped the unistd.h include so it won't be included when compiled under 212 1.1 lukem Win32. 213 1.1 lukem 214 1.1 lukem 3. Fixed a bad range check for hex digits in ucgendat.c. 215 1.1 lukem 216 1.1 lukem 4. Fixed a bad endian swap for combining classes. 217 1.1 lukem 218 1.1 lukem 5. Added code to make a number table and associated lookup functions. 219 1.1 lukem Functions added are ucnumber(), ucdigit(), and ucgetnumber(). The last 220 1.1 lukem function is to maintain compatibility with John Cowan's "uctype" package. 221 1.1 lukem 222 1.1 lukem Version 1.4 223 1.1 lukem ----------- 224 1.1 lukem 1. Fixed a bug with adding a range. 225 1.1 lukem 226 1.1 lukem 2. Fixed a bug with inserting a range in order. 227 1.1 lukem 228 1.1 lukem 3. Fixed incorrectly specified ucisdefined() and ucisundefined() macros. 229 1.1 lukem 230 1.1 lukem 4. Added the missing unload for the combining class data. 231 1.1 lukem 232 1.1 lukem 5. Fixed a bad macro placement in ucisweak(). 233 1.1 lukem 234 1.1 lukem Version 1.3 235 1.1 lukem ----------- 236 1.1 lukem 1. Bug with case mapping calculations fixed. 237 1.1 lukem 238 1.1 lukem 2. Bug with empty character property entries fixed. 239 1.1 lukem 240 1.1 lukem 3. Bug with incorrect type in the combining class lookup fixed. 241 1.1 lukem 242 1.1 lukem 4. Some corrections done to api.txt. 243 1.1 lukem 244 1.1 lukem 5. Bug in certain character property lookups fixed. 245 1.1 lukem 246 1.1 lukem 6. Added a character property table that records the defined characters. 247 1.1 lukem 248 1.1 lukem 7. Replaced ucisunknown() with ucisdefined() and ucisundefined(). 249 1.1 lukem 250 1.1 lukem Version 1.2 251 1.1 lukem ----------- 252 1.1 lukem 1. Added code to ucgendat to generate a combining class table. 253 1.1 lukem 254 1.1 lukem 2. Fixed an endian problem with the byte count of decompositions. 255 1.1 lukem 256 1.1 lukem 3. Fixed some minor problems in the "format.txt" file. 257 1.1 lukem 258 1.1 lukem 4. Removed some bogus "Ss" values from MUTTUCData.txt file. 259 1.1 lukem 260 1.1 lukem 5. Added API function to get combining class. 261 1.1 lukem 262 1.1 lukem 6. Changed the open mode to "rb" so binary data files will be opened correctly 263 1.1 lukem on DOS/WIN as well as other platforms. 264 1.1 lukem 265 1.1 lukem 7. Added the "api.txt" file. 266 1.1 lukem 267 1.1 lukem Version 1.1 268 1.1 lukem ----------- 269 1.1 lukem 1. Added ucisxdigit() which I overlooked. 270 1.1 lukem 271 1.1 lukem 2. Added UC_LT to the ucisalpha() macro which I overlooked. 272 1.1 lukem 273 1.1 lukem 3. Change uciscntrl() to include UC_CF. 274 1.1 lukem 275 1.1 lukem 4. Added ucisocntrl() and ucfntcntrl() macros. 276 1.1 lukem 277 1.1 lukem 5. Added a ucisblank() which I overlooked. 278 1.1 lukem 279 1.1 lukem 6. Added missing properties to ucissymbol() and ucisnumber(). 280 1.1 lukem 281 1.1 lukem 7. Added ucisgraph() and ucisprint(). 282 1.1 lukem 283 1.1 lukem 8. Changed the "Mr" property to "Sy" to mark this subset of mirroring 284 1.1 lukem characters as symmetric to avoid trampling the Unicode/ISO10646 sense of 285 1.1 lukem mirroring. 286 1.1 lukem 287 1.1 lukem 9. Added another property called "Ss" which includes control characters 288 1.1 lukem traditionally seen as spaces in the isspace() macro. 289 1.1 lukem 290 1.1 lukem 10. Added a bunch of macros to be API compatible with John Cowan's package. 291 1.1 lukem 292 1.1 lukem ACKNOWLEDGEMENTS 293 1.1 lukem ================ 294 1.1 lukem 295 1.1 lukem Thanks go to John Cowan <cowan@locke.ccil.org> for pointing out lots of 296 1.1 lukem missing things and giving me stuff, particularly a bunch of new macros. 297 1.1 lukem 298 1.1 lukem Thanks go to Bob Verbrugge <bob_verbrugge@nl.compuware.com> for pointing out 299 1.1 lukem various bugs. 300 1.1 lukem 301 1.1 lukem Thanks go to Christophe Pierret <cpierret@businessobjects.com> for pointing 302 1.1 lukem out that file modes need to have "b" for DOS/WIN machines, pointing out 303 1.1 lukem unistd.h is not a Win 32 header, and pointing out a problem with ucisalnum(). 304 1.1 lukem 305 1.1 lukem Thanks go to Kent Johnson <kent@pondview.mv.com> for finding a bug that caused 306 1.1 lukem incomplete decompositions to be generated by the "ucgendat" program. 307 1.1 lukem 308 1.1 lukem Thanks go to Valeriy E. Ushakov <uwe@ptc.spbu.ru> for spotting an allocation 309 1.1 lukem error and an initialization error. 310 1.1 lukem 311 1.1 lukem Thanks go to Stig Venaas <Stig.Venaas@uninett.no> for providing a patch to 312 1.1 lukem support return types on load and reload, and for major updates to handle 313 1.1 lukem canonical composition and decomposition. 314