35     if ( HexChar >= 
'0' && HexChar <= 
'9' )
 
   37     if ( HexChar >= 
'A' && HexChar <= 
'F' )
 
   38         return HexChar - 
'A' + 10;
 
   39     if ( HexChar >= 
'a' && HexChar <= 
'f' )
 
   40         return HexChar - 
'a' + 10;
 
   48     assert( HexDigit >= 0 && HexDigit < 16 );
 
   50         fprintf( pFile, 
"%d", HexDigit );
 
   52         fprintf( pFile, 
"%c", 
'A' + HexDigit-10 );
 
   58     int nWords = (nVars < 7)? 1 : (1 << (nVars-6));
 
   59     int k, Digit, nDigits = (nWords << 4);
 
   62     if ( pString[0] == 
'0' && pString[1] == 
'x' )
 
   65     EndSymbol = pString[nDigits];
 
   69     assert( EndSymbol == 
' ' || EndSymbol == 
'\n' || EndSymbol == 
'\r' || EndSymbol == 
'\0' );
 
   72     for ( k = 0; k < nDigits; k++ )
 
   75         assert( Digit >= 0 && Digit < 16 );
 
   83     int nDigits, Digit, k;
 
   86     nDigits = (1 << (nVars-2));
 
   87     for ( k = 0; k < nDigits; k++ )
 
   90         assert( Digit >= 0 && Digit < 16 );
 
  102     p->
nWords = (nVars < 7) ? 1 : (1 << (nVars-6));
 
  109     for ( i = 1; i < p->
nFuncs; i++ )
 
  129     pFile = fopen( pFileName, 
"r" );
 
  132         printf( 
"Cannot open file \"%s\" for reading.\n", pFileName );
 
  137     nFileSize = ftell( pFile );  
 
  141     pBuffer = (
char *)
malloc( nFileSize + 3 );
 
  142     RetValue = fread( pBuffer, nFileSize, 1, pFile );
 
  145     pBuffer[ nFileSize + 0] = 
'\n';
 
  146     pBuffer[ nFileSize + 1] = 
'\n';
 
  148     pBuffer[ nFileSize + 2] = 
'\0';
 
  158     int i, nVars, nLines;
 
  166     if ( pContents == NULL )
 
  170     for ( i = 0; pContents[i]; i++ )
 
  171         if ( pContents[i] == 
' ' || pContents[i] == 
'\n' || pContents[i] == 
'\r' )
 
  173     if ( pContents[i] == 0 )
 
  174         printf( 
"Strange, the input file does not have spaces and new-lines...\n" );
 
  177     if ( pContents[0] == 
'0' && pContents[1] == 
'x' )
 
  181     for ( nVars = 0; nVars < 32; nVars++ )
 
  182         if ( 4 * i == (1 << nVars) ) 
 
  184     if ( nVars < 2 || nVars > 16 )
 
  186         printf( 
"Does not look like the input file contains truth tables...\n" );
 
  194     for ( i = 0; pContents[i]; i++ )
 
  195         nLines += (pContents[i] == 
'\n');
 
  215     if ( pContents == NULL )
 
  222     for ( nLines = i = 0; pContents[i] != 
'\n'; )
 
  228         while ( pContents[i++] != 
'\n' );
 
  243     pFile = fopen( pFileName, 
"wb" );
 
  246         printf( 
"Cannot open file \"%s\" for writing.\n", pFileName );
 
  249     for ( i = 0; i < p->
nFuncs; i++ )
 
  252         fprintf( pFile, 
"\n" );
 
  261     pFile = fopen( pFileName, 
"w" );
 
  264         printf( 
"Cannot open file \"%s\" for writing.\n", pFileName );
 
  267     for ( i = 0; i < p->
nFuncs; i++ )
 
  270         fprintf( pFile, 
"\n" );
 
  279     pFile = fopen( pFileName, 
"w" );
 
  282         printf( 
"Cannot open file \"%s\" for writing.\n", pFileName );
 
  285     for ( i = 0; i < p->
nFuncs; i++ )
 
  287         fprintf( pFile, 
"0" );
 
  288         fprintf( pFile, 
"x" );
 
  289         for ( j=p->
nWords-1; j >= 0; j-- )
 
  291         fprintf( pFile, 
"\n" );
 
  293     fprintf( pFile, 
"\n" );
 
  300     pFile = fopen( pFileName, 
"w" );
 
  303         printf( 
"Cannot open file \"%s\" for writing.\n", pFileName );
 
  306     for ( i = 0; i < p->
nFuncs; i++ )
 
  308         fprintf( pFile, 
"0" );
 
  309         fprintf( pFile, 
"x" );
 
  310         for ( j=p->
nWords-1; j >= 0; j-- )
 
  312         fprintf( pFile, 
"\n" );
 
  314     fprintf( pFile, 
"\n" );
 
static void Abc_TruthXorHex(word *p, int k, int d)
 
static char * Abc_FileRead(char *pFileName)
 
static void Abc_TruthWriteHexDigit(FILE *pFile, int HexDigit)
 
static Abc_TtStore_t * Abc_Create_TtSpore(char *pFileInput)
 
static void WriteToFile1(char *pFileName, Abc_TtStore_t *p, word **a)
 
static ABC_NAMESPACE_IMPL_START int Abc_TruthGetBit(word *p, int i)
 
void Abc_TruthStoreFree(Abc_TtStore_t *p)
 
static int Abc_TruthGetHex(word *p, int k)
 
Abc_TtStore_t * setTtStore(char *pFileInput)
 
static void WriteToFile(char *pFileName, Abc_TtStore_t *p, word *a)
 
static Abc_TtStore_t * Abc_TruthStoreAlloc(int nVars, int nFuncs)
 
static void Abc_TruthGetParams(char *pFileName, int *pnVars, int *pnTruths)
 
unsigned __int64 word
DECLARATIONS ///. 
 
static void WriteToFile2(char *pFileName, Abc_TtStore_t *p, word *a)
 
#define ABC_NAMESPACE_IMPL_END
 
static int Abc_TruthReadHexDigit(char HexChar)
 
#define ABC_NAMESPACE_IMPL_START
 
static void Abc_TruthStoreRead(char *pFileName, Abc_TtStore_t *p)
 
static void Abc_TruthStoreWrite(char *pFileName, Abc_TtStore_t *p)
 
static void Abc_TruthReadHex(word *pTruth, char *pString, int nVars)
 
static void Abc_TruthSetBit(word *p, int i)
 
static void Abc_TruthXorBit(word *p, int i)
 
static void Abc_TruthSetHex(word *p, int k, int d)
 
static void Abc_TruthWriteHex(FILE *pFile, word *pTruth, int nVars)