30static char * Msat_FileRead( FILE * pFile );
47char * Msat_FileRead( FILE * pFile )
54 nFileSize = ftell( pFile );
58 pBuffer =
ABC_ALLOC(
char, nFileSize + 3 );
59 RetValue = fread( pBuffer, nFileSize, 1, pFile );
61 pBuffer[ nFileSize + 0] =
'\n';
62 pBuffer[ nFileSize + 1] =
'\0';
77static void Msat_ReadWhitespace(
char ** pIn )
79 while ((**pIn >= 9 && **pIn <= 13) || **pIn == 32)
94static void Msat_ReadNotWhitespace(
char ** pIn )
96 while ( !((**pIn >= 9 && **pIn <= 13) || **pIn == 32) )
111static void skipLine(
char ** pIn )
137static int Msat_ReadInt(
char ** pIn )
142 Msat_ReadWhitespace( pIn );
146 else if ( **pIn ==
'+' )
148 if ( **pIn <
'0' || **pIn >
'9' )
149 fprintf(stderr,
"PARSE ERROR! Unexpected char: %c\n", **pIn),
151 while ( **pIn >=
'0' && **pIn <=
'9' )
152 val = val*10 + (**pIn -
'0'),
154 return neg ? -val : val;
176 parsed_lit = Msat_ReadInt(pIn);
177 if ( parsed_lit == 0 )
179 var = abs(parsed_lit) - 1;
180 sign = (parsed_lit > 0);
183 printf(
"Variable %d is larger than the number of allocated variables (%d).\n", var+1, nVars );
201static int Msat_ReadDimacs(
char * pText,
Msat_Solver_t ** pS,
int fVerbose )
209 Msat_ReadWhitespace( &pIn );
212 else if ( *pIn ==
'c' )
214 else if ( *pIn ==
'p' )
217 Msat_ReadWhitespace( &pIn );
218 Msat_ReadNotWhitespace( &pIn );
220 nVars = Msat_ReadInt( &pIn );
221 nClas = Msat_ReadInt( &pIn );
234 printf(
"There is no parameter line.\n" );
237 Msat_ReadClause( &pIn,
p, pLits );
262 pText = Msat_FileRead( pFile );
263 Value = Msat_ReadDimacs( pText,
p, fVerbose );
#define ABC_ALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
int Msat_SolverParseDimacs(FILE *pFile, Msat_Solver_t **p, int fVerbose)
GLOBAL VARIABLES ///.
int Msat_SolverAddClause(Msat_Solver_t *p, Msat_IntVec_t *pLits)
void Msat_SolverSetVerbosity(Msat_Solver_t *p, int fVerbose)
struct Msat_IntVec_t_ Msat_IntVec_t
#define MSAT_VAR2LIT(v, s)
int Msat_SolverReadVarNum(Msat_Solver_t *p)
FUNCTION DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Msat_Solver_t_ Msat_Solver_t
INCLUDES ///.
int Msat_SolverSimplifyDB(Msat_Solver_t *p)
Msat_IntVec_t * Msat_IntVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Msat_Solver_t * Msat_SolverAlloc(int nVars, double dClaInc, double dClaDecay, double dVarInc, double dVarDecay, int fVerbose)
void Msat_SolverClean(Msat_Solver_t *p, int nVars)
void Msat_IntVecFree(Msat_IntVec_t *p)
void Msat_IntVecClear(Msat_IntVec_t *p)
void Msat_IntVecPush(Msat_IntVec_t *p, int Entry)