diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2013-10-02 18:22:14 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2013-10-02 18:22:14 -0700 |
commit | e01174c6db703a4d9f50a5ef3d494ea68c7640c2 (patch) | |
tree | 63bc7e087781cd442a874936f02e9cc68bc1e707 /src/map/mio | |
parent | fb2ae7c22f42e05c920dd9366313422ff073749f (diff) | |
download | abc-e01174c6db703a4d9f50a5ef3d494ea68c7640c2.tar.gz abc-e01174c6db703a4d9f50a5ef3d494ea68c7640c2.tar.bz2 abc-e01174c6db703a4d9f50a5ef3d494ea68c7640c2.zip |
Bug fixes in the library processing,.
Diffstat (limited to 'src/map/mio')
-rw-r--r-- | src/map/mio/mioParse.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/map/mio/mioParse.c b/src/map/mio/mioParse.c index 11b2a708..cac21596 100644 --- a/src/map/mio/mioParse.c +++ b/src/map/mio/mioParse.c @@ -429,14 +429,18 @@ void Mio_ParseFormulaTruthTest( char * pFormInit, char ** ppVarNames, int nVars int Mio_ParseCheckName( Mio_Gate_t * pGate, char ** ppStr ) { Mio_Pin_t * pPin; - int i; + int i, iBest; + // find the longest pin name that matches substring + char * pNameBest = NULL; for ( pPin = Mio_GateReadPins(pGate), i = 0; pPin; pPin = Mio_PinReadNext(pPin), i++ ) if ( !strncmp( *ppStr, Mio_PinReadName(pPin), strlen(Mio_PinReadName(pPin)) ) ) - { - *ppStr += strlen(Mio_PinReadName(pPin)) - 1; - return i; - } - return -1; + if ( pNameBest == NULL || strlen(pNameBest) < strlen(Mio_PinReadName(pPin)) ) + pNameBest = Mio_PinReadName(pPin), iBest = i; + // if pin is not found, return -1 + if ( pNameBest == NULL ) + return -1; + *ppStr += strlen(pNameBest) - 1; + return iBest; } int Mio_ParseCheckFormula( Mio_Gate_t * pGate, char * pForm ) { |