]> andersk Git - splint.git/blobdiff - src/lcllib.c
Fixed but with multiple globals clauses reported by Gayath Ratnayaka.
[splint.git] / src / lcllib.c
index efaa31fe5cb40ffacface938ed52291c2319edca..15a08c5893a4b970d051a4c79994825b46e042da 100644 (file)
 # include "splintMacros.nf"
 # include "llbasic.h"
 # include "osd.h"
+# include "version.h"
 
-# ifndef NOLCL
 # include "gram.h"
-
 # include "lclscan.h"
-# endif
 
 # include "lcllib.h"
 # include "llmain.h"
@@ -226,7 +224,15 @@ lcllib_isSkipHeader (cstring sname)
          if (context_getFlag (FLG_SKIPPOSIXHEADERS))
            {
              cstring_free (xname);
-             return TRUE; /* evans 2002-03-02: investigate this warning */
+             /*@-nullstate@*/ 
+             return TRUE; 
+             /*@=nullstate@*/
+             /*@i233@*/
+             /* evans 2002-03-02: 
+                the returned reference is possibly null,
+                but this should not change the null state of the parameter
+                investigate this warning 
+             */
            }
        }
       else
@@ -250,17 +256,14 @@ lcllib_isSkipHeader (cstring sname)
 
   cstring_free (xname);
   /*@noaccess cstring@*/
+  /*@-nullstate@*/ /*@i233@*/ /* same problem as above */
   return FALSE;
+  /*@=nullstate@*/
 }
 
 static void printDot (void)
 {
-  if (context_getFlag (FLG_SHOWSCAN)) 
-    {
-      (void) fflush (g_msgstream);
-      fprintf (stderr, "."); 
-      (void) fflush (stderr);
-    }
+  displayScanContinue (cstring_makeLiteralTemp ("."));
 }
 
 void
@@ -269,12 +272,9 @@ dumpState (cstring cfname)
   FILE *f;
   cstring fname = fileLib_addExtension (cfname, cstring_makeLiteralTemp (DUMP_SUFFIX));
   
-  f = fileTable_openFile (context_fileTable (), fname, "w");
+  f = fileTable_openWriteFile (context_fileTable (), fname);
 
-  if (context_getFlag (FLG_SHOWSCAN))
-    {
-      fprintf (stderr, "< Dumping to %s ", cstring_toCharsSafe (fname)); 
-    }
+  displayScanOpen (message ("Dumping to %s ", fname)); 
   
   if (f == NULL)
     {
@@ -328,11 +328,7 @@ dumpState (cstring cfname)
       check (fileTable_closeFile (context_fileTable (), f));
     }
 
-  if (context_getFlag (FLG_SHOWSCAN))
-    {
-      fprintf (g_msgstream, " >\n");
-    }
-
+  displayScanClose ();
   cstring_free (fname);
 }
 
@@ -357,7 +353,7 @@ loadStandardState ()
     }
   else
     {
-      stdlib = fileTable_openFile (context_fileTable (), fpath, "r");
+      stdlib = fileTable_openReadFile (context_fileTable (), fpath);
 
       if (stdlib == NULL)
        {
@@ -407,7 +403,7 @@ loadStandardState ()
              sfree (ot);
              
              check (fileTable_closeFile (context_fileTable (), stdlib));
-             stdlib = fileTable_openFile (context_fileTable (), fpath, "r");
+             stdlib = fileTable_openReadFile (context_fileTable (), fpath);
            }
 
          llassert (stdlib != NULL);
@@ -417,17 +413,9 @@ loadStandardState ()
 
          DPRINTF (("Loading: %s", fpath));
 
-         if (context_getDebug (FLG_SHOWSCAN))
-           {
-             fprintf (g_msgstream, "< loading standard library %s ", 
-                      cstring_toCharsSafe (fpath));
-             result = loadLCDFile (stdlib, fpath);
-             fprintf (g_msgstream, " >\n");
-           }
-         else
-           {
-             result = loadLCDFile (stdlib, fpath);
-           }
+         displayScanOpen (message ("loading standard library %s ", fpath));
+         result = loadLCDFile (stdlib, fpath);
+         displayScanClose ();
 
          check (fileTable_closeFile (context_fileTable (), stdlib));
        }
@@ -579,13 +567,11 @@ loadState (cstring cfname)
   FILE *f;
   cstring fname = fileLib_addExtension (cfname, cstring_makeLiteralTemp (DUMP_SUFFIX));
 
-  f = fileTable_openFile (context_fileTable (), fname, "r");
+  f = fileTable_openReadFile (context_fileTable (), fname);
 
   if (f == NULL)
     {
-      if (context_getDebug (FLG_SHOWSCAN))
-       fprintf (g_msgstream, " >\n");
-
+      displayScanClose ();
       llfatalerror (message ("Cannot open dump file for loading: %s", 
                             fname));
     }
This page took 0.037659 seconds and 4 git commands to generate.