Commit 6c3e0948 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

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.
parent 8be8bb2f
......@@ -969,8 +969,7 @@ namespace
}
int
process_automaton(const spot::const_parsed_aut_ptr& haut,
const char* filename) override
process_automaton(const spot::const_parsed_aut_ptr& haut) override
{
process_timer timer;
timer.start();
......@@ -1234,7 +1233,8 @@ namespace
++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)
abort_run = true;
......
......@@ -58,8 +58,7 @@ public:
}
virtual int
process_automaton(const spot::const_parsed_aut_ptr& haut,
const char* filename) = 0;
process_automaton(const spot::const_parsed_aut_ptr& haut) = 0;
int process_string(const std::string& input, const char* filename,
int linenum) override
......@@ -68,14 +67,13 @@ public:
loc << filename << ':' << linenum;
std::string locstr = loc.str();
return process_automaton_stream
(spot::automaton_stream_parser(input.c_str(), locstr, opt_parse),
locstr.c_str());
(spot::automaton_stream_parser(input.c_str(), locstr, opt_parse));
}
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;
}
......@@ -119,12 +117,10 @@ public:
}
return process_automaton_stream(spot::automaton_stream_parser(filename,
opt_parse),
filename);
opt_parse));
}
int process_automaton_stream(spot::automaton_stream_parser&& hp,
const char* filename)
int process_automaton_stream(spot::automaton_stream_parser&& hp)
{
int err = 0;
while (!abort_run)
......@@ -135,11 +131,12 @@ public:
if (haut->format_errors(std::cerr))
err = 2;
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)
err = std::max(err, aborted(haut, filename));
err = std::max(err, aborted(haut));
else
process_automaton(haut, filename);
process_automaton(haut);
}
return err;
}
......
......@@ -120,15 +120,14 @@ namespace
}
int
process_automaton(const spot::const_parsed_aut_ptr& haut,
const char* filename) override
process_automaton(const spot::const_parsed_aut_ptr& haut) override
{
process_timer timer;
timer.start();
auto nba = spot::to_generalized_buchi(haut->aut);
auto aut = post.run(nba, nullptr);
timer.stop();
printer.print(aut, timer, nullptr, filename, -1, haut);
printer.print(aut, timer, nullptr, haut->filename.c_str(), -1, haut);
flush_cout();
return 0;
}
......
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