diff -r 634f476cb60f -r f1fc4aa6f0e3 stage1_2/stage1_2.cc --- a/stage1_2/stage1_2.cc Tue Nov 27 14:49:08 2012 +0000 +++ b/stage1_2/stage1_2.cc Tue Nov 27 15:49:05 2012 +0000 @@ -51,18 +51,6 @@ -/**************************************/ -/* The name of the file being parsed. */ -/**************************************/ -/* The name of the file currently being parsed... - * Note that flex accesses and updates this global variable - * apropriately whenever it comes across an (*#include *) - * directive... - * ... and bison will use it when producing error messages. - * Note that bison also sets this variable correctly to the first - * file being parsed. - */ -const char *current_filename = NULL; /******************************************************/ @@ -220,59 +208,7 @@ return strcat(strcat(strcpy(res, a), b), c); /* safe, actually */ } -/*************************/ -/* Tracking Functions... */ -/*************************/ - -extern tracking_t* current_tracking; - -/*-------------------------------------------------------------------- - * GetNextChar - * - * reads a character from input for flex - *------------------------------------------------------------------*/ -int GetNextChar(char *b, int maxBuffer) { - char *p; - - if ( current_tracking->eof ) - return 0; - - while ( current_tracking->currentChar >= current_tracking->lineLength ) { - current_tracking->currentChar = 0; - current_tracking->currentTokenStart = 1; - current_tracking->eof = false; - - p = fgets(current_tracking->buffer, MAX_BUFFER_LENGTH, current_tracking->in_file); - if ( p == NULL ) { - if ( ferror(current_tracking->in_file) ) - return 0; - current_tracking->eof = true; - return 0; - } - - current_tracking->lineNumber++; - current_tracking->lineLength = strlen(current_tracking->buffer); - } - - b[0] = current_tracking->buffer[current_tracking->currentChar]; - if (b[0] == ' ' || b[0] == '\t') - current_tracking->currentTokenStart++; - current_tracking->currentChar++; - - return b[0]==0?0:1; -} - -tracking_t* GetNewTracking(FILE* in_file) { - tracking_t* new_env = new tracking_t; - new_env->eof = 0; - new_env->lineNumber = 0; - new_env->currentChar = 0; - new_env->lineLength = 0; - new_env->currentTokenStart = 0; - new_env->buffer = (char*)malloc(MAX_BUFFER_LENGTH); - new_env->in_file = in_file; - return new_env; -} + /***********************************************************************/ /***********************************************************************/