Commit 727c3516 authored by Alexandre Lewkowicz's avatar Alexandre Lewkowicz
Browse files

common_conv: Parse comma and space separated numbers

* src/bin/, src/bin/common_conv.hh: Here.
parent 78def4f8
......@@ -80,3 +80,21 @@ read_automaton(const char* filename, spot::bdd_dict_ptr& dict)
error(2, 0, "failed to read automaton from %s", filename);
return std::move(p->aut);
to_longs(const char* arg)
std::vector<long> res;
while (*arg)
char* endptr;
long value = strtol(arg, &endptr, 10);
if (endptr == arg)
error(2, 0, "failed to parse '%s' as an integer.", arg);
while (*endptr == ' ' || *endptr == ',')
arg = endptr;
return res;
......@@ -29,6 +29,9 @@ unsigned to_unsigned (const char *s);
float to_float(const char* s);
float to_probability(const char* s);
// Parse the comma or space seperate string of numbers.
std::vector<long> to_longs(const char* s);
read_automaton(const char* filename, spot::bdd_dict_ptr& dict);
Supports Markdown
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