Commit 9690c223 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

ltlcross, ltldo: rename "translators" to "tools" in the code

* bin/common_trans.cc, bin/common_trans.hh, bin/ltlcross.cc,
bin/ltldo.cc: Rename translator_spec and translators to tool_spec and
tools, so that we can reuse these structures for automata tools
in a future autcross.
parent 7bfe06b3
......@@ -73,7 +73,7 @@ static void show_shorthands()
}
translator_spec::translator_spec(const char* spec)
tool_spec::tool_spec(const char* spec)
: spec(spec), cmd(spec), name(spec)
{
if (*cmd == '{')
......@@ -134,7 +134,7 @@ translator_spec::translator_spec(const char* spec)
cmd = strdup(cmd);
}
translator_spec::translator_spec(const translator_spec& other)
tool_spec::tool_spec(const tool_spec& other)
: spec(other.spec), cmd(other.cmd), name(other.name)
{
if (cmd != spec)
......@@ -143,7 +143,7 @@ translator_spec::translator_spec(const translator_spec& other)
name = strdup(name);
}
translator_spec& translator_spec::operator=(const translator_spec& other)
tool_spec& tool_spec::operator=(const tool_spec& other)
{
spec = other.spec;
cmd = other.cmd;
......@@ -155,7 +155,7 @@ translator_spec& translator_spec::operator=(const translator_spec& other)
return *this;
}
translator_spec::~translator_spec()
tool_spec::~tool_spec()
{
if (name != spec)
free(const_cast<char*>(name));
......@@ -163,7 +163,7 @@ translator_spec::~translator_spec()
free(const_cast<char*>(cmd));
}
std::vector<translator_spec> translators;
std::vector<tool_spec> tools;
void
quoted_string::print(std::ostream& os, const char*) const
......@@ -296,14 +296,14 @@ translator_runner::translator_runner(spot::bdd_dict_ptr dict,
declare('T', &output);
declare('O', &output);
size_t s = translators.size();
size_t s = tools.size();
assert(s);
for (size_t n = 0; n < s; ++n)
{
// Check that each translator uses at least one input and
// one output.
std::vector<bool> has(256);
const translator_spec& t = translators[n];
const tool_spec& t = tools[n];
scan(t.cmd, has);
if (!(has['f'] || has['s'] || has['l'] || has['w']
|| has['F'] || has['S'] || has['L'] || has['W']))
......@@ -317,7 +317,7 @@ translator_runner::translator_runner(spot::bdd_dict_ptr dict,
error(2, 0, "no output %%-sequence in '%s'.\n Use "
"%%O to indicate where the automaton is output.",
t.spec);
// Remember the %-sequences used by all translators.
// Remember the %-sequences used by all tools.
prime(t.cmd);
}
}
......@@ -675,7 +675,7 @@ static int parse_opt_trans(int key, char* arg, struct argp_state*)
switch (key)
{
case 't':
translators.push_back(arg);
tools.push_back(arg);
break;
case 'T':
timeout = to_pos_int(arg);
......
......@@ -31,7 +31,7 @@
extern const struct argp trans_argp;
extern bool opt_relabel;
struct translator_spec
struct tool_spec
{
// The translator command, as specified on the command-line.
// If this has the form of
......@@ -44,13 +44,13 @@ struct translator_spec
// name of the translator (or spec)
const char* name;
translator_spec(const char* spec);
translator_spec(const translator_spec& other);
translator_spec& operator=(const translator_spec& other);
~translator_spec();
tool_spec(const char* spec);
tool_spec(const tool_spec& other);
tool_spec& operator=(const tool_spec& other);
~tool_spec();
};
extern std::vector<translator_spec> translators;
extern std::vector<tool_spec> tools;
struct quoted_string final: public spot::printable_value<std::string>
{
......
......@@ -423,7 +423,7 @@ parse_opt(int key, char* arg, struct argp_state*)
if (arg[0] == '-' && !arg[1])
jobs.emplace_back(arg, true);
else
translators.push_back(arg);
tools.push_back(arg);
break;
case OPT_AUTOMATA:
opt_automata = true;
......@@ -515,7 +515,7 @@ namespace
output.reset(translator_num);
std::ostringstream command;
format(command, translators[translator_num].cmd);
format(command, tools[translator_num].cmd);
std::string cmd = command.str();
std::cerr << "Running [" << l << translator_num << "]: "
......@@ -985,7 +985,7 @@ namespace
// These store the result of the translation of the positive and
// negative formulas.
size_t m = translators.size();
size_t m = tools.size();
std::vector<spot::twa_graph_ptr> pos(m);
std::vector<spot::twa_graph_ptr> neg(m);
// These store the complement of the above results, when we can
......@@ -1408,7 +1408,7 @@ print_stats_csv(const char* filename)
output_file outf(filename);
std::ostream& out = outf.ostream();
unsigned ntrans = translators.size();
unsigned ntrans = tools.size();
unsigned rounds = vstats.size();
assert(rounds == formulas.size());
......@@ -1427,7 +1427,7 @@ print_stats_csv(const char* filename)
out << '"';
spot::escape_rfc4180(out, formulas[r]);
out << "\",\"";
spot::escape_rfc4180(out, translators[t].name);
spot::escape_rfc4180(out, tools[t].name);
out << "\",";
vstats[r][t].to_csv(out, !opt_omit);
out << '\n';
......@@ -1444,16 +1444,16 @@ print_stats_json(const char* filename)
output_file outf(filename);
std::ostream& out = outf.ostream();
unsigned ntrans = translators.size();
unsigned ntrans = tools.size();
unsigned rounds = vstats.size();
assert(rounds == formulas.size());
out << "{\n \"tool\": [\n \"";
spot::escape_str(out, translators[0].name);
spot::escape_str(out, tools[0].name);
for (unsigned t = 1; t < ntrans; ++t)
{
out << "\",\n \"";
spot::escape_str(out, translators[t].name);
spot::escape_str(out, tools[t].name);
}
out << "\"\n ],\n \"formula\": [\n \"";
spot::escape_str(out, formulas[0]);
......@@ -1495,7 +1495,7 @@ main(int argc, char** argv)
check_no_formula();
if (translators.empty())
if (tools.empty())
error(2, 0, "No translator to run? Run '%s --help' for usage.",
program_name);
......
......@@ -171,7 +171,7 @@ parse_opt(int key, char* arg, struct argp_state*)
if (arg[0] == '-' && !arg[1])
jobs.emplace_back(arg, true);
else
translators.push_back(arg);
tools.push_back(arg);
break;
default:
return ARGP_ERR_UNKNOWN;
......@@ -195,7 +195,7 @@ namespace
output.reset(translator_num);
std::ostringstream command;
format(command, translators[translator_num].cmd);
format(command, tools[translator_num].cmd);
std::string cmd = command.str();
//std::cerr << "Running [" << l << translator_num << "]: "
......@@ -339,7 +339,7 @@ namespace
static unsigned round = 1;
runner.round_formula(f, round);
unsigned ts = translators.size();
unsigned ts = tools.size();
spot::twa_graph_ptr best_aut = nullptr;
std::string best_stats;
std::string best_cmdname;
......@@ -364,7 +364,7 @@ namespace
if (relmap)
relabel_here(aut, relmap.get());
cmdname = translators[t].name;
cmdname = tools[t].name;
aut = post.run(aut, f);
if (best_type)
{
......@@ -377,7 +377,7 @@ namespace
{
best_aut = aut;
best_stats = aut_stats;
best_cmdname = translators[t].name;
best_cmdname = tools[t].name;
best_timer = timer;
}
best_stream.str("");
......@@ -421,7 +421,7 @@ main(int argc, char** argv)
check_no_formula();
if (translators.empty())
if (tools.empty())
error(2, 0, "No translator to run? Run '%s --help' for usage.",
program_name);
......
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