MapleEval
evaluate a Maple object in external code
EvalMapleProc
evaluate a Maple function object in external code
EvalMapleStatement
parse and evaluate a command string in external code
Calling Sequence
Parameters
Description
Examples
MapleEval(kv, s)
EvalMapleProc(kv, fn, n, arg1, arg2, ..., argN)
EvalMapleStatement(kv, statement)
kv
-
kernel handle of type MKernelVector
s
type ALGEB object
fn
Maple Procedure object of type ALGEB
n
number of args following
arg1, ..., argN
type ALGEB arguments to fn
statement
command string
These functions can be used in external code with OpenMaple or define_external.
MapleEval evaluates the given Maple object, s. Evaluation is performed according to the rules used by the eval command.
EvalMapleProc invokes the procedure, fn(arg1, arg2, ..., argN), where n specifies the number of arguments supplied to the function call. The result of the evaluation is returned as a Maple object. fn must be a Procedure object.
EvalMapleStatement parses and executes the command string given in the statement argument. MapleAssign can be used to give external objects names that can be referenced in a command string. The command string must be terminated by a colon or semicolon. When using this command in OpenMaple, a colon suppresses the display of output.
#include "maplec.h"
ALGEB M_DECL MyStats( MKernelVector kv, ALGEB *args )
{
ALGEB mean, sd, f;
if( 1 != MapleNumArgs(kv,(ALGEB)args) ) {
MapleRaiseError(kv,"one argument expected");
return( NULL );
}
if( !IsMapleList(kv,args[1]) ) {
MapleRaiseError(kv,"list expected");
f = EvalMapleStatement(kv,"Statistics[Mean]:");
mean = EvalMapleProc(kv,f,1,args[1]);
f = EvalMapleStatement(kv,"Statistics[StandardDeviation]:");
f = ToMapleFunction(kv,f,1,args[1]);
sd = MapleEval(kv,f);
return( ToMapleExpressionSequence(kv,2,mean,sd) );
Execute the external function from Maple.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
stat≔DefineExternal⁡MyStats,dll:
stat⁡1,2,3,2,0,8
83,593
stat⁡0.3,0.1,0.4,0.1,0.5,0.9,0.2,0.6,0.5,0.3,0.5
0.4000000000,0.2256304299
See Also
CustomWrapper
define_external
eval
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
Download Help Document