TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
iScriptVM Struct Referenceabstract
Inheritance diagram for iScriptVM:
iScriptingHost iUnknown

Detailed Description

Script Virtual Machine interface.

System

virtual tIntPtr GetHandle () const =0
 Get the VM's handle. {Property}. More...
 
virtual iScriptVMGetParentVM () const =0
 Get the parent VM. {Property}. More...
 

Compilation & Execution

virtual iScriptObjectCompile (iFile *apFile, const achar *aaszName=NULL)=0
 Compile the given file. More...
 
virtual iScriptObjectCompileString (const achar *aaszCode, const achar *aaszName=NULL)=0
 Compile the given string. More...
 
virtual iUnknownCompileGetIUnknownObject (iScriptObject *apThisTable, iFile *apFile, const achar *aaszObjectName, const tUUID &aIID)=0
 Compile the given file and get the specified IUnknown object. More...
 
virtual tBool Run (iScriptObject *apThis, const achar *aaszCommand)=0
 Run the specified text. More...
 
virtual tI32 CollectGarbage ()=0
 Collect garbage. More...
 

Debug

virtual void EnableDebugInfos (tBool abEnabled)=0
 Enable debug informations in the compiled script. More...
 
virtual tBool AreDebugInfosEnabled () const =0
 Return eTrue if debug infos are enabled. More...
 
virtual void SetErrorLineOffset (tI32 anOffset)=0
 Set the line error reporting offset. {Property}. More...
 
virtual tI32 GetErrorLineOffset () const =0
 Get the line error reporting offset. {Property}. More...
 
virtual eScriptRaiseErrorMode SetRaiseErrorMode (eScriptRaiseErrorMode aMode)=0
 Set the current raise error mode. {Property}. More...
 
virtual eScriptRaiseErrorMode GetRaiseErrorMode () const =0
 Get the current raise error mode. {Property}. More...
 
virtual void SetLogRaiseError (tLogFlags aLog)=0
 Set whether each error raised should be logged. {Property}. More...
 
virtual tLogFlags GetLogRaiseError () const =0
 Get whether each error raised should be logged. {Property}. More...
 

Registration

virtual tBool RegisterFunction (const sMethodDef *apFunction, const achar *aaszName=NULL)=0
 Register a function in the active table. More...
 

Stack manipulation

virtual tBool PushRootTable ()=0
 Push the root table on the stack. More...
 
virtual tBool PushString (const achar *aaszString, tSize anLen=-1)=0
 Push a string on the stack. More...
 
virtual tBool PushInteger (tI32 anValue)=0
 Push an integer on the stack. More...
 
virtual tBool PushFloat (tF64 afValue)=0
 Push a float on the stack. More...
 
virtual tBool PushInterface (iUnknown *apInterface)=0
 Push an interface on the stack. More...
 
virtual tBool PushVariant (const Var &aVar)=0
 Push a variant on the stack. More...
 
virtual tBool PushObject (iScriptObject *apObject)=0
 Push a script object on the stack. More...
 
virtual tBool Pop (tU32 anNumPop)=0
 Pop n object of the stack. More...
 
virtual tI32 GetStackSize () const =0
 Get the stack size. More...
 
virtual tBool SetStackSize (tU32 anSize)=0
 Set the stack size. More...
 
virtual tBool CreateSlot (tI32 idx)=0
 Create a new slot. More...
 

Imports

virtual tInterfaceCVec
< iFileSystem > * 
GetImportFileSystems () const =0
 Get the list of file systems used by the script protocol URLFile handler. {Property}. More...
 
virtual iFileImportFileOpen (const achar *aaszFile)=0
 Open a file using the script protocol by default if no procotol is specified. More...
 
virtual tBool Import (iUnknown *apPathOrFile, iScriptObject *apDestTable)=0
 Call the system Import function. More...
 
virtual tBool NewImport (iUnknown *apPathOrFile, iScriptObject *apDestTable)=0
 Call the system NewImport function. More...
 

Script objects

@ }

virtual iScriptObjectCreateTable (iScriptObject *apDelegate=NULL, tI32 anNumPop=1)=0
 Create a new table. More...
 
virtual iScriptObjectCreateObject (tI32 anIndex=eInvalidHandle, tI32 anNumPop=1)=0
 Create a new script object. More...
 
virtual iScriptObjectCreateObjectGet (const achar *aaszKey, eScriptObjectType aRequiredType=eScriptObjectType_Last, tI32 anNumPop=1)=0
 Create an object the pushed table. More...
 

Functions

virtual tBool Call (tU32 anNumParams, tBool abPushRet)=0
 Call a function. More...
 

Serialization

virtual tBool WriteClosure (iFile *apFile, iScriptObject *apObject)=0
 Write a closure. More...
 
virtual iScriptObjectReadClosure (iFile *apFile)=0
 Read a closure. More...
 

High level API

virtual tBool ScriptCall (const achar *aaszModule, const achar *aaszFunc, const Var *apParams, tU32 anNumParams, Var *apRet)=0
 {NoAutomation} More...
 
virtual iScriptObjectScriptVar (const achar *aaszModule, const achar *aaszVar)=0
 
virtual tBool EvalString (iHString *ahspContext, const ni::achar *aaszCode)=0
 Evaluate the specified string. More...
 
virtual tBool CanEvalImpl (iHString *ahspContext, iHString *ahspCodeResource)=0
 Check whether the scripting host can evaluate the specified code resource. More...
 
virtual iUnknownEvalImpl (iHString *ahspContext, iHString *ahspCodeResource, const tUUID &aIID)=0
 Evaluate the specified implementation from the specified 'code resource'. More...
 
virtual void Service (tBool abForceGC)=0
 Service the scripting host. More...
 

Additional Inherited Members

- Public Member Functions inherited from iUnknown
virtual tBool IsOK () const =0
 Check if the object is valid. More...
 
virtual tI32 AddRef ()=0
 Signal that one more reference of the object has been created. More...
 
virtual tI32 Release ()=0
 Release a reference of the object. More...
 
virtual void DeleteThis ()=0
 Bypass any reference counting and delete this object. More...
 
virtual void Invalidate ()=0
 Invalidate the object. More...
 
virtual iUnknownQueryInterface (const tUUID &aIID)=0
 Query an interface. More...
 
virtual void ListInterfaces (iMutableCollection *apLst, tU32 anFlags) const =0
 Fill a UUID list containing the UUIDs of the implemented interfaces. More...
 
virtual tI32 SetNumRefs (tI32 anNumRefs)=0
 Set the reference counter directly. More...
 
virtual tI32 GetNumRefs () const =0
 Get the number of references to this object. More...
 

Member Function Documentation

virtual tIntPtr GetHandle ( ) const
pure virtual

Get the VM's handle. {Property}.

virtual iScriptVM* GetParentVM ( ) const
pure virtual

Get the parent VM. {Property}.

virtual iScriptObject* Compile ( iFile apFile,
const achar aaszName = NULL 
)
pure virtual

Compile the given file.

Parameters
apFilecontaines the code to compile.
aaszNameis the name to give to the closure. If NULL the file source path is used as name.
Returns
An object that contains the compiled code.
Remarks
This does not run the compiled code.
virtual iScriptObject* CompileString ( const achar aaszCode,
const achar aaszName = NULL 
)
pure virtual

Compile the given string.

Parameters
aaszCodecontaines the code to compile.
aaszNameis the name to give to the closure. If NULL [VM::String] is used.
Returns
A closure that contains the compiled code.
Remarks
This does not run the compiled code.
virtual iUnknown* CompileGetIUnknownObject ( iScriptObject apThisTable,
iFile apFile,
const achar aaszObjectName,
const tUUID aIID 
)
pure virtual

Compile the given file and get the specified IUnknown object.

virtual tBool Run ( iScriptObject apThis,
const achar aaszCommand 
)
pure virtual

Run the specified text.

Parameters
apThisis the 'this' table to use for the call, if null use the root table.
aaszCommandis the text to run.
Returns
eFalse on error, else eTrue.
virtual tI32 CollectGarbage ( )
pure virtual

Collect garbage.

virtual void EnableDebugInfos ( tBool  abEnabled)
pure virtual

Enable debug informations in the compiled script.

Remarks
This will enable or disable debug infos for all scripts compiled after the call to the method.
virtual tBool AreDebugInfosEnabled ( ) const
pure virtual

Return eTrue if debug infos are enabled.

virtual void SetErrorLineOffset ( tI32  anOffset)
pure virtual

Set the line error reporting offset. {Property}.

virtual tI32 GetErrorLineOffset ( ) const
pure virtual

Get the line error reporting offset. {Property}.

virtual eScriptRaiseErrorMode SetRaiseErrorMode ( eScriptRaiseErrorMode  aMode)
pure virtual

Set the current raise error mode. {Property}.

Returns
The previous raise error mode.
virtual eScriptRaiseErrorMode GetRaiseErrorMode ( ) const
pure virtual

Get the current raise error mode. {Property}.

virtual void SetLogRaiseError ( tLogFlags  aLog)
pure virtual

Set whether each error raised should be logged. {Property}.

Remarks
The default is eLogFlags_Debug in debug builds and 0 (disabled) in release builds.
virtual tLogFlags GetLogRaiseError ( ) const
pure virtual

Get whether each error raised should be logged. {Property}.

virtual tBool RegisterFunction ( const sMethodDef apFunction,
const achar aaszName = NULL 
)
pure virtual

Register a function in the active table.

virtual tBool PushRootTable ( )
pure virtual

Push the root table on the stack.

virtual tBool PushString ( const achar aaszString,
tSize  anLen = -1 
)
pure virtual

Push a string on the stack.

virtual tBool PushInteger ( tI32  anValue)
pure virtual

Push an integer on the stack.

virtual tBool PushFloat ( tF64  afValue)
pure virtual

Push a float on the stack.

virtual tBool PushInterface ( iUnknown apInterface)
pure virtual

Push an interface on the stack.

virtual tBool PushVariant ( const Var aVar)
pure virtual

Push a variant on the stack.

virtual tBool PushObject ( iScriptObject apObject)
pure virtual

Push a script object on the stack.

virtual tBool Pop ( tU32  anNumPop)
pure virtual

Pop n object of the stack.

virtual tI32 GetStackSize ( ) const
pure virtual

Get the stack size.

virtual tBool SetStackSize ( tU32  anSize)
pure virtual

Set the stack size.

virtual tBool CreateSlot ( tI32  idx)
pure virtual

Create a new slot.

virtual tInterfaceCVec<iFileSystem>* GetImportFileSystems ( ) const
pure virtual

Get the list of file systems used by the script protocol URLFile handler. {Property}.

Remarks
By default the root file system and ni.dir.scripts folder are added.
virtual iFile* ImportFileOpen ( const achar aaszFile)
pure virtual

Open a file using the script protocol by default if no procotol is specified.

virtual tBool Import ( iUnknown apPathOrFile,
iScriptObject apDestTable 
)
pure virtual

Call the system Import function.

virtual tBool NewImport ( iUnknown apPathOrFile,
iScriptObject apDestTable 
)
pure virtual

Call the system NewImport function.

virtual iScriptObject* CreateTable ( iScriptObject apDelegate = NULL,
tI32  anNumPop = 1 
)
pure virtual

Create a new table.

Parameters
apDelegateis an optional delegate table.
anNumPop
Returns
NULL if the table's creation failed.
virtual iScriptObject* CreateObject ( tI32  anIndex = eInvalidHandle,
tI32  anNumPop = 1 
)
pure virtual

Create a new script object.

virtual iScriptObject* CreateObjectGet ( const achar aaszKey,
eScriptObjectType  aRequiredType = eScriptObjectType_Last,
tI32  anNumPop = 1 
)
pure virtual

Create an object the pushed table.

Parameters
aaszKeyis the name of the object to get.
aRequiredTypeis the type that the object should have. If eScriptObjectType_Last this is ignored.
anNumPopis the number of pop, by defaul the object is pushed on the stack.
Returns
NULL if the object can't be found or that the type doesn't match aRequiredType.
virtual tBool Call ( tU32  anNumParams,
tBool  abPushRet 
)
pure virtual

Call a function.

Parameters
anNumParamsnumber of parameters to pop of the stack, should be at least one, aka the this table.
abPushRetif eTrue the return value will be pushed in the stack when the function returns.
Returns
eFalse if the call fails else eTrue.
Remarks
Pops anNumParameters number of parameters of the stack, and call the closure in the stack.
virtual tBool WriteClosure ( iFile apFile,
iScriptObject apObject 
)
pure virtual

Write a closure.

virtual iScriptObject* ReadClosure ( iFile apFile)
pure virtual

Read a closure.

virtual tBool ScriptCall ( const achar aaszModule,
const achar aaszFunc,
const Var apParams,
tU32  anNumParams,
Var apRet 
)
pure virtual

{NoAutomation}

virtual iScriptObject* ScriptVar ( const achar aaszModule,
const achar aaszVar 
)
pure virtual
virtual tBool EvalString ( iHString ahspContext,
const ni::achar aaszCode 
)
pure virtual

Evaluate the specified string.

Implements iScriptingHost.

virtual tBool CanEvalImpl ( iHString ahspContext,
iHString ahspCodeResource 
)
pure virtual

Check whether the scripting host can evaluate the specified code resource.

Implements iScriptingHost.

virtual iUnknown* EvalImpl ( iHString ahspContext,
iHString ahspCodeResource,
const tUUID aIID 
)
pure virtual

Evaluate the specified implementation from the specified 'code resource'.

Remarks
The code resource can be a file name, class name, or whathever is relevant as an implementation identifier depending on the type of the scripting host.

Implements iScriptingHost.

virtual void Service ( tBool  abForceGC)
pure virtual

Service the scripting host.

Implements iScriptingHost.