diff --git a/iface/nips/Makefile.am b/iface/nips/Makefile.am index c8db9eca1..1d474c2f4 100644 --- a/iface/nips/Makefile.am +++ b/iface/nips/Makefile.am @@ -35,7 +35,7 @@ libspotnips_la_SOURCES = \ nips.cc noinst_PROGRAMS = \ - dottynips + dottynips empt_check dottynips_SOURCES = dottynips.cc dottynips_LDADD = libspotnips.la $(builddir)/nips_vm/libnipsvm.la diff --git a/iface/nips/nips.cc b/iface/nips/nips.cc index a156f121b..d7f0cbc0b 100644 --- a/iface/nips/nips.cc +++ b/iface/nips/nips.cc @@ -22,6 +22,7 @@ #include #include "misc/hashfunc.hh" #include "nips.hh" +#include "nipsvm.h" namespace spot { @@ -385,7 +386,8 @@ namespace spot if (bytecode_ == 0) throw nips_exception("bytecode_load_from_file()"); - int res = nipsvm_init(&nipsvm_, bytecode_, successor_state_callback, + nipsvm_ = new nipsvm_t(); + int res = nipsvm_init(nipsvm_, bytecode_, successor_state_callback, search_error_callback); if (res != 0) @@ -394,12 +396,21 @@ namespace spot nips_interface::~nips_interface() { - nipsvm_finalize(&nipsvm_); + nipsvm_finalize(nipsvm_); bytecode_unload(bytecode_); + delete nipsvm_; + } + + bool nips_interface::has_monitor() const + { + if (bytecode_ == 0) + throw nips_exception("The bytecode isn't loaded"); + + return bytecode_monitor_present(bytecode_); } tgba* nips_interface::automaton() { - return new tgba_nips(dict_, &nipsvm_); + return new tgba_nips(dict_, nipsvm_); } } diff --git a/iface/nips/nips.hh b/iface/nips/nips.hh index 988a887a9..eff4ebec9 100644 --- a/iface/nips/nips.hh +++ b/iface/nips/nips.hh @@ -30,9 +30,10 @@ # include "tgba/tgba.hh" # include "common.hh" -// Damn, nipsvm.h is include, to fix. -# include "nipsvm.h" +// Fwd declarations. +typedef struct nipsvm_t nipsvm_t; +typedef struct t_bytecode nipsvm_bytecode_t; namespace spot { @@ -54,10 +55,11 @@ namespace spot public: nips_interface(bdd_dict* dict, const std::string& filename); ~nips_interface(); + bool has_monitor() const; tgba* automaton(); private: bdd_dict* dict_; - nipsvm_t nipsvm_; + nipsvm_t* nipsvm_; nipsvm_bytecode_t* bytecode_; }; }