Commit ff134eb8 authored by Guillaume Sadegh's avatar Guillaume Sadegh
Browse files

2008-05-29 Guillaume SADEGH <sadegh@lrde.epita.fr>

   * Makefile.am, nips.cc, nips.hh: Fix the previous patch.
parent a48a10e8
...@@ -35,7 +35,7 @@ libspotnips_la_SOURCES = \ ...@@ -35,7 +35,7 @@ libspotnips_la_SOURCES = \
nips.cc nips.cc
noinst_PROGRAMS = \ noinst_PROGRAMS = \
dottynips dottynips empt_check
dottynips_SOURCES = dottynips.cc dottynips_SOURCES = dottynips.cc
dottynips_LDADD = libspotnips.la $(builddir)/nips_vm/libnipsvm.la dottynips_LDADD = libspotnips.la $(builddir)/nips_vm/libnipsvm.la
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include "misc/hashfunc.hh" #include "misc/hashfunc.hh"
#include "nips.hh" #include "nips.hh"
#include "nipsvm.h"
namespace spot namespace spot
{ {
...@@ -385,7 +386,8 @@ namespace spot ...@@ -385,7 +386,8 @@ namespace spot
if (bytecode_ == 0) if (bytecode_ == 0)
throw nips_exception("bytecode_load_from_file()"); 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); search_error_callback);
if (res != 0) if (res != 0)
...@@ -394,12 +396,21 @@ namespace spot ...@@ -394,12 +396,21 @@ namespace spot
nips_interface::~nips_interface() nips_interface::~nips_interface()
{ {
nipsvm_finalize(&nipsvm_); nipsvm_finalize(nipsvm_);
bytecode_unload(bytecode_); 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() tgba* nips_interface::automaton()
{ {
return new tgba_nips(dict_, &nipsvm_); return new tgba_nips(dict_, nipsvm_);
} }
} }
...@@ -30,9 +30,10 @@ ...@@ -30,9 +30,10 @@
# include "tgba/tgba.hh" # include "tgba/tgba.hh"
# include "common.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 namespace spot
{ {
...@@ -54,10 +55,11 @@ namespace spot ...@@ -54,10 +55,11 @@ namespace spot
public: public:
nips_interface(bdd_dict* dict, const std::string& filename); nips_interface(bdd_dict* dict, const std::string& filename);
~nips_interface(); ~nips_interface();
bool has_monitor() const;
tgba* automaton(); tgba* automaton();
private: private:
bdd_dict* dict_; bdd_dict* dict_;
nipsvm_t nipsvm_; nipsvm_t* nipsvm_;
nipsvm_bytecode_t* bytecode_; nipsvm_bytecode_t* bytecode_;
}; };
} }
......
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