Error library

This library contains all the support for error codes and error messages. The header file contains the definition of the Error type which is used for the error codes, and some possible values.

ERRMessageGet
Get the error message which is associated with an error code. The maximum length of the returned message is ERR_MAXLEN. If the message is too long, then "unknown error" is returned instead.

It is however also allowed to build error codes for specific purposes, which are not catered for by the default mechanism. This is done with some macros.

ERROR_BUILD
Build an error code which should be associated with the given error message. The error code also has to be given a name. This macro should only be used in places
ERROR_EXTERN
Import the name for an error code which is defined with ERROR_BUILD in another file.
ERROR_CODE
Get the error code associated with the given name.
These macros can be used as follows :
/* sample file for error macros */
#include "err_h"

static ERROR_BUILD(myerror,"my error code");

Error myfunction()
{
    /* ..... */
    return ERROR_CODE(myerror);
}
The standard error codes which are provided are :
#define ERR_OK      0   /* NO error occured */
#define ERR_NC     -1   /* operation Not Complete */
#define ERR_IJOB   -2   /* Invalid JOB id */
#define ERR_IMEM   -3   /* Insufficient MEMory */
#define ERR_ORNG   -4   /* parameter Outside permitted RaNGe */
#define ERR_BFFL   -5   /* BuFfer FuLl */
#define ERR_ICHN   -6   /* Invalid CHaNnel id */
#define ERR_FDNF   -7   /* File or Device Not Found */
#define ERR_ITNF   -7   /* ITem Not Found */
#define ERR_FEX    -8   /* File already EXists */
#define ERR_FDIU   -9   /* File or Device In Use */
#define ERR_EOF    -10  /* End Of File */
#define ERR_DRFL   -11  /* DRive FuLl */
#define ERR_INAM   -12  /* Invalid file, device or thing NAMe */
#define ERR_TRNS   -13  /* TRaNSmission error */
#define ERR_FMTF   -14  /* ForMaT drive Failed */
#define ERR_IPAR   -15  /* Invalid PARameter */
#define ERR_MCHK   -16  /* file system Medium CHecK failed */
#define ERR_IEXP   -17  /* Invalid EXPression */
#define ERR_OVFL   -18  /* arithmetic OVerFLow */
#define ERR_NIMP   -19  /* operation Not IMPlemented */
#define ERR_RDO    -20  /* ReaD Only permitted */
#define ERR_ISYN   -21  /* Invalid SYNtax */
#define ERR_RWF    -22  /* Read or Write Failed */
#define ERR_NOMS   -22  /* NO error MeSsage */
#define ERR_ACCD   -23  /* ACCess Denied */

PROGS, Professional & Graphical Software
last edited April 10, 1996