Don't force user to be overly pedantic when writing diffpair rules.
This commit is contained in:
parent
022e7385f9
commit
fe7e72538e
|
@ -794,19 +794,17 @@ static void isCoupledDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
|
|
||||||
result->SetDeferredEval(
|
result->SetDeferredEval(
|
||||||
[a, b]() -> double
|
[a, b]() -> double
|
||||||
{
|
|
||||||
if( a && b )
|
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* netinfo = a->GetNet();
|
NETINFO_ITEM* netinfo = a->GetNet();
|
||||||
wxString coupledNet, dummy;
|
wxString coupledNet;
|
||||||
|
wxString dummy;
|
||||||
|
|
||||||
if( netinfo
|
if( netinfo
|
||||||
&& DRC_ENGINE::MatchDpSuffix( netinfo->GetNetname(), coupledNet, dummy )
|
&& DRC_ENGINE::MatchDpSuffix( netinfo->GetNetname(), coupledNet, dummy )
|
||||||
&& b->GetNetname() == coupledNet )
|
&& ( !b || b->GetNetname() == coupledNet ) )
|
||||||
{
|
{
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
} );
|
} );
|
||||||
|
@ -815,7 +813,7 @@ static void isCoupledDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
|
|
||||||
static void inDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
static void inDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
{
|
{
|
||||||
LIBEVAL::VALUE* arg = aCtx->Pop();
|
LIBEVAL::VALUE* argv = aCtx->Pop();
|
||||||
PCB_EXPR_VAR_REF* vref = static_cast<PCB_EXPR_VAR_REF*>( self );
|
PCB_EXPR_VAR_REF* vref = static_cast<PCB_EXPR_VAR_REF*>( self );
|
||||||
BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
|
BOARD_ITEM* item = vref ? vref->GetObject( aCtx ) : nullptr;
|
||||||
LIBEVAL::VALUE* result = aCtx->AllocValue();
|
LIBEVAL::VALUE* result = aCtx->AllocValue();
|
||||||
|
@ -823,7 +821,7 @@ static void inDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
result->Set( 0.0 );
|
result->Set( 0.0 );
|
||||||
aCtx->Push( result );
|
aCtx->Push( result );
|
||||||
|
|
||||||
if( !arg )
|
if( !argv )
|
||||||
{
|
{
|
||||||
if( aCtx->HasErrorCallback() )
|
if( aCtx->HasErrorCallback() )
|
||||||
{
|
{
|
||||||
|
@ -838,20 +836,23 @@ static void inDiffPair( LIBEVAL::CONTEXT* aCtx, void* self )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
result->SetDeferredEval(
|
result->SetDeferredEval(
|
||||||
[item, arg]() -> double
|
[item, argv]() -> double
|
||||||
{
|
{
|
||||||
if( item && item->IsConnected() )
|
if( item && item->IsConnected() )
|
||||||
{
|
{
|
||||||
NETINFO_ITEM* netinfo = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
|
NETINFO_ITEM* netinfo = static_cast<BOARD_CONNECTED_ITEM*>( item )->GetNet();
|
||||||
|
|
||||||
wxString refName = netinfo->GetNetname();
|
wxString refName = netinfo->GetNetname();
|
||||||
|
wxString arg = argv->AsString();
|
||||||
wxString baseName, coupledNet;
|
wxString baseName, coupledNet;
|
||||||
int polarity = DRC_ENGINE::MatchDpSuffix( refName, coupledNet, baseName );
|
int polarity = DRC_ENGINE::MatchDpSuffix( refName, coupledNet, baseName );
|
||||||
|
|
||||||
if( polarity != 0
|
if( polarity != 0 && item->GetBoard()->FindNet( coupledNet ) )
|
||||||
&& item->GetBoard()->FindNet( coupledNet )
|
|
||||||
&& baseName.Matches( arg->AsString() ) )
|
|
||||||
{
|
{
|
||||||
|
if( baseName.Matches( arg ) )
|
||||||
|
return 1.0;
|
||||||
|
|
||||||
|
if( baseName.EndsWith( "_" ) && baseName.BeforeLast( '_' ).Matches( arg ) )
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue