diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 03b807a1da..2639735834 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 +================================================================================ +++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 ================================================================================ ++eeschema: diff --git a/eeschema/class_netlist_object.cpp b/eeschema/class_netlist_object.cpp index e710ff07ef..7fa0c7a2bf 100644 --- a/eeschema/class_netlist_object.cpp +++ b/eeschema/class_netlist_object.cpp @@ -83,10 +83,28 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) if( !m_Label.IsEmpty() ) out << " \n"; + out << " " << m_SheetList.PathHumanReadable().mb_str() << "\n"; + + switch( m_Type ) + { + case NET_PIN: + out << " " << ((SCH_COMPONENT*)m_Link)->GetRef(&m_SheetList).mb_str() << "\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 ); + m_Comp->Show( 1, out ); // labels may not have good Show() funcs? else out << " m_Comp==NULL\n"; +*/ out << "\n"; } diff --git a/eeschema/class_pin.cpp b/eeschema/class_pin.cpp index ed0ee68029..629abd6fa1 100644 --- a/eeschema/class_pin.cpp +++ b/eeschema/class_pin.cpp @@ -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 ) << "\n"; +} + +#endif diff --git a/eeschema/class_pin.h b/eeschema/class_pin.h index ee9aee4196..810eb96215 100644 --- a/eeschema/class_pin.h +++ b/eeschema/class_pin.h @@ -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. diff --git a/eeschema/class_sch_component.cpp b/eeschema/class_sch_component.cpp index 8b4792ebaa..c7aa40a25a 100644 --- a/eeschema/class_sch_component.cpp +++ b/eeschema/class_sch_component.cpp @@ -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 ) diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index 517fcf31c0..81da6d43dd 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -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 ); } } } diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index f9a1dc7b0c..52270a8ecf 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -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: