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
|
|
MapleEval(kv, s)
EvalMapleProc(kv, fn, n, arg1, arg2, ..., argN)
EvalMapleStatement(kv, statement)
|
|
Parameters
|
|
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
|
|
|
|
|
Description
|
|
•
|
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.
|
|
|
Examples
|
|
#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");
|
return( NULL );
|
}
|
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.
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
|
|