2019-08-23 11:56:54 -07:00
|
|
|
namespace System.Diagnostics
|
|
|
|
{
|
|
|
|
class Debug
|
|
|
|
{
|
|
|
|
//[System.Diagnostics.Conditional("DEBUG")]
|
|
|
|
|
|
|
|
#if !DEBUG
|
|
|
|
[SkipCall]
|
|
|
|
#endif
|
|
|
|
public static void Assert(bool condition)
|
|
|
|
{
|
|
|
|
if (!condition)
|
|
|
|
Internal.FatalError("Assert failed", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !DEBUG
|
|
|
|
[SkipCall]
|
|
|
|
#endif
|
|
|
|
public static void Assert(bool condition, StringView error)
|
|
|
|
{
|
|
|
|
if (!condition)
|
|
|
|
Internal.FatalError("Assert failed", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if !DEBUG
|
2020-05-04 07:15:38 -07:00
|
|
|
[CallingConvention(.Cdecl), SkipCall]
|
2020-05-15 10:33:56 -07:00
|
|
|
#else
|
2020-05-04 07:15:38 -07:00
|
|
|
[CallingConvention(.Cdecl)]
|
2020-05-15 10:33:56 -07:00
|
|
|
#endif
|
2019-08-23 11:56:54 -07:00
|
|
|
static extern void Write(char8* str, int strLen);
|
|
|
|
|
|
|
|
public static void WriteLine(StringView line)
|
|
|
|
{
|
|
|
|
Write(line.Ptr, line.Length);
|
|
|
|
Write("\n", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*public static void WriteLine(StringView strFormat, params Object[] args)
|
|
|
|
{
|
|
|
|
String paramStr = scope String();
|
|
|
|
paramStr.FormatInto(strFormat, args);
|
|
|
|
paramStr.Append('\n');
|
|
|
|
Write(paramStr.Ptr, paramStr.Length);
|
|
|
|
}*/
|
|
|
|
|
|
|
|
[NoReturn]
|
|
|
|
public static void FatalError(String str = "")
|
|
|
|
{
|
|
|
|
Internal.FatalError(str, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|