Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
727c3516
Commit
727c3516
authored
Feb 12, 2015
by
Alexandre Lewkowicz
Browse files
common_conv: Parse comma and space separated numbers
* src/bin/common_conv.cc, src/bin/common_conv.hh: Here.
parent
78def4f8
Changes
2
Show whitespace changes
Inline
Side-by-side
src/bin/common_conv.cc
View file @
727c3516
...
...
@@ -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
);
}
std
::
vector
<
long
>
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
);
res
.
push_back
(
value
);
while
(
*
endptr
==
' '
||
*
endptr
==
','
)
++
endptr
;
arg
=
endptr
;
}
return
res
;
}
src/bin/common_conv.hh
View file @
727c3516
...
...
@@ -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
);
spot
::
tgba_digraph_ptr
read_automaton
(
const
char
*
filename
,
spot
::
bdd_dict_ptr
&
dict
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment