Initializing help system before first use

Definition of constants of different types


Type: Programming
Rating: 2 (easy-medium)
Description: Language extensions provided by this module:
  • constants: integer, real, string, boolean
This functionality can also be implemented by a package.
File(s): myconstants.c
Data file(s): Test model myconst_test.mos


myconstants.c
/******************************************
  Mosel NI Examples
  =================

  File myconstants.c
  ``````````````````
  Example module defining 
    constants
  of different types.

  (c) 2008 Fair Isaac Corporation
      author: S. Heipcke, 2002
*******************************************/

#include <stdlib.h>
#include "xprm_ni.h"

/**** Structures for passing info to Mosel ****/
/* Constants */
static const double tol=0.00001;

static XPRMdsoconst tabconst[]=
    {
     XPRM_CST_INT("MYCST_BIGM",10000),    /* A large integer value */
     XPRM_CST_REAL("MYCST_TOL",tol),      /* A tolerance value */
     XPRM_CST_STRING("MYCST_LINE",        /* String constant */
     "----------------------------------------------------------------"),
     XPRM_CST_BOOL("MYCST_FLAG",XPRM_TRUE),     /* Constant with value true */
     XPRM_CST_BOOL("MYCST_NOFLAG",XPRM_FALSE)   /* Constant with value false */
    };

/* Interface structure */
static XPRMdsointer dsointer= 
    { 
     sizeof(tabconst)/sizeof(XPRMdsoconst),tabconst, 0,NULL, 0,NULL, 0,NULL
    };

/*******************************************************/
/* Initialize the module library just after loading it */
/*******************************************************/
DSO_INIT myconstants_init(XPRMnifct nifct, int *interver,int *libver, 
  XPRMdsointer **interf)
{
 *interver=XPRM_NIVERS;     /* Mosel NI version */
 *libver=XPRM_MKVER(0,0,1); /* Module version */
 *interf=&dsointer;         /* Pass info about module contents to Mosel */

 return 0;
}

© 2001-2019 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.