1/*********************************************************************** 2* * 3* This software is part of the ast package * 4* Copyright (c) 1985-2011 AT&T Intellectual Property * 5* and is licensed under the * 6* Common Public License, Version 1.0 * 7* by AT&T Intellectual Property * 8* * 9* A copy of the License is available at * 10* http://www.opensource.org/licenses/cpl1.0.txt * 11* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 12* * 13* Information and Software Systems Research * 14* AT&T Research * 15* Florham Park NJ * 16* * 17* Glenn Fowler <gsf@research.att.com> * 18* David Korn <dgk@research.att.com> * 19* Phong Vo <kpv@research.att.com> * 20* * 21***********************************************************************/ 22#pragma prototyped 23/* 24 * standalone mini error interface 25 */ 26 27#ifndef _ERROR_H 28#define _ERROR_H 29 30#include <option.h> 31#include <stdarg.h> 32 33typedef struct Error_info_s 34{ 35 int errors; 36 int line; 37 int warnings; 38 char* catalog; 39 char* file; 40 char* id; 41} Error_info_t; 42 43#define ERROR_catalog(s) s 44 45#define ERROR_INFO 0 /* info message -- no err_id */ 46#define ERROR_WARNING 1 /* warning message */ 47#define ERROR_ERROR 2 /* error message -- no err_exit */ 48#define ERROR_FATAL 3 /* error message with err_exit */ 49#define ERROR_PANIC ERROR_LEVEL /* panic message with err_exit */ 50 51#define ERROR_LEVEL 0x00ff /* level portion of status */ 52#define ERROR_SYSTEM 0x0100 /* report system errno message */ 53#define ERROR_USAGE 0x0800 /* usage message */ 54 55#define error_info _err_info 56#define error _err_msg 57#define errorv _err_msgv 58 59extern Error_info_t error_info; 60 61#define errorx(l,x,c,m) (char*)m 62 63extern void error(int, ...); 64extern int errorf(void*, void*, int, ...); 65extern void errorv(const char*, int, va_list); 66 67#endif 68