Topo-R specctra import fix

This commit is contained in:
dickelbeck 2009-07-13 22:59:56 +00:00
parent d188bf5ae1
commit 8f853800e3
3 changed files with 93 additions and 10 deletions

View File

@ -4,6 +4,14 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2009-Jul-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
added support to specctra import for the <structure_out> descriptor.
<route_descriptor> had confused <structure_descriptor> with the <structure_out_descriptor>
The fix facillitates round tripping from the TOPO-R router.
2009-july-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr> 2009-july-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================ ================================================================================
++Eeschema: ++Eeschema:

View File

@ -834,6 +834,49 @@ L_place:
} }
void SPECCTRA_DB::doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IOError )
{
/*
<structure_out_descriptor >::=
(structure_out
{<layer_descriptor> }
[<rule_descriptor> ]
)
*/
DSN_T tok = nextTok();
while( tok != T_RIGHT )
{
if( tok != T_LEFT )
expecting( T_LEFT );
tok = nextTok();
switch( tok )
{
case T_layer:
LAYER* layer;
layer = new LAYER( growth );
growth->layers.push_back( layer );
doLAYER( layer );
break;
case T_rule:
if( growth->rules )
unexpected( tok );
growth->rules = new RULE( growth, T_rule );
doRULE( growth->rules );
break;
default:
unexpected( lexer->CurText() );
}
tok = nextTok();
}
}
void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth ) throw( IOError ) void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth ) throw( IOError )
{ {
DSN_T tok = nextTok(); DSN_T tok = nextTok();
@ -3303,11 +3346,11 @@ void SPECCTRA_DB::doROUTE( ROUTE* growth ) throw( IOError )
doPARSER( growth->parser ); doPARSER( growth->parser );
break; break;
case T_structure: case T_structure_out:
if( growth->structure ) if( growth->structure_out )
unexpected( tok ); unexpected( tok );
growth->structure = new STRUCTURE( growth ); growth->structure_out = new STRUCTURE_OUT( growth );
doSTRUCTURE( growth->structure ); doSTRUCTURE_OUT( growth->structure_out );
break; break;
case T_library_out: case T_library_out:

View File

@ -1320,6 +1320,8 @@ public:
} }
}; };
typedef boost::ptr_vector<LAYER> LAYERS;
class LAYER_PAIR : public ELEM class LAYER_PAIR : public ELEM
{ {
@ -1552,13 +1554,42 @@ public:
}; };
class STRUCTURE_OUT : public ELEM
{
friend class SPECCTRA_DB;
LAYERS layers;
RULE* rules;
public:
STRUCTURE_OUT( ELEM* aParent ) :
ELEM( T_structure_out, aParent )
{
rules = 0;
}
~STRUCTURE_OUT()
{
delete rules;
}
void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{
for( LAYERS::iterator i=layers.begin(); i!=layers.end(); ++i )
i->Format( out, nestLevel );
if( rules )
rules->Format( out, nestLevel );
}
};
class STRUCTURE : public ELEM_HOLDER class STRUCTURE : public ELEM_HOLDER
{ {
friend class SPECCTRA_DB; friend class SPECCTRA_DB;
UNIT_RES* unit; UNIT_RES* unit;
typedef boost::ptr_vector<LAYER> LAYERS;
LAYERS layers; LAYERS layers;
LAYER_NOISE_WEIGHT* layer_noise_weight; LAYER_NOISE_WEIGHT* layer_noise_weight;
@ -3435,7 +3466,7 @@ class ROUTE : public ELEM
UNIT_RES* resolution; UNIT_RES* resolution;
PARSER* parser; PARSER* parser;
STRUCTURE* structure; STRUCTURE_OUT* structure_out;
LIBRARY* library; LIBRARY* library;
NET_OUTS net_outs; NET_OUTS net_outs;
// TEST_POINTS* test_points; // TEST_POINTS* test_points;
@ -3447,14 +3478,14 @@ public:
{ {
resolution = 0; resolution = 0;
parser = 0; parser = 0;
structure = 0; structure_out = 0;
library = 0; library = 0;
} }
~ROUTE() ~ROUTE()
{ {
delete resolution; delete resolution;
delete parser; delete parser;
delete structure; delete structure_out;
delete library; delete library;
// delete test_points; // delete test_points;
} }
@ -3475,8 +3506,8 @@ public:
if( parser ) if( parser )
parser->Format( out, nestLevel ); parser->Format( out, nestLevel );
if( structure ) if( structure_out )
structure->Format( out, nestLevel ); structure_out->Format( out, nestLevel );
if( library ) if( library )
library->Format( out, nestLevel ); library->Format( out, nestLevel );
@ -3781,6 +3812,7 @@ class SPECCTRA_DB : public OUTPUTFORMATTER
void doRESOLUTION( UNIT_RES* growth ) throw(IOError); void doRESOLUTION( UNIT_RES* growth ) throw(IOError);
void doUNIT( UNIT_RES* growth ) throw( IOError ); void doUNIT( UNIT_RES* growth ) throw( IOError );
void doSTRUCTURE( STRUCTURE* growth ) throw( IOError ); void doSTRUCTURE( STRUCTURE* growth ) throw( IOError );
void doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IOError );
void doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth ) throw( IOError ); void doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth ) throw( IOError );
void doLAYER_PAIR( LAYER_PAIR* growth ) throw( IOError ); void doLAYER_PAIR( LAYER_PAIR* growth ) throw( IOError );
void doBOUNDARY( BOUNDARY* growth ) throw( IOError ); void doBOUNDARY( BOUNDARY* growth ) throw( IOError );