fix 2 corner case bugs in specctra import
This commit is contained in:
parent
a26e59d8ed
commit
9634fa5c07
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
#include <fctsys.h>
|
||||||
#include <dsnlexer.h>
|
#include <dsnlexer.h>
|
||||||
|
|
||||||
//#include "fctsys.h"
|
//#include "fctsys.h"
|
||||||
|
@ -60,6 +61,8 @@ void DSNLEXER::init()
|
||||||
space_in_quoted_tokens = false;
|
space_in_quoted_tokens = false;
|
||||||
|
|
||||||
commentsAreTokens = false;
|
commentsAreTokens = false;
|
||||||
|
|
||||||
|
D(printf( "readerStack::count:%zu\n", readerStack.size() );)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,6 +105,8 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
|
||||||
|
|
||||||
DSNLEXER::~DSNLEXER()
|
DSNLEXER::~DSNLEXER()
|
||||||
{
|
{
|
||||||
|
D(printf( "~readerStack::count:%zu\n", readerStack.size() );)
|
||||||
|
|
||||||
if( iOwnReaders )
|
if( iOwnReaders )
|
||||||
{
|
{
|
||||||
// delete the LINE_READERs from the stack, since I own them.
|
// delete the LINE_READERs from the stack, since I own them.
|
||||||
|
|
|
@ -744,7 +744,7 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR )
|
||||||
|
|
||||||
if( it == aMap.end() )
|
if( it == aMap.end() )
|
||||||
{
|
{
|
||||||
#if 1 && defined(DEBUG)
|
#if 0 && defined(DEBUG)
|
||||||
// dump the whole darn table, there's something wrong with it.
|
// dump the whole darn table, there's something wrong with it.
|
||||||
for( it = aMap.begin(); it != aMap.end(); ++it )
|
for( it = aMap.begin(); it != aMap.end(); ++it )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1870,58 +1870,54 @@ void SPECCTRA_DB::doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
T tok;
|
T tok;
|
||||||
|
|
||||||
NeedLEFT();
|
while( (tok = NextTok()) != T_RIGHT )
|
||||||
|
|
||||||
tok = NextTok();
|
|
||||||
if( tok==T_unit || tok==T_resolution )
|
|
||||||
{
|
{
|
||||||
growth->unit = new UNIT_RES( growth, tok );
|
if( tok == T_EOF )
|
||||||
if( tok==T_resolution )
|
Unexpected( T_EOF );
|
||||||
doRESOLUTION( growth->unit );
|
|
||||||
else
|
|
||||||
doUNIT( growth->unit );
|
|
||||||
|
|
||||||
if( NextTok() != T_LEFT )
|
if( tok != T_LEFT )
|
||||||
Expecting( T_LEFT );
|
|
||||||
tok = NextTok();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( tok == T_place_control )
|
|
||||||
{
|
|
||||||
if( NextTok() != T_LEFT )
|
|
||||||
Expecting( T_LEFT );
|
Expecting( T_LEFT );
|
||||||
|
|
||||||
tok = NextTok();
|
tok = NextTok();
|
||||||
if( tok != T_flip_style )
|
|
||||||
Expecting( T_flip_style );
|
|
||||||
|
|
||||||
tok = NextTok();
|
switch( tok )
|
||||||
if( tok==T_mirror_first || tok==T_rotate_first )
|
{
|
||||||
growth->flip_style = tok;
|
case T_unit:
|
||||||
else
|
case T_resolution:
|
||||||
Expecting("mirror_first|rotate_first");
|
growth->unit = new UNIT_RES( growth, tok );
|
||||||
|
if( tok==T_resolution )
|
||||||
|
doRESOLUTION( growth->unit );
|
||||||
|
else
|
||||||
|
doUNIT( growth->unit );
|
||||||
|
break;
|
||||||
|
|
||||||
NeedRIGHT();
|
case T_place_control:
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
NeedLEFT();
|
|
||||||
tok = NextTok();
|
|
||||||
}
|
|
||||||
|
|
||||||
while( tok == T_component )
|
|
||||||
{
|
|
||||||
COMPONENT* component = new COMPONENT( growth );
|
|
||||||
growth->components.push_back( component );
|
|
||||||
doCOMPONENT( component );
|
|
||||||
|
|
||||||
tok = NextTok();
|
|
||||||
if( tok == T_RIGHT )
|
|
||||||
return;
|
|
||||||
|
|
||||||
else if( tok == T_LEFT )
|
|
||||||
tok = NextTok();
|
tok = NextTok();
|
||||||
}
|
if( tok != T_flip_style )
|
||||||
|
Expecting( T_flip_style );
|
||||||
|
|
||||||
Unexpected( CurText() );
|
tok = NextTok();
|
||||||
|
if( tok==T_mirror_first || tok==T_rotate_first )
|
||||||
|
growth->flip_style = tok;
|
||||||
|
else
|
||||||
|
Expecting( "mirror_first|rotate_first" );
|
||||||
|
|
||||||
|
NeedRIGHT();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_component:
|
||||||
|
COMPONENT* component;
|
||||||
|
component = new COMPONENT( growth );
|
||||||
|
growth->components.push_back( component );
|
||||||
|
doCOMPONENT( component );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( tok );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2008 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -3796,7 +3796,9 @@ public:
|
||||||
SPECCTRA_DB() :
|
SPECCTRA_DB() :
|
||||||
SPECCTRA_LEXER( 0 ) // LINE_READER* == NULL, no DSNLEXER::PushReader()
|
SPECCTRA_LEXER( 0 ) // LINE_READER* == NULL, no DSNLEXER::PushReader()
|
||||||
{
|
{
|
||||||
iOwnReaders = true; // if an exception is thrown, close file.
|
// The LINE_READER will be pushed from an automatic instantiation,
|
||||||
|
// we don't own it:
|
||||||
|
wxASSERT( !iOwnReaders );
|
||||||
|
|
||||||
pcb = 0;
|
pcb = 0;
|
||||||
session = 0;
|
session = 0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -94,7 +94,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SPECCTRA_DB db;
|
SPECCTRA_DB db;
|
||||||
|
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -118,7 +117,7 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
|
|
||||||
/* At this point we should call Compile_Ratsnest()
|
/* At this point we should call Compile_Ratsnest()
|
||||||
* but this could be time consumming.
|
* but this could be time consumming.
|
||||||
* So if incorrect number of Connecred and No connected pads is accepted
|
* So if incorrect number of Connected and No connected pads is accepted
|
||||||
* until Compile_Ratsnest() is called (when track tool selected for instance)
|
* until Compile_Ratsnest() is called (when track tool selected for instance)
|
||||||
* leave the next line commented
|
* leave the next line commented
|
||||||
* Otherwise uncomment this line
|
* Otherwise uncomment this line
|
||||||
|
@ -377,7 +376,6 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// no UI code in this function, throw exception to report problems to the
|
// no UI code in this function, throw exception to report problems to the
|
||||||
// UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
|
// UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue