Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8b10ae7c1 | ||
|
|
f28557c1b6 | ||
|
|
8814303357 | ||
|
|
206d83a4c2 | ||
|
|
1d539ac192 | ||
|
|
5cf8fc1a89 | ||
|
|
131fe6e7b4 |
+1
-1
@@ -48,7 +48,7 @@ endif (POLICY CMP0077)
|
||||
|
||||
# SC version
|
||||
set(SC_VERSION_MAJOR 0)
|
||||
set(SC_VERSION_MINOR 9)
|
||||
set(SC_VERSION_MINOR 8)
|
||||
set(SC_VERSION_PATCH 1)
|
||||
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH})
|
||||
|
||||
|
||||
@@ -289,14 +289,6 @@ class SC_LAZYFILE_EXPORT lazyInstMgr {
|
||||
return 0;
|
||||
}
|
||||
instancePosition pos = cv->at( 0 );
|
||||
//a data section indexes its instances from its own constructor and is
|
||||
//registered only afterwards, and only if it succeeded - so an instance
|
||||
//can name a section that was never registered. Same test sourceRecord()
|
||||
//already makes.
|
||||
if( pos.section >= _dataSections.size() || !_dataSections[pos.section] ) {
|
||||
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - instanceID " << id << " names data section " << pos.section << ", which failed to index." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
return _dataSections[pos.section]->getType( pos.begin );
|
||||
}
|
||||
std::cerr << "Error at " << __FILE__ << ":" << __LINE__ << " - instanceID " << id << " not found." << std::endl;
|
||||
|
||||
@@ -88,11 +88,6 @@ class SC_CORE_EXPORT STEPnode : public SingleLinkNode {
|
||||
protected:
|
||||
int _null;
|
||||
|
||||
/// nodes must start out null; several StrToVal/STEPread paths leave
|
||||
/// _null untouched on failure and would otherwise read uninitialised.
|
||||
STEPnode() : _null( 1 ) {
|
||||
}
|
||||
|
||||
public:
|
||||
int is_null() {
|
||||
return _null;
|
||||
|
||||
@@ -27,16 +27,7 @@ if(BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
|
||||
if(BUILD_STATIC_LIBS)
|
||||
# Spell the static dependency names out rather than composing them with a
|
||||
# generator expression. Since 0b950dd1 SC_ADDLIB publishes LINK_LIBRARIES as
|
||||
# PUBLIC, so anything given here lands in INTERFACE_LINK_LIBRARIES and is
|
||||
# re-evaluated in each consumer - where a nested $<JOIN:...> comes back out
|
||||
# mangled and reaches the linker verbatim.
|
||||
set(_static_libdeps)
|
||||
foreach(_libdep ${_libdeps})
|
||||
list(APPEND _static_libdeps ${_libdep}-static)
|
||||
endforeach()
|
||||
SC_ADDLIB(stepdai-static STATIC SOURCES ${DAI_SRCS} LINK_LIBRARIES ${_static_libdeps})
|
||||
SC_ADDLIB(stepdai-static STATIC SOURCES ${DAI_SRCS} LINK_LIBRARIES $<JOIN:${_libdeps},-static >-static)
|
||||
endif()
|
||||
|
||||
# Local Variables:
|
||||
|
||||
@@ -743,15 +743,6 @@ int STEPfile::FindHeaderSection( istream & in ) {
|
||||
return 0;
|
||||
}
|
||||
in.getline( buf, BUFSIZ, ';' ); // reads but does not store the ;
|
||||
if( in.fail() ) {
|
||||
// A file with no ';' in its first BUFSIZ bytes - a binary file that
|
||||
// is not STEP at all, say - sets failbit and leaves buf unchanged.
|
||||
// eof() then never becomes true and the loop above spins forever.
|
||||
_error.AppendToUserMsg(
|
||||
"Error: Unable to find HEADER section. File not read.\n" );
|
||||
_error.GreaterSeverity( SEVERITY_INPUT_ERROR );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,5 @@ if(SC_ENABLE_TESTING)
|
||||
add_test(NAME lazy_index
|
||||
COMMAND lazy_index_test
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/lazy_index.stp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/lazy_scope.stp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/lazy_broken_section.stp)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/lazy_scope.stp)
|
||||
endif()
|
||||
|
||||
@@ -335,24 +335,7 @@ SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id, bool reSee
|
||||
break;
|
||||
case 1:
|
||||
pos = cv->at( 0 );
|
||||
//not an assert: a section that failed part way through its scan has
|
||||
//already indexed the instances before the error under its id, and is
|
||||
//then never registered. Those entries are bad input, not a programming
|
||||
//error, and in Release the assert was compiled out and this indexed an
|
||||
//empty vector. Same test sourceRecord() already makes.
|
||||
if( pos.section >= _dataSections.size() || !_dataSections[pos.section] ) {
|
||||
if( !_diagnosticCallback ) {
|
||||
std::cerr << "Instance #" << id << " names data section "
|
||||
<< pos.section << ", which failed to index." << std::endl;
|
||||
}
|
||||
LazyDiagnostic diagnostic;
|
||||
diagnostic.severity = LAZY_DIAGNOSTIC_ERROR;
|
||||
diagnostic.entity = id;
|
||||
diagnostic.offset = pos.begin;
|
||||
diagnostic.message = "instance belongs to a DATA section that failed to index";
|
||||
emitDiagnostic( diagnostic );
|
||||
break;
|
||||
}
|
||||
assert( _dataSections.size() > pos.section );
|
||||
if( reSeek ) {
|
||||
oldPos = _dataSections[pos.section]->tellg();
|
||||
}
|
||||
@@ -389,9 +372,7 @@ SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id, bool reSee
|
||||
* safely revisit this instance without tripping the materialization
|
||||
* cycle detector. */
|
||||
loading_guard.release();
|
||||
/* isNilSTEPentity( 0 ) is false, so a null has to be tested for
|
||||
* separately - every branch of the switch above can leave one. */
|
||||
if( inst && !isNilSTEPentity( inst ) ) {
|
||||
if( !isNilSTEPentity( inst ) ) {
|
||||
_instancesLoaded.insert( id, inst );
|
||||
_loadedInstanceCount++;
|
||||
++_materializations;
|
||||
|
||||
@@ -95,7 +95,6 @@ const namedLazyInstance lazyP21DataSectionReader::nextInstance() {
|
||||
std::streampos end = -1;
|
||||
namedLazyInstance i;
|
||||
|
||||
i.name = 0;
|
||||
i.refs = 0;
|
||||
i.componentTypes = 0;
|
||||
i.loc.section = 0;
|
||||
@@ -130,7 +129,6 @@ const namedLazyInstance lazyP21DataSectionReader::nextInstance() {
|
||||
i.loc.begin = 0;
|
||||
if( i.refs ) {
|
||||
delete i.refs;
|
||||
i.refs = 0;
|
||||
}
|
||||
if( i.componentTypes ) {
|
||||
delete i.componentTypes;
|
||||
|
||||
@@ -17,7 +17,7 @@ void emptyRegistryInit( Registry & ) {
|
||||
}
|
||||
|
||||
int main( int argc, char ** argv ) {
|
||||
require( argc == 4, "expected ordinary, scoped and broken-section fixture paths" );
|
||||
require( argc == 3, "expected ordinary and scoped fixture paths" );
|
||||
|
||||
lazyInstMgr manager;
|
||||
uint64_t progressCalls = 0;
|
||||
@@ -133,31 +133,5 @@ int main( int argc, char ** argv ) {
|
||||
complexOwner.find( "ENDSCOPE (C()D(" ) != std::string::npos &&
|
||||
!complexOwner.empty() && complexOwner[complexOwner.size() - 1] == ';',
|
||||
"complex scope source record was not preserved" );
|
||||
/* A DATA section indexes its instances from its own constructor, under the
|
||||
* id it will be given, and is registered only afterwards and only if the
|
||||
* scan succeeded. A section that fails part way through therefore leaves
|
||||
* every instance it had already indexed naming a section that does not
|
||||
* exist. Asking for one of those must fail like any other unloadable
|
||||
* instance rather than index an empty vector. */
|
||||
lazyInstMgr broken;
|
||||
broken.setRegistry( &emptyRegistry );
|
||||
uint64_t brokenDiagnostics = 0;
|
||||
broken.setDiagnosticCallback( [&brokenDiagnostics]( const LazyDiagnostic & ) {
|
||||
++brokenDiagnostics;
|
||||
} );
|
||||
broken.openFile( argv[3] );
|
||||
stats = broken.cacheStatistics();
|
||||
require( stats.dataSections == 0, "the failed data section was registered anyway" );
|
||||
require( broken.totalInstanceCount() == 1,
|
||||
"the instance indexed before the failure was dropped from the index" );
|
||||
require( broken.typeFromFile( 1 ) == 0,
|
||||
"type of an instance in an unregistered section was not refused" );
|
||||
require( broken.loadInstance( 1 ) == 0,
|
||||
"instance in an unregistered section was not refused" );
|
||||
require( brokenDiagnostics > 0,
|
||||
"refusing the instance produced no diagnostic" );
|
||||
require( broken.sourceRecord( 1 ).empty(),
|
||||
"source record of an instance in an unregistered section was not empty" );
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
ISO-10303-21;
|
||||
HEADER;
|
||||
FILE_DESCRIPTION(('lazy broken section test'),'2;1');
|
||||
FILE_NAME('lazy_broken_section.stp','2026-08-21T00:00:00',('STEPcode'),('STEPcode'),'','','');
|
||||
FILE_SCHEMA(('LAZY_TEST_SCHEMA { 1 0 10303 999 }'));
|
||||
ENDSEC;
|
||||
/* The DATA section indexes #1 and then fails: no ENDSEC; follows. The
|
||||
section is therefore never registered, while #1 is already in the
|
||||
instance index naming it. */
|
||||
DATA;
|
||||
#1=A();
|
||||
not a step instance
|
||||
END-ISO-10303-21;
|
||||
@@ -169,17 +169,14 @@ Severity EntityNode::StrToVal( const char * s, ErrorDescriptor * err,
|
||||
ErrorDescriptor error;
|
||||
if( EntityValidLevel( se, elem_type, &error ) == SEVERITY_NULL ) {
|
||||
node = se;
|
||||
_null = 0;
|
||||
} else {
|
||||
node = S_ENTITY_NULL;
|
||||
err->AppendToDetailMsg( error.DetailMsg() );
|
||||
err->AppendToUserMsg( error.UserMsg() );
|
||||
err->GreaterSeverity( error.severity() );
|
||||
_null = 1;
|
||||
}
|
||||
} else {
|
||||
node = S_ENTITY_NULL;
|
||||
_null = 1;
|
||||
}
|
||||
return err->severity();
|
||||
}
|
||||
@@ -206,17 +203,14 @@ Severity EntityNode::STEPread( istream & in, ErrorDescriptor * err,
|
||||
ErrorDescriptor error;
|
||||
if( EntityValidLevel( se, elem_type, &error ) == SEVERITY_NULL ) {
|
||||
node = se;
|
||||
_null = 0;
|
||||
} else {
|
||||
node = S_ENTITY_NULL;
|
||||
err->AppendToDetailMsg( error.DetailMsg() );
|
||||
err->AppendToUserMsg( error.UserMsg() );
|
||||
err->GreaterSeverity( error.severity() );
|
||||
_null = 1;
|
||||
}
|
||||
} else {
|
||||
node = S_ENTITY_NULL;
|
||||
_null = 1;
|
||||
}
|
||||
return err->severity();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
TypeDescriptor::TypeDescriptor( )
|
||||
: _name( 0 ), altNames( 0 ), _fundamentalType( UNKNOWN_TYPE ),
|
||||
_originatingSchema( 0 ), _referentType( 0 ), _description( 0 ), _where_rules( 0 ) {
|
||||
_altname[0] = '\0';
|
||||
}
|
||||
|
||||
TypeDescriptor::TypeDescriptor
|
||||
@@ -12,7 +11,6 @@ TypeDescriptor::TypeDescriptor
|
||||
: _name( nm ), altNames( 0 ), _fundamentalType( ft ),
|
||||
_originatingSchema( origSchema ), _referentType( 0 ), _description( d ),
|
||||
_where_rules( 0 ) {
|
||||
_altname[0] = '\0';
|
||||
}
|
||||
|
||||
TypeDescriptor::~TypeDescriptor() {
|
||||
|
||||
+2
-3
@@ -157,12 +157,11 @@ HASHcreate( unsigned count ) {
|
||||
/*
|
||||
** Allocate initial 'i' segments of buckets
|
||||
*/
|
||||
for( i = 0; i < count; i++ ) {
|
||||
for( i = 0; i < count; i++ )
|
||||
CALLOC( table->Directory[i], SEGMENT_SIZE, Element )
|
||||
/*, "segment in HASHcreate");*/
|
||||
}
|
||||
|
||||
table->SegmentCount = count;
|
||||
table->SegmentCount = count;
|
||||
table->maxp = MUL( count, SEGMENT_SIZE_SHIFT );
|
||||
table->MinLoadFactor = 1;
|
||||
table->MaxLoadFactor = MAX_LOAD_FACTOR;
|
||||
|
||||
+11
-11
@@ -310,16 +310,16 @@ Refinement collect_refinements_from_conjunction( Expression expr, Scope scope )
|
||||
}
|
||||
|
||||
/* Create a refinement */
|
||||
Refinement refinement = ( Refinement ) malloc( sizeof( struct Refinement_ ) );
|
||||
if( !refinement ) {
|
||||
Refinement ref = ( Refinement ) malloc( sizeof( struct Refinement_ ) );
|
||||
if( !ref ) {
|
||||
/* Memory allocation failed */
|
||||
return NULL;
|
||||
}
|
||||
refinement->variable = var;
|
||||
refinement->refined_type = target_type;
|
||||
refinement->next = NULL;
|
||||
ref->variable = var;
|
||||
ref->refined_type = target_type;
|
||||
ref->next = NULL;
|
||||
|
||||
return refinement;
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* Not an AND node and not a matching pattern - don't recurse further */
|
||||
@@ -347,12 +347,12 @@ static Type lookup_refinement( Variable var ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Refinement refinement = active_refinements->refinements;
|
||||
while( refinement ) {
|
||||
if( refinement->variable == var ) {
|
||||
return refinement->refined_type;
|
||||
Refinement ref = active_refinements->refinements;
|
||||
while( ref ) {
|
||||
if( ref->variable == var ) {
|
||||
return ref->refined_type;
|
||||
}
|
||||
refinement = refinement->next;
|
||||
ref = ref->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user