Commit c6700a15 authored by claes's avatar claes

Defines and macros for severity

parent e3f7211c
......@@ -1134,6 +1134,21 @@ errh_send (char *s, char severity, pwr_tStatus sts, errh_eMsgType message_type)
#endif
}
errh_eSeverity errh_Severity( pwr_tStatus sts)
{
if ( sts == 0)
return errh_eSeverity_Null;
switch ( sts & 7) {
case 1: return errh_eSeverity_Success;
case 3: return errh_eSeverity_Info;
case 0: return errh_eSeverity_Warning;
case 2: return errh_eSeverity_Error;
case 4: return errh_eSeverity_Fatal;
default: return errh_eSeverity_Null;
}
}
#if 0
int main(int argc, char **argv)
......
......@@ -42,6 +42,22 @@ extern "C" {
return (((int)(sts)?((*sts)=(lsts)):(EVEN(lsts)?(errh_Bugcheck(lsts, (str)),(lsts)):(lsts))),a)
#endif
#define errh_SeveritySuccess(sts) ((sts) & 7 == 3)
#define errh_SeverityInfo(sts) ((sts) & 7 == 1)
#define errh_SeverityWarning(sts) ((sts) & 7 == 0)
#define errh_SeverityError(sts) ((sts) & 7 == 2)
#define errh_SeverityFatal(sts) ((sts) & 7 == 4)
typedef enum {
errh_eSeverity_Null,
errh_eSeverity_Success,
errh_eSeverity_Info,
errh_eSeverity_Warning,
errh_eSeverity_Error,
errh_eSeverity_Fatal
} errh_eSeverity;
#define errh_cAnix_SrvSize 40
typedef enum {
......@@ -133,9 +149,14 @@ void *errh_ErrArgL (int val);
void errh_CErrLog (pwr_tStatus sts, ...);
char *errh_Message (char *string, char severity, char *msg, ...);
errh_eAnix errh_Anix ();
errh_eSeverity errh_Severity (pwr_tStatus);
#if defined __cplusplus
}
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment