MapleAssign
assign a value to a Maple variable in external code
MapleAssignIndexed
assign to an indexable object element in external code
Calling Sequence
Parameters
Description
Examples
MapleAssign(kv, lhs, rhs)
MapleAssignIndexed(kv, lhs, n, ind, rhs)
kv
-
kernel handle of type MKernelVector
lhs
type ALGEB assignable object
rhs
type ALGEB value
n
length of ind
ind
index array
These functions can be used in external code with OpenMaple or define_external.
MapleAssign attempts to assign lhs := rhs.
MapleAssignIndexed attempts to assign lhs[ind] := rhs. The index, ind is an integer array. To reference lhs[1,2], set ind[0] = 1, and ind[1] = 2.
#include "maplec.h"
ALGEB M_DECL MyMult( MKernelVector kv, ALGEB *args )
{
ALGEB a, b, r, val;
static M_INT index[1] = { 1 };
if( MapleNumArgs(kv,(ALGEB)args) != 2 ) {
MapleRaiseError(kv,"two arguments expected");
return( NULL );
}
a = ToMapleName(kv,"a",TRUE);
MapleAssign(kv,a,args[1]);
b = ToMapleName(kv,"b",TRUE);
MapleAssign(kv,b,args[2]);
val = EvalMapleStatement(kv,"a*b;");
r = ToMapleName(kv,"my_results",TRUE);
MapleAssignIndexed(kv,r,1,index,val);
index[0]++;
return( val );
Execute the external function from Maple.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
mult≔DefineExternal⁡MyMult,dll:
mult⁡3,3
9
mult⁡π,sin⁡π2
π
my_results1,my_results2
9,π
a,b
π,1
See Also
CustomWrapper
define_external
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
Download Help Document