com.c (finput): New variable.
authorDave Brolley <brolley@cygnus.com>
Wed, 8 Apr 1998 23:30:08 +0000 (17:30 -0600)
committerJeff Law <law@gcc.gnu.org>
Wed, 8 Apr 1998 23:30:08 +0000 (17:30 -0600)
        * com.c (finput): New variable.
        (init_parse): Handle !USE_CPPLIB.
        (finish_parse): New function.
        (lang_init): No longer declare finput.

From-SVN: r19064

gcc/f/com.c

index 39af54dce70cc9bfa5f85ffe807b059f78642d4e..282a294b67996687fc8afeda37a57b56969594c1 100644 (file)
@@ -238,6 +238,9 @@ tree current_function_decl;
 
 char *language_string = "GNU F77";
 
+/* Stream for reading from the input file.  */
+FILE *finput;
+
 /* These definitions parallel those in c-decl.c so that code from that
    module can be used pretty much as is.  Much of these defs aren't
    otherwise used, i.e. by g77 code per se, except some of them are used
@@ -14793,12 +14796,28 @@ init_decl_processing ()
 }
 
 void
-init_lex ()
+init_parse (filename)
+     char *filename;
 {
 #if BUILT_FOR_270
   extern void (*print_error_function) (char *);
 #endif
 
+  /* 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
+
   /* Make identifier nodes long enough for the language-specific slots.  */
   set_identifier_size (sizeof (struct lang_identifier));
   decl_printable_name = lang_printable_name;
@@ -14807,6 +14826,12 @@ init_lex ()
 #endif
 }
 
+void
+finish_parse ()
+{
+  fclose (finput);
+}
+
 void
 insert_block (block)
      tree block;
@@ -14851,8 +14876,6 @@ lang_identify ()
 void
 lang_init ()
 {
-  extern FILE *finput;         /* Don't pollute com.h with this. */
-
   /* If the file is output from cpp, it should contain a first line
      `# 1 "real-filename"', and the current design of gcc (toplev.c
      in particular and the way it sets up information relied on by