#include "NasalSys.hxx"
#include "NasalPositioned.hxx"
+#include "NasalCanvas.hxx"
+#include "NasalClipboard.hxx"
+#include "NasalCondition.hxx"
+
#include <Main/globals.hxx>
#include <Main/util.hxx>
#include <Main/fg_props.hxx>
+
using std::map;
static FGNasalSys* nasalSys = 0;
_callCount = 0;
}
+// Utility. Sets a named key in a hash by C string, rather than nasal
+// string object.
+void FGNasalSys::hashset(naRef hash, const char* key, naRef val)
+{
+ naRef s = naNewString(_context);
+ naStr_fromdata(s, (char*)key, strlen(key));
+ naHash_set(hash, s, val);
+}
+
+void FGNasalSys::globalsSet(const char* key, naRef val)
+{
+ hashset(_globals, key, val);
+}
+
naRef FGNasalSys::call(naRef code, int argc, naRef* args, naRef locals)
{
return callMethod(code, naNil(), argc, args, locals);
return script;
}
-// Utility. Sets a named key in a hash by C string, rather than nasal
-// string object.
-void FGNasalSys::hashset(naRef hash, const char* key, naRef val)
-{
- naRef s = naNewString(_context);
- naStr_fromdata(s, (char*)key, strlen(key));
- naHash_set(hash, s, val);
-}
-
// The get/setprop functions accept a *list* of strings and walk
// through the property tree with them to find the appropriate node.
// This allows a Nasal object to hold onto a property path and use it
hashset(_globals, "__gcsave", _gcHash);
initNasalPositioned(_globals, _context, _gcHash);
+ initNasalCanvas(_globals, _context, _gcHash);
+ NasalClipboard::init(this);
+ initNasalCondition(_globals, _context, _gcHash);
// Now load the various source files in the Nasal directory
simgear::Dir nasalDir(SGPath(globals->get_fg_root(), "Nasal"));
void FGNasalSys::update(double)
{
+ if( NasalClipboard::getInstance() )
+ NasalClipboard::getInstance()->update();
+
if(!_dead_listener.empty()) {
vector<FGNasalListener *>::iterator it, end = _dead_listener.end();
for(it = _dead_listener.begin(); it != end; ++it) delete *it;