MapleKernelOptions - set or query kernel variables and options in external code
|
Calling Sequence
|
|
MapleKernelOptions(kv, option, val)
|
|
Parameters
|
|
kv
|
-
|
kernel handle of type MKernelVector
|
option
|
-
|
character string
|
val
|
-
|
type ALGEB value
|
|
|
|
|
Description
|
|
•
|
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.
|
|
|
Examples
|
|
#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.
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
|
|