Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
ff58b0a8
Commit
ff58b0a8
authored
Jul 15, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed: eeschema crashes when creating netlist with hierarchies (due to netlist calculations rework)
parent
b78444c2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
68 deletions
+61
-68
listlib.cpp
cvpcb/listlib.cpp
+18
-21
netlist.cpp
eeschema/netlist.cpp
+43
-47
No files found.
cvpcb/listlib.cpp
View file @
ff58b0a8
...
...
@@ -21,9 +21,9 @@
#include "dialog_load_error.h"
/* MDC file strings */
wxString
mdc
_files_not_found
;
wxString
mdc
_files_invalid
;
/* MDC
and MOD
file strings */
static
wxString
s
_files_not_found
;
static
wxString
s
_files_invalid
;
/* routines locales : */
static
void
ReadDocLib
(
const
wxString
&
ModLibName
,
FOOTPRINT_LIST
&
list
);
...
...
@@ -76,7 +76,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
if
(
!
tmp
)
{
mdc
_files_not_found
<<
filename
.
GetFullName
()
<<
wxT
(
"
\n
"
);
s
_files_not_found
<<
filename
.
GetFullName
()
<<
wxT
(
"
\n
"
);
continue
;
}
...
...
@@ -85,7 +85,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
if
(
file
==
NULL
)
{
mdc
_files_invalid
<<
tmp
<<
_
(
" (file cannot be opened)"
)
<<
wxT
(
"
\n
"
);
s
_files_invalid
<<
tmp
<<
_
(
" (file cannot be opened)"
)
<<
wxT
(
"
\n
"
);
continue
;
}
...
...
@@ -93,7 +93,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
fgets
(
buffer
,
32
,
file
);
if
(
strncmp
(
buffer
,
ENTETE_LIBRAIRIE
,
L_ENTETE_LIB
)
!=
0
)
{
mdc
_files_invalid
<<
tmp
<<
_
(
" (Not a Kicad file)"
)
<<
wxT
(
"
\n
"
);
s
_files_invalid
<<
tmp
<<
_
(
" (Not a Kicad file)"
)
<<
wxT
(
"
\n
"
);
fclose
(
file
);
continue
;
}
...
...
@@ -123,7 +123,7 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
if
(
!
end
)
{
mdc
_files_invalid
<<
tmp
<<
_
(
" (Unexpected end of file)"
)
<<
wxT
(
"
\n
"
);
s
_files_invalid
<<
tmp
<<
_
(
" (Unexpected end of file)"
)
<<
wxT
(
"
\n
"
);
}
}
}
...
...
@@ -132,27 +132,24 @@ bool LoadFootprintFiles( const wxArrayString& libNames,
ReadDocLib
(
tmp
,
list
);
}
/* Display if there are mdc files not found */
if
(
!
mdc_files_not_found
.
IsEmpty
()
||
!
mdc
_files_invalid
.
IsEmpty
()
)
if
(
!
s_files_not_found
.
IsEmpty
()
||
!
s
_files_invalid
.
IsEmpty
()
)
{
DIALOG_LOAD_ERROR
dialog
(
NULL
);
if
(
!
mdc
_files_not_found
.
IsEmpty
()
)
if
(
!
s
_files_not_found
.
IsEmpty
()
)
{
wxString
message
=
_
(
"Some
MDC
files could not be found!"
);
wxString
message
=
_
(
"Some files could not be found!"
);
dialog
.
MessageSet
(
message
);
dialog
.
ListSet
(
mdc
_files_not_found
);
mdc
_files_not_found
.
Empty
();
dialog
.
ListSet
(
s
_files_not_found
);
s
_files_not_found
.
Empty
();
}
/* Display if there are mdc files invalid */
if
(
!
mdc
_files_invalid
.
IsEmpty
()
)
if
(
!
s
_files_invalid
.
IsEmpty
()
)
{
dialog
.
MessageSet
(
_
(
"Some
MDC
files are invalid!"
));
dialog
.
ListSet
(
mdc
_files_invalid
);
mdc
_files_invalid
.
Empty
();
dialog
.
MessageSet
(
_
(
"Some files are invalid!"
));
dialog
.
ListSet
(
s
_files_invalid
);
s
_files_invalid
.
Empty
();
}
dialog
.
ShowModal
();
}
...
...
@@ -184,7 +181,7 @@ ReadDocLib( const wxString& ModLibName,
/* Check if mdc file exists and can be opened */
if
(
(
mdc_file
=
wxFopen
(
mdc_filename
.
GetFullPath
(),
wxT
(
"rt"
)
)
)
==
NULL
)
{
mdc
_files_not_found
+=
mdc_filename
.
GetFullPath
()
+
wxT
(
"
\n
"
);
s
_files_not_found
+=
mdc_filename
.
GetFullPath
()
+
wxT
(
"
\n
"
);
return
;
}
...
...
@@ -192,7 +189,7 @@ ReadDocLib( const wxString& ModLibName,
GetLine
(
mdc_file
,
Line
,
NULL
,
sizeof
(
Line
)
-
1
);
if
(
strnicmp
(
Line
,
ENTETE_LIBDOC
,
L_ENTETE_LIB
)
!=
0
)
{
mdc
_files_invalid
+=
mdc_filename
.
GetFullPath
()
+
wxT
(
"
\n
"
);
s
_files_invalid
+=
mdc_filename
.
GetFullPath
()
+
wxT
(
"
\n
"
);
return
;
}
...
...
eeschema/netlist.cpp
View file @
ff58b0a8
...
...
@@ -83,7 +83,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
*/
{
int
NetNumber
;
int
i
,
NetCode
;
int
NetCode
;
DrawSheetPath
*
sheet
;
wxString
msg
,
activity
;
wxBusyCursor
Busy
;
...
...
@@ -97,7 +97,6 @@ void WinEDA_SchematicFrame::BuildNetListBase()
/* Build the sheet (not screen) list (flattened)*/
EDA_SheetList
SheetListList
;
i
=
0
;
/* Fill g_NetObjectslist with items used in connectivity calculation */
...
...
@@ -122,14 +121,16 @@ void WinEDA_SchematicFrame::BuildNetListBase()
sheet
=
&
(
g_NetObjectslist
[
0
]
->
m_SheetList
);
LastNetCode
=
LastBusNetCode
=
1
;
for
(
unsigned
i
=
0
,
istart
=
0
;
i
<
g_NetObjectslist
.
size
();
i
++
)
for
(
unsigned
i
i
=
0
,
istart
=
0
;
ii
<
g_NetObjectslist
.
size
();
i
i
++
)
{
if
(
g_NetObjectslist
[
i
]
->
m_SheetList
!=
*
sheet
)
NETLIST_OBJECT
*
net_item
=
g_NetObjectslist
[
ii
];
if
(
net_item
->
m_SheetList
!=
*
sheet
)
// Sheet change
{
sheet
=
&
(
g_NetObjectslist
[
i
]
->
m_SheetList
);
sheet
=
&
(
net_item
->
m_SheetList
);
istart
=
ii
;
}
switch
(
g_NetObjectslist
[
i
]
->
m_Type
)
switch
(
net_item
->
m_Type
)
{
case
NET_ITEM_UNSPECIFIED
:
wxMessageBox
(
wxT
(
"BuildNetListBase() error"
));
...
...
@@ -138,73 +139,73 @@ void WinEDA_SchematicFrame::BuildNetListBase()
case
NET_PINLABEL
:
case
NET_SHEETLABEL
:
case
NET_NOCONNECT
:
if
(
g_NetObjectslist
[
i
]
->
GetNet
()
!=
0
)
if
(
net_item
->
GetNet
()
!=
0
)
break
;
/* Deja connecte */
case
NET_SEGMENT
:
/* Controle des connexions type point a point ( Sans BUS ) */
if
(
g_NetObjectslist
[
i
]
->
GetNet
()
==
0
)
if
(
net_item
->
GetNet
()
==
0
)
{
g_NetObjectslist
[
i
]
->
SetNet
(
LastNetCode
);
net_item
->
SetNet
(
LastNetCode
);
LastNetCode
++
;
}
PointToPointConnect
(
g_NetObjectslist
[
i
]
,
0
,
istart
);
PointToPointConnect
(
net_item
,
0
,
istart
);
break
;
case
NET_JONCTION
:
/* Controle des jonction , hors BUS */
if
(
g_NetObjectslist
[
i
]
->
GetNet
()
==
0
)
if
(
net_item
->
GetNet
()
==
0
)
{
g_NetObjectslist
[
i
]
->
SetNet
(
LastNetCode
);
net_item
->
SetNet
(
LastNetCode
);
LastNetCode
++
;
}
SegmentToPointConnect
(
g_NetObjectslist
[
i
]
,
0
,
istart
);
SegmentToPointConnect
(
net_item
,
0
,
istart
);
/* Controle des jonction , sur BUS */
if
(
g_NetObjectslist
[
i
]
->
m_BusNetCode
==
0
)
if
(
net_item
->
m_BusNetCode
==
0
)
{
g_NetObjectslist
[
i
]
->
m_BusNetCode
=
LastBusNetCode
;
net_item
->
m_BusNetCode
=
LastBusNetCode
;
LastBusNetCode
++
;
}
SegmentToPointConnect
(
g_NetObjectslist
[
i
]
,
ISBUS
,
istart
);
SegmentToPointConnect
(
net_item
,
ISBUS
,
istart
);
break
;
case
NET_LABEL
:
case
NET_HIERLABEL
:
case
NET_GLOBLABEL
:
/* Controle des connexions type jonction ( Sans BUS ) */
if
(
g_NetObjectslist
[
i
]
->
GetNet
()
==
0
)
if
(
net_item
->
GetNet
()
==
0
)
{
g_NetObjectslist
[
i
]
->
SetNet
(
LastNetCode
);
net_item
->
SetNet
(
LastNetCode
);
LastNetCode
++
;
}
SegmentToPointConnect
(
g_NetObjectslist
[
i
]
,
0
,
istart
);
SegmentToPointConnect
(
net_item
,
0
,
istart
);
break
;
case
NET_SHEETBUSLABELMEMBER
:
if
(
g_NetObjectslist
[
i
]
->
m_BusNetCode
!=
0
)
if
(
net_item
->
m_BusNetCode
!=
0
)
break
;
/* Deja connecte */
case
NET_BUS
:
/* Controle des connexions type point a point mode BUS */
if
(
g_NetObjectslist
[
i
]
->
m_BusNetCode
==
0
)
if
(
net_item
->
m_BusNetCode
==
0
)
{
g_NetObjectslist
[
i
]
->
m_BusNetCode
=
LastBusNetCode
;
net_item
->
m_BusNetCode
=
LastBusNetCode
;
LastBusNetCode
++
;
}
PointToPointConnect
(
g_NetObjectslist
[
i
]
,
ISBUS
,
istart
);
PointToPointConnect
(
net_item
,
ISBUS
,
istart
);
break
;
case
NET_BUSLABELMEMBER
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
/* Controle des connexions semblables a des sur BUS */
if
(
g_NetObjectslist
[
i
]
->
GetNet
()
==
0
)
if
(
net_item
->
GetNet
()
==
0
)
{
g_NetObjectslist
[
i
]
->
m_BusNetCode
=
LastBusNetCode
;
net_item
->
m_BusNetCode
=
LastBusNetCode
;
LastBusNetCode
++
;
}
SegmentToPointConnect
(
g_NetObjectslist
[
i
]
,
ISBUS
,
istart
);
SegmentToPointConnect
(
net_item
,
ISBUS
,
istart
);
break
;
}
}
...
...
@@ -225,9 +226,9 @@ void WinEDA_SchematicFrame::BuildNetListBase()
SetStatusText
(
activity
);
/* Connections des groupes d'objets par labels identiques */
for
(
unsigned
i
=
0
;
i
<
g_NetObjectslist
.
size
();
i
++
)
for
(
unsigned
i
i
=
0
;
ii
<
g_NetObjectslist
.
size
();
i
i
++
)
{
switch
(
g_NetObjectslist
[
i
]
->
m_Type
)
switch
(
g_NetObjectslist
[
i
i
]
->
m_Type
)
{
case
NET_PIN
:
case
NET_SHEETLABEL
:
...
...
@@ -242,7 +243,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
case
NET_PINLABEL
:
case
NET_BUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
LabelConnect
(
g_NetObjectslist
[
i
]
);
LabelConnect
(
g_NetObjectslist
[
i
i
]
);
break
;
case
NET_SHEETBUSLABELMEMBER
:
...
...
@@ -265,18 +266,16 @@ void WinEDA_SchematicFrame::BuildNetListBase()
/* Connexion des hierarchies */
activity
<<
wxT
(
"; "
)
<<
_
(
"Hierar."
);
SetStatusText
(
activity
);
for
(
unsigned
i
=
0
;
i
<
g_NetObjectslist
.
size
();
i
++
)
for
(
unsigned
ii
=
0
;
ii
<
g_NetObjectslist
.
size
();
ii
++
)
{
if
(
g_NetObjectslist
[
i
]
->
m_Type
==
NET_SHEETLABEL
||
g_NetObjectslist
[
i
]
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
SheetLabelConnect
(
g_NetObjectslist
[
i
]
);
if
(
g_NetObjectslist
[
i
i
]
->
m_Type
==
NET_SHEETLABEL
||
g_NetObjectslist
[
i
i
]
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
SheetLabelConnect
(
g_NetObjectslist
[
i
i
]
);
}
/* Sort objects by NetCode */
sort
(
g_NetObjectslist
.
begin
(),
g_NetObjectslist
.
end
(),
SortItemsbyNetcode
);
#if defined(NETLIST_DEBUG) && defined(DEBUG)
std
::
cout
<<
"after qsort()
\n
"
;
dumpNetTable
();
...
...
@@ -286,22 +285,17 @@ void WinEDA_SchematicFrame::BuildNetListBase()
SetStatusText
(
activity
);
/* Compression des numeros de NetCode a des valeurs consecutives */
activity
<<
wxT
(
"; "
)
<<
_
(
"Sorting Nets"
);
SetStatusText
(
activity
);
LastNetCode
=
NetCode
=
0
;
for
(
unsigned
i
=
0
;
i
<
g_NetObjectslist
.
size
();
i
++
)
for
(
unsigned
i
i
=
0
;
ii
<
g_NetObjectslist
.
size
();
i
i
++
)
{
if
(
g_NetObjectslist
[
i
]
->
GetNet
()
!=
LastNetCode
)
if
(
g_NetObjectslist
[
i
i
]
->
GetNet
()
!=
LastNetCode
)
{
NetCode
++
;
LastNetCode
=
g_NetObjectslist
[
i
]
->
GetNet
();
LastNetCode
=
g_NetObjectslist
[
i
i
]
->
GetNet
();
}
g_NetObjectslist
[
i
]
->
SetNet
(
NetCode
);
g_NetObjectslist
[
i
i
]
->
SetNet
(
NetCode
);
}
activity
<<
wxT
(
" "
)
<<
_
(
"Done"
);
SetStatusText
(
activity
);
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
SetUnconnectedFlag
(
g_NetObjectslist
);
}
...
...
@@ -319,9 +313,9 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
* pour regroupement des NetCodes */
for
(
unsigned
i
=
0
;
i
<
g_NetObjectslist
.
size
();
i
++
)
for
(
unsigned
i
i
=
0
;
ii
<
g_NetObjectslist
.
size
();
i
i
++
)
{
NETLIST_OBJECT
*
ObjetNet
=
g_NetObjectslist
[
i
];
NETLIST_OBJECT
*
ObjetNet
=
g_NetObjectslist
[
i
i
];
if
(
ObjetNet
->
m_SheetList
!=
SheetLabel
->
m_SheetListInclude
)
continue
;
//use SheetInclude, not the sheet!!
...
...
@@ -332,12 +326,14 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
if
(
ObjetNet
->
GetNet
()
==
SheetLabel
->
GetNet
()
)
continue
;
//already connected.
wxASSERT
(
ObjetNet
->
m_Label
);
wxASSERT
(
SheetLabel
->
m_Label
);
if
(
ObjetNet
->
m_Label
->
CmpNoCase
(
*
SheetLabel
->
m_Label
)
!=
0
)
continue
;
//different names.
/* Propagation du Netcode a tous les Objets de meme NetCode */
if
(
ObjetNet
->
GetNet
()
)
PropageNetCode
(
ObjetNet
[
i
].
GetNet
(),
SheetLabel
->
GetNet
(),
0
);
PropageNetCode
(
ObjetNet
->
GetNet
(),
SheetLabel
->
GetNet
(),
0
);
else
ObjetNet
->
SetNet
(
SheetLabel
->
GetNet
()
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment