Sometimes ``foreign'' subroutines must be called which do not use the Starlink error status conventions (e.g. because they must adhere to some standard interface definition like GKS). Unless they are unusually robust, such routines must normally be prevented from executing under error conditions, either by performing a status check immediately beforehand, or by enclosing them within an appropriate IF...END IF block. Depending on the form of error indication that such foreign routines use, it may also be necessary to check afterwards whether they have succeeded or not. If such a routine fails, then for compatibility with other Starlink software a status value should be set and an error report made on its behalf.
For example, the following code makes a GKS inquiry and checks the success of that inquiry:
IF ( STATUS .EQ. SAI__OK ) THEN * Inquire the GKS workstation colour facilities available. CALL GQCF( WTYPE, ERRIND, NCOLI, COLA, NPCI ) * Check if a GKS error has occurred. IF ( ERRIND .NE. GKS__OK ) THEN * An error has occurred, so report it and abort. STATUS = SAI__ERROR CALL MSG_SETI( 'ERRIND', ERRIND ) CALL ERR_REP( 'ROUTN_GQCFERR', : 'Error no. ^ERRIND occurred in GKS routine GQCF ' // '(enquire workstation colour facilities).', : STATUS ) GO TO 999 END IF END IF ... 999 CONTINUE END
In some cases, it may be possible to obtain a textual error message from the error flag, by means of a suitable inquiry routine, which could be used as the basis of the error report.
It will be obvious from this example how convenient the inherited error status strategy is, and how much extra work is involved in obtaining the same degree of robustness and quality of error reporting from routines which do not use it. It is worth bearing this in mind if you are involved in importing foreign subroutine libraries for use with Starlink software: the provision of a few simple routines for automating error reporting, or an extra layer of subroutine calls where inherited status checking and error reporting can be performed, can make the final product vastly easier to use. Starlink staff will be pleased to offer advice on this matter if consulted.
MERS (MSG and ERR) Message and Error Reporting Systems