extern int RcIoPushInputFile( char * filename ) /*********************************************/ { int error; if( InStack.Current == InStack.Stack + MAX_INCLUDE_DEPTH - 1 ) { RcError( ERR_RCINCLUDE_TOO_DEEP, MAX_INCLUDE_DEPTH ); return( TRUE ); } SetPhysFileOffset( &(InStack) ); InStack.Current++; /* set up the logical file info */ RcIoSetLogicalFileInfo( 1, filename ); /* set up the physical file info */ error = OpenNewPhysicalFile( &(InStack.Current->Physical), filename ); if( error ) { InStack.Current--; } else { error = ReadBuffer( &(InStack) ); } return( error ); } /* RcIoPushInputFile */
static YYTOKENTYPE scanCPPDirective( ScanValue *value ) /******************************************************/ /* This function takes the correct action for the #line directive and returns */ /* the token following the preprocessor stuff. It uses Scan to do it's */ /* scanning. DON'T call this function from within Scan or the functions it */ /* calls unless you are very careful about recurtion. */ { YYTOKENTYPE token; int linenum; if( StopInvoked ) { RcFatalError( ERR_STOP_REQUESTED ); } /* get the "line" or "pragma" directive */ token = scanDFA( value ); if( token != Y_NAME ) { RcFatalError( ERR_INVALID_CPP ); } if( stricmp( value->string.string, "line" ) == 0 ) { RESFREE( value->string.string ); /* get the line number */ token = scanDFA( value ); if( token != Y_INTEGER ) { RcFatalError( ERR_INVALID_CPP_LINE ); } RESFREE( value->intinfo.str ); value->intinfo.str = NULL; linenum = value->intinfo.val; /* get the filename if there is one */ token = scanDFA( value ); if( token == Y_STRING ) { RcIoSetLogicalFileInfo( linenum, value->string.string ); if( AddDependency( value->string.string ) ) { ErrorHasOccured = true; } RESFREE( value->string.string ); token = scanDFA( value ); } else { RcIoSetLogicalFileInfo( linenum, NULL ); } } else if( stricmp( value->string.string, "pragma" ) == 0 ) { RESFREE( value->string.string ); token = Y_POUND_PRAGMA; } else if( stricmp( value->string.string, "error" ) == 0 ) { char buf[80]; unsigned i; i = 0; while( LookAhead != '\n' && LookAhead != EOF ) { buf[i] = LookAhead; i ++; GetNextChar(); } buf[i] = '\0'; RcFatalError( ERR_TEXT_FROM_CPP, buf ); } else { RcFatalError( ERR_INVALID_CPP ); } return( token ); } /* scanCPPDirective */