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

Class TIFPS3CompExec

Unit

IFPS3CompExec

Declaration

type TIFPS3CompExec = class(TComponent)

Description

TIFPS3CompExec can be used for compiling and executing scripts

Methods

Overview

Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public function AddFunction(Ptr: Pointer; const Decl: string): Boolean;
Public function AddFunctionEx(Ptr: Pointer; const Decl: string; CallingConv: TDelphiCallingConvention): Boolean;
Public function AddMethod(Slf, Ptr: Pointer; const Decl: string): Boolean;
Public function AddMethodEx(Slf, Ptr: Pointer; const Decl: string; CallingConv: TDelphiCallingConvention): Boolean;
Public function AddRegisteredVariable(const VarName, VarType: string): Boolean;
Public function Compile: Boolean;
Public function CompilerErrorToStr(I: Longint): string;
Public function Execute: Boolean;
Public procedure GetCompiled(var data: string);
Public function GetVariable(const Name: string): PIFVariant;
Public procedure SetCompiled(const Data: string);
Public function SetVarToInstance(const VarName: string; cl: TObject): Boolean;
Public function TranslatePositionPos(Proc, Position: Cardinal; var Pos: Cardinal): Boolean;
Public function TranslatePositionRC(Proc, Position: Cardinal; var Row, Col: Cardinal): Boolean;

Description

Public constructor Create(AOwner: TComponent); override;

 

Public destructor Destroy; override;

 

Public function AddFunction(Ptr: Pointer; const Decl: string): Boolean;

Add a function to the script engine, with cdRegister as a calling convention

Public function AddFunctionEx(Ptr: Pointer; const Decl: string; CallingConv: TDelphiCallingConvention): Boolean;

Add a function to the script engine

Public function AddMethod(Slf, Ptr: Pointer; const Decl: string): Boolean;

Add a method to the script engine, with cdRegister as a calling convention

Public function AddMethodEx(Slf, Ptr: Pointer; const Decl: string; CallingConv: TDelphiCallingConvention): Boolean;

Add a method to the script engine, slf should be the self pointer, ptr should be the procedural pointer, for example: Form1.Show
AddMethod(Form1, WARNING: @TForm1.Show, 'procedure Show;', cdRegister);

Public function AddRegisteredVariable(const VarName, VarType: string): Boolean;

Add a variable to the script engine that can be used at runtime with the GetVariable function

Public function Compile: Boolean;

Compile the script

Public function CompilerErrorToStr(I: Longint): string;

Convert a compiler message to a string

Public function Execute: Boolean;

Execute the compiled script

Public procedure GetCompiled(var data: string);

Returns the compiled data, first call Compile

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

Returns the variable with the name Name

Public procedure SetCompiled(const Data: string);

Load compiled data in the script engine

Public function SetVarToInstance(const VarName: string; cl: TObject): Boolean;

Set a variable to an object instance

Public function TranslatePositionPos(Proc, Position: Cardinal; var Pos: Cardinal): Boolean;

Translate a Proc+ByteCode position into an offset in the script

Public function TranslatePositionRC(Proc, Position: Cardinal; var Row, Col: Cardinal): Boolean;

Translate a Proc+ByteCode position into an row/col in the script

Properties

Overview

Published property About: string;
Public property Comp: TIFPSPascalCompiler;
Public property CompilerMessageCount: Longint;
Public property CompilerMessages[i: Longint]: TIFPSPascalCompilerMessage;
Published property CompilerOptions: TIFPS3CompOptions;
Public property Exec: TIFPSDebugExec;
Public property ExecErrorByteCodePosition: Cardinal;
Public property ExecErrorCode: TIFError;
Public property ExecErrorCol: Cardinal;
Public property ExecErrorParam: string;
Public property ExecErrorPosition: Cardinal;
Public property ExecErrorProcNo: Cardinal;
Public property ExecErrorRow: Cardinal;
Public property ExecErrorToString: string;
Published property OnAfterExecute: TIFPS3CompExecEvent;
Published property OnCompile: TIFPS3CompExecEvent;
Published property OnCompImport: TIFPS3ClOnCompImport;
Published property OnExecImport: TIFPS3ClOnExecImport;
Published property OnExecute: TIFPS3CompExecEvent;
Published property OnLine: TNotifyEvent;
Public property Running: Boolean;
Published property Script: TStrings;
Published property UseDebugInfo: Boolean;

Description

Published property About: string;

About this script engine

Public property Comp: TIFPSPascalCompiler;

PascalCompiler object

Public property CompilerMessageCount: Longint;

Returns the number of compiler messages

Public property CompilerMessages[i: Longint]: TIFPSPascalCompilerMessage;

Return compiler message number I

Published property CompilerOptions: TIFPS3CompOptions;

Compiler options

Public property Exec: TIFPSDebugExec;

Exec object

Public property ExecErrorByteCodePosition: Cardinal;

The bytecode offset the runtime error occured in

Public property ExecErrorCode: TIFError;

Runtime errors: error code

Public property ExecErrorCol: Cardinal;

The Col in the script the error occured in, does not work when DebugInfo = False

Public property ExecErrorParam: string;

Runtime errors: more information for th eerror

Public property ExecErrorPosition: Cardinal;

The offset in the script the error occured in, does not work when DebugInfo = False

Public property ExecErrorProcNo: Cardinal;

The procedure number the runtime error occured in

Public property ExecErrorRow: Cardinal;

The Row in the script the error occured in, does not work when DebugInfo = False

Public property ExecErrorToString: string;

Convert an errorcode + errorparam to a string

Published property OnAfterExecute: TIFPS3CompExecEvent;

OnAfterExecute is called when the script is done executing

Published property OnCompile: TIFPS3CompExecEvent;

OnCompile event is called when the script is about to be compiled

Published property OnCompImport: TIFPS3ClOnCompImport;

OnCompImport is called when you can import your functions and classes into the compiler

Published property OnExecImport: TIFPS3ClOnExecImport;

OnCompImport is called when you can import your functions and classes into the exec

Published property OnExecute: TIFPS3CompExecEvent;

OnExecute event is called when the script is about to the executed, useful for changing variables within the script

Published property OnLine: TNotifyEvent;

OnLine event, is called after each bytecode position, useful for checking messages to make sure longer scripts don't block the application

Public property Running: Boolean;

Is the script running now?

Published property Script: TStrings;

The current script

Published property UseDebugInfo: Boolean;

UseDebugInfo should be true when you want to use debug information, like position information in the script, it does make the executing a bit slower