home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / h / errMsgs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  2.9 KB  |  112 lines

  1. /* File: /u1/oystr/ErrCodes/errMsgs.m  Date: 23-Nov-1982  */
  2.  
  3. /*
  4.  * $Header$
  5.  * INTERFACE:    None.
  6.  *
  7.  * FUNCTION:    Provides the standard error codes for the Error Message
  8.  *        Retrival system itself.
  9.  *
  10.  * IMPORTS:    None.
  11.  *
  12.  * EXPORTS:    Standard error codes for the EMR.
  13.  *
  14.  * DESIGN:    See "Eden Error Message Retrieval System", J. Sanislo,
  15.  *        TBS.
  16.  *
  17.  * $Log$
  18.  * 23-Nov-1982:    Initial implementation. J. Sanislo.
  19.  */
  20. #ifndef errMsgs
  21. #define errMsgs
  22.  
  23. /*
  24.  * Each Eden system constant looks like:
  25.  *
  26.  *    +----------------+-------------+---+
  27.  *    |  Facility No.  |  Err. Code  |ETY|
  28.  *    +----------------+-------------+---+
  29.  *
  30.  * where the values of ETY imply:
  31.  *    0 : warning
  32.  *    1 : success
  33.  *    2 : failure
  34.  *    3 : information
  35.  *    4 : severe failure
  36.  *    5 : message
  37.  *    6-7 : reserved
  38.  *
  39.  * Odd values (bit 0 set) imply a non-error status.
  40.  *
  41.  * Define these bit codes.
  42.  */
  43.  
  44. #define WARNING    0
  45. #define SUCCESS 1
  46. #define    FAILURE 2
  47. #define INFO    3
  48. #define SEVERE    4
  49. #define MESSAGE 5
  50. #define RESERV1 6
  51. #define RESERV2 7
  52. #define MODULUS 8
  53. #define ETYMASK 7
  54.  
  55. /*
  56.  * The following macros check a purported error code for its type.
  57.  */
  58. #define mWARNING(Val) ( ( (Val) & ETYMASK) == WARNING )
  59. #define mSUCCESS(Val) ( ( (Val) & ETYMASK) == SUCCESS )
  60. #define mERROR(Val)   ( ( (Val) & ETYMASK) == FAILURE )
  61. #define mINFO(Val)    ( ( (Val) & ETYMASK) == INFO    )
  62. #define mSEVERE(Val)  ( ( (Val) & ETYMASK) == SEVERE  )
  63. #define mMESSAGE(Val) ( ( (Val) & ETYMASK) == MESSAGE )
  64. #define mNOERROR(Val) ( ( (Val) % 2) == 1 )
  65. #define mBADSTATUS(Val) ( ( (Val) % 2) == 0 )
  66.  
  67. /*
  68.  * EMR error codes.
  69.  */
  70. #define FAC_ErrMsgs    0x0000000d
  71. #define VER_ErrMsgs    0x00000001
  72. #define ABV_ErrMsgs    "EMR"
  73. #define    EMRS_Success    0x000d0001 
  74. /* "Normal, successful completion." */
  75. #define    EMRW_MsgTrunc    0x000d0000 
  76. /* "Message truncated." */
  77. #define    EMRF_NoMsg    0x000d0002 
  78. /* "No message associated with code: %x." */
  79. #define    EMRK_InitDB    0x000d0004 
  80. /* "Can't initialize string database: %d." */
  81. #define    EMRK_AccStr    0x000d000c 
  82. /* "String file access failure: %d." */
  83. #define    EMRK_UnSpec    0x000d0014 
  84. /* "Unspecified error code: %x." */
  85.  
  86. /*
  87.  * The following two procedures access the error message database.
  88.  *
  89.  *   GetEdenMsg(code, bufsize, buffer, flags)
  90.  *    int code;
  91.  *    int bufsize;
  92.  *    char buffer[];
  93.  *    int flags;
  94.  * The database is searched for the error string associated with the
  95.  * specified code.  If it one is found and its size is <= bufsize
  96.  * it is returned in buffer, terminated by \0.  Otherwise, at most
  97.  * bufsize characters are returned (including the \0).  The flags
  98.  * parameter is not used at this time and should be specified as 0.
  99.  *
  100.  *   PutEdenMsg(code, argc, argv)
  101.  *     int  code;
  102.  *    int  argc;
  103.  *    char *argv[];
  104.  * This routine attempts to write the error message associated with
  105.  * the specified code to stderr.  Argc and argv are meant to be
  106.  * describe the values expected by the message a la sprintf.  The
  107.  * current implementation IGNORES them.
  108.  */
  109. int GetEdenMsg();
  110. int PutEdenMsg();
  111. #endif
  112.