X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/616915ddfdcba888735f45cbd9c26c9b5383ee2c..061ece7d6fedbde47030222fea74b575c12707dc:/src/scanline.c diff --git a/src/scanline.c b/src/scanline.c index d972215..5b0baa8 100644 --- a/src/scanline.c +++ b/src/scanline.c @@ -1,6 +1,6 @@ /* -** LCLint - annotation-assisted static program checker -** Copyright (C) 1994-2000 University of Virginia, +** Splint - annotation-assisted static program checker +** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it @@ -17,9 +17,9 @@ ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** -** For information on lclint: lclint-request@cs.virginia.edu -** To report a bug: lclint-bug@cs.virginia.edu -** For more information: http://lclint.cs.virginia.edu +** For information on splint: info@splint.org +** To report a bug: splint-bug@splint.org +** For more information: http://www.splint.org */ /* ** scanline.c @@ -39,8 +39,8 @@ ** and determine its kind. */ -# include "lclintMacros.nf" -# include "llbasic.h" +# include "splintMacros.nf" +# include "basic.h" # include "signature.h" # include "signature2.h" # include "scan.h" @@ -51,8 +51,9 @@ /*@notfunction@*/ # define MOVECHAR() do { *bufptr++ = c; c = *currentLine++; colNumber++; } while (FALSE) -/*@constant static int MAXCHAR;@*/ -# define MAXCHAR 512 +/* evans 2003-04-21: changed name to avoid conflict with MS VC++ */ +/*@constant static int SCANMAXCHAR;@*/ +# define SCANMAXCHAR 512 /*@constant static int TABSIZE;@*/ # define TABSIZE 8 @@ -61,12 +62,12 @@ static void LocalUserError (/*@temp@*/ char *p_msg); static charClassData charClass[LASTCHAR + 1]; -static unsigned int colNumber; -static unsigned int startCol; +static int colNumber; +static int startCol; static bool reportEOL; static bool reportComments; -static char tokenBuffer[MAXCHAR]; +static char tokenBuffer[SCANMAXCHAR]; static const charClassData charClassDef[] = { @@ -606,8 +607,8 @@ lscanLine (char *currentLine) } ltoken_setCol (newToken, startCol); - ltoken_setLine (newToken, tsource_thisLineNumber (LSLScanSource ())); - ltoken_setFileName (newToken, tsource_fileName (LSLScanSource ())); + ltoken_setLine (newToken, inputStream_thisLineNumber (LSLScanSource ())); + ltoken_setFileName (newToken, inputStream_fileName (LSLScanSource ())); if (ltoken_getCode (newToken) == LST_COMMENTSYM) { @@ -653,8 +654,8 @@ LSLScanEofToken (void) lsymbol_fromChars ("E O F"), 0, TRUE)); ltoken_setCol (t, colNumber); - ltoken_setLine (t, tsource_thisLineNumber (LSLScanSource ())); - ltoken_setFileName (t, tsource_fileName (LSLScanSource ())); + ltoken_setLine (t, inputStream_thisLineNumber (LSLScanSource ())); + ltoken_setFileName (t, inputStream_fileName (LSLScanSource ())); return t; } @@ -667,10 +668,10 @@ LSLReportEolTokens (bool setting) static void LocalUserError (char *msg) { - tsource *s = LSLScanSource (); - llfatalerror (message ("%s:%u,%u: %s", - cstring_fromChars (tsource_fileName (s)), - tsource_thisLineNumber (s), colNumber, + inputStream s = LSLScanSource (); + llfatalerror (message ("%s:%d,%d: %s", + inputStream_fileName (s), + inputStream_thisLineNumber (s), colNumber, cstring_fromChars (msg))); } @@ -755,7 +756,7 @@ lscanLineInit (void) ltoken_compose = LSLReserveToken (LST_COMPOSESYM, "\\composeSort"); ltoken_if = LSLReserveToken (LST_ifTOKEN, "if"); - (void) LSLReserveToken (LST_LPAR, "("); + (void) LSLReserveToken (LST_LPAR, " ("); (void) LSLReserveToken (LST_RPAR, ")"); (void) LSLReserveToken (LST_COMMA, ","); (void) LSLReserveToken (LST_COLON, ":"); @@ -803,20 +804,20 @@ lscanLineCleanup (void) charCode lscanCharClass (char c) { - return charClass[(int)(c)].code; + return charClass[ (int) (c)].code; } bool LSLIsEndComment (char c) { - return charClass[(int)(c)].endCommentChar; + return charClass[ (int) (c)].endCommentChar; } void lsetCharClass (char c, charCode cod) { - charClass[(int)(c)].code = cod; + charClass[ (int) (c)].code = cod; } void lsetEndCommentChar (char c, bool flag) { - charClass[(int)(c)].endCommentChar = flag; + charClass[ (int) (c)].endCommentChar = flag; }