📄 errors.c
字号:
/*Copyright (c) 2000, Red Hat, Inc.This file is part of Source-Navigator.Source-Navigator is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public License as publishedby the Free Software Foundation; either version 2, or (at your option)any later version.Source-Navigator is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith Source-Navigator; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330, Boston,MA 02111-1307, USA.*//* $Id: Errors.c 247 2003-05-03 20:09:16Z mdejong $ *//* * $Log$ * Revision 1.2 2003/05/03 20:09:15 mdejong * * parsers/libjcreuse/Errors.c: Include * string.h to avoid compiler warning. * * parsers/python/pybrowser.c: Regen. * * parsers/python/pybrowser.l: Define YY_SKIP_YYWRAP * to avoid compiler warning. * * Revision 1.1.1.1 2002/04/18 23:41:59 mdejong * Import from sources.redhat.com on 2002-04-18. * * Revision 1.3 2000/04/20 00:38:40 spolk * 2000-04-19 Syd Polk <spolk@redhat.com> * * * Merged from snavigator-elix-990915-branch. * * Revision 1.2.16.2 2000/02/11 23:54:40 spolk * 2000-02-11 Syd Polk <spolk@cygnus.com> * * * configure.in: Added SUITE_NAME * * config.h.in configure: Regenerated. * * bitmaps/splashsn.gif: Added Shadow Man. * * english.txt.in: Added SUITE_NAME * * hyper/tclsql.c: Added SUITE_NAME * * gui/misc.tcl: Mucked around with text in About Box. * Changed all copyrights from "Red Hat Source-Navigator" to * "Source-Navigator" * Regenerated all Makefile.in. * * Revision 1.2.16.1 2000/02/10 02:12:55 spolk * 2000-02-09 Syd Polk <spolk@cygnus.com> * * * configure.in: More adjustments to product names and the like. * Got rid of --enable-production. * * configure: Regenerated. * * install/cdkey_mangle.c: Removed. * Added GPL copyright notice to all source files. * Regenerated all Makefile.in files. * * Revision 1.2 1998/05/21 04:51:00 bje * * parsers/libjcreuse/*.c: Removed RCS Id keyword. * * Revision 1.1.1.1 1998/03/16 18:39:12 khamis * Souce-Navigator in a new devo tree * * Revision 1.4 1998/01/27 12:20:38 zkoppany * Modifications for the Tcl parser. * * Revision 1.21 1997/11/30 22:40:23 grosch * changed type of ErrorCode from int to long * added missing initializations * suppress call of WritePosition if NoPosition * added functions BeginErrors and GetCount * * Revision 1.20 1997/05/27 13:25:04 grosch * truncation of filenames to 8.3 format * * Revision 1.19 1997/05/06 15:11:37 grosch * calmed down purify * * Revision 1.18 1996/08/13 13:20:23 grosch * adaption to DLL's for Microsoft Visual C++ * * Revision 1.17 1996/08/01 08:33:05 grosch * adaptions to MS Visual C++ 1.52 * * Revision 1.16 1996/07/25 16:51:34 grosch * adaption to MS VC++ * * Revision 1.15 1996/07/04 17:15:19 grosch * introduced files Reuse.h and config.h for system configuration * * Revision 1.14 1996/07/04 09:53:45 grosch * introduced files Reuse.h and config.h for system configuration * * Revision 1.13 1996/06/05 12:00:48 grosch * adaption to MS VC++ * * Revision 1.12 1995/08/14 13:56:25 grosch * corrections because of purify * * Revision 1.11 1995/05/09 13:53:42 grosch * added void to argument list of functions without arguments * * Revision 1.10 1995/03/20 15:37:30 grosch * truncate lines to at most 80 characters * * Revision 1.9 1995/02/23 20:11:10 grosch * renamed Positions to Position, StringMem to StringM, Relations to Relation * output lines with at most 132 characters * * Revision 1.8 1994/12/04 19:29:55 grosch * added ANSI-C prototypes * * Revision 1.7 1994/11/10 11:26:40 grosch * fixed bug in declaration of FoundString * * Revision 1.6 1994/11/07 12:39:52 grosch * added cpp variables BRIEF, FIRST, and TRUNCATE * * Revision 1.5 1994/06/16 19:05:46 grosch * added fflush * * Revision 1.4 1994/04/05 09:00:35 grosch * added prefix 'r' to true and false for improved portability * * Revision 1.3 1994/01/29 22:13:50 grosch * renamed bool to rbool * * Revision 1.2 1993/08/18 15:01:05 grosch * rename System and Memory to rSystem and rMemory * * Revision 1.1 1992/08/13 12:29:12 grosch * fix bugs with ANSI C * * Revision 1.0 1992/08/07 14:31:40 grosch * Initial revision * *//* Ich, Doktor Josef Grosch, Informatiker, Nov. 1994 */#include "Errors.h"#include "Reuse.h"#if HAVE_STDLIB_H | defined _MSC_VER#include <stdlib.h>#endif#include <string.h>#ifdef __cplusplusextern "C" {#include "rSystem.h"#include "rMemory.h"#include "Sets.h"#include "Idents.h"}#else#include "rSystem.h"#include "rMemory.h"#include "Sets.h"#include "Idents.h"#endif#define BRIEF#define FIRST#define TRUNCATE#define MaxError 500static void yyExit ARGS ((void)) { rExit (1); }void (* Errors_Exit) ARGS ((void)) = yyExit;typedef struct { tPosition Position ; rbool IsErrorCode ; short ErrorNumber ; long ErrorCode ; short ErrorClass ; short InfoClass ; union { int vInteger ; short vShort ; long vLong ; float vReal ; rbool vBoolean ; char vCharacter ; tStringRef vString ; tSet * vSet ; tIdent vIdent ; tPosition vPosition ; } Info;} tError;static void WriteHead ARGS ((tPosition Position, int ErrorClass));static void WriteCode ARGS ((long ErrorCode));static void WriteInfo ARGS ((int InfoClass, char * Info));static void WriteMessage ARGS ((rbool IsErrorCode, long ErrorCode, int ErrorClass, tPosition Position, int InfoClass, char * Info));static void StoreMessage ARGS ((rbool IsErrorCode, long ErrorCode, int ErrorClass, tPosition Position, int InfoClass, char * Info));static int IsLess ARGS ((tError * i, tError * j));static tError ErrorTable [MaxError + 1];static int MessageCount = 0;static rbool IsStore = rfalse;static void (* HandleMessage) ARGS ((rbool IsErrorCode, long ErrorCode, int ErrorClass, tPosition Position, int InfoClass, char * Info)) = WriteMessage;static FILE * Out = NULL;static unsigned long PrevLine = 0;static char FoundString [5000];static int nErrors [8] = { 0, 0, 0, 0, 0, 0, 0, 0 };void BeginErrors ARGS ((void)){ int i; for (i = 0; i < 8; i ++) nErrors [i] = 0; PrevLine = 0; MessageCount = 0;}void ErrorMessage#if defined __STDC__ | defined __cplusplus (long ErrorCode, int ErrorClass, tPosition Position)#else (ErrorCode, ErrorClass, Position) long ErrorCode, ErrorClass; tPosition Position;#endif{ nErrors [ErrorClass] ++; (* HandleMessage) (rtrue, ErrorCode, ErrorClass, Position, xxNone, NULL);}void ErrorMessageI#if defined __STDC__ | defined __cplusplus (long ErrorCode, int ErrorClass, tPosition Position, int InfoClass, char * Info)#else (ErrorCode, ErrorClass, Position, InfoClass, Info) long ErrorCode, ErrorClass; tPosition Position; int InfoClass; char * Info;#endif{ nErrors [ErrorClass] ++; (* HandleMessage) (rtrue, ErrorCode, ErrorClass, Position, InfoClass, Info);}void Message#if defined __STDC__ | defined __cplusplus (char * ErrorText, int ErrorClass, tPosition Position)#else (ErrorText, ErrorClass, Position) char * ErrorText; int ErrorClass; tPosition Position;#endif{ nErrors [ErrorClass] ++; (* HandleMessage) (rfalse, MakeIdent (ErrorText, strlen (ErrorText)), ErrorClass, Position, xxNone, NULL);}void MessageI#if defined __STDC__ | defined __cplusplus (char * ErrorText, int ErrorClass, tPosition Position, int InfoClass, char * Info)#else (ErrorText, ErrorClass, Position, InfoClass, Info) char * ErrorText; int ErrorClass; tPosition Position; int InfoClass; char * Info;#endif{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -