]> andersk Git - splint.git/blobdiff - src/cppmain.c
Renaming - LCLint => Splint
[splint.git] / src / cppmain.c
index 40950200e8393d043183a245b058cbd5986cbb80..ed6a6d6de384f8d4e49a30d75253689970f4ec9f 100644 (file)
@@ -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-2001 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
@@ -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
 */
 /*
 ** cppmain.c
@@ -48,7 +48,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 # include "lclintMacros.nf"
 # include "llbasic.h"
-# include "cpp.h"
 # include "cpplib.h"
 # include "cpphash.h"
 # include "cpperror.h"
@@ -116,7 +115,7 @@ int cppProcess (/*@dependent@*/ cstring infile,
       llexit (LLFAILURE);
     }
 
-  ofile = fopen (cstring_toCharsSafe (outfile), "w");
+  ofile = fileTable_openFile (context_fileTable (), outfile, "w");
   
   if (ofile == NULL) 
     {
@@ -148,9 +147,9 @@ int cppProcess (/*@dependent@*/ cstring infile,
     }
 
   cppReader_finish (&g_cppState);
-  check (fclose (ofile) == 0);
+  check (fileTable_closeFile (context_fileTable (), ofile));
 
-  /* Resotre the original definition table. */
+  /* Restore the original definition table. */
 
   if (!context_getFlag (FLG_SINGLEINCLUDE))
     {
@@ -167,24 +166,36 @@ int cppProcess (/*@dependent@*/ cstring infile,
   return 0;
 }
 
-void cppAddIncludeDir (cstring dir) 
+void cppAddIncludeDir (cstring dir)
 {
-  /* -I option (Add directory to include path) */
-  struct file_name_list *dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp));
+  /* evans 2001-08-26
+  ** Add the -I- code.  This code provided by Robin Watts <Robin.Watts@wss.co.uk>
+  */
 
-  DPRINTF (("Add include: %s", dir));
-
-  dirtmp->next = 0;            /* New one goes on the end */
-  dirtmp->control_macro = 0;
-  dirtmp->c_system_include_path = FALSE;
-  
-  /* This copy is necessary...but shouldn't be? */
-  /*@-onlytrans@*/
-  dirtmp->fname = cstring_copy (dir);
-  /*@=onlytrans@*/
-  
-  dirtmp->got_name_map = FALSE;
-  cppReader_addIncludeChain (&g_cppState, dirtmp);
+  if (cstring_equalLit (dir, "-I-"))
+    {
+      struct cppOptions *opts = CPPOPTIONS (&g_cppState);    
+      opts->ignore_srcdir = TRUE;
+    } 
+  else 
+    {
+      /* -I option (Add directory to include path) */
+      struct file_name_list *dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp));
+      
+      DPRINTF (("Add include: %s", dir));
+      
+      dirtmp->next = 0;                /* New one goes on the end */
+      dirtmp->control_macro = 0;
+      dirtmp->c_system_include_path = FALSE;
+      
+      /* This copy is necessary...but shouldn't be? */
+      /*@-onlytrans@*/
+      dirtmp->fname = cstring_copy (dir);
+      /*@=onlytrans@*/
+      
+      dirtmp->got_name_map = FALSE;
+      cppReader_addIncludeChain (&g_cppState, dirtmp);
+    }
 }
 
 void cppDoDefine (cstring str)
@@ -199,7 +210,7 @@ void cppDoDefine (cstring str)
 void cppDoUndefine (cstring str)
 {
   int sym_length;
-  HASHNODE *hp;
+  hashNode hp;
   char *buf = cstring_toCharsSafe (str);
 
   sym_length = cppReader_checkMacroName (&g_cppState, buf,
This page took 0.043715 seconds and 4 git commands to generate.