1 Index: corlib.dll.sources
2 ===================================================================
3 --- corlib.dll.sources (revision 47603)
4 +++ corlib.dll.sources (working copy)
6 Microsoft.Win32/Win32RegistryApi.cs
7 Microsoft.Win32/Win32ResultCode.cs
8 Microsoft.Win32.SafeHandles/SafeFileHandle.cs
9 +Mono.Globalization.Unicode/CodePointIndexer.cs
10 +Mono.Globalization.Unicode/MSCompatUnicodeTable.cs
11 +Mono.Globalization.Unicode/MSCompatUnicodeTableUtil.cs
12 +Mono.Globalization.Unicode/SimpleCollator.cs
13 +Mono.Globalization.Unicode/SortKey.cs
14 +Mono.Globalization.Unicode/SortKeyBuffer.cs
16 Mono.Math/BigInteger.cs
17 Mono.Math.Prime/ConfidenceFactor.cs
19 System.Globalization/NumberFormatInfo.cs
20 System.Globalization/NumberStyles.cs
21 System.Globalization/RegionInfo.cs
22 -System.Globalization/SortKey.cs
23 System.Globalization/StringInfo.cs
24 System.Globalization/TaiwanCalendar.cs
25 System.Globalization/TextElementEnumerator.cs
27 ===================================================================
28 --- Makefile (revision 47603)
29 +++ Makefile (working copy)
31 include ../../build/rules.make
32 export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib
36 + collation.core.bin \
37 + collation.tailoring.bin \
38 + collation.cjkCHS.bin \
39 + collation.cjkCHT.bin \
40 + collation.cjkJA.bin \
41 + collation.cjkKO.bin \
42 + collation.cjkKOlv2.bin
44 # corlib is crazy to build so we skip build/library.make and do stuff
47 # Here, we define a bunch of variables.
49 corlib_flags = /unsafe /nostdlib
50 -LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 /nowarn:414 -nowarn:612 -nowarn:618 -d:INSIDE_CORLIB
51 +LOCAL_MCS_FLAGS = /nowarn:649 /nowarn:169 /nowarn:414 -nowarn:612 -nowarn:618 -d:INSIDE_CORLIB \
52 + $(RESOURCE_FILES:%=/resource:%)
55 LIBRARY_NAME = mscorlib.dll
56 Index: System/String.cs
57 ===================================================================
58 --- System/String.cs (revision 47603)
59 +++ System/String.cs (working copy)
61 if (this.length < value.length)
64 - return (0 == Compare (this, 0, value, 0 , value.length));
65 + return CultureInfo.CurrentCulture.CompareInfo.IsPrefix (this, value);
68 /* This method is culture insensitive */
69 Index: System.Globalization/CompareInfo.cs
70 ===================================================================
71 --- System.Globalization/CompareInfo.cs (revision 47603)
72 +++ System.Globalization/CompareInfo.cs (working copy)
74 using System.Reflection;
75 using System.Runtime.Serialization;
76 using System.Runtime.CompilerServices;
77 +using Mono.Globalization.Unicode;
79 namespace System.Globalization
82 public class CompareInfo : IDeserializationCallback
84 + static readonly bool useManagedCollation =
85 + Environment.GetEnvironmentVariable ("MONO_USE_MANAGED_COLLATION")
88 + public static bool UseManagedCollation {
89 + get { return useManagedCollation && MSCompatUnicodeTable.IsReady; }
92 // Keep in synch with MonoCompareInfo in the runtime.
97 private IntPtr ICU_collator;
98 private int win32LCID; // Unused, but MS.NET serializes this
101 + SimpleCollator collator;
103 /* Hide the .ctor() */
106 internal CompareInfo (CultureInfo ci)
108 this.culture = ci.LCID;
109 - this.icu_name = ci.IcuName;
110 - this.construct_compareinfo (icu_name);
111 + if (UseManagedCollation)
112 + collator = new SimpleCollator (ci);
114 + this.icu_name = ci.IcuName;
115 + this.construct_compareinfo (icu_name);
119 [MethodImplAttribute (MethodImplOptions.InternalCall)]
120 private extern void free_internal_collator ();
125 free_internal_collator ();
130 [MethodImplAttribute (MethodImplOptions.InternalCall)]
131 private extern int internal_compare (string str1, int offset1,
132 int length1, string str2,
133 int offset2, int length2,
134 CompareOptions options);
136 + private int internal_compare_managed (string str1, int offset1,
137 + int length1, string str2,
138 + int offset2, int length2,
139 + CompareOptions options)
141 + return collator.Compare (str1, offset1, length1,
142 + str2, offset2, length2, options);
145 + private int internal_compare_switch (string str1, int offset1,
146 + int length1, string str2,
147 + int offset2, int length2,
148 + CompareOptions options)
150 + return UseManagedCollation ?
151 + internal_compare_managed (str1, offset1, length1,
152 + str2, offset2, length2, options) :
153 + internal_compare (str1, offset1, length1,
154 + str2, offset2, length2, options);
157 public virtual int Compare (string string1, string string2)
159 - /* Short cuts... */
160 - if(string1.Length == 0) {
161 - if(string2.Length == 0) {
166 - } else if(string2.Length == 0) {
170 + if(string1.Length == 0 && string2.Length == 0)
173 - return(internal_compare (string1, 0, string1.Length,
174 + return(internal_compare_switch (string1, 0, string1.Length,
175 string2, 0, string2.Length,
176 CompareOptions.None));
179 public virtual int Compare (string string1, string string2,
180 CompareOptions options)
182 - /* Short cuts... */
183 - if(string1.Length == 0) {
184 - if(string2.Length == 0) {
189 - } else if(string2.Length == 0) {
193 + if(string1.Length == 0 && string2.Length == 0)
196 - return(internal_compare (string1, 0, string1.Length,
197 + return(internal_compare_switch (string1, 0, string1.Length,
198 string2, 0, string2.Length,
202 * the offset >= string length specified check
205 - if(string1.Length == 0 ||
206 - offset1 == string1.Length) {
207 - if(string2.Length == 0 ||
208 - offset2 == string2.Length) {
213 - } else if(string2.Length == 0 ||
214 - offset2 == string2.Length) {
217 + if ((string1.Length == 0 || offset1 == string1.Length) &&
218 + (string2.Length == 0 || offset2 == string2.Length))
221 if(offset1 < 0 || offset2 < 0) {
222 throw new ArgumentOutOfRangeException ("Offsets must not be less than zero");
224 throw new ArgumentOutOfRangeException ("Offset2 is greater than or equal to the length of string2");
227 - return(internal_compare (string1, offset1,
228 + return(internal_compare_switch (string1, offset1,
229 string1.Length-offset1,
231 string2.Length-offset2,
233 * the offset >= string length specified check
236 - if(string1.Length == 0 ||
237 - offset1 == string1.Length) {
238 - if(string2.Length == 0 ||
239 - offset2 == string2.Length) {
244 - } else if(string2.Length == 0 ||
245 - offset2 == string2.Length) {
248 + if((string1.Length == 0 || offset1 == string1.Length) &&
249 + (string2.Length == 0 || offset2 == string2.Length))
252 if(offset1 < 0 || offset2 < 0) {
253 throw new ArgumentOutOfRangeException ("Offsets must not be less than zero");
255 throw new ArgumentOutOfRangeException ("Offset2 is greater than or equal to the length of string2");
258 - return(internal_compare (string1, offset1,
259 + return(internal_compare_switch (string1, offset1,
260 string1.Length-offset1,
262 string2.Length-offset1,
263 @@ -203,21 +207,13 @@
264 * the offset >= string length specified check
267 - if(string1.Length == 0 ||
268 - offset1 == string1.Length ||
270 - if(string2.Length == 0 ||
271 - offset2 == string2.Length ||
277 - } else if(string2.Length == 0 ||
278 - offset2 == string2.Length ||
282 + if((string1.Length == 0 ||
283 + offset1 == string1.Length ||
285 + (string2.Length == 0 ||
286 + offset2 == string2.Length ||
290 if(offset1 < 0 || length1 < 0 ||
291 offset2 < 0 || length2 < 0) {
293 throw new ArgumentOutOfRangeException ("Length2 is greater than the number of characters from offset2 to the end of string2");
296 - return(internal_compare (string1, offset1, length1,
297 + return(internal_compare_switch (string1, offset1, length1,
298 string2, offset2, length2,
299 CompareOptions.None));
301 @@ -255,21 +251,13 @@
302 * the offset >= string length specified check
305 - if(string1.Length == 0 ||
306 - offset1 == string1.Length ||
308 - if(string2.Length == 0 ||
309 - offset2 == string2.Length ||
311 + if((string1.Length == 0 ||
312 + offset1 == string1.Length ||
314 + (string2.Length == 0 ||
315 + offset2 == string2.Length ||
321 - } else if(string2.Length == 0 ||
322 - offset2 == string2.Length ||
327 if(offset1 < 0 || length1 < 0 ||
328 offset2 < 0 || length2 < 0) {
330 throw new ArgumentOutOfRangeException ("Length2 is greater than the number of characters from offset2 to the end of string2");
333 - return(internal_compare (string1, offset1, length1,
334 + return(internal_compare_switch (string1, offset1, length1,
335 string2, offset2, length2,
339 public virtual SortKey GetSortKey(string source,
340 CompareOptions options)
342 + if (UseManagedCollation)
343 + return collator.GetSortKey (source, options);
344 SortKey key=new SortKey (culture, source, options);
346 /* Need to do the icall here instead of in the
348 int count, char value,
349 CompareOptions options,
353 + private int internal_index_managed (string s, int sindex,
354 + int count, char c, CompareOptions opt,
358 + collator.IndexOf (s, c, sindex, count, opt) :
359 + collator.LastIndexOf (s, c, sindex, count, opt);
362 + private int internal_index_switch (string s, int sindex,
363 + int count, char c, CompareOptions opt,
366 + return UseManagedCollation &&
367 + (CompareOptions.Ordinal & opt) == 0 ?
368 + internal_index_managed (s, sindex, count, c, opt, first) :
369 + internal_index (s, sindex, count, c, opt, first);
372 public virtual int IndexOf (string source, char value,
373 int startIndex, int count,
374 CompareOptions options)
379 - return (internal_index (source, startIndex,
380 + return (internal_index_switch (source, startIndex,
381 count, value, options,
385 int count, string value,
386 CompareOptions options,
390 + private int internal_index_managed (string s1, int sindex,
391 + int count, string s2, CompareOptions opt,
395 + collator.IndexOf (s1, s2, sindex, count, opt) :
396 + collator.LastIndexOf (s1, s2, sindex, count, opt);
399 + private int internal_index_switch (string s1, int sindex,
400 + int count, string s2, CompareOptions opt,
403 + return UseManagedCollation &&
404 + (CompareOptions.Ordinal & opt) == 0 ?
405 + internal_index_managed (s1, sindex, count, s2, opt, first) :
406 + internal_index (s1, sindex, count, s2, opt, first);
409 public virtual int IndexOf (string source, string value,
410 int startIndex, int count,
411 CompareOptions options)
416 - return (internal_index (source, startIndex, count,
417 + return (internal_index_switch (source, startIndex, count,
418 value, options, true));
422 throw new ArgumentNullException("prefix");
425 + if (UseManagedCollation)
426 + return collator.IsPrefix (source, prefix, options);
428 if(source.Length < prefix.Length) {
432 throw new ArgumentNullException("suffix");
435 + if (UseManagedCollation)
436 + return collator.IsSuffix (source, suffix, options);
438 if(source.Length < suffix.Length) {
445 - return (internal_index (source, startIndex,
446 + return (internal_index_switch (source, startIndex,
447 count, value, options,
454 - return(internal_index (source, startIndex, count,
455 + return(internal_index_switch (source, startIndex, count,
456 value, options, false));
459 @@ -724,13 +758,17 @@
461 void IDeserializationCallback.OnDeserialization(object sender)
463 - /* This will build the ICU collator, and store
464 - * the pointer in ICU_collator
467 - this.construct_compareinfo (icu_name);
469 - ICU_collator=IntPtr.Zero;
470 + if (UseManagedCollation) {
471 + collator = new SimpleCollator (new CultureInfo (culture));
473 + /* This will build the ICU collator, and store
474 + * the pointer in ICU_collator
477 + this.construct_compareinfo (icu_name);
479 + ICU_collator=IntPtr.Zero;
484 Index: System.Reflection/Assembly.cs
485 ===================================================================
486 --- System.Reflection/Assembly.cs (revision 47603)
487 +++ System.Reflection/Assembly.cs (working copy)
491 [MethodImplAttribute (MethodImplOptions.InternalCall)]
492 - private extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
493 + internal extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
495 public virtual Stream GetManifestResourceStream (String name)