autfilt, dstar2tgba: remove some superfluous arguments

* bin/autfilt.cc, bin/dstar2tgba.cc, bin/common_hoaread.hh: The
filename is stored in the parsed automaton, so do not pass it another
time to the printer.
This commit is contained in:
Alexandre Duret-Lutz 2017-07-26 15:28:41 +02:00
parent 8be8bb2f95
commit 6c3e09489e
3 changed files with 15 additions and 19 deletions

View file

@ -969,8 +969,7 @@ namespace
} }
int int
process_automaton(const spot::const_parsed_aut_ptr& haut, process_automaton(const spot::const_parsed_aut_ptr& haut) override
const char* filename) override
{ {
process_timer timer; process_timer timer;
timer.start(); timer.start();
@ -1234,7 +1233,8 @@ namespace
++match_count; ++match_count;
printer.print(aut, timer, nullptr, filename, -1, haut, prefix, suffix); printer.print(aut, timer, nullptr, haut->filename.c_str(), -1,
haut, prefix, suffix);
if (opt_max_count >= 0 && match_count >= opt_max_count) if (opt_max_count >= 0 && match_count >= opt_max_count)
abort_run = true; abort_run = true;

View file

@ -58,8 +58,7 @@ public:
} }
virtual int virtual int
process_automaton(const spot::const_parsed_aut_ptr& haut, process_automaton(const spot::const_parsed_aut_ptr& haut) = 0;
const char* filename) = 0;
int process_string(const std::string& input, const char* filename, int process_string(const std::string& input, const char* filename,
int linenum) override int linenum) override
@ -68,14 +67,13 @@ public:
loc << filename << ':' << linenum; loc << filename << ':' << linenum;
std::string locstr = loc.str(); std::string locstr = loc.str();
return process_automaton_stream return process_automaton_stream
(spot::automaton_stream_parser(input.c_str(), locstr, opt_parse), (spot::automaton_stream_parser(input.c_str(), locstr, opt_parse));
locstr.c_str());
} }
int int
aborted(const spot::const_parsed_aut_ptr& h, const char* filename) aborted(const spot::const_parsed_aut_ptr& h)
{ {
std::cerr << filename << ':' << h->loc << ": aborted input automaton\n"; std::cerr << h->filename << ':' << h->loc << ": aborted input automaton\n";
return 2; return 2;
} }
@ -119,12 +117,10 @@ public:
} }
return process_automaton_stream(spot::automaton_stream_parser(filename, return process_automaton_stream(spot::automaton_stream_parser(filename,
opt_parse), opt_parse));
filename);
} }
int process_automaton_stream(spot::automaton_stream_parser&& hp, int process_automaton_stream(spot::automaton_stream_parser&& hp)
const char* filename)
{ {
int err = 0; int err = 0;
while (!abort_run) while (!abort_run)
@ -135,11 +131,12 @@ public:
if (haut->format_errors(std::cerr)) if (haut->format_errors(std::cerr))
err = 2; err = 2;
if (!haut->aut) if (!haut->aut)
error(2, 0, "failed to read automaton from %s", filename); error(2, 0, "failed to read automaton from %s",
haut->filename.c_str());
else if (haut->aborted) else if (haut->aborted)
err = std::max(err, aborted(haut, filename)); err = std::max(err, aborted(haut));
else else
process_automaton(haut, filename); process_automaton(haut);
} }
return err; return err;
} }

View file

@ -120,15 +120,14 @@ namespace
} }
int int
process_automaton(const spot::const_parsed_aut_ptr& haut, process_automaton(const spot::const_parsed_aut_ptr& haut) override
const char* filename) override
{ {
process_timer timer; process_timer timer;
timer.start(); timer.start();
auto nba = spot::to_generalized_buchi(haut->aut); auto nba = spot::to_generalized_buchi(haut->aut);
auto aut = post.run(nba, nullptr); auto aut = post.run(nba, nullptr);
timer.stop(); timer.stop();
printer.print(aut, timer, nullptr, filename, -1, haut); printer.print(aut, timer, nullptr, haut->filename.c_str(), -1, haut);
flush_cout(); flush_cout();
return 0; return 0;
} }