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
945c14d4
Commit
945c14d4
authored
Jan 04, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more specctra dsn work
parent
36f6103b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
16 deletions
+83
-16
dsn.cpp
pcbnew/dsn.cpp
+2
-2
dsn.h
pcbnew/dsn.h
+10
-2
specctra.cpp
pcbnew/specctra.cpp
+71
-12
No files found.
pcbnew/dsn.cpp
View file @
945c14d4
...
...
@@ -588,7 +588,7 @@ DSN_T LEXER::NextTok() throw (IOError)
char
*
cur
=
next
;
char
*
head
=
cur
;
last
Tok
=
curTok
;
prev
Tok
=
curTok
;
if
(
curTok
!=
T_EOF
)
{
...
...
@@ -613,7 +613,7 @@ L_read:
goto
L_read
;
// switching the string_quote character
if
(
last
Tok
==
T_string_quote
)
if
(
prev
Tok
==
T_string_quote
)
{
static
const
wxString
errtxt
(
_
(
"String delimiter must be a single character of ',
\"
, or $"
));
...
...
pcbnew/dsn.h
View file @
945c14d4
...
...
@@ -527,7 +527,7 @@ class LEXER
bool
space_in_quoted_tokens
;
///< blank spaces within quoted strings
wxString
filename
;
int
last
Tok
;
///< curTok from previous NextTok() call.
DSN_T
prev
Tok
;
///< curTok from previous NextTok() call.
int
curOffset
;
///< offset within current line of the current token
DSN_T
curTok
;
///< the current token obtained on last NextTok()
...
...
@@ -640,7 +640,6 @@ public:
return
curText
.
c_str
();
}
/**
* Function CurTok
* returns whatever NextTok() returned the last time it was called.
...
...
@@ -650,6 +649,15 @@ public:
return
curTok
;
}
/**
* Function PrevTok
* returns whatever NextTok() returned the 2nd to last time it was called.
*/
DSN_T
PrevTok
()
{
return
prevTok
;
}
/**
* Function CurOffset
* returns the char offset within the current line, using a 1 based index.
...
...
pcbnew/specctra.cpp
View file @
945c14d4
...
...
@@ -538,23 +538,36 @@ public:
};
/**
* Class RULE
* holds a single rule and corresponds to <rule_descriptors>
*/
class
RULE
:
public
ELEM
{
};
/**
* Class RULES
* corresponds to the <rule_descriptor> in the specctra dsn spec.
*/
class
RULES
:
public
ELEM
{
;
friend
class
SPECCTRA_DB
;
STRINGS
rules
;
///< rules are saved in std::string form.
public
:
RULES
(
ELEM
*
aParent
)
:
ELEM
(
T_rule
,
aParent
)
{
}
~
RULES
()
{
}
void
Save
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
out
->
Print
(
nestLevel
,
"(%s
\n
"
,
LEXER
::
GetTokenText
(
Type
()
)
);
for
(
STRINGS
::
const_iterator
i
=
rules
.
begin
();
i
!=
rules
.
end
();
++
i
)
out
->
Print
(
nestLevel
+
1
,
"%s
\n
"
,
i
->
c_str
()
);
out
->
Print
(
nestLevel
,
")
\n
"
);
}
};
...
...
@@ -670,6 +683,7 @@ class STRUCTURE : public ELEM
BOUNDARY
*
place_boundary
;
VIA
*
via
;
CONTROL
*
control
;
RULES
*
rules
;
typedef
boost
::
ptr_vector
<
LAYER
>
LAYERS
;
LAYERS
layers
;
...
...
@@ -684,6 +698,7 @@ public:
place_boundary
=
0
;
via
=
0
;
control
=
0
;
rules
=
0
;
}
~
STRUCTURE
()
...
...
@@ -693,6 +708,7 @@ public:
delete
place_boundary
;
delete
via
;
delete
control
;
delete
rules
;
}
void
Save
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
...
...
@@ -722,6 +738,9 @@ public:
At
(
i
)
->
Save
(
out
,
nestLevel
+
1
);
}
if
(
rules
)
rules
->
Save
(
out
,
nestLevel
+
1
);
out
->
Print
(
nestLevel
,
")
\n
"
);
}
...
...
@@ -910,6 +929,7 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
void
doVIA
(
VIA
*
growth
)
throw
(
IOError
);
void
doCONTROL
(
CONTROL
*
growth
)
throw
(
IOError
);
void
doLAYER
(
LAYER
*
growth
)
throw
(
IOError
);
void
doRULES
(
RULES
*
growth
)
throw
(
IOError
);
public
:
...
...
@@ -1338,6 +1358,11 @@ L_place:
growth
->
layers
.
push_back
(
layer
);
doLAYER
(
layer
);
break
;
case
T_rule
:
growth
->
rules
=
new
RULES
(
growth
);
doRULES
(
growth
->
rules
);
break
;
default
:
unexpected
(
lexer
->
CurText
()
);
...
...
@@ -1608,7 +1633,8 @@ void SPECCTRA_DB::doLAYER( LAYER* growth ) throw( IOError )
break
;
case
T_rule
:
// @todo
growth
->
rules
=
new
RULES
(
growth
);
doRULES
(
growth
->
rules
);
break
;
case
T_property
:
...
...
@@ -1714,6 +1740,39 @@ void SPECCTRA_DB::doLAYER( LAYER* growth ) throw( IOError )
}
void
SPECCTRA_DB
::
doRULES
(
RULES
*
growth
)
throw
(
IOError
)
{
std
::
string
builder
;
int
bracketNesting
=
1
;
// we already saw the opening T_LEFT
while
(
bracketNesting
!=
0
)
{
DSN_T
tok
=
nextTok
();
switch
(
tok
)
{
case
T_LEFT
:
++
bracketNesting
;
break
;
case
T_RIGHT
:
--
bracketNesting
;
break
;
default
:
;
}
if
(
bracketNesting
>=
1
)
{
if
(
lexer
->
PrevTok
()
!=
T_LEFT
&&
tok
!=
T_RIGHT
)
builder
+=
' '
;
builder
+=
lexer
->
CurText
();
}
if
(
bracketNesting
==
1
)
{
growth
->
rules
.
push_back
(
builder
);
builder
.
clear
();
}
}
}
void
SPECCTRA_DB
::
Print
(
int
nestLevel
,
const
char
*
fmt
,
...
)
throw
(
IOError
)
{
va_list
args
;
...
...
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