ltl2tgba: Add a --csv-escape option and document CSV I/O.
* src/bin/common_output.cc, src/bin/common_output.hh: (output_formula_checked, aut_stat_printer): New. * src/bin/genltl.cc, src/bin/randltl.cc, src/bin/ltlfilt.cc: Call output_formula_checked() instead of output_formula(). * src/bin/ltl2tgba.cc: Use aut_stat_printer and add option --csv-escape. * doc/org/csv.org: New file to document CSV I/O. * doc/Makefile.am: Add it. * doc/org/ioltl.org, doc/org/ltlfilt.org, doc/org/ltl2tgba.org, doc/org/tools.org: Link to csv.org
This commit is contained in:
parent
0faea814da
commit
846e33b9e5
13 changed files with 399 additions and 39 deletions
|
|
@ -24,18 +24,63 @@
|
|||
|
||||
#include <argp.h>
|
||||
#include "ltlast/formula.hh"
|
||||
#include "tgbaalgos/stats.hh"
|
||||
#include "common_output.hh"
|
||||
|
||||
enum output_format_t { spot_output, spin_output, utf8_output,
|
||||
lbt_output, wring_output, latex_output };
|
||||
extern output_format_t output_format;
|
||||
extern bool full_parenth;
|
||||
extern bool escape_csv;
|
||||
|
||||
extern const struct argp output_argp;
|
||||
|
||||
int parse_opt_output(int key, char* arg, struct argp_state* state);
|
||||
|
||||
void output_formula(const spot::ltl::formula* f,
|
||||
void output_formula(std::ostream& os, const spot::ltl::formula* f,
|
||||
const char* filename = 0, int linenum = 0,
|
||||
const char* prefix = 0, const char* suffix = 0);
|
||||
void output_formula_checked(const spot::ltl::formula* f,
|
||||
const char* filename = 0, int linenum = 0,
|
||||
const char* prefix = 0, const char* suffix = 0);
|
||||
|
||||
|
||||
class printable_formula:
|
||||
public spot::printable_value<const spot::ltl::formula*>
|
||||
{
|
||||
public:
|
||||
printable_formula&
|
||||
operator=(const spot::ltl::formula* new_val)
|
||||
{
|
||||
val_ = new_val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual void
|
||||
print(std::ostream& os, const char*) const
|
||||
{
|
||||
output_formula(os, val_);
|
||||
}
|
||||
};
|
||||
|
||||
class aut_stat_printer: protected spot::stat_printer
|
||||
{
|
||||
public:
|
||||
aut_stat_printer(std::ostream& os, const char* format)
|
||||
: spot::stat_printer(os, format)
|
||||
{
|
||||
declare('f', &formula_); // Override the formula printer.
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
print(const spot::tgba* aut, const spot::ltl::formula* f = 0,
|
||||
double run_time = -1.)
|
||||
{
|
||||
formula_ = f;
|
||||
return this->spot::stat_printer::print(aut, f, run_time);
|
||||
}
|
||||
|
||||
printable_formula formula_;
|
||||
};
|
||||
|
||||
#endif // SPOT_BIN_COMMON_OUTPUT_HH
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue