- Debug mode can now be disabled.
This commit is contained in:
Paul Beckingham 2014-05-11 10:15:10 -04:00
parent 567f242e6d
commit a97ce45cdf
4 changed files with 14 additions and 10 deletions

View file

@ -201,9 +201,9 @@ void Eval::ambiguity (bool value)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Eval::debug () void Eval::debug (bool value)
{ {
_debug = true; _debug = value;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View file

@ -47,7 +47,7 @@ public:
void compileExpression (const std::string&); void compileExpression (const std::string&);
void evaluateCompiledExpression (Variant&); void evaluateCompiledExpression (Variant&);
void ambiguity (bool); void ambiguity (bool);
void debug (); void debug (bool);
static void getOperators (std::vector <std::string>&); static void getOperators (std::vector <std::string>&);

View file

@ -92,10 +92,12 @@ void Filter::subset (const std::vector <Task>& input, std::vector <Task>& output
Eval eval; Eval eval;
eval.addSource (namedDates); eval.addSource (namedDates);
eval.addSource (domSource); eval.addSource (domSource);
eval.compileExpression (filterExpr);
if (context.config.getBoolean ("debug")) // Debug output from Eval during compilation is useful. During evaluation
eval.debug (); // it is mostly noise.
eval.debug (context.config.getBoolean ("debug"));
eval.compileExpression (filterExpr);
eval.debug (false);
std::vector <Task>::const_iterator task; std::vector <Task>::const_iterator task;
for (task = input.begin (); task != input.end (); ++task) for (task = input.begin (); task != input.end (); ++task)
@ -147,10 +149,12 @@ void Filter::subset (std::vector <Task>& output)
Eval eval; Eval eval;
eval.addSource (namedDates); eval.addSource (namedDates);
eval.addSource (domSource); eval.addSource (domSource);
eval.compileExpression (filterExpr);
if (context.config.getBoolean ("debug")) // Debug output from Eval during compilation is useful. During evaluation
eval.debug (); // it is mostly noise.
eval.debug (context.config.getBoolean ("debug"));
eval.compileExpression (filterExpr);
eval.debug (false);
output.clear (); output.clear ();
std::vector <Task>::const_iterator task; std::vector <Task>::const_iterator task;

View file

@ -120,7 +120,7 @@ int main (int argc, char** argv)
exit (1); exit (1);
} }
else if (!strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug")) else if (!strcmp (argv[i], "-d") || !strcmp (argv[i], "--debug"))
e.debug (); e.debug (true);
else if (!strcmp (argv[i], "-i") || !strcmp (argv[i], "--infix")) else if (!strcmp (argv[i], "-i") || !strcmp (argv[i], "--infix"))
infix = true; infix = true;
else if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "--postfix")) else if (!strcmp (argv[i], "-p") || !strcmp (argv[i], "--postfix"))