projects/guix·blob python-team · refs

585 lines · 18.7 KiB

1diff --git a/mcs/class/System/System.Diagnostics/ICollectData.cs b/mcs/class/System/System.Diagnostics/ICollectData.cs
2index c52f9871589..c66c1936d3d 100644
3--- a/mcs/class/System/System.Diagnostics/ICollectData.cs
4+++ b/mcs/class/System/System.Diagnostics/ICollectData.cs
5@@ -41,7 +41,7 @@ namespace System.Diagnostics
6 #endif
7 public interface ICollectData {
8 void CloseData ();
9- [return: MarshalAs(UnmanagedType.I4)]
10+ //[return: MarshalAs(UnmanagedType.I4)]
11 void CollectData (
12 [In] [MarshalAs(UnmanagedType.I4)] int id,
13 [In] [MarshalAs(UnmanagedType.SysInt)] IntPtr valueName,
14diff --git a/mcs/class/System/System.Diagnostics/LocalFileEventLog.cs b/mcs/class/System/System.Diagnostics/LocalFileEventLog.cs
15index 280e6a97227..c41816dca24 100644
16--- a/mcs/class/System/System.Diagnostics/LocalFileEventLog.cs
17+++ b/mcs/class/System/System.Diagnostics/LocalFileEventLog.cs
18@@ -140,6 +140,30 @@ namespace System.Diagnostics
19 file_watcher.EnableRaisingEvents = false;
20 }
21
22+ void FileCreationWatcher(object o, FileSystemEventArgs e)
23+ {
24+ lock (this) {
25+ if (_notifying)
26+ return;
27+ _notifying = true;
28+ }
29+
30+ // Process every new entry in one notification event.
31+ try {
32+ while (GetLatestIndex () > last_notification_index) {
33+ try {
34+ CoreEventLog.OnEntryWritten (GetEntry (last_notification_index++));
35+ } catch (Exception ex) {
36+ // FIXME: find some proper way to output this error
37+ Debug.WriteLine (ex);
38+ }
39+ }
40+ } finally {
41+ lock (this)
42+ _notifying = false;
43+ }
44+ }
45+
46 public override void EnableNotification ()
47 {
48 if (file_watcher == null) {
49@@ -149,28 +173,7 @@ namespace System.Diagnostics
50
51 file_watcher = new FileSystemWatcher ();
52 file_watcher.Path = logDir;
53- file_watcher.Created += delegate (object o, FileSystemEventArgs e) {
54- lock (this) {
55- if (_notifying)
56- return;
57- _notifying = true;
58- }
59-
60- // Process every new entry in one notification event.
61- try {
62- while (GetLatestIndex () > last_notification_index) {
63- try {
64- CoreEventLog.OnEntryWritten (GetEntry (last_notification_index++));
65- } catch (Exception ex) {
66- // FIXME: find some proper way to output this error
67- Debug.WriteLine (ex);
68- }
69- }
70- } finally {
71- lock (this)
72- _notifying = false;
73- }
74- };
75+ file_watcher.Created += new FileSystemEventHandler(FileCreationWatcher);
76 }
77 last_notification_index = GetLatestIndex ();
78 file_watcher.EnableRaisingEvents = true;
79diff --git a/mcs/class/System/System.IO/InotifyWatcher.cs b/mcs/class/System/System.IO/InotifyWatcher.cs
80index d8e7acce3a7..7b0907eebc1 100644
81--- a/mcs/class/System/System.IO/InotifyWatcher.cs
82+++ b/mcs/class/System/System.IO/InotifyWatcher.cs
83@@ -423,19 +423,36 @@ namespace System.IO {
84 return 16 + len;
85 }
86
87+ class ThingEnumerator : IEnumerator, IEnumerable
88+ {
89+ object thing;
90+ int j;
91+ public ThingEnumerator(object thing)
92+ { this.thing = thing; j = -1; }
93+
94+ public IEnumerator GetEnumerator() { return this; }
95+ public bool MoveNext()
96+ {
97+ if(thing == null) { return false; }
98+ if(thing is ArrayList)
99+ {
100+ ArrayList list = (ArrayList) thing;
101+ if(j+1 >= list.Count) { return false; }
102+ j++;
103+ return true;
104+ }
105+ if(j == -1) { j = 0; return true; }
106+ return false;
107+ }
108+ public void Reset() { j = -1; }
109+ public object Current
110+ { get { if(thing is ArrayList) return ((ArrayList)thing)[j];
111+ return thing; }}
112+ }
113+
114 static IEnumerable GetEnumerator (object source)
115 {
116- if (source == null)
117- yield break;
118-
119- if (source is InotifyData)
120- yield return source;
121-
122- if (source is ArrayList) {
123- ArrayList list = (ArrayList) source;
124- for (int i = 0; i < list.Count; i++)
125- yield return list [i];
126- }
127+ return new ThingEnumerator(source);
128 }
129
130 /* Interesting events:
131diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs
132index a884d90f507..e1c73b098c2 100644
133--- a/mcs/class/System/System.Net/ServicePoint.cs
134+++ b/mcs/class/System/System.Net/ServicePoint.cs
135@@ -137,7 +137,7 @@ namespace System.Net
136 get {
137 return idleSince;
138 }
139- internal set {
140+ set {
141 lock (locker)
142 idleSince = value;
143 }
144diff --git a/mcs/class/System/System.Text.RegularExpressions/BaseMachine.cs-2 b/mcs/class/System/System.Text.RegularExpressions/BaseMachine.cs-2
145new file mode 100644
146index 00000000000..a685e2679b7
147--- /dev/null
148+++ b/mcs/class/System/System.Text.RegularExpressions/BaseMachine.cs-2
149@@ -0,0 +1,168 @@
150+//
151+// BaseMachine.jvm.cs
152+//
153+// Author:
154+// author: Dan Lewis ([email protected])
155+// (c) 2002
156+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
157+//
158+
159+//
160+// Permission is hereby granted, free of charge, to any person obtaining
161+// a copy of this software and associated documentation files (the
162+// "Software"), to deal in the Software without restriction, including
163+// without limitation the rights to use, copy, modify, merge, publish,
164+// distribute, sublicense, and/or sell copies of the Software, and to
165+// permit persons to whom the Software is furnished to do so, subject to
166+// the following conditions:
167+//
168+// The above copyright notice and this permission notice shall be
169+// included in all copies or substantial portions of the Software.
170+//
171+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
172+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
173+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
174+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
175+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
176+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
177+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
178+//
179+
180+using System;
181+using System.Collections;
182+using System.Collections.Specialized;
183+
184+namespace System.Text.RegularExpressions
185+{
186+ abstract class BaseMachine : IMachine
187+ {
188+ internal delegate void MatchAppendEvaluator (Match match, StringBuilder sb);
189+
190+ public virtual string Replace (Regex regex, string input, string replacement, int count, int startat)
191+ {
192+ ReplacementEvaluator ev = new ReplacementEvaluator (regex, replacement);
193+ if (regex.RightToLeft)
194+ return RTLReplace (regex, input, new MatchEvaluator (ev.Evaluate), count, startat);
195+ else
196+ return LTRReplace (regex, input, new MatchAppendEvaluator (ev.EvaluateAppend), count, startat);
197+ }
198+
199+ virtual public string [] Split (Regex regex, string input, int count, int startat)
200+ {
201+ ArrayList splits = new ArrayList ();
202+ if (count == 0)
203+ count = Int32.MaxValue;
204+
205+ int ptr = startat;
206+ Match m = null;
207+ while (--count > 0) {
208+ if (m != null)
209+ m = m.NextMatch ();
210+ else
211+ m = regex.Match (input, ptr);
212+
213+ if (!m.Success)
214+ break;
215+
216+ if (regex.RightToLeft)
217+ splits.Add (input.Substring (m.Index + m.Length, ptr - m.Index - m.Length));
218+ else
219+ splits.Add (input.Substring (ptr, m.Index - ptr));
220+
221+ int gcount = m.Groups.Count;
222+ for (int gindex = 1; gindex < gcount; gindex++) {
223+ Group grp = m.Groups [gindex];
224+ splits.Add (input.Substring (grp.Index, grp.Length));
225+ }
226+
227+ if (regex.RightToLeft)
228+ ptr = m.Index;
229+ else
230+ ptr = m.Index + m.Length;
231+
232+ }
233+
234+ if (regex.RightToLeft && ptr >= 0)
235+ splits.Add (input.Substring (0, ptr));
236+ if (!regex.RightToLeft && ptr <= input.Length)
237+ splits.Add (input.Substring (ptr));
238+
239+ return (string []) splits.ToArray (typeof (string));
240+ }
241+
242+ virtual public Match Scan (Regex regex, string text, int start, int end)
243+ {
244+ throw new NotImplementedException ("Scan method must be implemented in derived classes");
245+ }
246+
247+ virtual public string Result (string replacement, Match match)
248+ {
249+ return ReplacementEvaluator.Evaluate (replacement, match);
250+ }
251+
252+ internal static string LTRReplace (Regex regex, string input, MatchAppendEvaluator evaluator, int count, int startat)
253+ {
254+ Match m = regex.Match (input, startat);
255+ if (!m.Success)
256+ return input;
257+
258+ StringBuilder result = new StringBuilder ();
259+ int ptr = startat;
260+ int counter = count;
261+
262+ result.Append (input, 0, ptr);
263+
264+ do {
265+ if (count != -1)
266+ if (counter-- <= 0)
267+ break;
268+ if (m.Index < ptr)
269+ throw new SystemException ("how");
270+ result.Append (input, ptr, m.Index - ptr);
271+ evaluator (m, result);
272+
273+ ptr = m.Index + m.Length;
274+ m = m.NextMatch ();
275+ } while (m.Success);
276+
277+ result.Append (input, ptr, input.Length - ptr);
278+
279+ return result.ToString ();
280+ }
281+
282+ internal static string RTLReplace (Regex regex, string input, MatchEvaluator evaluator, int count, int startat)
283+ {
284+ Match m = regex.Match (input, startat);
285+ if (!m.Success)
286+ return input;
287+
288+ int ptr = startat;
289+ int counter = count;
290+ StringCollection pieces = new StringCollection ();
291+ pieces.Add (input.Substring (ptr));
292+
293+ do {
294+ if (count != -1)
295+ if (counter-- <= 0)
296+ break;
297+ if (m.Index + m.Length > ptr)
298+ throw new SystemException ("how");
299+ pieces.Add (input.Substring (m.Index + m.Length, ptr - m.Index - m.Length));
300+ pieces.Add (evaluator (m));
301+
302+ ptr = m.Index;
303+ m = m.NextMatch ();
304+ } while (m.Success);
305+
306+ StringBuilder result = new StringBuilder ();
307+
308+ result.Append (input, 0, ptr);
309+ for (int i = pieces.Count; i > 0; )
310+ result.Append (pieces [--i]);
311+
312+ pieces.Clear ();
313+
314+ return result.ToString ();
315+ }
316+ }
317+}
318diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
319index 94069d1727e..042574178fa 100644
320--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
321+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs
322@@ -272,6 +272,10 @@ namespace System.Runtime.Remoting.Messaging {
323 set { _uri = value; }
324 }
325
326+ string IMethodMessage.Uri {
327+ get { return Uri; }
328+ }
329+
330 string IInternalMessage.Uri {
331 get { return Uri; }
332 set { Uri = value; }
333diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
334index 1b1eab014b3..575e7e37dee 100644
335--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
336+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodResponse.cs
337@@ -272,6 +272,10 @@ namespace System.Runtime.Remoting.Messaging {
338 }
339 }
340
341+ string IMethodMessage.Uri {
342+ get { return Uri; }
343+ }
344+
345 string IInternalMessage.Uri {
346 get { return Uri; }
347 set { Uri = value; }
348diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
349index aee39f5bb81..ec09b73c15d 100644
350--- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
351+++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ReturnMessage.cs
352@@ -166,6 +166,10 @@ namespace System.Runtime.Remoting.Messaging
353 }
354 }
355
356+ string IMethodMessage.Uri {
357+ get { return Uri; }
358+ }
359+
360 string IInternalMessage.Uri {
361 get { return Uri; }
362 set { Uri = value; }
363diff --git a/mcs/class/corlib/System/MulticastDelegate.cs b/mcs/class/corlib/System/MulticastDelegate.cs
364index b36aff33492..cf9134a33b3 100644
365--- a/mcs/class/corlib/System/MulticastDelegate.cs
366+++ b/mcs/class/corlib/System/MulticastDelegate.cs
367@@ -262,16 +262,16 @@ namespace System
368
369 public static bool operator == (MulticastDelegate a, MulticastDelegate b)
370 {
371- if (a == null)
372- return b == null;
373+ if ((object)a == null)
374+ return (object)b == null;
375
376 return a.Equals (b);
377 }
378
379 public static bool operator != (MulticastDelegate a, MulticastDelegate b)
380 {
381- if (a == null)
382- return b != null;
383+ if ((object)a == null)
384+ return (object)b != null;
385
386 return !a.Equals (b);
387 }
388diff --git a/mcs/class/corlib/System/Object.cs b/mcs/class/corlib/System/Object.cs
389index 6b0a03d2a31..694cbd454e1 100644
390--- a/mcs/class/corlib/System/Object.cs
391+++ b/mcs/class/corlib/System/Object.cs
392@@ -40,7 +40,7 @@ using System.Runtime.ConstrainedExecution;
393
394 namespace System {
395
396- [Serializable]
397+ //[Serializable]
398 [ClassInterface (ClassInterfaceType.AutoDual)]
399 #if NET_2_0
400 [ComVisible (true)]
401@@ -47,6 +47,12 @@
402 #endif
403 public class Object {
404
405+ // Default definition of the object finalizer.
406+ #if NET_2_0
407+ [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
408+ #endif
409+ protected virtual void Finalize() {}
410+
411 // <summary>
412 // Compares this object to the specified object.
413 // Returns true if they are equal, false otherwise.
414@@ -80,16 +86,6 @@ namespace System {
415 {
416 }
417
418- // <summary>
419- // Object destructor.
420- // </summary>
421-#if NET_2_0
422- [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
423-#endif
424- ~Object ()
425- {
426- }
427-
428 // <summary>
429 // Returns a hashcode for this object. Each derived
430 // class should return a hash code that makes sense
431diff --git a/mcs/mcs/codegen.cs b/mcs/mcs/codegen.cs
432index c94a61772f4..8546d671ec6 100644
433--- a/mcs/mcs/codegen.cs
434+++ b/mcs/mcs/codegen.cs
435@@ -498,7 +498,7 @@ namespace Mono.CSharp {
436
437 // utility helper for CheckExpr, UnCheckExpr, Checked and Unchecked statements
438 // it's public so that we can use a struct at the callsite
439- public struct FlagsHandle : IDisposable
440+ public class FlagsHandle : IDisposable
441 {
442 EmitContext ec;
443 readonly Flags invmask, oldval;
444diff --git a/mcs/mcs/typemanager.cs b/mcs/mcs/typemanager.cs
445index 1e173de89d2..58477af41a3 100644
446--- a/mcs/mcs/typemanager.cs
447+++ b/mcs/mcs/typemanager.cs
448@@ -629,18 +629,42 @@ namespace Mono.CSharp {
449 return CSharpName (GetFullName (t));
450 }
451
452+ static bool StartsWithWord(string haystack, string check)
453+ {
454+ if(String.Compare(haystack, 0, check, 0, check.Length, false) != 0)
455+ { return false; }
456+ if(check.Length == haystack.Length) { return true; }
457+ char c = haystack[check.Length];
458+ return !(Char.IsLetter(c) || Char.IsDigit(c));
459+ }
460+
461 public static string CSharpName (string name)
462 {
463 if (name.StartsWith (AnonymousTypeClass.ClassNamePrefix))
464 return AnonymousTypeClass.SignatureForError;
465-
466- return Regex.Replace (name,
467- @"^System\." +
468- @"(Int32|UInt32|Int16|UInt16|Int64|UInt64|" +
469- @"Single|Double|Char|Decimal|Byte|SByte|Object|" +
470- @"Boolean|String|Void|Null)" +
471- @"(\W+|\b)",
472- new MatchEvaluator (CSharpNameMatch)).Replace ('+', '.');
473+
474+ int l = "System.".Length;
475+ if(name.StartsWith("System.") && name.Length > l)
476+ {
477+ string s2 = name.Substring(l).ToLower();
478+ if(StartsWithWord(s2, "int32"))
479+ return "int";
480+ if(StartsWithWord(s2, "uint32"))
481+ return "uint";
482+ if(StartsWithWord(s2, "int16"))
483+ return "short";
484+ if(StartsWithWord(s2, "uint16"))
485+ return "ushort";
486+ if(StartsWithWord(s2, "int64"))
487+ return "long";
488+ if(StartsWithWord(s2, "uint64"))
489+ return "ulong";
490+ if(StartsWithWord(s2, "single"))
491+ return "float";
492+ if(StartsWithWord(s2, "boolean"))
493+ return "bool";
494+ }
495+ return name;
496 }
497
498 static public string CSharpName (Type[] types)
499@@ -654,21 +678,6 @@ namespace Mono.CSharp {
500 return sb.ToString ();
501 }
502
503- static String CSharpNameMatch (Match match)
504- {
505- string s = match.Groups [1].Captures [0].Value;
506- return s.ToLower ().
507- Replace ("int32", "int").
508- Replace ("uint32", "uint").
509- Replace ("int16", "short").
510- Replace ("uint16", "ushort").
511- Replace ("int64", "long").
512- Replace ("uint64", "ulong").
513- Replace ("single", "float").
514- Replace ("boolean", "bool")
515- + match.Groups [2].Captures [0].Value;
516- }
517-
518 // Used for error reporting to show symbolic name instead of underlying value
519 public static string CSharpEnumValue (Type t, object value)
520 {
521diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c
522index cd6176cdda2..486087d3a1b 100644
523--- a/mono/io-layer/processes.c
524+++ b/mono/io-layer/processes.c
525@@ -15,6 +15,7 @@
526 #include <sys/time.h>
527 #include <errno.h>
528 #include <sys/types.h>
529+#include <sys/sysmacros.h>
530 #include <unistd.h>
531 #include <signal.h>
532 #include <sys/wait.h>
533diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am
534index 6ff2368895b..b8ba66e8756 100644
535--- a/mono/metadata/Makefile.am
536+++ b/mono/metadata/Makefile.am
537@@ -154,7 +154,6 @@ libmonoruntimeinclude_HEADERS = \
538 object.h \
539 exception.h \
540 profiler.h \
541- appdomain.h \
542 mono-config.h \
543 debug-helpers.h \
544 mempool.h
545diff --git a/mono/metadata/class.c b/mono/metadata/class.c
546index f13f37632fe..128710337f4 100644
547--- a/mono/metadata/class.c
548+++ b/mono/metadata/class.c
549@@ -2695,10 +2695,10 @@ initialize_object_slots (MonoClass *class)
550 finalize_slot = i;
551 }
552
553- g_assert (ghc_slot > 0);
554+ g_assert (ghc_slot >= 0);
555 default_ghc = class->vtable [ghc_slot];
556
557- g_assert (finalize_slot > 0);
558+ g_assert (finalize_slot >= 0);
559 default_finalize = class->vtable [finalize_slot];
560 }
561 }
562diff --git a/mono/metadata/object.c b/mono/metadata/object.c
563index 2b6f4909b34..ef4c8fd8b44 100644
564--- a/mono/metadata/object.c
565+++ b/mono/metadata/object.c
566@@ -861,7 +861,7 @@ mono_class_compute_gc_descriptor (MonoClass *class)
567 mono_register_jit_icall (GC_local_gcj_fast_malloc, "GC_local_gcj_fast_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
568 #endif
569 mono_register_jit_icall (GC_gcj_malloc, "GC_gcj_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
570- mono_register_jit_icall (GC_gcj_fast_malloc, "GC_gcj_fast_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
571+ mono_register_jit_icall (GC_gcj_malloc, "GC_gcj_fast_malloc", mono_create_icall_signature ("object int ptr"), FALSE);
572 #endif
573 gcj_inited = TRUE;
574 mono_loader_unlock ();
575diff --git a/runtime/Makefile.am b/runtime/Makefile.am
576index 779787b3ce3..b67957dcf16 100644
577--- a/runtime/Makefile.am
578+++ b/runtime/Makefile.am
579@@ -1,6 +1,3 @@
580-# hack to prevent 'check' from depending on 'all'
581-AUTOMAKE_OPTIONS = cygnus
582-
583 tmpinst = _tmpinst
584
585 noinst_SCRIPTS = mono-wrapper monodis-wrapper semdel-wrapper