summaryrefslogtreecommitdiffstats
path: root/src/base/wlc/wlcReadVer.c
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-06-23 15:53:41 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-06-23 15:53:41 -0700
commita26d8621f018aeaae6259fa212f33a2267477ae1 (patch)
tree099d2f3e0f365fb6ec13a95d3f81b8c713deb774 /src/base/wlc/wlcReadVer.c
parentd0d7763ef8954ff2bd74a00545c986584a7666a2 (diff)
downloadabc-a26d8621f018aeaae6259fa212f33a2267477ae1.tar.gz
abc-a26d8621f018aeaae6259fa212f33a2267477ae1.tar.bz2
abc-a26d8621f018aeaae6259fa212f33a2267477ae1.zip
Add warnings to %read about 3-arge ops and non-zero-based ranges.
Diffstat (limited to 'src/base/wlc/wlcReadVer.c')
-rw-r--r--src/base/wlc/wlcReadVer.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/base/wlc/wlcReadVer.c b/src/base/wlc/wlcReadVer.c
index 1bcb2517..40f41bbc 100644
--- a/src/base/wlc/wlcReadVer.c
+++ b/src/base/wlc/wlcReadVer.c
@@ -113,6 +113,14 @@ void Wlc_PrsStop( Wlc_Prs_t * p )
SeeAlso []
***********************************************************************/
+int Wlc_PrsFindLine( Wlc_Prs_t * p, char * pCur )
+{
+ int Entry, iLine = 0;
+ Vec_IntForEachEntry( p->vLines, Entry, iLine )
+ if ( Entry > pCur - p->pBuffer )
+ return iLine + 1;
+ return -1;
+}
int Wlc_PrsWriteErrorMessage( Wlc_Prs_t * p, char * pCur, const char * format, ... )
{
char * pMessage;
@@ -128,11 +136,8 @@ int Wlc_PrsWriteErrorMessage( Wlc_Prs_t * p, char * pCur, const char * format, .
sprintf( p->sError, "%s: %s\n", p->pFileName, pMessage );
else // print the error message with the line number
{
- int Entry, iLine = 0;
- Vec_IntForEachEntry( p->vLines, Entry, iLine )
- if ( Entry > pCur - p->pBuffer )
- break;
- sprintf( p->sError, "%s (line %d): %s\n", p->pFileName, iLine+1, pMessage );
+ int iLine = Wlc_PrsFindLine( p, pCur );
+ sprintf( p->sError, "%s (line %d): %s\n", p->pFileName, iLine, pMessage );
}
ABC_FREE( pMessage );
return 0;
@@ -768,6 +773,9 @@ static inline int Wlc_PrsFindDefinition( Wlc_Prs_t * p, char * pStr, Vec_Int_t *
else return Wlc_PrsWriteErrorMessage( p, pStr, "Unsupported operation (%c).", pStr[0] );
if ( !(pStr = Wlc_PrsReadName(p, pStr+1, vFanins)) )
return 0;
+ pStr = Wlc_PrsSkipSpaces( pStr );
+ if ( pStr[0] )
+ printf( "Warning: Trailing symbols \"%s\" in line %d.\n", pStr, Wlc_PrsFindLine(p, pStr) );
}
}
// make sure there is nothing left there
@@ -798,6 +806,8 @@ int Wlc_PrsReadDeclaration( Wlc_Prs_t * p, char * pStart )
pStart = Wlc_PrsFindRange( pStart, &End, &Beg );
if ( pStart == NULL )
return Wlc_PrsWriteErrorMessage( p, pStart, "Cannot read range." );
+ if ( Beg != 0 )
+ printf( "Warning: Non-zero-based range ([%d:%d]) in line %d.\n", End, Beg, Wlc_PrsFindLine(p, pStart) );
while ( 1 )
{
char * pName;