MapleKernelOptions
set or query kernel variables and options in external code
Calling Sequence
Parameters
Description
Examples
MapleKernelOptions(kv, option, val)
kv
-
kernel handle of type MKernelVector
option
character string
val
type ALGEB value
This function can be used in external code with OpenMaple or define_external.
MapleKernelOptions sets and queries variables that affect Maple computations. For a list of option names and descriptions, see ?kernelopts,
To query a value without setting it pass val = NULL. The previous assigned value is returned.
#include "maplec.h"
ALGEB M_DECL MyDelay( MKernelVector kv, ALGEB *args )
{
M_INT i, n;
ALGEB start_time, fin_time;
double junk;
if( 1 != MapleNumArgs(kv,(ALGEB)args) ) {
MapleRaiseError(kv,"one argument expected");
return( NULL );
}
MapleKernelOptions(kv,"assertlevel",ToMapleInteger(kv,2));
n = MapleToM_INT(kv,args[1]);
start_time = MapleKernelOptions(kv,"cputime",NULL);
for( i=1; i<=n; ++i ) {
junk *= 2;
MapleAssign(kv,ToMapleName(kv,"myjunk",TRUE),ToMapleFloat(kv,junk));
fin_time = MapleKernelOptions(kv,"cputime",NULL);
return( EvalMapleProc(kv,ToMapleName(kv,"-",TRUE),
2,fin_time,start_time) );
Execute the external function from Maple.
with⁡ExternalCalling:
dll≔ExternalLibraryName⁡HelpExamples:
delay≔DefineExternal⁡MyDelay,dll:
kernelopts⁡assertlevel=0
0
delay⁡20000
0.0000490000000000212
kernelopts⁡assertlevel
2
delay⁡226
0.0728510000000000
See Also
CustomWrapper
define_external
kernelopts
OpenMaple
OpenMaple/C/API
OpenMaple/C/Examples
Download Help Document