support new zone field ZPriority in kicad_plugin.cpp, enhance TESTLINE() so it does not match substrings
This commit is contained in:
parent
60fb3fb7f7
commit
98b5cddab0
|
@ -102,14 +102,14 @@
|
|||
#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.
|
||||
/// The -1 is to omit the trailing \0 which is included in sizeof() on a
|
||||
/// string constant.
|
||||
#define TESTLINE( x ) (strnicmp( line, x, sizeof(x)-1 ) == 0)
|
||||
|
||||
/// Get the length of a string constant, at compile time
|
||||
#define SZ( x ) (sizeof(x)-1)
|
||||
#define TESTLINE( x ) ( !strnicmp( line, x, SZ( x ) ) && isspace( line[SZ( x )] ) )
|
||||
|
||||
|
||||
#if 1
|
||||
|
@ -994,7 +994,6 @@ void KICAD_PLUGIN::loadMODULE()
|
|||
module->m_KeyWord = FROM_UTF8( StrPurge( line + SZ( "Kw" ) ) );
|
||||
}
|
||||
|
||||
// test this longer similar string before the shorter ".SolderPaste"
|
||||
else if( TESTLINE( ".SolderPasteRatio" ) )
|
||||
{
|
||||
double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
|
||||
|
@ -1203,7 +1202,6 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
|||
pad->SetLocalSolderMaskMargin( tmp );
|
||||
}
|
||||
|
||||
// test this before the similar but shorter ".SolderPaste"
|
||||
else if( TESTLINE( ".SolderPasteRatio" ) )
|
||||
{
|
||||
double tmp = atof( line + SZ( ".SolderPasteRatio" ) );
|
||||
|
@ -2178,6 +2176,12 @@ void KICAD_PLUGIN::loadZONE_CONTAINER()
|
|||
zc->SetMinThickness( thickness );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "ZPriority" ) )
|
||||
{
|
||||
int priority = intParse( line + SZ( "ZPriority" ) );
|
||||
zc->SetPriority( priority );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "$POLYSCORNERS" ) )
|
||||
{
|
||||
// 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
|
|||
|
||||
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
|
||||
char padoption;
|
||||
|
||||
|
|
Loading…
Reference in New Issue