← Back to team overview

kicad-developers team mailing list archive

[PATCH 17/27] ElectricPinType: Rename PIN_NMAX to PINTYPE_COUNT

 

---
 eeschema/dialogs/dialog_erc.cpp | 14 +++++++-------
 eeschema/dialogs/dialog_erc.h   |  6 +++---
 eeschema/erc.cpp                |  6 +++---
 eeschema/lib_pin.cpp            |  6 +++---
 eeschema/pin_type.h             |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index c745ee6..2e01b90 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -54,7 +54,7 @@ bool DIALOG_ERC::m_writeErcFile = false;
 
 
 BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
-    EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PIN_NMAX * PIN_NMAX ) - 1,
+    EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PINTYPE_COUNT * PINTYPE_COUNT ) - 1,
                        wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
 END_EVENT_TABLE()
 
@@ -82,8 +82,8 @@ void DIALOG_ERC::Init()
 {
     m_initialized = false;
 
-    for( int ii = 0; ii < PIN_NMAX; ii++ )
-        for( int jj = 0; jj < PIN_NMAX; jj++ )
+    for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
+        for( int jj = 0; jj < PINTYPE_COUNT; jj++ )
             m_buttonList[ii][jj] = NULL;
 
     m_WriteResultOpt->SetValue( m_writeErcFile );
@@ -266,7 +266,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
     if( m_initialized == false )
     {
         // Print row labels
-        for( int ii = 0; ii < PIN_NMAX; ii++ )
+        for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
         {
             int y = pos.y + (ii * bitmap_size.y);
             text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
@@ -281,7 +281,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
     else
         pos = m_buttonList[0][0]->GetPosition();
 
-    for( int ii = 0; ii < PIN_NMAX; ii++ )
+    for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
     {
         int y = pos.y + (ii * bitmap_size.y);
 
@@ -299,7 +299,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
                 text     = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
             }
 
-            int event_id = ID_MATRIX_0 + ii + ( jj * PIN_NMAX );
+            int event_id = ID_MATRIX_0 + ii + ( jj * PINTYPE_COUNT );
             BITMAP_DEF bitmap_butt = erc_green_xpm;
 
             delete m_buttonList[ii][jj];
@@ -393,7 +393,7 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
     wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
     pos  = butt->GetPosition();
 
-    x = ii / PIN_NMAX; y = ii % PIN_NMAX;
+    x = ii / PINTYPE_COUNT; y = ii % PINTYPE_COUNT;
 
     level = DiagErc[y][x];
 
diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h
index 13955f1..cb9f521 100644
--- a/eeschema/dialogs/dialog_erc.h
+++ b/eeschema/dialogs/dialog_erc.h
@@ -32,9 +32,9 @@
 #include <dialog_erc_base.h>
 
 /* Variable locales */
-extern int           DiagErc[PIN_NMAX][PIN_NMAX];
+extern int           DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 extern bool          DiagErcTableInit; // go to true after DiagErc init
-extern int           DefaultDiagErc[PIN_NMAX][PIN_NMAX];
+extern int           DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 
 /*  Control identifiers */
 #define ID_MATRIX_0 1800
@@ -49,7 +49,7 @@ class DIALOG_ERC : public DIALOG_ERC_BASE
 
 private:
     SCH_EDIT_FRAME* m_parent;
-    wxBitmapButton* m_buttonList[PIN_NMAX][PIN_NMAX];
+    wxBitmapButton* m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT];
     bool            m_initialized;
     const SCH_MARKER* m_lastMarkerFound;
     static bool     m_writeErcFile;
diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp
index c21a253..7d78cd1 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -118,7 +118,7 @@ const wxString CommentERC_V[] =
  *  Can be modified by ERC options.
  *  at start up: must be loaded by DefaultDiagErc
  */
-int  DiagErc[PIN_NMAX][PIN_NMAX];
+int  DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 bool DiagErcTableInit;       // go to true after DiagErc init
 
 /**
@@ -128,7 +128,7 @@ bool DiagErcTableInit;       // go to true after DiagErc init
  *  note also, to avoid inconsistancy:
  *    DefaultDiagErc[i][j] = DefaultDiagErc[j][i]
  */
-int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
+int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT] =
 {
 /*         I,   O,    Bi,   3S,   Pas,  UnS,  PwrI, PwrO, OC,   OE,   NC */
 /* I */  { OK,  OK,   OK,   OK,   OK,   WAR,  OK,   OK,   OK,   OK,   ERR },
@@ -155,7 +155,7 @@ int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
  * in net.  Nets are OK when their final state is NET_NC or DRV.   Nets with the state
  * NOD have no valid source signal.
  */
-static int MinimalReq[PIN_NMAX][PIN_NMAX] =
+static int MinimalReq[PINTYPE_COUNT][PINTYPE_COUNT] =
 {
 /*         In   Out, Bi,  3S,  Pas, UnS, PwrI,PwrO,OC,  OE,  NC */
 /* In*/  { NOD, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index 58d0c48..a47d815 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -92,7 +92,7 @@ static const BITMAP_DEF iconsPinsElectricalType[] =
 
 const wxString LIB_PIN::GetCanonicalElectricalTypeName( ElectricPinType aType )
 {
-    assert( aType >= 0 && aType < PIN_NMAX );
+    assert( aType >= 0 && aType < PINTYPE_COUNT );
 
     // These strings are the canonical name of the electrictal type
     // Not translated, no space in name, only ASCII chars.
@@ -113,7 +113,7 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( ElectricPinType aType )
         wxT( "NotConnected" )
     };
 
-    if( aType > PIN_NMAX )
+    if( aType > PINTYPE_COUNT )
         return wxT( "???" );
 
     return msgPinElectricType[ aType ];
@@ -354,7 +354,7 @@ void LIB_PIN::SetShape( PinShape aShape )
 
 void LIB_PIN::SetType( ElectricPinType aType )
 {
-    assert( aType >= 0 && aType < PIN_NMAX );
+    assert( aType >= 0 && aType < PINTYPE_COUNT );
 
     if( m_type != aType )
     {
diff --git a/eeschema/pin_type.h b/eeschema/pin_type.h
index 8ae72e5..f525347 100644
--- a/eeschema/pin_type.h
+++ b/eeschema/pin_type.h
@@ -43,7 +43,7 @@ enum ElectricPinType {
     PIN_OPENCOLLECTOR,
     PIN_OPENEMITTER,
     PIN_NC,             /* No connect */
-    PIN_NMAX            /* End of List (no used as pin type) */
+    PINTYPE_COUNT       /* End of List (no used as pin type) */
 };
 
 #endif

Follow ups

References