46 char Carry = 0;
int i;
47 for ( i = 0; i < nBits; i++ )
49 char Sum = pRes[i] + pAdd[i] + Carry;
57 assert( Sum >= 0 && Sum < Radix );
66 char * pRes = Vec_StrArray( vRes );
67 char * pSum = Vec_StrArray( vSum );
int i;
68 assert( Radix >= 2 && Radix < 36 );
71 for ( i = 0; i < nBits; i++ )
73 if ( Abc_InfoHasBit(pBits, Start + i) )
80 for ( i = nBits - 1; i >= 0; i-- )
83 Vec_StrShrink( vRes, i+1 );
92 Vec_StrReverseOrder( vRes );
93 if ( Vec_StrSize(vRes) == 0 )
94 Vec_StrPush( vRes,
'0' );
95 Vec_StrPush( vRes,
'\0' );
113 int i, NameId, Name, Start = -1, nBits = -1;
114 assert( pCex->nRegs == 0 );
119 printf(
"Cannot find \"%s\" among nodes of the network.\n", pName );
124 if ( Name == NameId )
127 if ( i == Vec_IntSize(&
p->vValues) )
129 printf(
"Cannot find \"%s\" among primary inputs of the network.\n", pName );
133 assert( Radix == 2 || Radix == 10 || Radix == 16 );
135 printf(
"((%s %s%s))\n", pName, Radix == 16 ?
"#x" : (Radix == 2 ?
"#b" :
""), Vec_StrArray(vNum) );
150static inline int Wlc_StdinCollectStop(
Vec_Str_t * vInput,
char * pLine,
int LineSize )
152 char * pStr = Vec_StrArray(vInput) + Vec_StrSize(vInput) - LineSize;
153 if ( Vec_StrSize(vInput) < LineSize )
155 return !
strncmp( pStr, pLine, LineSize );
159 int c, DirSize =
strlen(pDir);
160 Vec_Str_t * vInput = Vec_StrAlloc( 1000 );
161 while ( (c = fgetc(stdin)) != EOF )
163 Vec_StrPush( vInput, (
char)c );
164 if ( c ==
')' && Wlc_StdinCollectStop(vInput, pDir, DirSize) )
167 Vec_StrPush( vInput,
'\0' );
172 int c, Count = 0, fSomeInput = 0;
173 Vec_Str_t * vInput = Vec_StrAlloc( 1000 );
174 while ( (c = fgetc(stdin)) != EOF )
176 Vec_StrPush( vInput, (
char)c );
178 Count++, fSomeInput = 1;
181 if ( Count == 0 && fSomeInput )
185 Vec_StrFreeP( &vInput );
187 Vec_StrPush( vInput,
'\0' );
196 Vec_StrFree( vInput );
202 Abc_Print( 1,
"Something did not work out with the command \"%s\".\n", pCmd );
207 printf(
"undecided\n" );
217 char * pName =
strtok( Vec_StrArray(vInput),
" \n\t\r()" );
219 if (
strcmp(pName,
"get-value") )
221 Abc_Print( 1,
"ABC is expecting \"get-value\" in a follow-up input of the satisfiable problem.\n" );
222 Vec_StrFree( vInput );
228 Abc_Print( 1,
"ABC received a follow-up input for a problem that is not known to be satisfiable.\n" );
229 Vec_StrFree( vInput );
233 pName =
strtok( NULL,
"() \n\t\r" );
237 Abc_Print( 1,
"ABC does not have a counter-example available to process a \"get-value\" request.\n" );
238 Vec_StrFree( vInput );
243 Vec_StrFree( vInput );
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
ABC_DLL int Abc_FrameReadProbStatus(Abc_Frame_t *pAbc)
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
ABC_DLL void * Abc_FrameReadCex(Abc_Frame_t *pAbc)
struct Vec_Str_t_ Vec_Str_t
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
#define Vec_IntForEachEntryTriple(vVec, Entry1, Entry2, Entry3, i)
Vec_Str_t * Wlc_ConvertToRadix(unsigned *pBits, int Start, int nBits, int Radix)
Vec_Str_t * Wlc_StdinCollectQuery()
void Wlc_NtkReport(Wlc_Ntk_t *p, Abc_Cex_t *pCex, char *pName, int Radix)
Vec_Str_t * Wlc_StdinCollectProblem(char *pDir)
int Wlc_StdinProcessSmt(Abc_Frame_t *pAbc, char *pCmd)
ABC_NAMESPACE_IMPL_START void Wlc_ComputeSum(char *pRes, char *pAdd, int nBits, int Radix)
DECLARATIONS ///.
struct Wlc_Ntk_t_ Wlc_Ntk_t
Wlc_Ntk_t * Wlc_ReadSmtBuffer(char *pFileName, char *pBuffer, char *pLimit, int fOldParser, int fPrintTree)
void Wlc_SetNtk(Abc_Frame_t *pAbc, Wlc_Ntk_t *pNtk)