Commit 2213a347 authored by Dick Hollenbeck's avatar Dick Hollenbeck

netlist export speed optimizations, bug fix in...

netlist export speed optimizations, bug fix in NETLIST_HELP::FindAllInstancesOfComponent that I put in there yesterday.
parent 5d7410c9
......@@ -4,6 +4,14 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-Aug-3 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++eeschema netlist.cpp and netform.cpp:
* Found several speed optimizations in the netlist export code.
* Now sort the pins properly if they have pin numbers like A1 and A10,
i.e. alphanumerics in them.
2010-Jul-30 & 31 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++eeschema:
......
......@@ -83,10 +83,28 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx )
if( !m_Label.IsEmpty() )
out << " <label>" << m_Label.mb_str() << "</label>\n";
out << " <sheetpath>" << m_SheetList.PathHumanReadable().mb_str() << "</sheetpath>\n";
switch( m_Type )
{
case NET_PIN:
out << " <refOfComp>" << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str() << "</refOfComp>\n";
if( m_Comp )
m_Comp->Show( 1, out );
break;
default:
// not all the m_Comp classes have working Show functions.
;
}
/* was segfault-ing
if( m_Comp )
m_Comp->Show( 1, out ); // labels may not have good Show() funcs?
else
out << " m_Comp==NULL\n";
*/
out << "</netItem>\n";
}
......
......@@ -1766,3 +1766,16 @@ const char*** LIB_PIN::GetStyleSymbols()
return s_icons_Pins_Shapes;
}
#if defined(DEBUG)
void LIB_PIN::Show( int nestLevel, std::ostream& os )
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str()
<< " num=\"" << GetNumber().mb_str()
<< '"' << "/>\n";
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
......@@ -115,6 +115,10 @@ public:
return wxT( "LIB_PIN" );
}
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); // virtual override
#endif
/**
* Write pin object to a FILE in "*.lib" format.
......
......@@ -934,7 +934,7 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
<< '"' << " chipName=\""
<< CONV_TO_UTF8( m_ChipName ) << '"' << m_Pos
<< " layer=\"" << m_Layer
<< '"' << "/>\n";
<< '"' << ">\n";
// skip the reference, it's been output already.
for( int i = 1; i < GetFieldCount(); ++i )
......
......@@ -343,11 +343,6 @@ SCH_COMPONENT* NETLIST_HELP::findNextComponentAndCreatPinList( EDA_BaseStruct* a
// Collect all parts and pins for this first occurance of reference.
// This is only done once, it would be too expensive otherwise.
FindAllInstancesOfComponent( comp, entry, aSheetPath );
if( ref == wxString( wxT("U1") ) )
{
printf("U1 m_SortedComponentPinList.size():%zu\n", m_SortedComponentPinList.size() );
}
}
else // entry->GetPartCount() <= 1 means one part per package
......@@ -867,9 +862,6 @@ bool NETLIST_HELP::WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bo
}
ret |= fprintf( f, "\n" );
printf( "%-10s pincount:%zu\n", CONV_TO_UTF8( comp->GetRef( path ) ),
m_SortedComponentPinList.size() );
// Write pin list:
for( unsigned ii = 0; ii < m_SortedComponentPinList.size(); ii++ )
{
......@@ -1086,32 +1078,8 @@ void NETLIST_HELP::FindAllInstancesOfComponent( SCH_COMPONENT* aComponent,
if( pin->m_Convert && pin->m_Convert != comp2->m_Convert )
continue;
#if defined(DEBUG)
printf( "AddPin %s %s\n", CONV_TO_UTF8(ref), CONV_TO_UTF8( pin->GetNumber() ) );
if( ref == wxString( wxT("U1") ) && pin->GetNumber() == wxString( wxT("A1") ) )
{
int debug = 1;
}
bool rc =
#endif
// A suitable pin is found: add it to the current list
AddPinToComponentPinList( comp2, aSheetPath, pin );
#if defined(DEBUG)
if( !rc )
{
printf("skipped pin %s %s\n",
CONV_TO_UTF8(ref),
CONV_TO_UTF8( pin->GetNumber() ) );
printf( "g_NetObjectslist.size():%zu\n",
g_NetObjectslist.size() );
}
#endif
AddPinToComponentPinList( comp2, sheet, pin );
}
}
}
......
......@@ -18,7 +18,7 @@
// Buffer to build the list of items used in netlist and erc calculations
NETLIST_OBJECT_LIST g_NetObjectslist;
#define NETLIST_DEBUG
//#define NETLIST_DEBUG
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
......@@ -273,7 +273,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
sort( g_NetObjectslist.begin(), g_NetObjectslist.end(), SortItemsbyNetcode );
#if defined(NETLIST_DEBUG) && defined(DEBUG)
std::cout << "after qsort()\n";
std::cout << "\n\nafter qsort()\n";
dumpNetTable();
#endif
......@@ -467,7 +467,6 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
NETLIST_OBJECT* new_item;
SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry;
LIB_PIN* pin;
SCH_SHEET_PATH list;
DrawList = sheetlist->LastScreen()->EEDrawList;
......@@ -587,24 +586,20 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
case TYPE_SCH_COMPONENT:
DrawLibItem = (SCH_COMPONENT*) DrawList;
Entry =
CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
Entry = CMP_LIBRARY::FindLibraryComponent( DrawLibItem->m_ChipName );
if( Entry == NULL )
break;
for( pin = Entry->GetNextPin(); pin != NULL;
pin = Entry->GetNextPin( pin ) )
for( LIB_PIN* pin = Entry->GetNextPin(); pin; pin = Entry->GetNextPin( pin ) )
{
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
if( pin->m_Unit
&& ( pin->m_Unit !=
DrawLibItem->GetUnitSelection( sheetlist ) ) )
if( pin->m_Unit &&
( pin->m_Unit != DrawLibItem->GetUnitSelection( sheetlist ) ) )
continue;
if( pin->m_Convert
&& ( pin->m_Convert != DrawLibItem->m_Convert ) )
if( pin->m_Convert &&
( pin->m_Convert != DrawLibItem->m_Convert ) )
continue;
wxPoint pos2 =
......@@ -640,7 +635,6 @@ static void AddConnectedObjects( SCH_SHEET_PATH* sheetlist,
aNetItemBuffer.push_back( new_item );
}
}
break;
case DRAW_POLYLINE_STRUCT_TYPE:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment