81 for ( pMem = p->
pChunkLast; (pNext = *(
char **)pMem); pMem = pNext )
100 char * pMem, * pNext;
104 for ( pMem = p->
pChunkLast; (pNext = *(
char **)pMem); pMem = pNext )
170 for ( i = pBeg + 1; i < pEnd; i++ )
173 for ( j = i; j > pBeg && *(j-1) > Lit; j-- )
178 for ( i = pBeg + 1; i < pEnd; i++ )
181 printf(
"The clause contains two literals of the same variable: %d and %d.\n", *(i-1), *i );
189 nSize =
sizeof(
Sto_Cls_t) +
sizeof(
lit) * (pEnd - pBeg);
190 nSize = (nSize /
sizeof(
char*) + ((nSize %
sizeof(
char*)) > 0)) *
sizeof(
char*);
196 pClause->
nLits = pEnd - pBeg;
201 if ( p->
pHead == NULL )
203 if ( p->
pTail == NULL )
212 if ( pClause->
nLits == 0 )
216 printf(
"More than one empty clause!\n" );
290 return pPrev->
pLits[0] >> 1;
311 pFile = fopen( pFileName,
"w" );
314 printf(
"Error: Cannot open output file (%s).\n", pFileName );
321 for ( i = 0; i < (int)pClause->
nLits; i++ )
323 fprintf( pFile,
" 0\n" );
342 int Char, Number = 0, Sign = 0;
345 Char = fgetc( pFile );
348 }
while ( Char ==
' ' || Char ==
'\t' || Char ==
'\r' || Char ==
'\n' );
353 Char = fgetc( pFile );
354 if ( Char ==
' ' || Char ==
'\t' || Char ==
'\r' || Char ==
'\n' )
359 printf(
"Error: Wrong char (%c) in the input file.\n", Char );
366 Number = 10 * Number +
Char;
369 *pNumber = Sign? -Number : Number;
390 int nLits, nLitsAlloc,
Counter, Number;
394 pFile = fopen( pFileName,
"r" );
397 printf(
"Error: Cannot open input file (%s).\n", pFileName );
410 while ( fgets( pBuffer, 1024, pFile ) )
412 if ( pBuffer[0] ==
'c' )
414 if ( pBuffer[0] ==
'p' )
419 printf(
"Warning: Skipping line: \"%s\"\n", pBuffer );
434 if ( nLits == nLitsAlloc )
439 pLits[ nLits++ ] =
lit_read(Number);
442 printf(
"Error: The last clause was not saved.\n" );
452 printf(
"Error: The actual number of clauses (%d) is different than declared (%d).\n", Counter, p->
nClauses );
int Sto_ManMemoryReport(Sto_Man_t *p)
#define ABC_REALLOC(type, obj, num)
static int lit_var(lit l)
void Sto_ManMarkClausesA(Sto_Man_t *p)
ABC_NAMESPACE_IMPL_START char * Sto_ManMemoryFetch(Sto_Man_t *p, int nBytes)
DECLARATIONS ///.
#define ABC_ALLOC(type, num)
struct Sto_Cls_t_ Sto_Cls_t
BASIC TYPES ///.
void Sto_ManMarkRoots(Sto_Man_t *p)
int Sto_ManChangeLastClause(Sto_Man_t *p)
static lit lit_read(int s)
Sto_Man_t * Sto_ManAlloc()
MACRO DEFINITIONS ///.
#define ABC_NAMESPACE_IMPL_END
void Sto_ManMemoryStop(Sto_Man_t *p)
void Sto_ManDumpClauses(Sto_Man_t *p, char *pFileName)
#define ABC_NAMESPACE_IMPL_START
void Sto_ManFree(Sto_Man_t *p)
#define STO_MAX(a, b)
INCLUDES ///.
int Sto_ManAddClause(Sto_Man_t *p, lit *pBeg, lit *pEnd)
int Sto_ManLoadNumber(FILE *pFile, int *pNumber)
#define Sto_ManForEachClause(p, pCls)
Sto_Man_t * Sto_ManLoadClauses(char *pFileName)
static int lit_print(lit l)