Report::printLine. no more \n's in print stmts
This commit is contained in:
parent
83ed72cd3a
commit
a005ccb0e2
|
|
@ -38,12 +38,9 @@ public:
|
|||
Report();
|
||||
virtual ~Report();
|
||||
|
||||
// Primitive to print output.
|
||||
// Return the number of characters written.
|
||||
virtual size_t printString(const char *buffer,
|
||||
size_t length);
|
||||
// Print line with return.
|
||||
virtual void reportLine(const char *fmt, ...);
|
||||
virtual void reportLine(const char *fmt, ...)
|
||||
__attribute__((format (printf, 2, 3)));
|
||||
virtual void reportLineString(const char *line);
|
||||
virtual void reportLine(const string &line);
|
||||
|
||||
|
|
@ -114,9 +111,16 @@ public:
|
|||
virtual const char *redirectStringEnd();
|
||||
virtual void setTclInterp(Tcl_Interp *) {}
|
||||
|
||||
// Primitive to print output.
|
||||
// Return the number of characters written.
|
||||
// public for use by ReportTcl encapsulated channel functions.
|
||||
virtual size_t printString(const char *buffer,
|
||||
size_t length);
|
||||
static Report *defaultReport() { return default_; }
|
||||
|
||||
protected:
|
||||
virtual void printLine(const char *line,
|
||||
size_t length);
|
||||
// Primitive to print output on the console.
|
||||
// Return the number of characters written.
|
||||
virtual size_t printConsole(const char *buffer,
|
||||
|
|
@ -129,7 +133,7 @@ protected:
|
|||
...);
|
||||
void printToBufferAppend(const char *fmt,
|
||||
va_list args);
|
||||
void printBuffer();
|
||||
void printBufferLine();
|
||||
void redirectStringPrint(const char *buffer,
|
||||
size_t length);
|
||||
|
||||
|
|
|
|||
|
|
@ -845,14 +845,14 @@ Table1::report(const Units *units,
|
|||
line += unit1->asString(axis1_->axisValue(index1), digits);
|
||||
line += " ";
|
||||
}
|
||||
report->reportLine(line.c_str());
|
||||
report->reportLine(line);
|
||||
|
||||
line.clear();
|
||||
for (size_t index1 = 0; index1 < axis1_->size(); index1++) {
|
||||
line += table_unit->asString(tableValue(index1), digits);
|
||||
line += " ";
|
||||
}
|
||||
report->reportLine(line.c_str());
|
||||
report->reportLine(line);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1036,7 +1036,7 @@ Table2::report(const Units *units,
|
|||
line += unit2->asString(axis2_->axisValue(index2), digits);
|
||||
line += " ";
|
||||
}
|
||||
report->reportLine(line.c_str());
|
||||
report->reportLine(line);
|
||||
|
||||
for (size_t index1 = 0; index1 < axis1_->size(); index1++) {
|
||||
line = unit1->asString(axis1_->axisValue(index1), digits);
|
||||
|
|
@ -1045,7 +1045,7 @@ Table2::report(const Units *units,
|
|||
line += table_unit->asString(tableValue(index1, index2), digits);
|
||||
line += " ";
|
||||
}
|
||||
report->reportLine(line.c_str());
|
||||
report->reportLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1300,7 +1300,7 @@ Table3::report(const Units *units,
|
|||
line += unit3->asString(axis3_->axisValue(index3), digits);
|
||||
line += " ";
|
||||
}
|
||||
report->reportLine(line.c_str());
|
||||
report->reportLine(line);
|
||||
|
||||
for (size_t index2 = 0; index2 < axis2_->size(); index2++) {
|
||||
line = unit2->asString(axis2_->axisValue(index2),digits);
|
||||
|
|
@ -1309,7 +1309,7 @@ Table3::report(const Units *units,
|
|||
line += table_unit->asString(tableValue(index1, index2, index3), digits);
|
||||
line += " ";
|
||||
}
|
||||
report->reportLine(line.c_str());
|
||||
report->reportLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ ReportAnnotated::reportArcs(const char *header,
|
|||
PinSet &pins)
|
||||
{
|
||||
report_->reportLine("");
|
||||
report_->reportLine(header);
|
||||
report_->reportLineString(header);
|
||||
PinSeq sorted_pins;
|
||||
sortPinSet(&pins, network_, sorted_pins);
|
||||
int i = 0;
|
||||
|
|
|
|||
|
|
@ -2784,7 +2784,7 @@ Search::reportTagGroups() const
|
|||
for (TagGroupIndex i = 0; i < tag_group_next_; i++) {
|
||||
TagGroup *tag_group = tag_groups_[i];
|
||||
if (tag_group) {
|
||||
report_->reportLine("Group %4u hash = %4u (%4u)",
|
||||
report_->reportLine("Group %4u hash = %4lu (%4lu)",
|
||||
i,
|
||||
tag_group->hash(),
|
||||
tag_group->hash() % tag_group_set_->capacity());
|
||||
|
|
@ -2792,7 +2792,7 @@ Search::reportTagGroups() const
|
|||
}
|
||||
}
|
||||
size_t long_hash = tag_group_set_->longestBucketHash();
|
||||
report_->reportLine("Longest hash bucket length %lu hash=%lu",
|
||||
report_->reportLine("Longest hash bucket length %d hash=%lu",
|
||||
tag_group_set_->bucketLength(long_hash),
|
||||
long_hash);
|
||||
}
|
||||
|
|
@ -2816,7 +2816,7 @@ Search::reportArrivalCountHistogram() const
|
|||
for (size_t arrival_count = 0; arrival_count < vertex_counts.size(); arrival_count++) {
|
||||
int vertex_count = vertex_counts[arrival_count];
|
||||
if (vertex_count > 0)
|
||||
report_->reportLine("%6d %6d", arrival_count, vertex_count);
|
||||
report_->reportLine("%6lu %6d", arrival_count, vertex_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ void
|
|||
TagGroup::report(const StaState *sta) const
|
||||
{
|
||||
Report *report = sta->report();
|
||||
report->reportLine("Group %u hash = %u", index_, hash_);
|
||||
report->reportLine("Group %u hash = %lu", index_, hash_);
|
||||
arrivalMapReport(arrival_map_, sta);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,8 +112,8 @@ Debug::reportLine(const char *what,
|
|||
report_->printToBuffer(what);
|
||||
report_->printToBufferAppend(": ");
|
||||
report_->printToBufferAppend(fmt, args);
|
||||
report_->printToBufferAppend("\n");
|
||||
report_->printBuffer();
|
||||
report_->printBufferLine();
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -44,6 +44,14 @@ Report::~Report()
|
|||
delete [] buffer_;
|
||||
}
|
||||
|
||||
void
|
||||
Report::printLine(const char *line,
|
||||
size_t length)
|
||||
{
|
||||
printString(line, length);
|
||||
printString("\n", 1);
|
||||
}
|
||||
|
||||
size_t
|
||||
Report::printString(const char *buffer,
|
||||
size_t length)
|
||||
|
|
@ -69,23 +77,20 @@ Report::reportLine(const char *fmt, ...)
|
|||
va_start(args, fmt);
|
||||
std::unique_lock<std::mutex> lock(buffer_lock_);
|
||||
printToBuffer(fmt, args);
|
||||
printString(buffer_, buffer_length_);
|
||||
printString("\n", 1);
|
||||
printBufferLine();
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void
|
||||
Report::reportLineString(const char *line)
|
||||
{
|
||||
printString(line, strlen(line));
|
||||
printString("\n", 1);
|
||||
printLine(line, strlen(line));
|
||||
}
|
||||
|
||||
void
|
||||
Report::reportLine(const string &line)
|
||||
{
|
||||
printString(line.c_str(), line.length());
|
||||
printString("\n", 1);
|
||||
printLine(line.c_str(), line.length());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -137,9 +142,9 @@ Report::printToBufferAppend(const char *fmt,
|
|||
}
|
||||
|
||||
void
|
||||
Report::printBuffer()
|
||||
Report::printBufferLine()
|
||||
{
|
||||
printString(buffer_, buffer_length_);
|
||||
printLine(buffer_, buffer_length_);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -153,8 +158,7 @@ Report::warn(int /* id */,
|
|||
va_start(args, fmt);
|
||||
printToBuffer("Warning: ");
|
||||
printToBufferAppend(fmt, args);
|
||||
printToBufferAppend("\n");
|
||||
printBuffer();
|
||||
printBufferLine();
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
@ -165,8 +169,7 @@ Report::vwarn(int /* id */,
|
|||
{
|
||||
printToBuffer("Warning: ");
|
||||
printToBufferAppend(fmt, args);
|
||||
printToBufferAppend("\n");
|
||||
printBuffer();
|
||||
printBufferLine();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -180,8 +183,7 @@ Report::fileWarn(int /* id */,
|
|||
va_start(args, fmt);
|
||||
printToBuffer("Warning: %s line %d, ", filename, line);
|
||||
printToBufferAppend(fmt, args);
|
||||
printToBufferAppend("\n");
|
||||
printBuffer();
|
||||
printBufferLine();
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
@ -194,8 +196,7 @@ Report::vfileWarn(int /* id */,
|
|||
{
|
||||
printToBuffer("Warning: %s line %d, ", filename, line);
|
||||
printToBufferAppend(fmt, args);
|
||||
printToBufferAppend("\n");
|
||||
printBuffer();
|
||||
printBufferLine();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
@ -262,8 +263,7 @@ Report::critical(int /* id */,
|
|||
va_start(args, fmt);
|
||||
printToBuffer("Critical: ");
|
||||
printToBufferAppend(fmt, args);
|
||||
printToBufferAppend("\n");
|
||||
printBuffer();
|
||||
printBufferLine();
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ Report::fileCritical(int /* id */,
|
|||
va_start(args, fmt);
|
||||
printToBuffer("Critical: %s line %d, ", filename, line, fmt, args);
|
||||
printToBufferAppend(fmt, args);
|
||||
printToBufferAppend("\n");
|
||||
printBufferLine();
|
||||
va_end(args);
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue