]> git.mxchange.org Git - flightgear.git/blob - src/Scripting/NasalSys.hxx
gcc 2.95 and 3.0 requite handleTimer to be public
[flightgear.git] / src / Scripting / NasalSys.hxx
1 #ifndef __NASALSYS_HXX
2 #define __NASALSYS_HXX
3
4 #include <simgear/misc/sg_path.hxx>
5 #include <simgear/structure/subsystem_mgr.hxx>
6 #include <simgear/nasal/nasal.h>
7
8 class FGNasalSys : public SGSubsystem
9 {
10 public:
11     FGNasalSys();
12     virtual ~FGNasalSys();
13     virtual void init();
14     virtual void update(double dt) { /* noop */ }
15
16     virtual bool handleCommand(const SGPropertyNode* arg);
17
18     // Implementation of the settimer extension function
19     void setTimer(naRef args);
20
21 private:
22     //
23     // FGTimer subclass for handling Nasal timer callbacks.
24     // See the implementation of the settimer() extension function for
25     // more notes.
26     //
27     struct NasalTimer {
28         virtual void timerExpired();
29         naRef handler;
30         int hashKey;
31         FGNasalSys* nasal;
32     };
33
34     void readScriptFile(SGPath file, const char* lib);
35     void hashset(naRef hash, const char* key, naRef val);
36     void logError();
37     naRef parse(const char* filename, const char* buf, int len);
38
39     naContext _context;
40     naRef _globals;
41     naRef _timerHash;
42
43     int _nextTimerHashKey;
44
45 public:
46          void handleTimer(NasalTimer* t);
47 };
48
49 #endif // __NASALSYS_HXX