Fix incorrect parsing in kicad2step when a footprint has both locked and placed options activated.
Fixes: lp:1742700 https://bugs.launchpad.net/kicad/+bug/1742700
This commit is contained in:
parent
11fa7cdaf3
commit
b327da6e5a
|
@ -2,6 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright 2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -85,22 +86,33 @@ bool KICADMODULE::Read( SEXPR::SEXPR* aEntry )
|
|||
for( size_t i = 2; i < nc && result; ++i )
|
||||
{
|
||||
child = aEntry->GetChild( i );
|
||||
std::string symname;
|
||||
|
||||
// skip the optional 'locked' attribute; due to the vagaries of the
|
||||
// skip the optional locked and/or placed attributes; due to the vagaries of the
|
||||
// kicad version of sexpr, the attribute may be a Symbol or a String
|
||||
if( i <= 2 && ( child->IsSymbol() || child->IsString() ) )
|
||||
continue;
|
||||
|
||||
if( !child->IsList() )
|
||||
if( child->IsSymbol() || child->IsString() )
|
||||
{
|
||||
std::ostringstream ostr;
|
||||
ostr << "* corrupt module in PCB file at line ";
|
||||
ostr << child->GetLineNumber() << "\n";
|
||||
wxLogMessage( "%s\n", ostr.str().c_str() );
|
||||
if( child->IsSymbol() )
|
||||
symname = child->GetSymbol();
|
||||
else if( child->IsString() )
|
||||
symname = child->GetString();
|
||||
|
||||
if( symname == "locked" || symname == "placed" )
|
||||
continue;
|
||||
|
||||
wxLogMessage( "* module descr in PCB file at line %d: unexpected keyword '%s'\n",
|
||||
child->GetLineNumber(), symname.c_str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string symname( child->GetChild( 0 )->GetSymbol() );
|
||||
if( !child->IsList() )
|
||||
{
|
||||
wxLogMessage( "* corrupt module in PCB file at line %d\n",
|
||||
child->GetLineNumber() );
|
||||
return false;
|
||||
}
|
||||
|
||||
symname = child->GetChild( 0 )->GetSymbol();
|
||||
|
||||
if( symname == "layer" )
|
||||
result = result && parseLayer( child );
|
||||
|
|
Loading…
Reference in New Issue