// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'CioinaEval.pas' rev: 6.00

#ifndef CioinaEvalHPP
#define CioinaEvalHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Classes.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Cioinaeval
{
//-- type declarations -------------------------------------------------------
typedef Extended TReal;

typedef Extended *PTReal;

typedef Extended *TVectorPTReal[536870910];

typedef PTReal *PVectorPTReal;

typedef DynamicArray<int >  PComand;

struct TRecord1;
typedef TRecord1 *PRecord1;

#pragma pack(push, 1)
struct TRecord1
{
	AnsiString StrExpr;
	AnsiString DerExpr;
	PTReal *ExtVect;
	int LenVect;
	bool Variab;
	bool PrFlag;
	bool PublFlag;
	DynamicArray<int >  Comand;
	DynamicArray<int >  Lista;
} ;
#pragma pack(pop)

#pragma pack(push, 1)
struct TRecord2
{
	PTReal *ProcInput;
	PTReal *ProcOut;
	int ProcParamCount;
	Word ProcId;
} ;
#pragma pack(pop)

struct TRecord3;
typedef TRecord3 *PRecord3;

#pragma pack(push, 1)
struct TRecord3
{
	AnsiString StrExpr;
	Extended *Value;
	bool ExternFlag;
	bool Protect;
} ;
#pragma pack(pop)

struct TUserVarRec;
typedef TUserVarRec *PTUserVarRec;

#pragma pack(push, 1)
struct TUserVarRec
{
	AnsiString StrExpr;
	Extended *Value;
	bool Protect;
} ;
#pragma pack(pop)

#pragma pack(push, 1)
struct WhileRecord
{
	int Proc;
	DynamicArray<int >  Test;
	DynamicArray<int >  Body;
} ;
#pragma pack(pop)

#pragma pack(push, 1)
struct IfRecord
{
	int Proc;
	DynamicArray<int >  Condition;
	DynamicArray<int >  ThenComand;
	DynamicArray<int >  ElseComand;
} ;
#pragma pack(pop)

#pragma pack(push, 1)
struct FuncRecord
{
	AnsiString Name;
	AnsiString Definition;
	int Proc;
	int PvCount;
	PTReal *PvInput;
	PTReal *PvOut;
	DynamicArray<int >  Body;
	unsigned StackIndex;
} ;
#pragma pack(pop)

typedef TRecord3 *TVector1[536870910];

typedef PRecord3 *PVector1;

typedef TRecord2 TVector3[153391688];

typedef TRecord2 *PVector3;

typedef Extended __fastcall (*TUserFunction)(PVectorPTReal Pv, int PvCount);

#pragma pack(push, 1)
struct TUserFuncRec
{
	AnsiString FuncName;
	TUserFunction FuncAddress;
	int VarCount;
	PTReal *PvInput;
} ;
#pragma pack(pop)

#pragma pack(push, 1)
struct TVarPropertyRec
{
	bool ProtectEndedWithNumber;
	bool ProtectEndedWithoutNumber;
} ;
#pragma pack(pop)

typedef DynamicArray<TUserFuncRec >  TUserFuncArray;

typedef DynamicArray<TUserVarRec >  TUserVarArray;

typedef DynamicArray<Extended >  TUserValuesArray;

typedef void __fastcall (__closure *TProcedureEvent)(System::TObject* Sender);

typedef void __fastcall (*TStdCallUserFunction)(PVectorPTReal Pv, int PvCount);

typedef DynamicArray<WhileRecord >  CioinaEval__2;

typedef DynamicArray<IfRecord >  CioinaEval__3;

typedef DynamicArray<FuncRecord >  CioinaEval__4;

typedef DynamicArray<PTReal >  CioinaEval__5;

typedef DynamicArray<PVectorPTReal >  CioinaEval__6;

typedef DynamicArray<PRecord1 >  CioinaEval__7;

typedef DynamicArray<Extended >  CioinaEval__8;

class DELPHICLASS TCioinaEval;
class PASCALIMPLEMENTATION TCioinaEval : public System::TObject 
{
	typedef System::TObject inherited;
	
private:
	DynamicArray<TUserFuncRec >  UserFuncArray;
	DynamicArray<WhileRecord >  WhileArray;
	DynamicArray<IfRecord >  IfArray;
	DynamicArray<FuncRecord >  RTFuncArray;
	DynamicArray<PTReal >  TempPTRealAr;
	DynamicArray<PVectorPTReal >  TempPVectorAr;
	DynamicArray<PRecord1 >  ListStr;
	DynamicArray<Extended >  fStack;
	PRecord3 *VarVect;
	TRecord2 *ListaProc;
	int VarCount;
	int VectCount;
	int ElemVectCount;
	int ProcCount;
	int ExtCount;
	int MathValueCount;
	int NumAllocMem;
	int RuleFlag;
	int fErrorNumber;
	int StackIndex;
	int ExceptionId;
	PTReal *MathValue;
	AnsiString MathExpr;
	AnsiString DerExpr;
	AnsiString DerVar;
	AnsiString ErrorMessage;
	bool fMathVariabFlag;
	bool fMathPublFlag;
	bool fMathPrFlag;
	bool fMathLinearFlag;
	bool PowerOperator;
	bool Derivation;
	bool ErrorMsg;
	bool fSpaceLikeMultiply;
	bool fOriginalMathExpressionString;
	DynamicArray<int >  ComandArray;
	unsigned fMaxIterations;
	unsigned fMaxStack;
	#pragma pack(push, 1)
	TVarPropertyRec fProtectVariables;
	#pragma pack(pop)
	
	void __fastcall PuneValoarea(int i, Extended d);
	int __fastcall fVariableLowIndex(void);
	PVector1 __fastcall ScoateVectorVar(void);
	AnsiString __fastcall ScoateNumeVar(int i);
	void __fastcall PuneNumeVar(int i, AnsiString s);
	void __fastcall PuneNumePointerVar(int i, const AnsiString s, PTReal pr, bool Protect);
	AnsiString __fastcall UsedFunc(Word i);
	void __fastcall SetOriginalMathExpressionString(bool l);
	AnsiString __fastcall fUserFuncName(int i);
	int __fastcall fUserFuncVarCount(int i);
	int __fastcall fUserFuncCount(void);
	AnsiString __fastcall fRunTimeFuncName(int i);
	AnsiString __fastcall fRunTimeFuncDefinition(int i);
	int __fastcall fRunTimeFuncCount(void);
	int __fastcall fRunTimeFuncVarCount(int i);
	void __fastcall AddToListStr(int k, PVectorPTReal Pv, bool FlagVar, bool FlagPr, bool FlagPubl, const int * Comand, const int Comand_Size, const int * Lista, const int Lista_Size, const AnsiString s, const AnsiString ds);
	void __fastcall Initializare(void);
	HIDESBASE void __fastcall Free(void);
	AnsiString __fastcall fExceptionInfo(int i);
	unsigned __fastcall fDynamicMemoryInfo(void);
	PVectorPTReal __fastcall NewPointerVector(int i);
	PTReal __fastcall NewPointerTReal(void);
	void __fastcall NewProc(const TRecord2 &Rec2);
	bool __fastcall CompOper(const AnsiString s, int i, bool flag);
	bool __fastcall CompOperAsoc(const AnsiString s, int i);
	void __fastcall Simplify(AnsiString &s);
	AnsiString __fastcall DerSqrt(AnsiString s);
	AnsiString __fastcall DerLn(AnsiString s);
	AnsiString __fastcall DerPutere(AnsiString s1, AnsiString s2);
	AnsiString __fastcall DerProdus(AnsiString s1, AnsiString s2);
	AnsiString __fastcall DerImpar(AnsiString s1, AnsiString s2);
	AnsiString __fastcall DerSuma(AnsiString s1, AnsiString s2);
	AnsiString __fastcall DerDif(AnsiString s1, AnsiString s2);
	Extended __fastcall MyPower(Extended d1, Extended d2, Extended d3);
	int __fastcall PosOperInMathStr(const char ch, const AnsiString s);
	bool __fastcall isSameStr(AnsiString s1, AnsiString s2);
	bool __fastcall isEqual(Extended x, Extended y);
	bool __fastcall EvalExpres(int i1, int i2, char c, Extended &d, TRecord2 &Rec2, AnsiString &ds3);
	int __fastcall EvalString(const AnsiString s);
	Extended __fastcall ValFunct(int k, int i, TRecord2 &Rec2, AnsiString &ds);
	bool __fastcall Functii(AnsiString s, int i, Extended &d, TRecord2 &Rec2, AnsiString &ds);
	bool __fastcall PriorOper(int i, int j, const AnsiString s);
	bool __fastcall Separ(AnsiString &s, int i, int n, int &j, int &t, char ch);
	AnsiString __fastcall StergeNumaiParant(const AnsiString s1);
	bool __fastcall IsNumber(const AnsiString s);
	bool __fastcall IsIntegerNumber(const AnsiString s);
	bool __fastcall IsRealNumber(const AnsiString s);
	void __fastcall StergeSpatii(AnsiString &s);
	void __fastcall FormatareaExponentei(AnsiString &s, bool m41Flag);
	void __fastcall ExpresieParant(AnsiString &s);
	void __fastcall ParseBack(AnsiString &s);
	void __fastcall ParseForward(AnsiString &s, char ch1, char ch2);
	void __fastcall Compile(AnsiString &s);
	__property AnsiString NumeVar[int i] = {read=ScoateNumeVar};
	__property Extended Valoarea[int i] = {write=PuneValoarea};
	void __fastcall ExceptieMatematica(int i, int EId);
	void __fastcall ExceptieExprConst(char c, Extended d1, Extended d2, int EId);
	void __fastcall ExceptieFunctie(PVectorPTReal Pv, int t, int i, int EId);
	int __fastcall ExpresieSemanticCorecta(AnsiString s, int i);
	void __fastcall VerifySyntaxSemanticsRule(AnsiString MathStr, AnsiString VarStr, AnsiString DerStr, const TUserVarRec * RecordVar, const int RecordVar_Size, bool DerFlag, bool CheckUnknownVar);
	void __fastcall VerifySyntaxSemanticsRuleExit(char ch);
	void __fastcall Execute(void);
	void __fastcall ExecuteComand(const int * Comand, const int Comand_Size);
	void __fastcall FillValuesArray(const Extended * VarValues, const int VarValues_Size);
	AnsiString __fastcall Transform(const AnsiString s);
	AnsiString __fastcall MathematicaForm(const AnsiString PascalForm);
	AnsiString __fastcall GetMath(int Index);
	AnsiString __fastcall GetDerivative(int Index);
	AnsiString __fastcall GetVariable(void);
	int __fastcall fTotalFunctionCount(void);
	void __fastcall ReplaceFirstChar(AnsiString &s, const AnsiString OldPattern);
	
protected:
	virtual void __fastcall fClearMathLinkString(void);
	
public:
	Classes::TNotifyEvent OnVerifySyntaxSemanticsError;
	Classes::TNotifyEvent OnDoMathExpressionError;
	TStdCallUserFunction OnStdCallUserFunction;
	/*         class method */ static AnsiString __fastcall OwnerInfo(TMetaClass* vmt);
	/*         class method */ static AnsiString __fastcall VersionInfo(TMetaClass* vmt);
	/*         class method */ static AnsiString __fastcall TypeInfo(TMetaClass* vmt);
	/*         class method */ static AnsiString __fastcall DedicationInfo(TMetaClass* vmt);
	bool __fastcall IsValidIdentName(AnsiString s);
	bool __fastcall IsExistString(AnsiString &s, AnsiString &ss, bool flag);
	void __fastcall ExpressionReplace(AnsiString &s, const AnsiString OldPattern, const AnsiString NewPattern);
	Extended __fastcall DoMathExpression(void)/* overload */;
	Extended __fastcall DoMathExpression(TUserValuesArray VarValues)/* overload */;
	PVectorPTReal __fastcall DoVectorOfMathExpressions(void)/* overload */;
	PVectorPTReal __fastcall DoVectorOfMathExpressions(TUserValuesArray VarValues)/* overload */;
	Extended __fastcall DoRunTimeFunction(int i, TUserValuesArray Values);
	Extended __fastcall DoUserFunction(int i, TUserValuesArray Values);
	void __fastcall Clear(void);
	void __fastcall VerifySyntaxSemantics(AnsiString MathStr, AnsiString VarStr, bool CheckUnknownVar)/* overload */;
	void __fastcall VerifySyntaxSemantics(AnsiString MathStr)/* overload */;
	void __fastcall VerifySyntaxSemantics(AnsiString MathStr, TUserVarArray RecordVar, bool CheckUnknownVar)/* overload */;
	void __fastcall VerifySyntaxSemanticsAndDerivation(AnsiString MathStr, AnsiString VarStr, AnsiString DerStr, bool CheckUnknownVar)/* overload */;
	void __fastcall VerifySyntaxSemanticsAndDerivation(AnsiString MathStr, AnsiString DerStr)/* overload */;
	void __fastcall VerifySyntaxSemanticsAndDerivation(AnsiString MathStr, TUserVarArray RecordVar, AnsiString DerStr, bool CheckUnknownVar)/* overload */;
	void __fastcall DeleteParantheses(AnsiString &s);
	void __fastcall ClearMathExpressionString(void);
	void __fastcall ClearDerivativeExpressionString(void);
	__property bool ProtectVariablesEndedWithNumber = {read=fProtectVariables.ProtectEndedWithNumber, write=fProtectVariables.ProtectEndedWithNumber, nodefault};
	__property bool ProtectVariablesEndedWithoutNumber = {read=fProtectVariables.ProtectEndedWithoutNumber, write=fProtectVariables.ProtectEndedWithoutNumber, nodefault};
	__property TVarPropertyRec ProtectVariables = {read=fProtectVariables, write=fProtectVariables};
	__property bool SpaceLikeMultiply = {read=fSpaceLikeMultiply, write=fSpaceLikeMultiply, nodefault};
	__property int TotalFunctionCount = {read=fTotalFunctionCount, nodefault};
	__property unsigned MaxIterations = {read=fMaxIterations, write=fMaxIterations, nodefault};
	__property unsigned MaxStack = {read=fMaxStack, write=fMaxStack, nodefault};
	__property int VariableLowIndex = {read=fVariableLowIndex, nodefault};
	__property int VariableCount = {read=VarCount, nodefault};
	__property AnsiString VariableName[int i] = {read=ScoateNumeVar};
	__property PVector1 VariableArray = {read=ScoateVectorVar};
	__property int MathExpressionCount = {read=MathValueCount, nodefault};
	__property AnsiString MathExpressionString = {read=GetMath, index=0};
	__property AnsiString DerivativeExpressionString = {read=GetDerivative, index=0};
	__property AnsiString DerivativeVariableString = {read=DerVar};
	__property AnsiString MathematicaFormVariableNames = {read=GetVariable};
	__property AnsiString MathematicaFormMathExpressionString = {read=GetMath, index=1};
	__property AnsiString MathematicaFormDerivativeExpressionString = {read=GetDerivative, index=1};
	__property bool ErrorFlag = {read=ErrorMsg, nodefault};
	__property int ErrorNumber = {read=fErrorNumber, nodefault};
	__property AnsiString ErrorMessageInfo = {read=ErrorMessage};
	__property int UserFunctionCount = {read=fUserFuncCount, nodefault};
	__property int UserFunctionVarCount[int i] = {read=fUserFuncVarCount};
	__property AnsiString UserFunctionName[int i] = {read=fUserFuncName};
	__property int RunTimeFunctionCount = {read=fRunTimeFuncCount, nodefault};
	__property int RunTimeFunctionVarCount[int i] = {read=fRunTimeFuncVarCount};
	__property AnsiString RunTimeFunctionName[int i] = {read=fRunTimeFuncName};
	__property AnsiString RunTimeFunctionDefinition[int i] = {read=fRunTimeFuncDefinition};
	__property AnsiString BuiltInFunctionInfo[Word i] = {read=UsedFunc};
	__property bool IsMathExpressionVariable = {read=fMathVariabFlag, nodefault};
	__property bool IsMathExpressionPublic = {read=fMathPublFlag, nodefault};
	__property bool IsMathExpressionProtected = {read=fMathPrFlag, nodefault};
	__property bool IsMathExpressionLinear = {read=fMathLinearFlag, nodefault};
	__property int MathException = {read=ExceptionId, nodefault};
	__property AnsiString ExceptionInfo[int i] = {read=fExceptionInfo};
	__property bool SetPowerOperator = {read=PowerOperator, write=PowerOperator, nodefault};
	__property unsigned AllocDynamicMemoryInfo = {read=fDynamicMemoryInfo, nodefault};
	__property bool OriginalMathExpressionString = {read=fOriginalMathExpressionString, write=SetOriginalMathExpressionString, nodefault};
	__fastcall TCioinaEval(void)/* overload */;
	__fastcall TCioinaEval(TUserFuncArray FuncArray)/* overload */;
	__fastcall virtual ~TCioinaEval(void);
};


//-- var, const, procedure ---------------------------------------------------
#define TrialMsg "Sorry but trial version can parse strings with limitated l"\
	"ength"
extern PACKAGE Extended TRealZero;
#define MathLinkZeroStr "(1.0*^-18)"
static const int MaxPTReal = 0x1ffffffe;
extern PACKAGE int MaxFuncParam;
extern PACKAGE Word MaxUserFunc;
static const Shortint OperCount = 0x7;
static const int MaxVar = 0x1ffffffe;
static const int MaxProc = 0x9249248;
static const Shortint FunCount = 0x52;
extern PACKAGE System::SmallString<16>  aStr[82];
static const Shortint EX_NONMATH = 0x0;
static const Shortint EX_Overflow = 0x1;
static const Shortint EX_Underflow = 0x2;
static const Shortint EX_InvalidArgument = 0x3;
static const Shortint EX_ZeroDivide = 0x4;
static const Shortint EX_InvalidOp = 0x5;
static const Shortint ERR_NOERROR = 0x0;
static const Shortint ERR_NO_MATH_EXPRESSION_WAS_PARSED = 0xffffffff;
static const Shortint ERR_PARANTHESES_SYNTAX_ERROR = 0xfffffffe;
static const Shortint ERR_INVALID_DERIVATIVE_VARIABLE_NAME = 0xfffffffd;
static const Shortint ERR_MATH_EXPRESSION_IS_EMPTY = 0xfffffffc;
static const Shortint ERR_IDENTIFIER_CANNOT_BE_EMPTY = 0xfffffffb;
static const Shortint ERR_IDENTIFIER_LENGTH = 0xfffffffa;
static const Shortint ERR_NOT_PASCAL_IDENTIFIER = 0xfffffff9;
static const Shortint ERR_IDENTIFIER_CANNOT_BE_RESERVED_NAME = 0xfffffff8;
static const Shortint ERR_IDENTIFIER_ALREADY_EXISTS = 0xfffffff7;
static const Shortint ERR_DUBLICATING_USER_IDENTIFIER = 0xfffffff6;
static const Shortint ERR_UNKNOWN_EXPRESSION = 0xfffffff5;
static const Shortint ERR_BAD_EXPONENTIAL_FORMAT = 0xfffffff4;
static const Shortint ERR_SET_OriginalMathExpressionString_FALSE = 0xfffffff3;
static const Shortint ERR_MATH_EXPRESSION_WAS_ERASED = 0xfffffff2;
static const Shortint ERR_USE_VerifySyntaxSemanticsAndDerivation = 0xfffffff1;
static const Shortint ERR_DERIVATIVE_EXPRESSION_WAS_ERASED = 0xfffffff0;
static const Shortint ERR_VARIABLES_AND_VALUES_ARE_DIFFERENT = 0xffffffef;
static const Shortint ERR_MATH_EXPRESSIONS_ARRAY = 0xffffffee;
static const Shortint ERR_FUNCTION_NUMBER_MUST_BE_LESS = 0xffffffed;
static const Shortint ERR_FUNCTION_ADDRESS_CANNOT_BE_NIL = 0xffffffec;
static const Shortint ERR_PROTECTED_EXPRESSION = 0xffffffeb;
static const Shortint ERR_PARSE = 0xffffffea;
static const Shortint ERR_EXECUTE = 0xffffffe9;
static const Shortint ERR_DYNAMIC_MEMORY = 0xffffffe8;
static const Shortint ERR_MULTIPLY = 0xffffffe7;
static const Shortint ERR_DIVISION = 0xffffffe6;
static const Shortint ERR_PLUS = 0xffffffe5;
static const Shortint ERR_MINUS = 0xffffffe4;
static const Shortint ERR_POWER = 0xffffffe3;
static const Shortint ERR_EQUAL = 0xffffffe2;
static const Shortint ERR_UNKNOWN_FUNCTION = 0xffffffe1;
static const Shortint ERR_UNKNOWN_VARIABLE = 0xffffffe0;
static const Shortint ERR_BAD_SYNTAX = 0xffffffdf;
static const Shortint ERR_COMMA_SYNTAX = 0xffffffde;
static const Shortint ERR_SYSTEM_STACK_OVERFLOW = 0xffffffdd;
static const Shortint ERR_DEF_FUNC_NAME = 0xffffffdc;
static const Shortint ERR_DEF_FUNC_DUBLICATING = 0xffffffdb;
static const Shortint ERR_DEF_FUNC_IMPLEMENTING = 0xffffffda;
static const Shortint ERR_DEF_FUNC_ARG_COUNT = 0xffffffd9;
static const Shortint ERR_DEF_FUNC_ARG_NAME = 0xffffffd8;
static const Shortint ERR_DEF_FUNC_ARG_DUBLICATING = 0xffffffd7;
static const Shortint ERR_DEF_FUNCTION_STACK_OVERFLOW = 0xffffffd6;

}	/* namespace Cioinaeval */
using namespace Cioinaeval;
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// CioinaEval
