]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
minor changes to c_interface
authorvijay_ganesh <vijay_ganesh@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 6 Sep 2009 20:52:21 +0000 (20:52 +0000)
committervijay_ganesh <vijay_ganesh@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 6 Sep 2009 20:52:21 +0000 (20:52 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@192 e59a4935-1847-0410-ae03-e826735625c1

src/AST/Makefile
src/AST/TestAST/asttest.cpp [moved from src/AST/asttest.cpp with 100% similarity]
src/AST/TestAST/bbtest.cpp [moved from src/AST/test/bbtest.cpp with 100% similarity]
src/AST/TestAST/cnftest.cpp [moved from src/AST/test/cnftest.cpp with 100% similarity]
src/c_interface/c_interface.cpp
src/main/Globals.h

index d976865c541f7676e7e6d256dbee2b1c02345b93..186f0cf8e607378a1b98e5f01e60d31fc71c5987 100644 (file)
@@ -6,7 +6,7 @@ OBJS = $(SRCS:.cpp=.o)
 CFLAGS += -I../sat/mtl -I../sat/core
 
 #Make the ast library for use by other modules
-libast.a:      $(OBJS) depend
+libast.a:$(OBJS) depend
        -rm -rf $@
        $(AR) rc $@ $(OBJS)
        $(RANLIB) $@
index 44b7f3375e00333ad22fa731e30c0a41e8263244..2a063f524726fbabb648e090f27a2b2deb5066b1 100644 (file)
@@ -27,7 +27,7 @@ bool cinterface_exprdelete_on_flag = false;
 
 /* GLOBAL FUNCTION: parser
  */
-extern int cvcparse();
+extern int cvcparse(void*);
 
 void vc_setFlags(char c) {
   std::string helpstring = "Usage: stp [-option] [infile]\n\n";
@@ -1448,6 +1448,40 @@ static char *val_to_binary_str(unsigned nbits, unsigned long long val) {
 }
 #endif
 
+// Expr vc_parseExpr(VC vc, char* infile) {
+//   bmstar b = (bmstar)vc;
+//   extern FILE* cvcin;
+//   const char * prog = "stp";
+  
+//   cvcin = fopen(infile,"r");
+//   if(cvcin == NULL) {
+//     fprintf(stderr,"%s: Error: cannot open %s\n",prog,infile);
+//     BEEV::FatalError("");
+//   }
+  
+//   BEEV::GlobalBeevMgr = b;
+
+//   CONSTANTBV::ErrCode c = CONSTANTBV::BitVector_Boot(); 
+//   if(0 != c) {
+//     cout << CONSTANTBV::BitVector_Error(c) << endl;
+//     return 0;
+//   }
+
+//   cvcparse();
+//   nodelist aaa = b->GetAsserts();
+
+//   //Don't add the query. It gets added automatically if the input file
+//   //has QUERY in it 
+//   //
+//   //node bbb = b->CreateNode(BEEV::NOT,b->GetQuery());
+//   node o =  b->CreateNode(BEEV::AND,aaa);
+//   //node o = b->CreateNode(BEEV::AND,oo,bbb);
+
+//   nodestar output = new node(o);
+//   return output;
+// } //end of vc_parseExpr()
+
+
 Expr vc_parseExpr(VC vc, char* infile) {
   bmstar b = (bmstar)vc;
   extern FILE* cvcin;
@@ -1460,23 +1494,20 @@ Expr vc_parseExpr(VC vc, char* infile) {
   }
   
   BEEV::GlobalBeevMgr = b;
-
   CONSTANTBV::ErrCode c = CONSTANTBV::BitVector_Boot(); 
   if(0 != c) {
     cout << CONSTANTBV::BitVector_Error(c) << endl;
     return 0;
   }
 
-  cvcparse();
-  nodelist aaa = b->GetAsserts();
-
-  //Don't add the query. It gets added automatically if the input file
-  //has QUERY in it 
-  //
-  //node bbb = b->CreateNode(BEEV::NOT,b->GetQuery());
-  node o =  b->CreateNode(BEEV::AND,aaa);
-  //node o = b->CreateNode(BEEV::AND,oo,bbb);
-
+  BEEV::ASTVec * AssertsQuery = new BEEV::ASTVec;
+  cvcparse((void*)AssertsQuery);
+  BEEV::ASTNode asserts = (*(BEEV::ASTVec*)AssertsQuery)[0];
+  BEEV::ASTNode query   = (*(BEEV::ASTVec*)AssertsQuery)[1];
+  //b->TopLevelSAT(asserts, query);
+  
+  node oo = b->CreateNode(BEEV::NOT,query);
+  node o = b->CreateNode(BEEV::AND,asserts,oo);
   nodestar output = new node(o);
   return output;
 } //end of vc_parseExpr()
index 212feedef57b31672d0cffed70f69210433577a4..abd66df07a88e9702aad267a9e91db95f8776b32 100644 (file)
@@ -18,6 +18,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <unistd.h>
+#include <vector>
 
 namespace MINISAT
 {
@@ -103,6 +104,9 @@ namespace BEEV
   //Useful global variables. There are very few them
   extern BeevMgr * GlobalBeevMgr;
 
+  //Empty vector
+  extern std::vector<BEEV::ASTNode> _empty_ASTVec;
+
   //Some global vars for the Main function.
   extern const char * prog;
   extern int linenum;