add deleteModule() method
This commit is contained in:
parent
ed9e16d001
commit
77de0c8e09
2 changed files with 13 additions and 0 deletions
|
@ -500,6 +500,15 @@ void FGNasalSys::createModule(const char* moduleName, const char* fileName,
|
|||
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)
|
||||
{
|
||||
int errLine = -1;
|
||||
|
|
|
@ -54,6 +54,8 @@ public:
|
|||
void createModule(const char* moduleName, const char* fileName,
|
||||
const char* src, int len);
|
||||
|
||||
void deleteModule(const char* moduleName);
|
||||
|
||||
private:
|
||||
friend class FGNasalScript;
|
||||
friend class FGNasalListener;
|
||||
|
@ -101,6 +103,7 @@ private:
|
|||
public: void handleTimer(NasalTimer* t);
|
||||
};
|
||||
|
||||
|
||||
class FGNasalScript {
|
||||
public:
|
||||
~FGNasalScript() { _nas->gcRelease(_gcKey); }
|
||||
|
@ -118,6 +121,7 @@ private:
|
|||
FGNasalSys* _nas;
|
||||
};
|
||||
|
||||
|
||||
class FGNasalListener : public SGPropertyChangeListener {
|
||||
public:
|
||||
FGNasalListener(SGPropertyNode_ptr node, naRef handler,
|
||||
|
|
Loading…
Add table
Reference in a new issue