Units
Class Hierarchy
Classes, Interfaces and Objects
Types
Variables
Constants
Functions and Procedures
Identifiers

Class TIFPSExec

Unit

ifps3

Declaration

type TIFPSExec = class(TObject)

Description

TIFPSExec is the core of the script engine executer

Fields

 NameDescription
Protected ExEx The error code
Protected ExObject The exception object from delphi
Protected ExParam The optional parameter for the error
Protected ExPos The position of the last error
Protected ExProc The proc where the last error occured
Protected FAttributeTypes  
Protected FCurrentPosition The current position in the current proc
Protected FCurrProc The current proc
Protected FCurrStackBase Current stack base
Protected FData The currproc^.data contents
Protected FDataLength Length of FData
Protected FExceptionStack The exception stack
Protected FExportedVars The list of exported variables
Protected FGlobalVars FGlobalVars contains the global variables of the current script
Protected FMainProc The main proc no or -1 (no main proc)
Protected FOnRunLine FOnRunLine event
Protected FProcs FProcs contains all script procedures
Protected FRegProcs List of all registered external functions
Protected FResources The list of resources
Protected FReturnAddressType  
Protected FSpecialProcList List of SpecialProcs; See TIFPSExec.AddSpecialProc
Protected FStack The Stack
Protected FStatus The current status of the script engine
Protected FTempVars Temporarily created variables
Protected FTypes FTypes contains all types used by the script
Protected FVariantArrayType  
Protected FVariantType  

Methods

Overview

Public constructor Create;
Public destructor Destroy; Override;
Public class function About: string;
Public procedure AddResource(Proc, P: Pointer);
Public procedure AddSpecialProcImport(const FName: string; P: TIFPSOnSpecialProcImport; Tag: Pointer);
Public procedure Cleanup; Virtual;
Public procedure Clear; Virtual;
Public procedure ClearFunctionList;
Public procedure ClearspecialProcImports;
Public procedure CMD_Err(EC: TIFError);
Public procedure CMD_Err2(EC: TIFError; const Param: string);
Public procedure CMD_Err3(EC: TIFError; const Param: string; ExObject: TObject);
Public procedure DeleteResource(P: Pointer);
Protected procedure ExceptionProc(proc, Position: Cardinal; Ex: TIFError; const s: string; NewObject: TObject); Virtual;
Public function FindProcResource(Proc: Pointer): Pointer;
Public function FindProcResource2(Proc: Pointer; var StartAt: Longint): Pointer;
Protected function FindSpecialProcImport(P: TIFPSOnSpecialProcImport): pointer;
Public function FindType(StartAt: Cardinal; BaseType: TIFPSBaseType; var l: Cardinal): PIFTypeRec;
Public function FindType2(BaseType: TIFPSBaseType): PIFTypeRec;
Public function GetProc(const Name: string): Cardinal;
Public function GetProcAsMethod(const ProcNo: Cardinal): TMethod;
Public function GetProcAsMethodN(const ProcName: string): TMethod;
Public function GetProcCount: Cardinal;
Public function GetProcNo(C: Cardinal): PIFProcRec;
Public function GetType(const Name: string): Cardinal;
Public function GetTypeCount: Longint;
Public function GetTypeNo(l: Cardinal): PIFTypeRec;
Public function GetVar(const Name: string): Cardinal;
Public function GetVar2(const Name: string): PIFVariant;
Public function GetVarCount: Longint;
Public function GetVarNo(C: Cardinal): PIFVariant;
Protected function ImportProc(const Name: ShortString; proc: TIFExternalProcRec): Boolean; Virtual;
Protected function InnerfuseCall(_Self, Address: Pointer; CallingConv: TIFPSCallingConvention; Params: TIfList; res: PIFPSVariantIFC): Boolean;
Public function IsValidResource(Proc, P: Pointer): Boolean;
Public function LoadData(const s: string): Boolean; virtual;
Public procedure Pause; Virtual;
Public procedure RaiseCurrentException;
Public procedure RegisterAttributeType(useproc: TIFPSAttributeUseProc; const TypeName: string);
Public procedure RegisterDelphiFunction(ProcPtr: Pointer; const Name: string; CC: TIFPSCallingConvention);
Public procedure RegisterDelphiMethod(Slf, ProcPtr: Pointer; const Name: string; CC: TIFPSCallingConvention);
Public function RegisterFunctionName(const Name: string; ProcPtr: TIFProc; Ext1, Ext2: Pointer): PProcRec;
Protected procedure RunLine; virtual;
Public function RunProc(Params: TIfList; ProcNo: Cardinal): Boolean;
Public function RunScript: Boolean;
Public procedure Stop; Virtual;

Description

Public constructor Create;

Create an instance of the executer

Public destructor Destroy; Override;

Destroy this instance of the executer

Public class function About: string;

This function will return about information

Public procedure AddResource(Proc, P: Pointer);

Add a resource

Public procedure AddSpecialProcImport(const FName: string; P: TIFPSOnSpecialProcImport; Tag: Pointer);

Add a special proc import; this is used for the dll and class library

Public procedure Cleanup; Virtual;

Reset all variables in the script to zero

Public procedure Clear; Virtual;

Clear the currently loaded script

Public procedure ClearFunctionList;

Clear the function list

Public procedure ClearspecialProcImports;

Clear the list of special proc imports

Public procedure CMD_Err(EC: TIFError);

Call CMD_Err to cause an error and stop the script

Public procedure CMD_Err2(EC: TIFError; const Param: string);

Call CMD_Err2 to cause an error and stop the script

Public procedure CMD_Err3(EC: TIFError; const Param: string; ExObject: TObject);

Call CMD_Err3 to cause an error and stop the script

Public procedure DeleteResource(P: Pointer);

Delete a resource

Protected procedure ExceptionProc(proc, Position: Cardinal; Ex: TIFError; const s: string; NewObject: TObject); Virtual;

ExceptionProc is called when an error occurs

Public function FindProcResource(Proc: Pointer): Pointer;

Find a resource

Public function FindProcResource2(Proc: Pointer; var StartAt: Longint): Pointer;

Find a resource

Protected function FindSpecialProcImport(P: TIFPSOnSpecialProcImport): pointer;

 

Public function FindType(StartAt: Cardinal; BaseType: TIFPSBaseType; var l: Cardinal): PIFTypeRec;

Search for a type (l is the starting position)

Public function FindType2(BaseType: TIFPSBaseType): PIFTypeRec;

Search for a type

Public function GetProc(const Name: string): Cardinal;

Get function that has been compiled with a name

Public function GetProcAsMethod(const ProcNo: Cardinal): TMethod;

Returns a TMethod for the procedure you specified (or nil), cast this to the function header you want to use and call it make sure it was exported with ExportDecl

Public function GetProcAsMethodN(const ProcName: string): TMethod;

Same as GetProcAsMethod but calls GetProc

Public function GetProcCount: Cardinal;

Return the number of procedures

Public function GetProcNo(C: Cardinal): PIFProcRec;

Get Proc no (C)

Public function GetType(const Name: string): Cardinal;

Get Type that has been compiled with a name

Public function GetTypeCount: Longint;

Return the number of types

Public function GetTypeNo(l: Cardinal): PIFTypeRec;

Return type no L

Public function GetVar(const Name: string): Cardinal;

Get variable that has been compiled with a name

Public function GetVar2(const Name: string): PIFVariant;

Get variable compiled with a name as a variant

Public function GetVarCount: Longint;

Return the number of variables

Public function GetVarNo(C: Cardinal): PIFVariant;

Get variable no (C)

Protected function ImportProc(const Name: ShortString; proc: TIFExternalProcRec): Boolean; Virtual;

ImportProc is called when the script needs to import an external function

Protected function InnerfuseCall(_Self, Address: Pointer; CallingConv: TIFPSCallingConvention; Params: TIfList; res: PIFPSVariantIFC): Boolean;

Call a method

Public function IsValidResource(Proc, P: Pointer): Boolean;

Check if P is a valid resource for Proc

Public function LoadData(const s: string): Boolean; virtual;

Load data into the script engine

Public procedure Pause; Virtual;

Pause the script engine

Public procedure RaiseCurrentException;

Raises the current Exception object, or if that doesn't exist, an EIFPS3Exception. If there is no current exception in ifps3 at all, it does nothing

Public procedure RegisterAttributeType(useproc: TIFPSAttributeUseProc; const TypeName: string);

Register Attribute Type

Public procedure RegisterDelphiFunction(ProcPtr: Pointer; const Name: string; CC: TIFPSCallingConvention);

Register a delphi function ProcPtr is a pointer to the proc to be called; Name is the name of that proc (uppercased). CC is the calling convention.

Public procedure RegisterDelphiMethod(Slf, ProcPtr: Pointer; const Name: string; CC: TIFPSCallingConvention);

Register a delphi function Slf is the self pointer, don't use nil, it won't work ProcPtr is a pointer to the proc to be called; Name is the name of that proc (uppercased). CC is the calling convention.

Public function RegisterFunctionName(const Name: string; ProcPtr: TIFProc; Ext1, Ext2: Pointer): PProcRec;

Register a function by name

Protected procedure RunLine; virtual;

RunLine function

Public function RunProc(Params: TIfList; ProcNo: Cardinal): Boolean;

Use RunProc to call a script function. The Params will not be freed after the call

Public function RunScript: Boolean;

Run the current script

Public procedure Stop; Virtual;

Stop the script engine

Properties

Overview

Public property CallCleanup: Boolean;
Public property ExceptionCode: TIFError;
Public property ExceptionObject: TObject;
Public property ExceptionPos: Cardinal;
Public property ExceptionProcNo: Cardinal;
Public property ExceptionString: string;
Public property Id: Pointer;
Public property OnException: TIFPSOnException;
Public property OnRunLine: TIFPSOnLineEvent;
Public property Status: TIFStatus;

Description

Public property CallCleanup: Boolean;

Set CallCleanup to false when you don't want the script engine to cleanup all variables after RunScript

Public property ExceptionCode: TIFError;

Contains the last error code

Public property ExceptionObject: TObject;

Contains the exception object

Public property ExceptionPos: Cardinal;

Contains the last error position

Public property ExceptionProcNo: Cardinal;

Contains the last error proc

Public property ExceptionString: string;

Contains the last error string

Public property Id: Pointer;

Optional tag of the script engine

Public property OnException: TIFPSOnException;

OnException is called when an exception occurs

Public property OnRunLine: TIFPSOnLineEvent;

The OnRunLine event is called after each executed script line

Public property Status: TIFStatus;

Status contains the current status of the scriptengine