X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FTianoTools%2FPccts%2Fh%2FBufFileInput.cpp;fp=Tools%2FSource%2FTianoTools%2FPccts%2Fh%2FBufFileInput.cpp;h=0000000000000000000000000000000000000000;hp=99d08a42a49bc8659e746c47664e5ec962691823;hb=feccee87a78e68d575dbdf44b34ca0cb5a21ea8d;hpb=214b0d1914b48d651b25e58f321ddb77a46903b8 diff --git a/Tools/Source/TianoTools/Pccts/h/BufFileInput.cpp b/Tools/Source/TianoTools/Pccts/h/BufFileInput.cpp deleted file mode 100644 index 99d08a42a4..0000000000 --- a/Tools/Source/TianoTools/Pccts/h/BufFileInput.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// FILE: BufFileInput.cpp -// AUTHOR: Alexey Demakov (AVD) demakov@kazbek.ispras.ru -// CREATION: 26-JAN-1998 -// DESCRIPTION: File Input Stream with lookahead for Scanner. -// See file BufFileInput.h for details - -// Change History: -// -// 22-Jun-1998 assert.h -> PCCTS_ASSERT_H -// string.h -> PCCTS_STRING_H -// -// 28-May-1998 Add virtual destructor to release buffer. -// -// Add dummy definition for ANTLRTokenType -// to allow compilation without knowing -// token type codes. -// -// Manfred Kogler (km@cast.uni-linz.ac.at) -// (1.33MR14) -// -// 20-Jul-1998 MR14a - Reorder initialization list for ctor. -// - -enum ANTLRTokenType {TER_HATES_CPP=0, SO_DO_OTHERS=9999 }; - -#include "pcctscfg.h" -#include "pccts_assert.h" -#include "pccts_string.h" - -PCCTS_NAMESPACE_STD - -#include "BufFileInput.h" - -BufFileInput::BufFileInput( FILE *f, int buf_size ) -: input( f ), - buf( new int[buf_size] ), - size( buf_size ), - start( 0 ), - len( 0 ) -{ -} - -BufFileInput::~BufFileInput() -{ - delete [] buf; -} - -int BufFileInput::nextChar( void ) -{ - if( len > 0 ) - { - // get char from buffer - int c = buf[start]; - - if( c != EOF ) - { - start++; start %= size; - len--; - } - return c; - } else { - // get char from file - int c = getc( input ); - - if( c == EOF ) - { - // if EOF - put it in the buffer as indicator - buf[start] = EOF; - len++; - } - return c; - } -} - -int BufFileInput::lookahead( char* s ) -{ - int l = strlen( s ); - - assert( 0 < l && l <= size ); - - while( len < l ) - { - int c = getc( input ); - - buf[ (start+len) % size ] = c; - - len++; - - if( c == EOF ) return 0; - } - - for( int i = 0; i < l; i++ ) - { - if( s[i] != buf[ (start+i) % size ] ) return 0; - } - return 1; -} - -// End of file BufFileInput.cpp -