/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped22/*23* fmtmsg interface definitions24*/2526#ifndef _FMTMSG_H27#define _FMTMSG_H2829#define MM_VERB_ENV "MSGVERB" /* keyword filter env var */30#define MM_SEVERITY_ENV "SEV_LEVEL" /* alternate severity env var */3132/* max component length */3334#define MM_LABEL_1_MAX 10 /* label field 1 length */35#define MM_LABEL_2_MAX 14 /* label field 2 length */3637/* classification type */3839#define MM_HARD 0x00000001L /* hardware */40#define MM_SOFT 0x00000002L /* software */41#define MM_FIRM 0x00000004L /* firmware */4243/* classification source */4445#define MM_APPL 0x00000010L /* application */46#define MM_UTIL 0x00000020L /* utility */47#define MM_OPSYS 0x00000040L /* kernel */4849/* classification display */5051#define MM_PRINT 0x00000100L /* stderr */52#define MM_CONSOLE 0x00000200L /* console */5354/* classification status */5556#define MM_RECOVER 0x00001000L /* recoverable */57#define MM_NRECOV 0x00002000L /* non-recoverable */5859/* severity */6061#define MM_NOSEV 0x0 /* no severity */62#define MM_HALT 0x1 /* severe fault */63#define MM_ERROR 0x2 /* fault */64#define MM_WARNING 0x4 /* could be a problem */65#define MM_INFO 0x8 /* not an error (noise?) */6667/* fmtmsg return value */6869#define MM_OK 0 /* succeeded */70#define MM_NOTOK 3 /* failed completely */71#define MM_NOMSG 1 /* stderr message failed */72#define MM_NOCON 2 /* console message failed */7374/* null argument values -- 0 just doesn't get any respect */7576#define MM_NULLLBL (char*)0 /* label */77#define MM_NULLSEV 0 /* severity */78#define MM_NULLMC 0L /* class */79#define MM_NULLTXT (char*)0 /* text */80#define MM_NULLACT (char*)0 /* action */81#define MM_NULLTAG (char*)0 /* tag */8283#ifdef MM_TABLES8485/* encoding support */8687typedef struct88{89const char* name;90const char* display;91unsigned int value;92} MM_table_t;9394#define mm_class _mm_class95#define mm_severity _mm_severity()96#define mm_verb _mm_verb9798#define MM_all 0xff99#define MM_action 0x01100#define MM_class 0x02101#define MM_label 0x04102#define MM_severity 0x08103#define MM_source 0x10104#define MM_status 0x20105#define MM_tag 0x40106#define MM_text 0x80107108#define MM_default (MM_action|MM_label|MM_severity|MM_tag|MM_text)109110#if _BLD_ast && defined(__EXPORT__)111#define extern __EXPORT__112#endif113#if !_BLD_ast && defined(__IMPORT__)114#define extern extern __IMPORT__115#endif116117extern const MM_table_t mm_class[];118extern const MM_table_t mm_verb[];119120#undef extern121122#if _BLD_ast && defined(__EXPORT__)123#define extern __EXPORT__124#endif125126extern const MM_table_t* mm_severity;127128#undef extern129130#endif131132#if _BLD_ast && defined(__EXPORT__)133#define extern __EXPORT__134#endif135136extern int fmtmsg(long, const char*, int, const char*, const char*, const char*);137138#undef extern139140#endif141142143