-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.cpp
More file actions
42 lines (34 loc) · 1.08 KB
/
debug.cpp
File metadata and controls
42 lines (34 loc) · 1.08 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
// $Id: debug.cpp,v 1.6 2015-07-02 16:48:18-07 - - $
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
#include "debug.h"
#include "general.h"
vector<bool> debugflags::flags (UCHAR_MAX + 1, false);
void debugflags::setflags (const string& initflags) {
for (const unsigned char flag: initflags) {
if (flag == '@') flags.assign (flags.size(), true);
else flags[flag] = true;
}
// Note that DEBUGF can trace setflags.
if (getflag ('x')) {
string flag_chars;
for (size_t index = 0; index < flags.size(); ++index) {
if (getflag (index)) flag_chars += static_cast<char> (index);
}
DEBUGF ('x', "debugflags::flags = " << flag_chars);
}
}
//
// getflag -
// Check to see if a certain flag is on.
//
bool debugflags::getflag (char flag) {
return flags[static_cast<unsigned char> (flag)];
}
void debugflags::where (char flag, const char* file, int line,
const char* func) {
note() << "DEBUG(" << flag << ") " << file << "[" << line << "] "
<< func << "()" << endl;
}