#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/nasal/nasal.h>
#include <simgear/scene/model/model.hxx>
+#include <simgear/xml/easyxml.hxx>
#include <map>
SG_USING_STD(map);
FGNasalScript* parseScript(const char* src, const char* name=0);
// Implementation of the settimer extension function
- void setTimer(int argc, naRef* args);
+ void setTimer(naContext c, int argc, naRef* args);
// Implementation of the setlistener extension function
naRef setListener(naContext c, int argc, naRef* args);
SGConstPropertyNode_ptr _unload;
};
+
+class NasalXMLVisitor : public XMLVisitor {
+public:
+ NasalXMLVisitor(naContext c, int argc, naRef* args);
+ virtual ~NasalXMLVisitor() { naFreeContext(_c); }
+
+ virtual void startElement(const char* tag, const XMLAttributes& a);
+ virtual void endElement(const char* tag);
+ virtual void data(const char* str, int len);
+ virtual void pi(const char* target, const char* data);
+
+private:
+ void call(naRef func, int num, naRef a = naNil(), naRef b = naNil());
+ naRef make_string(const char* s, int n = -1);
+
+ naContext _c;
+ naRef _start_element, _end_element, _data, _pi;
+};
+
#endif // __NASALSYS_HXX