-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
35 lines (26 loc) · 934 Bytes
/
debug.cpp
File metadata and controls
35 lines (26 loc) · 934 Bytes
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
// $Id: debug.cpp,v 1.12 2018-06-27 14:44:57-07 - - $
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
#include "debug.h"
#include "util.h"
debugflags::flagset debugflags::flags {};
void debugflags::setflags (const string& initflags) {
for (const unsigned char flag: initflags) {
if (flag == '@') flags.set();
else flags.set (flag, true);
}
}
// getflag -
// Check to see if a certain flag is on.
bool debugflags::getflag (char flag) {
// WARNING: Don't TRACE this function or the stack will blow up.
return flags.test (static_cast<unsigned char> (flag));
}
void debugflags::where (char flag, const char* file, int line,
const char* pretty_function) {
cout << execname() << ": DEBUG(" << flag << ") "
<< file << "[" << line << "] " << endl
<< " " << pretty_function << endl;
}