Naming conventions.

This commit is contained in:
Jeff Young 2023-04-01 14:11:56 +01:00
parent a8faa0e615
commit 4fbb85aa4f
4 changed files with 58 additions and 58 deletions

View File

@ -3,7 +3,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2007-2023 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
@ -2121,7 +2121,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( !IsSymbol( tok ) && tok != T_NUMBER )
Expecting( "padstack_id" );
growth->padstack_id = CurText();
growth->m_padstack_id = CurText();
while( ( tok = NextTok() ) != T_RIGHT )
{
@ -2133,11 +2133,11 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
switch( tok )
{
case T_unit:
if( growth->unit )
if( growth->m_unit )
Unexpected( tok );
growth->unit = new UNIT_RES( growth, tok );
doUNIT( growth->unit );
growth->m_unit = new UNIT_RES( growth, tok );
doUNIT( growth->m_unit );
break;
case T_rotate:
@ -2146,7 +2146,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( tok != T_on && tok != T_off )
Expecting( "on|off" );
growth->rotate = tok;
growth->m_rotate = tok;
NeedRIGHT();
break;
@ -2156,7 +2156,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( tok != T_on && tok != T_off )
Expecting( "on|off" );
growth->absolute = tok;
growth->m_absolute = tok;
NeedRIGHT();
break;
@ -2173,7 +2173,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( tok != T_off && tok != T_on )
Expecting( "off|on" );
growth->attach = tok;
growth->m_attach = tok;
tok = NextTok();
if( tok == T_LEFT )
@ -2182,7 +2182,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
Expecting( T_use_via );
NeedSYMBOL();
growth->via_id = CurText();
growth->m_via_id = CurText();
NeedRIGHT();
NeedRIGHT();
@ -2197,11 +2197,11 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
case T_rule:
if( growth->rules )
if( growth->m_rules )
Unexpected( tok );
growth->rules = new RULE( growth, T_rule );
doRULE( growth->rules );
growth->m_rules = new RULE( growth, T_rule );
doRULE( growth->m_rules );
break;
default:
@ -3817,20 +3817,20 @@ UNIT_RES UNIT_RES::Default( nullptr, T_resolution );
int PADSTACK::Compare( PADSTACK* lhs, PADSTACK* rhs )
{
if( !lhs->hash.size() )
lhs->hash = lhs->makeHash();
if( !lhs->m_hash.size() )
lhs->m_hash = lhs->makeHash();
if( !rhs->hash.size() )
rhs->hash = rhs->makeHash();
if( !rhs->m_hash.size() )
rhs->m_hash = rhs->makeHash();
int result = lhs->hash.compare( rhs->hash );
int result = lhs->m_hash.compare( rhs->m_hash );
if( result )
return result;
// Via names hold the drill diameters, so we have to include those to discern
// between two vias with same copper size but with different drill sizes.
result = lhs->padstack_id.compare( rhs->padstack_id );
result = lhs->m_padstack_id.compare( rhs->m_padstack_id );
return result;
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2007-2023 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
@ -2134,22 +2134,22 @@ public:
PADSTACK() :
ELEM_HOLDER( T_padstack, nullptr )
{
unit = 0;
rotate = T_on;
absolute = T_off;
rules = 0;
attach = T_off;
m_unit = 0;
m_rotate = T_on;
m_absolute = T_off;
m_rules = 0;
m_attach = T_off;
}
~PADSTACK()
{
delete unit;
delete rules;
delete m_unit;
delete m_rules;
}
const std::string& GetPadstackId()
{
return padstack_id;
return m_padstack_id;
}
/**
@ -2159,14 +2159,14 @@ public:
void SetPadstackId( const char* aPadstackId )
{
padstack_id = aPadstackId;
m_padstack_id = aPadstackId;
}
void Format( OUTPUTFORMATTER* out, int nestLevel ) override
{
const char* quote = out->GetQuoteChar( padstack_id.c_str() );
const char* quote = out->GetQuoteChar( m_padstack_id.c_str() );
out->Print( nestLevel, "(%s %s%s%s\n", Name(), quote, padstack_id.c_str(), quote );
out->Print( nestLevel, "(%s %s%s%s\n", Name(), quote, m_padstack_id.c_str(), quote );
FormatContents( out, nestLevel+1 );
@ -2176,8 +2176,8 @@ public:
// this factored out for use by Compare()
void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
{
if( unit )
unit->Format( out, nestLevel );
if( m_unit )
m_unit->Format( out, nestLevel );
// format the kids, which in this class are the shapes
ELEM_HOLDER::FormatContents( out, nestLevel );
@ -2186,34 +2186,34 @@ public:
// spec for <attach_descriptor> says default is on, so
// print the off condition to override this.
if( attach == T_off )
if( m_attach == T_off )
{
out->Print( 0, "(attach off)" );
}
else if( attach == T_on )
else if( m_attach == T_on )
{
const char* quote = out->GetQuoteChar( via_id.c_str() );
const char* quote = out->GetQuoteChar( m_via_id.c_str() );
out->Print( 0, "(attach on (use_via %s%s%s))", quote, via_id.c_str(), quote );
out->Print( 0, "(attach on (use_via %s%s%s))", quote, m_via_id.c_str(), quote );
}
if( rotate == T_off ) // print the non-default
out->Print( 0, "(rotate %s)", GetTokenText( rotate ) );
if( m_rotate == T_off ) // print the non-default
out->Print( 0, "(rotate %s)", GetTokenText( m_rotate ) );
if( absolute == T_on ) // print the non-default
out->Print( 0, "(absolute %s)", GetTokenText( absolute ) );
if( m_absolute == T_on ) // print the non-default
out->Print( 0, "(absolute %s)", GetTokenText( m_absolute ) );
out->Print( 0, "\n" );
if( rules )
rules->Format( out, nestLevel );
if( m_rules )
m_rules->Format( out, nestLevel );
}
UNIT_RES* GetUnits() const override
{
if( unit )
return unit;
if( m_unit )
return m_unit;
return ELEM::GetUnits();
}
@ -2221,19 +2221,19 @@ public:
private:
friend class SPECCTRA_DB;
std::string hash; ///< a hash string used by Compare(), not Format()ed/exported.
std::string m_hash; ///< a hash string used by Compare(), not Format()ed/exported.
std::string padstack_id;
UNIT_RES* unit;
std::string m_padstack_id;
UNIT_RES* m_unit;
/* The shapes are stored in the kids list */
DSN_T rotate;
DSN_T absolute;
DSN_T attach;
std::string via_id;
DSN_T m_rotate;
DSN_T m_absolute;
DSN_T m_attach;
std::string m_via_id;
RULE* rules;
RULE* m_rules;
};
typedef boost::ptr_vector<PADSTACK> PADSTACKS;

View File

@ -694,7 +694,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
image->pins.push_back( pin );
pin->padstack_id = padstack->padstack_id;
pin->padstack_id = padstack->m_padstack_id;
EDA_ANGLE angle = pad->GetOrientation() - aFootprint->GetOrientation();
pin->SetRotation( angle.Normalize().AsDegrees() );
@ -1697,7 +1697,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
m_pcb->wiring->wire_vias.push_back( dsnVia );
dsnVia->padstack_id = registered->padstack_id;
dsnVia->padstack_id = registered->m_padstack_id;
dsnVia->vertexes.push_back( mapPt( via->GetPosition() ) );
NETINFO_ITEM* net = aBoard->FindNet( netcode );
@ -1723,7 +1723,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
VIA* vias = m_pcb->structure->via;
for( unsigned viaNdx = 0; viaNdx < m_pcb->library->vias.size(); ++viaNdx )
vias->AppendVia( m_pcb->library->vias[viaNdx].padstack_id.c_str() );
vias->AppendVia( m_pcb->library->vias[viaNdx].m_padstack_id.c_str() );
}
//-----<output NETCLASSs>----------------------------------------------------

View File

@ -192,16 +192,16 @@ PCB_VIA* SPECCTRA_DB::makeVIA( WIRE_VIA*aVia, PADSTACK* aPadstack, const POINT&
// The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
// It is after the colon and before the last '_'
int drillStartNdx = aPadstack->padstack_id.find( ':' );
int drillStartNdx = aPadstack->m_padstack_id.find( ':' );
if( drillStartNdx != -1 )
{
++drillStartNdx; // skip over the ':'
int drillEndNdx = aPadstack->padstack_id.rfind( '_' );
int drillEndNdx = aPadstack->m_padstack_id.rfind( '_' );
if( drillEndNdx != -1 )
{
std::string diam_txt( aPadstack->padstack_id,
std::string diam_txt( aPadstack->m_padstack_id,
drillStartNdx, drillEndNdx-drillStartNdx );
double drill_um = strtod( diam_txt.c_str(), 0 );