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
4e97b4e1
Commit
4e97b4e1
authored
Dec 28, 2010
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changes
parent
27dea782
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
8 deletions
+30
-8
kicad_exceptions.h
include/kicad_exceptions.h
+5
-0
sch_dir_lib_source.cpp
new/sch_dir_lib_source.cpp
+10
-4
sch_lib_table.cpp
new/sch_lib_table.cpp
+15
-4
No files found.
include/kicad_exceptions.h
View file @
4e97b4e1
...
@@ -42,6 +42,11 @@ struct IO_ERROR
...
@@ -42,6 +42,11 @@ struct IO_ERROR
{
{
wxString
errorText
;
wxString
errorText
;
IO_ERROR
(
const
wxChar
*
aMsg
)
:
errorText
(
aMsg
)
{
}
IO_ERROR
(
const
wxString
&
aMsg
)
:
IO_ERROR
(
const
wxString
&
aMsg
)
:
errorText
(
aMsg
)
errorText
(
aMsg
)
{
{
...
...
new/sch_dir_lib_source.cpp
View file @
4e97b4e1
...
@@ -50,7 +50,6 @@ using namespace SCH;
...
@@ -50,7 +50,6 @@ using namespace SCH;
#include <sys/stat.h>
#include <sys/stat.h>
#include <cstring>
#include <cstring>
#include <cstdio>
#include <cstdio>
#include <ctype.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
...
@@ -66,6 +65,7 @@ using namespace std;
...
@@ -66,6 +65,7 @@ using namespace std;
/// implementation, and to a corresponding LIB_SINK.
/// implementation, and to a corresponding LIB_SINK.
/// Core EESCHEMA should never have to see this.
/// Core EESCHEMA should never have to see this.
#define SWEET_EXT ".part"
#define SWEET_EXT ".part"
#define SWEET_EXTZ (sizeof(SWEET_EXT)-1)
/* __func__ is C99 prescribed, but just in case:
/* __func__ is C99 prescribed, but just in case:
...
@@ -141,6 +141,12 @@ static const char* strrstr( const char* haystack, const char* needle )
...
@@ -141,6 +141,12 @@ static const char* strrstr( const char* haystack, const char* needle )
}
}
static
inline
bool
isDigit
(
char
c
)
{
return
c
>=
'0'
&&
c
<=
'9'
;
}
/**
/**
* Function endsWithRev
* Function endsWithRev
* returns a pointer to the final string segment: "revN[N..]" or NULL if none.
* returns a pointer to the final string segment: "revN[N..]" or NULL if none.
...
@@ -154,7 +160,7 @@ static const char* endsWithRev( const char* start, const char* tail, char separa
...
@@ -154,7 +160,7 @@ static const char* endsWithRev( const char* start, const char* tail, char separa
{
{
bool
sawDigit
=
false
;
bool
sawDigit
=
false
;
while
(
tail
>
start
&&
is
d
igit
(
*--
tail
)
)
while
(
tail
>
start
&&
is
D
igit
(
*--
tail
)
)
{
{
sawDigit
=
true
;
sawDigit
=
true
;
}
}
...
@@ -237,7 +243,7 @@ bool DIR_LIB_SOURCE::makePartName( STRING* aPartName, const char* aEntry,
...
@@ -237,7 +243,7 @@ bool DIR_LIB_SOURCE::makePartName( STRING* aPartName, const char* aEntry,
// If versioning, then must find a trailing "revN.." type of string.
// If versioning, then must find a trailing "revN.." type of string.
if
(
useVersioning
)
if
(
useVersioning
)
{
{
const
char
*
rev
=
endsWithRev
(
cp
+
sizeof
(
SWEET_EXT
)
-
1
,
limit
,
'.'
);
const
char
*
rev
=
endsWithRev
(
cp
+
SWEET_EXTZ
,
limit
,
'.'
);
if
(
rev
)
if
(
rev
)
{
{
if
(
aCategory
.
size
()
)
if
(
aCategory
.
size
()
)
...
@@ -397,7 +403,7 @@ void DIR_LIB_SOURCE::GetCategoricalPartNames( STRINGS* aResults, const STRING& a
...
@@ -397,7 +403,7 @@ void DIR_LIB_SOURCE::GetCategoricalPartNames( STRINGS* aResults, const STRING& a
while
(
it
!=
limit
)
while
(
it
!=
limit
)
{
{
const
char
*
rev
=
endsWithRev
(
*
it
,
'/'
);
const
char
*
rev
=
endsWithRev
(
*
it
,
'/'
);
// all cached partnames have a rev string in useVersioning mode
// all cached partnames have a rev string in useVersioning mode
assert
(
rev
);
assert
(
rev
);
...
...
new/sch_lib_table.cpp
View file @
4e97b4e1
...
@@ -171,11 +171,10 @@ const LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName )
...
@@ -171,11 +171,10 @@ const LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName )
// ptr_map<> was used instead of ptr_set<>, which would have required
// ptr_map<> was used instead of ptr_set<>, which would have required
// instantiating a ROW just to find a ROW.
// instantiating a ROW just to find a ROW.
LIB_TABLE
*
cur
=
this
;
LIB_TABLE
*
cur
=
this
;
ROWS_CITER
it
;
do
do
{
{
it
=
cur
->
rows
.
find
(
aLogicalName
);
ROWS_CITER
it
=
cur
->
rows
.
find
(
aLogicalName
);
if
(
it
!=
cur
->
rows
.
end
()
)
if
(
it
!=
cur
->
rows
.
end
()
)
{
{
...
@@ -192,9 +191,11 @@ const LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName )
...
@@ -192,9 +191,11 @@ const LIB_TABLE::ROW* LIB_TABLE::FindRow( const STRING& aLogicalName )
bool
LIB_TABLE
::
InsertRow
(
auto_ptr
<
ROW
>&
aRow
,
bool
doReplace
)
bool
LIB_TABLE
::
InsertRow
(
auto_ptr
<
ROW
>&
aRow
,
bool
doReplace
)
{
{
ROWS_ITER
it
=
rows
.
find
(
aRow
->
logicalName
);
// this does not need to be super fast.
if
(
doReplace
||
it
==
rows
.
end
()
)
ROWS_CITER
it
=
rows
.
find
(
aRow
->
logicalName
);
if
(
it
==
rows
.
end
()
)
{
{
// be careful here, key is needed because aRow can be
// be careful here, key is needed because aRow can be
// release()ed before logicalName is captured.
// release()ed before logicalName is captured.
...
@@ -202,6 +203,16 @@ bool LIB_TABLE::InsertRow( auto_ptr<ROW>& aRow, bool doReplace )
...
@@ -202,6 +203,16 @@ bool LIB_TABLE::InsertRow( auto_ptr<ROW>& aRow, bool doReplace )
rows
.
insert
(
key
,
aRow
);
rows
.
insert
(
key
,
aRow
);
return
true
;
return
true
;
}
}
else
if
(
doReplace
)
{
rows
.
erase
(
aRow
->
logicalName
);
// be careful here, key is needed because aRow can be
// release()ed before logicalName is captured.
const
STRING
&
key
=
aRow
->
logicalName
;
rows
.
insert
(
key
,
aRow
);
return
true
;
}
return
false
;
return
false
;
}
}
...
...
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