From 0871bffae307e0553e0c5186336189e8b55cf6a6 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 15 Feb 2009 08:01:00 -0800 Subject: Version abc90215 --- src/map/amap/amapRead.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'src/map/amap/amapRead.c') diff --git a/src/map/amap/amapRead.c b/src/map/amap/amapRead.c index 182de5d1..7ebc239b 100644 --- a/src/map/amap/amapRead.c +++ b/src/map/amap/amapRead.c @@ -89,7 +89,7 @@ char * Amap_LoadFile( char * pFileName ) // move the file current reading position to the beginning rewind( pFile ); // load the contents of the file into memory - pBuffer = ALLOC( char, nFileSize + 10 ); + pBuffer = ABC_ALLOC( char, nFileSize + 10 ); fread( pBuffer, nFileSize, 1, pFile ); // terminate the string with '\0' pBuffer[ nFileSize ] = '\0'; @@ -173,11 +173,11 @@ Vec_Ptr_t * Amap_DeriveTokens( char * pBuffer ) Vec_Ptr_t * vTokens; char * pToken; vTokens = Vec_PtrAlloc( 1000 ); - pToken = strtok( pBuffer, " ;=\t\r\n" ); + pToken = strtok( pBuffer, " =\t\r\n" ); while ( pToken ) { Vec_PtrPush( vTokens, pToken ); - pToken = strtok( NULL, " ;=\t\r\n" ); + pToken = strtok( NULL, " =\t\r\n" ); } return vTokens; } @@ -277,6 +277,32 @@ Amap_Gat_t * Amap_ParseGateWithSamePins( Amap_Gat_t * p ) return pGate; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Amap_CollectFormulaTokens( Vec_Ptr_t * vTokens, char * pToken, int iPos ) +{ + char * pNext, * pPrev; + pPrev = pToken + strlen(pToken); + while ( *(pPrev-1) != ';' ) + { + *pPrev++ = ' '; + pNext = Vec_PtrEntry(vTokens, iPos++); + while ( *pNext ) + *pPrev++ = *pNext++; + } + *(pPrev-1) = 0; + return iPos; +} + /**Function************************************************************* Synopsis [] @@ -320,6 +346,7 @@ Amap_Lib_t * Amap_ParseTokens( Vec_Ptr_t * vTokens, int fVerbose ) pToken = Vec_PtrEntry(vTokens, iPos++); pGate->pOutName = Amap_ParseStrsav( p->pMemGates, pToken ); pToken = Vec_PtrEntry(vTokens, iPos++); + iPos = Amap_CollectFormulaTokens( vTokens, pToken, iPos ); pGate->pForm = Amap_ParseStrsav( p->pMemGates, pToken ); // read pins Amap_GateForEachPin( pGate, pPin ) @@ -401,7 +428,7 @@ Amap_Lib_t * Amap_LibReadFile( char * pFileName, int fVerbose ) return NULL; pLib->pName = Amap_ParseStrsav( pLib->pMemGates, pFileName ); Vec_PtrFree( vTokens ); - free( pBuffer ); + ABC_FREE( pBuffer ); return pLib; } -- cgit v1.2.3