From e7303e0b666c6f19b7e3417710217ee4ec95460e Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Wed, 10 Feb 2016 21:53:20 -0800 Subject: [PATCH] Eliminated "handled" field in Parser::Action This field was used during development to measure the coverage of the ANSI terminal parser against typical terminal input sequences. The "handled" field has not been read by any code since commit 1ee54cd7 (February 2011). Eliminating the field by popular request (closes #723). --- src/terminal/parseraction.cc | 4 +--- src/terminal/parseraction.h | 3 +-- src/terminal/terminal.cc | 3 --- src/terminal/terminaldispatcher.cc | 10 ++-------- src/terminal/terminalfunctions.cc | 4 +--- src/terminal/terminaluserinput.cc | 2 -- 6 files changed, 5 insertions(+), 21 deletions(-) diff --git a/src/terminal/parseraction.cc b/src/terminal/parseraction.cc index 29c260b..022a981 100644 --- a/src/terminal/parseraction.cc +++ b/src/terminal/parseraction.cc @@ -110,12 +110,10 @@ void UserByte::act_on_terminal( Terminal::Emulator *emu ) const void Resize::act_on_terminal( Terminal::Emulator *emu ) const { emu->resize( width, height ); - handled = true; } bool Action::operator==( const Action &other ) const { return ( char_present == other.char_present ) - && ( ch == other.ch ) - && ( handled == other.handled ); + && ( ch == other.ch ); } diff --git a/src/terminal/parseraction.h b/src/terminal/parseraction.h index 3032d63..78798c4 100644 --- a/src/terminal/parseraction.h +++ b/src/terminal/parseraction.h @@ -46,7 +46,6 @@ namespace Parser { public: wchar_t ch; bool char_present; - mutable bool handled; std::string str( void ); @@ -56,7 +55,7 @@ namespace Parser { virtual bool ignore() const { return false; } - Action() : ch( -1 ), char_present( false ), handled( false ) {}; + Action() : ch( -1 ), char_present( false ) {}; virtual ~Action() {}; virtual bool operator==( const Action &other ) const; diff --git a/src/terminal/terminal.cc b/src/terminal/terminal.cc index 443d9c6..971b578 100644 --- a/src/terminal/terminal.cc +++ b/src/terminal/terminal.cc @@ -118,13 +118,11 @@ void Emulator::print( const Parser::Print *act ) fb.ds.move_col( chwidth, true, true ); - act->handled = true; break; case 0: /* combining character */ { Cell *combining_cell = fb.get_combining_cell(); /* can be null if we were resized */ if ( combining_cell == NULL ) { /* character is now offscreen */ - act->handled = true; break; } @@ -141,7 +139,6 @@ void Emulator::print( const Parser::Print *act ) if ( !combining_cell->full() ) { combining_cell->append( ch ); } - act->handled = true; } break; case -1: /* unprintable character */ diff --git a/src/terminal/terminaldispatcher.cc b/src/terminal/terminaldispatcher.cc index f762aec..2c901a6 100644 --- a/src/terminal/terminaldispatcher.cc +++ b/src/terminal/terminaldispatcher.cc @@ -54,7 +54,6 @@ void Dispatcher::newparamchar( const Parser::Param *act ) if ( params.length() < 100 ) { /* enough for 16 five-char params plus 15 semicolons */ params.push_back( act->ch ); - act->handled = true; } parsed = false; } @@ -65,16 +64,14 @@ void Dispatcher::collect( const Parser::Collect *act ) if ( ( dispatch_chars.length() < 8 ) /* never should need more than 2 */ && ( act->ch <= 255 ) ) { /* ignore non-8-bit */ dispatch_chars.push_back( act->ch ); - act->handled = true; } } -void Dispatcher::clear( const Parser::Clear *act ) +void Dispatcher::clear( const Parser::Clear *act __attribute((unused)) ) { params.clear(); dispatch_chars.clear(); parsed = false; - act->handled = true; } void Dispatcher::parse_params( void ) @@ -228,7 +225,6 @@ void Dispatcher::dispatch( Function_Type type, const Parser::Action *act, Frameb fb->ds.next_print_will_wrap = false; return; } else { - act->handled = true; if ( i->second.clears_wrap_state ) { fb->ds.next_print_will_wrap = false; } @@ -241,14 +237,12 @@ void Dispatcher::OSC_put( const Parser::OSC_Put *act ) assert( act->char_present ); if ( OSC_string.size() < 256 ) { /* should be a long enough window title */ OSC_string.push_back( act->ch ); - act->handled = true; } } -void Dispatcher::OSC_start( const Parser::OSC_Start *act ) +void Dispatcher::OSC_start( const Parser::OSC_Start *act __attribute((unused)) ) { OSC_string.clear(); - act->handled = true; } bool Dispatcher::operator==( const Dispatcher &x ) const diff --git a/src/terminal/terminalfunctions.cc b/src/terminal/terminalfunctions.cc index 11cb2bc..22bf4f0 100644 --- a/src/terminal/terminalfunctions.cc +++ b/src/terminal/terminalfunctions.cc @@ -557,7 +557,7 @@ static void CSI_DECSTR( Framebuffer *fb, Dispatcher *dispatch __attribute((unuse static Function func_CSI_DECSTR( CSI, "!p", CSI_DECSTR ); /* xterm uses an Operating System Command to set the window title */ -void Dispatcher::OSC_dispatch( const Parser::OSC_End *act, Framebuffer *fb ) +void Dispatcher::OSC_dispatch( const Parser::OSC_End *act __attribute((unused)), Framebuffer *fb ) { if ( OSC_string.size() >= 1 ) { long cmd_num = -1; @@ -581,8 +581,6 @@ void Dispatcher::OSC_dispatch( const Parser::OSC_End *act, Framebuffer *fb ) Terminal::Framebuffer::title_type newtitle( OSC_string.begin() + offset, OSC_string.end() ); if ( set_icon ) { fb->set_icon_name( newtitle ); } if ( set_title ) { fb->set_window_title( newtitle ); } - - act->handled = true; } } } diff --git a/src/terminal/terminaluserinput.cc b/src/terminal/terminaluserinput.cc index 6aca086..5973549 100644 --- a/src/terminal/terminaluserinput.cc +++ b/src/terminal/terminaluserinput.cc @@ -39,8 +39,6 @@ using namespace std; string UserInput::input( const Parser::UserByte *act, bool application_mode_cursor_keys ) { - act->handled = true; - /* The user will always be in application mode. If stm is not in application mode, convert user's cursor control function to an ANSI cursor control sequence */