From 77f77701a5cfcced3afcab79f8b6a81e7a968c71 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Wed, 8 Apr 1998 17:30:08 -0600 Subject: [PATCH] com.c (finput): New variable. * 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 | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/gcc/f/com.c b/gcc/f/com.c index 39af54dce70..282a294b679 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -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 -- 2.30.2