Gorilla.Script.Executor
Unit Gorilla.Script.Executor.pasClasses
- TGorillaScriptExecutor = class ( TObject )
Records
- record TGorillaScriptStackValue
- record TGorillaScriptCall
- record TGorillaScriptContext
Constants
- const GORILLA_SCRIPT_MAX_STACKSIZE : Integer = $200;
- const GORILLA_SCRIPT_MAX_CALLSTACK : Integer = $80;
- const GORILLA_SCRIPT_MAX_HEAPSIZE : Integer = $2000000;
Mics. types
- type PGorillaScriptStackValue = pointer to TGorillaScriptStackValue;
- type PGorillaScriptCall = pointer to TGorillaScriptCall;
- type PGorillaScriptContext = pointer to TGorillaScriptContext;
TGorillaScriptContext
Fields
- public Executor :
TGorillaScriptExecutor
- public Parent :
PGorillaScriptContext
- public _Program :
PGSProgram
- public _Unit :
PGSUnit
- public _Class :
PGSClass
- public _Struct :
PGSStruct
- public _Function :
PGSFunc
- public _Block :
PGSCode
- public StackOffset :
Integer
- public CallStackOffset :
Integer
Methods
- public constructor Create ( AExecutor : TGorillaScriptExecutor; AParent : PGorillaScriptContext = nil ) ;
- private function DoGetStackValuePtr
(
const
AIndex :
Integer
)
: PGorillaScriptStackValue
;
This method is not threadsafe! Should be used inside of a TMonitor.
- private function DoGetStackTopValuePtr ( ) : PGorillaScriptStackValue ;
- public procedure Free ( ) ;
- public function CreateContext ( ) : PGorillaScriptContext ;
- public procedure PushStackValue ( const ARef : PGSSymbolID; const AValue : TValue ) ; overload;
- public procedure PushStackValue ( const ARef : PGSSymbolID; const AValue : PGSValue ) ; overload;
- public procedure PushStackValue ( const AValue : PGSVar ) ; overload;
- public procedure PushStackValue ( const AValue : PGSFunc ) ; overload;
- public procedure PushStackValue ( const AValue : PGSType ) ; overload;
- public procedure PushStackValue ( const AValue : PGSInterface ) ; overload;
- public procedure PushStackValue ( const AValue : PGSClass ) ; overload;
- public procedure PushStackValue ( const AValue : PGSStruct ) ; overload;
- public procedure PushStackValue ( const AValue : PGSEnum ) ; overload;
- public procedure PushStackValue ( const AValue : PGSSet ) ; overload;
- public procedure PushStackValue ( const AValue : PGorillaScriptStackValue ) ; overload;
- public procedure PushStackValue ( const AValue : TGorillaScriptStackValue ) ; overload;
- public function PopStackValue ( ) : TGorillaScriptStackValue ;
- public function PopStackValuesToArray ( ACount : Integer ) : TArray<Gorilla.Script.Executor.TGorillaScriptStackValue> ;
- public procedure PopStackValues ( ACount : Integer ) ;
- public procedure FlipStackValue ( ) ;
- public function GetStackCount ( ) : Integer ;
- public function GetStackValuePtr ( const AIndex : Integer ) : PGorillaScriptStackValue ;
- public procedure PushStackValueAtIndex ( const AIndex : Integer ) ;
- public procedure PushStackTopValue ( ) ;
- public procedure LogStackValues ( ) ;
- public procedure LogCallStack ( ) ;
TGorillaScriptExecutor
Executes a specific Gorilla3D script, after it was compiled to a fast bytecode.
Ancestors
Members
Fields
- protected FCompiler :
TObject
- protected FContext :
TGorillaScriptContext
- protected FMaxStackSize :
Cardinal
- protected FMaxCallStack :
Integer
- protected FCallStack :
Integer
- protected FMaxHeapSize :
Cardinal
- protected FHeapSize :
Cardinal
- protected Stack :
TStack<Gorilla.Script.Executor.TGorillaScriptStackValue>
- protected CallStack :
TStack<Gorilla.Script.Executor.TGorillaScriptCall>
- protected FStackLock :
TCriticalSection
- protected FHalted :
Boolean
- protected FByteCodes :
- protected FObjects :
TObjectList<Gorilla.Script.Types.TGorillaScriptObject>
- protected FPrg :
PGSProgram
- protected FUnit :
PGSUnit
Methods
- public constructor Create ( const ACompiler : TObject ) ;
- public destructor Destroy ( ) ;
- protected function GetContext ( ) : PGorillaScriptContext ;
- protected procedure SetupByteCodes ( ) ;
- protected procedure DoDelim ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoHalt ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoReturn ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoJump ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoJumpOnZero ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoJumpOnNotZero ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoTry ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoExcept ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoFinally ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoForLoop ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoWhileLoop ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoRepeatLoop ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoCase ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGetStackValue ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoSetStackValue ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoCopy ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoCopyTop ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoRangeCheck ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoFlip ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoPush ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoPop ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoStackPos ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGetField ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoSetField ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGetConst ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGetNativeProperty ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoSetNativeProperty ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGetType ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGetMethod ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoCallScript ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream; const AFunc : PGSFunc ) ;
- protected procedure DoCallNative ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream; const AFunc : PGSFunc ) ;
- protected procedure DoCall ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoReadAccessArray ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoWriteAccessArray ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoIsType ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoNewSet ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoAdd ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoSub ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoMul ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoDiv ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoMod ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoPow ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoLT ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoLEQ ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGT ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoGEQ ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoEQ ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoNEQ ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoNOT ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoBoolAnd ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoBoolOr ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoBoolXor ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoBitAnd ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoBitOr ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoBitXor ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoShr ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoShl ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoInc ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoDec ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoAddressOf ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoIn ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoAs ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure DoReadValue ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream; out AValue : TValue ) ;
- protected procedure DoReadByteCode ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ;
- protected procedure Interprete ( const AContext : PGorillaScriptContext; const AByteCode : TBytesStream ) ; virtual;
- public procedure Lock ( ) ; inline;
- public procedure Unlock ( ) ; inline;
- public procedure IncCallStack ( ) ; inline;
- public procedure DecCallStack ( ) ; inline;
- public procedure IncHeapSize ( const ASize : Cardinal ) ; inline;
- public procedure DecHeapSize ( const ASize : Cardinal ) ; inline;
- public procedure Run
(
const
AByteCode :
TBytesStream; const
AKeepAlive :
Boolean
)
;
virtual;
Executes a specific bytecode. The keep-alive parameter defines if all bytecode structures are free after execution. If KeepAlive is true the last execution environment could not be reused.
- public function Eval
(
const
AByteCode :
TBytesStream
)
: TValue
;
virtual;
Executes only a code snippet, instead of a full program like Run().
- public procedure Call
(
const
AFunc :
PGSFunc; const
AArgs :
TArray<System.Rtti.TValue>
)
;
Expects a pushed PGSFunc on top of the stack and afterwards all necessary arguments. The routine will call the DoCall() bytecode operation.
- public function ToJSON ( ) : string ;