Gorilla.Script.Bytecode
Unit Gorilla.Script.Bytecode.pasClasses
- EGorillaScriptByteCodeException = class ( Exception )
Records
- record TGorillaScriptByteCodeHelper
- record TGSBlock
- record TGSValue
- record TGSCode
- record TGSSymbol
- record TGSNameHelper
- record TGSSymbolID
- record TGSAccessor
- record TGSVar
- record TGSNativeParam
- record TGSFuncNative
- record TGSFunc
- record TGSType
- record TGSEnumValue
- record TGSEnum
- record TGSSet
- record TGSInterface
- record TGSStruct
- record TGSClass
- record TGSUnit
- record TGSProgram
Enumerations
- enum TGorillaScriptByteCode = ( GS_BC_NONE, GS_BC_DELIM, GS_BC_HALT, GS_BC_RETURN, GS_BC_JUMP, GS_BC_JUMP_ON_ZERO, GS_BC_JUMP_ON_NOTZERO, GS_BC_GET_STACKVALUE, GS_BC_SET_STACKVALUE, GS_BC_ADD, GS_BC_SUB, GS_BC_MUL, GS_BC_DIV, GS_BC_MOD, GS_BC_POW, GS_BC_LT, GS_BC_LEQ, GS_BC_GT, GS_BC_GEQ, GS_BC_EQ, GS_BC_NEQ, GS_BC_NOT, GS_BC_AND, GS_BC_OR, GS_BC_XOR, GS_BC_BITAND, GS_BC_BITOR, GS_BC_BITXOR, GS_BC_SHL, GS_BC_SHR, GS_BC_INC, GS_BC_DEC, GS_BC_ADDRESSOF, GS_BC_IN, GS_BC_AS, GS_BC_COPY, GS_BC_COPYTOP, GS_BC_RANGECHECK, GS_BC_TRY, GS_BC_EXCEPT, GS_BC_FINALLY, GS_BC_FOR_LOOP, GS_BC_WHILE_LOOP, GS_BC_REPEAT_LOOP, GS_BC_CASE, GS_BC_GET_TYPE, GS_BC_GET_METHOD, GS_BC_GET_FIELD, GS_BC_SET_FIELD, GS_BC_GET_CONST, GS_BC_GET_NATIVE_PROPERTY, GS_BC_SET_NATIVE_PROPERTY, GS_BC_CALL, GS_BC_READ_ACC_ARR, GS_BC_WRITE_ACC_ARR, GS_BC_ISTYPE, GS_BC_NEWSET, GS_BC_FLIP, GS_BC_PUSH, GS_BC_POP, GS_BC_STACKPOS, GS_BC_BOOL, GS_BC_ORD_1BYTE, GS_BC_ORD_U1BYTE, GS_BC_ORD_2BYTE, GS_BC_ORD_U2BYTE, GS_BC_ORD_4BYTE, GS_BC_ORD_U4BYTE, GS_BC_ORD_8BYTE, GS_BC_ORD_U8BYTE, GS_BC_FLT_4BYTE, GS_BC_FLT_8BYTE, GS_BC_STRING, GS_BC_ARRAY, GS_BC_POINTER, GS_BC_OBJECT, GS_BC_CLASS, GS_BC_INTERFACE, GS_BC_METHOD, GS_BC_STRUCT, GS_BC_ENUM, GS_BC_SET, GS_BC_VARIANT, GS_BC_NULL, GS_BC_NOTSET, GS_BC_UNDEFINED, GS_BC_DEBUG ) ;
- enum TGSSymbolKind = ( gsUnknown, gsVar, gsFunc, gsType, gsEnum, gsSet, gsIntf, gsStruct, gsClass, gsUnit ) ;
- enum TGSFuncNativeKind = ( fnkGlobal, fnkClass, fnkStruct, fnkIntf ) ;
Constants
- const GORILLA_SCRIPT_MAGIC : Cardinal = ;
- const GORILLA_SCRIPT_VERSION : Cardinal = ;
- const GS_BYTECODE_TYPES : TGorillaScriptByteCodes = ;
- const GS_NAME_THIS : TGSName = ;
- const GS_NAME_RESULT : TGSName = ;
Mics. types
- type PGSBlock = pointer to TGSBlock;
- type PGSValue = pointer to TGSValue;
- type PGSCode = pointer to TGSCode;
- type PGSSymbol = pointer to TGSSymbol;
- type PGSSymbolID = pointer to TGSSymbolID;
- type PGSVar = pointer to TGSVar;
- type PGSFuncNative = pointer to TGSFuncNative;
- type PGSFunc = pointer to TGSFunc;
- type PGSType = pointer to TGSType;
- type PGSEnumValue = pointer to TGSEnumValue;
- type PGSEnum = pointer to TGSEnum;
- type PGSSet = pointer to TGSSet;
- type PGSInterface = pointer to TGSInterface;
- type PGSStruct = pointer to TGSStruct;
- type PGSClass = pointer to TGSClass;
- type PGSUnit = pointer to TGSUnit;
- type PGSProgram = pointer to TGSProgram;
- type TGSName = array [0..255] of Byte;
TGorillaScriptByteCode
enum TGorillaScriptByteCode = (
GS_BC_NONE, GS_BC_DELIM, GS_BC_HALT, GS_BC_RETURN, GS_BC_JUMP, GS_BC_JUMP_ON_ZERO, GS_BC_JUMP_ON_NOTZERO, GS_BC_GET_STACKVALUE, GS_BC_SET_STACKVALUE, GS_BC_ADD, GS_BC_SUB, GS_BC_MUL, GS_BC_DIV, GS_BC_MOD, GS_BC_POW, GS_BC_LT, GS_BC_LEQ, GS_BC_GT, GS_BC_GEQ, GS_BC_EQ, GS_BC_NEQ, GS_BC_NOT, GS_BC_AND, GS_BC_OR, GS_BC_XOR, GS_BC_BITAND, GS_BC_BITOR, GS_BC_BITXOR, GS_BC_SHL, GS_BC_SHR, GS_BC_INC, GS_BC_DEC, GS_BC_ADDRESSOF, GS_BC_IN, GS_BC_AS, GS_BC_COPY, GS_BC_COPYTOP, GS_BC_RANGECHECK, GS_BC_TRY, GS_BC_EXCEPT, GS_BC_FINALLY, GS_BC_FOR_LOOP, GS_BC_WHILE_LOOP, GS_BC_REPEAT_LOOP, GS_BC_CASE, GS_BC_GET_TYPE, GS_BC_GET_METHOD, GS_BC_GET_FIELD, GS_BC_SET_FIELD, GS_BC_GET_CONST, GS_BC_GET_NATIVE_PROPERTY, GS_BC_SET_NATIVE_PROPERTY, GS_BC_CALL, GS_BC_READ_ACC_ARR, GS_BC_WRITE_ACC_ARR, GS_BC_ISTYPE, GS_BC_NEWSET, GS_BC_FLIP, GS_BC_PUSH, GS_BC_POP, GS_BC_STACKPOS, GS_BC_BOOL, GS_BC_ORD_1BYTE, GS_BC_ORD_U1BYTE, GS_BC_ORD_2BYTE, GS_BC_ORD_U2BYTE, GS_BC_ORD_4BYTE, GS_BC_ORD_U4BYTE, GS_BC_ORD_8BYTE, GS_BC_ORD_U8BYTE, GS_BC_FLT_4BYTE, GS_BC_FLT_8BYTE, GS_BC_STRING, GS_BC_ARRAY, GS_BC_POINTER, GS_BC_OBJECT, GS_BC_CLASS, GS_BC_INTERFACE, GS_BC_METHOD, GS_BC_STRUCT, GS_BC_ENUM, GS_BC_SET, GS_BC_VARIANT, GS_BC_NULL, GS_BC_NOTSET, GS_BC_UNDEFINED, GS_BC_DEBUG
) ;
Defining byte operational codes for compiling and execution mode.
Remarks
The basic command structure is:OPERATION[(GS_BC_STACKVALUE (GS_BC_BOOL|GS_BC_ORD_1BYTE|GS_BC_ORD_2BYTE|...|GS_BC_STRUCT))] DELIMITER OPERATION GS_BC_CONST GS_BC_BOOL|GS_BC_ORD_1BYTE|...|GS_BC_UNDEFINED [ [NUMBER OF BYTES] ] [...NUMBER OF BYTES...] DELIMITER
The count indicator is used differently: 1) number of stack parameter used 2) number of bytes for data supplied
For example: (<!-- ... --> means the operation doing this internally)GS_BC_ADD GS_BC_CONST GS_BC_ORD_4BYTE 123 GS_BC_STACKVALUE GS_BC_ORD_4BYTE DELIM
TGSValue
Fields
Methods
- public function Create ( ) : PGSValue ; static overload;
- public function Create ( const AValue : Byte ) : PGSValue ; static overload;
- public function Create ( const AValue : ShortInt ) : PGSValue ; static overload;
- public function Create ( const AValue : Word ) : PGSValue ; static overload;
- public function Create ( const AValue : SmallInt ) : PGSValue ; static overload;
- public function Create ( const AValue : Cardinal ) : PGSValue ; static overload;
- public function Create ( const AValue : Integer ) : PGSValue ; static overload;
- public function Create ( const AValue : UInt64 ) : PGSValue ; static overload;
- public function Create ( const AValue : Int64 ) : PGSValue ; static overload;
- public function Create ( const AValue : Single ) : PGSValue ; static overload;
- public function Create ( const AValue : Double ) : PGSValue ; static overload;
- public function Create ( const AValue : Boolean ) : PGSValue ; static overload;
- public function Create ( const AValue : Variant ) : PGSValue ; static overload;
- public function Create ( const AValue : TValue ) : PGSValue ; static overload;
- public function Create ( const AValue : string ) : PGSValue ; static overload;
- public procedure Free ( ) ;
- public function GetDataSize ( ) : Integer ;
- public function Read ( const AStream : TBytesStream ) : PGSValue ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
TGSNameHelper
Methods
- public function FromString ( const AName : string ) : TGSName ; static;
- public function FromUnicodeBytes ( const ABytes : TArray<System.Byte> ) : TGSName ; static;
- public function ToString ( const AName : TGSName ) : string ; static;
- public function ToUnicodeBytes ( const AName : TGSName ) : TArray<System.Byte> ; static;
- public function IsEqual ( const AName1 : TGSName; const AName2 : TGSName ) : Boolean ; static;
TGSSymbolID
Fields
Methods
TGSVar
Fields
- public SymbolID :
TGSSymbolID
- public Owner :
PGSSymbolID
- public Flags :
Word
- public _Type :
TGSSymbolID
- public TypeKind :
TGorillaScriptByteCode
- public ReadAccess :
TGSAccessor
- public WriteAccess :
TGSAccessor
- public Value :
PGSValue
Methods
- public function Create ( const AID : TGUID; const AName : string ) : PGSVar ; static;
- public procedure Free ( ) ;
- public function Read ( const AStream : TBytesStream; const ASym : TGSSymbolID ) : PGSVar ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function GetName ( ) : PAnsiChar ;
- public procedure SetType ( const AID : TGUID; const AName : string; const AType : TGSSymbolKind; const AKind : TGorillaScriptByteCode ) ;
TGSFuncNative
Fields
- public Kind :
TGSFuncNativeKind
- public Address :
Pointer
- public Return :
PTypeInfo
- public CallConv :
TCallConv
- public DispatchKind :
TDispatchKind
- public VirtualIndex :
SmallInt
- public IsStatic :
Boolean
- public IsConstructor :
Boolean
- public IsDestructor :
Boolean
- public IsClassMethod :
Boolean
- public HasSelf :
Boolean
- public Parameters :
TArray<Gorilla.Script.Bytecode.TGSNativeParam>
Methods
TGSFunc
Fields
- public SymbolID :
TGSSymbolID
- public Owner :
PGSSymbolID
- public Flags :
Byte
- public Directives :
Byte
- public Visibility :
Byte
- public ParamCount :
Byte
- public Params :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public Return :
TGSSymbolID
- public LocalCount :
Byte
- public Locals :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public Code :
PGSCode
- public NativeCall :
PGSFuncNative
Methods
- public function Create ( const AID : TGUID; const AName : string ) : PGSFunc ; static;
- public procedure Free ( ) ;
- public function Read ( const AStream : TBytesStream; const ASym : TGSSymbolID ) : PGSFunc ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function GetName ( ) : PAnsiChar ;
- public procedure SetReturn ( const AID : TGUID; const AName : string; const AType : TGSSymbolKind ) ;
- public procedure AddParam ( const AValue : PGSVar ) ;
- public function GetParam ( const AName : TGSName ) : PGSVar ; overload;
- public function GetParam ( const AName : string ) : PGSVar ; overload;
- public procedure RearrangeParams ( ) ;
- public procedure AddLocal ( const AValue : PGSVar ) ;
- public function GetLocal ( const AName : TGSName ) : PGSVar ; overload;
- public function GetLocal ( const AName : string ) : PGSVar ; overload;
- public function GetThis ( ) : PGSVar ;
- public function GetClass ( ) : PGSClass ;
- public function GetStruct ( ) : PGSStruct ;
- public function GetUnit ( ) : PGSUnit ;
- public function GetProgram ( ) : PGSProgram ;
TGSEnum
Fields
- public _Type :
TGSType
- public ValueCount :
Cardinal
- public Values :
TArray<Gorilla.Script.Bytecode.TGSEnumValue>
Methods
- public function Create ( const AID : TGUID; const AName : string ) : PGSEnum ; static;
- public procedure Free ( ) ;
- public procedure AddValue ( const AName : TGSName; const AValue : Int64 ) ;
- public function Read ( const AStream : TBytesStream; const ASym : TGSSymbolID ) : PGSEnum ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
TGSSet
Fields
Methods
TGSInterface
Fields
- public _Type :
TGSType
- public GUID :
TGUID
- public Ancestor :
TGSSymbolID
- public IntfCount :
Byte
- public Interfaces :
TArray<Gorilla.Script.Bytecode.TGSSymbolID>
- public PropertyCount :
Cardinal
- public Properties :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public MethodCount :
Cardinal
- public Methods :
TArray<Gorilla.Script.Bytecode.PGSFunc>
Methods
- public function Create ( const AID : TGUID; const AName : string; const AAncestor : TGSSymbolID ) : PGSInterface ; static;
- public procedure Free ( ) ;
- public function Read ( const AStream : TBytesStream; const ASym : TGSSymbolID ) : PGSInterface ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function GetName ( ) : PAnsiChar ;
- public procedure SetSignature ( const ASig : string ) ;
- public function GetSigStr ( ) : string ;
- public procedure AddInterface ( const AIntf : PGSInterface ) ;
- public procedure AddInterfaceAsType ( const AType : TGSSymbolID ) ;
- public procedure AddProperty ( const AProp : PGSVar ) ;
- public procedure AddMethod ( const AFunc : PGSFunc ) ;
- public function GetUnit ( ) : PGSUnit ;
- public function GetProgram ( ) : PGSProgram ;
TGSStruct
Fields
- public _Type :
TGSType
- public FieldCount :
Cardinal
- public Fields :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public PropertyCount :
Cardinal
- public Properties :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public MethodCount :
Cardinal
- public Methods :
TArray<Gorilla.Script.Bytecode.PGSFunc>
Methods
- public function Create ( const AID : TGUID; const AName : string ) : PGSStruct ; static;
- public procedure Free ( ) ;
- public function Read ( const AStream : TBytesStream; const ASym : TGSSymbolID ) : PGSStruct ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function GetName ( ) : PAnsiChar ;
- public procedure SetSignature ( const ASig : string ) ;
- public function GetSigStr ( ) : string ;
- public procedure AddField ( const AField : PGSVar ) ;
- public procedure AddProperty ( const AProp : PGSVar ) ;
- public procedure AddMethod ( const AFunc : PGSFunc ) ;
- public function GetUnit ( ) : PGSUnit ;
- public function GetProgram ( ) : PGSProgram ;
TGSClass
Fields
- public _Type :
TGSType
- public Ancestor :
TGSSymbolID
- public IntfCount :
Byte
- public Interfaces :
TArray<Gorilla.Script.Bytecode.TGSSymbolID>
- public FieldCount :
Cardinal
- public Fields :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public PropertyCount :
Cardinal
- public Properties :
TArray<Gorilla.Script.Bytecode.PGSVar>
- public MethodCount :
Cardinal
- public Methods :
TArray<Gorilla.Script.Bytecode.PGSFunc>
Methods
- public function Create ( const AID : TGUID; const AName : string; const AAncestor : TGSSymbolID ) : PGSClass ; static;
- public procedure Free ( ) ;
- public function Read ( const AStream : TBytesStream; const ASym : TGSSymbolID ) : PGSClass ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function GetName ( ) : PAnsiChar ;
- public procedure SetSignature ( const ASig : string ) ;
- public function GetSigStr ( ) : string ;
- public procedure AddInterface ( const AIntf : PGSInterface ) ;
- public procedure AddInterfaceAsType ( const AType : TGSSymbolID ) ;
- public procedure AddField ( const AField : PGSVar ) ;
- public procedure AddProperty ( const AProp : PGSVar ) ;
- public procedure AddMethod ( const AFunc : PGSFunc ) ;
- public function GetUnit ( ) : PGSUnit ;
- public function GetProgram ( ) : PGSProgram ;
TGSUnit
Fields
- public SymbolID :
TGSSymbolID
- public Magic :
Cardinal
- public Version :
Cardinal
- public Owner :
PGSSymbolID
- public _Program :
PGSProgram
- public SymbolCount :
Cardinal
- public Symbols :
TArray<Gorilla.Script.Bytecode.PGSSymbolID>
- public Init :
PGSCode
- public Finalize :
PGSCode
Methods
- public function Create ( const AID : TGUID; const AName : string ) : PGSUnit ; static;
- public procedure Free ( ) ;
- public function Read ( const AStream : TBytesStream ) : PGSUnit ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function GetName ( ) : PAnsiChar ;
- public function GetNameStr ( ) : string ;
- public procedure AddSymbol ( const AValue : PGSSymbolID ) ;
- public function FindSymbol ( const ASig : TGSName ) : PGSSymbolID ;
- public function FindNativeSymbol ( const ATypeInfo : PTypeInfo ) : PGSSymbolID ;
TGSProgram
Fields
- public Magic :
Cardinal
- public Version :
Cardinal
- public UnitCount :
Cardinal
- public Units :
TArray<Gorilla.Script.Bytecode.PGSUnit>
Methods
- public function Create ( const AID : TGUID; const AName : string ) : PGSProgram ; static;
- public procedure Free ( ) ;
- public function GetProgramUnit ( ) : PGSUnit ;
- public procedure AddUnit ( const AValue : PGSUnit ) ;
- public function Read ( const AStream : TBytesStream ) : PGSProgram ; static;
- public procedure Write ( const AStream : TBytesStream ) ;
- public function FindSymbol ( const ASig : TGSName ) : PGSSymbolID ;
- public function FindNativeSymbol ( const ATypeInfo : PTypeInfo ) : PGSSymbolID ;