lex.c (finput): New variable.

* 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.

From-SVN: r19065
This commit is contained in:
Dave Brolley 1998-04-08 23:30:28 +00:00 committed by Jeff Law
parent 77f77701a5
commit 2b2a353188
4 changed files with 59 additions and 22 deletions

View 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.

View 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));

View 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,10 +888,20 @@ 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 ()
{
@ -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

View 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 ()