-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDebug.cpp
More file actions
115 lines (98 loc) · 2.66 KB
/
Debug.cpp
File metadata and controls
115 lines (98 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <stdarg.h>
#include <stdio.h>
#include <Windows.h>
#include "Debug.h"
namespace Aurora
{
// void __trace_w( const wchar_t* format, ... )
// {
// wchar_t* buf = new wchar_t[1024];
// if(NULL == buf) return;
//
// va_list args;
// va_start(args, format);
// ORC_VSPRINTFW(buf, 1024, format, args);
// va_end(args);
//
// PrintConsoleW(buf);
//
// delete[] buf;
// }
void __trace_a( const char* format, ... )
{
// static char buf[1024];
//
// va_list args;
// va_start(args, format);
// #ifdef _WIN32
// vsprintf(buf, format, args);
// #else
// vsnprintf(buf, 1024, format, args);
// #endif
// va_end(args);
//PrintConsoleA(buf);
}
void __custom_assert(const char* description, unsigned int line, const char* function, const char* file/*, bool* bIgnoreAlways*/ )
{
static char temp_t[1024] = {0};
// std::string temp_a;
// #if (ORC_ENCODE == ORC_UNICODE)
// std::wstring temp0;
// str_2_wstr(temp0, function);
// const char_t* tfunction = temp0.c_str();
//
// std::wstring temp1;
// str_2_wstr(temp1, file);
// const char_t* tfile = temp1.c_str();
// ORC_SPRINTFW(temp_t, L"\n所在文件: %s\n所在函数: %s\n所在行数: %d\n错误信息: %s", tfile, tfunction, line, description);
// wstr_2_str(temp_a, temp_t);
// #else
sprintf(temp_t, "\nat file: %s\nat function: %s\nat line: %d\nerror: %s\n", file, function, line, description);
// temp_a = temp_t;
// #endif
::MessageBoxA(nullptr, temp_t, "assert failed!", MB_OK);
_asm
{
int 3;
}
}
bool __assert_a(const char* file, const char* function, unsigned int line, const char* format, ...)
{
static char buf[1024];
va_list args;
va_start(args, format);
vsprintf(buf, format, args);
va_end(args);
// #if ORC_ENCODE == ORC_UNICODE
// string_t dest;
// str_2_wstr(dest, buf);
// __custom_assert(dest.c_str(), line, function, file/*, &bIgnoreAlways*/);
// #else
__custom_assert(buf, line, function, file/*, &bIgnoreAlways*/);
//#endif
return true;
}
// bool __assert_w(const char* file, const char* function, unsigned int line, const wchar_t* format, ...)
// {
// if(!gIgnoreAlways)
// {
// wchar_t* buf = new wchar_t[1024];
// if(NULL == buf) return false;
//
// va_list args;
// va_start(args, format);
// wprintf(buf, format, args);
// va_end(args);
//
// #if ORC_ENCODE != ORC_UNICODE
// string_t dest;
// wstr_2_str(dest, buf);
// __custom_assert(dest.c_str(), line, function, file/*, &bIgnoreAlways*/);
// #else
// __custom_assert(buf, line, function, file/*, &bIgnoreAlways*/);
// #endif
// delete buf;
// }
// return true;
// }
}