1 /* $Id$ $Revision$ */ 2 /* vim:set shiftwidth=4 ts=8: */ 3 4 /************************************************************************* 5 * Copyright (c) 2011 AT&T Intellectual Property 6 * All rights reserved. This program and the accompanying materials 7 * are made available under the terms of the Eclipse Public License v1.0 8 * which accompanies this distribution, and is available at 9 * http://www.eclipse.org/legal/epl-v10.html 10 * 11 * Contributors: See CVS logs. Details at http://www.graphviz.org/ 12 *************************************************************************/ 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 /* 19 * standalone mini error interface 20 */ 21 22 #ifndef _ERROR_H 23 #define _ERROR_H 24 25 #include <stdarg.h> 26 #include <errno.h> 27 28 typedef struct Error_info_s { 29 int errors; 30 int indent; 31 int line; 32 int warnings; 33 int trace; 34 char *file; 35 char *id; 36 } Error_info_t; 37 38 #ifndef ERROR_catalog 39 #define ERROR_catalog(t) t 40 #endif 41 42 #define ERROR_INFO 0 /* info message -- no err_id */ 43 #define ERROR_WARNING 1 /* warning message */ 44 #define ERROR_ERROR 2 /* error message -- no err_exit */ 45 #define ERROR_FATAL 3 /* error message with err_exit */ 46 #define ERROR_PANIC ERROR_LEVEL /* panic message with err_exit */ 47 48 #define ERROR_LEVEL 0x00ff /* level portion of status */ 49 #define ERROR_SYSTEM 0x0100 /* report system errno message */ 50 #define ERROR_USAGE 0x0800 /* usage message */ 51 52 #define error_info _err_info 53 #define error _err_msg 54 #define errorv _err_msgv 55 56 extern Error_info_t error_info; 57 58 extern void setTraceLevel (int); 59 extern void setErrorLine (int); 60 extern void setErrorFileLine (char*, int); 61 extern void setErrorId (char*); 62 extern void setErrorErrors (int); 63 extern int getErrorErrors (void); 64 65 extern void error(int, ...); 66 extern void errorf(void *, void *, int, ...); 67 extern void errorv(const char *, int, va_list); 68 69 #endif 70 71 #ifdef __cplusplus 72 } 73 #endif 74