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_range.hh"
#include "common_cout.hh"
#include "common_aoutput.hh"
#include "common_conv.hh"
#include "ltlenv/defaultenv.hh"
#include "misc/timer.hh"
@ -115,26 +116,6 @@ static bool opt_state_acc = false;
static bool ba_wanted = false;
static std::unique_ptr<unique_aut_t> opt_uniq = nullptr;
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 float
to_float(const char* s)
{
char* endptr;
float res = strtof(s, &endptr);
if (*endptr)
error(2, 0, "failed to parse '%s' as a float.", s);
return res;
}
static void
ba_options()
{