]> andersk Git - splint.git/blobdiff - src/lcllib.c
Fixed branch state bug with definitely null values (reported by Jon Wilson).
[splint.git] / src / lcllib.c
index 58d64ca6405ab3241f8b539f7cd7a3ef2f9dc962..5bc00e2bc479ef46ecefcd9a369edfb14aaf3f1b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-** LCLint - annotation-assisted static program checker
+** Splint - annotation-assisted static program checker
 ** Copyright (C) 1994-2001 University of Virginia,
 **         Massachusetts Institute of Technology
 **
@@ -19,7 +19,7 @@
 **
 ** 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 more information: http://www.splint.org
 */
 /*
 ** lcllib.c
@@ -33,7 +33,6 @@
 
 # include "lclintMacros.nf"
 # include "llbasic.h"
-
 # include "osd.h"
 
 # ifndef NOLCL
@@ -42,8 +41,6 @@
 # include "lclscan.h"
 # endif
 
-
-# include "herald.h"
 # include "lcllib.h"
 # include "llmain.h"
 # include "portab.h"
@@ -245,7 +242,7 @@ dumpState (cstring cfname)
   FILE *f;
   cstring fname = fileLib_addExtension (cfname, cstring_makeLiteralTemp (DUMP_SUFFIX));
   
-  f = fopen (cstring_toCharsSafe (fname), "w");
+  f = fileTable_openFile (context_fileTable (), fname, "w");
 
   if (context_getFlag (FLG_SHOWSCAN))
     {
@@ -277,8 +274,8 @@ dumpState (cstring cfname)
       ** Be careful, these lines must match loadLCDFile checking.
       */
 
-      fprintf (f, ";;LCLint Dump: %s\n", cstring_toCharsSafe (fname));
-      fprintf (f, ";;%s\n", LCL_VERSION);
+      fprintf (f, "%s %s\n", LIBRARY_MARKER, cstring_toCharsSafe (fname));
+      fprintf (f, ";;%s\n", SPLINT_VERSION);
       fprintf (f, ";;lib:%d\n", (int) context_getLibrary ());
       fprintf (f, ";;ctTable\n");
       
@@ -301,7 +298,7 @@ dumpState (cstring cfname)
       fprintf (f, ";; Modules access\n");
       context_dumpModuleAccess (f);
       fprintf (f, ";;End\n");
-      check (fclose (f) == 0);
+      check (fileTable_closeFile (context_fileTable (), f));
     }
 
   if (context_getFlag (FLG_SHOWSCAN))
@@ -333,7 +330,7 @@ loadStandardState ()
     }
   else
     {
-      stdlib = fopen (cstring_toCharsSafe (fpath), "r");
+      stdlib = fileTable_openFile (context_fileTable (), fpath, "r");
 
       if (stdlib == NULL)
        {
@@ -382,8 +379,8 @@ loadStandardState ()
 
              sfree (ot);
              
-             check (fclose (stdlib) == 0);
-             stdlib = fopen (cstring_toCharsSafe (fpath), "r");
+             check (fileTable_closeFile (context_fileTable (), stdlib));
+             stdlib = fileTable_openFile (context_fileTable (), fpath, "r");
            }
 
          llassert (stdlib != NULL);
@@ -405,7 +402,7 @@ loadStandardState ()
              result = loadLCDFile (stdlib, fpath);
            }
 
-         check (fclose (stdlib) == 0);
+         check (fileTable_closeFile (context_fileTable (), stdlib));
        }
     }
 
@@ -426,9 +423,9 @@ loadLCDFile (FILE *f, cstring name)
   */
 
   if (reader_readLine (f, buf, BUFLEN) == NULL
-      || !mstring_equalPrefix (buf, ";;LCLint Dump:"))
+      || !mstring_equalPrefix (buf, LIBRARY_MARKER))
     {
-      loadllmsg (message ("Load library %s is not in LCLint library format.  Attempting "
+      loadllmsg (message ("Load library %s is not in Splint library format.  Attempting "
                          "to continue without library.", name));
       return FALSE;
     }
@@ -437,13 +434,13 @@ loadLCDFile (FILE *f, cstring name)
     {
       if (!mstring_equalPrefix (buf, ";;"))
        {
-         loadllmsg (message ("Load library %s is not in LCLint library format.  Attempting "
+         loadllmsg (message ("Load library %s is not in Splint library format.  Attempting "
                              "to continue without library.", name));
          return FALSE;
        }
       else if (mstring_equalPrefix (buf, ";;ctTable"))
        {
-         loadllmsg (message ("Load library %s is in obsolete LCLint library format.  Attempting "
+         loadllmsg (message ("Load library %s is in obsolete Splint library format.  Attempting "
                              "to continue anyway, but results may be incorrect.  Rebuild "
                              "the library with this version of lclint.", 
                              name));
@@ -452,9 +449,10 @@ loadLCDFile (FILE *f, cstring name)
        {
          float version = 0.0;
 
-         if (sscanf (buf, ";;LCLint %f", &version) != 1)
+         if (sscanf (buf, ";;Splint %f", &version) != 1
+             && (sscanf (buf, ";;LCLint %f", &version) != 1))
            {
-             loadllmsg (message ("Load library %s is not in LCLint library format (missing version "
+             loadllmsg (message ("Load library %s is not in Splint library format (missing version "
                                  "number).  Attempting "
                                  "to continue without library.", name));
              return FALSE;
@@ -480,7 +478,7 @@ loadLCDFile (FILE *f, cstring name)
                {
                  if (reader_readLine (f, buf, BUFLEN) == NULL)
                    {
-                     loadllmsg (message ("Load library %s is not in LCLint library "
+                     loadllmsg (message ("Load library %s is not in Splint library "
                                          "format (missing library code). Attempting "
                                          "to continue without library.", name));
                      return FALSE;
@@ -491,7 +489,7 @@ loadLCDFile (FILE *f, cstring name)
                      
                      if (sscanf (buf, ";;lib:%d", &lib) != 1)
                        {
-                         loadllmsg (message ("Load library %s is not in LCLint library "
+                         loadllmsg (message ("Load library %s is not in Splint library "
                                              "format (missing library code). Attempting "
                                              "to continue without library.", name));
                          return FALSE;
@@ -524,7 +522,7 @@ loadLCDFile (FILE *f, cstring name)
     }
   else
     {
-      loadllmsg (message ("Load library %s is not in LCLint library format (missing lines).  "
+      loadllmsg (message ("Load library %s is not in Splint library format (missing lines).  "
                          "Attempting to continue without library.", name));
       return FALSE;
     }
@@ -554,7 +552,7 @@ loadState (cstring cfname)
   FILE *f;
   cstring fname = fileLib_addExtension (cfname, cstring_makeLiteralTemp (DUMP_SUFFIX));
 
-  f = fopen (cstring_toCharsSafe (fname), "r");
+  f = fileTable_openFile (context_fileTable (), fname, "r");
 
   if (f == NULL)
     {
@@ -577,7 +575,7 @@ loadState (cstring cfname)
            }
        }
       
-      check (fclose (f) == 0);
+      check (fileTable_closeFile (context_fileTable (), f));
     }
 
   /* usymtab_printAll (); */
This page took 0.052534 seconds and 4 git commands to generate.