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
cdbd1b29
Commit
cdbd1b29
authored
Mar 15, 2009
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tolerate long library lists
parent
ae72db7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+17
-9
No files found.
eeschema/load_one_schematic_file.cpp
View file @
cdbd1b29
...
@@ -81,7 +81,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -81,7 +81,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
MsgDiag
=
_
(
"Loading "
)
+
screen
->
m_FileName
;
MsgDiag
=
_
(
"Loading "
)
+
screen
->
m_FileName
;
PrintMsg
(
MsgDiag
);
PrintMsg
(
MsgDiag
);
if
(
fgets
(
Line
,
1024
-
1
,
f
)
==
NULL
if
(
fgets
(
Line
,
sizeof
(
Line
)
,
f
)
==
NULL
||
strncmp
(
Line
+
9
,
SCHEMATIC_HEAD_STRING
,
sizeof
(
SCHEMATIC_HEAD_STRING
)
-
1
)
||
strncmp
(
Line
+
9
,
SCHEMATIC_HEAD_STRING
,
sizeof
(
SCHEMATIC_HEAD_STRING
)
-
1
)
!=
0
)
!=
0
)
{
{
...
@@ -113,7 +113,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -113,7 +113,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
#endif
#endif
LineCount
++
;
LineCount
++
;
if
(
fgets
(
Line
,
1024
-
1
,
f
)
==
NULL
||
strncmp
(
Line
,
"LIBS:"
,
5
)
!=
0
)
if
(
fgets
(
Line
,
sizeof
(
Line
)
,
f
)
==
NULL
||
strncmp
(
Line
,
"LIBS:"
,
5
)
!=
0
)
{
{
MsgDiag
=
FullFileName
+
_
(
" is NOT an EESchema file!"
);
MsgDiag
=
FullFileName
+
_
(
" is NOT an EESchema file!"
);
DisplayError
(
this
,
MsgDiag
);
DisplayError
(
this
,
MsgDiag
);
...
@@ -121,6 +121,15 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -121,6 +121,15 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
return
FALSE
;
return
FALSE
;
}
}
// Read the rest of a potentially very long line. fgets() puts a '\n' into
// the buffer if the end of line was reached. Read until end of line if necessary.
if
(
Line
[
strlen
(
Line
)
-
1
]
!=
'\n'
)
{
int
c
;
while
(
!
feof
(
f
)
&&
(
c
=
fgetc
(
f
))
!=
'\n'
)
;
}
LoadLayers
(
f
,
&
LineCount
);
LoadLayers
(
f
,
&
LineCount
);
while
(
!
feof
(
f
)
&&
GetLine
(
f
,
Line
,
&
LineCount
,
sizeof
(
Line
)
)
!=
NULL
)
while
(
!
feof
(
f
)
&&
GetLine
(
f
,
Line
,
&
LineCount
,
sizeof
(
Line
)
)
!=
NULL
)
...
@@ -407,20 +416,21 @@ static void LoadLayers( FILE* f, int* linecnt )
...
@@ -407,20 +416,21 @@ static void LoadLayers( FILE* f, int* linecnt )
/* Load the Layer Struct from a file
/* Load the Layer Struct from a file
*/
*/
{
{
int
cnt
=
0
,
Number
;
int
Number
;
char
Line
[
1024
];
char
Line
[
1024
];
//int Mode,Color,Layer;
//int Mode,Color,Layer;
char
Name
[
256
];
char
Name
[
256
];
GetLine
(
f
,
Line
,
NULL
,
sizeof
(
Line
)
);
/* read line */
GetLine
(
f
,
Line
,
linecnt
,
sizeof
(
Line
)
);
/* read line */
(
*
linecnt
)
++
;
sscanf
(
Line
,
"%s %d %d"
,
Name
,
&
Number
,
&
g_LayerDescr
.
CurrentLayer
);
sscanf
(
Line
,
"%s %d %d"
,
Name
,
&
Number
,
&
g_LayerDescr
.
CurrentLayer
);
if
(
strcmp
(
Name
,
"EELAYER"
)
!=
0
)
if
(
strcmp
(
Name
,
"EELAYER"
)
!=
0
)
{
{
/* error : init par defaut */
/* error : init par defaut */
Number
=
MAX_LAYER
;
Number
=
MAX_LAYER
;
}
}
if
(
Number
<=
0
)
if
(
Number
<=
0
)
Number
=
MAX_LAYER
;
Number
=
MAX_LAYER
;
if
(
Number
>
MAX_LAYER
)
if
(
Number
>
MAX_LAYER
)
...
@@ -428,11 +438,9 @@ static void LoadLayers( FILE* f, int* linecnt )
...
@@ -428,11 +438,9 @@ static void LoadLayers( FILE* f, int* linecnt )
g_LayerDescr
.
NumberOfLayers
=
Number
;
g_LayerDescr
.
NumberOfLayers
=
Number
;
while
(
GetLine
(
f
,
Line
,
NULL
,
sizeof
(
Line
)
)
)
while
(
GetLine
(
f
,
Line
,
linecnt
,
sizeof
(
Line
)
)
)
{
{
(
*
linecnt
)
++
;
if
(
strnicmp
(
Line
,
"EELAYER END"
,
11
)
==
0
)
if
(
strnicmp
(
Line
,
"EELAYER END"
,
11
)
==
0
)
break
;
break
;
cnt
++
;
}
}
}
}
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