]> andersk Git - splint.git/blobdiff - src/lslinit.c
Merged this branch with the one in the splint.sf.net repository.
[splint.git] / src / lslinit.c
index 64d69195e149cb474951e0a5af61fc0fe603d7ca..01fbdad607e9d0d756639a7e6a60ff19a5ecafd4 100644 (file)
@@ -36,7 +36,6 @@
 # include "tokentable.h"
 # include "syntable.h"
 # include "lslinit.h"
-# include "lclinit.h"
 
 /* needed to parse init files */
 # include "shift.h"
@@ -53,8 +52,6 @@ static void LocalUserError (ltoken p_t, /*@temp@*/ char *p_msg)
 
 static /*@only@*/ ltoken nextToken;
 
-static /*@only@*/ /*@null@*/ inputStream s_initFile = inputStream_undefined;
-
 static void InitFile (void) /*@modifies nextToken@*/ ;
 static void InitLines (void) /*@modifies nextToken@*/ ;
 static void InitLine (void) /*@modifies nextToken@*/ ;
@@ -149,10 +146,9 @@ hasFirstChar (ltoken tok)
 }
 
 void
-lslinit_setInitFile (inputStream s)
+LSLProcessInitFile (void)
 {
-  llassert (inputStream_isUndefined (s_initFile));
-  s_initFile = s;
+  InitFile ();
 }
 
 /*
@@ -162,7 +158,8 @@ lslinit_setInitFile (inputStream s)
 **
 */
 
-static void lslinit_processInitFile (void)
+static void
+InitFile (void)
 {
   InitLines ();
   InitReduce (INITFILE1);
@@ -1495,8 +1492,8 @@ static /*@exposed@*/ ltoken insertSimpleToken (char *text)
   return (LSLInsertToken (LST_SIMPLEID, lsymbol_fromChars (text), 0, FALSE));
 }
 
-static void
-lslinit_initProcessInitFile (void)
+void
+LSLProcessInitFileInit (void)
 {
   int i;
 
@@ -1549,154 +1546,10 @@ lslinit_initProcessInitFile (void)
   nextToken = LSLScanNextToken ();            
 }
 
-void lslinit_process (void)
-  /*@globals undef g_symtab; @*/
-  /*@modifies g_symtab, internalState, fileSystem; @*/
-{
-  /*
-  ** Open init file provided by user, or use the default LCL init file 
-  */
-  
-  cstring larchpath = context_getLarchPath ();
-  inputStream initstream = inputStream_undefined;
-
-  setCodePoint ();
-
-  if (inputStream_isUndefined (s_initFile))
-    {
-      s_initFile = inputStream_create (cstring_makeLiteral (INITFILENAME), 
-                                      cstring_makeLiteralTemp (LCLINIT_SUFFIX),
-                                      FALSE);
-      
-      if (!inputStream_getPath (larchpath, s_initFile))
-       {
-         lldiagmsg (message ("Continuing without LCL init file: %s",
-                             inputStream_fileName (s_initFile)));
-       }
-      else 
-       {
-         if (!inputStream_open (s_initFile))
-           {
-             lldiagmsg (message ("Continuing without LCL init file: %s",
-                                 inputStream_fileName (s_initFile)));
-           }
-       }
-    }
-  else 
-    {
-      if (!inputStream_open (s_initFile))
-       {
-         lldiagmsg (message ("Continuing without LCL init file: %s",
-                             inputStream_fileName (s_initFile)));
-       }
-    }
-
-  /* Initialize checker */
-
-  lsymbol_initMod ();
-  LCLSynTableInit ();
-
-  setCodePoint ();
-
-  LCLSynTableReset ();
-  LCLTokenTableInit ();
-
-  setCodePoint ();
-
-  LCLScanLineInit ();
-  setCodePoint ();
-  LCLScanLineReset ();
-  setCodePoint ();
-  LCLScanInit ();
 
-  setCodePoint ();
 
-  /* need this to initialize LCL checker */
 
-  llassert (inputStream_isDefined (s_initFile));      
-  if (inputStream_isOpen (s_initFile))
-    {
-      setCodePoint ();
-
-      LCLScanReset (s_initFile);
-      lclinit_initMod ();
-      lclinit_reset ();
 
-      setCodePoint ();
-      lclinit_process ();
-      lclinit_cleanup ();
-
-      setCodePoint ();
-      check (inputStream_close (s_initFile));
-    }
-  
-  /* Initialize LSL init files, for parsing LSL signatures from LSL */
-  
-  initstream = inputStream_create (cstring_makeLiteral ("lslinit.lsi"), 
-                                   cstring_makeLiteralTemp (".lsi"),
-                                   FALSE);
-  
-  if (!inputStream_getPath (larchpath, initstream))
-    {
-      lldiagmsg (message ("Continuing without LSL init file: %s",
-                         inputStream_fileName (initstream)));
-    }
-  else 
-    {
-      if (!inputStream_open (initstream))
-       {
-         lldiagmsg (message ("Continuing without LSL init file: %s",
-                             inputStream_fileName (initstream)));
-       }
-    }
-      
-  setCodePoint ();
-  lsynTableInit ();
-  lsynTableReset ();
 
-  setCodePoint ();
-  ltokenTableInit ();
 
-  setCodePoint ();
-  lscanLineInit ();
-  lscanLineReset ();
-  LSLScanInit ();
 
-  if (inputStream_isOpen (initstream))
-    {
-      setCodePoint ();
-      LSLScanReset (initstream);
-      lslinit_initProcessInitFile ();
-      lslinit_processInitFile ();
-      check (inputStream_close (initstream));
-    }
-      
-  inputStream_free (initstream);
-  
-  if (lclHadError ())
-    {
-      lclplainerror 
-       (cstring_makeLiteral ("LSL init file error.  Attempting to continue."));
-    }
-  
-  setCodePoint ();
-  g_symtab = symtable_new ();
-  
-  /* 
-  ** sort_init must come after symtab has been initialized 
-  */
-  sort_init ();
-  abstract_init ();
-  setCodePoint ();
-  
-  /* 
-  ** Equivalent to importing old spec_csupport.lcl
-  ** define immutable LCL type "bool" and bool constants TRUE and FALSE
-  ** and initialized them to be equal to LSL's "true" and "false".
-  **
-  ** Reads in CTrait.syms (derived from CTrait.lsl) on LARCH_PATH.
-  */
-      
-  LCLBuiltins (); 
-  LCLReportEolTokens (FALSE);
-}
This page took 0.03956 seconds and 4 git commands to generate.