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