Next: EMS within an environment
Up: Message Output
Previous: No EMS_FLUSH
EMS without an environment
Outside any environment EMS has to have some reliable mechanism for ultimately
delivering any reported error messages to the user, since it cannot be
guaranteed that the ERR library is being used at the level of the application.
This is achieved by the having the initial error context level of EMS deliver
any reported error message immediately to the user using a C printf
statement: i.e. if all an application does is call EMS_REP,
then all error messages are immediately delivered to the user when they are
reported.
Any higher error context level, set with a call to EMS_MARK or
EMS_BEGIN,
will have the effect of deferring message output until the error reporting
context is returned to its initial level with calls to EMS_RLSE
or EMS_END.
Any deferred error messages will then be delivered to the user and any further
error messages reported in this context will again be delivered immediately to
the user.
The behaviour of EMS without an environment present means that it is essential
for error reporting contexts to be properly nested within a package and for a
subroutine library using EMS not to exit at a context level other than the
one at which it was invoked.
If context levels are incorrectly nested within a package it can lead to
EMS failing to deliver reported error messages when an application goes wrong.
Because the nested use of EMS_MARK and EMS_RLSE
(or EMS_BEGIN and
EMS_END) is normally confined within the same routine, incorrect
nesting of context levels will normally result from simple programming errors
which can be easily traced.
However, there is no simple safeguard against the incorrect nesting of error
context levels provided by EMS: thorough testing is the most effective
approach.
N.B. On some systems, C and Fortran output cannot be reliably
interspersed. This fallback output at the EMS initial context level should
therefore not be used in programs which also use Fortran WRITE
statements.
Next: EMS within an environment
Up: Message Output
Previous: No EMS_FLUSH
EMS Error Message Service
Starlink System Note 4
P C T Rees
A J Chipperfield
28 September 2001
E-mail:ussc@star.rl.ac.uk
Copyright © 2001 Council for the Central Laboratory of the Research
Councils