abc/src/map/amap/amapRead.c
/**Function*************************************************************

  Synopsis    [Eliminates comments from the input file.]

  Description [As a byproduct, this procedure also counts the number
  lines and dot-statements in the input file. This also joins non-comment 
  lines that are joined with a backspace '\']
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Function
Synopsis    [Eliminates comments from the input file.]

Description [As a byproduct, this procedure also counts the number
lines and dot-statements in the input file. This also joins non-comment
lines that are joined with a backspace '\']




Function Synopsis [ Eliminates comments from the input file . ] Description [ As a byproduct this procedure also counts the number lines and dot - statements in the input file . This also joins non - comment lines that are joined with a backspace ' \ ' ]
void Amap_RemoveComments( char * pBuffer, int * pnDots, int * pnLines )
{
    char * pCur;
    int nDots, nLines;
    nDots = nLines = 0;
    for ( pCur = pBuffer; *pCur; pCur++ )
    {
        if ( *pCur == '#' )
            while ( *pCur != '\n' )
                *pCur++ = ' ';
        if ( *pCur == '\n' ) {
        if (*(pCur-1)=='\r') {
        if (*(pCur-2)!='\\') nLines++;
        else {
            *(pCur-2) = ' ';
            *(pCur-1) = ' ';
            *pCur = ' ';
        }
        } else {
        if (*(pCur-1)!='\\') nLines++;
        else {
            *(pCur-1) = ' ';
            *pCur = ' ';
        }
        }
    }
        else if ( *pCur == '.' )
            nDots++;
    }
    if ( pnDots )
        *pnDots = nDots; 
    if ( pnLines )
        *pnLines = nLines; 
}
void Amap_RemoveComments ( char * pBuffer , int * pnDots , int * pnLines ) { char * pCur ; int nDots , nLines ; nDots = nLines = 0 ; for ( pCur = pBuffer ; * pCur ; pCur ++ ) { if ( * pCur == ' ' ) while ( * pCur != ' \n ' ) * pCur ++ = ' ' ; if ( * pCur == ' \n ' ) { if ( * ( pCur - 1 ) == ' \r ' ) { if ( * ( pCur - 2 ) != ' \\ ' ) nLines ++ ; else { * ( pCur - 2 ) = ' ' ; * ( pCur - 1 ) = ' ' ; * pCur = ' ' ; } } else { if ( * ( pCur - 1 ) != ' \\ ' ) nLines ++ ; else { * ( pCur - 1 ) = ' ' ; * pCur = ' ' ; } } } else if ( * pCur == ' ' ) nDots ++ ; } if ( pnDots ) * pnDots = nDots ; if ( pnLines ) * pnLines = nLines ; }
Function
Synopsis    [Eliminates comments from the input file.]
Function Synopsis [ Eliminates comments from the input file . ]
// scan through the buffer and eliminate comments // (in the BLIF file, comments are lines starting with "#") // if this is the beginning of comment // clean it with spaces until the new line statement // count the number of new lines and dots // DOS(R) file support // rewind to backslash and overwrite with a space // UNIX(TM) file support // rewind to backslash and overwrite with a space