diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/scl/sclLiberty.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/map/scl/sclLiberty.c b/src/map/scl/sclLiberty.c index 49b5c237..60aaded2 100644 --- a/src/map/scl/sclLiberty.c +++ b/src/map/scl/sclLiberty.c @@ -42,20 +42,20 @@ typedef enum { typedef struct Scl_Pair_t_ Scl_Pair_t; struct Scl_Pair_t_ { - int Beg; // item beginning - int End; // item end + long Beg; // item beginning + long End; // item end }; typedef struct Scl_Item_t_ Scl_Item_t; struct Scl_Item_t_ { int Type; // Scl_LibertyType_t - int iLine; // file line where the item's spec begins + long iLine; // file line where the item's spec begins Scl_Pair_t Key; // key part Scl_Pair_t Head; // head part Scl_Pair_t Body; // body part - int Next; // next item in the list - int Child; // first child item + long Next; // next item in the list + long Child; // first child item }; typedef struct Scl_Tree_t_ Scl_Tree_t; @@ -63,10 +63,10 @@ struct Scl_Tree_t_ { char * pFileName; // input Liberty file name char * pContents; // file contents - int nContents; // file size - int nLines; // line counter - int nItems; // number of items - int nItermAlloc; // number of items allocated + long nContents; // file size + long nLines; // line counter + long nItems; // number of items + long nItermAlloc; // number of items allocated Scl_Item_t * pItems; // the items char * pError; // the error string abctime clkStart; // beginning time @@ -74,11 +74,11 @@ struct Scl_Tree_t_ }; static inline Scl_Item_t * Scl_LibertyRoot( Scl_Tree_t * p ) { return p->pItems; } -static inline Scl_Item_t * Scl_LibertyItem( Scl_Tree_t * p, int v ) { assert( v < p->nItems ); return v < 0 ? NULL : p->pItems + v; } -static inline int Scl_LibertyCompare( Scl_Tree_t * p, Scl_Pair_t Pair, char * pStr ) { return strncmp( p->pContents+Pair.Beg, pStr, Pair.End-Pair.Beg ) || ((int)strlen(pStr) != Pair.End-Pair.Beg); } +static inline Scl_Item_t * Scl_LibertyItem( Scl_Tree_t * p, long v ) { assert( v < p->nItems ); return v < 0 ? NULL : p->pItems + v; } +static inline long Scl_LibertyCompare( Scl_Tree_t * p, Scl_Pair_t Pair, char * pStr ) { return strncmp( p->pContents+Pair.Beg, pStr, Pair.End-Pair.Beg ) || ((long)strlen(pStr) != Pair.End-Pair.Beg); } static inline void Scl_PrintWord( FILE * pFile, Scl_Tree_t * p, Scl_Pair_t Pair ) { char * pBeg = p->pContents+Pair.Beg, * pEnd = p->pContents+Pair.End; while ( pBeg < pEnd ) fputc( *pBeg++, pFile ); } -static inline void Scl_PrintSpace( FILE * pFile, int nOffset ) { int i; for ( i = 0; i < nOffset; i++ ) fputc(' ', pFile); } -static inline int Scl_LibertyItemId( Scl_Tree_t * p, Scl_Item_t * pItem ) { return pItem - p->pItems; } +static inline void Scl_PrintSpace( FILE * pFile, long nOffset ) { long i; for ( i = 0; i < nOffset; i++ ) fputc(' ', pFile); } +static inline long Scl_LibertyItemId( Scl_Tree_t * p, Scl_Item_t * pItem ) { return pItem - p->pItems; } #define Scl_ItemForEachChild( p, pItem, pChild ) \ for ( pChild = Scl_LibertyItem(p, pItem->Child); pChild; pChild = Scl_LibertyItem(p, pChild->Next) ) @@ -166,9 +166,9 @@ int Scl_LibertyParseDump( Scl_Tree_t * p, char * pFileName ) SeeAlso [] ***********************************************************************/ -int Scl_LibertyCountItems( char * pBeg, char * pEnd ) +long Scl_LibertyCountItems( char * pBeg, char * pEnd ) { - int Counter = 0; + long Counter = 0; for ( ; pBeg < pEnd; pBeg++ ) Counter += (*pBeg == '(' || *pBeg == ':'); return Counter; @@ -213,11 +213,11 @@ void Scl_LibertyWipeOutComments( char * pBeg, char * pEnd ) } } } -static inline int Scl_LibertyCharIsSpace( char c ) +static inline long Scl_LibertyCharIsSpace( char c ) { return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\\'; } -static inline int Scl_LibertySkipSpaces( Scl_Tree_t * p, char ** ppPos, char * pEnd, int fStopAtNewLine ) +static inline long Scl_LibertySkipSpaces( Scl_Tree_t * p, char ** ppPos, char * pEnd, int fStopAtNewLine ) { char * pPos = *ppPos; for ( ; pPos < pEnd; pPos++ ) @@ -235,7 +235,7 @@ static inline int Scl_LibertySkipSpaces( Scl_Tree_t * p, char ** ppPos, char * p return pPos == pEnd; } // skips entry delimited by " :;(){}" and returns 1 if reached the end -static inline int Scl_LibertySkipEntry( char ** ppPos, char * pEnd ) +static inline long Scl_LibertySkipEntry( char ** ppPos, char * pEnd ) { char * pPos = *ppPos; if ( *pPos == '\"' ) @@ -262,7 +262,7 @@ static inline int Scl_LibertySkipEntry( char ** ppPos, char * pEnd ) // finds the matching closing symbol static inline char * Scl_LibertyFindMatch( char * pPos, char * pEnd ) { - int Counter = 0; + long Counter = 0; assert( *pPos == '(' || *pPos == '{' ); if ( *pPos == '(' ) { @@ -356,10 +356,10 @@ char * Scl_LibertyReadString( Scl_Tree_t * p, Scl_Pair_t Pair ) Buffer[Pair.End-Pair.Beg] = 0; return Buffer; } -int Scl_LibertyItemNum( Scl_Tree_t * p, Scl_Item_t * pRoot, char * pName ) +long Scl_LibertyItemNum( Scl_Tree_t * p, Scl_Item_t * pRoot, char * pName ) { Scl_Item_t * pItem; - int Counter = 0; + long Counter = 0; Scl_ItemForEachChildName( p, pRoot, pItem, pName ) Counter++; return Counter; @@ -376,7 +376,7 @@ int Scl_LibertyItemNum( Scl_Tree_t * p, Scl_Item_t * pRoot, char * pName ) SeeAlso [] ***********************************************************************/ -int Scl_LibertyBuildItem( Scl_Tree_t * p, char ** ppPos, char * pEnd ) +long Scl_LibertyBuildItem( Scl_Tree_t * p, char ** ppPos, char * pEnd ) { Scl_Item_t * pItem; Scl_Pair_t Key, Head, Body; @@ -482,7 +482,7 @@ exit: if ( p->pError == NULL ) { p->pError = ABC_ALLOC( char, 1000 ); - sprintf( p->pError, "File \"%s\". Line %6d. Failed to parse entry \"%s\".\n", + sprintf( p->pError, "File \"%s\". Line %6ld. Failed to parse entry \"%s\".\n", p->pFileName, p->nLines, Scl_LibertyReadString(p, Key) ); } return -1; @@ -506,10 +506,10 @@ void Scl_LibertyFixFileName( char * pFileName ) if ( *pHead == '>' ) *pHead = '\\'; } -int Scl_LibertyFileSize( char * pFileName ) +long Scl_LibertyFileSize( char * pFileName ) { FILE * pFile; - int nFileSize; + long nFileSize; pFile = fopen( pFileName, "rb" ); if ( pFile == NULL ) { @@ -521,11 +521,11 @@ int Scl_LibertyFileSize( char * pFileName ) fclose( pFile ); return nFileSize; } -char * Scl_LibertyFileContents( char * pFileName, int nContents ) +char * Scl_LibertyFileContents( char * pFileName, long nContents ) { FILE * pFile = fopen( pFileName, "rb" ); char * pContents = ABC_ALLOC( char, nContents+1 ); - int RetValue = 0; + long RetValue = 0; RetValue = fread( pContents, nContents, 1, pFile ); fclose( pFile ); pContents[nContents] = 0; @@ -534,7 +534,7 @@ char * Scl_LibertyFileContents( char * pFileName, int nContents ) void Scl_LibertyStringDump( char * pFileName, Vec_Str_t * vStr ) { FILE * pFile = fopen( pFileName, "wb" ); - int RetValue = 0; + long RetValue = 0; if ( pFile == NULL ) { printf( "Scl_LibertyStringDump(): The output file is unavailable.\n" ); @@ -558,7 +558,7 @@ void Scl_LibertyStringDump( char * pFileName, Vec_Str_t * vStr ) Scl_Tree_t * Scl_LibertyStart( char * pFileName ) { Scl_Tree_t * p; - int RetValue; + long RetValue; // read the file into the buffer Scl_LibertyFixFileName( pFileName ); RetValue = Scl_LibertyFileSize( pFileName ); @@ -682,10 +682,10 @@ int Scl_LibertyReadCellIsThreeState( Scl_Tree_t * p, Scl_Item_t * pCell ) return 1; return 0; } -int Scl_LibertyReadCellOutputNum( Scl_Tree_t * p, Scl_Item_t * pCell ) +long Scl_LibertyReadCellOutputNum( Scl_Tree_t * p, Scl_Item_t * pCell ) { Scl_Item_t * pPin; - int Counter = 0; + long Counter = 0; Scl_ItemForEachChildName( p, pCell, pPin, "pin" ) if ( Scl_LibertyReadPinFormula(p, pPin) ) Counter++; |