Naming conventions.

This commit is contained in:
Jeff Young 2023-04-01 14:11:56 +01:00
parent cea9b38815
commit 78ee542d8d
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. * 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-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 * 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
@ -2120,7 +2120,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( !IsSymbol( tok ) && tok != T_NUMBER ) if( !IsSymbol( tok ) && tok != T_NUMBER )
Expecting( "padstack_id" ); Expecting( "padstack_id" );
growth->padstack_id = CurText(); growth->m_padstack_id = CurText();
while( ( tok = NextTok() ) != T_RIGHT ) while( ( tok = NextTok() ) != T_RIGHT )
{ {
@ -2132,11 +2132,11 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
switch( tok ) switch( tok )
{ {
case T_unit: case T_unit:
if( growth->unit ) if( growth->m_unit )
Unexpected( tok ); Unexpected( tok );
growth->unit = new UNIT_RES( growth, tok ); growth->m_unit = new UNIT_RES( growth, tok );
doUNIT( growth->unit ); doUNIT( growth->m_unit );
break; break;
case T_rotate: case T_rotate:
@ -2145,7 +2145,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( tok != T_on && tok != T_off ) if( tok != T_on && tok != T_off )
Expecting( "on|off" ); Expecting( "on|off" );
growth->rotate = tok; growth->m_rotate = tok;
NeedRIGHT(); NeedRIGHT();
break; break;
@ -2155,7 +2155,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( tok != T_on && tok != T_off ) if( tok != T_on && tok != T_off )
Expecting( "on|off" ); Expecting( "on|off" );
growth->absolute = tok; growth->m_absolute = tok;
NeedRIGHT(); NeedRIGHT();
break; break;
@ -2172,7 +2172,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
if( tok != T_off && tok != T_on ) if( tok != T_off && tok != T_on )
Expecting( "off|on" ); Expecting( "off|on" );
growth->attach = tok; growth->m_attach = tok;
tok = NextTok(); tok = NextTok();
if( tok == T_LEFT ) if( tok == T_LEFT )
@ -2181,7 +2181,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
Expecting( T_use_via ); Expecting( T_use_via );
NeedSYMBOL(); NeedSYMBOL();
growth->via_id = CurText(); growth->m_via_id = CurText();
NeedRIGHT(); NeedRIGHT();
NeedRIGHT(); NeedRIGHT();
@ -2196,11 +2196,11 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth )
case T_rule: case T_rule:
if( growth->rules ) if( growth->m_rules )
Unexpected( tok ); Unexpected( tok );
growth->rules = new RULE( growth, T_rule ); growth->m_rules = new RULE( growth, T_rule );
doRULE( growth->rules ); doRULE( growth->m_rules );
break; break;
default: default:
@ -3816,20 +3816,20 @@ UNIT_RES UNIT_RES::Default( nullptr, T_resolution );
int PADSTACK::Compare( PADSTACK* lhs, PADSTACK* rhs ) int PADSTACK::Compare( PADSTACK* lhs, PADSTACK* rhs )
{ {
if( !lhs->hash.size() ) if( !lhs->m_hash.size() )
lhs->hash = lhs->makeHash(); lhs->m_hash = lhs->makeHash();
if( !rhs->hash.size() ) if( !rhs->m_hash.size() )
rhs->hash = rhs->makeHash(); rhs->m_hash = rhs->makeHash();
int result = lhs->hash.compare( rhs->hash ); int result = lhs->m_hash.compare( rhs->m_hash );
if( result ) if( result )
return result; return result;
// Via names hold the drill diameters, so we have to include those to discern // 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. // 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; return result;
} }

View File

@ -2,7 +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) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * 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 * 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
@ -2134,22 +2134,22 @@ public:
PADSTACK() : PADSTACK() :
ELEM_HOLDER( T_padstack, nullptr ) ELEM_HOLDER( T_padstack, nullptr )
{ {
unit = 0; m_unit = 0;
rotate = T_on; m_rotate = T_on;
absolute = T_off; m_absolute = T_off;
rules = 0; m_rules = 0;
attach = T_off; m_attach = T_off;
} }
~PADSTACK() ~PADSTACK()
{ {
delete unit; delete m_unit;
delete rules; delete m_rules;
} }
const std::string& GetPadstackId() const std::string& GetPadstackId()
{ {
return padstack_id; return m_padstack_id;
} }
/** /**
@ -2159,14 +2159,14 @@ public:
void SetPadstackId( const char* aPadstackId ) void SetPadstackId( const char* aPadstackId )
{ {
padstack_id = aPadstackId; m_padstack_id = aPadstackId;
} }
void Format( OUTPUTFORMATTER* out, int nestLevel ) override 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 ); FormatContents( out, nestLevel+1 );
@ -2176,8 +2176,8 @@ public:
// this factored out for use by Compare() // this factored out for use by Compare()
void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override void FormatContents( OUTPUTFORMATTER* out, int nestLevel ) override
{ {
if( unit ) if( m_unit )
unit->Format( out, nestLevel ); m_unit->Format( out, nestLevel );
// format the kids, which in this class are the shapes // format the kids, which in this class are the shapes
ELEM_HOLDER::FormatContents( out, nestLevel ); ELEM_HOLDER::FormatContents( out, nestLevel );
@ -2186,34 +2186,34 @@ public:
// spec for <attach_descriptor> says default is on, so // spec for <attach_descriptor> says default is on, so
// print the off condition to override this. // print the off condition to override this.
if( attach == T_off ) if( m_attach == T_off )
{ {
out->Print( 0, "(attach 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 if( m_rotate == T_off ) // print the non-default
out->Print( 0, "(rotate %s)", GetTokenText( rotate ) ); out->Print( 0, "(rotate %s)", GetTokenText( m_rotate ) );
if( absolute == T_on ) // print the non-default if( m_absolute == T_on ) // print the non-default
out->Print( 0, "(absolute %s)", GetTokenText( absolute ) ); out->Print( 0, "(absolute %s)", GetTokenText( m_absolute ) );
out->Print( 0, "\n" ); out->Print( 0, "\n" );
if( rules ) if( m_rules )
rules->Format( out, nestLevel ); m_rules->Format( out, nestLevel );
} }
UNIT_RES* GetUnits() const override UNIT_RES* GetUnits() const override
{ {
if( unit ) if( m_unit )
return unit; return m_unit;
return ELEM::GetUnits(); return ELEM::GetUnits();
} }
@ -2221,19 +2221,19 @@ public:
private: private:
friend class SPECCTRA_DB; 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; std::string m_padstack_id;
UNIT_RES* unit; UNIT_RES* m_unit;
/* The shapes are stored in the kids list */ /* The shapes are stored in the kids list */
DSN_T rotate; DSN_T m_rotate;
DSN_T absolute; DSN_T m_absolute;
DSN_T attach; DSN_T m_attach;
std::string via_id; std::string m_via_id;
RULE* rules; RULE* m_rules;
}; };
typedef boost::ptr_vector<PADSTACK> PADSTACKS; typedef boost::ptr_vector<PADSTACK> PADSTACKS;

View File

@ -686,7 +686,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
image->pins.push_back( pin ); 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(); EDA_ANGLE angle = pad->GetOrientation() - aFootprint->GetOrientation();
pin->SetRotation( angle.Normalize().AsDegrees() ); pin->SetRotation( angle.Normalize().AsDegrees() );
@ -1688,7 +1688,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
m_pcb->wiring->wire_vias.push_back( dsnVia ); 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() ) ); dsnVia->vertexes.push_back( mapPt( via->GetPosition() ) );
NETINFO_ITEM* net = aBoard->FindNet( netcode ); NETINFO_ITEM* net = aBoard->FindNet( netcode );
@ -1714,7 +1714,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
VIA* vias = m_pcb->structure->via; VIA* vias = m_pcb->structure->via;
for( unsigned viaNdx = 0; viaNdx < m_pcb->library->vias.size(); ++viaNdx ) 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>---------------------------------------------------- //-----<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. // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export.
// It is after the colon and before the last '_' // 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 ) if( drillStartNdx != -1 )
{ {
++drillStartNdx; // skip over the ':' ++drillStartNdx; // skip over the ':'
int drillEndNdx = aPadstack->padstack_id.rfind( '_' ); int drillEndNdx = aPadstack->m_padstack_id.rfind( '_' );
if( drillEndNdx != -1 ) if( drillEndNdx != -1 )
{ {
std::string diam_txt( aPadstack->padstack_id, std::string diam_txt( aPadstack->m_padstack_id,
drillStartNdx, drillEndNdx-drillStartNdx ); drillStartNdx, drillEndNdx-drillStartNdx );
double drill_um = strtod( diam_txt.c_str(), 0 ); double drill_um = strtod( diam_txt.c_str(), 0 );