From 9690c2230d2a457fb7e7c755238b97be8cf51c34 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 26 Jul 2017 14:18:46 +0200 Subject: [PATCH] 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. --- bin/common_trans.cc | 18 +++++++++--------- bin/common_trans.hh | 12 ++++++------ bin/ltlcross.cc | 18 +++++++++--------- bin/ltldo.cc | 12 ++++++------ 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/bin/common_trans.cc b/bin/common_trans.cc index 73ebad376..9b029b550 100644 --- a/bin/common_trans.cc +++ b/bin/common_trans.cc @@ -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(name)); @@ -163,7 +163,7 @@ translator_spec::~translator_spec() free(const_cast(cmd)); } -std::vector translators; +std::vector 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 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); diff --git a/bin/common_trans.hh b/bin/common_trans.hh index ac87498da..6054a21d8 100644 --- a/bin/common_trans.hh +++ b/bin/common_trans.hh @@ -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 translators; +extern std::vector tools; struct quoted_string final: public spot::printable_value { diff --git a/bin/ltlcross.cc b/bin/ltlcross.cc index a01473700..7252bd319 100644 --- a/bin/ltlcross.cc +++ b/bin/ltlcross.cc @@ -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 pos(m); std::vector 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); diff --git a/bin/ltldo.cc b/bin/ltldo.cc index 6336a74f1..dfae4a0a6 100644 --- a/bin/ltldo.cc +++ b/bin/ltldo.cc @@ -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);