00001 // Copyright (C) 2001, Compaq Computer Corporation 00002 // 00003 // This file is part of Vesta. 00004 // 00005 // Vesta is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // Vesta is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with Vesta; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 /* File: Err.H */ 00020 /* Last Modified On Mon May 23 23:18:24 EDT 2005 by ken@xorian.net */ 00021 /* Modified On Fri Jul 14 21:04:45 PDT 2000 by mann */ 00022 /* Modified On Wed Apr 12 18:08:00 PDT 2000 by yuanyu */ 00023 /* Modified On Sun Nov 2 18:11:16 PST 1997 by heydon */ 00024 /* Modified On Fri Jan 19 18:36:50 PST 1996 by horning */ 00025 /* Modified On Mon Oct 18 14:38:29 PDT 1993 by hanna */ 00026 00027 #ifndef Err_H 00028 #define Err_H 00029 00030 #include <VestaSource.H> 00031 00032 #include "ValExpr.H" 00033 #include "Location.H" 00034 #include "ModelState.H" 00035 00036 // The mutex protects output to cout, cerr, and the error counter. 00037 extern Basics::mutex outputMu; 00038 00039 // Count an error: 00040 void Error(); 00041 00042 // Return error count: 00043 int ErrorCount(); 00044 00045 // Print and count an error, with location, if available: 00046 void Error(const Text &msg, SrcLoc *loc = noLoc); 00047 00048 // Append msg as part of the current error message: 00049 void ErrorDetail(const Text &msg); 00050 00051 // Append the text form of v as part of the current error message: 00052 void ErrorVal(const Val v); 00053 00054 // Append the text form of e as part of the current error message: 00055 void ErrorExpr(const Expr e); 00056 00057 // Append the text form of args as part of the current error message: 00058 void ErrorArgs(const Vals &args); 00059 00060 // Report "impossible" state encountered in procedure procName. 00061 // It is used to indicate implementation errors. 00062 void InternalError(const Text &procName); 00063 00064 // Print the number of errors encounted since the last ErrInit(). 00065 // Return true iff there is an error. 00066 bool ErrorSummary(std::ostream *out); 00067 00068 // Record the error of evaluating expression expr on the stack: 00069 Val RecordErrorOnStack(Expr expr); 00070 00071 void ErrInit(); 00072 00073 /* Return a string representation of the VestaSource errorCode "err" 00074 suitable for use in human-readable error messsages. This function 00075 returns a pointer to static storage. */ 00076 const Text VestaSourceErrorMsg(VestaSource::errorCode err) throw (); 00077 00078 #endif // Err_H