OSDN Git Service

* lex.c (finput): New variable.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Apr 1998 23:30:28 +0000 (23:30 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Apr 1998 23:30:28 +0000 (23:30 +0000)
        (init_cpp_parse):  Renamed from init_parse.
        (init_parse): Handle !USE_CPPLIB.  Call init_cpp_parse when finished.
        (finish_parse): New function.
        * cp-tree.h (init_lex, init_parse): Remove declarations.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19065 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/lex.c
gcc/cp/spew.c

index 02b3f69..64f5a59 100644 (file)
@@ -1,3 +1,11 @@
+Thu Apr  9 00:18:44 1998  Dave Brolley  (brolley@cygnus.com)
+
+       * lex.c (finput): New variable.
+       (init_cpp_parse):  Renamed from init_parse.
+       (init_parse): Handle !USE_CPPLIB.  Call init_cpp_parse when finished.
+       (finish_parse): New function.
+       * cp-tree.h (init_lex, init_parse): Remove declarations.
+
 Mon Apr  6 02:25:05 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * call.c (build_call): Still evaluate the actual argument.
index 443c83e..3da7f89 100644 (file)
@@ -2345,9 +2345,7 @@ extern void init_filename_times                   PROTO((void));
 #if 0
 extern void reinit_lang_specific               PROTO((void));
 #endif
-extern void init_lex                           PROTO((void));
 extern void reinit_parse_for_function          PROTO((void));
-extern int *init_parse                         PROTO((void));
 extern void print_parse_statistics             PROTO((void));
 extern void extract_interface_info             PROTO((void));
 extern void do_pending_inlines                 PROTO((void));
index 9d724a5..6033300 100644 (file)
@@ -108,6 +108,9 @@ file_name_nondirectory (x)
 struct obstack inline_text_obstack;
 char *inline_text_firstobj;
 
+#if !USE_CPPLIB
+FILE *finput;
+#endif
 int end_of_file;
 
 /* Pending language change.
@@ -425,7 +428,7 @@ init_filename_times ()
 
 /* Change by Bryan Boreham, Kewill, Thu Jul 27 09:46:05 1989.
    Stuck this hack in to get the files open correctly; this is called
-   in place of init_lex if we are an unexec'd binary.    */
+   in place of init_parse if we are an unexec'd binary.    */
 
 #if 0
 void
@@ -436,14 +439,48 @@ reinit_lang_specific ()
 }
 #endif
 
+static int *
+init_cpp_parse ()
+{
+#ifdef GATHER_STATISTICS
+#ifdef REDUCE_LENGTH
+  reduce_count = (int *)malloc (sizeof (int) * (REDUCE_LENGTH + 1));
+  bzero (reduce_count, sizeof (int) * (REDUCE_LENGTH + 1));
+  reduce_count += 1;
+  token_count = (int *)malloc (sizeof (int) * (TOKEN_LENGTH + 1));
+  bzero (token_count, sizeof (int) * (TOKEN_LENGTH + 1));
+  token_count += 1;
+#endif
+#endif
+  return token_count;
+}
+
 void
-init_lex ()
+init_parse (filename)
+     char *filename;
 {
   extern int flag_no_gnu_keywords;
   extern int flag_operator_names;
 
   int i;
 
+#if !USE_CPPLIB
+  /* Open input file.  */
+  if (filename == 0 || !strcmp (filename, "-"))
+    {
+      finput = stdin;
+      filename = "stdin";
+    }
+  else
+    finput = fopen (filename, "r");
+  if (finput == 0)
+    pfatal_with_name (filename);
+
+#ifdef IO_BUFFER_SIZE
+  setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
+#endif
+#endif /* !USE_CPPLIB */
+
   /* Initialize the lookahead machinery.  */
   init_spew ();
 
@@ -851,11 +888,21 @@ init_lex ()
       UNSET_RESERVED_WORD ("xor_eq");
     }
 
-  token_count = init_parse ();
+  token_count = init_cpp_parse ();
   interface_unknown = 1;
 }
 
 void
+finish_parse ()
+{
+#if USE_CPPLIB
+  cpp_finish (&parse_in);
+#else
+  fclose (finput);
+#endif
+}
+
+void
 reinit_parse_for_function ()
 {
   current_base_init_list = NULL_TREE;
@@ -922,22 +969,6 @@ int *token_count;
 #define TOKEN_LENGTH (256 + sizeof (yytname) / sizeof (yytname[0]))
 #endif
 
-int *
-init_parse ()
-{
-#ifdef GATHER_STATISTICS
-#ifdef REDUCE_LENGTH
-  reduce_count = (int *)malloc (sizeof (int) * (REDUCE_LENGTH + 1));
-  bzero (reduce_count, sizeof (int) * (REDUCE_LENGTH + 1));
-  reduce_count += 1;
-  token_count = (int *)malloc (sizeof (int) * (TOKEN_LENGTH + 1));
-  bzero (token_count, sizeof (int) * (TOKEN_LENGTH + 1));
-  token_count += 1;
-#endif
-#endif
-  return token_count;
-}
-
 #ifdef GATHER_STATISTICS
 #ifdef REDUCE_LENGTH
 void
index 0844679..ceee4e6 100644 (file)
@@ -69,7 +69,7 @@ static unsigned int yylex_ctr = 0;
 static int debug_yychar ();
 #endif
 
-/* Initialize token_obstack. Called once, from init_lex.  */
+/* Initialize token_obstack. Called once, from init_parse.  */
 
 void
 init_spew ()