Use strong check for bus label when netlisting

Fixes #4318
This commit is contained in:
Jon Evans 2020-05-06 18:26:56 -04:00
parent 241fc3166b
commit c92181621e
3 changed files with 22 additions and 6 deletions

View File

@ -400,9 +400,16 @@ void SCH_CONNECTION::AppendDebugInfoToMsgPanel( MSG_PANEL_ITEMS& aList ) const
bool SCH_CONNECTION::IsBusLabel( const wxString& aLabel )
{
//return IsBusVectorLabel( aLabel ) || IsBusGroupLabel( aLabel );
return IsBusVectorLabel( aLabel ) || IsBusGroupLabel( aLabel );
}
bool SCH_CONNECTION::MightBeBusLabel( const wxString& aLabel )
{
// Weak heuristic for performance reasons. Stronger test will be used for connectivity
return aLabel.Contains( wxT( "[" ) ) || aLabel.Contains( wxT( "{" ) );
wxString label = UnescapeString( aLabel );
return label.Contains( wxT( "[" ) ) || label.Contains( wxT( "{" ) );
}

View File

@ -303,6 +303,15 @@ public:
*/
static bool IsBusLabel( const wxString& aLabel );
/**
* Test if \a aLabel looks like a bus notation.
* This check is much less expensive than IsBusLabel.
*
* @param aLabel A wxString object containing the label to test.
* @return true if text might be a bus label
*/
static bool MightBeBusLabel( const wxString& aLabel );
/**
* Test if \a aLabel has a bus vector notation (simple bus, e.g. A[7..0])
*

View File

@ -523,12 +523,12 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
label = GetSheetLabel( aPosition );
if( label && conn.IsBusLabel( label->GetText() ) && label->IsConnected( aPosition ) )
if( label && conn.MightBeBusLabel( label->GetText() ) && label->IsConnected( aPosition ) )
return true;
text = GetLabel( aPosition );
if( text && conn.IsBusLabel( text->GetText() ) && text->IsConnected( aPosition )
if( text && conn.MightBeBusLabel( text->GetText() ) && text->IsConnected( aPosition )
&& (text->Type() != SCH_LABEL_T) )
return true;
@ -559,12 +559,12 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
text = GetLabel( aPosition );
if( text && text->IsConnected( aPosition ) && !conn.IsBusLabel( text->GetText() ) )
if( text && text->IsConnected( aPosition ) && !conn.MightBeBusLabel( text->GetText() ) )
return true;
label = GetSheetLabel( aPosition );
if( label && label->IsConnected( aPosition ) && !conn.IsBusLabel( label->GetText() ) )
if( label && label->IsConnected( aPosition ) && !conn.MightBeBusLabel( label->GetText() ) )
return true;
break;