diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 54004bd00d..03ce7a46a9 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -559,8 +559,8 @@ set( PCB_COMMON_SRCS fp_lib_table.cpp hash_eda.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_base_frame.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/pcb_expr_evaluator.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/pcb_expr_functions.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/pcbexpr_evaluator.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/pcbexpr_functions.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_commit.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_connected_item.cpp ${CMAKE_SOURCE_DIR}/pcbnew/board_design_settings.cpp diff --git a/pcbnew/connectivity/from_to_cache.cpp b/pcbnew/connectivity/from_to_cache.cpp index f27441942c..abbcf04c19 100644 --- a/pcbnew/connectivity/from_to_cache.cpp +++ b/pcbnew/connectivity/from_to_cache.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/pcbnew/dialogs/panel_setup_rules.cpp b/pcbnew/dialogs/panel_setup_rules.cpp index 147e3fd924..894860c9f9 100644 --- a/pcbnew/dialogs/panel_setup_rules.cpp +++ b/pcbnew/dialogs/panel_setup_rules.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -457,7 +457,7 @@ void PANEL_SETUP_RULES::onScintillaCharAdded( wxStyledTextEvent &aEvent ) for( const wxString& propName : propNames ) tokens += wxT( "|" ) + propName; - PCB_EXPR_BUILTIN_FUNCTIONS& functions = PCB_EXPR_BUILTIN_FUNCTIONS::Instance(); + PCBEXPR_BUILTIN_FUNCTIONS& functions = PCBEXPR_BUILTIN_FUNCTIONS::Instance(); for( const wxString& funcSig : functions.GetSignatures() ) { diff --git a/pcbnew/drc/drc_rule.h b/pcbnew/drc/drc_rule.h index 62d79c4d16..1d16f483e8 100644 --- a/pcbnew/drc/drc_rule.h +++ b/pcbnew/drc/drc_rule.h @@ -36,7 +36,7 @@ #include class BOARD_ITEM; -class PCB_EXPR_UCODE; +class PCBEXPR_UCODE; class DRC_CONSTRAINT; class DRC_RULE_CONDITION; diff --git a/pcbnew/drc/drc_rule_condition.cpp b/pcbnew/drc/drc_rule_condition.cpp index 6dce18eee4..d3e31f5007 100644 --- a/pcbnew/drc/drc_rule_condition.cpp +++ b/pcbnew/drc/drc_rule_condition.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include DRC_RULE_CONDITION::DRC_RULE_CONDITION( const wxString& aExpression ) : @@ -54,7 +54,7 @@ bool DRC_RULE_CONDITION::EvaluateFor( const BOARD_ITEM* aItemA, const BOARD_ITEM return false; } - PCB_EXPR_CONTEXT ctx( aConstraint, aLayer ); + PCBEXPR_CONTEXT ctx( aConstraint, aLayer ); if( aReporter ) { @@ -88,7 +88,7 @@ bool DRC_RULE_CONDITION::EvaluateFor( const BOARD_ITEM* aItemA, const BOARD_ITEM bool DRC_RULE_CONDITION::Compile( REPORTER* aReporter, int aSourceLine, int aSourceOffset ) { - PCB_EXPR_COMPILER compiler( new PCB_UNIT_RESOLVER() ); + PCBEXPR_COMPILER compiler( new PCBEXPR_UNIT_RESOLVER() ); if( aReporter ) { @@ -107,9 +107,9 @@ bool DRC_RULE_CONDITION::Compile( REPORTER* aReporter, int aSourceLine, int aSou } ); } - m_ucode = std::make_unique(); + m_ucode = std::make_unique(); - PCB_EXPR_CONTEXT preflightContext( 0, F_Cu ); + PCBEXPR_CONTEXT preflightContext( 0, F_Cu ); bool ok = compiler.Compile( GetExpression().ToUTF8().data(), m_ucode.get(), &preflightContext ); return ok; diff --git a/pcbnew/drc/drc_rule_condition.h b/pcbnew/drc/drc_rule_condition.h index c7208ac543..aa81b99d4d 100644 --- a/pcbnew/drc/drc_rule_condition.h +++ b/pcbnew/drc/drc_rule_condition.h @@ -28,7 +28,7 @@ #include class BOARD_ITEM; -class PCB_EXPR_UCODE; +class PCBEXPR_UCODE; class REPORTER; @@ -47,8 +47,8 @@ public: wxString GetExpression() const { return m_expression; } private: - wxString m_expression; - std::unique_ptr m_ucode; + wxString m_expression; + std::unique_ptr m_ucode; }; diff --git a/pcbnew/drc/drc_rule_parser.cpp b/pcbnew/drc/drc_rule_parser.cpp index d31c326c46..ca2838d593 100644 --- a/pcbnew/drc/drc_rule_parser.cpp +++ b/pcbnew/drc/drc_rule_parser.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include using namespace DRCRULE_T; @@ -584,8 +584,8 @@ void DRC_RULES_PARSER::parseValueWithUnits( const wxString& aExpr, int& aResult, } }; - PCB_EXPR_EVALUATOR evaluator( aUnitless ? (LIBEVAL::UNIT_RESOLVER*) new PCB_UNITLESS_RESOLVER() - : (LIBEVAL::UNIT_RESOLVER*) new PCB_UNIT_RESOLVER() ); + PCBEXPR_EVALUATOR evaluator( aUnitless ? (LIBEVAL::UNIT_RESOLVER*) new PCBEXPR_UNITLESS_RESOLVER() + : (LIBEVAL::UNIT_RESOLVER*) new PCBEXPR_UNIT_RESOLVER() ); evaluator.SetErrorCallback( errorHandler ); evaluator.Evaluate( aExpr ); diff --git a/pcbnew/drc/drc_test_provider_matched_length.cpp b/pcbnew/drc/drc_test_provider_matched_length.cpp index 7c0c19724b..ab2f4b717b 100644 --- a/pcbnew/drc/drc_test_provider_matched_length.cpp +++ b/pcbnew/drc/drc_test_provider_matched_length.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include /* Single-ended matched length + skew + via count test. diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcbexpr_evaluator.cpp similarity index 73% rename from pcbnew/pcb_expr_evaluator.cpp rename to pcbnew/pcbexpr_evaluator.cpp index eeffcf04e4..be71a36a99 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcbexpr_evaluator.cpp @@ -26,27 +26,27 @@ #include #include #include -#include +#include #include /* -------------------------------------------------------------------------------------------- * Specialized Expression References */ -BOARD_ITEM* PCB_EXPR_VAR_REF::GetObject( const LIBEVAL::CONTEXT* aCtx ) const +BOARD_ITEM* PCBEXPR_VAR_REF::GetObject( const LIBEVAL::CONTEXT* aCtx ) const { - wxASSERT( dynamic_cast( aCtx ) ); + wxASSERT( dynamic_cast( aCtx ) ); - const PCB_EXPR_CONTEXT* ctx = static_cast( aCtx ); - BOARD_ITEM* item = ctx->GetItem( m_itemIndex ); + const PCBEXPR_CONTEXT* ctx = static_cast( aCtx ); + BOARD_ITEM* item = ctx->GetItem( m_itemIndex ); return item; } -class PCB_LAYER_VALUE : public LIBEVAL::VALUE +class PCBEXPR_LAYER_VALUE : public LIBEVAL::VALUE { public: - PCB_LAYER_VALUE( PCB_LAYER_ID aLayer ) : + PCBEXPR_LAYER_VALUE( PCB_LAYER_ID aLayer ) : LIBEVAL::VALUE( LayerName( aLayer ) ), m_layer( aLayer ) {}; @@ -59,7 +59,7 @@ public: wxPGChoices& layerMap = ENUM_MAP::Instance().Choices(); const wxString& layerName = b->AsString(); - BOARD* board = static_cast( aCtx )->GetBoard(); + BOARD* board = static_cast( aCtx )->GetBoard(); std::unique_lock cacheLock( board->m_CachesMutex ); auto i = board->m_LayerExpressionCache.find( layerName ); LSET mask; @@ -89,23 +89,23 @@ protected: }; -class PCB_NETCLASS_VALUE : public LIBEVAL::VALUE +class PCBEXPR_NETCLASS_VALUE : public LIBEVAL::VALUE { public: - PCB_NETCLASS_VALUE( BOARD_CONNECTED_ITEM* aItem ) : + PCBEXPR_NETCLASS_VALUE( BOARD_CONNECTED_ITEM* aItem ) : LIBEVAL::VALUE( wxEmptyString ), m_item( aItem ) {}; const wxString& AsString() const override { - const_cast( this )->Set( m_item->GetEffectiveNetClass()->GetName() ); + const_cast( this )->Set( m_item->GetEffectiveNetClass()->GetName() ); return LIBEVAL::VALUE::AsString(); } bool EqualTo( LIBEVAL::CONTEXT* aCtx, const VALUE* b ) const override { - if( const PCB_NETCLASS_VALUE* bValue = dynamic_cast( b ) ) + if( const PCBEXPR_NETCLASS_VALUE* bValue = dynamic_cast( b ) ) return m_item->GetEffectiveNetClass() == bValue->m_item->GetEffectiveNetClass(); else return LIBEVAL::VALUE::EqualTo( aCtx, b ); @@ -113,7 +113,7 @@ public: bool NotEqualTo( LIBEVAL::CONTEXT* aCtx, const LIBEVAL::VALUE* b ) const override { - if( const PCB_NETCLASS_VALUE* bValue = dynamic_cast( b ) ) + if( const PCBEXPR_NETCLASS_VALUE* bValue = dynamic_cast( b ) ) return m_item->GetEffectiveNetClass() != bValue->m_item->GetEffectiveNetClass(); else return LIBEVAL::VALUE::NotEqualTo( aCtx, b ); @@ -124,23 +124,23 @@ protected: }; -class PCB_NET_VALUE : public LIBEVAL::VALUE +class PCBEXPR_NET_VALUE : public LIBEVAL::VALUE { public: - PCB_NET_VALUE( BOARD_CONNECTED_ITEM* aItem ) : + PCBEXPR_NET_VALUE( BOARD_CONNECTED_ITEM* aItem ) : LIBEVAL::VALUE( wxEmptyString ), m_item( aItem ) {}; const wxString& AsString() const override { - const_cast( this )->Set( m_item->GetNetname() ); + const_cast( this )->Set( m_item->GetNetname() ); return LIBEVAL::VALUE::AsString(); } bool EqualTo( LIBEVAL::CONTEXT* aCtx, const VALUE* b ) const override { - if( const PCB_NET_VALUE* bValue = dynamic_cast( b ) ) + if( const PCBEXPR_NET_VALUE* bValue = dynamic_cast( b ) ) return m_item->GetNetCode() == bValue->m_item->GetNetCode(); else return LIBEVAL::VALUE::EqualTo( aCtx, b ); @@ -148,7 +148,7 @@ public: bool NotEqualTo( LIBEVAL::CONTEXT* aCtx, const LIBEVAL::VALUE* b ) const override { - if( const PCB_NET_VALUE* bValue = dynamic_cast( b ) ) + if( const PCBEXPR_NET_VALUE* bValue = dynamic_cast( b ) ) return m_item->GetNetCode() != bValue->m_item->GetNetCode(); else return LIBEVAL::VALUE::NotEqualTo( aCtx, b ); @@ -159,12 +159,12 @@ protected: }; -LIBEVAL::VALUE* PCB_EXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) +LIBEVAL::VALUE* PCBEXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); if( m_itemIndex == 2 ) - return new PCB_LAYER_VALUE( context->GetLayer() ); + return new PCBEXPR_LAYER_VALUE( context->GetLayer() ); BOARD_ITEM* item = GetObject( aCtx ); @@ -202,9 +202,9 @@ LIBEVAL::VALUE* PCB_EXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) if( it->second->Name() == wxT( "Layer" ) ) { if( any.GetAs( &layer ) ) - return new PCB_LAYER_VALUE( layer ); + return new PCBEXPR_LAYER_VALUE( layer ); else if( any.GetAs( &str ) ) - return new PCB_LAYER_VALUE( context->GetBoard()->GetLayerID( str ) ); + return new PCBEXPR_LAYER_VALUE( context->GetBoard()->GetLayerID( str ) ); } else { @@ -219,29 +219,29 @@ LIBEVAL::VALUE* PCB_EXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) } -LIBEVAL::VALUE* PCB_EXPR_NETCLASS_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) +LIBEVAL::VALUE* PCBEXPR_NETCLASS_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) { BOARD_CONNECTED_ITEM* item = dynamic_cast( GetObject( aCtx ) ); if( !item ) return new LIBEVAL::VALUE(); - return new PCB_NETCLASS_VALUE( item ); + return new PCBEXPR_NETCLASS_VALUE( item ); } -LIBEVAL::VALUE* PCB_EXPR_NETNAME_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) +LIBEVAL::VALUE* PCBEXPR_NETNAME_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) { BOARD_CONNECTED_ITEM* item = dynamic_cast( GetObject( aCtx ) ); if( !item ) return new LIBEVAL::VALUE(); - return new PCB_NET_VALUE( item ); + return new PCBEXPR_NET_VALUE( item ); } -LIBEVAL::VALUE* PCB_EXPR_TYPE_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) +LIBEVAL::VALUE* PCBEXPR_TYPE_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) { BOARD_ITEM* item = GetObject( aCtx ); @@ -252,56 +252,56 @@ LIBEVAL::VALUE* PCB_EXPR_TYPE_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) } -LIBEVAL::FUNC_CALL_REF PCB_EXPR_UCODE::CreateFuncCall( const wxString& aName ) +LIBEVAL::FUNC_CALL_REF PCBEXPR_UCODE::CreateFuncCall( const wxString& aName ) { - PCB_EXPR_BUILTIN_FUNCTIONS& registry = PCB_EXPR_BUILTIN_FUNCTIONS::Instance(); + PCBEXPR_BUILTIN_FUNCTIONS& registry = PCBEXPR_BUILTIN_FUNCTIONS::Instance(); return registry.Get( aName.Lower() ); } -std::unique_ptr PCB_EXPR_UCODE::CreateVarRef( const wxString& aVar, +std::unique_ptr PCBEXPR_UCODE::CreateVarRef( const wxString& aVar, const wxString& aField ) { PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); - std::unique_ptr vref; + std::unique_ptr vref; // Check for a couple of very common cases and compile them straight to "object code". if( aField.CmpNoCase( wxT( "NetClass" ) ) == 0 ) { if( aVar == wxT( "A" ) ) - return std::make_unique( 0 ); + return std::make_unique( 0 ); else if( aVar == wxT( "B" ) ) - return std::make_unique( 1 ); + return std::make_unique( 1 ); else return nullptr; } else if( aField.CmpNoCase( wxT( "NetName" ) ) == 0 ) { if( aVar == wxT( "A" ) ) - return std::make_unique( 0 ); + return std::make_unique( 0 ); else if( aVar == wxT( "B" ) ) - return std::make_unique( 1 ); + return std::make_unique( 1 ); else return nullptr; } else if( aField.CmpNoCase( wxT( "Type" ) ) == 0 ) { if( aVar == wxT( "A" ) ) - return std::make_unique( 0 ); + return std::make_unique( 0 ); else if( aVar == wxT( "B" ) ) - return std::make_unique( 1 ); + return std::make_unique( 1 ); else return nullptr; } if( aVar == wxT( "A" ) || aVar == wxT( "AB" ) ) - vref = std::make_unique( 0 ); + vref = std::make_unique( 0 ); else if( aVar == wxT( "B" ) ) - vref = std::make_unique( 1 ); + vref = std::make_unique( 1 ); else if( aVar == wxT( "L" ) ) - vref = std::make_unique( 2 ); + vref = std::make_unique( 2 ); else return nullptr; @@ -342,7 +342,7 @@ std::unique_ptr PCB_EXPR_UCODE::CreateVarRef( const wxString& } else { - wxFAIL_MSG( wxT( "PCB_EXPR_UCODE::createVarRef: Unknown property type." ) ); + wxFAIL_MSG( wxT( "PCBEXPR_UCODE::createVarRef: Unknown property type." ) ); } } } @@ -355,7 +355,7 @@ std::unique_ptr PCB_EXPR_UCODE::CreateVarRef( const wxString& } -BOARD* PCB_EXPR_CONTEXT::GetBoard() const +BOARD* PCBEXPR_CONTEXT::GetBoard() const { if( m_items[0] ) return m_items[0]->GetBoard(); @@ -368,7 +368,7 @@ BOARD* PCB_EXPR_CONTEXT::GetBoard() const * Unit Resolvers */ -const std::vector& PCB_UNIT_RESOLVER::GetSupportedUnits() const +const std::vector& PCBEXPR_UNIT_RESOLVER::GetSupportedUnits() const { static const std::vector pcbUnits = { wxT( "mil" ), wxT( "mm" ), wxT( "in" ) }; @@ -376,13 +376,13 @@ const std::vector& PCB_UNIT_RESOLVER::GetSupportedUnits() const } -wxString PCB_UNIT_RESOLVER::GetSupportedUnitsMessage() const +wxString PCBEXPR_UNIT_RESOLVER::GetSupportedUnitsMessage() const { return _( "must be mm, in, or mil" ); } -double PCB_UNIT_RESOLVER::Convert( const wxString& aString, int unitId ) const +double PCBEXPR_UNIT_RESOLVER::Convert( const wxString& aString, int unitId ) const { double v = wxAtof( aString ); @@ -396,7 +396,7 @@ double PCB_UNIT_RESOLVER::Convert( const wxString& aString, int unitId ) const }; -const std::vector& PCB_UNITLESS_RESOLVER::GetSupportedUnits() const +const std::vector& PCBEXPR_UNITLESS_RESOLVER::GetSupportedUnits() const { static const std::vector emptyUnits; @@ -404,13 +404,13 @@ const std::vector& PCB_UNITLESS_RESOLVER::GetSupportedUnits() const } -double PCB_UNITLESS_RESOLVER::Convert( const wxString& aString, int unitId ) const +double PCBEXPR_UNITLESS_RESOLVER::Convert( const wxString& aString, int unitId ) const { return wxAtof( aString ); }; -PCB_EXPR_COMPILER::PCB_EXPR_COMPILER( LIBEVAL::UNIT_RESOLVER* aUnitResolver ) +PCBEXPR_COMPILER::PCBEXPR_COMPILER( LIBEVAL::UNIT_RESOLVER* aUnitResolver ) { m_unitResolver.reset( aUnitResolver ); } @@ -420,7 +420,7 @@ PCB_EXPR_COMPILER::PCB_EXPR_COMPILER( LIBEVAL::UNIT_RESOLVER* aUnitResolver ) * PCB Expression Evaluator */ -PCB_EXPR_EVALUATOR::PCB_EXPR_EVALUATOR( LIBEVAL::UNIT_RESOLVER* aUnitResolver ) : +PCBEXPR_EVALUATOR::PCBEXPR_EVALUATOR( LIBEVAL::UNIT_RESOLVER* aUnitResolver ) : m_result( 0 ), m_compiler( aUnitResolver ), m_ucode(), @@ -429,20 +429,20 @@ PCB_EXPR_EVALUATOR::PCB_EXPR_EVALUATOR( LIBEVAL::UNIT_RESOLVER* aUnitResolver ) } -PCB_EXPR_EVALUATOR::~PCB_EXPR_EVALUATOR() +PCBEXPR_EVALUATOR::~PCBEXPR_EVALUATOR() { } -bool PCB_EXPR_EVALUATOR::Evaluate( const wxString& aExpr ) +bool PCBEXPR_EVALUATOR::Evaluate( const wxString& aExpr ) { - PCB_EXPR_UCODE ucode; - PCB_EXPR_CONTEXT preflightContext( NULL_CONSTRAINT, F_Cu ); + PCBEXPR_UCODE ucode; + PCBEXPR_CONTEXT preflightContext( NULL_CONSTRAINT, F_Cu ); if( !m_compiler.Compile( aExpr.ToUTF8().data(), &ucode, &preflightContext ) ) return false; - PCB_EXPR_CONTEXT evaluationContext( NULL_CONSTRAINT, F_Cu ); + PCBEXPR_CONTEXT evaluationContext( NULL_CONSTRAINT, F_Cu ); LIBEVAL::VALUE* result = ucode.Run( &evaluationContext ); if( result->GetType() == LIBEVAL::VT_NUMERIC ) diff --git a/pcbnew/pcb_expr_evaluator.h b/pcbnew/pcbexpr_evaluator.h similarity index 76% rename from pcbnew/pcb_expr_evaluator.h rename to pcbnew/pcbexpr_evaluator.h index 1ef2cde365..79123a8940 100644 --- a/pcbnew/pcb_expr_evaluator.h +++ b/pcbnew/pcbexpr_evaluator.h @@ -22,8 +22,8 @@ */ -#ifndef __PCB_EXPR_EVALUATOR_H -#define __PCB_EXPR_EVALUATOR_H +#ifndef PCBEXPR_EVALUATOR_H +#define PCBEXPR_EVALUATOR_H #include @@ -35,13 +35,13 @@ class BOARD; class BOARD_ITEM; -class PCB_EXPR_VAR_REF; +class PCBEXPR_VAR_REF; -class PCB_EXPR_UCODE final : public LIBEVAL::UCODE +class PCBEXPR_UCODE final : public LIBEVAL::UCODE { public: - PCB_EXPR_UCODE() {}; - virtual ~PCB_EXPR_UCODE() {}; + PCBEXPR_UCODE() {}; + virtual ~PCBEXPR_UCODE() {}; virtual std::unique_ptr CreateVarRef( const wxString& aVar, const wxString& aField ) override; @@ -49,10 +49,10 @@ public: }; -class PCB_EXPR_CONTEXT : public LIBEVAL::CONTEXT +class PCBEXPR_CONTEXT : public LIBEVAL::CONTEXT { public: - PCB_EXPR_CONTEXT( int aConstraint, PCB_LAYER_ID aLayer ) : + PCBEXPR_CONTEXT( int aConstraint, PCB_LAYER_ID aLayer ) : m_constraint( aConstraint ), m_layer( aLayer ) { @@ -79,16 +79,16 @@ private: }; -class PCB_EXPR_VAR_REF : public LIBEVAL::VAR_REF +class PCBEXPR_VAR_REF : public LIBEVAL::VAR_REF { public: - PCB_EXPR_VAR_REF( int aItemIndex ) : - m_itemIndex( aItemIndex ), - m_type( LIBEVAL::VT_UNDEFINED ), - m_isEnum( false ) + PCBEXPR_VAR_REF( int aItemIndex ) : + m_itemIndex( aItemIndex ), + m_type( LIBEVAL::VT_UNDEFINED ), + m_isEnum( false ) {} - ~PCB_EXPR_VAR_REF() {}; + ~PCBEXPR_VAR_REF() {}; void SetIsEnum( bool s ) { m_isEnum = s; } bool IsEnum() const { return m_isEnum; } @@ -114,11 +114,11 @@ private: // "Object code" version of a netclass reference (for performance). -class PCB_EXPR_NETCLASS_REF : public PCB_EXPR_VAR_REF +class PCBEXPR_NETCLASS_REF : public PCBEXPR_VAR_REF { public: - PCB_EXPR_NETCLASS_REF( int aItemIndex ) : - PCB_EXPR_VAR_REF( aItemIndex ) + PCBEXPR_NETCLASS_REF( int aItemIndex ) : + PCBEXPR_VAR_REF( aItemIndex ) { SetType( LIBEVAL::VT_STRING ); } @@ -128,11 +128,11 @@ public: // "Object code" version of a netname reference (for performance). -class PCB_EXPR_NETNAME_REF : public PCB_EXPR_VAR_REF +class PCBEXPR_NETNAME_REF : public PCBEXPR_VAR_REF { public: - PCB_EXPR_NETNAME_REF( int aItemIndex ) : - PCB_EXPR_VAR_REF( aItemIndex ) + PCBEXPR_NETNAME_REF( int aItemIndex ) : + PCBEXPR_VAR_REF( aItemIndex ) { SetType( LIBEVAL::VT_STRING ); } @@ -141,11 +141,11 @@ public: }; -class PCB_EXPR_TYPE_REF : public PCB_EXPR_VAR_REF +class PCBEXPR_TYPE_REF : public PCBEXPR_VAR_REF { public: - PCB_EXPR_TYPE_REF( int aItemIndex ) : - PCB_EXPR_VAR_REF( aItemIndex ) + PCBEXPR_TYPE_REF( int aItemIndex ) : + PCBEXPR_VAR_REF( aItemIndex ) { SetType( LIBEVAL::VT_STRING ); } @@ -154,14 +154,14 @@ public: }; -class PCB_EXPR_BUILTIN_FUNCTIONS +class PCBEXPR_BUILTIN_FUNCTIONS { public: - PCB_EXPR_BUILTIN_FUNCTIONS(); + PCBEXPR_BUILTIN_FUNCTIONS(); - static PCB_EXPR_BUILTIN_FUNCTIONS& Instance() + static PCBEXPR_BUILTIN_FUNCTIONS& Instance() { - static PCB_EXPR_BUILTIN_FUNCTIONS self; + static PCBEXPR_BUILTIN_FUNCTIONS self; return self; } @@ -191,7 +191,7 @@ private: }; -class PCB_UNIT_RESOLVER : public LIBEVAL::UNIT_RESOLVER +class PCBEXPR_UNIT_RESOLVER : public LIBEVAL::UNIT_RESOLVER { public: const std::vector& GetSupportedUnits() const override; @@ -202,7 +202,7 @@ public: }; -class PCB_UNITLESS_RESOLVER : public LIBEVAL::UNIT_RESOLVER +class PCBEXPR_UNITLESS_RESOLVER : public LIBEVAL::UNIT_RESOLVER { public: const std::vector& GetSupportedUnits() const override; @@ -211,18 +211,18 @@ public: }; -class PCB_EXPR_COMPILER : public LIBEVAL::COMPILER +class PCBEXPR_COMPILER : public LIBEVAL::COMPILER { public: - PCB_EXPR_COMPILER( LIBEVAL::UNIT_RESOLVER* aUnitResolver ); + PCBEXPR_COMPILER( LIBEVAL::UNIT_RESOLVER* aUnitResolver ); }; -class PCB_EXPR_EVALUATOR +class PCBEXPR_EVALUATOR { public: - PCB_EXPR_EVALUATOR( LIBEVAL::UNIT_RESOLVER* aUnitResolver ); - ~PCB_EXPR_EVALUATOR(); + PCBEXPR_EVALUATOR( LIBEVAL::UNIT_RESOLVER* aUnitResolver ); + ~PCBEXPR_EVALUATOR(); bool Evaluate( const wxString& aExpr ); int Result() const { return m_result; } @@ -238,8 +238,8 @@ public: private: int m_result; - PCB_EXPR_COMPILER m_compiler; - PCB_EXPR_UCODE m_ucode; + PCBEXPR_COMPILER m_compiler; + PCBEXPR_UCODE m_ucode; LIBEVAL::ERROR_STATUS m_errorStatus; }; diff --git a/pcbnew/pcb_expr_functions.cpp b/pcbnew/pcbexpr_functions.cpp similarity index 94% rename from pcbnew/pcb_expr_functions.cpp rename to pcbnew/pcbexpr_functions.cpp index 6db1f9b203..067d798dc8 100644 --- a/pcbnew/pcb_expr_functions.cpp +++ b/pcbnew/pcbexpr_functions.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include @@ -40,7 +40,7 @@ bool fromToFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -75,7 +75,7 @@ bool fromToFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void existsOnLayerFunc( LIBEVAL::CONTEXT* aCtx, void *self ) { - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; LIBEVAL::VALUE* arg = aCtx->Pop(); @@ -172,7 +172,7 @@ static void isPlatedFunc( LIBEVAL::CONTEXT* aCtx, void* self ) result->Set( 0.0 ); aCtx->Push( result ); - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; if( !item ) @@ -186,7 +186,7 @@ static void isPlatedFunc( LIBEVAL::CONTEXT* aCtx, void* self ) bool collidesWithCourtyard( BOARD_ITEM* aItem, std::shared_ptr& aItemShape, - PCB_EXPR_CONTEXT* aCtx, FOOTPRINT* aFootprint, PCB_LAYER_ID aSide ) + PCBEXPR_CONTEXT* aCtx, FOOTPRINT* aFootprint, PCB_LAYER_ID aSide ) { SHAPE_POLY_SET footprintCourtyard; @@ -206,7 +206,7 @@ bool collidesWithCourtyard( BOARD_ITEM* aItem, std::shared_ptr& aItemShap }; -static bool searchFootprints( BOARD* aBoard, const wxString& aArg, PCB_EXPR_CONTEXT* aCtx, +static bool searchFootprints( BOARD* aBoard, const wxString& aArg, PCBEXPR_CONTEXT* aCtx, const std::function& aFunc ) { if( aArg == wxT( "A" ) ) @@ -241,7 +241,7 @@ static bool searchFootprints( BOARD* aBoard, const wxString& aArg, PCB_EXPR_CONT static void intersectsCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); LIBEVAL::VALUE* arg = context->Pop(); LIBEVAL::VALUE* result = context->AllocValue(); @@ -256,7 +256,7 @@ static void intersectsCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr; if( !item ) @@ -301,7 +301,7 @@ static void intersectsCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void intersectsFrontCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); LIBEVAL::VALUE* arg = context->Pop(); LIBEVAL::VALUE* result = context->AllocValue(); @@ -316,7 +316,7 @@ static void intersectsFrontCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr; if( !item ) @@ -360,7 +360,7 @@ static void intersectsFrontCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void intersectsBackCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); LIBEVAL::VALUE* arg = context->Pop(); LIBEVAL::VALUE* result = context->AllocValue(); @@ -375,7 +375,7 @@ static void intersectsBackCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr; if( !item ) @@ -417,7 +417,7 @@ static void intersectsBackCourtyardFunc( LIBEVAL::CONTEXT* aCtx, void* self ) } -bool collidesWithArea( BOARD_ITEM* aItem, PCB_EXPR_CONTEXT* aCtx, ZONE* aArea ) +bool collidesWithArea( BOARD_ITEM* aItem, PCBEXPR_CONTEXT* aCtx, ZONE* aArea ) { BOARD* board = aArea->GetBoard(); BOX2I areaBBox = aArea->GetBoundingBox(); @@ -535,7 +535,7 @@ bool collidesWithArea( BOARD_ITEM* aItem, PCB_EXPR_CONTEXT* aCtx, ZONE* aArea ) } -bool searchAreas( BOARD* aBoard, const wxString& aArg, PCB_EXPR_CONTEXT* aCtx, +bool searchAreas( BOARD* aBoard, const wxString& aArg, PCBEXPR_CONTEXT* aCtx, const std::function& aFunc ) { if( aArg == wxT( "A" ) ) @@ -606,7 +606,7 @@ bool searchAreas( BOARD* aBoard, const wxString& aArg, PCB_EXPR_CONTEXT* aCtx, static void intersectsAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); LIBEVAL::VALUE* arg = aCtx->Pop(); LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -621,7 +621,7 @@ static void intersectsAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr; if( !item ) @@ -691,7 +691,7 @@ static void intersectsAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); LIBEVAL::VALUE* arg = aCtx->Pop(); LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -706,7 +706,7 @@ static void enclosedByAreaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( context ) : nullptr; if( !item ) @@ -795,7 +795,7 @@ static void memberOfGroupFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; if( !item ) @@ -841,7 +841,7 @@ static void memberOfFootprintFunc( LIBEVAL::CONTEXT* aCtx, void* self ) return; } - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; if( !item ) @@ -865,7 +865,7 @@ static void memberOfFootprintFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void isMicroVia( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -882,7 +882,7 @@ static void isMicroVia( LIBEVAL::CONTEXT* aCtx, void* self ) static void isBlindBuriedViaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -899,7 +899,7 @@ static void isBlindBuriedViaFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void isCoupledDiffPairFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { - PCB_EXPR_CONTEXT* context = static_cast( aCtx ); + PCBEXPR_CONTEXT* context = static_cast( aCtx ); BOARD_CONNECTED_ITEM* a = dynamic_cast( context->GetItem( 0 ) ); BOARD_CONNECTED_ITEM* b = dynamic_cast( context->GetItem( 1 ) ); LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -939,7 +939,7 @@ static void isCoupledDiffPairFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void inDiffPairFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { LIBEVAL::VALUE* argv = aCtx->Pop(); - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -990,7 +990,7 @@ static void inDiffPairFunc( LIBEVAL::CONTEXT* aCtx, void* self ) static void getFieldFunc( LIBEVAL::CONTEXT* aCtx, void* self ) { LIBEVAL::VALUE* arg = aCtx->Pop(); - PCB_EXPR_VAR_REF* vref = static_cast( self ); + PCBEXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; LIBEVAL::VALUE* result = aCtx->AllocValue(); @@ -1029,13 +1029,13 @@ static void getFieldFunc( LIBEVAL::CONTEXT* aCtx, void* self ) } -PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS() +PCBEXPR_BUILTIN_FUNCTIONS::PCBEXPR_BUILTIN_FUNCTIONS() { RegisterAllFunctions(); } -void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions() +void PCBEXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions() { m_funcs.clear(); diff --git a/qa/tests/pcbnew/test_libeval_compiler.cpp b/qa/tests/pcbnew/test_libeval_compiler.cpp index 3408cb8e2f..4cac3ec07b 100644 --- a/qa/tests/pcbnew/test_libeval_compiler.cpp +++ b/qa/tests/pcbnew/test_libeval_compiler.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -90,10 +90,10 @@ static bool testEvalExpr( const wxString& expr, const LIBEVAL::VALUE& expectedRe bool expectError = false, BOARD_ITEM* itemA = nullptr, BOARD_ITEM* itemB = nullptr ) { - PCB_EXPR_COMPILER compiler( new PCB_UNIT_RESOLVER() ); - PCB_EXPR_UCODE ucode; - PCB_EXPR_CONTEXT context( NULL_CONSTRAINT, UNDEFINED_LAYER ); - PCB_EXPR_CONTEXT preflightContext( NULL_CONSTRAINT, UNDEFINED_LAYER ); + PCBEXPR_COMPILER compiler( new PCBEXPR_UNIT_RESOLVER() ); + PCBEXPR_UCODE ucode; + PCBEXPR_CONTEXT context( NULL_CONSTRAINT, UNDEFINED_LAYER ); + PCBEXPR_CONTEXT preflightContext( NULL_CONSTRAINT, UNDEFINED_LAYER ); bool ok = true; context.SetItems( itemA, itemB ); diff --git a/qa/tools/drc_proto/drc_proto.cpp b/qa/tools/drc_proto/drc_proto.cpp index 5a010f7243..d347a450be 100644 --- a/qa/tools/drc_proto/drc_proto.cpp +++ b/qa/tools/drc_proto/drc_proto.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include diff --git a/qa/tools/libeval_compiler/libeval_compiler_test.cpp b/qa/tools/libeval_compiler/libeval_compiler_test.cpp index 4459a94e83..b55ff20790 100644 --- a/qa/tools/libeval_compiler/libeval_compiler_test.cpp +++ b/qa/tools/libeval_compiler/libeval_compiler_test.cpp @@ -4,7 +4,7 @@ #include "board.h" #include "pcb_track.h" -#include +#include #include #include @@ -16,11 +16,11 @@ bool testEvalExpr( const std::string expr, LIBEVAL::VALUE expectedResult, bool expectError = false, BOARD_ITEM* itemA = nullptr, BOARD_ITEM* itemB = nullptr ) { - PCB_EXPR_COMPILER compiler( new PCB_UNIT_RESOLVER() ); - PCB_EXPR_UCODE ucode; + PCBEXPR_COMPILER compiler( new PCB_UNIT_RESOLVER() ); + PCBEXPR_UCODE ucode; bool ok = true; - PCB_EXPR_CONTEXT context, preflightContext; + PCBEXPR_CONTEXT context, preflightContext; context.SetItems( itemA, itemB );