Initializing help system before first use

Functions for handling parameters

In a Mosel program, parameters are accessed with the two subroutines setparam and getparam. The module must implement these two subroutines for its parameters.
The function that enables the user to set the parameters of our module is the following:

static int task_setpar(XPRMcontext ctx, void *libctx)
{
 s_taskctx *taskctx;
 int n;

 taskctx=libctx;
 n=XPRM_POP_INT(ctx);
 switch(n)
 {
  case 0: taskctx->maxname=XPRM_POP_INT(ctx); break;
  case 1: taskctx->maxtime=XPRM_POP_REAL(ctx); break;
  default: mm->dispmsg(ctx, "Task: Wrong control parameter number.\n");
	   return XPRM_RT_ERROR;
 }
 return XPRM_RT_OK;
}

Via its stack, Mosel provides the number of the parameter (value returned by the findparam service function) and its new value to the module.

The parameters of our module are accessed via the following function:

static int task_getpar(XPRMcontext ctx, void *libctx)
{
 s_taskctx *taskctx;
 int n;

 taskctx=libctx;
 n=XPRM_POP_INT(ctx);
 switch(n)
 {
  case 0: XPRM_PUSH_INT(ctx, taskctx->maxname); break;
  case 1: XPRM_PUSH_REAL(ctx, taskctx->maxtime); break;
  default: mm->dispmsg(ctx, "Task: Wrong control parameter number.\n");
	   return XPRM_RT_ERROR;
 }
 return XPRM_RT_OK;
}

The complete task module is part of the module examples provided with the Mosel distribution and on the Xpress website.

© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.