if (!strncmp(keywd, "ISO-10303-21",strlen(keywd)))
{
exchange_file = 1;
SetFileType(VERSION_CURRENT);
}
else if (!strncmp(keywd, "STEP",strlen(keywd)))
{
_error.AppendToUserMsg("Reading Old Version of exchange file.\n");
_error.GreaterSeverity(SEVERITY_USERMSG);
exchange_file = 1;
SetFileType(VERSION_OLD);
}
else if (!strncmp(keywd, "STEP_WORKING_SESSION",strlen(keywd)))
{
exchange_file = 0;
if (_fileType != WORKING_SESSION)
{
_error.AppendToUserMsg("Warning: Reading in file as Working Session file.\n");
_error.GreaterSeverity(SEVERITY_WARNING);
}
SetFileType(WORKING_SESSION);
}
else
{
sprintf(errbuf,"Faulty input at beginning of file. \"ISO-10303-21;\" or \"STEP;\" or \"STEP_WORKING_SESSION;\" expected. File not read: %s\n",FileName());
_error.AppendToUserMsg(errbuf);
_error.GreaterSeverity(SEVERITY_INPUT_ERROR);
return SEVERITY_INPUT_ERROR;
}
cout << "Reading Data from " << FileName () << "...\n";
// Read header
rval = ReadHeader(*in);
cout << "\nHEADER read:";
if (rval < SEVERITY_WARNING)
{
sprintf(errbuf,"Error: non-recoverable error in reading header section. There were %d errors encountered. Rest of file is ignored.\n",_errorCount);
_error.AppendToUserMsg(errbuf);
return rval;
}
else if (rval != SEVERITY_NULL) {
sprintf(errbuf, " %d ERRORS\t %d WARNINGS\n\n",
_errorCount, _warningCount);
cout << errbuf;
}
else cout << endl;
if (!FindDataSection (*in))
{
_error.AppendToUserMsg("Error: Unable to find DATA section delimiter. Data section not read. Rest of file ignored.\n");
if ((sev < SEVERITY_MAX) || (sev > SEVERITY_NULL))
{
//ERROR: something wrong with ErrorDescriptor
//_error.AppendToDetailMsg("Error: in AppendEntityErrorMsg(ErrorDesriptor& e). Incomplete ErrorDescriptor, unable to report error message in STEPentity.\n");
_error.GreaterSeverity(SEVERITY_WARNING);
return SEVERITY_BUG;
}
switch (sev)
{
case SEVERITY_NULL:
return SEVERITY_NULL;
default:
{
// cerr << e->UserMsg();
cerr << e->DetailMsg();
e->ClearErrorMsg();
if (sev < SEVERITY_USERMSG) { ++_errorCount; }
if (sev < SEVERITY_WARNING) { sev = SEVERITY_WARNING; }