Commit cc0524a2 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Converted the IS_BUS/IS_WIRE define to an enum

parent 81751632
...@@ -49,15 +49,21 @@ ...@@ -49,15 +49,21 @@
const SCH_SHEET_PATH BOM_LABEL::emptySheetPath; const SCH_SHEET_PATH BOM_LABEL::emptySheetPath;
enum BUS_OR_WIRE
{
IS_WIRE = 0,
IS_BUS = 1
};
// Buffer to build the list of items used in netlist and erc calculations // Buffer to build the list of items used in netlist and erc calculations
NETLIST_OBJECT_LIST g_NetObjectslist; NETLIST_OBJECT_LIST g_NetObjectslist;
//#define NETLIST_DEBUG //#define NETLIST_DEBUG
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ); static void PropageNetCode( int OldNetCode, int NewNetCode, BUS_OR_WIRE IsBus );
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel ); static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ); static void PointToPointConnect( NETLIST_OBJECT* Ref, BUS_OR_WIRE IsBus, int start );
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus, int start ); static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, BUS_OR_WIRE IsBus, int start );
static void LabelConnect( NETLIST_OBJECT* Label ); static void LabelConnect( NETLIST_OBJECT* Label );
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer ); static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer );
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer ); static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer );
...@@ -184,7 +190,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() ...@@ -184,7 +190,7 @@ void SCH_EDIT_FRAME::BuildNetListBase()
LastNetCode++; LastNetCode++;
} }
PointToPointConnect( net_item, 0, istart ); PointToPointConnect( net_item, IS_WIRE, istart );
break; break;
case NET_JUNCTION: case NET_JUNCTION:
...@@ -195,7 +201,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() ...@@ -195,7 +201,7 @@ void SCH_EDIT_FRAME::BuildNetListBase()
LastNetCode++; LastNetCode++;
} }
SegmentToPointConnect( net_item, 0, istart ); SegmentToPointConnect( net_item, IS_WIRE, istart );
/* Control of the junction, on BUS. */ /* Control of the junction, on BUS. */
if( net_item->m_BusNetCode == 0 ) if( net_item->m_BusNetCode == 0 )
...@@ -204,7 +210,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() ...@@ -204,7 +210,7 @@ void SCH_EDIT_FRAME::BuildNetListBase()
LastBusNetCode++; LastBusNetCode++;
} }
SegmentToPointConnect( net_item, ISBUS, istart ); SegmentToPointConnect( net_item, IS_BUS, istart );
break; break;
case NET_LABEL: case NET_LABEL:
...@@ -217,7 +223,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() ...@@ -217,7 +223,7 @@ void SCH_EDIT_FRAME::BuildNetListBase()
LastNetCode++; LastNetCode++;
} }
SegmentToPointConnect( net_item, 0, istart ); SegmentToPointConnect( net_item, IS_WIRE, istart );
break; break;
case NET_SHEETBUSLABELMEMBER: case NET_SHEETBUSLABELMEMBER:
...@@ -232,7 +238,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() ...@@ -232,7 +238,7 @@ void SCH_EDIT_FRAME::BuildNetListBase()
LastBusNetCode++; LastBusNetCode++;
} }
PointToPointConnect( net_item, ISBUS, istart ); PointToPointConnect( net_item, IS_BUS, istart );
break; break;
case NET_BUSLABELMEMBER: case NET_BUSLABELMEMBER:
...@@ -245,7 +251,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() ...@@ -245,7 +251,7 @@ void SCH_EDIT_FRAME::BuildNetListBase()
LastBusNetCode++; LastBusNetCode++;
} }
SegmentToPointConnect( net_item, ISBUS, istart ); SegmentToPointConnect( net_item, IS_BUS, istart );
break; break;
} }
} }
...@@ -547,7 +553,7 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel ) ...@@ -547,7 +553,7 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
/* Propagate Netcode having all the objects of the same Netcode. */ /* Propagate Netcode having all the objects of the same Netcode. */
if( ObjetNet->GetNet() ) if( ObjetNet->GetNet() )
PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), 0 ); PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE );
else else
ObjetNet->SetNet( SheetLabel->GetNet() ); ObjetNet->SetNet( SheetLabel->GetNet() );
} }
...@@ -593,7 +599,7 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer ) ...@@ -593,7 +599,7 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
if( LabelInTst->GetNet() == 0 ) if( LabelInTst->GetNet() == 0 )
LabelInTst->SetNet( Label->GetNet() ); LabelInTst->SetNet( Label->GetNet() );
else else
PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 ); PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE );
} }
} }
} }
...@@ -607,12 +613,12 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer ) ...@@ -607,12 +613,12 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
* If IsBus == 0; Netcode is the member who is spreading * If IsBus == 0; Netcode is the member who is spreading
* If IsBus != 0; is the member who is spreading BusNetCode * If IsBus != 0; is the member who is spreading BusNetCode
*/ */
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ) static void PropageNetCode( int OldNetCode, int NewNetCode, BUS_OR_WIRE IsBus )
{ {
if( OldNetCode == NewNetCode ) if( OldNetCode == NewNetCode )
return; return;
if( IsBus == 0 ) /* Propagate NetCode */ if( IsBus == IS_WIRE ) // Propagate NetCode
{ {
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ ) for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
{ {
...@@ -658,11 +664,11 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ) ...@@ -658,11 +664,11 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
* Leaf schema * Leaf schema
* (There can be no physical connection between elements of different sheets) * (There can be no physical connection between elements of different sheets)
*/ */
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) static void PointToPointConnect( NETLIST_OBJECT* Ref, BUS_OR_WIRE IsBus, int start )
{ {
int netCode; int netCode;
if( IsBus == 0 ) /* Objects other than BUS and BUSLABELS. */ if( IsBus == IS_WIRE ) // Objects other than BUS and BUSLABELS
{ {
netCode = Ref->GetNet(); netCode = Ref->GetNet();
...@@ -692,7 +698,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) ...@@ -692,7 +698,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
if( item->GetNet() == 0 ) if( item->GetNet() == 0 )
item->SetNet( netCode ); item->SetNet( netCode );
else else
PropageNetCode( item->GetNet(), netCode, 0 ); PropageNetCode( item->GetNet(), netCode, IS_WIRE );
} }
break; break;
...@@ -744,7 +750,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) ...@@ -744,7 +750,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
if( item->m_BusNetCode == 0 ) if( item->m_BusNetCode == 0 )
item->m_BusNetCode = netCode; item->m_BusNetCode = netCode;
else else
PropageNetCode( item->m_BusNetCode, netCode, 1 ); PropageNetCode( item->m_BusNetCode, netCode, IS_BUS );
} }
break; break;
} }
...@@ -760,7 +766,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) ...@@ -760,7 +766,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
* The list of objects is expected sorted by sheets. * The list of objects is expected sorted by sheets.
* Search is done from index aIdxStart to the last element of g_NetObjectslist * Search is done from index aIdxStart to the last element of g_NetObjectslist
*/ */
static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aIdxStart ) static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, BUS_OR_WIRE aIsBus, int aIdxStart )
{ {
for( unsigned i = aIdxStart; i < g_NetObjectslist.size(); i++ ) for( unsigned i = aIdxStart; i < g_NetObjectslist.size(); i++ )
{ {
...@@ -770,7 +776,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aI ...@@ -770,7 +776,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aI
if( Segment->m_SheetList != aJonction->m_SheetList ) if( Segment->m_SheetList != aJonction->m_SheetList )
continue; continue;
if( aIsBus == 0 ) if( aIsBus == IS_WIRE )
{ {
if( Segment->m_Type != NET_SEGMENT ) if( Segment->m_Type != NET_SEGMENT )
continue; continue;
...@@ -784,7 +790,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aI ...@@ -784,7 +790,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aI
if( SegmentIntersect( Segment->m_Start, Segment->m_End, aJonction->m_Start ) ) if( SegmentIntersect( Segment->m_Start, Segment->m_End, aJonction->m_Start ) )
{ {
/* Propagation Netcode has all the objects of the same Netcode. */ /* Propagation Netcode has all the objects of the same Netcode. */
if( aIsBus == 0 ) if( aIsBus == IS_WIRE )
{ {
if( Segment->GetNet() ) if( Segment->GetNet() )
PropageNetCode( Segment->GetNet(), aJonction->GetNet(), aIsBus ); PropageNetCode( Segment->GetNet(), aJonction->GetNet(), aIsBus );
...@@ -849,7 +855,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef ) ...@@ -849,7 +855,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
continue; continue;
if( g_NetObjectslist[i]->GetNet() ) if( g_NetObjectslist[i]->GetNet() )
PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 ); PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), IS_WIRE );
else else
g_NetObjectslist[i]->SetNet( LabelRef->GetNet() ); g_NetObjectslist[i]->SetNet( LabelRef->GetNet() );
} }
......
...@@ -45,9 +45,7 @@ class SCH_REFERENC_LIST; ...@@ -45,9 +45,7 @@ class SCH_REFERENC_LIST;
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
#define ISBUS 1 // Max pin number per component and footprint
/* Max pin number per component and footprint */
#define MAXPIN 5000 #define MAXPIN 5000
......
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