Compare commits

...

2 commits

Author SHA1 Message Date
Mark Pictor
81b798e34a p21read shouldn't quit for errors 2012-04-14 21:08:59 -04:00
Mark Pictor
5aad260470 If an instance has too few attributes and the missing attributes are strings, add them 2012-04-14 21:08:59 -04:00
2 changed files with 21 additions and 9 deletions

View file

@ -550,11 +550,23 @@ Severity SDAI_Application_instance::STEPread( int id, int idIncr,
while( i < n - 1 ) { while( i < n - 1 ) {
i++; // check if following attributes are redefined i++; // check if following attributes are redefined
if( !( attributes[i].aDesc->AttrType() == AttrType_Redefining ) ) { if( !( attributes[i].aDesc->AttrType() == AttrType_Redefining ) ) {
PrependEntityErrMsg();
_error.AppendToDetailMsg( "Missing attribute value[s].\n" ); //The attribute is missing. If it's a string, use ''.
// recoverable error if( ( !strict ) && ( attributes[i].aDesc->NonRefType() == STRING_TYPE ) ) {
_error.GreaterSeverity( SEVERITY_WARNING ); attributes[i].StrToVal("''", instance_set, idIncr);
return _error.severity(); _error.AppendToDetailMsg("Missing required non-redefined attribute of type string added as null string.\n" );
_error.GreaterSeverity( SEVERITY_INCOMPLETE );
std::ostringstream oss;
oss << "/* Entity #" << id <<", attribute #" << i;
oss << ": a missing, required, non-redefined string; added as null string. */\n";
p21Comment.append( oss.str() );
} else {
PrependEntityErrMsg();
_error.AppendToDetailMsg( "Missing attribute value[s].\n" );
// recoverable error
_error.GreaterSeverity( SEVERITY_WARNING );
return _error.severity();
}
} }
i++; i++;
} }

View file

@ -152,8 +152,8 @@ int main( int argc, char * argv[] ) {
sfile.ReadExchangeFile( flnm ); sfile.ReadExchangeFile( flnm );
sfile.Error().PrintContents( cout ); sfile.Error().PrintContents( cout );
if ( sfile.Error().severity() <= SEVERITY_INCOMPLETE ) if ( sfile.Error().severity() < SEVERITY_INCOMPLETE )
exit(1); exit( EXIT_FAILURE );
checkSchemaName( registry, sfile, ignoreErr ); checkSchemaName( registry, sfile, ignoreErr );
@ -169,7 +169,7 @@ int main( int argc, char * argv[] ) {
sfile.Error().PrintContents( cout ); sfile.Error().PrintContents( cout );
cout << flnm << " written" << endl; cout << flnm << " written" << endl;
if( ( sfile.Error().severity() <= SEVERITY_INCOMPLETE ) || ( readSev <= SEVERITY_INCOMPLETE ) ) { //lower is worse if( sfile.Error().severity() < SEVERITY_INCOMPLETE ) { //lower is worse
exit( 1 ); exit( EXIT_FAILURE );
} }
} }