← Back to team overview

kicad-developers team mailing list archive

[PATCH 11/19] ElectricPinType: Rename PIN_NMAX to PINTYPE_COUNT

 

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

diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp
index 87acb30..19f480e 100644
--- a/eeschema/dialogs/dialog_erc.cpp
+++ b/eeschema/dialogs/dialog_erc.cpp
@@ -49,8 +49,8 @@
 #include <erc.h>
 #include <id.h>
 
-extern int           DiagErc[PIN_NMAX][PIN_NMAX];
-extern int           DefaultDiagErc[PIN_NMAX][PIN_NMAX];
+extern int           DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
+extern int           DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 
 
 
@@ -63,7 +63,7 @@ bool DIALOG_ERC::m_tstUniqueGlobalLabels = true;    // saved only for the curren
 #define ID_MATRIX_0 1800
 
 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()
 
@@ -91,9 +91,9 @@ void DIALOG_ERC::Init()
 {
     m_initialized = false;
 
-    for( int ii = 0; ii < PIN_NMAX; ii++ )
+    for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
     {
-        for( int jj = 0; jj < PIN_NMAX; jj++ )
+        for( int jj = 0; jj < PINTYPE_COUNT; jj++ )
             m_buttonList[ii][jj] = NULL;
     }
 
@@ -290,7 +290,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],
@@ -305,7 +305,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);
 
@@ -323,7 +323,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];
@@ -420,7 +420,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 d7d9ff8..9cce8b1 100644
--- a/eeschema/dialogs/dialog_erc.h
+++ b/eeschema/dialogs/dialog_erc.h
@@ -27,7 +27,7 @@
 
 #include <wx/htmllbox.h>
 #include <vector>
-#include <lib_pin.h>        // For PIN_NMAX definition
+#include <lib_pin.h>        // For PINTYPE_COUNT definition
 
 #include <dialog_erc_base.h>
 #include "dialog_erc_listbox.h"
@@ -40,7 +40,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 a7f1b58..2e531b1 100644
--- a/eeschema/erc.cpp
+++ b/eeschema/erc.cpp
@@ -121,7 +121,7 @@ const wxString CommentERC_V[] =
  *  at start up: must be loaded by DefaultDiagErc
  *  Can be modified in dialog ERC
  */
-int  DiagErc[PIN_NMAX][PIN_NMAX];
+int  DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
 
 /**
  * Default Look up table which gives the ERC error level for a pair of connected pins
@@ -130,7 +130,7 @@ int  DiagErc[PIN_NMAX][PIN_NMAX];
  *  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 },
@@ -157,7 +157,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 ed6d4e4..e210d11 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