-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathconfig.cpp
More file actions
49 lines (41 loc) · 1.11 KB
/
config.cpp
File metadata and controls
49 lines (41 loc) · 1.11 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
// Copyright Ryan Schmidt 2011.
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
// always build this file in debug mode, so that proper debug functions are defined.
// lgASSERT is enabled/disabled in config.h
//#ifndef _DEBUG
//#define _DEBUG
//#endif
#ifdef WIN32
#include <windows.h>
#include <crtdbg.h>
#endif
#include <cstdlib>
#include <stdio.h>
void lgBreakToDebugger()
{
#ifdef WIN32
DebugBreak();
#else
abort();
#endif
}
int lgAssertReport(const char * filename, int line, const char * message)
{
#ifdef WIN32
#ifdef DEBUG
// return _CrtDbgReportW(_CRT_ASSERT, filename, line, NULL, message);
return _CrtDbgReport(_CRT_ASSERT, filename, line, NULL, message);
#else
char buf[1024];
_snprintf_s(buf, 1024, "lgASSERT FAILED - [%s:%d] - %s\n", filename, line, message);
OutputDebugString(buf);
lgBreakToDebugger();
return 1;
#endif
#else
fprintf(stderr, "lgASSERT FAILED - [%s:%d] - %s\n", filename, line, message);
lgBreakToDebugger();
return 1; // [RMS] is this right?
#endif
}