File indexing completed on 2025-01-26 04:43:59
0001 /* ------------------------------------------------------------------------ 0002 @NAME : error.c 0003 @DESCRIPTION: Prototypes for the error-generating functions (i.e. functions 0004 defined in error.c, and meant only for use elsewhere in the 0005 library). 0006 @CREATED : Summer 1996, Greg Ward 0007 @MODIFIED : 0008 @VERSION : $Id: error.h,v 1.11 1999/11/29 01:13:10 greg Rel $ 0009 @COPYRIGHT : Copyright (c) 1996-99 by Gregory P. Ward. All rights reserved. 0010 0011 This file is part of the btparse library. This library is 0012 free software; you can redistribute it and/or modify it under 0013 the terms of the GNU General Public License as 0014 published by the Free Software Foundation; either version 2 0015 of the License, or (at your option) any later version. 0016 -------------------------------------------------------------------------- */ 0017 0018 #ifndef ERROR_H 0019 #define ERROR_H 0020 0021 #include <stdarg.h> 0022 #include "btparse.h" /* for AST typedef */ 0023 0024 #define MAX_ERROR 1024 0025 0026 #define ERRFUNC_BODY(class,filename,line,item_desc,item,format) \ 0027 { \ 0028 va_list arglist; \ 0029 \ 0030 va_start (arglist, format); \ 0031 report_error (class, filename, line, item_desc, item, format, arglist); \ 0032 va_end (arglist); \ 0033 } 0034 0035 #define GEN_ERRFUNC(name,params,class,filename,line,item_desc,item,format) \ 0036 void name params \ 0037 ERRFUNC_BODY (class, filename, line, item_desc, item, format) 0038 0039 #define GEN_PRIVATE_ERRFUNC(name,params, \ 0040 class,filename,line,item_desc,item,format) \ 0041 static GEN_ERRFUNC(name,params,class,filename,line,item_desc,item,format) 0042 0043 /* 0044 * Prototypes for functions exported by error.c but only used within 0045 * the library -- functions that can be called by outsiders are declared 0046 * in btparse.h. 0047 */ 0048 0049 void print_error (bt_error *err); 0050 void report_error (bt_errclass class, 0051 const char * filename, int line, const char * item_desc, int item, 0052 const char * format, va_list arglist); 0053 0054 void general_error (bt_errclass class, 0055 char * filename, int line, const char * item_desc, int item, 0056 const char * format, ...); 0057 void error (bt_errclass class, char * filename, int line, char * format, ...); 0058 void ast_error (bt_errclass class, AST * ast, char * format, ...); 0059 0060 void notify (const char *format,...); 0061 void usage_warning (const char * format, ...); 0062 void usage_error (const char * format, ...); 0063 void internal_error (const char * format, ...); 0064 0065 #endif