From a2d9acb647f657dff0a4482111e7a20c9c498441 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 27 Sep 2020 18:05:16 +0100 Subject: [PATCH] Rename DRC rule function onLayer to existsOnLayer. Fixes https://gitlab.com/kicad/code/kicad/issues/5647 --- pcbnew/pcb_expr_evaluator.cpp | 10 +++++----- qa/libeval_compiler/libeval_compiler_test.cpp | 2 +- qa/pcbnew/test_libeval_compiler.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 21f50d9b99..0f23cf4ef7 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -60,13 +60,13 @@ bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self ) } int r =0 ; - + if( ftCache->IsOnFromToPath( static_cast( item ), argFrom->AsString(), argTo->AsString() ) ) { result->Set(1.0); r = 1; - + } /*printf("isonfromto %p %s %s -> %d\n", static_cast( item ), @@ -77,7 +77,7 @@ bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self ) } -static void onLayer( LIBEVAL::CONTEXT* aCtx, void *self ) +static void existsOnLayer( LIBEVAL::CONTEXT* aCtx, void *self ) { PCB_EXPR_VAR_REF* vref = static_cast( self ); BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr; @@ -94,7 +94,7 @@ static void onLayer( LIBEVAL::CONTEXT* aCtx, void *self ) if( !arg ) { aCtx->ReportError( wxString::Format( _( "Missing argument to '%s'" ), - wxT( "onLayer()" ) ) ); + wxT( "existsOnLayer()" ) ) ); return; } @@ -342,7 +342,7 @@ PCB_EXPR_BUILTIN_FUNCTIONS::PCB_EXPR_BUILTIN_FUNCTIONS() void PCB_EXPR_BUILTIN_FUNCTIONS::RegisterAllFunctions() { m_funcs.clear(); - RegisterFunc( "onLayer('x')", onLayer ); + registerFunc( "existsOnLayer('x')", existsOnLayer ); RegisterFunc( "isPlated()", isPlated ); RegisterFunc( "insideCourtyard('x')", insideCourtyard ); RegisterFunc( "insideArea('x')", insideArea ); diff --git a/qa/libeval_compiler/libeval_compiler_test.cpp b/qa/libeval_compiler/libeval_compiler_test.cpp index cac3407d74..1b15572429 100644 --- a/qa/libeval_compiler/libeval_compiler_test.cpp +++ b/qa/libeval_compiler/libeval_compiler_test.cpp @@ -98,7 +98,7 @@ int main( int argc, char *argv[] ) trackB.SetWidth( Mils2iu( 20 )); // testEvalExpr( "A.onlayer('F.Cu') || A.onlayer('B.Cu')", VAL( 1.0 ), false, &trackA, &trackB ); - testEvalExpr( "A.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB ); + testEvalExpr( "A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB ); return 0; testEvalExpr( "A.Width > B.Width", VAL( 0.0 ), false, &trackA, &trackB ); testEvalExpr( "A.Width + B.Width", VAL( Mils2iu(10) + Mils2iu(20) ), false, &trackA, &trackB ); diff --git a/qa/pcbnew/test_libeval_compiler.cpp b/qa/pcbnew/test_libeval_compiler.cpp index b824527eeb..86fe1ce094 100644 --- a/qa/pcbnew/test_libeval_compiler.cpp +++ b/qa/pcbnew/test_libeval_compiler.cpp @@ -71,7 +71,7 @@ const static std::vector simpleExpressions = { const static std::vector introspectionExpressions = { - { "A.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", false, VAL( 0.0 ) }, + { "A.type == 'Pad' && B.type == 'Pad' && (A.existsOnLayer('F.Cu'))", false, VAL( 0.0 ) }, { "A.Width > B.Width", false, VAL( 0.0 ) }, { "A.Width + B.Width", false, VAL( Mils2iu(10) + Mils2iu(20) ) }, { "A.Netclass", false, VAL( "HV" ) },