Пример #1
0
void ResourceComp()
{
	int Line = 0;
	char *FPtr = FilePtr;				// Preserve file pointer

	EndComp = 0;

	ResetErrorCount();

	SET_ERROR_RETURN();

	while(1)
	{
		SkipWhiteSpace();

		Line++;

		if (EndComp)
			break;

		if (*FilePtr == 0)
			break;

		if (*FilePtr == '{' || *FilePtr == '}')
		{
			FilePtr++;
			continue;
		}

		if (*FilePtr == 0)
			break;

		if (ResourceCommands())
		{
			SkipWhiteSpace();
			continue;
		}
	}

	FilePtr = FPtr;

	ExitErrorCount();
	SetErrorReset();
}
Пример #2
0
void HeaderReader(char *filemem)
{
	char *FPtr = FilePtr;				// Preserve file pointer
	char *FTop = FileTop;				// Preserve file pointer

	SetError_Mode(ErrorMode_Basic);
	
	FileTop = FilePtr = filemem;

	hEndComp = 0;

	ResetErrorCount();
	
	SET_ERROR_RETURN();

	while(1)
	{	
		if (hEndComp)
			break;

		if (*FilePtr == 0)
			break;
	
		if (*FilePtr == 0)
			break;
	
		if (HeaderCommands())
			continue;
	}

	FilePtr = FPtr;
	FileTop = FTop;

	ExitErrorCount();
	SetErrorReset();

	SetError_Mode(ErrorMode_Full);
}
Пример #3
0
Bool_T Postsolver::ReadActions( FILE *fp )
{
	//--------------------------------------------------------------------------
	//	Initialize the object as an empty object. Set up the read data buffer,
	//	work variables etc. Set up the lexical analysis module.
	//
	FreeMemory();

	Lexer::SetInputStream( "action file", fp );
	ResetErrorCount();
	MaxErrCount( 20 );

	Int_T ReducedCols = 0;

	//--------------------------------------------------------------------------
	//	Read the first line.
	//
	if( !Lexer::GetKeyword( "PRESOLVER" ) || !Lexer::GetSpace() ||
		!Lexer::GetKeyword( "REPORT" ) )
	{
		Error( "Title line incorrect or missing." );
		goto error;
	}

	if( !Lexer::GetNewline() )
	{
		Error( "Extra input after the title line ignored." );
		Lexer::GetNewline( True );
	}

	//--------------------------------------------------------------------------
	//	Read the ROWS section and create the row exclusion array. Then read the
	//	COLUMNS section and do the same.
	//
	if( /* !GetRowsSection() || */ !GetColumnsSection() )
		goto error;

	assert( n >= 0 );

	{ for( Int_T j = 0; j < n; j++ ) if( ExcludeCols[j] ) ReducedCols++; }

	//--------------------------------------------------------------------------
	//	Read the actions in loop. Then read the "ENDATA" and finish processing.
	//
	while( GetAction( ReducedCols ) || GetAdjustment() )
		;

	if( ReducedCols > 0 )
	{
		Error( "Some postsolve actions missing." );
		goto error;
	}

	if( !Lexer::GetKeyword( "ENDATA" ) )
	{
		Error( "ENDATA expected." );
		goto error;
	}

	if( ErrorCount() > 0 )
		goto error;

	return True;

error:
	FreeMemory();
	return False;
}