From 9e751bb8c0cdf771d34c839cb6591d892b8e62de Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 7 Mar 2017 01:41:48 -0800 Subject: 3761 --- html/003trace.cc.html | 127 +++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 63 deletions(-) (limited to 'html/003trace.cc.html') diff --git a/html/003trace.cc.html b/html/003trace.cc.html index 6aadb6cc..21005a48 100644 --- a/html/003trace.cc.html +++ b/html/003trace.cc.html @@ -16,13 +16,14 @@ a { text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } .Constant { color: #00a0a0; } -.cSpecial { color: #008000; } +.Conceal { color: #4e4e4e; } .Comment { color: #9090ff; } .Delimiter { color: #800080; } .LineNr { color: #444444; } .Identifier { color: #c0a020; } .Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } .PreProc { color: #800080; } +.cSpecial { color: #008000; } --> @@ -165,15 +166,15 @@ if ('onhashchange' in window) { 106 ~trace_stream() { if (curr_stream) delete curr_stream; } 107 108 ostream& stream(string label) { -109 return stream(Max_depth, label); +109 ¦ return stream(Max_depth, label); 110 } 111 112 ostream& stream(int depth, string label) { -113 if (depth > collect_depth) return null_stream; -114 curr_stream = new ostringstream; -115 curr_label = label; -116 curr_depth = depth; -117 return *curr_stream; +113 ¦ if (depth > collect_depth) return null_stream; +114 ¦ curr_stream = new ostringstream; +115 ¦ curr_label = label; +116 ¦ curr_depth = depth; +117 ¦ return *curr_stream; 118 } 119 120 // be sure to call this before messing with curr_stream or curr_label @@ -187,11 +188,11 @@ if ('onhashchange' in window) { 128 if (!curr_stream) return; 129 string curr_contents = curr_stream->str(); 130 if (!curr_contents.empty()) { -131 past_lines.push_back(trace_line(curr_depth, trim(curr_label), curr_contents)); // preserve indent in contents -132 if ((!Hide_errors && curr_label == "error") -133 || Dump_trace -134 || (!Dump_label.empty() && curr_label == Dump_label)) -135 cerr << curr_label << ": " << curr_contents << '\n'; +131 ¦ past_lines.push_back(trace_line(curr_depth, trim(curr_label), curr_contents)); // preserve indent in contents +132 ¦ if ((!Hide_errors && curr_label == "error") +133 ¦ ¦ ¦ || Dump_trace +134 ¦ ¦ ¦ || (!Dump_label.empty() && curr_label == Dump_label)) +135 ¦ ¦ cerr << curr_label << ": " << curr_contents << '\n'; 136 } 137 delete curr_stream; 138 curr_stream = NULL; @@ -203,9 +204,9 @@ if ('onhashchange' in window) { 144 ostringstream output; 145 label = trim(label); 146 for (vector<trace_line>::iterator p = past_lines.begin(); p != past_lines.end(); ++p) -147 if (label.empty() || label == p->label) { -148 output << std::setw(4) << p->depth << ' ' << p->label << ": " << p->contents << '\n'; -149 } +147 ¦ if (label.empty() || label == p->label) { +148 ¦ ¦ output << std::setw(4) << p->depth << ' ' << p->label << ": " << p->contents << '\n'; +149 ¦ } 150 return output.str(); 151 } 152 @@ -262,9 +263,9 @@ if ('onhashchange' in window) { 203 lease_tracer::~lease_tracer() { 204 if (!Trace_stream) return; // in case tests close Trace_stream 205 if (Save_trace) { -206 ofstream fout("last_trace"); -207 fout << Trace_stream->readable_contents(""); -208 fout.close(); +206 ¦ ofstream fout("last_trace"); +207 ¦ fout << Trace_stream->readable_contents(""); +208 ¦ fout.close(); 209 } 210 delete Trace_stream, Trace_stream = NULL; 211 } @@ -279,19 +280,19 @@ if ('onhashchange' in window) { 220 #define CHECK_TRACE_CONTAINS_ERRORS() CHECK(trace_contains_errors()) 221 #define CHECK_TRACE_DOESNT_CONTAIN_ERRORS() \ 222 if (Passed && trace_contains_errors()) { \ -223 cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \ -224 DUMP("error"); \ -225 Passed = false; \ -226 return; \ +223 ¦ cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): unexpected errors\n"; \ +224 ¦ DUMP("error"); \ +225 ¦ Passed = false; \ +226 ¦ return; \ 227 } 228 229 #define CHECK_TRACE_COUNT(label, count) \ 230 if (Passed && trace_count(label) != (count)) { \ -231 cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): trace_count of " << label << " should be " << count << '\n'; \ -232 cerr << " got " << trace_count(label) << '\n'; /* multiple eval */ \ -233 DUMP(label); \ -234 Passed = false; \ -235 return; /* Currently we stop at the very first failure. */ \ +231 ¦ cerr << "\nF - " << __FUNCTION__ << "(" << __FILE__ << ":" << __LINE__ << "): trace_count of " << label << " should be " << count << '\n'; \ +232 ¦ cerr << " got " << trace_count(label) << '\n'; /* multiple eval */ \ +233 ¦ DUMP(label); \ +234 ¦ Passed = false; \ +235 ¦ return; /* Currently we stop at the very first failure. */ \ 236 } 237 238 #define CHECK_TRACE_DOESNT_CONTAIN(...) CHECK(trace_doesnt_contain(__VA_ARGS__)) @@ -303,27 +304,27 @@ if ('onhashchange' in window) { 244 vector<string> expected_lines = split(expected, "^D"); 245 int curr_expected_line = 0; 246 while (curr_expected_line < SIZE(expected_lines) && expected_lines.at(curr_expected_line).empty()) -247 ++curr_expected_line; +247 ¦ ++curr_expected_line; 248 if (curr_expected_line == SIZE(expected_lines)) return true; 249 string label, contents; 250 split_label_contents(expected_lines.at(curr_expected_line), &label, &contents); 251 for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { -252 if (label != p->label) continue; -253 if (contents != trim(p->contents)) continue; -254 ++curr_expected_line; -255 while (curr_expected_line < SIZE(expected_lines) && expected_lines.at(curr_expected_line).empty()) -256 ++curr_expected_line; -257 if (curr_expected_line == SIZE(expected_lines)) return true; -258 split_label_contents(expected_lines.at(curr_expected_line), &label, &contents); +252 ¦ if (label != p->label) continue; +253 ¦ if (contents != trim(p->contents)) continue; +254 ¦ ++curr_expected_line; +255 ¦ while (curr_expected_line < SIZE(expected_lines) && expected_lines.at(curr_expected_line).empty()) +256 ¦ ¦ ++curr_expected_line; +257 ¦ if (curr_expected_line == SIZE(expected_lines)) return true; +258 ¦ split_label_contents(expected_lines.at(curr_expected_line), &label, &contents); 259 } 260 261 if (line_exists_anywhere(label, contents)) { -262 cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): line [" << label << ": " << contents << "] out of order in trace:\n"; -263 DUMP(""); +262 ¦ cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): line [" << label << ": " << contents << "] out of order in trace:\n"; +263 ¦ DUMP(""); 264 } 265 else { -266 cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): missing [" << contents << "] in trace:\n"; -267 DUMP(label); +266 ¦ cerr << "\nF - " << FUNCTION << "(" << FILE << ":" << LINE << "): missing [" << contents << "] in trace:\n"; +267 ¦ DUMP(label); 268 } 269 Passed = false; 270 return false; @@ -333,19 +334,19 @@ if ('onhashchange' in window) { 274 static const string delim(": "); 275 size_t pos = s.find(delim); 276 if (pos == string::npos) { -277 *label = ""; -278 *contents = trim(s); +277 ¦ *label = ""; +278 ¦ *contents = trim(s); 279 } 280 else { -281 *label = trim(s.substr(0, pos)); -282 *contents = trim(s.substr(pos+SIZE(delim))); +281 ¦ *label = trim(s.substr(0, pos)); +282 ¦ *contents = trim(s.substr(pos+SIZE(delim))); 283 } 284 } 285 286 bool line_exists_anywhere(const string& label, const string& contents) { 287 for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { -288 if (label != p->label) continue; -289 if (contents == trim(p->contents)) return true; +288 ¦ if (label != p->label) continue; +289 ¦ if (contents == trim(p->contents)) return true; 290 } 291 return false; 292 } @@ -358,10 +359,10 @@ if ('onhashchange' in window) { 299 if (!Trace_stream) return 0; 300 long result = 0; 301 for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { -302 if (label == p->label) { -303 if (line == "" || trim(line) == trim(p->contents)) -304 ++result; -305 } +302 ¦ if (label == p->label) { +303 ¦ ¦ if (line == "" || trim(line) == trim(p->contents)) +304 ¦ ¦ ¦ ++result; +305 ¦ } 306 } 307 return result; 308 } @@ -370,10 +371,10 @@ if ('onhashchange' in window) { 311 if (!Trace_stream) return 0; 312 long result = 0; 313 for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) { -314 if (label == p->label) { -315 if (starts_with(trim(p->contents), trim(prefix))) -316 ++result; -317 } +314 ¦ if (label == p->label) { +315 ¦ ¦ if (starts_with(trim(p->contents), trim(prefix))) +316 ¦ ¦ ¦ ++result; +317 ¦ } 318 } 319 return result; 320 } @@ -391,13 +392,13 @@ if ('onhashchange' in window) { 332 vector<string> result; 333 size_t begin=0, end=s.find(delim); 334 while (true) { -335 if (end == string::npos) { -336 result.push_back(string(s, begin, string::npos)); -337 break; -338 } -339 result.push_back(string(s, begin, end-begin)); -340 begin = end+SIZE(delim); -341 end = s.find(delim, begin); +335 ¦ if (end == string::npos) { +336 ¦ ¦ result.push_back(string(s, begin, string::npos)); +337 ¦ ¦ break; +338 ¦ } +339 ¦ result.push_back(string(s, begin, end-begin)); +340 ¦ begin = end+SIZE(delim); +341 ¦ end = s.find(delim, begin); 342 } 343 return result; 344 } @@ -407,19 +408,19 @@ if ('onhashchange' in window) { 348 size_t end=s.find(delim); 349 result.push_back(string(s, 0, end)); 350 if (end != string::npos) -351 result.push_back(string(s, end+SIZE(delim), string::npos)); +351 ¦ result.push_back(string(s, end+SIZE(delim), string::npos)); 352 return result; 353 } 354 355 string trim(const string& s) { 356 string::const_iterator first = s.begin(); 357 while (first != s.end() && isspace(*first)) -358 ++first; +358 ¦ ++first; 359 if (first == s.end()) return ""; 360 361 string::const_iterator last = --s.end(); 362 while (last != s.begin() && isspace(*last)) -363 --last; +363 ¦ --last; 364 ++last; 365 return string(first, last); 366 } -- cgit 1.4.1-2-gfad0