Commit 98b5cdda authored by Dick Hollenbeck's avatar Dick Hollenbeck

support new zone field ZPriority in kicad_plugin.cpp, enhance TESTLINE() so it...

support new zone field ZPriority in kicad_plugin.cpp, enhance TESTLINE() so it does not match substrings
parent 60fb3fb7
...@@ -102,14 +102,14 @@ ...@@ -102,14 +102,14 @@
#define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" ) #define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" )
/// Get the length of a string constant, at compile time
#define SZ( x ) (sizeof(x)-1)
/// C string compare test for a specific length of characters. /// C string compare test for a specific length of characters.
/// The -1 is to omit the trailing \0 which is included in sizeof() on a /// The -1 is to omit the trailing \0 which is included in sizeof() on a
/// string constant. /// string constant.
#define TESTLINE( x ) (strnicmp( line, x, sizeof(x)-1 ) == 0) #define TESTLINE( x ) ( !strnicmp( line, x, SZ( x ) ) && isspace( line[SZ( x )] ) )
/// Get the length of a string constant, at compile time
#define SZ( x ) (sizeof(x)-1)
#if 1 #if 1
...@@ -994,7 +994,6 @@ void KICAD_PLUGIN::loadMODULE() ...@@ -994,7 +994,6 @@ void KICAD_PLUGIN::loadMODULE()
module->m_KeyWord = FROM_UTF8( StrPurge( line + SZ( "Kw" ) ) ); module->m_KeyWord = FROM_UTF8( StrPurge( line + SZ( "Kw" ) ) );
} }
// test this longer similar string before the shorter ".SolderPaste"
else if( TESTLINE( ".SolderPasteRatio" ) ) else if( TESTLINE( ".SolderPasteRatio" ) )
{ {
double tmp = atof( line + SZ( ".SolderPasteRatio" ) ); double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
...@@ -1203,7 +1202,6 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule ) ...@@ -1203,7 +1202,6 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
pad->SetLocalSolderMaskMargin( tmp ); pad->SetLocalSolderMaskMargin( tmp );
} }
// test this before the similar but shorter ".SolderPaste"
else if( TESTLINE( ".SolderPasteRatio" ) ) else if( TESTLINE( ".SolderPasteRatio" ) )
{ {
double tmp = atof( line + SZ( ".SolderPasteRatio" ) ); double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
...@@ -2178,6 +2176,12 @@ void KICAD_PLUGIN::loadZONE_CONTAINER() ...@@ -2178,6 +2176,12 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
zc->SetMinThickness( thickness ); zc->SetMinThickness( thickness );
} }
else if( TESTLINE( "ZPriority" ) )
{
int priority = intParse( line + SZ( "ZPriority" ) );
zc->SetPriority( priority );
}
else if( TESTLINE( "$POLYSCORNERS" ) ) else if( TESTLINE( "$POLYSCORNERS" ) )
{ {
// Read the PolysList (polygons used for fill areas in the zone) // Read the PolysList (polygons used for fill areas in the zone)
...@@ -3419,6 +3423,9 @@ void KICAD_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const ...@@ -3419,6 +3423,9 @@ void KICAD_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
fprintf( m_fp, "ZAux %d %c\n", me->GetNumCorners(), outline_hatch ); fprintf( m_fp, "ZAux %d %c\n", me->GetNumCorners(), outline_hatch );
if( me->GetPriority() > 0 )
fprintf( m_fp, "ZPriority %d\n", me->GetPriority() );
// Save pad option and clearance // Save pad option and clearance
char padoption; char padoption;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment