D Portability

D.1 Porting prerequisites

The Fortran interface to EMS makes use of the Starlink mixed language programming package, CNF (see SUN/209), which must be available for building EMS and programs which use its Fortran interface.

The correct operation of EMS_FACER (and emsFacer) also requires the necessary facility message files to be installed (see ‘Operating system specific routines’ below).

D.2 Operating system specific routines

EMS is coded in ANSI C, according to the Starlink C coding conventions described in SGP/4. However, the following routines have system-specific features and may need re-implementing for new platforms. They may also produce differing results on different platforms.

EMS_FACER
Assign the message associated with a Starlink status value to a token.

On UNIX this is implemented using the MESSGEN system (see SUN/185) and thus relies on the required Starlink facility message files having been entered into the system.

When EMS_FACER is called to to obtain the message associated with a given STATUS value, it first works out the facility number from the STATUS value. It then searches for a file with the name fac_facnum_err (where facnum is the facility number). If environment variable EMS_PATH is defined, it is taken to be a directory search path for the file; if not, a directory search path of ../help relative to each of the directories on the user’s PATH is used.

If the file cannot be found along the selected search path, or a message cannot be associated for any other reason, a ‘FACERR’ message is substituted giving as much information as possible. For example:

ident, error 147358667 (fac=200,messid=121)

where the given status value is 147358667 and 200 and 121 are the facility number and message number derived from it.

ident may be one of the following:

FACERR__BADARG
– the given status value was not a valid Starlink status value.
FACERR__NOFAC
FACERR__BADFIL
– the facility message file was faulty.
FACERR__NOMSG
– the required message number was not found in the facility message file.
EMS_FIOER
Assign a Fortran I/O error message to a token.

This will generally need to be rewritten for each new target platform. Current versions have the appropriate messages hardwired into the code.

EMS_SYSER
Assign an operating system error message to a token.

This may need to be rewritten for a new target platform. At the moment UNIX platforms use the same code which accesses sys_errlist.

emsErrno
Assign the message associated with a C errno to a token.

On UNIX platforms this accesses sys_errlist to obtain the message.