Commit 8e4e0fb5 authored by lifekidyeaa's avatar lifekidyeaa
Browse files

fixed bug: labels, hierarchal labels, global labels, as well as their busmember

counterparts, will be connected together if they have the same label (name) and are on the same sheet. 
parent 60651486
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
	Pinsheet = m_Label;
	Pinsheet = m_Label;
	while( Pinsheet )
	while( Pinsheet )
	{
	{
		/* Search Glabel corresponding to this Pinsheet */
		/* Search Hlabel corresponding to this Pinsheet */


		EDA_BaseStruct*        DrawStruct = m_s->EEDrawList;
		EDA_BaseStruct*        DrawStruct = m_s->EEDrawList;
		DrawHierLabelStruct* HLabel = NULL;
		DrawHierLabelStruct* HLabel = NULL;
+19 −13
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "protos.h"


//#define NETLIST_DEBUG


/* Routines locales */
/* Routines locales */
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
@@ -301,7 +302,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
    }
    }


   
   
#if 0 && defined(DEBUG)
#if defined(NETLIST_DEBUG) && defined(DEBUG)
    std::cout << "\n\nafter sheet local\n\n";
    std::cout << "\n\nafter sheet local\n\n";
    dumpNetTable();
    dumpNetTable();
#endif    
#endif    
@@ -342,7 +343,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
        }
        }
    }
    }


#if 0 && defined(DEBUG)
#if defined(NETLIST_DEBUG) && defined(DEBUG)
    std::cout << "\n\nafter sheet global\n\n";
    std::cout << "\n\nafter sheet global\n\n";
    dumpNetTable();
    dumpNetTable();
#endif    
#endif    
@@ -363,7 +364,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
    qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );
    qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );


    
    
#if 0 && defined(DEBUG)
#if defined(NETLIST_DEBUG) && defined(DEBUG)
    std::cout << "after qsort()\n";
    std::cout << "after qsort()\n";
    dumpNetTable();
    dumpNetTable();
#endif    
#endif    
@@ -549,8 +550,8 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetList* sh
                ObjNet[NbrItem].m_Comp   = STRUCT;
                ObjNet[NbrItem].m_Comp   = STRUCT;
                ObjNet[NbrItem].m_Type   = NET_LABEL;
                ObjNet[NbrItem].m_Type   = NET_LABEL;
                
                
                if( STRUCT->m_Layer ==  LAYER_GLOBLABEL )
                if( STRUCT->m_Layer ==  LAYER_GLOBLABEL ) //this is not the simplest way of doing it
                    ObjNet[NbrItem].m_Type = NET_GLOBLABEL;
                    ObjNet[NbrItem].m_Type = NET_GLOBLABEL;// (look at the case statement above). 
				if( STRUCT->m_Layer ==  LAYER_HIERLABEL )
				if( STRUCT->m_Layer ==  LAYER_HIERLABEL )
					ObjNet[NbrItem].m_Type = NET_HIERLABEL;
					ObjNet[NbrItem].m_Type = NET_HIERLABEL;
                
                
@@ -851,7 +852,7 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )


    for( BusMember++; BusMember <= LastNumWireBus; BusMember++ )
    for( BusMember++; BusMember <= LastNumWireBus; BusMember++ )
    {
    {
        *(BusLabel + 1) = *BusLabel; 
        *(BusLabel + 1) = *BusLabel; //copy constructor.
        BusLabel++; 
        BusLabel++; 
        NumItem++;
        NumItem++;
        
        
@@ -883,8 +884,8 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )


    if( OldNetCode == NewNetCode )
    if( OldNetCode == NewNetCode )
        return;
        return;
#ifdef DEBUG
#if defined(NETLIST_DEBUG) && defined(DEBUG)
	//printf("replacing net %d with %d\n", OldNetCode,NewNetCode); 
	printf("replacing net %d with %d\n", OldNetCode,NewNetCode); 
#endif
#endif


    if( IsBus == 0 )    /* Propagation du NetCode */
    if( IsBus == 0 )    /* Propagation du NetCode */
@@ -1095,13 +1096,16 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
    {
    {
        if( netTable[i].GetNet() == LabelRef->GetNet() )
        if( netTable[i].GetNet() == LabelRef->GetNet() )
            continue;
            continue;

		if( netTable[i].m_SheetList != LabelRef->m_SheetList )
		if( netTable[i].m_SheetList != LabelRef->m_SheetList )
        {
        {
            if( netTable[i].m_Type != NET_PINLABEL 
            if( (netTable[i].m_Type != NET_PINLABEL 
				&& netTable[i].m_Type != NET_GLOBLABEL
				&& netTable[i].m_Type != NET_GLOBLABEL
				&& netTable[i].m_Type != NET_GLOBBUSLABELMEMBER
				&& netTable[i].m_Type != NET_GLOBBUSLABELMEMBER) ) 
			    /*netTable[i].m_Type != NET_LABEL (***)*/ ) 
                continue;
			if( (netTable[i].m_Type == NET_GLOBLABEL 
			 	|| netTable[i].m_Type == NET_GLOBBUSLABELMEMBER) 
			  	&& netTable[i].m_Type != LabelRef->m_Type)
				//global labels only connect other global labels.
				continue; 
				continue; 
        }
        }
		//regular labels are sheet-local; 
		//regular labels are sheet-local; 
@@ -1110,8 +1114,10 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
		//NET_GLOBLABEL is global. 
		//NET_GLOBLABEL is global. 
		if( netTable[i].m_Type == NET_LABEL
		if( netTable[i].m_Type == NET_LABEL
         || netTable[i].m_Type == NET_GLOBLABEL
         || netTable[i].m_Type == NET_GLOBLABEL
		 || netTable[i].m_Type == NET_HIERLABEL
         || netTable[i].m_Type == NET_BUSLABELMEMBER
         || netTable[i].m_Type == NET_BUSLABELMEMBER
         || netTable[i].m_Type == NET_GLOBBUSLABELMEMBER
         || netTable[i].m_Type == NET_GLOBBUSLABELMEMBER
		 || netTable[i].m_Type == NET_HIERBUSLABELMEMBER
         || netTable[i].m_Type == NET_PINLABEL )
         || netTable[i].m_Type == NET_PINLABEL )
        {
        {
            if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
            if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )