bug solved: netlist calculations could crash eeschema under very rare circumstances. See also changelog

This commit is contained in:
charras 2008-08-22 14:48:30 +00:00
parent c10fdc422b
commit 88b1c9b7d3
8 changed files with 1303 additions and 713 deletions

View File

@ -5,6 +5,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Aug-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema:
bug solved: netlist calculations could crash eeschema under very rare circumstances.
recent bug solved: background filled shapes (filled but not solid: texts are readables inside shapes)
were drawn (and plotted) as filled (solid) shapes
enhancements needed for plotting background filled shapes, in color mode
(cannot be filled in black and white mode)
2008-Aug-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:

View File

@ -238,7 +238,7 @@ class LibDrawArc : public LibEDA_BaseStruct
{
public:
int m_Rayon;
bool m_Fill;
int m_Fill; // NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
int t1, t2; /* position des 2 extremites de l'arc en 0,1 degres */
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
@ -259,7 +259,7 @@ class LibDrawCircle : public LibEDA_BaseStruct
{
public:
int m_Rayon;
bool m_Fill;
int m_Fill;
public:
LibDrawCircle();
@ -299,7 +299,7 @@ class LibDrawSquare : public LibEDA_BaseStruct
{
public:
wxPoint m_End;
bool m_Fill;
int m_Fill;
public:
LibDrawSquare();
@ -337,7 +337,7 @@ class LibDrawPolyline : public LibEDA_BaseStruct
public:
int n;
int* PolyList;
bool m_Fill;
int m_Fill;
public:
LibDrawPolyline();

View File

@ -44,22 +44,52 @@ const char* ShowType( NetObjetType aType )
switch( aType )
{
case NET_SEGMENT: ret = "segment"; break;
case NET_BUS: ret = "bus"; break;
case NET_JONCTION: ret = "junction"; break;
case NET_LABEL: ret = "label"; break;
case NET_HIERLABEL: ret = "hierlabel"; break;
case NET_GLOBLABEL: ret = "glabel"; break;
case NET_BUSLABELMEMBER: ret = "buslblmember"; break;
case NET_HIERBUSLABELMEMBER: ret = "hierbuslblmember"; break;
case NET_GLOBBUSLABELMEMBER: ret = "gbuslblmember"; break;
case NET_SHEETBUSLABELMEMBER: ret = "sbuslblmember"; break;
case NET_SHEETLABEL: ret = "sheetlabel"; break;
case NET_PINLABEL: ret = "pinlabel"; break;
case NET_PIN: ret = "pin"; break;
case NET_NOCONNECT: ret = "noconnect"; break;
default: ret = "??"; break;
case NET_SEGMENT:
ret = "segment"; break;
case NET_BUS:
ret = "bus"; break;
case NET_JONCTION:
ret = "junction"; break;
case NET_LABEL:
ret = "label"; break;
case NET_HIERLABEL:
ret = "hierlabel"; break;
case NET_GLOBLABEL:
ret = "glabel"; break;
case NET_BUSLABELMEMBER:
ret = "buslblmember"; break;
case NET_HIERBUSLABELMEMBER:
ret = "hierbuslblmember"; break;
case NET_GLOBBUSLABELMEMBER:
ret = "gbuslblmember"; break;
case NET_SHEETBUSLABELMEMBER:
ret = "sbuslblmember"; break;
case NET_SHEETLABEL:
ret = "sheetlabel"; break;
case NET_PINLABEL:
ret = "pinlabel"; break;
case NET_PIN:
ret = "pin"; break;
case NET_NOCONNECT:
ret = "noconnect"; break;
default:
ret = "??"; break;
}
return ret;
}
@ -67,6 +97,7 @@ const char* ShowType( NetObjetType aType )
void ObjetNetListStruct::Show( std::ostream& out, int ndx )
{
wxString path = m_SheetList.PathHumanReadable();
out << "<netItem ndx=\"" << ndx << '"' <<
" type=\"" << ShowType( m_Type ) << '"' <<
" netCode=\"" << GetNet() << '"' <<
@ -86,6 +117,7 @@ void ObjetNetListStruct::Show( std::ostream& out, int ndx )
out << "</netItem>\n";
}
void dumpNetTable()
{
for( int i = 0; i<g_NbrObjNet; ++i )
@ -93,6 +125,8 @@ void dumpNetTable()
g_TabObjNet[i].Show( std::cout, i );
}
}
#endif
@ -131,6 +165,7 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
case NET_SHEETBUSLABELMEMBER:
case NET_BUSLABELMEMBER:
SAFE_DELETE( TabNetItems[i].m_Label );
//see the note in ConvertBustToMembers
break;
}
@ -143,6 +178,7 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
/*****************************************************/
void* WinEDA_SchematicFrame::BuildNetListBase()
/*****************************************************/
/* Routine qui construit le tableau des elements connectes du projet
* met a jour:
* g_TabObjNet
@ -190,12 +226,12 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
/* second pass: fill the fields of the structures used in connectivty calculation */
s_PassNumber++;
ObjetNetListStruct* tabObjNet = g_TabObjNet;
sheet = SheetListList.GetFirst();
for( ObjetNetListStruct* tabObjNet = g_TabObjNet;
sheet != NULL; sheet = SheetListList.GetNext() )
for( ; sheet != NULL; sheet = SheetListList.GetNext() )
{
tabObjNet += ListeObjetConnection( sheet, tabObjNet );
int icnt = ListeObjetConnection( sheet, tabObjNet );
tabObjNet += icnt; // tabObjNet points the first free location in g_TabObjNet
}
activity.Empty();
@ -297,7 +333,6 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
}
}
#if defined (NETLIST_DEBUG) && defined (DEBUG)
std::cout << "\n\nafter sheet local\n\n";
dumpNetTable();
@ -457,11 +492,6 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
DrawList = sheetlist->LastScreen()->EEDrawList;
for( ; DrawList; DrawList = DrawList->Pnext )
{
if( ObjNet ){
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
//used for DrawSheetLabels
}
switch( DrawList->Type() )
{
case DRAW_SEGMENT_STRUCT_TYPE:
@ -469,10 +499,11 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
if( ObjNet )
{
if( (STRUCT->GetLayer() != LAYER_BUS)
&& (STRUCT->GetLayer() != LAYER_WIRE) )
if( (STRUCT->GetLayer() != LAYER_BUS) && (STRUCT->GetLayer() != LAYER_WIRE) )
break;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Start = STRUCT->m_Start;
ObjNet[NbrItem].m_End = STRUCT->m_End;
@ -494,6 +525,8 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
#define STRUCT ( (DrawJunctionStruct*) DrawList )
if( ObjNet )
{
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Type = NET_JONCTION;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
@ -507,6 +540,8 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
#define STRUCT ( (DrawNoConnectStruct*) DrawList )
if( ObjNet )
{
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Type = NET_NOCONNECT;
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
@ -521,6 +556,8 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
ii = IsBusLabel( STRUCT->m_Text );
if( ObjNet )
{
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Type = NET_LABEL;
@ -547,6 +584,8 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
ii = IsBusLabel( STRUCT->m_Text );
if( ObjNet )
{
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Type = NET_LABEL;
@ -605,6 +644,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
if( ObjNet )
{
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = DEntry;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Type = NET_PIN;
@ -624,6 +664,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
/* Il y a un PIN_LABEL Associe */
if( ObjNet )
{
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = NULL;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Type = NET_PINLABEL;
@ -657,6 +698,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
ii = IsBusLabel( SheetLabel->m_Text );
if( ObjNet )
{
ObjNet[NbrItem].m_SheetListInclude = *sheetlist;
ObjNet[NbrItem].m_Comp = SheetLabel;
ObjNet[NbrItem].m_SheetList = *sheetlist;
ObjNet[NbrItem].m_Link = DrawList;
@ -743,6 +785,8 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
}
}
}
/**************************************************/
int IsBusLabel( const wxString& LabelDrawList )
/**************************************************/
@ -941,7 +985,6 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
netCode = Ref->GetNet();
for( i = start; i < g_NbrObjNet; i++ )
{
if( netTable[i].m_SheetList != Ref->m_SheetList ) //used to be > (why?)
continue;
@ -977,7 +1020,6 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
}
}
}
else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
{
netCode = Ref->m_BusNetCode;
@ -1107,6 +1149,7 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
//global labels only connect other global labels.
continue;
}
//regular labels are sheet-local;
//NET_HIERLABEL are used to connect sheets.
//NET_LABEL is sheet-local (***)
@ -1121,6 +1164,7 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
{
if( netTable[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
continue;
// Propagation du Netcode a tous les Objets de meme NetCode
if( netTable[i].GetNet() )
PropageNetCode( netTable[i].GetNet(), LabelRef->GetNet(), 0 );
@ -1130,6 +1174,7 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
}
}
/****************************************************************************/
static int TriNetCode( const void* o1, const void* o2 )
/****************************************************************************/
@ -1144,6 +1189,7 @@ static int TriNetCode( const void* o1, const void* o2 )
return Objet1->GetNet() - Objet2->GetNet();
}
/*****************************************************************************/
static int TriBySheet( const void* o1, const void* o2 )
/*****************************************************************************/
@ -1154,9 +1200,11 @@ static int TriBySheet( const void* o1, const void* o2 )
{
ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1;
ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2;
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList );
}
/**********************************************************************/
static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
/**********************************************************************/

View File

@ -219,7 +219,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
pos.y = PartY + TransMat[1][0] * Arc->m_Pos.x +
TransMat[1][1] * Arc->m_Pos.y;
MapAngles( &t1, &t2, TransMat );
PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill, Arc->m_Width );
PlotArc( pos, t1, t2, Arc->m_Rayon, Arc->m_Fill == FILLED_SHAPE ? true : false, Arc->m_Width );
}
break;
@ -230,7 +230,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
TransMat[0][1] * Circle->m_Pos.y;
pos.y = PartY + TransMat[1][0] * Circle->m_Pos.x +
TransMat[1][1] * Circle->m_Pos.y;
PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill, Circle->m_Width );
PlotCercle( pos, Circle->m_Rayon * 2, Circle->m_Fill == FILLED_SHAPE ? true : false, Circle->m_Width );
}
break;
@ -266,7 +266,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
y2 = PartY + TransMat[1][0] * Square->m_End.x
+ TransMat[1][1] * Square->m_End.y;
PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), Square->m_Fill, Square->m_Width );
PlotRect( wxPoint(x1, y1), wxPoint(x2, y2), Square->m_Fill == FILLED_SHAPE ? true : false, Square->m_Width );
}
break;
@ -311,7 +311,7 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
TransMat[1][1] * polyline->PolyList[ii * 2 + 1];
}
PlotPoly( ii, Poly, polyline->m_Fill, polyline->m_Width );
PlotPoly( ii, Poly, polyline->m_Fill == FILLED_SHAPE ? true : false, polyline->m_Width );
MyFree( Poly );
}
break;

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -494,7 +494,7 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 1, _( "Module" ), Line, DARKCYAN );
Line = m_Text;
Affiche_1_Parametre( frame, 10, _( "Text" ), Line, YELLOW );
Affiche_1_Parametre( frame, 10, _( "Text" ), Line, BROWN );
ii = m_Type;
if( ii > 2 )
@ -510,18 +510,16 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
ii = m_Layer;
if( ii < NB_LAYERS )
Affiche_1_Parametre( frame, 28, _( "Layer" ), board->GetLayerName( ii ), DARKGREEN );
msg = board->GetLayerName( ii );
else
{
msg.Printf( wxT( "%d" ), ii );
Affiche_1_Parametre( frame, 28, _( "Layer" ), msg, DARKGREEN );
}
Affiche_1_Parametre( frame, 31, _( "Layer" ), msg, DARKGREEN );
msg = wxT( " Yes" );
if( m_Miroir & 1 )
msg = wxT( " No" );
Affiche_1_Parametre( frame, 36, _( "Mirror" ), msg, DARKGREEN );
Affiche_1_Parametre( frame, 37, _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
Affiche_1_Parametre( frame, 43, _( "Orient" ), msg, DARKGREEN );

View File

@ -237,8 +237,10 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
_( "End Drawing" ), apply_xpm );
}
aPopMenu->Append( ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ) );
aPopMenu->Append( ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ) );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_DRAWING,
_( "Edit Drawing" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING,
_( "Delete Drawing" ), delete_xpm );
break;
case TYPEZONE: // Item used to fill a zone