00001 00002 #ifndef ERROR_FUNC_HH 00003 #define ERROR_FUNC_HH 00004 00005 // Copyright (c) 1996-1999 The University of Cincinnati. 00006 // All rights reserved. 00007 00008 // UC MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF 00009 // THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 00010 // TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 00011 // PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UC SHALL NOT BE LIABLE 00012 // FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, 00013 // MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. 00014 00015 // By using or copying this Software, Licensee agrees to abide by the 00016 // intellectual property laws, and all other applicable laws of the 00017 // U.S., and the terms of this license. 00018 00019 00020 // You may modify, distribute, and use the software contained in this package 00021 // under the terms of the "GNU LIBRARY GENERAL PUBLIC LICENSE" version 2, 00022 // June 1991. A copy of this license agreement can be found in the file 00023 // "LGPL", distributed with this archive. 00024 00025 // Author: Dale E. Martin dmartin@cliftonlabs.com 00026 00027 //--------------------------------------------------------------------------- 00028 00029 // Error reporting is done following the gnu guidlines. Here is what they 00030 // have to say: 00031 00032 // Formatting Error Messages 00033 // ************************* 00034 00035 // Error messages from compilers should look like this: 00036 00037 // SOURCE-FILE-NAME:LINENO: MESSAGE 00038 00039 // Error messages from other noninteractive programs should look like 00040 // this: 00041 00042 // PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE 00043 00044 // when there is an appropriate source file, or like this: 00045 00046 // PROGRAM: MESSAGE 00047 00048 // when there is no relevant source file. 00049 00050 // In an interactive program (one that is reading commands from a 00051 // terminal), it is better not to include the program name in an error 00052 // message. The place to indicate which program is running is in the 00053 // prompt or with the screen layout. (When the same program runs with 00054 // input from a source other than a terminal, it is not interactive and 00055 // would do best to print error messages using the noninteractive style.) 00056 00057 // The string MESSAGE should not begin with a capital letter when it 00058 // follows a program name and/or file name. Also, it should not end with a 00059 // period. 00060 00061 // Error messages from interactive programs, and other messages such as 00062 // usage messages, should start with a capital letter. But they should not 00063 // end with a period. 00064 00065 #include <string> 00066 00067 class IIR; 00068 class IIR_Name; 00069 class IIR_Identifier; 00070 class IIR_TypeDefinition; 00071 class IIR_Declaration; 00072 class ANTLRToken; 00073 class plugin_class_factory; 00074 00075 namespace savant { 00076 template <class type> class set; 00077 } 00078 00079 using std::string; 00080 00081 enum severity { WARNING, FATAL }; 00082 00083 void 00084 report_error( const char *message, 00085 int line_number, 00086 severity how_serious); 00087 void 00088 report_error( const char *message, 00089 int line_number = -1, 00090 IIR_Identifier *file_name = NULL, 00091 severity = FATAL ); 00092 00093 void 00094 report_error( const string &message, 00095 int line_number = -1, 00096 IIR_Identifier *file_name = NULL, 00097 severity = FATAL ); 00098 00099 void 00100 report_error ( ANTLRToken *tok, const string &, severity = FATAL ); 00101 00102 void 00103 report_error ( ANTLRToken *tok, char *msg, severity = FATAL ); 00104 00105 void 00106 report_error ( IIR *if_node, const string &message, severity = FATAL ); 00107 00108 void 00109 report_error ( IIR *if_node, char *msg, severity = FATAL ); 00110 00111 void 00112 report_undefined_symbol( IIR * ); 00113 00114 void 00115 report_undefined_symbol( IIR_Declaration *, IIR_Name * ); 00116 00117 void 00118 report_undefined_symbol( savant::set<IIR_TypeDefinition> *, IIR * ); 00119 00120 void 00121 report_ambiguous_error( IIR *error_info, savant::set<IIR_Declaration> *error_set ); 00122 00123 void 00124 report_ambiguous_error( IIR *error_info, savant::set<IIR_TypeDefinition> *error_set ); 00125 00126 void 00127 report_ambiguous_error( IIR_Declaration *prefix, 00128 IIR_Name *suffix, 00129 savant::set<IIR_Declaration> *error_set ); 00130 00131 void 00132 report_undefined_function(char *func_name); 00133 00134 #endif 00135
1.4.6