Rename DRC rule function onLayer to existsOnLayer.
Fixes https://gitlab.com/kicad/code/kicad/issues/5647
This commit is contained in:
parent
6f5f6a0fba
commit
a2d9acb647
|
@ -60,13 +60,13 @@ bool exprFromTo( LIBEVAL::CONTEXT* aCtx, void* self )
|
|||
}
|
||||
|
||||
int r =0 ;
|
||||
|
||||
|
||||
if( ftCache->IsOnFromToPath( static_cast<BOARD_CONNECTED_ITEM*>( item ),
|
||||
argFrom->AsString(), argTo->AsString() ) )
|
||||
{
|
||||
result->Set(1.0);
|
||||
r = 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*printf("isonfromto %p %s %s -> %d\n", static_cast<BOARD_CONNECTED_ITEM*>( 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<PCB_EXPR_VAR_REF*>( 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 );
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -71,7 +71,7 @@ const static std::vector<EXPR_TO_TEST> simpleExpressions = {
|
|||
|
||||
|
||||
const static std::vector<EXPR_TO_TEST> 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" ) },
|
||||
|
|
Loading…
Reference in New Issue