4 #include <simgear/misc/sg_path.hxx>
5 #include <simgear/structure/subsystem_mgr.hxx>
6 #include <simgear/nasal/nasal.h>
8 class FGNasalSys : public SGSubsystem
12 virtual ~FGNasalSys();
14 virtual void update(double dt) { /* noop */ }
16 virtual bool handleCommand(const SGPropertyNode* arg);
18 // Simple hook to run arbitrary source code. Returns a bool to
19 // indicate successful execution. Does *not* return any Nasal
20 // values, because handling garbage-collected objects from C space
21 // is deep voodoo and violates the "simple hook" idea.
22 bool parseAndRun(const char* sourceCode);
24 // Implementation of the settimer extension function
25 void setTimer(naRef args);
27 // Returns a ghost wrapper for the current _cmdArg
32 // FGTimer subclass for handling Nasal timer callbacks.
33 // See the implementation of the settimer() extension function for
37 virtual void timerExpired();
43 void loadPropertyScripts();
44 void initModule(const char* moduleName, const char* fileName,
45 const char* src, int len);
46 void readScriptFile(SGPath file, const char* lib);
47 void hashset(naRef hash, const char* key, naRef val);
49 naRef parse(const char* filename, const char* buf, int len);
50 naRef genPropsModule();
51 naRef propNodeGhost(SGPropertyNode* handle);
57 SGPropertyNode* _cmdArg;
59 int _nextTimerHashKey;
62 void handleTimer(NasalTimer* t);
65 #endif // __NASALSYS_HXX