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
8d9e314a
Commit
8d9e314a
authored
Oct 01, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check Liste at end for MyFree, assuming single point of exit
parent
71722a0b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
gen_modules_placefile.cpp
pcbnew/gen_modules_placefile.cpp
+29
-17
No files found.
pcbnew/gen_modules_placefile.cpp
View file @
8d9e314a
...
@@ -28,9 +28,12 @@ static wxPoint File_Place_Offset; /* Offset des coord de placement pour le fic
...
@@ -28,9 +28,12 @@ static wxPoint File_Place_Offset; /* Offset des coord de placement pour le fic
static
void
WriteDrawSegmentPcb
(
DRAWSEGMENT
*
PtDrawSegment
,
FILE
*
rptfile
);
static
void
WriteDrawSegmentPcb
(
DRAWSEGMENT
*
PtDrawSegment
,
FILE
*
rptfile
);
/* Routine de tri utilisee par GenereModulesPosition() */
/* Routine de tri utilisee par GenereModulesPosition() */
static
int
ListeModCmp
(
LIST_MOD
*
Ref
,
LIST_MOD
*
Cmp
)
static
int
ListeModCmp
(
const
void
*
o1
,
const
void
*
o2
)
{
{
return
StrLenNumCmp
(
Ref
->
m_Reference
,
Cmp
->
m_Reference
,
16
);
LIST_MOD
*
ref
=
(
LIST_MOD
*
)
o1
;
LIST_MOD
*
cmp
=
(
LIST_MOD
*
)
o2
;
return
StrLenNumCmp
(
ref
->
m_Reference
,
cmp
->
m_Reference
,
16
);
}
}
...
@@ -67,7 +70,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -67,7 +70,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
{
{
bool
doBoardBack
=
false
;
bool
doBoardBack
=
false
;
MODULE
*
module
;
MODULE
*
module
;
LIST_MOD
*
Liste
;
LIST_MOD
*
Liste
=
0
;
char
line
[
1024
];
char
line
[
1024
];
char
Buff
[
80
];
char
Buff
[
80
];
wxString
fnFront
;
wxString
fnFront
;
...
@@ -77,8 +80,8 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -77,8 +80,8 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
wxString
frontLayerName
;
wxString
frontLayerName
;
wxString
backLayerName
;
wxString
backLayerName
;
wxString
Title
;
wxString
Title
;
FILE
*
fpFront
=
NULL
;
FILE
*
fpFront
=
0
;
FILE
*
fpBack
=
NULL
;
FILE
*
fpBack
=
0
;
bool
switchedLocale
=
false
;
bool
switchedLocale
=
false
;
/* Calcul des echelles de conversion */
/* Calcul des echelles de conversion */
...
@@ -95,15 +98,18 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -95,15 +98,18 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
{
{
if
(
module
->
m_Attributs
&
MOD_VIRTUAL
)
if
(
module
->
m_Attributs
&
MOD_VIRTUAL
)
{
{
D
(
printf
(
"skipping module %s because its virtual
\n
"
,
CONV_TO_UTF8
(
module
->
GetReference
())
);)
D
(
printf
(
"skipping module %s because it
'
s virtual
\n
"
,
CONV_TO_UTF8
(
module
->
GetReference
())
);)
continue
;
continue
;
}
}
if
(
(
module
->
m_Attributs
&
MOD_CMS
)
==
0
)
if
(
(
module
->
m_Attributs
&
MOD_CMS
)
==
0
)
{
{
#if
0
&& defined(DEBUG) // enable this code to fix a bunch of mis-labeled modules:
#if
1
&& defined(DEBUG) // enable this code to fix a bunch of mis-labeled modules:
if
(
!
HasNonSMDPins
(
module
)
)
if
(
!
HasNonSMDPins
(
module
)
)
module->m_Attributs |= MOD_CMS; // all pins are SMD, fix the problem
{
// all module's pins are SMD, mark the part for pick and place
module
->
m_Attributs
|=
MOD_CMS
;
}
else
else
{
{
printf
(
"skipping %s because its attribute is not CMS and it has non SMD pins
\n
"
,
CONV_TO_UTF8
(
module
->
GetReference
())
);
printf
(
"skipping %s because its attribute is not CMS and it has non SMD pins
\n
"
,
CONV_TO_UTF8
(
module
->
GetReference
())
);
...
@@ -181,6 +187,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -181,6 +187,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
{
{
if
(
module
->
m_Attributs
&
MOD_VIRTUAL
)
if
(
module
->
m_Attributs
&
MOD_VIRTUAL
)
continue
;
continue
;
if
(
(
module
->
m_Attributs
&
MOD_CMS
)
==
0
)
if
(
(
module
->
m_Attributs
&
MOD_CMS
)
==
0
)
continue
;
continue
;
...
@@ -190,9 +197,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -190,9 +197,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
ii
++
;
ii
++
;
}
}
qsort
(
Liste
,
moduleCount
,
sizeof
(
LIST_MOD
),
qsort
(
Liste
,
moduleCount
,
sizeof
(
LIST_MOD
),
ListeModCmp
);
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
ListeModCmp
);
/* Generation entete du fichier 'commentaires) */
/* Generation entete du fichier 'commentaires) */
sprintf
(
line
,
"### Module positions - created on %s ###
\n
"
,
sprintf
(
line
,
"### Module positions - created on %s ###
\n
"
,
...
@@ -245,13 +250,17 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -245,13 +250,17 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
(
float
)
module_pos
.
y
*
conv_unit
,
(
float
)
module_pos
.
y
*
conv_unit
,
(
float
)
Liste
[
ii
].
m_Module
->
m_Orient
/
10
);
(
float
)
Liste
[
ii
].
m_Module
->
m_Orient
/
10
);
if
(
Liste
[
ii
].
m_Module
->
GetLayer
()
==
CMP_N
)
int
layer
=
Liste
[
ii
].
m_Module
->
GetLayer
();
wxASSERT
(
layer
==
CMP_N
||
layer
==
COPPER_LAYER_N
);
if
(
layer
==
CMP_N
)
{
{
strcat
(
line
,
CONV_TO_UTF8
(
frontLayerName
)
);
strcat
(
line
,
CONV_TO_UTF8
(
frontLayerName
)
);
strcat
(
line
,
"
\n
"
);
strcat
(
line
,
"
\n
"
);
fputs
(
line
,
fpFront
);
fputs
(
line
,
fpFront
);
}
}
else
if
(
Liste
[
ii
].
m_Module
->
GetLayer
()
==
COPPER_LAYER_N
)
else
if
(
layer
==
COPPER_LAYER_N
)
{
{
strcat
(
line
,
CONV_TO_UTF8
(
backLayerName
)
);
strcat
(
line
,
CONV_TO_UTF8
(
backLayerName
)
);
strcat
(
line
,
"
\n
"
);
strcat
(
line
,
"
\n
"
);
...
@@ -265,8 +274,6 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -265,8 +274,6 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
if
(
doBoardBack
)
if
(
doBoardBack
)
fputs
(
"## End
\n
"
,
fpBack
);
fputs
(
"## End
\n
"
,
fpBack
);
MyFree
(
Liste
);
msg
=
frontLayerName
+
wxT
(
" File: "
)
+
fnFront
;
msg
=
frontLayerName
+
wxT
(
" File: "
)
+
fnFront
;
if
(
doBoardBack
)
if
(
doBoardBack
)
...
@@ -274,7 +281,12 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
...
@@ -274,7 +281,12 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event )
DisplayInfo
(
this
,
msg
);
DisplayInfo
(
this
,
msg
);
exit
:
exit
:
// the only safe way out of here, no returns please.
if
(
Liste
)
MyFree
(
Liste
);
if
(
switchedLocale
)
if
(
switchedLocale
)
SetLocaleTo_Default
(
);
// revert to the current locale
SetLocaleTo_Default
(
);
// revert to the current locale
...
...
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