fix 2 corner case bugs in specctra import

This commit is contained in:
Dick Hollenbeck 2013-05-01 10:48:00 -05:00
parent a26e59d8ed
commit 9634fa5c07
5 changed files with 52 additions and 51 deletions

View File

@ -2,7 +2,7 @@
/*
* 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.
*
* This program is free software; you can redistribute it and/or
@ -30,6 +30,7 @@
#include <cctype>
#include <macros.h>
#include <fctsys.h>
#include <dsnlexer.h>
//#include "fctsys.h"
@ -60,6 +61,8 @@ void DSNLEXER::init()
space_in_quoted_tokens = false;
commentsAreTokens = false;
D(printf( "readerStack::count:%zu\n", readerStack.size() );)
}
@ -102,6 +105,8 @@ DSNLEXER::DSNLEXER( const KEYWORD* aKeywordTable, unsigned aKeywordCount,
DSNLEXER::~DSNLEXER()
{
D(printf( "~readerStack::count:%zu\n", readerStack.size() );)
if( iOwnReaders )
{
// delete the LINE_READERs from the stack, since I own them.

View File

@ -744,7 +744,7 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR )
if( it == aMap.end() )
{
#if 1 && defined(DEBUG)
#if 0 && defined(DEBUG)
// dump the whole darn table, there's something wrong with it.
for( it = aMap.begin(); it != aMap.end(); ++it )
{

View File

@ -1870,58 +1870,54 @@ void SPECCTRA_DB::doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR )
{
T tok;
NeedLEFT();
tok = NextTok();
if( tok==T_unit || tok==T_resolution )
while( (tok = NextTok()) != T_RIGHT )
{
growth->unit = new UNIT_RES( growth, tok );
if( tok==T_resolution )
doRESOLUTION( growth->unit );
else
doUNIT( growth->unit );
if( tok == T_EOF )
Unexpected( T_EOF );
if( NextTok() != T_LEFT )
Expecting( T_LEFT );
tok = NextTok();
}
if( tok == T_place_control )
{
if( NextTok() != T_LEFT )
if( tok != T_LEFT )
Expecting( T_LEFT );
tok = NextTok();
if( tok != T_flip_style )
Expecting( T_flip_style );
tok = NextTok();
if( tok==T_mirror_first || tok==T_rotate_first )
growth->flip_style = tok;
else
Expecting("mirror_first|rotate_first");
switch( tok )
{
case T_unit:
case T_resolution:
growth->unit = new UNIT_RES( growth, tok );
if( tok==T_resolution )
doRESOLUTION( growth->unit );
else
doUNIT( growth->unit );
break;
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 )
case T_place_control:
NeedRIGHT();
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 );
}
}
}

View File

@ -1,7 +1,7 @@
/*
* 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.
*
* This program is free software; you can redistribute it and/or
@ -3796,7 +3796,9 @@ public:
SPECCTRA_DB() :
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;
session = 0;

View File

@ -1,7 +1,7 @@
/*
* 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.
*
* This program is free software; you can redistribute it and/or
@ -94,7 +94,6 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
return;
SPECCTRA_DB db;
LOCALE_IO toggle;
try
@ -118,7 +117,7 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
/* At this point we should call Compile_Ratsnest()
* 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)
* leave the next line commented
* 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
// UI handler: void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )