Initializing help system before first use

Module vs. package

Since Mosel 5.0 packages offer similar functionality as modules for the implementation of parameters. The parameter names and types are specified in the parameters block of the package:

 parameters
  "p1":real
  "p2":integer
  "p3":string
  "p4":boolean
 end-parameters

The access routines for the four parameter types have a fixed format, namely packagename∼get[r|i|s|b]param and packagename∼set[r|i|s|b]param. The access routines must be defined according to the parameter types implemented by a package as shown in the code extract below—the complete example can be found in the Chapter 'Packages' of the Mosel User Guide.

 declarations
  myp1: real     ! Entity for storing the current parameter value
 end-declarations

 myp1:=0.25      ! Set the default value for the parameter

! Get value of a real parameter
 public function parpkg~getrparam(p:string):real
  case p of
   "p1": returned:=myp1
  end-case
 end-function

 ! Set value for real parameters
 public procedure parpkg~setparam(p:string,v:real)
  case p of
   "p1": myp1:=v
  end-case
 end-procedure

A model using the package will access the package parameters via Mosel's standard getparam and setparam routines.


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