SMath Studio Forum
»
SMath Studio
»
Questions
»
API - function name with subscript
Rank: Newbie
Groups: Registered
Joined: 20/02/2017(UTC) Posts: 5 Was thanked: 1 time(s) in 1 post(s)
|
Hi! My next question about Smath API is about function names. Is there any possibility to create function with subscript in its name? Below I present some code which contains definition of function. I want to obtain function like: greek epsilon <subscript {c3} >. Can it be done? Code: public static TermInfo GetTermInfo()
{
return new TermInfo(
"ε.c3",
TermType.Function,
"ec3 value of concrete class.",
FunctionSections.Unknown,
true,
new ArgumentInfo(ArgumentSections.Variable, true)
);
}
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Yes, you can. Script:
Code:var def = new Definition( "\u03b5.c3", // or @"ε.c3"
new Term[] { new Term( "1", TermType.Operand, 0) },
new Term[] { new Term( "x", TermType.Operand, 0) } );
store.AddDefinition( def );
|
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
Rank: Newbie
Groups: Registered
Joined: 20/02/2017(UTC) Posts: 5 Was thanked: 1 time(s) in 1 post(s)
|
Thank you again - now I see that it can be done but your answer results in two more questions: 1) How are you including C# code in Smath region? Is it just print screen or real code in some type of region which is evaluating on fly? Looks like magic for me (in MathCAD it is impossible to do such things). 2) You are using Definition and Store classes. During searching in example plugins I found that there are used mainly in customizable controls. I am developing some sort of functions by implementing IPluginHandleEvaluation interface. Code:
public TermInfo[] TermsHandled
{
get
{
return this.termInfos;
}
}
public void Initialize()
{
this.assemblyInfos = new[]
{
new AssemblyInfo("SMath Studio", new Version(0, 98), new Guid("a37cba83-b69c-4c71-9992-55ff666763bd"))
};
this.termInfos = new[]
{
Fck.GetTermInfo(),
Fck_cube.GetTermInfo()
};
}
//Example GetTermInfo function
public static TermInfo GetTermInfo()
{
return new TermInfo(
"Fck",
TermType.Function,
"Fck value of concrete class.",
FunctionSections.Unknown,
true,
new ArgumentInfo(ArgumentSections.Variable, true)
);
}
How to combine your solution (Store and Definition) with TermInfo[]?
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 10/11/2010(UTC) Posts: 1,494 Was thanked: 1274 time(s) in 745 post(s)
|
Quote:1) How are you including C# code in Smath region? Is it just print screen or real code in some type of region which is evaluating on fly? Looks like magic for me (in MathCAD it is impossible to do such things). Yes, the code is executed on the fly. This is just a Script region. Quote:2) You are using Definition and Store classes. During searching in example plugins I found that there are used mainly in customizable controls. I am developing some sort of functions by implementing IPluginHandleEvaluation interface. This is features of Script region. In your case, you have to write it differently. I just showed that this will work. |
Russia ☭ forever Viacheslav N. Mezentsev |
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
API - function name with subscript
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.