dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics Debug.cs,1.1,1.2


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System/Diagnostics Debug.cs,1.1,1.2
Date: Sun, 12 Jan 2003 01:47:04 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics
In directory subversions:/tmp/cvs-serv18945/System/Diagnostics

Modified Files:
        Debug.cs 
Log Message:


Implement the debug assert routines using simple "report to stderr" behaviour.


Index: Debug.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Diagnostics/Debug.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Debug.cs    17 Dec 2002 15:50:11 -0000      1.1
--- Debug.cs    12 Jan 2003 06:47:02 -0000      1.2
***************
*** 24,230 ****
  namespace System.Diagnostics
  {
!       public sealed class Debug
!       {
!               [TODO]
!               public static void Assert(bool condition)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Assert(bool condition, System.String message)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Assert(bool condition, System.String 
message, System.String detailMessage)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Close()
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Fail(System.String message)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Fail(System.String message, System.String 
detailMessage)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Flush()
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Indent()
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static void Unindent()
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void Write(System.Object value)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void Write(System.String message)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void Write(System.Object value, System.String 
category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void Write(System.String message, System.String 
category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteIf(bool condition, System.Object value)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteIf(bool condition, System.String 
message)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteIf(bool condition, System.Object value, 
System.String category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteIf(bool condition, System.String 
message, System.String category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLine(System.Object value)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLine(System.String message)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLine(System.Object value, System.String 
category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLine(System.String message, 
System.String category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLineIf(bool condition, System.Object 
value)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLineIf(bool condition, System.String 
message)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLineIf(bool condition, System.Object 
value, System.String category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               [Conditional("DEBUG")]
!               public static void WriteLineIf(bool condition, System.String 
message, System.String category)
!               {
!               /*TODO*/
!               }
! 
!               [TODO]
!               public static bool AutoFlush 
!               { 
!                       get
!                       {
!                               return false;
!                       } 
!                       set
!                       {
!                       } 
!               }
! 
!               [TODO]
!               public static int IndentLevel 
!               { 
!                       get
!                       {
!                               return 0;
!                       }
!                       set
!                       {
!                       }
!               }
! 
!               [TODO]
!               public static int IndentSize 
!               {
!                       get
!                       {
!                               return 4;
!                       }
!                       set
!                       {
!                       }
!               }
!       }
! }//namespace
--- 24,327 ----
  namespace System.Diagnostics
  {
! 
! using System;
! 
! #define       DEBUG
! 
! public sealed class Debug
! {
!       // Internal state.
!       private static bool autoFlush = true;
!       private static int indentLevel = 0;
!       private static int indentSize = 4;
! 
!       // Cannot construct instances of this class.
!       private Debug() {}
! 
!       // Assert a condition, exiting the application if it is false.
!       [Conditional("DEBUG")]
!       public static void Assert(bool condition)
!                       {
!                               if(!condition)
!                               {
!                                       Fail(String.Empty);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void Assert(bool condition, String message)
!                       {
!                               if(!condition)
!                               {
!                                       Fail(message);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void Assert
!                               (bool condition, String message, String 
detailMessage)
!                       {
!                               if(!condition)
!                               {
!                                       Fail(message, detailMessage);
!                               }
!                       }
! 
!       // Close the trace output stream.
!       [Conditional("DEBUG")]
!       public static void Close()
!                       {
!                               // Nothing to do here.
!                       }
! 
!       // Report a debugging failure and exit the application.
!       [Conditional("DEBUG")]
!       public static void Fail(String message)
!                       {
!                               Fail(message, String.Empty);
!                       }
!       [Conditional("DEBUG")]
!       public static void Fail(String message, String detailMessage)
!                       {
!                               // Print the failure message details.
!                               if(message != null && message != String.Empty)
!                               {
!                                       WriteLine(message);
!                               }
!                               if(detailMessage != null && detailMessage != 
String.Empty)
!                               {
!                                       WriteLine(detailMessage);
!                               }
! 
!                               // Print the stack trace for the failure.
!                               Write((new StackTrace()).ToString());
!                               Flush();
! 
!                               // Abort the application.
!                               Environment.Exit(1);
!                       }
! 
!       // Flush the trace output stream.
!       [Conditional("DEBUG")]
!       public static void Flush()
!                       {
!                               Console.Error.Flush();
!                       }
! 
!       // Go in one indent level within the trace output stream.
!       [Conditional("DEBUG")]
!       public static void Indent()
!                       {
!                               IndentLevel += 1;
!                       }
! 
!       // Go out one indent level within the trace output stream.
!       [Conditional("DEBUG")]
!       public static void Unindent()
!                       {
!                               IndentLevel -= 1;
!                       }
! 
!       // Write data to the trace output stream.
!       [Conditional("DEBUG")]
!       public static void Write(Object value)
!                       {
!                               if(value != null)
!                               {
!                                       Write(value.ToString());
!                               }
!                       }
!       [TODO]
!       [Conditional("DEBUG")]
!       public static void Write(String message)
!                       {
!                               Console.Error.Write(message);
!                       }
!       [Conditional("DEBUG")]
!       public static void Write(Object value, String category)
!                       {
!                               if(category == null)
!                               {
!                                       Write(value);
!                               }
!                               else
!                               {
!                                       Write((value != null ? value.ToString() 
: String.Empty),
!                                                 category);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void Write(String message, String category)
!                       {
!                               if(category == null)
!                               {
!                                       Write(message);
!                               }
!                               else
!                               {
!                                       Write(category + ": " +
!                                                 (message != null ? message : 
String.Empty));
!                               }
!                       }
! 
!       // Write a debugging message if a condition is true.
!       [Conditional("DEBUG")]
!       public static void WriteIf(bool condition, Object value)
!                       {
!                               if(condition)
!                               {
!                                       Write(value);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteIf(bool condition, String message)
!                       {
!                               if(condition)
!                               {
!                                       Write(message);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteIf(bool condition, Object value, String 
category)
!                       {
!                               if(condition)
!                               {
!                                       Write(value, category);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteIf(bool condition, String message, String 
category)
!                       {
!                               if(condition)
!                               {
!                                       Write(message, category);
!                               }
!                       }
! 
!       // Write a message to the debug output stream followed by newline.
!       [Conditional("DEBUG")]
!       public static void WriteLine(Object value)
!                       {
!                               if(value != null)
!                               {
!                                       WriteLine(value.ToString());
!                               }
!                       }
!       [TODO]
!       [Conditional("DEBUG")]
!       public static void WriteLine(String message)
!                       {
!                               Console.Error.WriteLine(message);
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteLine(Object value, String category)
!                       {
!                               if(category == null)
!                               {
!                                       WriteLine(value);
!                               }
!                               else
!                               {
!                                       WriteLine((value != null ?
!                                                                       
value.ToString() : String.Empty),
!                                                      category);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteLine(String message, String category)
!                       {
!                               if(category == null)
!                               {
!                                       WriteLine(message);
!                               }
!                               else
!                               {
!                                       WriteLine(category + ": " +
!                                                     (message != null ? 
message : String.Empty));
!                               }
!                       }
! 
!       // Write a debugging message if a condition is true, followed by 
newline.
!       [Conditional("DEBUG")]
!       public static void WriteLineIf(bool condition, Object value)
!                       {
!                               if(condition)
!                               {
!                                       WriteLine(value);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteLineIf(bool condition, String message)
!                       {
!                               if(condition)
!                               {
!                                       WriteLine(message);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteLineIf
!                                       (bool condition, Object value, String 
category)
!                       {
!                               if(condition)
!                               {
!                                       WriteLine(value, category);
!                               }
!                       }
!       [Conditional("DEBUG")]
!       public static void WriteLineIf
!                                       (bool condition, String message, String 
category)
!                       {
!                               if(condition)
!                               {
!                                       WriteLine(message, category);
!                               }
!                       }
! 
!       // Get or set the message auto-flush state.
!       public static bool AutoFlush 
!                       { 
!                               get
!                               {
!                                       return autoFlush;
!                               } 
!                               set
!                               {
!                                       autoFlush = value;
!                               } 
!                       }
! 
!       // Change the indent level for output messages.
!       public static int IndentLevel 
!                       { 
!                               get
!                               {
!                                       return indentLevel;
!                               }
!                               set
!                               {
!                                       if(value < 0)
!                                       {
!                                               value = 0;
!                                       }
!                                       indentLevel = value;
!                               }
!                       }
! 
!       // Set the size of output message indenting.
!       public static int IndentSize 
!                       {
!                               get
!                               {
!                                       return indentSize;
!                               }
!                               set
!                               {
!                                       if(value < 0)
!                                       {
!                                               value = 0;
!                                       }
!                                       indentSize = value;
!                               }
!                       }
! 
! }; // class Debug
! 
! }; // namespace System.Diagnostics





reply via email to

[Prev in Thread] Current Thread [Next in Thread]