fix collation/normalization resource builder up to complete build.
authorAtsushi Eno <atsushieno@veritas-vos-liberabit.com>
Wed, 27 Feb 2013 13:46:27 +0000 (22:46 +0900)
committerAtsushi Eno <atsushieno@veritas-vos-liberabit.com>
Wed, 27 Feb 2013 13:46:27 +0000 (22:46 +0900)
Then there are some resource value differences that likely needs other
fixes. But since some people seem to have changed some tests "to match
.NET" that actually changed the behavior, it won't recover the working
state. The resource generator generates "almost compatible" resource,
but won't be perfect.

mcs/class/corlib/Mono.Globalization.Unicode/NormalizationTableUtil.cs
mcs/class/corlib/Mono.Globalization.Unicode/create-mscompat-collation-table.cs

index cde020a41b92ddf822b997c44ca1216c645a7c31..651551dbd7f8139187e5bd047cde9629ee4815a7 100644 (file)
@@ -16,12 +16,12 @@ namespace Mono.Globalization.Unicode
                {
                        int [] propStarts = new int [] {
                                0, 0x0910, 0x1B00, 0x2460, 0x2980,
-                               0x2C70, 0x2D60, 0x2E90, 0xA770, 0xF900,
+                               0x2C70, 0x2D60, 0x2E90, 0xA770, 0xA7F0, 0xF900,
 //                             0x1D100, 0x2f800, 0x2fa10
                                };
                        int [] propEnds = new int [] {
                                0x06E0, 0x1200, 0x2330, 0x2600, 0x2AE0,
-                               0x2C80, 0x2D70, 0x3400, 0xA780, 0x10000,
+                               0x2C80, 0x2D70, 0x3400, 0xA780, 0xA800, 0x10000,
 //                             0x1D800, 0x2f810, 0x2fa20
                                };
                        int [] mapStarts = new int [] {
index 01ce2684c087c77be2a65a4182d8ec4f5cc228c5..f54d79e23977476529565b06b7c85054b2b470f2 100644 (file)
@@ -1024,8 +1024,13 @@ sw.Close ();
                                        // be identical to the corresponding
                                        // ASCII latins.
                                        if (c != target && diacritical [cp] == 0) {
-                                               diacriticalOffset [c - 'A']++;
-                                               diacritical [cp] = (byte) (diacriticalOffset [c - 'A'] + 0x7C);
+                                               var diaidx = c - 'A';
+                                               if (diaidx < 0 || diaidx >= diacritical.Length)
+                                                       Console.Error.WriteLine ("!!!!! warning: unexpected LATIN character: {0:X}", cp);
+                                               else {
+                                                       diacriticalOffset [diaidx]++;
+                                                       diacritical [cp] = (byte) (diacriticalOffset [diaidx] + 0x7C);
+                                               }
                                        }
                                }
                        }
@@ -1577,7 +1582,8 @@ throw new Exception (String.Format ("Should not happen. weights are {0} while la
                        category = "chs";
                        arr = cjkCHS;
                        offset = 0;//char.MaxValue - arr.Length;
-                       doc.Load (zhXML);
+                       using (var xr = XmlReader.Create (zhXML, new XmlReaderSettings () { XmlResolver = null, ProhibitDtd = false }))
+                               doc.Load (xr);
                        s = doc.SelectSingleNode ("/ldml/collations/collation[@type='pinyin']/rules/pc").InnerText;
                        v = 0x8008;
                        foreach (char c in s) {
@@ -1675,7 +1681,8 @@ throw new Exception (String.Format ("Should not happen. weights are {0} while la
                        category = "ko";
                        arr = cjkKO;
                        offset = 0;//char.MaxValue - arr.Length;
-                       doc.Load (koXML);
+                       using (var xr = XmlReader.Create (koXML, new XmlReaderSettings () { XmlResolver = null, ProhibitDtd = false }))
+                               doc.Load (xr);
                        foreach (XmlElement reset in doc.SelectNodes ("/ldml/collations/collation/rules/reset")) {
                                XmlElement sc = (XmlElement) reset.NextSibling;
                                // compute "category" and "level 1" for the 
@@ -3381,6 +3388,10 @@ throw new Exception (String.Format ("Should not happen. weights are {0} while la
                                        length = 1;
                                }
 
+                               if (primaryChar >= map.Length) {
+                                       Console.Error.WriteLine ("!!!!! warning: unexpected primary char {0:X}", i);
+                                       continue;
+                               }
                                if (map [primaryChar].Level1 == 0)
                                        continue;