next up previous 211
Next: Conditional Message Reporting and MSG_OUT
Up: MSG - Message Reporting System
Previous: Reporting messages


Conditional message reporting

It is sometimes useful to have varying levels of message output which may be controlled by the user of an application. Instances where this facility might be of use are: Conditional message output is achieved explicitly in the Message Reporting System using the subroutine MSG_OUTIF to assign a ``priority'' to the message, e.g.
      CALL MSG_OUTIF( MSG__NORM, ' ', 'A conditional message', STATUS )
Here, the first argument is the ``priority'' associated with the message and can be any one of three levels which are represented by symbolic constants defined in the include file MSG_PAR:
MSG__QUIET
- quiet mode, high priority;
MSG__NORM
- normal mode, normal priority (default);
MSG__VERB
- verbose mode, low priority.
Whether or not the message will be output depends upon the ``conditional message output filter'' which may be set using the subroutine MSG_IFSET. e.g.
      CALL MSG_IFSET( MSG__QUIET, STATUS )
The first argument of MSG_IFSET is the required conditional output filter level - it may take the same values as the message priority; by default it is set to MSG__NORM. The current conditional output filtering level may be inquired using subroutine MSG_IFLEV.

See also MSG_TUNE which allows the filter level to be set by an environment variable, and MSG_IFGET which allows ADAM programs to obtain the filter level from an ADAM parameter.

The action of MSG_OUTIF resulting from each of the defined priority values is as follows:

MSG__QUIET
- always output given the message, regardless of output filter setting;
MSG__NORM
- output the given message if the current output filter is set to either MSG__NORM or MSG__VERB;
MSG__VERB
- output the given message only if the current output filter is set to MSG__VERB.
In this scheme, messages given the priority MSG__QUIET could never be turned off and would therefore be the most most important messages being output by an application.

Here is an example of how conditional message output might be used in an application using interactive graphics with differing levels of informational messages to match how familiar the user is with the application:

*  Use the cursor to enter the approximate positions of stars on the 
*  displayed image to be fitted.
      CALL MSG_OUT( ' ', 'Use the cursor to enter star positions', 
     :             STATUS )

*  Explain the positioning of the cursor.
      CALL MSG_OUTIF( MSG__NORM, ' ', 
     :               'The graphics cursor should be positioned ' //
     :               'close to the centre of each star image', STATUS )

*  Explain the cursor keys to new user.
      CALL MSG_OUTIF( MSG__VERB, ' ', 'Cursor keys: 1 add entry', STATUS )
      CALL MSG_OUTIF( MSG__VERB, ' ', '             2 reject last entry', 
     :               STATUS )
      CALL MSG_OUTIF( MSG__VERB, ' ', '             3 entry complete', 
     :               STATUS )



next up previous 211
Next: Conditional Message Reporting and MSG_OUT
Up: MSG - Message Reporting System
Previous: Reporting messages

MERS (MSG and ERR) Message and Error Reporting Systems
Starlink User Note 104
P C T Rees
A J Chipperfield
22 October 2001
E-mail:ussc@star.rl.ac.uk

Copyright © 2001 Council for the Central Laboratory of the Research Councils