artefaktur
software engineer &        architecture

 
 
 
 

class Script

Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::cfgscript::Script Class Reference

#include <Script.h>

Inheritance diagram for acdk::cfgscript::Script:

acdk::lang::Object acdk::lang::ObjectBase acdk::lang::dmi::StdDispatch List of all members.

Detailed Description

Script represents a script file.

Note:
the Script class must not allocated on the stack, because it will register itself as ThreadLocal
See also:
 CfgScript Handbook.


Public Member Functions

 Script (IN(RString) cfgfile, IN(RScript) parentScript=Nil)
 ~Script ()
RString toString ()
 return a string representation of this object Object::toString() return getName() by default

RString getFileName ()
RString getScriptPath ()
RProps getGlobals ()
RScript getParentScript ()
bool useStrict ()
void useStrict (bool use)
short getCastFlags ()
 a combination of acdk::lang::dmi::ScriptVarCastFlags

void setCastFlags (int castFlags)
 a combination of acdk::lang::dmi::ScriptVarCastFlags

int readEval (IN(RProps) props, int flags=PropsParentRead|PropsNoParentWrite)
int eval (IN(RString) text, IN(RProps) props, int flags=ScriptDefaultFlags)
 evaluates a complete script

RDmiObject evalExpr (IN(RString) text, IN(RProps) props, int flags=ScriptDefaultFlags)
 evaluates not a sequence of statements, but a single expression

int evalTemplate (IN(RString) text, IN(RProps) props, int flag=ScriptDefaultFlags)
int evalTemplate (IN(acdk::io::RFile) sourceFile, IN(RProps) props, int flag=ScriptDefaultFlags)
void assert (bool test)
 this method will be called by scripts if the expression is false it write the asserting scripting line to ACDK_NLOG(acdk.cfgscript.Script.assert, Error)

void assertTest (bool test)
 same as assert(bool test) but write an info log entry in case of success

void assertTrue (bool test, IN(RString) msg)
void testAssert (bool test)
void testAssertComment (bool test, IN(RString) msg)
void assertExists (IN(RProps) props, IN(RString) variable)
bool include (IN(RString) fname, bool noDuplicates=true, bool changeDir=false)
 INOUT (RTokenizedSource) getTokenized()

Static Public Member Functions

void initAsEnvProps (IN(RProps) scriptenv)
 initialize properties as script environmnet

void breakToDebug ()
 next statement will break to debugger

void traceOn ()
 trace each executed line to System::out

void traceOff ()
 don't trace each executed line

RString getScriptBackTrace (bool withSourcePos=true, bool withLocals=false)
RExecutionStack getExecutionStack ()
void clearStack ()
 if Script exits with an exception the execution stack is still active.

RString getCfgScriptCommandLineHelp ()
RStringArray parseCfgScriptOptions (IN(RStringArray) args, IN(RProps) envProps=Nil)
 this method parses (and removes) the CfgScript command line options

acdk::lang::dmi::RDmiDelegate createScriptDelegate (IN(RString) code)
acdk::lang::dmi::RDmiDelegate createScriptDelegate (const acdk::lang::dmi::ScriptVar &arg1, IN(RString) code)
acdk::lang::dmi::RDmiDelegate createScriptDelegate (const acdk::lang::dmi::ScriptVar &arg1, const acdk::lang::dmi::ScriptVar &arg2, IN(RString) code)
acdk::lang::dmi::RDmiDelegate createScriptDelegate (const acdk::lang::dmi::ScriptVar &arg1, const acdk::lang::dmi::ScriptVar &arg2, const acdk::lang::dmi::ScriptVar &arg3, IN(RString) code)
acdk::lang::dmi::RDmiDelegate createScriptDelegate (const acdk::lang::dmi::ScriptVar &arg1, const acdk::lang::dmi::ScriptVar &arg2, const acdk::lang::dmi::ScriptVar &arg3, const acdk::lang::dmi::ScriptVar &arg4, IN(RString) code)
acdk::lang::dmi::RDmiDelegate createScriptDelegate (const acdk::lang::dmi::ScriptVarArray &args, IN(RString) code)

Public Attributes

RProps currentProps
 script globals


Private Member Functions

int _readEval (IN(RProps) props, int flags)
int _readEval2 (IN(RProps) props, bool inplace)
RString _getCurrentAssertLine ()

Private Attributes

RString _filename
RScript _parentScript
RStringArray _alreadyIncluded
RTokenizedSource _tokenized
bool _useStrict
short _castFlags
 a combination of ScriptVarCastFlags


Constructor & Destructor Documentation

acdk::cfgscript::Script::Script IN(RString cfgfile,
IN(RScript parentScript = Nil
[inline]
 

acdk::cfgscript::Script::~Script  ) 
 


Member Function Documentation

RString acdk::cfgscript::Script::_getCurrentAssertLine  )  [private]
 

int acdk::cfgscript::Script::_readEval IN(RProps props,
int  flags
[private]
 

int acdk::cfgscript::Script::_readEval2 IN(RProps props,
bool  inplace
[private]
 

void acdk::cfgscript::Script::assert bool  test  ) 
 

this method will be called by scripts if the expression is false it write the asserting scripting line to ACDK_NLOG(acdk.cfgscript.Script.assert, Error)

void acdk::cfgscript::Script::assertExists IN(RProps props,
IN(RString variable
 

void acdk::cfgscript::Script::assertTest bool  test  ) 
 

same as assert(bool test) but write an info log entry in case of success

void acdk::cfgscript::Script::assertTrue bool  test,
IN(RString msg
 

void acdk::cfgscript::Script::breakToDebug  )  [inline, static]
 

next statement will break to debugger

void acdk::cfgscript::Script::clearStack  )  [static]
 

if Script exits with an exception the execution stack is still active.

Therefore call clearStack to remove stack for this thread.

acdk::lang::dmi::RDmiDelegate acdk::cfgscript::Script::createScriptDelegate const acdk::lang::dmi::ScriptVarArray args,
IN(RString code
[static]
 

acdk::lang::dmi::RDmiDelegate acdk::cfgscript::Script::createScriptDelegate const acdk::lang::dmi::ScriptVar arg1,
const acdk::lang::dmi::ScriptVar arg2,
const acdk::lang::dmi::ScriptVar arg3,
const acdk::lang::dmi::ScriptVar arg4,
IN(RString code
[inline, static]
 

acdk::lang::dmi::RDmiDelegate acdk::cfgscript::Script::createScriptDelegate const acdk::lang::dmi::ScriptVar arg1,
const acdk::lang::dmi::ScriptVar arg2,
const acdk::lang::dmi::ScriptVar arg3,
IN(RString code
[inline, static]
 

acdk::lang::dmi::RDmiDelegate acdk::cfgscript::Script::createScriptDelegate const acdk::lang::dmi::ScriptVar arg1,
const acdk::lang::dmi::ScriptVar arg2,
IN(RString code
[inline, static]
 

acdk::lang::dmi::RDmiDelegate acdk::cfgscript::Script::createScriptDelegate const acdk::lang::dmi::ScriptVar arg1,
IN(RString code
[inline, static]
 

acdk::lang::dmi::RDmiDelegate acdk::cfgscript::Script::createScriptDelegate IN(RString code  )  [inline, static]
 

int acdk::cfgscript::Script::eval IN(RString text,
IN(RProps props,
int  flags = ScriptDefaultFlags
 

evaluates a complete script

RDmiObject acdk::cfgscript::Script::evalExpr IN(RString text,
IN(RProps props,
int  flags = ScriptDefaultFlags
 

evaluates not a sequence of statements, but a single expression

Returns:
the expression evaluated

int acdk::cfgscript::Script::evalTemplate IN(acdk::io::RFile sourceFile,
IN(RProps props,
int  flag = ScriptDefaultFlags
 

int acdk::cfgscript::Script::evalTemplate IN(RString text,
IN(RProps props,
int  flag = ScriptDefaultFlags
 

short acdk::cfgscript::Script::getCastFlags  )  [inline]
 

a combination of acdk::lang::dmi::ScriptVarCastFlags

RString acdk::cfgscript::Script::getCfgScriptCommandLineHelp  )  [static]
 

RExecutionStack acdk::cfgscript::Script::getExecutionStack  )  [inline, static]
 

RString acdk::cfgscript::Script::getFileName  )  [inline]
 

RProps acdk::cfgscript::Script::getGlobals  )  [inline]
 

RScript acdk::cfgscript::Script::getParentScript  )  [inline]
 

RString acdk::cfgscript::Script::getScriptBackTrace bool  withSourcePos = true,
bool  withLocals = false
[inline, static]
 

RString acdk::cfgscript::Script::getScriptPath  ) 
 

bool acdk::cfgscript::Script::include IN(RString fname,
bool  noDuplicates = true,
bool  changeDir = false
 

void acdk::cfgscript::Script::initAsEnvProps IN(RProps scriptenv  )  [static]
 

initialize properties as script environmnet

acdk::cfgscript::Script::INOUT RTokenizedSource   )  [inline]
 

RStringArray acdk::cfgscript::Script::parseCfgScriptOptions IN(RStringArray args,
IN(RProps envProps = Nil
[static]
 

this method parses (and removes) the CfgScript command line options

int acdk::cfgscript::Script::readEval IN(RProps props,
int  flags = PropsParentRead|PropsNoParentWrite
 

void acdk::cfgscript::Script::setCastFlags int  castFlags  )  [inline]
 

a combination of acdk::lang::dmi::ScriptVarCastFlags

void acdk::cfgscript::Script::testAssert bool  test  ) 
 

void acdk::cfgscript::Script::testAssertComment bool  test,
IN(RString msg
 

RString acdk::cfgscript::Script::toString  )  [inline, virtual]
 

return a string representation of this object Object::toString() return getName() by default

Reimplemented from acdk::lang::Object.

void acdk::cfgscript::Script::traceOff  )  [inline, static]
 

don't trace each executed line

void acdk::cfgscript::Script::traceOn  )  [inline, static]
 

trace each executed line to System::out

void acdk::cfgscript::Script::useStrict bool  use  )  [inline]
 

bool acdk::cfgscript::Script::useStrict  )  [inline]
 


Member Data Documentation

RStringArray acdk::cfgscript::Script::_alreadyIncluded [private]
 

short acdk::cfgscript::Script::_castFlags [private]
 

a combination of ScriptVarCastFlags

RString acdk::cfgscript::Script::_filename [private]
 

RScript acdk::cfgscript::Script::_parentScript [private]
 

RTokenizedSource acdk::cfgscript::Script::_tokenized [private]
 

bool acdk::cfgscript::Script::_useStrict [private]
 

RProps acdk::cfgscript::Script::currentProps
 

script globals

 
Last modified 2005-05-08 18:31 by SYSTEM By Artefaktur, Ing. Bureau Kommer