From fd01bba1e5e7b211515e897ac3e18d10773a4114 Mon Sep 17 00:00:00 2001 From: vijay_ganesh Date: Mon, 12 Oct 2009 20:58:21 +0000 Subject: [PATCH] removed ASTUtil.h and merged with UsefulDefs.h git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@297 e59a4935-1847-0410-ae03-e826735625c1 --- src/AST/ASTUtil.cpp | 11 +++++-- src/AST/ASTUtil.h | 77 -------------------------------------------- src/AST/UsefulDefs.h | 62 ++++++++++++++++++++++++++++++----- 3 files changed, 62 insertions(+), 88 deletions(-) delete mode 100644 src/AST/ASTUtil.h diff --git a/src/AST/ASTUtil.cpp b/src/AST/ASTUtil.cpp index 48e32f7..0989802 100644 --- a/src/AST/ASTUtil.cpp +++ b/src/AST/ASTUtil.cpp @@ -7,7 +7,7 @@ ********************************************************************/ // -*- c++ -*- -#include "ASTUtil.h" +#include "UsefulDefs.h" #include "../main/Globals.h" namespace BEEV { @@ -40,8 +40,13 @@ namespace BEEV if (!strcmp(functionname, "print_func_stats")) { cout << endl; - for (function_counters::iterator it = s.begin(), itend = s.end(); it != itend; it++) - cout << "Number of times the function: " << it->first << ": is called: " << it->second << endl; + for (function_counters::iterator + it = s.begin(), itend = s.end(); + it != itend; it++) + cout << "Number of times the function: " + << it->first + << ": is called: " + << it->second << endl; return; } s[functionname] += 1; diff --git a/src/AST/ASTUtil.h b/src/AST/ASTUtil.h deleted file mode 100644 index e69aa59..0000000 --- a/src/AST/ASTUtil.h +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************** - * AUTHORS: Vijay Ganesh - * - * BEGIN DATE: November, 2005 - * - * LICENSE: Please view LICENSE file in the home dir of this Program - ********************************************************************/ -// -*- c++ -*- - -#ifndef ASTUTIL_H -#define ASTUTIL_H - -#include -#include -#include - -#ifdef EXT_HASH_MAP - #include - #include -#elif defined(TR1_UNORDERED_MAP) - #include - #include -#else - #include - #include -#endif - -#define HASHMAP hash_map -#define HASHSET hash_set -#define HASHMULTISET hash_multiset - -using namespace std; -namespace BEEV { -#ifdef EXT_HASH_MAP - using namespace __gnu_cxx; -#endif - - extern void (*vc_error_hdlr)(const char* err_msg); - /*Spacer class is basically just an int, but the new class allows - overloading of << with a special definition that prints the int as - that many spaces. */ - class Spacer { - public: - int _spaces; - Spacer(int spaces) { _spaces = spaces; } - friend ostream& operator<<(ostream& os, const Spacer &ind); - }; - - inline Spacer spaces(int width) { - Spacer sp(width); - return sp; - } - - struct eqstr { - bool operator()(const char* s1, const char* s2) const { - return strcmp(s1, s2) == 0; - } - }; - - // Table for storing function count stats. -#ifdef TR1_UNORDERED_MAP - typedef tr1::unordered_map< - const char*, - int, - tr1::hash, - eqstr> function_counters; -#else - typedef HASHMAP< - const char*, - int, - hash, - eqstr> function_counters; -#endif - - void CountersAndStats(const char * functionname); -}; // end namespace. -#endif diff --git a/src/AST/UsefulDefs.h b/src/AST/UsefulDefs.h index 473cad8..b6e50eb 100644 --- a/src/AST/UsefulDefs.h +++ b/src/AST/UsefulDefs.h @@ -21,7 +21,10 @@ #include #include -#define INITIAL_TABLE_SIZE 100 +#include "../main/Globals.h" +#include "ASTKind.h" +#include "../extlib-constbv/constantbv.h" +#include "RunTimes.h" #ifdef EXT_HASH_MAP #include @@ -37,18 +40,12 @@ #include #endif -#include "../main/Globals.h" -#include "ASTUtil.h" -#include "ASTKind.h" -#include "../extlib-constbv/constantbv.h" -#include "RunTimes.h" - #define HASHMAP hash_map #define HASHSET hash_set #define HASHMULTISET hash_multiset +#define INITIAL_TABLE_SIZE 100 namespace BEEV { - using namespace std; using namespace MINISAT; #ifdef EXT_HASH_MAP @@ -77,6 +74,55 @@ namespace BEEV { typedef vector ASTVec; typedef unsigned int * CBV; extern ASTVec _empty_ASTVec; + + // Error handling function + extern void (*vc_error_hdlr)(const char* err_msg); + + /****************************************************************** + * Class Spacer: + * + * Spacer class is basically just an int, but the new class allows + * overloading of << with a special definition that prints the int + * as that many spaces. + ******************************************************************/ + class Spacer { + public: + int _spaces; + Spacer(int spaces) + { + _spaces = spaces; + } + friend ostream& operator<<(ostream& os, const Spacer &ind); + }; //End of class spacer + + inline Spacer spaces(int width) { + Spacer sp(width); + return sp; + } + + struct eqstr { + bool operator()(const char* s1, const char* s2) const { + return strcmp(s1, s2) == 0; + } + }; + + // function_counters: Table for storing function count stats. +#ifdef TR1_UNORDERED_MAP + typedef tr1::unordered_map< + const char*, + int, + tr1::hash, + eqstr> function_counters; +#else + typedef HASHMAP, + eqstr> function_counters; +#endif + + // Function that computes various kinds of statistics for the phases + // of STP + void CountersAndStats(const char * functionname); }; //end of namespace #endif -- 2.47.3