blob: 9360c415c2f7edf6234e2a1bb29bc0fbdc40e397 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* http://www.eclipse.org/org/documents/epl-v10.html *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* fmtmsg interface definitions
*/
#ifndef _FMTMSG_H
#define _FMTMSG_H
#define MM_VERB_ENV "MSGVERB" /* keyword filter env var */
#define MM_SEVERITY_ENV "SEV_LEVEL" /* alternate severity env var */
/* max component length */
#define MM_LABEL_1_MAX 10 /* label field 1 length */
#define MM_LABEL_2_MAX 14 /* label field 2 length */
/* classification type */
#define MM_HARD 0x00000001L /* hardware */
#define MM_SOFT 0x00000002L /* software */
#define MM_FIRM 0x00000004L /* firmware */
/* classification source */
#define MM_APPL 0x00000010L /* application */
#define MM_UTIL 0x00000020L /* utility */
#define MM_OPSYS 0x00000040L /* kernel */
/* classification display */
#define MM_PRINT 0x00000100L /* stderr */
#define MM_CONSOLE 0x00000200L /* console */
/* classification status */
#define MM_RECOVER 0x00001000L /* recoverable */
#define MM_NRECOV 0x00002000L /* non-recoverable */
/* severity */
#define MM_NOSEV 0x0 /* no severity */
#define MM_HALT 0x1 /* severe fault */
#define MM_ERROR 0x2 /* fault */
#define MM_WARNING 0x4 /* could be a problem */
#define MM_INFO 0x8 /* not an error (noise?) */
/* fmtmsg return value */
#define MM_OK 0 /* succeeded */
#define MM_NOTOK 3 /* failed completely */
#define MM_NOMSG 1 /* stderr message failed */
#define MM_NOCON 2 /* console message failed */
/* null argument values -- 0 just doesn't get any respect */
#define MM_NULLLBL (char*)0 /* label */
#define MM_NULLSEV 0 /* severity */
#define MM_NULLMC 0L /* class */
#define MM_NULLTXT (char*)0 /* text */
#define MM_NULLACT (char*)0 /* action */
#define MM_NULLTAG (char*)0 /* tag */
#ifdef MM_TABLES
/* encoding support */
typedef struct
{
const char* name;
const char* display;
unsigned int value;
} MM_table_t;
#define mm_class _mm_class
#define mm_severity _mm_severity()
#define mm_verb _mm_verb
#define MM_all 0xff
#define MM_action 0x01
#define MM_class 0x02
#define MM_label 0x04
#define MM_severity 0x08
#define MM_source 0x10
#define MM_status 0x20
#define MM_tag 0x40
#define MM_text 0x80
#define MM_default (MM_action|MM_label|MM_severity|MM_tag|MM_text)
#if _BLD_ast && defined(__EXPORT__)
#define extern __EXPORT__
#endif
#if !_BLD_ast && defined(__IMPORT__)
#define extern extern __IMPORT__
#endif
extern const MM_table_t mm_class[];
extern const MM_table_t mm_verb[];
#undef extern
#if _BLD_ast && defined(__EXPORT__)
#define extern __EXPORT__
#endif
extern const MM_table_t* mm_severity;
#undef extern
#endif
#if _BLD_ast && defined(__EXPORT__)
#define extern __EXPORT__
#endif
extern int fmtmsg(long, const char*, int, const char*, const char*, const char*);
#undef extern
#endif
|