TIfPasScript

Unit: IFSPas.Pas
TIFPasScript is the pascal script engine.

TIfPasScript = class
Variables: PVariableManager;
Use this to read of write to variables in the script engine. Add variables only in the OnUses event.

Types: PTypeManager;
Use this to add types to the scriptengine. Only do this when the script engine is running. (In OnUses)

function AddFunction(Proc: Pointer; Decl: String): Boolean;
Add an external function to the script engine. Decl is the standard pascal function header. Proc is a pointer to a TRegisteredProc like procedure.

procedure RunScript;
Run the script.

function RunScriptProc(const Name: string; Parameters: PVariableManager): PIfVariant;
Run a procedure inside the script. Errors are returned in ErrorCode an ErrorPos properties.

procedure AddResource(FreeProc: TResourceFree; Data: Pointer);
Add a resource to the script engine.

procedure RemoveResource(Data: Pointer);
Remove a resource from the script engine.

function IsValidResource(FreeProc: TResourceFree; Data: Pointer): Boolean;
Check if it is really your resource (FreeProc should be the same as in AddResource).

procedure SetText(p: Pchar);
Change the pascal code inside.

constructor Create(ID: Pointer);
Create the script engine. ID is only used as an pointer that you can use freely.

destructor Destroy; override;
Destroy the script engine.

property GetText: Pchar //readonly
Return the current text in the engine.

property OnRunLine: TOnRunLine;
OnRunLine event.

property OnUses: TOnUses;
OnUses event.

property ErrorCode: TIfsError//readonly
The error that has happened in the script.

property ErrorPos: LongInt; //readonly
The position of the error that has occured.
end;