Commit 3d053053 authored by Ian Bell's avatar Ian Bell
Browse files

REFORM DEB_out. Some corrections to indenting code.

Added recommeded system stream piping sysntax to quad_mesher_debug_options.txt. 
No changes to ReForm performance other than DEB_out.

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 10483]
parent 0564a0a6
......@@ -97,8 +97,8 @@ public:
class DebEnter
{
public:
int id_;
int count_;
int id_; /*!< Unique identifier for this DebEnter (used in ANCHORS) */
int count_; /*!< deb_enter_count for this function. */
int deb_outs_; /*!< Number of DEB_outs encountered within this function
determining whether a given DEB_out should include or omit
a call stack or exit trace. */
......
......@@ -230,6 +230,9 @@ private:
int num_flush_;
int priority_; // Last permission granted
int indent_size_;
bool at_line_start_;
std::string current_;
std::string output_;
std::string file_name_;
......@@ -278,20 +281,21 @@ public:
}
void indent()
void indent(bool _full_text)
{
std::string str;
if (call_stack().indent(str, this, is_html()))
if (call_stack().indent(str, this, _full_text && is_html()))
current_.append(str);
}
void line_break(bool _with_indent = true)
void line_break(bool _with_indent = false)
{
if ( is_html() ) current_.append("<br>"); // Don't bother with matching </br>
current_.append("\n", 1);
if (_with_indent) indent();
if (_with_indent) indent(false);
else at_line_start_ = true;
}
......@@ -311,6 +315,13 @@ public:
return;
}
if (at_line_start_)
{
indent( true);
at_line_start_ = false;
}
if ( is_html() )
{ // translate the esoteric characters used in IGM DEB_out
......@@ -373,10 +384,10 @@ public:
{
switch(_co.com()) {
case DebCommand::end :
if (is_html()) print("</FONT>", false);
if (is_html()) print_direct("</FONT>");
break;
case DebCommand::end_lf :
if (is_html()) print("</FONT>", false);
if (is_html()) print_direct("</FONT>");
line_break();
break;
}
......@@ -633,8 +644,7 @@ public:
bool is_at_line_start()
{
char prev = prev_char();
return (prev=='\n') || (prev=='\0');
return at_line_start_;
}
......@@ -646,6 +656,7 @@ public:
{
set_file_name(_file_name);
indent_size_ = 3;
at_line_start_ = false; // Don't want to indent header
// indent_string_ = ".";
set_module_color("PARA", 0xFF8000);
set_module_color("SOLV", 0x00FF00);
......@@ -703,12 +714,13 @@ DebStream& DebEnter::stream(const int _warn, const bool _print)
char buffer[256];
sprintf_s(buffer, sizeof(buffer),"<FONT COLOR=\"#%06X\" SIZE=%i>",
col, impl->priority()+1 );
ds.print(buffer, false);
impl->print_direct(buffer);
}
if ( deb_outs_ < 1)
{
// First DEB_out in this function so output callstack, and flush.
impl->indent(true);
std::string str;
bool is_html = impl->is_html();
if (is_html)
......@@ -723,17 +735,10 @@ DebStream& DebEnter::stream(const int _warn, const bool _print)
impl->call_stack().get(str);
if (is_html) str.append("</u></FONT>");
str.append("\n");
ds.print(str.c_str(), false); // Don't fork callstack to cerr etc.
impl->print_direct(str.c_str()); // Don't fork callstack to cerr etc.
impl->line_break();
ds.dfile()->flush();
}
else
{
if ( impl->is_at_line_start() )
{
impl->indent();
}
}
++deb_outs_;
}
......@@ -805,7 +810,9 @@ bool CallStack::indent(std::string& _str, DebFile * _dfile, const bool is_html)
_str.append(buffer);
}
int num = (int)calls_.size();
for (int i =0; i< num; ++i)
int i0 = 0;
if (!is_html) ++i0; // Don't waste whitespace on first level indent if .txt
for (int i =i0; i< num; ++i)
{
calls_[i].indent(_str, _dfile, is_html);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment