Class TCustomFormula (unit FC)

Inherits from

TComponent

TCustomFormula - predecessor of TFormulaCompiler components } { It provides all common properties and methods

Constructors


constructor Create(AOwner: TComponent);

TCustomFormula methods


Functions

destructor Destroy;

prepare to call event

function NewFunction(const S: String): Integer;

sets new formula - returns error code

FLD1 (D9E8); FWAIT (9B); RET (C3);


procedure Recompile;

recompile Source

recompile Source


procedure Loaded;


procedure Notification(AComponent: TComponent; Operation: TOperation);


function Compile(S: String; var Code: PChar; var CodeSize: Integer; var Cnst: PChar; var ConstSize: Integer; NameList: TStringList): Integer;

Compile S into machine code } { Code - pointer to copiled code, CodeSize - size of code } { Cnst - pointer to array of constants, ConstSize - size of Cnst } { NameList - list of unknown names (aliases which are not defined in FLib)

Main method - compilation of expression


function GetArgs: Integer;

get number of arguments in Source

function OnFuncCall(Index: Integer; ParamCount: Integer; Offs: Integer): Extended;

OnFuncCall is called from the compiled code

function OnVarCall(Index: Integer): Extended;

OnVarCall is called from the compiled code

procedure SetSource(NewValue: String);


procedure SetUnknownNames(NewValue: Boolean);


Properties

property Args : Integer

Runtime only and read only .

property Lib : TFormulaLib

assigned user library

property Source : String

formula

property UnknownNames : Boolean


Events

event OnFunction : TFunctionEvent


event OnVariable : TVariableEvent


Variables

FCode : PChar;


FCodeSize : Integer;

compiled code of Source

FConst : PChar;

code size

FConstSize : Integer;

array of used constants

FLib : TFormulaLib;


FNameList : TStringList;


FOnFunction : TFunctionEvent;


FOnVariable : TVariableEvent;


FOptions : Integer;

size of FConst

FSource : String;


FUnknownNames : Boolean;

TFormulaLib - assigned user library


Constructors


constructor Create(AOwner: TComponent);

TCustomFormula methods


Functions


destructor Destroy;

prepare to call event


function NewFunction(const S: String): Integer;

sets new formula - returns error code

FLD1 (D9E8); FWAIT (9B); RET (C3);


procedure Recompile;

recompile Source

recompile Source


procedure Loaded;


procedure Notification(AComponent: TComponent; Operation: TOperation);


function Compile(S: String; var Code: PChar; var CodeSize: Integer; var Cnst: PChar; var ConstSize: Integer; NameList: TStringList): Integer;

Compile S into machine code } { Code - pointer to copiled code, CodeSize - size of code } { Cnst - pointer to array of constants, ConstSize - size of Cnst } { NameList - list of unknown names (aliases which are not defined in FLib)

Main method - compilation of expression


function GetArgs: Integer;

get number of arguments in Source


function OnFuncCall(Index: Integer; ParamCount: Integer; Offs: Integer): Extended;

OnFuncCall is called from the compiled code


function OnVarCall(Index: Integer): Extended;

OnVarCall is called from the compiled code


procedure SetSource(NewValue: String);


procedure SetUnknownNames(NewValue: Boolean);


Properties


property Args : Integer

Runtime only and read only . Number of arguments


property Lib : TFormulaLib

assigned user library


property Source : String

formula


property UnknownNames : Boolean


Events


event OnFunction : TFunctionEvent


event OnVariable : TVariableEvent


Variables


FCode : PChar;


FCodeSize : Integer;

compiled code of Source


FConst : PChar;

code size


FConstSize : Integer;

array of used constants


FLib : TFormulaLib;


FNameList : TStringList;


FOnFunction : TFunctionEvent;


FOnVariable : TVariableEvent;


FOptions : Integer;

size of FConst


FSource : String;


FUnknownNames : Boolean;

TFormulaLib - assigned user library