Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/lex More g++-3 fixes:
details: https://anonhg.NetBSD.org/src/rev/9887d3e72ee3
branches: trunk
changeset: 555481:9887d3e72ee3
user: christos <christos%NetBSD.org@localhost>
date: Tue Nov 18 21:37:39 2003 +0000
description:
More g++-3 fixes:
- std:c{in,out,err}
- include <iostream>
- use std::endl instead of \n
diffstat:
usr.bin/lex/FlexLexer.h | 28 ++++++++++++++--------------
usr.bin/lex/NEWS | 8 ++++----
usr.bin/lex/flex.1 | 14 +++++++-------
usr.bin/lex/flex.skl | 10 +++++-----
usr.bin/lex/gen.c | 14 +++++++-------
5 files changed, 37 insertions(+), 37 deletions(-)
diffs (283 lines):
diff -r 75bd58d89fe9 -r 9887d3e72ee3 usr.bin/lex/FlexLexer.h
--- a/usr.bin/lex/FlexLexer.h Tue Nov 18 21:21:58 2003 +0000
+++ b/usr.bin/lex/FlexLexer.h Tue Nov 18 21:37:39 2003 +0000
@@ -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
// by flex
@@ -43,7 +43,7 @@
#ifndef __FLEX_LEXER_H
// Never included before - need to define base class.
#define __FLEX_LEXER_H
-#include <iostream.h>
+#include <iostream>
extern "C++" {
@@ -60,14 +60,14 @@
virtual void
yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
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 yyrestart( istream* s ) = 0;
+ virtual void yyrestart( std::istream* s ) = 0;
virtual int yylex() = 0;
// 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 );
return yylex();
@@ -75,8 +75,8 @@
// Switch to new input/output streams. A nil stream pointer
// indicates "keep the current one".
- virtual void switch_streams( istream* new_in = 0,
- ostream* new_out = 0 ) = 0;
+ virtual void switch_streams( std::istream* new_in = 0,
+ std::ostream* new_out = 0 ) = 0;
int lineno() const { return yylineno; }
@@ -103,17 +103,17 @@
public:
// arg_yyin and arg_yyout default to the cin and cout, but we
// 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();
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 yyrestart( istream* s );
+ void yyrestart( std::istream* s );
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:
virtual int LexerInput( char* buf, int max_size );
@@ -124,7 +124,7 @@
int yyinput();
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 );
int yy_start_stack_ptr;
@@ -139,8 +139,8 @@
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
- istream* yyin; // input source for default LexerInput
- ostream* yyout; // output sink for default LexerOutput
+ std::istream* yyin; // input source for default LexerInput
+ std::ostream* yyout; // output sink for default LexerOutput
struct yy_buffer_state* yy_current_buffer;
diff -r 75bd58d89fe9 -r 9887d3e72ee3 usr.bin/lex/NEWS
--- a/usr.bin/lex/NEWS Tue Nov 18 21:21:58 2003 +0000
+++ b/usr.bin/lex/NEWS Tue Nov 18 21:37:39 2003 +0000
@@ -65,7 +65,7 @@
- The .texi and .info files in MISC/texinfo/ have been updated,
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
it from FlexLexer::yylex().
@@ -371,14 +371,14 @@
- The FlexLexer class includes two new public member functions:
- virtual void switch_streams( istream* new_in = 0,
- ostream* new_out = 0 )
+ virtual void switch_streams( std::istream* new_in = 0,
+ std::ostream* new_out = 0 )
reassigns yyin to new_in (if non-nil) and yyout to new_out
(ditto), deleting the previous input buffer if yyin is
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
of calling yylex().
diff -r 75bd58d89fe9 -r 9887d3e72ee3 usr.bin/lex/flex.1
--- a/usr.bin/lex/flex.1 Tue Nov 18 21:21:58 2003 +0000
+++ b/usr.bin/lex/flex.1 Tue Nov 18 21:37:39 2003 +0000
@@ -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"
.SH NAME
@@ -3394,7 +3394,7 @@
.B yy_switch_to_buffer(),
.B yy_create_buffer()
(though the first argument is an
-.B istream*
+.B std::istream*
object pointer and not a
.B FILE*),
.B yy_flush_buffer(),
@@ -3402,7 +3402,7 @@
and
.B yyrestart()
(again, the first argument is a
-.B istream*
+.B std::istream*
object pointer).
.PP
The second class defined in
@@ -3414,7 +3414,7 @@
It defines the following additional member functions:
.TP
.B
-yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )
+yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 )
constructs a
.B yyFlexLexer
object using the given streams for input and output.
@@ -3455,9 +3455,9 @@
if called).
.TP
.B
-virtual void switch_streams(istream* new_in = 0,
+virtual void switch_streams(std::istream* new_in = 0,
.B
-ostream* new_out = 0)
+std::ostream* new_out = 0)
reassigns
.B yyin
to
@@ -3472,7 +3472,7 @@
is reassigned.
.TP
.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
.B switch_streams( new_in, new_out )
and then returns the value of
diff -r 75bd58d89fe9 -r 9887d3e72ee3 usr.bin/lex/flex.skl
--- a/usr.bin/lex/flex.skl Tue Nov 18 21:21:58 2003 +0000
+++ b/usr.bin/lex/flex.skl Tue Nov 18 21:37:39 2003 +0000
@@ -1,7 +1,7 @@
/* A lexical scanner generated by flex */
/* 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
@@ -25,7 +25,7 @@
#include <stdlib.h>
%+
-class std::istream;
+#include <iostream>
%*
#include <unistd.h>
@@ -480,14 +480,14 @@
%-
yyin = stdin;
%+
- yyin = &cin;
+ yyin = &std::cin;
%*
if ( ! yyout )
%-
yyout = stdout;
%+
- yyout = &cout;
+ yyout = &std::cout;
%*
if ( ! yy_current_buffer )
@@ -1446,7 +1446,7 @@
void yyFlexLexer::LexerError( yyconst char msg[] )
{
- cerr << msg << '\n';
+ std::cerr << msg << std::endl;
exit( YY_EXIT_FAILURE );
}
%*
diff -r 75bd58d89fe9 -r 9887d3e72ee3 usr.bin/lex/gen.c
--- a/usr.bin/lex/gen.c Tue Nov 18 21:21:58 2003 +0000
+++ b/usr.bin/lex/gen.c Tue Nov 18 21:37:39 2003 +0000
@@ -26,7 +26,7 @@
* 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"
@@ -1436,7 +1436,7 @@
indent_puts( "if ( yy_act == 0 )" );
indent_up();
indent_puts( C_plus_plus ?
- "cerr << \"--scanner backing up\\n\";" :
+ "std::cerr << \"--scanner backing up\" << std:endl;" :
"fprintf( stderr, \"--scanner backing up\\n\" );" );
indent_down();
@@ -1447,9 +1447,9 @@
if ( C_plus_plus )
{
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(
- " \"(\\\"\" << yytext << \"\\\")\\n\";" );
+ " \"(\\\"\" << yytext << \"\\\")\" << std::endl;" );
}
else
{
@@ -1469,7 +1469,7 @@
if ( C_plus_plus )
{
indent_puts(
-"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" );
+"std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\" << std::endl;" );
}
else
{
@@ -1485,7 +1485,7 @@
indent_up();
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\" );" );
indent_down();
@@ -1497,7 +1497,7 @@
if ( C_plus_plus )
{
indent_puts(
- "cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" );
+ "std::cerr << \"--EOF (start condition \" << YY_START << \")\" << std::endl;" );
}
else
{
Home |
Main Index |
Thread Index |
Old Index