FlightGear next
FGNasalSys Class Reference

#include <NasalSys.hxx>

Inherits SGSubsystem.

Public Member Functions

 FGNasalSys ()
 
virtual ~FGNasalSys ()
 
void init () override
 
void shutdown () override
 
void update (double dt) override
 
bool loadModule (SGPath file, const char *moduleName)
 
bool parseAndRun (const std::string &source)
 
bool parseAndRunWithOutput (const std::string &source, std::string &output, std::string &errors)
 
void setTimer (naContext c, int argc, naRef *args)
 
naRef setListener (naContext c, int argc, naRef *args)
 
naRef removeListener (naContext c, int argc, naRef *args)
 
naRef cmdArgGhost ()
 
void setCmdArg (SGPropertyNode *aNode)
 
naRef wrappedPropsNode (SGPropertyNode *aProps)
 create Nasal props.Node for an SGPropertyNode* This is the actual ghost, wrapped in a Nasal sugar class.
 
virtual bool handleCommand (const char *moduleName, const char *fileName, const char *src, const SGPropertyNode *arg=0, SGPropertyNode *root=0)
 
virtual bool handleCommand (const SGPropertyNode *arg, SGPropertyNode *root)
 
bool createModule (const char *moduleName, const char *fileName, const char *src, int len, const SGPropertyNode *cmdarg=0, int argc=0, naRef *args=0)
 
void deleteModule (const char *moduleName)
 
naRef getModule (const std::string &moduleName) const
 
naRef getModule (const char *moduleName)
 
bool addCommand (naRef func, const std::string &name)
 
bool removeCommand (const std::string &name)
 
void hashset (naRef hash, const char *key, naRef val)
 Set member of specified hash to given value.
 
void globalsSet (const char *key, naRef val)
 Set member of globals hash to given value.
 
naRef call (naRef code, int argc, naRef *args, naRef locals)
 
naRef callWithContext (naContext ctx, naRef code, int argc, naRef *args, naRef locals)
 
naRef callMethod (naRef code, naRef self, int argc, naRef *args, naRef locals)
 
naRef callMethodWithContext (naContext ctx, naRef code, naRef self, int argc, naRef *args, naRef locals)
 
naRef propNodeGhost (SGPropertyNode *handle)
 
void registerToLoad (FGNasalModelData *data)
 
void registerToUnload (FGNasalModelData *data)
 
naRef nasalGlobals () const
 
nasal::Hash getGlobals () const
 
int gcSave (naRef r)
 
void gcRelease (int key)
 
bool checkIOrules ()
 Check if IOrules correctly work to limit access from Nasal scripts to the file system.
 
simgear::BufferedLogCallback * log () const
 retrive the associated log object, for displaying log output somewhere (a UI, presumably)
 
string_list getAndClearErrorList ()
 
bool reloadModuleFromFile (const std::string &moduleName)
 

Static Public Member Functions

static const char * staticSubsystemClassId ()
 
static naRef getPropertyValue (naContext c, SGPropertyNode *node)
 Convert the value of an SGPropertyNode to its Nasal representation.
 

Detailed Description

Definition at line 33 of file NasalSys.hxx.

Constructor & Destructor Documentation

◆ FGNasalSys()

FGNasalSys::FGNasalSys ( )

Definition at line 286 of file NasalSys.cxx.

◆ ~FGNasalSys()

FGNasalSys::~FGNasalSys ( )
virtual

Definition at line 354 of file NasalSys.cxx.

Member Function Documentation

◆ addCommand()

bool FGNasalSys::addCommand ( naRef func,
const std::string & name )

Definition at line 1892 of file NasalSys.cxx.

◆ call()

naRef FGNasalSys::call ( naRef code,
int argc,
naRef * args,
naRef locals )

Definition at line 314 of file NasalSys.cxx.

◆ callMethod()

naRef FGNasalSys::callMethod ( naRef code,
naRef self,
int argc,
naRef * args,
naRef locals )

Definition at line 331 of file NasalSys.cxx.

◆ callMethodWithContext()

naRef FGNasalSys::callMethodWithContext ( naContext ctx,
naRef code,
naRef self,
int argc,
naRef * args,
naRef locals )

Definition at line 341 of file NasalSys.cxx.

◆ callWithContext()

naRef FGNasalSys::callWithContext ( naContext ctx,
naRef code,
int argc,
naRef * args,
naRef locals )

Definition at line 319 of file NasalSys.cxx.

◆ checkIOrules()

bool FGNasalSys::checkIOrules ( )

Check if IOrules correctly work to limit access from Nasal scripts to the file system.

Note
Just a simple test is performed to check if access to a path is possible which should never be possible (The actual path refers to a file/folder named 'do-not-access' in the file system root).
See also
http://wiki.flightgear.org/IOrules
Returns
Whether the check was successful.

◆ cmdArgGhost()

naRef FGNasalSys::cmdArgGhost ( )

Definition at line 1046 of file NasalSys.cxx.

◆ createModule()

bool FGNasalSys::createModule ( const char * moduleName,
const char * fileName,
const char * src,
int len,
const SGPropertyNode * cmdarg = 0,
int argc = 0,
naRef * args = 0 )

Definition at line 1506 of file NasalSys.cxx.

◆ deleteModule()

void FGNasalSys::deleteModule ( const char * moduleName)

Definition at line 1558 of file NasalSys.cxx.

◆ gcRelease()

void FGNasalSys::gcRelease ( int key)

Definition at line 1787 of file NasalSys.cxx.

◆ gcSave()

int FGNasalSys::gcSave ( naRef r)

Definition at line 1782 of file NasalSys.cxx.

◆ getAndClearErrorList()

string_list FGNasalSys::getAndClearErrorList ( )

◆ getGlobals()

nasal::Hash FGNasalSys::getGlobals ( ) const

Definition at line 2146 of file NasalSys.cxx.

◆ getModule() [1/2]

naRef FGNasalSys::getModule ( const char * moduleName)

Definition at line 1633 of file NasalSys.cxx.

◆ getModule() [2/2]

naRef FGNasalSys::getModule ( const std::string & moduleName) const

Definition at line 1627 of file NasalSys.cxx.

◆ getPropertyValue()

naRef FGNasalSys::getPropertyValue ( naContext c,
SGPropertyNode * node )
static

Convert the value of an SGPropertyNode to its Nasal representation.

Used by props.Node.getValue internally, but exposed here for other use cases which don't want to create a props.Node wrapper each time.

Definition at line 942 of file nasal-props.cxx.

◆ globalsSet()

void FGNasalSys::globalsSet ( const char * key,
naRef val )

Set member of globals hash to given value.

Definition at line 309 of file NasalSys.cxx.

◆ handleCommand() [1/2]

bool FGNasalSys::handleCommand ( const char * moduleName,
const char * fileName,
const char * src,
const SGPropertyNode * arg = 0,
SGPropertyNode * root = 0 )
virtual

Definition at line 1683 of file NasalSys.cxx.

◆ handleCommand() [2/2]

bool FGNasalSys::handleCommand ( const SGPropertyNode * arg,
SGPropertyNode * root )
virtual

Definition at line 1720 of file NasalSys.cxx.

◆ hashset()

void FGNasalSys::hashset ( naRef hash,
const char * key,
naRef val )

Set member of specified hash to given value.

Definition at line 302 of file NasalSys.cxx.

◆ init()

void FGNasalSys::init ( )
override

Definition at line 1068 of file NasalSys.cxx.

◆ loadModule()

bool FGNasalSys::loadModule ( SGPath file,
const char * moduleName )

Definition at line 1488 of file NasalSys.cxx.

◆ log()

simgear::BufferedLogCallback * FGNasalSys::log ( ) const

retrive the associated log object, for displaying log output somewhere (a UI, presumably)

Definition at line 2136 of file NasalSys.cxx.

◆ nasalGlobals()

naRef FGNasalSys::nasalGlobals ( ) const

Definition at line 2141 of file NasalSys.cxx.

◆ parseAndRun()

bool FGNasalSys::parseAndRun ( const std::string & source)

Definition at line 388 of file NasalSys.cxx.

◆ parseAndRunWithOutput()

bool FGNasalSys::parseAndRunWithOutput ( const std::string & source,
std::string & output,
std::string & errors )

Definition at line 364 of file NasalSys.cxx.

◆ propNodeGhost()

naRef FGNasalSys::propNodeGhost ( SGPropertyNode * handle)

Definition at line 43 of file nasal-props.cxx.

◆ registerToLoad()

void FGNasalSys::registerToLoad ( FGNasalModelData * data)

Definition at line 1880 of file NasalSys.cxx.

◆ registerToUnload()

void FGNasalSys::registerToUnload ( FGNasalModelData * data)

Definition at line 1887 of file NasalSys.cxx.

◆ reloadModuleFromFile()

bool FGNasalSys::reloadModuleFromFile ( const std::string & moduleName)

Definition at line 1592 of file NasalSys.cxx.

◆ removeCommand()

bool FGNasalSys::removeCommand ( const std::string & name)

Definition at line 1904 of file NasalSys.cxx.

◆ removeListener()

naRef FGNasalSys::removeListener ( naContext c,
int argc,
naRef * args )

Definition at line 1865 of file NasalSys.cxx.

◆ setCmdArg()

void FGNasalSys::setCmdArg ( SGPropertyNode * aNode)

Definition at line 1063 of file NasalSys.cxx.

◆ setListener()

naRef FGNasalSys::setListener ( naContext c,
int argc,
naRef * args )

Definition at line 1827 of file NasalSys.cxx.

◆ setTimer()

void FGNasalSys::setTimer ( naContext c,
int argc,
naRef * args )

Definition at line 1742 of file NasalSys.cxx.

◆ shutdown()

void FGNasalSys::shutdown ( )
override

Definition at line 1191 of file NasalSys.cxx.

◆ staticSubsystemClassId()

static const char * FGNasalSys::staticSubsystemClassId ( )
inlinestatic

Definition at line 45 of file NasalSys.hxx.

◆ update()

void FGNasalSys::update ( double dt)
override

Definition at line 1262 of file NasalSys.cxx.

◆ wrappedPropsNode()

naRef FGNasalSys::wrappedPropsNode ( SGPropertyNode * aProps)

create Nasal props.Node for an SGPropertyNode* This is the actual ghost, wrapped in a Nasal sugar class.

Definition at line 1247 of file NasalSys.cxx.


The documentation for this class was generated from the following files: