Innerfuse Pascal Script
Back to Index.

The file ifspas.pas contains the script engine.

Types:
TIfPasScript
TIFSError
TOnUses = function(id: Pointer; Sender: TIfPasScript; Name: string): TIfPasScriptError;
TOnUses is an event that is used by TIfPasScript. It is called every time a script runs with with a name 'SYSTEM'. If the script includes an Uses, it is also called.
TOnRunLine = function(id: Pointer; Sender: TIfPasScript; Position: Longint): TIfPasScriptError;
TOnRunLine is an event that is used by TIfPasScript. It is called every line in the script engine.

TResourceFree = procedure(id: Pointer; Data: Pointer);
TResourceFree is used by TIfPasScript.AddResource and RemoveResource.

TOnExternal = function(id: Pointer; Sender: TIfPasScript; const Param, FuncName: string; Func: PProcedure; const CallingConvention: string): Boolean;
TOnExternal is an event that is used by TIfPasScript. It is called for each external function in the script.


Functions:
function GetClassVariable(Self: PIfVariant; ProcClass: PIFSClassType; const Name: string; var thevar: PIfVariant; AlsoProtected: Boolean): Boolean;
function GetClassVariable2(Self: PCreatedClass; ProcClass: PIFSClassType; const Name: string; var thevar: PIfVariant; AlsoProtected: Boolean): Boolean;
Returns a variable that is in a class.

function GetClassProcedure(Self: PIfVariant; ProcClass: PIFSClassType; const Name: string; var proc: PProcedure; AlsoProtected: Boolean): Boolean;
Returns a method pointer.

function GetInheritedProc(CurrProc: PProcedure): PProcedure;
Returns where function CurrProc inherits from (or nil).

procedure RegisterStdLib(p: TIfPasScript; OnlySafe: Boolean);
Register the standard library. If onlysafe is true, All Floating point functions are disabled (cos, sin, tan, round etc).
Installs:
Function StrGet(S : String; I : Integer) : Char;
Function StrSet(c : Char; I : Integer; var s : String) : Char;
Function Ord(C : Char) : Byte;
Function Chr(B : Byte) : Char;
Function StrToInt(s : string;def : Longint) : Longint;
Function IntToStr(i : Longint) : String;
Function Uppercase(s : string) : string;
Function Lowercase(s : string) : string;
Function Trim(s : string) : string;
Function Copy(S : String; Indx, Count : Integer) : String;
Procedure Delete(var S : String; Indx, Count : Integer);
Function Pos(SubStr, S : String) : Integer;
Procedure Insert(Source : String; var Dest : String; Indx : Integer);
Function Length(s : String) : Longint;
procedure SetLength(var S: String; L: Longint);
Function Sin(e : Extended) : Extended;
Function Cos(e : Extended) : Extended;
Function Sqrt(e : Extended) : Extended;
Function Round(e : Extended) : Longint;
Function Trunc(e : Extended) : Longint;
Function Int(e : Extended) : Longint;
Function Pi : Extended;
Function Abs(e : Extended) : Extended;
Function Sqrt(e : Extended) : Extended;
Function FloatToStr(e : Extended) : String;
Function Padl(s : string;I : longInt) : string;
Function Padr(s : string;I : longInt) : string;
Function Padz(s : string;I : longInt) : string;
Function Replicate(c : char;I : longInt) : string;
Function StringOfChar(c : char;I : longInt) : string;
procedure SetArrayLength(var u: array; Length: Longint);
function GetArrayLength(var u: array): Longint;
function GetType(const data): String;
function Assigned(const data): Boolean;
function Low(var u: array): Longint;
function High(var u: array): Longint;

Type
TObject = class
public
Constructor Create;
Destructor Destroy; virtual;
procedure Free;

function ClassNameIs(FType: string): Boolean;
function ClassName: string;
function GetAncestors: string;
end;

procedure RegisterExceptionLib(Sender: TIfPasScript);
Registers the exception support library.
function GetLastErrorCode: word;
function GetLastErrorParam: string;
function GetLastErrorModule: string;
function GetLastErrorAsString: string;
function GetLastErrorPosition: Longint;
procedure RaiseError(ErrorCode: Word; Param: string);


Copyright (c) 2001 by Carlo Kok
last update: 24-11-01