class FGNasalScript;
class FGNasalListener;
-
+class SGCondition;
/** Nasal model data container.
* load and unload methods must be run in main thread (not thread-safe). */
SGSharedPtr<FGNasalModelData> _data;
};
+SGPropertyNode* ghostToPropNode(naRef ref);
+SGCondition* conditionGhost(naRef r);
+
class FGNasalSys : public SGSubsystem
{
public:
naRef cmdArgGhost();
// Callbacks for command and timer bindings
+ virtual bool handleCommand( const char* moduleName,
+ const char* fileName,
+ const char* src,
+ const SGPropertyNode* arg = 0 );
virtual bool handleCommand(const SGPropertyNode* arg);
bool createModule(const char* moduleName, const char* fileName,
void deleteModule(const char* moduleName);
+ /**
+ * Set member of specified hash to given value
+ */
+ void hashset(naRef hash, const char* key, naRef val);
+
+ /**
+ * Set member of globals hash to given value
+ */
+ void globalsSet(const char* key, naRef val);
+
naRef call(naRef code, int argc, naRef* args, naRef locals);
+
+ naRef callMethod(naRef code, naRef self, int argc, naRef* args, naRef locals);
+
naRef propNodeGhost(SGPropertyNode* handle);
-
+
void registerToLoad(FGNasalModelData* data) { _loadList.push(data);}
void registerToUnload(FGNasalModelData* data) { _unloadList.push(data);}
+ // can't call this 'globals' due to naming clash
+ naRef nasalGlobals() const
+ { return _globals; }
+
+ naContext context() const
+ { return _context; }
+
+ // This mechanism is here to allow naRefs to be passed to
+ // locations "outside" the interpreter. Normally, such a
+ // reference would be garbage collected unexpectedly. By passing
+ // it to gcSave and getting a key/handle, it can be cached in a
+ // globals.__gcsave hash. Be sure to release it with gcRelease
+ // when done.
+ int gcSave(naRef r);
+ void gcRelease(int key);
private:
friend class FGNasalScript;
friend class FGNasalListener;
void loadPropertyScripts(SGPropertyNode* n);
void loadScriptDirectory(simgear::Dir nasalDir);
void addModule(string moduleName, simgear::PathList scripts);
- void hashset(naRef hash, const char* key, naRef val);
void logError(naContext);
naRef parse(const char* filename, const char* buf, int len);
naRef genPropsModule();
- // This mechanism is here to allow naRefs to be passed to
- // locations "outside" the interpreter. Normally, such a
- // reference would be garbage collected unexpectedly. By passing
- // it to gcSave and getting a key/handle, it can be cached in a
- // globals.__gcsave hash. Be sure to release it with gcRelease
- // when done.
- int gcSave(naRef r);
- void gcRelease(int key);
-
naContext _context;
- naRef _globals;
+ naRef _globals,
+ _string;
SGPropertyNode_ptr _cmdArg;