9#include <simgear/math/SGMath.hxx>
11#include <simgear/misc/sg_dir.hxx>
12#include <simgear/misc/sg_path.hxx>
13#include <simgear/nasal/cppbind/NasalHash.hxx>
14#include <simgear/nasal/nasal.h>
15#include <simgear/props/props.hxx>
16#include <simgear/structure/subsystem_mgr.hxx>
17#include <simgear/threads/SGQueue.hxx>
29namespace simgear {
class BufferedLogCallback; }
42 void update(
double dt)
override;
49 bool loadModule(SGPath file,
const char* moduleName);
62 void setTimer(naContext c,
int argc, naRef* args);
65 naRef
setListener(naContext c,
int argc, naRef* args);
83 const SGPropertyNode* arg = 0,
84 SGPropertyNode* root = 0);
85 virtual bool handleCommand(
const SGPropertyNode* arg, SGPropertyNode *root);
87 bool createModule(
const char* moduleName,
const char* fileName,
88 const char* src,
int len,
const SGPropertyNode* cmdarg=0,
89 int argc=0, naRef*args=0);
93 naRef
getModule(
const std::string& moduleName)
const;
102 void hashset(naRef hash,
const char* key, naRef val);
109 naRef
call(naRef code,
int argc, naRef* args, naRef locals);
110 naRef
callWithContext(naContext ctx, naRef code,
int argc, naRef* args, naRef locals);
112 naRef
callMethod(naRef code, naRef self,
int argc, naRef* args, naRef locals);
113 naRef
callMethodWithContext(naContext ctx, naRef code, naRef self,
int argc, naRef* args, naRef locals);
150 simgear::BufferedLogCallback*
log()
const;
166 friend FGNasalModuleListener;
168 void initLogLevelConstants();
170 void loadPropertyScripts();
171 void loadPropertyScripts(SGPropertyNode* n);
172 void loadScriptDirectory(simgear::Dir nasalDir, SGPropertyNode* loadorder,
173 bool excludeUnspecifiedInLoadOrder);
174 void addModule(std::string moduleName, simgear::PathList scripts);
175 static void logError(naContext);
176 naRef parse(naContext ctx,
const char* filename,
const char* buf,
int len,
177 std::string& errors);
178 naRef genPropsModule();
182 void addPersistentTimer(TimerObj* pto);
183 void removePersistentTimer(TimerObj* obj);
189 void handleTimer(NasalTimer* t);
191 static void logNasalStack(naContext context,
string_list& stack);
195 std::unique_ptr<NasalSysPrivate> d;
SGPropertyNode * ghostToPropNode(naRef ref)
Nasal model data container.
simgear::BufferedLogCallback * log() const
retrive the associated log object, for displaying log output somewhere (a UI, presumably)
bool removeCommand(const std::string &name)
naRef removeListener(naContext c, int argc, naRef *args)
void setCmdArg(SGPropertyNode *aNode)
void update(double dt) override
bool createModule(const char *moduleName, const char *fileName, const char *src, int len, const SGPropertyNode *cmdarg=0, int argc=0, naRef *args=0)
void setTimer(naContext c, int argc, naRef *args)
void registerToUnload(FGNasalModelData *data)
naRef call(naRef code, int argc, naRef *args, naRef locals)
naRef callMethod(naRef code, naRef self, int argc, naRef *args, naRef locals)
static naRef getPropertyValue(naContext c, SGPropertyNode *node)
Convert the value of an SGPropertyNode to its Nasal representation.
void deleteModule(const char *moduleName)
static const char * staticSubsystemClassId()
void registerToLoad(FGNasalModelData *data)
void hashset(naRef hash, const char *key, naRef val)
Set member of specified hash to given value.
naRef callWithContext(naContext ctx, naRef code, int argc, naRef *args, naRef locals)
bool addCommand(naRef func, const std::string &name)
bool reloadModuleFromFile(const std::string &moduleName)
naRef nasalGlobals() const
naRef callMethodWithContext(naContext ctx, naRef code, naRef self, int argc, naRef *args, naRef locals)
naRef setListener(naContext c, int argc, naRef *args)
string_list getAndClearErrorList()
naRef getModule(const std::string &moduleName) const
bool checkIOrules()
Check if IOrules correctly work to limit access from Nasal scripts to the file system.
nasal::Hash getGlobals() const
virtual bool handleCommand(const char *moduleName, const char *fileName, const char *src, const SGPropertyNode *arg=0, SGPropertyNode *root=0)
void globalsSet(const char *key, naRef val)
Set member of globals hash to given value.
bool parseAndRunWithOutput(const std::string &source, std::string &output, std::string &errors)
naRef propNodeGhost(SGPropertyNode *handle)
naRef wrappedPropsNode(SGPropertyNode *aProps)
create Nasal props.Node for an SGPropertyNode* This is the actual ghost, wrapped in a Nasal sugar cla...
bool parseAndRun(const std::string &source)
bool loadModule(SGPath file, const char *moduleName)
std::vector< std::string > string_list