python: implicit str->formula conversion

* python/spot/impl.i, python/spot/__init__.py: Implement it.
* NEWS: Mention it.
* tests/python/atva16-fig2a.ipynb, tests/python/atva16-fig2b.ipynb,
tests/python/formulas.ipynb, tests/python/ltsmin-dve.ipynb,
tests/python/ltsmin-pml.ipynb, tests/python/stutter-inv.ipynb,
doc/org/tut02.org: Modernize.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-15 16:07:14 +02:00
parent 5c1d9c492c
commit 6a808492c1
10 changed files with 168 additions and 210 deletions

View file

@ -365,7 +365,8 @@ namespace swig
// default to None on the Python side.
%typemap(in) spot::formula {
void *tmp;
int res = SWIG_ConvertPtr($input, &tmp, $descriptor(spot::formula*), 0);
int res = SWIG_ConvertPtr($input, &tmp, $descriptor(spot::formula*),
SWIG_POINTER_IMPLICIT_CONV);
if (!SWIG_IsOK(res)) {
%argument_fail(res, "spot::formula", $symname, $argnum);
}
@ -377,9 +378,10 @@ namespace swig
// if tmp == nullptr, then the default value of $1 is fine.
}
%typemap(typecheck) spot::formula {
%typemap(typecheck, precedence=2000) spot::formula {
$1 = SWIG_CheckState(SWIG_ConvertPtr($input, nullptr,
$descriptor(spot::formula*), 0));
$descriptor(spot::formula*),
SWIG_POINTER_IMPLICIT_CONV));
}
%typemap(out) spot::formula {
@ -427,6 +429,7 @@ namespace swig
%include <spot/misc/trival.hh>
%implicitconv std::vector<spot::formula>;
%implicitconv spot::formula;
%include <spot/tl/formula.hh>