1
0
Fork 0

add deleteModule() method

This commit is contained in:
mfranz 2006-03-08 10:35:20 +00:00
parent ed9e16d001
commit 77de0c8e09
2 changed files with 13 additions and 0 deletions

View file

@ -500,6 +500,15 @@ void FGNasalSys::createModule(const char* moduleName, const char* fileName,
hashset(_globals, moduleName, locals); hashset(_globals, moduleName, locals);
} }
void FGNasalSys::deleteModule(const char* moduleName)
{
naRef modname = naNewString(_context);
naStr_fromdata(modname, (char*)moduleName, strlen(moduleName));
naModLock();
naHash_delete(_globals, modname);
naModUnlock();
}
naRef FGNasalSys::parse(const char* filename, const char* buf, int len) naRef FGNasalSys::parse(const char* filename, const char* buf, int len)
{ {
int errLine = -1; int errLine = -1;

View file

@ -54,6 +54,8 @@ public:
void createModule(const char* moduleName, const char* fileName, void createModule(const char* moduleName, const char* fileName,
const char* src, int len); const char* src, int len);
void deleteModule(const char* moduleName);
private: private:
friend class FGNasalScript; friend class FGNasalScript;
friend class FGNasalListener; friend class FGNasalListener;
@ -101,6 +103,7 @@ private:
public: void handleTimer(NasalTimer* t); public: void handleTimer(NasalTimer* t);
}; };
class FGNasalScript { class FGNasalScript {
public: public:
~FGNasalScript() { _nas->gcRelease(_gcKey); } ~FGNasalScript() { _nas->gcRelease(_gcKey); }
@ -118,6 +121,7 @@ private:
FGNasalSys* _nas; FGNasalSys* _nas;
}; };
class FGNasalListener : public SGPropertyChangeListener { class FGNasalListener : public SGPropertyChangeListener {
public: public:
FGNasalListener(SGPropertyNode_ptr node, naRef handler, FGNasalListener(SGPropertyNode_ptr node, naRef handler,