Unit IFS_VAR.PAS
Types:
TIfsError is used to store errors. (see below for error code)
PTypeManager is used internally to store types.
PVariableManager is used internally to store variables.
PProcedureManager is used internally to store procedures.
PIfsProcType
PIfsRecordType
PIFsClassType
PCreatedClass
PPropertyDef
TRegisteredProc/TRegisteredProcObject
PProcedure
PTypeRec
TIfVariant
Constants:
Errors:
ENoError - No error has occured
ECanNotReadProperty - Can not read property, not used yet
ECanNotWriteProperty - Can not write property, not used yet
EUnknownIdentifier - The identifier is unknown
EIdentifierExpected - An identifier is expected
ESemicolonExpected - A semicolon is required
EBeginExpected - Begin is expected
EDuplicateIdentifier - Duplicate identifier
EUnexpectedEndOfFile - Unexpected end of file is occured
EColonExpected - An colon is expected
ESyntaxError - There was an error in the syntax
EStringError - A string error, usually, a string that has notended before the enter.
EErrorInStatement - Error in the statement
EAssignmentExpected - Assignment is expected
ETypeMismatch - Type is not the same.
EErrorInExpression - Error in the expresssion.
ERoundOpenExpected - A round open is expected
ERoundCloseExpected - A round close is expected
EVariableExpected - A variable is expected
ECommaExpected - A comma is expected
EThenExpected - Then is expected
EPeriodExpected - A period is expected
EParameterError - Parameter error, occurs when calling RunScriptProc.The ErrorPos gives the parameter number.
EToExpected - To expected
EDoExpected - Do expected
ERangeError - out of range
EOfExpected - Of expected
EndExpxcted - End expected
EOutOfRange - Out of range
EOpenBlockExpected - Open block expected
ECloseBlockExpected - Close block expected
EConstantExpected - Constant variable is expected
EIsExpected - The = was expected
EUnitNotFound - Unit was not found
EIntegerExpected - An integer is expected
ENotSupported - This is not supported in current version
EExitCommand - Internal use only: Exit is called
ECloseRoundExpected - Close round is expected
EUntilExpected - Until expected
EClassNotCreated - The class is not yet created.
EClassNotAllowedHere - No class declaration allowed here.
EClassTypeExpected - Class type is expected.
EDivideByZero - Divide by zero.
ECanNotOverride - Can not override this method.
EUnsatisfiedForward - Unsatisfied forward method.
EConstructorExpected - Constructor Expected here.
ENoInheritedAllowedHere - No inherited is allowed here.
EClassAlreadyFreed - class is already freed.
EClassReferenceNotAssigned - Class reference is not assigned.
ECanNotReadOrWriteProperty - Property should at least be readable or writeable.
EObjectExpected - Object Expected.
EVariantIsNil - Variant is nil.
ECustomError - Custom error
ECommentError - Error when parsing comments.
ECharError - Error when parsing char tokens.
EOutOfMemoryError - Out of memory error
Variant types:
CSV_NONE = Void/ERROR
CSV_UByte = Byte
CSV_SByte = ShortInt
CSV_UInt16 = Word
CSV_SInt16 = Integer (Delphi : SmallInt)
CSV_UInt32 = Longint (Delphi : Cardinal)
CSV_SInt32 = Longint
CSV_Char = Char
CSV_String = String
CSV_Real = Real
CSV_Single = Single
CSV_Double = Double
CSV_Extended = Extended
CSV_Comp = Comp
CSV_Bool = Boolean
CSV_Var = Variable in function call
CSV_Array = Array
CSV_Record = Record
CSV_Class = class
CSV_Internal = Script internal type that can be used to store resources.
CSV_ClassRef = Class of Class.
CSV_Property = Property
CSV_TypeCopy = Type
CSV_ProcVariable = Procedural variable/method variable
CSV_Special = Used for NIL maybe later for UNASSIGNED
CSV_ExternalObject - External object
CSV_ExternalObjectProperty - A property from an external object. Internal use.
CSV_Variant - A variant.
Functions:
function CreateCajVariant(PType: PTypeRec): PIfVariant;
Create a variant with the type PType.
procedure SetType(p: PIfVariant; PType: PTypeRec);
Change the type of P.
procedure DestroyCajVariant(p: PIfVariant);
Destroy the variant.
function VM_Create(InheritFrom: PVariableManager): PVariableManager;
Create a variant manager, used to store variables.
procedure VM_Destroy(p: PVariableManager);
Destroy a veriable manager.
function VM_Add(P: PVariableManager; D: PIfVariant; const Name: string): PIfVariant;
Add an item to the variable manager.
procedure VM_Delete(p: PVariableManager; Idx: LongInt);
Delete an item frm the variable manager.
function VM_Get(p: PVariableManager; Idx: LongInt): PIfVariant;
Return an item from the variable manager as a TIfVariant.
{$IFDEF VARIANTSUPPORT}function VM_GetVariant(p: PVariableManager; Idx: LongInt): Variant;{$ENDIF}
Return an item from the variable manager as an Delphi variant. Only works in >= D4.
procedure VM_SetName(p: PVariableManager; Idx: LongInt; S: string);
Set the name of a variable
function VM_Count(p: PVariableManager): LongInt;
Return the number of items in the variable manager
function VM_Find(p: PVariableManager; const Name: string): LongInt;
Search for a name in the variable manager.
procedure VM_Clear(p: PVariableManager);
Clear the variable manager.
function PM_Create: PProcedureManager;
Create a procedure manager. Used to store internal and external procedures.
procedure PM_Destroy(p: PProcedureManager);
Destroy the procedure manager.
procedure PM_Clear(p: PProcedureManager);
Clear the procedure manager.
function PM_AddExtOfObject(p: PProcedureManager; ScriptEngine: Pointer; const Name, Decl: string; {$IFNDEF NOCLASSES}ClassType: PTypeRec;{$ENDIF} Ext: Pointer; Addr: TRegisteredProcObject): PProcedure;
function PM_AddExt(p: PProcedureManager; ScriptEngine: Pointer; const Name, Decl: string; {$IFNDEF NOCLASSES}ClassType: PTypeRec;{$ENDIF} Ext, Addr: Pointer): PProcedure;
Adds an external function to the pproceduremanger.
function PM_AddInt(p: PProcedureManager; ScriptEngine: Pointer; const Name, Decl: string; {$IFNDEF NOCLASSES}ClassType: PTypeRec;{$ENDIF} Ext: Pointer; Offset: Longint): PProcedure;
Adds an internal function to the pproceduremanger.
function PM_Find(p: PProcedureManager; const Name: string): Integer;
Finds a procedure in the PProcedureManager list.
function PM_Get(p: PProcedureManager; i: LongInt): PProcedure;
Returns the Procedure at I.
function DoMinus(p: PIfVariant): Boolean;
Do the variable in P * -1
function DoNot(p: PIfVariant): Boolean;
Not the variable in P
function Perform(Types: PTypeManager; V1: PIfVariant; v2: PIfVariant; T: TPerformType): Boolean;
Perform something on V1.
procedure SetInteger(p: PIfVariant; I: LongInt);
Set P to I
procedure SetReal(p: PIfVariant; i: Extended);
Set P to I
procedure SetString(p: PIfVariant; const I: string);
Set P to I
procedure SetBoolean(p: PIfVariant; i: Boolean);
Set P to I
function IsStringType(v: PIfVariant): Boolean;
Return if V is a string
function IsIntRealType(v: PIfVariant): Boolean;
Return if V is an integer or real number.
function IsIntegerType(v: PIfVariant): Boolean;
Return if V is an integer.
function IsBooleanType(v: PIfVariant): Boolean;
Return if V is a boolean.
function IsRealType(v: PIfVariant): Boolean;
Return if v is a real type.
function GetString(v: PIfVariant): string;
Return V as a string.
function GetReal(v: PIfVariant): Extended;
Return V as a real.
function GetInteger(v: PIfVariant): LongInt;
Return v as an integer.
function GetBoolean(v: PIfVariant): Boolean;
Return v as a boolean.
function GetTypeLink(p: PTypeRec): PTypeRec;
Follows all CSV_TypeCopy types.
function GetVarLink(p: PIfVariant): PIfVariant;
Use this function to get the variable when it's used in function calls as a var parameter. Use it always.
function ErrorToString(e: TIfPasScriptError; const ErrorString: string): string;
Translate an error to a string.