More g++-3 fixes:

- std:c{in,out,err}
	- include <iostream>
	- use std::endl instead of \n
This commit is contained in:
christos 2003-11-18 21:37:39 +00:00
parent 9845fd1063
commit 2f971ecfcb
5 changed files with 37 additions and 37 deletions

View File

@ -1,4 +1,4 @@
// $NetBSD: FlexLexer.h,v 1.8 1998/01/05 05:15:43 perry Exp $ // $NetBSD: FlexLexer.h,v 1.9 2003/11/18 21:37:39 christos Exp $
// FlexLexer.h -- define interfaces for lexical analyzer classes generated // FlexLexer.h -- define interfaces for lexical analyzer classes generated
// by flex // by flex
@ -43,7 +43,7 @@
#ifndef __FLEX_LEXER_H #ifndef __FLEX_LEXER_H
// Never included before - need to define base class. // Never included before - need to define base class.
#define __FLEX_LEXER_H #define __FLEX_LEXER_H
#include <iostream.h> #include <iostream>
extern "C++" { extern "C++" {
@ -60,14 +60,14 @@ public:
virtual void virtual void
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
virtual struct yy_buffer_state* virtual struct yy_buffer_state*
yy_create_buffer( istream* s, int size ) = 0; yy_create_buffer( std::istream* s, int size ) = 0;
virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
virtual void yyrestart( istream* s ) = 0; virtual void yyrestart( std::istream* s ) = 0;
virtual int yylex() = 0; virtual int yylex() = 0;
// Call yylex with new input/output sources. // Call yylex with new input/output sources.
int yylex( istream* new_in, ostream* new_out = 0 ) int yylex( std::istream* new_in, std::ostream* new_out = 0 )
{ {
switch_streams( new_in, new_out ); switch_streams( new_in, new_out );
return yylex(); return yylex();
@ -75,8 +75,8 @@ public:
// Switch to new input/output streams. A nil stream pointer // Switch to new input/output streams. A nil stream pointer
// indicates "keep the current one". // indicates "keep the current one".
virtual void switch_streams( istream* new_in = 0, virtual void switch_streams( std::istream* new_in = 0,
ostream* new_out = 0 ) = 0; std::ostream* new_out = 0 ) = 0;
int lineno() const { return yylineno; } int lineno() const { return yylineno; }
@ -103,17 +103,17 @@ class yyFlexLexer : public FlexLexer {
public: public:
// arg_yyin and arg_yyout default to the cin and cout, but we // arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex(). // only make that assignment when initializing in yylex().
yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ); yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
virtual ~yyFlexLexer(); virtual ~yyFlexLexer();
void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
struct yy_buffer_state* yy_create_buffer( istream* s, int size ); struct yy_buffer_state* yy_create_buffer( std::istream* s, int size );
void yy_delete_buffer( struct yy_buffer_state* b ); void yy_delete_buffer( struct yy_buffer_state* b );
void yyrestart( istream* s ); void yyrestart( std::istream* s );
virtual int yylex(); virtual int yylex();
virtual void switch_streams( istream* new_in, ostream* new_out ); virtual void switch_streams( std::istream* new_in, std::ostream* new_out );
protected: protected:
virtual int LexerInput( char* buf, int max_size ); virtual int LexerInput( char* buf, int max_size );
@ -124,7 +124,7 @@ protected:
int yyinput(); int yyinput();
void yy_load_buffer_state(); void yy_load_buffer_state();
void yy_init_buffer( struct yy_buffer_state* b, istream* s ); void yy_init_buffer( struct yy_buffer_state* b, std::istream* s );
void yy_flush_buffer( struct yy_buffer_state* b ); void yy_flush_buffer( struct yy_buffer_state* b );
int yy_start_stack_ptr; int yy_start_stack_ptr;
@ -139,8 +139,8 @@ protected:
yy_state_type yy_try_NUL_trans( yy_state_type current_state ); yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer(); int yy_get_next_buffer();
istream* yyin; // input source for default LexerInput std::istream* yyin; // input source for default LexerInput
ostream* yyout; // output sink for default LexerOutput std::ostream* yyout; // output sink for default LexerOutput
struct yy_buffer_state* yy_current_buffer; struct yy_buffer_state* yy_current_buffer;

View File

@ -65,7 +65,7 @@ Changes between release 2.5.2 (25Apr95) and release 2.5.1:
- The .texi and .info files in MISC/texinfo/ have been updated, - The .texi and .info files in MISC/texinfo/ have been updated,
thanks also to Francois Pinard. thanks also to Francois Pinard.
- The FlexLexer::yylex(istream* new_in, ostream* new_out) method - The FlexLexer::yylex(std::istream* new_in, std::ostream* new_out) method
now does not have a default for the first argument, to disambiguate now does not have a default for the first argument, to disambiguate
it from FlexLexer::yylex(). it from FlexLexer::yylex().
@ -371,14 +371,14 @@ Changes between release 2.5.1 (28Mar95) and release 2.4.7:
- The FlexLexer class includes two new public member functions: - The FlexLexer class includes two new public member functions:
virtual void switch_streams( istream* new_in = 0, virtual void switch_streams( std::istream* new_in = 0,
ostream* new_out = 0 ) std::ostream* new_out = 0 )
reassigns yyin to new_in (if non-nil) and yyout to new_out reassigns yyin to new_in (if non-nil) and yyout to new_out
(ditto), deleting the previous input buffer if yyin is (ditto), deleting the previous input buffer if yyin is
reassigned. It is used by: reassigned. It is used by:
int yylex( istream* new_in = 0, ostream* new_out = 0 ) int yylex( std::istream* new_in = 0, std::ostream* new_out = 0 )
which first calls switch_streams() and then returns the value which first calls switch_streams() and then returns the value
of calling yylex(). of calling yylex().

View File

@ -1,4 +1,4 @@
.\" $NetBSD: flex.1,v 1.15 2003/07/09 14:47:33 wiz Exp $ .\" $NetBSD: flex.1,v 1.16 2003/11/18 21:37:39 christos Exp $
.\" .\"
.TH FLEX 1 "April 1995" "Version 2.5" .TH FLEX 1 "April 1995" "Version 2.5"
.SH NAME .SH NAME
@ -3394,7 +3394,7 @@ Also provided are member functions equivalent to
.B yy_switch_to_buffer(), .B yy_switch_to_buffer(),
.B yy_create_buffer() .B yy_create_buffer()
(though the first argument is an (though the first argument is an
.B istream* .B std::istream*
object pointer and not a object pointer and not a
.B FILE*), .B FILE*),
.B yy_flush_buffer(), .B yy_flush_buffer(),
@ -3402,7 +3402,7 @@ object pointer and not a
and and
.B yyrestart() .B yyrestart()
(again, the first argument is a (again, the first argument is a
.B istream* .B std::istream*
object pointer). object pointer).
.PP .PP
The second class defined in The second class defined in
@ -3414,7 +3414,7 @@ which is derived from
It defines the following additional member functions: It defines the following additional member functions:
.TP .TP
.B .B
yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ) yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 )
constructs a constructs a
.B yyFlexLexer .B yyFlexLexer
object using the given streams for input and output. object using the given streams for input and output.
@ -3455,9 +3455,9 @@ that calls
if called). if called).
.TP .TP
.B .B
virtual void switch_streams(istream* new_in = 0, virtual void switch_streams(std::istream* new_in = 0,
.B .B
ostream* new_out = 0) std::ostream* new_out = 0)
reassigns reassigns
.B yyin .B yyin
to to
@ -3472,7 +3472,7 @@ to
is reassigned. is reassigned.
.TP .TP
.B .B
int yylex( istream* new_in, ostream* new_out = 0 ) int yylex( std::istream* new_in, std::ostream* new_out = 0 )
first switches the input streams via first switches the input streams via
.B switch_streams( new_in, new_out ) .B switch_streams( new_in, new_out )
and then returns the value of and then returns the value of

View File

@ -1,7 +1,7 @@
/* A lexical scanner generated by flex */ /* A lexical scanner generated by flex */
/* Scanner skeleton version: /* Scanner skeleton version:
* $NetBSD: flex.skl,v 1.17 2003/11/18 17:02:27 christos Exp $ * $NetBSD: flex.skl,v 1.18 2003/11/18 21:37:39 christos Exp $
*/ */
#define FLEX_SCANNER #define FLEX_SCANNER
@ -25,7 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
%+ %+
class std::istream; #include <iostream>
%* %*
#include <unistd.h> #include <unistd.h>
@ -480,14 +480,14 @@ YY_DECL
%- %-
yyin = stdin; yyin = stdin;
%+ %+
yyin = &cin; yyin = &std::cin;
%* %*
if ( ! yyout ) if ( ! yyout )
%- %-
yyout = stdout; yyout = stdout;
%+ %+
yyout = &cout; yyout = &std::cout;
%* %*
if ( ! yy_current_buffer ) if ( ! yy_current_buffer )
@ -1446,7 +1446,7 @@ char msg[];
void yyFlexLexer::LexerError( yyconst char msg[] ) void yyFlexLexer::LexerError( yyconst char msg[] )
{ {
cerr << msg << '\n'; std::cerr << msg << std::endl;
exit( YY_EXIT_FAILURE ); exit( YY_EXIT_FAILURE );
} }
%* %*

View File

@ -26,7 +26,7 @@
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
/* $NetBSD: gen.c,v 1.16 2003/07/14 11:36:48 itojun Exp $ */ /* $NetBSD: gen.c,v 1.17 2003/11/18 21:37:39 christos Exp $ */
#include "flexdef.h" #include "flexdef.h"
@ -1436,7 +1436,7 @@ void make_tables()
indent_puts( "if ( yy_act == 0 )" ); indent_puts( "if ( yy_act == 0 )" );
indent_up(); indent_up();
indent_puts( C_plus_plus ? indent_puts( C_plus_plus ?
"cerr << \"--scanner backing up\\n\";" : "std::cerr << \"--scanner backing up\" << std:endl;" :
"fprintf( stderr, \"--scanner backing up\\n\" );" ); "fprintf( stderr, \"--scanner backing up\\n\" );" );
indent_down(); indent_down();
@ -1447,9 +1447,9 @@ void make_tables()
if ( C_plus_plus ) if ( C_plus_plus )
{ {
indent_puts( indent_puts(
"cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" ); "std::cerr << \"--accepting rule at line \" << yy_rule_linenum[yy_act] <<" );
indent_puts( indent_puts(
" \"(\\\"\" << yytext << \"\\\")\\n\";" ); " \"(\\\"\" << yytext << \"\\\")\" << std::endl;" );
} }
else else
{ {
@ -1469,7 +1469,7 @@ void make_tables()
if ( C_plus_plus ) if ( C_plus_plus )
{ {
indent_puts( indent_puts(
"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); "std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\" << std::endl;" );
} }
else else
{ {
@ -1485,7 +1485,7 @@ void make_tables()
indent_up(); indent_up();
indent_puts( C_plus_plus ? indent_puts( C_plus_plus ?
"cerr << \"--(end of buffer or a NUL)\\n\";" : "std::cerr << \"--(end of buffer or a NUL)\" << std::endl;" :
"fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" );
indent_down(); indent_down();
@ -1497,7 +1497,7 @@ void make_tables()
if ( C_plus_plus ) if ( C_plus_plus )
{ {
indent_puts( indent_puts(
"cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); "std::cerr << \"--EOF (start condition \" << YY_START << \")\" << std::endl;" );
} }
else else
{ {