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.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* 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 )
|
for( size_t i = 2; i < nc && result; ++i )
|
||||||
{
|
{
|
||||||
child = aEntry->GetChild( 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
|
// kicad version of sexpr, the attribute may be a Symbol or a String
|
||||||
if( i <= 2 && ( child->IsSymbol() || child->IsString() ) )
|
if( child->IsSymbol() || child->IsString() )
|
||||||
continue;
|
|
||||||
|
|
||||||
if( !child->IsList() )
|
|
||||||
{
|
{
|
||||||
std::ostringstream ostr;
|
if( child->IsSymbol() )
|
||||||
ostr << "* corrupt module in PCB file at line ";
|
symname = child->GetSymbol();
|
||||||
ostr << child->GetLineNumber() << "\n";
|
else if( child->IsString() )
|
||||||
wxLogMessage( "%s\n", ostr.str().c_str() );
|
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;
|
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" )
|
if( symname == "layer" )
|
||||||
result = result && parseLayer( child );
|
result = result && parseLayer( child );
|
||||||
|
|
Loading…
Reference in New Issue