-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
34 lines (25 loc) · 859 Bytes
/
debug.cpp
File metadata and controls
34 lines (25 loc) · 859 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
// $Id: debug.cpp,v 1.9 2016-01-14 16:16:52-08 - - $
#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* func) {
cout << execname() << ": DEBUG(" << flag << ") "
<< file << "[" << line << "] " << func << "()" << endl;
}