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
bdadac7b
Commit
bdadac7b
authored
Feb 06, 2011
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FILE_LINE_READER owns open files by default
parent
66566f9b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
listlib.cpp
cvpcb/listlib.cpp
+17
-20
No files found.
cvpcb/listlib.cpp
View file @
bdadac7b
...
...
@@ -80,21 +80,19 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles( )
}
FILE_LINE_READER
fileReader
(
file
,
libname
);
FILTER_READER
reader
(
fileReader
);
/* Read header. */
reader
.
ReadLine
();
char
*
L
ine
=
reader
.
Line
();
StrPurge
(
L
ine
);
char
*
l
ine
=
reader
.
Line
();
StrPurge
(
l
ine
);
if
(
strnicmp
(
L
ine
,
ENTETE_LIBRAIRIE
,
L_ENTETE_LIB
)
!=
0
)
if
(
strnicmp
(
l
ine
,
ENTETE_LIBRAIRIE
,
L_ENTETE_LIB
)
!=
0
)
{
wxString
msg
;
msg
.
Printf
(
_
(
"<%s> is not a valid Kicad PCB footprint library."
),
GetChars
(
libname
)
);
files_invalid
<<
msg
<<
wxT
(
"
\n
"
);
fclose
(
file
);
continue
;
}
...
...
@@ -102,47 +100,46 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles( )
bool
end
=
false
;
while
(
!
end
&&
reader
.
ReadLine
()
)
{
L
ine
=
reader
.
Line
();
StrPurge
(
L
ine
);
if
(
strnicmp
(
L
ine
,
"$EndLIBRARY"
,
11
)
==
0
)
l
ine
=
reader
.
Line
();
StrPurge
(
l
ine
);
if
(
strnicmp
(
l
ine
,
"$EndLIBRARY"
,
11
)
==
0
)
{
end
=
true
;
break
;
}
if
(
strnicmp
(
L
ine
,
"$MODULE"
,
7
)
==
0
)
if
(
strnicmp
(
l
ine
,
"$MODULE"
,
7
)
==
0
)
{
L
ine
+=
7
;
l
ine
+=
7
;
FOOTPRINT
*
ItemLib
=
new
FOOTPRINT
();
ItemLib
->
m_Module
=
CONV_FROM_UTF8
(
StrPurge
(
L
ine
)
);
ItemLib
->
m_Module
=
CONV_FROM_UTF8
(
StrPurge
(
l
ine
)
);
ItemLib
->
m_LibName
=
libname
;
m_footprints
.
push_back
(
ItemLib
);
while
(
reader
.
ReadLine
()
)
{
L
ine
=
reader
.
Line
();
StrPurge
(
L
ine
);
if
(
strnicmp
(
L
ine
,
"$EndMODULE"
,
10
)
==
0
)
l
ine
=
reader
.
Line
();
StrPurge
(
l
ine
);
if
(
strnicmp
(
l
ine
,
"$EndMODULE"
,
10
)
==
0
)
break
;
int
id
=
((
Line
[
0
]
&
0xFF
)
<<
8
)
+
(
L
ine
[
1
]
&
0xFF
);
int
id
=
((
line
[
0
]
&
0xFF
)
<<
8
)
+
(
l
ine
[
1
]
&
0xFF
);
switch
(
id
)
{
/* KeyWords */
case
((
'K'
<<
8
)
+
'w'
):
ItemLib
->
m_KeyWord
=
CONV_FROM_UTF8
(
StrPurge
(
L
ine
+
3
)
);
ItemLib
->
m_KeyWord
=
CONV_FROM_UTF8
(
StrPurge
(
l
ine
+
3
)
);
break
;
/* Doc */
case
((
'C'
<<
8
)
+
'd'
):
ItemLib
->
m_Doc
=
CONV_FROM_UTF8
(
StrPurge
(
L
ine
+
3
)
);
ItemLib
->
m_Doc
=
CONV_FROM_UTF8
(
StrPurge
(
l
ine
+
3
)
);
break
;
}
}
}
}
fclose
(
file
);
if
(
!
end
)
{
files_invalid
<<
libname
<<
_
(
" (Unexpected end of file)"
)
<<
wxT
(
"
\n
"
);
...
...
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