diff options
author | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-02-27 17:46:27 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@veritas-vos-liberabit.com> | 2013-02-27 17:46:27 +0400 |
commit | 5d13979d853c5ad96e730c7e89a5a0f669f9dd27 (patch) | |
tree | b8975d788ad42854db5a70fc31d426e7a8e535b0 | |
parent | 58ab8540ec30d5f80c6be1ba84301c620769e8aa (diff) |
fix collation/normalization resource builder up to complete build.
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.
-rw-r--r-- | mcs/class/corlib/Mono.Globalization.Unicode/NormalizationTableUtil.cs | 4 | ||||
-rw-r--r-- | mcs/class/corlib/Mono.Globalization.Unicode/create-mscompat-collation-table.cs | 19 |
2 files changed, 17 insertions, 6 deletions
diff --git a/mcs/class/corlib/Mono.Globalization.Unicode/NormalizationTableUtil.cs b/mcs/class/corlib/Mono.Globalization.Unicode/NormalizationTableUtil.cs index cde020a41b9..651551dbd7f 100644 --- a/mcs/class/corlib/Mono.Globalization.Unicode/NormalizationTableUtil.cs +++ b/mcs/class/corlib/Mono.Globalization.Unicode/NormalizationTableUtil.cs @@ -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 [] { diff --git a/mcs/class/corlib/Mono.Globalization.Unicode/create-mscompat-collation-table.cs b/mcs/class/corlib/Mono.Globalization.Unicode/create-mscompat-collation-table.cs index 01ce2684c08..f54d79e2397 100644 --- a/mcs/class/corlib/Mono.Globalization.Unicode/create-mscompat-collation-table.cs +++ b/mcs/class/corlib/Mono.Globalization.Unicode/create-mscompat-collation-table.cs @@ -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; |