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
1969a511
Commit
1969a511
authored
Jan 24, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more free specctra dsn work
parent
b8b0fc6e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
415 additions
and
104 deletions
+415
-104
dsn.cpp
pcbnew/dsn.cpp
+1
-1
specctra.cpp
pcbnew/specctra.cpp
+24
-16
specctra.h
pcbnew/specctra.h
+101
-68
specctra_export.cpp
pcbnew/specctra_export.cpp
+289
-19
No files found.
pcbnew/dsn.cpp
View file @
1969a511
...
...
@@ -737,7 +737,7 @@ L_read:
goto
exit
;
}
// else it was something like +5V,
reset head back
// else it was something like +5V,
fall through below
}
// a quoted string
...
...
pcbnew/specctra.cpp
View file @
1969a511
...
...
@@ -212,7 +212,7 @@ void SPECCTRA_DB::readTIME( time_t* time_stamp ) throw( IOError )
const
char
*
ptok
=
lexer
->
CurText
();
mytime
.
tm_mon
=
0
;
// remains
o
f we don't find a month match.
mytime
.
tm_mon
=
0
;
// remains
i
f we don't find a month match.
for
(
int
m
=
0
;
months
[
m
];
++
m
)
{
if
(
!
stricmp
(
months
[
m
],
ptok
)
)
...
...
@@ -1985,7 +1985,7 @@ void SPECCTRA_DB::doSHAPE( SHAPE* growth ) throw( IOError )
case
T_polygon
:
case
T_qarc
:
L_done_that
:
if
(
growth
->
rectangle
||
growth
->
circle
||
growth
->
path
||
growth
->
qarc
)
if
(
growth
->
Length
()
)
unexpected
(
tok
);
break
;
default
:
...
...
@@ -2000,24 +2000,32 @@ L_done_that:
switch
(
tok
)
{
case
T_rect
:
growth
->
rectangle
=
new
RECTANGLE
(
growth
);
doRECTANGLE
(
growth
->
rectangle
);
RECTANGLE
*
rectangle
;
rectangle
=
new
RECTANGLE
(
growth
);
growth
->
Append
(
rectangle
);
doRECTANGLE
(
rectangle
);
break
;
case
T_circle
:
growth
->
circle
=
new
CIRCLE
(
growth
);
doCIRCLE
(
growth
->
circle
);
CIRCLE
*
circle
;
circle
=
new
CIRCLE
(
growth
);
growth
->
Append
(
circle
);
doCIRCLE
(
circle
);
break
;
case
T_path
:
case
T_polygon
:
growth
->
path
=
new
PATH
(
growth
,
tok
);
doPATH
(
growth
->
path
);
PATH
*
path
;
path
=
new
PATH
(
growth
,
tok
);
growth
->
Append
(
path
);
doPATH
(
path
);
break
;
case
T_qarc
:
growth
->
qarc
=
new
QARC
(
growth
);
doQARC
(
growth
->
qarc
);
QARC
*
qarc
;
qarc
=
new
QARC
(
growth
);
growth
->
Append
(
qarc
);
doQARC
(
qarc
);
break
;
case
T_connect
:
...
...
@@ -3650,16 +3658,16 @@ int main( int argc, char** argv )
{
// wxString filename( wxT("/tmp/fpcroute/Sample_1sided/demo_1sided.dsn") );
// wxString filename( wxT("/tmp/testdesigns/test.dsn") );
wxString
filename
(
wxT
(
"/tmp/testdesigns/test.ses"
)
);
//
wxString filename( wxT("/tmp/specctra_big.dsn") );
//
wxString filename( wxT("/tmp/testdesigns/test.ses") );
wxString
filename
(
wxT
(
"/tmp/specctra_big.dsn"
)
);
SPECCTRA_DB
db
;
bool
failed
=
false
;
try
{
//
db.LoadPCB( filename );
db
.
LoadSESSION
(
filename
);
db
.
LoadPCB
(
filename
);
//
db.LoadSESSION( filename );
}
catch
(
IOError
ioe
)
{
...
...
@@ -3672,8 +3680,8 @@ int main( int argc, char** argv )
// export what we read in, making this test program basically a beautifier
db
.
ExportSESSION
(
wxT
(
"/tmp/export.ses"
)
);
//
db.ExportPCB( wxT("/tmp/export.dsn") );
//
db.ExportSESSION( wxT("/tmp/export.ses") );
db
.
ExportPCB
(
wxT
(
"/tmp/export.dsn"
)
);
}
...
...
pcbnew/specctra.h
View file @
1969a511
...
...
@@ -111,6 +111,11 @@ struct POINT
POINT
()
{
x
=
0
.
0
;
y
=
0
.
0
;
}
POINT
(
double
aX
,
double
aY
)
:
x
(
aX
),
y
(
aY
)
{
}
bool
operator
==
(
const
POINT
&
other
)
const
{
return
x
==
other
.
x
&&
y
==
other
.
y
;
...
...
@@ -407,6 +412,17 @@ public:
{
}
void
SetLayerId
(
const
char
*
aLayerId
)
{
layer_id
=
aLayerId
;
}
void
SetCorners
(
const
POINT
&
aPoint0
,
const
POINT
&
aPoint1
)
{
point0
=
aPoint0
;
point1
=
aPoint1
;
}
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
const
char
*
quote
=
out
->
GetQuoteChar
(
layer_id
.
c_str
()
);
...
...
@@ -439,21 +455,22 @@ public:
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
out
->
Print
(
nestLevel
,
"(%s
"
,
LEXER
::
GetTokenText
(
Type
()
)
);
out
->
Print
(
nestLevel
,
"(%s"
,
LEXER
::
GetTokenText
(
Type
()
)
);
bool
singleLine
;
if
(
rules
.
size
()
==
1
)
{
singleLine
=
true
;
out
->
Print
(
0
,
"%s)"
,
rules
.
begin
()
->
c_str
()
);
out
->
Print
(
0
,
"
%s)"
,
rules
.
begin
()
->
c_str
()
);
}
else
{
out
->
Print
(
0
,
"
\n
"
);
singleLine
=
false
;
for
(
STRINGS
::
const_iterator
i
=
rules
.
begin
();
i
!=
rules
.
end
();
++
i
)
out
->
Print
(
nestLevel
,
"%s
\n
"
,
i
->
c_str
()
);
out
->
Print
(
nestLevel
+
1
,
"%s
\n
"
,
i
->
c_str
()
);
out
->
Print
(
nestLevel
,
")"
);
}
...
...
@@ -671,6 +688,16 @@ public:
quote
,
layer_id
.
c_str
(),
quote
,
diameter
,
vertex
.
x
,
vertex
.
y
);
}
void
SetLayerId
(
const
char
*
aLayerId
)
{
layer_id
=
aLayerId
;
}
void
SetDiameter
(
double
aDiameter
)
{
diameter
=
aDiameter
;
}
};
...
...
@@ -870,28 +897,42 @@ public:
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
out
->
Print
(
nestLevel
,
"(%s
\n
"
,
LEXER
::
GetTokenText
(
Type
()
)
);
const
int
RIGHTMARGIN
=
80
;
int
perLine
=
out
->
Print
(
nestLevel
,
"(%s"
,
LEXER
::
GetTokenText
(
Type
()
)
);
for
(
STRINGS
::
iterator
i
=
padstacks
.
begin
();
i
!=
padstacks
.
end
();
++
i
)
{
if
(
perLine
>
RIGHTMARGIN
)
{
out
->
Print
(
0
,
"
\n
"
);
perLine
=
out
->
Print
(
nestLevel
+
1
,
"%s"
,
""
);
}
const
char
*
quote
=
out
->
GetQuoteChar
(
i
->
c_str
()
);
out
->
Print
(
nestLevel
+
1
,
"%s%s%s
\n
"
,
quote
,
i
->
c_str
(),
quote
);
perLine
+=
out
->
Print
(
0
,
" %s%s%s
"
,
quote
,
i
->
c_str
(),
quote
);
}
if
(
spares
.
size
()
)
{
out
->
Print
(
nestLevel
+
1
,
"(spare
\n
"
);
out
->
Print
(
0
,
"
\n
"
);
perLine
=
out
->
Print
(
nestLevel
+
1
,
"(spare"
);
for
(
STRINGS
::
iterator
i
=
spares
.
begin
();
i
!=
spares
.
end
();
++
i
)
{
if
(
perLine
>
RIGHTMARGIN
)
{
out
->
Print
(
0
,
"
\n
"
);
perLine
=
out
->
Print
(
nestLevel
+
2
,
"%s"
,
""
);
}
const
char
*
quote
=
out
->
GetQuoteChar
(
i
->
c_str
()
);
out
->
Print
(
nestLevel
+
2
,
"%s%s%s
\n
"
,
quote
,
i
->
c_str
(),
quote
);
perLine
+=
out
->
Print
(
0
,
" %s%s%s
"
,
quote
,
i
->
c_str
(),
quote
);
}
out
->
Print
(
nestLevel
+
1
,
")
\n
"
);
out
->
Print
(
0
,
")
"
);
}
out
->
Print
(
nestLevel
,
")
\n
"
);
out
->
Print
(
0
,
")
\n
"
);
}
};
...
...
@@ -1600,55 +1641,34 @@ public:
};
class
SHAPE
:
public
ELEM
class
SHAPE
:
public
ELEM
_HOLDER
{
friend
class
SPECCTRA_DB
;
DSN_T
connect
;
//----- only one of these is used, like a union -----
/*----- only one of these is used, like a union -----
single item, but now in the kids list
PATH* path; ///< used for both path and polygon
RECTANGLE* rectangle;
CIRCLE* circle;
QARC* qarc;
//---------------------------------------------------
//---------------------------------------------------
*/
WINDOWS
windows
;
public
:
SHAPE
(
ELEM
*
aParent
,
DSN_T
aType
=
T_shape
)
:
ELEM
(
aType
,
aParent
)
ELEM
_HOLDER
(
aType
,
aParent
)
{
connect
=
T_on
;
path
=
0
;
rectangle
=
0
;
circle
=
0
;
qarc
=
0
;
}
~
SHAPE
()
{
delete
path
;
delete
rectangle
;
delete
circle
;
delete
qarc
;
}
void
FormatContents
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
if
(
path
)
path
->
Format
(
out
,
nestLevel
);
else
if
(
rectangle
)
rectangle
->
Format
(
out
,
nestLevel
);
else
if
(
circle
)
circle
->
Format
(
out
,
nestLevel
);
else
if
(
qarc
)
qarc
->
Format
(
out
,
nestLevel
);
ELEM_HOLDER
::
FormatContents
(
out
,
nestLevel
);
if
(
connect
==
T_off
)
out
->
Print
(
nestLevel
,
"(connect %s)
\n
"
,
LEXER
::
GetTokenText
(
connect
)
);
...
...
@@ -1817,6 +1837,11 @@ public:
delete
rules
;
}
void
SetPadstackId
(
const
char
*
aPadstackId
)
{
padstack_id
=
aPadstackId
;
}
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
const
char
*
quote
=
out
->
GetQuoteChar
(
padstack_id
.
c_str
()
);
...
...
@@ -1865,6 +1890,7 @@ public:
return
ELEM
::
GetUnits
();
}
};
typedef
boost
::
ptr_vector
<
PADSTACK
>
PADSTACKS
;
/**
...
...
@@ -1882,7 +1908,6 @@ class LIBRARY : public ELEM
typedef
boost
::
ptr_vector
<
IMAGE
>
IMAGES
;
IMAGES
images
;
typedef
boost
::
ptr_vector
<
PADSTACK
>
PADSTACKS
;
PADSTACKS
padstacks
;
public
:
...
...
@@ -1916,6 +1941,11 @@ public:
return
ELEM
::
GetUnits
();
}
void
AddPadstack
(
PADSTACK
*
aPadstack
)
{
padstacks
.
push_back
(
aPadstack
);
}
};
...
...
@@ -2215,35 +2245,32 @@ public:
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
throw
(
IOError
)
{
const
int
RIGHTMARGIN
=
80
;
const
char
*
quote
=
out
->
GetQuoteChar
(
class_id
.
c_str
()
);
out
->
Print
(
nestLevel
,
"(%s %s%s%s"
,
LEXER
::
GetTokenText
(
Type
()
),
quote
,
class_id
.
c_str
(),
quote
);
const
int
NETGAP
=
2
;
const
int
RIGHTMARGIN
=
92
;
int
perLine
=
out
->
Print
(
nestLevel
,
"(%s %s%s%s"
,
LEXER
::
GetTokenText
(
Type
()
),
quote
,
class_id
.
c_str
(),
quote
);
int
perRow
=
RIGHTMARGIN
;
for
(
STRINGS
::
iterator
i
=
net_ids
.
begin
();
i
!=
net_ids
.
end
();
++
i
)
{
quote
=
out
->
GetQuoteChar
(
i
->
c_str
()
);
int
slength
=
strlen
(
i
->
c_str
()
);
if
(
*
quote
!=
'\0'
)
slength
+=
2
;
if
(
perRow
+
slength
+
NETGAP
>
RIGHTMARGIN
)
if
(
perLine
>
RIGHTMARGIN
)
{
out
->
Print
(
0
,
"
\n
"
);
perRow
=
0
;
perRow
+=
out
->
Print
(
nestLevel
+
1
,
"%s%s%s"
,
quote
,
i
->
c_str
(),
quote
);
}
else
{
perRow
+=
out
->
Print
(
0
,
"%*c%s%s%s"
,
NETGAP
,
' '
,
quote
,
i
->
c_str
(),
quote
);
perLine
=
out
->
Print
(
nestLevel
+
1
,
"%s"
,
""
);
}
quote
=
out
->
GetQuoteChar
(
i
->
c_str
()
);
perLine
+=
out
->
Print
(
0
,
" %s%s%s"
,
quote
,
i
->
c_str
(),
quote
);
}
bool
newLine
=
false
;
if
(
circuit
.
size
()
||
layer_rules
.
size
()
||
topology
)
{
out
->
Print
(
0
,
"
\n
"
);
newLine
=
true
;
}
for
(
STRINGS
::
iterator
i
=
circuit
.
begin
();
i
!=
circuit
.
end
();
++
i
)
out
->
Print
(
nestLevel
+
1
,
"%s
\n
"
,
i
->
c_str
()
);
...
...
@@ -2254,7 +2281,7 @@ public:
if
(
topology
)
topology
->
Format
(
out
,
nestLevel
+
1
);
out
->
Print
(
ne
stLevel
,
")
\n
"
);
out
->
Print
(
ne
wLine
?
nestLevel
:
0
,
")
\n
"
);
}
};
...
...
@@ -2444,6 +2471,9 @@ public:
perLine
+=
out
->
Print
(
0
,
"%.6g %.6g"
,
i
->
x
,
i
->
y
);
}
if
(
net_id
.
size
()
||
via_number
!=-
1
||
type
!=
T_NONE
||
attr
!=
T_NONE
||
supply
)
out
->
Print
(
0
,
" "
);
if
(
net_id
.
size
()
)
{
if
(
perLine
>
RIGHTMARGIN
)
...
...
@@ -3183,13 +3213,6 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
void
doSUPPLY_PIN
(
SUPPLY_PIN
*
growth
)
throw
(
IOError
);
/**
* Function exportEdges
* exports the EDGES_N layer of the board.
*/
void
exportEdges
(
BOARD
*
aBoard
)
throw
(
IOError
);
public
:
SPECCTRA_DB
()
...
...
@@ -3288,7 +3311,17 @@ public:
/**
* Function FromBOARD
* adds the entire BOARD to the PCB but does not write it out.
* adds the entire BOARD to the PCB but does not write it out. Note that
* the BOARD given to this function must have all the MODULEs on the component
* side of the BOARD.
*
* See void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event )
* for how this can be done before calling this function.
* @todo
* I would have liked to put the flipping logic into the ExportToSPECCTRA()
* function directly, but for some strange reason,
* void Change_Side_Module( MODULE* Module, wxDC* DC ) is a member of
* of class WinEDA_BasePcbFrame rather than class BOARD.
*
* @param aBoard The BOARD to convert to a PCB.
* @throw IOError, if the BOARD cannot be converted, and the text of the
...
...
pcbnew/specctra_export.cpp
View file @
1969a511
This diff is collapsed.
Click to expand it.
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