diff options
-rw-r--r-- | usr.bin/lex/FlexLexer.h | 32 | ||||
-rw-r--r-- | usr.bin/lex/flex.1 | 12 | ||||
-rw-r--r-- | usr.bin/lex/flex.skl | 26 | ||||
-rw-r--r-- | usr.bin/lex/flexdef.h | 11 | ||||
-rw-r--r-- | usr.bin/lex/gen.c | 14 | ||||
-rw-r--r-- | usr.bin/lex/main.c | 6 |
6 files changed, 51 insertions, 50 deletions
diff --git a/usr.bin/lex/FlexLexer.h b/usr.bin/lex/FlexLexer.h index 2d2db0db479..3fd7f63c16c 100644 --- a/usr.bin/lex/FlexLexer.h +++ b/usr.bin/lex/FlexLexer.h @@ -1,6 +1,6 @@ -/* $OpenBSD: FlexLexer.h,v 1.5 2003/06/04 17:34:44 millert Exp $ */ +/* $OpenBSD: FlexLexer.h,v 1.6 2004/02/03 21:20:17 espie Exp $ */ -// $Header: /cvs/OpenBSD/src/usr.bin/lex/FlexLexer.h,v 1.5 2003/06/04 17:34:44 millert Exp $ +// $Header: /cvs/OpenBSD/src/usr.bin/lex/FlexLexer.h,v 1.6 2004/02/03 21:20:17 espie Exp $ // FlexLexer.h -- define interfaces for lexical analyzer classes generated // by flex @@ -50,10 +50,10 @@ #ifndef __FLEX_LEXER_H // Never included before - need to define base class. #define __FLEX_LEXER_H -#include <iostream.h> -extern "C++" { +#include <iostream> +extern "C++" { struct yy_buffer_state; typedef int yy_state_type; @@ -67,14 +67,14 @@ public: 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(); @@ -82,8 +82,8 @@ public: // 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; } @@ -110,17 +110,17 @@ class yyFlexLexer : public FlexLexer { 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 ); @@ -131,7 +131,7 @@ protected: 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; @@ -146,8 +146,8 @@ protected: 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 --git a/usr.bin/lex/flex.1 b/usr.bin/lex/flex.1 index 8b7580f8bc5..878762359b2 100644 --- a/usr.bin/lex/flex.1 +++ b/usr.bin/lex/flex.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: flex.1,v 1.17 2003/12/09 12:44:17 jmc Exp $ +.\" $OpenBSD: flex.1,v 1.18 2004/02/03 21:20:17 espie Exp $ .\" .\" Copyright (c) 1990 The Regents of the University of California. .\" All rights reserved. @@ -3498,7 +3498,7 @@ Also provided are member functions equivalent to .Fn yy_switch_to_buffer , .Fn yy_create_buffer (though the first argument is an -.Fa istream* +.Fa std::istream* object pointer and not a .Fa FILE* ) , .Fn yy_flush_buffer , @@ -3506,7 +3506,7 @@ object pointer and not a and .Fn yyrestart (again, the first argument is an -.Fa istream* +.Fa std::istream* object pointer). .Pp The second class defined in @@ -3517,7 +3517,7 @@ which is derived from .Fa FlexLexer . It defines the following additional member functions: .Bl -tag -width Ds -.It "yyFlexLexer(istream* arg_yyin = 0, ostream* arg_yyout = 0)" +.It "yyFlexLexer(std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0)" Constructs a .Fa yyFlexLexer object using the given streams for input and output. @@ -3557,7 +3557,7 @@ generates that calls .Dq yyFlexLexer::LexerError() if called). -.It "virtual void switch_streams(istream* new_in = 0, ostream* new_out = 0)" +.It "virtual void switch_streams(std::istream* new_in = 0, std::ostream* new_out = 0)" Reassigns .Fa yyin to @@ -3571,7 +3571,7 @@ to deleting the previous input buffer if .Fa yyin is reassigned. -.It int yylex(istream* new_in, ostream* new_out = 0) +.It int yylex(std::istream* new_in, std::ostream* new_out = 0) First switches the input streams via .Dq switch_streams(new_in, new_out) and then returns the value of diff --git a/usr.bin/lex/flex.skl b/usr.bin/lex/flex.skl index 126db4f55ee..46dd1e19c39 100644 --- a/usr.bin/lex/flex.skl +++ b/usr.bin/lex/flex.skl @@ -1,9 +1,9 @@ -/* $OpenBSD: flex.skl,v 1.6 2001/01/05 18:26:23 millert Exp $ */ +/* $OpenBSD: flex.skl,v 1.7 2004/02/03 21:20:17 espie Exp $ */ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/OpenBSD/src/usr.bin/lex/flex.skl,v 1.6 2001/01/05 18:26:23 millert Exp $ + * $Header: /cvs/OpenBSD/src/usr.bin/lex/flex.skl,v 1.7 2004/02/03 21:20:17 espie Exp $ */ #define FLEX_SCANNER @@ -28,7 +28,7 @@ #include <stdlib.h> %+ -class istream; +#include <iosfwd> %* #include <unistd.h> @@ -156,7 +156,7 @@ struct yy_buffer_state %- FILE *yy_input_file; %+ - istream* yy_input_file; + std::istream* yy_input_file; %* char *yy_ch_buf; /* input buffer */ @@ -472,14 +472,14 @@ YY_DECL %- yyin = stdin; %+ - yyin = &cin; + yyin = &std::cin; %* if ( ! yyout ) %- yyout = stdout; %+ - yyout = &cout; + yyout = &std::cout; %* if ( ! yy_current_buffer ) @@ -649,7 +649,7 @@ do_action: /* This label is used only to access EOF actions. */ } /* end of yylex */ %+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) +yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout ) { yyin = arg_yyin; yyout = arg_yyout; @@ -684,7 +684,7 @@ yyFlexLexer::~yyFlexLexer() yy_delete_buffer( yy_current_buffer ); } -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) +void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out ) { if ( new_in ) { @@ -1058,7 +1058,7 @@ void yyrestart( input_file ) FILE *input_file; #endif %+ -void yyFlexLexer::yyrestart( istream* input_file ) +void yyFlexLexer::yyrestart( std::istream* input_file ) %* { if ( ! yy_current_buffer ) @@ -1129,7 +1129,7 @@ FILE *file; int size; #endif %+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) +YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) %* { YY_BUFFER_STATE b; @@ -1182,7 +1182,7 @@ void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) %- #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); +#include <unistd.h> #endif #endif @@ -1196,7 +1196,7 @@ FILE *file; %+ extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) +void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) %* { @@ -1443,7 +1443,7 @@ char msg[]; void yyFlexLexer::LexerError( yyconst char msg[] ) { - cerr << msg << '\n'; + std::cerr << msg << '\n'; exit( YY_EXIT_FAILURE ); } %* diff --git a/usr.bin/lex/flexdef.h b/usr.bin/lex/flexdef.h index 39d04033478..7828d1af629 100644 --- a/usr.bin/lex/flexdef.h +++ b/usr.bin/lex/flexdef.h @@ -1,4 +1,4 @@ -/* $OpenBSD: flexdef.h,v 1.6 2003/06/04 17:34:44 millert Exp $ */ +/* $OpenBSD: flexdef.h,v 1.7 2004/02/03 21:20:17 espie Exp $ */ /* flexdef - definitions file for flex */ @@ -33,7 +33,7 @@ * PURPOSE. */ -/* @(#) $Header: /cvs/OpenBSD/src/usr.bin/lex/flexdef.h,v 1.6 2003/06/04 17:34:44 millert Exp $ (LBL) */ +/* @(#) $Header: /cvs/OpenBSD/src/usr.bin/lex/flexdef.h,v 1.7 2004/02/03 21:20:17 espie Exp $ (LBL) */ #include <stdio.h> #include <ctype.h> @@ -64,14 +64,15 @@ #include <sys/types.h> #endif +#ifdef STDC_HEADERS +#include <stdlib.h> +#else #ifdef HAVE_MALLOC_H #include <malloc.h> #endif - -#ifdef STDC_HEADERS -#include <stdlib.h> #endif + /* As an aid for the internationalization patch to flex, which * is maintained outside this distribution for copyright reasons. */ diff --git a/usr.bin/lex/gen.c b/usr.bin/lex/gen.c index 19373f84cfa..3f1f86dfdd4 100644 --- a/usr.bin/lex/gen.c +++ b/usr.bin/lex/gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gen.c,v 1.10 2003/06/04 17:34:44 millert Exp $ */ +/* $OpenBSD: gen.c,v 1.11 2004/02/03 21:20:17 espie Exp $ */ /* gen - actual generation (writing) of flex scanners */ @@ -33,7 +33,7 @@ * PURPOSE. */ -/* $Header: /cvs/OpenBSD/src/usr.bin/lex/gen.c,v 1.10 2003/06/04 17:34:44 millert Exp $ */ +/* $Header: /cvs/OpenBSD/src/usr.bin/lex/gen.c,v 1.11 2004/02/03 21:20:17 espie Exp $ */ #include "flexdef.h" @@ -1446,7 +1446,7 @@ void make_tables() indent_puts( "if ( yy_act == 0 )" ); indent_up(); indent_puts( C_plus_plus ? - "cerr << \"--scanner backing up\\n\";" : + "std::cerr << \"--scanner backing up\\n\";" : "fprintf( stderr, \"--scanner backing up\\n\" );" ); indent_down(); @@ -1457,7 +1457,7 @@ void make_tables() 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\";" ); } @@ -1479,7 +1479,7 @@ void make_tables() if ( C_plus_plus ) { indent_puts( -"cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); +"std::cerr << \"--accepting default rule (\\\"\" << yytext << \"\\\")\\n\";" ); } else { @@ -1495,7 +1495,7 @@ void make_tables() indent_up(); indent_puts( C_plus_plus ? - "cerr << \"--(end of buffer or a NUL)\\n\";" : + "std::cerr << \"--(end of buffer or a NUL)\\n\";" : "fprintf( stderr, \"--(end of buffer or a NUL)\\n\" );" ); indent_down(); @@ -1507,7 +1507,7 @@ void make_tables() if ( C_plus_plus ) { indent_puts( - "cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); + "std::cerr << \"--EOF (start condition \" << YY_START << \")\\n\";" ); } else { diff --git a/usr.bin/lex/main.c b/usr.bin/lex/main.c index 814b77b1593..111ba6963c3 100644 --- a/usr.bin/lex/main.c +++ b/usr.bin/lex/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.9 2003/06/04 17:34:44 millert Exp $ */ +/* $OpenBSD: main.c,v 1.10 2004/02/03 21:20:17 espie Exp $ */ /* flex - tool to generate fast lexical analyzers */ @@ -39,7 +39,7 @@ char copyright[] = All rights reserved.\n"; #endif /* not lint */ -/* $Header: /cvs/OpenBSD/src/usr.bin/lex/main.c,v 1.9 2003/06/04 17:34:44 millert Exp $ */ +/* $Header: /cvs/OpenBSD/src/usr.bin/lex/main.c,v 1.10 2004/02/03 21:20:17 espie Exp $ */ #include "flexdef.h" @@ -1013,7 +1013,7 @@ _( "Variable trailing context rules entail a large performance penalty\n" ) ); if ( C_plus_plus ) { - outn( "\n#include <g++/FlexLexer.h>" ); + outn( "\n#include <FlexLexer.h>" ); if ( yyclass ) { |