Overload List
Overload 1: int DefineFunction(const DewString &AFunctName, TExprFunc AFuncAddress, int NArguments, int NResults, const DewString &Help);
Defines new function.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AFunctName | const DewString & | Defines function name. If a function with the same name was already definded, it is redefined and all expressions which contain the symbol AFuncName will be recompiled before the next evaluation. |
| 2 | AFuncAddress | TExprFunc | |
| 3 | NArguments | int | Defines number of arguments for function. |
| 4 | NResults | int | Defines number of arguments, which are treated as results. NResults <= NArguments |
| 5 | Help | const DewString & | Function help text. |
Examples
#include "MtxParseClass.h"
#include "MtxParseExpr.h"
#include "Units.Math387.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Math387;
static void _Factorial_D(TExprRec* Param)
{
Param->Res->DefineDouble();
Param->Res->DoubleValue = Fact((int)Round(Param->Args[0]->DoubleValue));
}
void Example()
{
TMtxExpression* MyParser = new TMtxExpression();
MyParser->DefineFunction("fact_double", _Factorial_D, 1, "fact_double(x): factorial function");
delete MyParser;
}
See Also: TMtxExpression::Undefine, TMtxExpression::VarByName, TMtxExpression::GetVarList, TMtxExpression::DefineVariable, TMtxExpression::DefineDouble, TMtxExpression::DefineComplex, TMtxExpression::DefineMatrix, TMtxExpression::DefineVector, TMtxExpression::DefineVaryingFunction, TMtxExpression::DefineOperator, TMtxExpression::DefineDoubleConstant, TMtxExpression::DefineComplexConstant
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler
Overload 2: int DefineFunction(const DewString &AFunctName, TExprFunc AFuncAddress, int NArguments, const DewString &Help);
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AFunctName | const DewString & | |
| 2 | AFuncAddress | TExprFunc | |
| 3 | NArguments | int | |
| 4 | Help | const DewString & |
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler
Overload 3: int DefineFunction(const DewString &AFunctName, TExprFunc AFuncAddress, int NArguments);
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AFunctName | const DewString & | |
| 2 | AFuncAddress | TExprFunc | |
| 3 | NArguments | int |
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler
Overload 4: int DefineFunction(const DewString &AFunctName, int NArguments, const TExprFuncObj &AFuncAddress);
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AFunctName | const DewString & | |
| 2 | NArguments | int | |
| 3 | AFuncAddress | const TExprFuncObj & |
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler
Overload 5: int DefineFunction(const DewString &AFunctName, int NArguments, const TExprFuncObj &AFuncAddress, const DewString &Help);
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AFunctName | const DewString & | |
| 2 | NArguments | int | |
| 3 | AFuncAddress | const TExprFuncObj & | |
| 4 | Help | const DewString & |
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler
Overload 6: int DefineFunction(const DewString &AFunctName, int NArguments, int NResults, const TExprFuncObj &AFuncAddress, const DewString &Help);
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AFunctName | const DewString & | |
| 2 | NArguments | int | |
| 3 | NResults | int | |
| 4 | AFuncAddress | const TExprFuncObj & | |
| 5 | Help | const DewString & |
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler