Added more info to kicad2step parsing failures

This commit is contained in:
Cirilo Bernardo 2017-02-01 14:49:48 +11:00 committed by Wayne Stambaugh
parent 1b9c8676df
commit cf1003955d
4 changed files with 38 additions and 25 deletions

View File

@ -39,7 +39,7 @@ bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& a
if( nchild < 3 )
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -47,7 +47,8 @@ bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& a
if( data->GetChild( 0 )->GetSymbol() != "at" )
{
std::ostringstream ostr;
ostr << "* SEXPR item is not a position string";
ostr << "* SEXPR item is not a position string (line ";
ostr << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -62,7 +63,7 @@ bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& a
else
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -77,7 +78,7 @@ bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& a
else
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -98,7 +99,7 @@ bool Get2DPositionAndRotation( SEXPR::SEXPR* data, DOUBLET& aPosition, double& a
else
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -123,7 +124,7 @@ bool Get2DCoordinate( SEXPR::SEXPR* data, DOUBLET& aCoordinate )
if( nchild < 3 )
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -138,7 +139,7 @@ bool Get2DCoordinate( SEXPR::SEXPR* data, DOUBLET& aCoordinate )
else
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -153,7 +154,7 @@ bool Get2DCoordinate( SEXPR::SEXPR* data, DOUBLET& aCoordinate )
else
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -173,7 +174,7 @@ bool Get3DCoordinate( SEXPR::SEXPR* data, TRIPLET& aCoordinate )
if( nchild < 4 )
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -192,7 +193,7 @@ bool Get3DCoordinate( SEXPR::SEXPR* data, TRIPLET& aCoordinate )
else
{
std::ostringstream ostr;
ostr << bad_position;
ostr << bad_position << " (line " << child->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -213,7 +214,7 @@ bool GetXYZRotation( SEXPR::SEXPR* data, TRIPLET& aRotation )
if( !Get3DCoordinate( data, aRotation ) )
{
std::ostringstream ostr;
ostr << bad_rotation;
ostr << bad_rotation << " (line " << data->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}

View File

@ -94,7 +94,8 @@ bool KICADMODULE::Read( SEXPR::SEXPR* aEntry )
if( !child->IsList() )
{
std::ostringstream ostr;
ostr << "* corrupt module in PCB file\n";
ostr << "* corrupt module in PCB file at line ";
ostr << child->GetLineNumber() << "\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -181,7 +182,8 @@ bool KICADMODULE::parseLayer( SEXPR::SEXPR* data )
else
{
std::ostringstream ostr;
ostr << "* corrupt module in PCB file; layer cannot be parsed\n";
ostr << "* corrupt module in PCB file (line ";
ostr << val->GetLineNumber() << "); layer cannot be parsed\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -206,7 +208,8 @@ bool KICADMODULE::parseAttribute( SEXPR::SEXPR* data )
if( data->GetNumberOfChildren() < 2 )
{
std::ostringstream ostr;
ostr << "* corrupt module in PCB file; attribute cannot be parsed\n";
ostr << "* corrupt module in PCB file (line ";
ostr << data->GetLineNumber() << "); attribute cannot be parsed\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}

View File

@ -54,7 +54,7 @@ bool KICADPAD::Read( SEXPR::SEXPR* aEntry )
if( nchild < 2 )
{
std::ostringstream ostr;
ostr << bad_pad;
ostr << bad_pad << " (line " << aEntry->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -106,7 +106,7 @@ bool KICADPAD::parseDrill( SEXPR::SEXPR* aDrill )
if( nchild < 2 )
{
std::ostringstream ostr;
ostr << bad_drill;
ostr << bad_drill << " (line " << aDrill->GetLineNumber() << ")";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -125,7 +125,8 @@ bool KICADPAD::parseDrill( SEXPR::SEXPR* aDrill )
else
{
std::ostringstream ostr;
ostr << bad_drill << " (unexpected symbol: ";
ostr << bad_drill << " (line " << child->GetLineNumber();
ostr << ") (unexpected symbol: ";
ostr << child->GetSymbol() << "), nchild = " << nchild;
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
@ -141,7 +142,8 @@ bool KICADPAD::parseDrill( SEXPR::SEXPR* aDrill )
else
{
std::ostringstream ostr;
ostr << bad_drill << " (did not find X size)";
ostr << bad_drill << " (line " << child->GetLineNumber();
ostr << ") (did not find X size)";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -170,7 +172,8 @@ bool KICADPAD::parseDrill( SEXPR::SEXPR* aDrill )
else
{
std::ostringstream ostr;
ostr << bad_drill << " (did not find Y size)";
ostr << bad_drill << " (line " << child->GetLineNumber();
ostr << ") (did not find Y size)";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}

View File

@ -234,7 +234,8 @@ bool KICADPCB::parsePCB( SEXPR::SEXPR* data )
if( !child->IsList() )
{
std::ostringstream ostr;
ostr << "* corrupt PCB file: '" << m_filename << "'\n";
ostr << "* corrupt PCB file (line " << child->GetLineNumber();
ostr << "): '" << m_filename << "'\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -278,7 +279,8 @@ bool KICADPCB::parseGeneral( SEXPR::SEXPR* data )
if( !child->IsList() )
{
std::ostringstream ostr;
ostr << "* corrupt PCB file: '" << m_filename << "'\n";
ostr << "* corrupt PCB file (line " << child->GetLineNumber();
ostr << "): '" << m_filename << "'\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -293,7 +295,8 @@ bool KICADPCB::parseGeneral( SEXPR::SEXPR* data )
}
std::ostringstream ostr;
ostr << "* corrupt PCB file: '" << m_filename << "'\n";
ostr << "* corrupt PCB file (line " << child->GetLineNumber();
ostr << "): '" << m_filename << "'\n";
ostr << "* no PCB thickness specified in general section\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
@ -313,7 +316,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
if( !child->IsList() )
{
std::ostringstream ostr;
ostr << "* corrupt PCB file: '" << m_filename << "'\n";
ostr << "* corrupt PCB file (line " << child->GetLineNumber();
ostr << "): '" << m_filename << "'\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
return false;
}
@ -325,7 +329,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
if( child->GetNumberOfChildren() != 3 )
{
std::ostringstream ostr;
ostr << "* corrupt PCB file: '" << m_filename << "'\n";
ostr << "* corrupt PCB file (line " << child->GetLineNumber();
ostr << "): '" << m_filename << "'\n";
ostr << "* grid_origin has " << child->GetNumberOfChildren();
ostr << " children (expected: 3)\n";
wxLogMessage( "%s\n", ostr.str().c_str() );
@ -342,7 +347,8 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
if( child->GetNumberOfChildren() != 3 )
{
std::ostringstream ostr;
ostr << "* corrupt PCB file: '" << m_filename << "'\n";
ostr << "* corrupt PCB file (line " << child->GetLineNumber();
ostr << "): '" << m_filename << "'\n";
ostr << "* aux_axis_origin has " << child->GetNumberOfChildren();
ostr << " children (expected: 3)\n";
wxLogMessage( "%s\n", ostr.str().c_str() );