Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorJonathan Pryor <jpryor@novell.com>2002-06-16 23:49:45 +0400
committerJonathan Pryor <jpryor@novell.com>2002-06-16 23:49:45 +0400
commit609c2de3e6f6b94460637e5175b0bdbb6692c997 (patch)
tree2301cd6dc95e8fb2538ee1623efb38bbf513f3de /mcs
parent9a16ca4210018c668b82c4d5771bf8cdf42f1349 (diff)
* ICollectData.cs: Implemented
* TraceImpl.cs: Setting IndentLevel, IndentSize should change the corresponding properties on all current TraceListeners. Also, to answer the FIXME message: Yes, the properties in TraceListener need to be [ThreadStatic] as well. * TraceListenerCollection.cs: When adding a TraceListener, the TraceListener should have its properties set to the current TraceImpl property values. * TraceListener.cs: Make indentSize, lndentLevel [ThreadStatic]. svn path=/trunk/mcs/; revision=5291
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System/System.Diagnostics/ChangeLog9
-rw-r--r--mcs/class/System/System.Diagnostics/ICollectData.cs26
-rw-r--r--mcs/class/System/System.Diagnostics/TraceImpl.cs38
-rw-r--r--mcs/class/System/System.Diagnostics/TraceListener.cs4
-rw-r--r--mcs/class/System/System.Diagnostics/TraceListenerCollection.cs31
5 files changed, 86 insertions, 22 deletions
diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog
index f6a3f1103be..b8b0a87a5f7 100644
--- a/mcs/class/System/System.Diagnostics/ChangeLog
+++ b/mcs/class/System/System.Diagnostics/ChangeLog
@@ -1,3 +1,12 @@
+2002-06-16 Jonathan Pryor <jonpryor@vt.edu>
+ * ICollectData.cs: Implemented
+ * TraceImpl.cs: Setting IndentLevel, IndentSize should change the
+ corresponding properties on all current TraceListeners.
+ Also, to answer the FIXME message: Yes, the properties in TraceListener
+ need to be [ThreadStatic] as well.
+ * TraceListenerCollection.cs:
+ * TraceListener.cs:
+
2002-06-09 Jonathan Pryor <jonpryor@vt.edu>
* EntryWrittenEventArgs.cs: Implemented
* EntryWrittenEventHandler.cs: Implemented
diff --git a/mcs/class/System/System.Diagnostics/ICollectData.cs b/mcs/class/System/System.Diagnostics/ICollectData.cs
new file mode 100644
index 00000000000..8ed58307627
--- /dev/null
+++ b/mcs/class/System/System.Diagnostics/ICollectData.cs
@@ -0,0 +1,26 @@
+//
+// System.Diagnostics.ICollectData.cs
+//
+// Authors:
+// Jonathan Pryor (jonpryor@vt.edu)
+//
+// (C) 2002
+//
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace System.Diagnostics {
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface ICollectData {
+ void CloseData ();
+ void CollectData (
+ int id,
+ IntPtr valueName,
+ IntPtr data,
+ int totalBytes,
+ out IntPtr res);
+ }
+}
+
diff --git a/mcs/class/System/System.Diagnostics/TraceImpl.cs b/mcs/class/System/System.Diagnostics/TraceImpl.cs
index e2fe2022485..f159f2518c4 100644
--- a/mcs/class/System/System.Diagnostics/TraceImpl.cs
+++ b/mcs/class/System/System.Diagnostics/TraceImpl.cs
@@ -24,34 +24,36 @@ namespace System.Diagnostics {
set {autoFlush = value;}
}
- // FIXME: From MSDN: "This property is stored on
- // per-thread/pre-reqeust basis"
- //
- // What exactly does this mean? Sure, we can mark it
- // [ThreadStatic], which make a per-thread value, but what
- // does this mean for each of the writers? Do *they* need to
- // store this as a thread-static value?
- [MonoTODO, ThreadStatic]
+ [ThreadStatic]
private static int indentLevel = 0;
public static int IndentLevel {
get {return indentLevel;}
- set {indentLevel = value;}
+ set {
+ indentLevel = value;
+
+ // Don't need to lock for threadsafety as
+ // TraceListener.IndentLevel is [ThreadStatic]
+ foreach (TraceListener t in Listeners) {
+ t.IndentLevel = indentLevel;
+ }
+ }
}
- // FIXME: From MSDN: "This property is stored on
- // per-thread/pre-reqeust basis"
- //
- // What exactly does this mean? Sure, we can mark it
- // [ThreadStatic], which makes a per-thread value, but what
- // does this mean for each of the writers? Do *they* need to
- // store this as a thread-static value?
- [MonoTODO, ThreadStatic]
+ [ThreadStatic]
private static int indentSize = 4;
public static int IndentSize {
get {return indentSize;}
- set {indentSize = value;}
+ set {
+ indentSize = value;
+
+ // Don't need to lock for threadsafety as
+ // TraceListener.IndentSize is [ThreadStatic]
+ foreach (TraceListener t in Listeners) {
+ t.IndentSize = indentSize;
+ }
+ }
}
private static TraceListenerCollection listeners =
diff --git a/mcs/class/System/System.Diagnostics/TraceListener.cs b/mcs/class/System/System.Diagnostics/TraceListener.cs
index 4f4fa922dd5..b32ced8eb1b 100644
--- a/mcs/class/System/System.Diagnostics/TraceListener.cs
+++ b/mcs/class/System/System.Diagnostics/TraceListener.cs
@@ -17,8 +17,12 @@ namespace System.Diagnostics {
public abstract class TraceListener : MarshalByRefObject, IDisposable {
+ [ThreadStatic]
private int indentLevel = 0;
+
+ [ThreadStatic]
private int indentSize = 4;
+
private string name = null;
private bool needIndent = false;
diff --git a/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs b/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
index 8f7240b0774..8d32414efbc 100644
--- a/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
+++ b/mcs/class/System/System.Diagnostics/TraceListenerCollection.cs
@@ -43,12 +43,17 @@ namespace System.Diagnostics {
public TraceListener this [int index] {
get {return (TraceListener) listeners[index];}
- set {listeners[index] = value;}
+ set {
+ InitializeListener (value);
+ listeners[index] = value;
+ }
}
object IList.this [int index] {
get {return listeners[index];}
- set {((IList)this).Insert (index, value);}
+ set {
+ this[index] = (TraceListener) value;
+ }
}
bool ICollection.IsSynchronized {
@@ -69,16 +74,33 @@ namespace System.Diagnostics {
public int Add (TraceListener listener)
{
+ InitializeListener (listener);
return listeners.Add (listener);
}
+ private void InitializeListener (TraceListener listener)
+ {
+ listener.IndentLevel = TraceImpl.IndentLevel;
+ listener.IndentSize = TraceImpl.IndentSize;
+ }
+
+ private void InitializeRange (IList listeners)
+ {
+ int e = listeners.Count;
+ for (int i = 0; i != e; ++i)
+ InitializeListener (
+ (TraceListener) listeners[i]);
+ }
+
public void AddRange (TraceListener[] value)
{
+ InitializeRange (value);
listeners.AddRange (value);
}
public void AddRange (TraceListenerCollection value)
{
+ InitializeRange (value);
listeners.AddRange (value.listeners);
}
@@ -110,7 +132,7 @@ namespace System.Diagnostics {
int IList.Add (object value)
{
if (value is TraceListener)
- return listeners.Add (value);
+ return Add ((TraceListener) value);
throw new NotSupportedException (Locale.GetText (
"You can only add TraceListener objects to the collection"));
}
@@ -132,7 +154,7 @@ namespace System.Diagnostics {
void IList.Insert (int index, object value)
{
if (value is TraceListener) {
- listeners.Insert (index, value);
+ Insert (index, (TraceListener) value);
return;
}
throw new NotSupportedException (Locale.GetText (
@@ -152,6 +174,7 @@ namespace System.Diagnostics {
public void Insert (int index, TraceListener listener)
{
+ InitializeListener (listener);
listeners.Insert (index, listener);
}