bin: factor common conversion functions

* src/bin/common_conv.cc, src/bin/common_conv.hh: New files.
* src/bin/Makefile.am: Add them.
* src/bin/autfilt.cc, src/bin/ltlcross.cc, src/bin/ltlfilt.cc,
src/bin/ltlgrind.cc, src/bin/randaut.cc, src/bin/randltl.cc: Use them.
This commit is contained in:
Alexandre Duret-Lutz 2015-01-24 22:55:57 +01:00
parent 06d1c1ea96
commit d9045d131c
9 changed files with 136 additions and 148 deletions

View file

@ -31,6 +31,7 @@
#include "common_finput.hh"
#include "common_output.hh"
#include "common_cout.hh"
#include "common_conv.hh"
#include "common_r.hh"
#include "misc/hash.hh"
@ -239,25 +240,6 @@ static const spot::ltl::formula* implied_by = 0;
static const spot::ltl::formula* imply = 0;
static const spot::ltl::formula* equivalent_to = 0;
static int
to_int(const char* s)
{
char* endptr;
int res = strtol(s, &endptr, 10);
if (*endptr)
error(2, 0, "failed to parse '%s' as an integer.", s);
return res;
}
static int
to_pos_int(const char* s)
{
int res = to_int(s);
if (res < 0)
error(2, 0, "%d is not positive", res);
return res;
}
static const spot::ltl::formula*
parse_formula_arg(const std::string& input)
{