Commit 6d39b53e authored by Dick Hollenbeck's avatar Dick Hollenbeck

try and support Electra *.ses files

parent 45021493
...@@ -872,6 +872,41 @@ void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth ) throw( IO_ERROR ) ...@@ -872,6 +872,41 @@ void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth ) throw( IO_ERROR )
} }
void SPECCTRA_DB::doCONNECT( CONNECT* growth ) throw( IO_ERROR )
{
/* from page 143 of specctra spec:
(connect
{(terminal <object_type> [<pin_reference> ])}
)
*/
T tok = NextTok();
while( tok != T_RIGHT )
{
if( tok!=T_LEFT )
Expecting( T_LEFT );
tok = NextTok();
switch( tok )
{
case T_terminal:
// since we do not use the terminal information, simlpy toss it.
while( ( tok = NextTok() ) != T_RIGHT && tok != T_EOF )
;
break;
default:
Unexpected( CurText() );
}
tok = NextTok();
}
}
void SPECCTRA_DB::doWINDOW( WINDOW* growth ) throw( IO_ERROR ) void SPECCTRA_DB::doWINDOW( WINDOW* growth ) throw( IO_ERROR )
{ {
T tok = NextTok(); T tok = NextTok();
...@@ -2823,10 +2858,8 @@ void SPECCTRA_DB::doWIRE( WIRE* growth ) throw( IO_ERROR ) ...@@ -2823,10 +2858,8 @@ void SPECCTRA_DB::doWIRE( WIRE* growth ) throw( IO_ERROR )
case T_connect: case T_connect:
if( growth->connect ) if( growth->connect )
Unexpected( tok ); Unexpected( tok );
/* @todo
growth->connect = new CONNECT( growth ); growth->connect = new CONNECT( growth );
doCONNECT( growth->connect ); doCONNECT( growth->connect );
*/
break; break;
case T_supply: case T_supply:
...@@ -3245,7 +3278,14 @@ void SPECCTRA_DB::doROUTE( ROUTE* growth ) throw( IO_ERROR ) ...@@ -3245,7 +3278,14 @@ void SPECCTRA_DB::doROUTE( ROUTE* growth ) throw( IO_ERROR )
case T_parser: case T_parser:
if( growth->parser ) if( growth->parser )
{
#if 0 // Electra 2.9.1 emits two (parser ) elements in a row.
// Work around their bug for now.
Unexpected( tok ); Unexpected( tok );
#else
delete growth->parser;
#endif
}
growth->parser = new PARSER( growth ); growth->parser = new PARSER( growth );
doPARSER( growth->parser ); doPARSER( growth->parser );
break; break;
......
...@@ -3668,6 +3668,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER ...@@ -3668,6 +3668,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
void doCIRCLE( CIRCLE* growth ) throw( IO_ERROR ); void doCIRCLE( CIRCLE* growth ) throw( IO_ERROR );
void doQARC( QARC* growth ) throw( IO_ERROR ); void doQARC( QARC* growth ) throw( IO_ERROR );
void doWINDOW( WINDOW* growth ) throw( IO_ERROR ); void doWINDOW( WINDOW* growth ) throw( IO_ERROR );
void doCONNECT( CONNECT* growth ) throw( IO_ERROR );
void doREGION( REGION* growth ) throw( IO_ERROR ); void doREGION( REGION* growth ) throw( IO_ERROR );
void doCLASS_CLASS( CLASS_CLASS* growth ) throw( IO_ERROR ); void doCLASS_CLASS( CLASS_CLASS* growth ) throw( IO_ERROR );
void doLAYER_RULE( LAYER_RULE* growth ) throw( IO_ERROR ); void doLAYER_RULE( LAYER_RULE* growth ) throw( IO_ERROR );
......
...@@ -95,7 +95,7 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event ) ...@@ -95,7 +95,7 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
SPECCTRA_DB db; SPECCTRA_DB db;
SetLocaleTo_C_standard( ); // Switch the locale to standard C LOCALE_IO toggle;
try try
{ {
...@@ -104,8 +104,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event ) ...@@ -104,8 +104,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
} }
catch( IO_ERROR& ioe ) catch( IO_ERROR& ioe )
{ {
SetLocaleTo_Default( ); // revert to the current locale
ioe.errorText += '\n'; ioe.errorText += '\n';
ioe.errorText += _("BOARD may be corrupted, do not save it."); ioe.errorText += _("BOARD may be corrupted, do not save it.");
ioe.errorText += '\n'; ioe.errorText += '\n';
...@@ -115,8 +113,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event ) ...@@ -115,8 +113,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
return; return;
} }
SetLocaleTo_Default( ); // revert to the current locale
OnModify(); OnModify();
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
...@@ -363,8 +359,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR ) ...@@ -363,8 +359,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR )
if( !session ) if( !session )
ThrowIOError( _("Session file is missing the \"session\" section") ); ThrowIOError( _("Session file is missing the \"session\" section") );
/* Dick 16-Jan-2012: session need not have a placement section.
if( !session->placement ) if( !session->placement )
ThrowIOError( _("Session file is missing the \"placement\" section") ); ThrowIOError( _("Session file is missing the \"placement\" section") );
*/
if( !session->route ) if( !session->route )
ThrowIOError( _("Session file is missing the \"routes\" section") ); ThrowIOError( _("Session file is missing the \"routes\" section") );
...@@ -379,7 +377,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR ) ...@@ -379,7 +377,8 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR )
buildLayerMaps( aBoard ); buildLayerMaps( aBoard );
#if 1 if( session->placement )
{
// Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within
// each COMPONENT, reposition and re-orient each component and put on // each COMPONENT, reposition and re-orient each component and put on
// correct side of the board. // correct side of the board.
...@@ -437,7 +436,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR ) ...@@ -437,7 +436,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) throw( IO_ERROR )
} }
} }
} }
#endif }
routeResolution = session->route->GetUnits(); routeResolution = session->route->GetUnits();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment