Skip to content

Commit

Permalink
More changees to compile new code with namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanminko committed Mar 3, 2024
1 parent a1159d9 commit 4de4605
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sat/bsat2/Alg.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA

#include "Vec.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -81,4 +83,6 @@ static inline void append(const vec<T>& from, vec<T>& to){ copy(from, to, true);
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "XAlloc.h"
#include "Vec.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -128,4 +130,6 @@ RegionAllocator<T>::alloc(int size)
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Dimacs.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "ParseUtils.h"
#include "SolverTypes.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -86,4 +88,6 @@ static void parse_DIMACS(gzFile input_stream, Solver& S) {
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA

#include "Vec.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -146,4 +148,6 @@ class Heap {
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
5 changes: 5 additions & 0 deletions src/sat/bsat2/MainSat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Dimacs.h"
#include "Solver.h"

ABC_NAMESPACE_IMPL_START

using namespace Minisat;

//=================================================================================================
Expand Down Expand Up @@ -195,3 +197,6 @@ extern "C" int MainSat(int argc, char** argv)
exit(0);
}
}


ABC_NAMESPACE_IMPL_END
5 changes: 5 additions & 0 deletions src/sat/bsat2/MainSimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Dimacs.h"
#include "SimpSolver.h"

ABC_NAMESPACE_IMPL_START

using namespace Minisat;

//=================================================================================================
Expand Down Expand Up @@ -204,3 +206,6 @@ extern "C" int MainSimp(int argc, char** argv)
exit(0);
}
}


ABC_NAMESPACE_IMPL_END
4 changes: 4 additions & 0 deletions src/sat/bsat2/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "IntTypes.h"
#include "Vec.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -190,4 +192,6 @@ class Map {
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Options.h"
#include "ParseUtils.h"

ABC_NAMESPACE_IMPL_START

using namespace Minisat;

int Minisat::parseOptions(int& argc, char** argv, bool strict)
Expand Down Expand Up @@ -91,3 +93,5 @@ int Minisat::printUsageAndExit (int argc, char** argv, bool verbose)
return 0;
}


ABC_NAMESPACE_IMPL_END
4 changes: 4 additions & 0 deletions src/sat/bsat2/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Vec.h"
#include "ParseUtils.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//==================================================================================================
Expand Down Expand Up @@ -384,4 +386,6 @@ class BoolOption : public Option
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA

namespace Minisat {

ABC_NAMESPACE_CXX_HEADER_START

//=================================================================================================

template<class T>
Expand Down Expand Up @@ -66,4 +68,6 @@ class Queue {
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/SimpSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "SimpSolver.h"
#include "System.h"

ABC_NAMESPACE_IMPL_START

using namespace Minisat;

//=================================================================================================
Expand Down Expand Up @@ -718,3 +720,5 @@ void SimpSolver::garbageCollect()
ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size);
to.moveTo(ca);
}

ABC_NAMESPACE_IMPL_END
3 changes: 3 additions & 0 deletions src/sat/bsat2/SimpSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Queue.h"
#include "Solver.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

Expand Down Expand Up @@ -194,4 +195,6 @@ inline lbool SimpSolver::solveLimited (const vec<Lit>& assumps, bool do_simp, bo
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Sort.h"
#include "Solver.h"

ABC_NAMESPACE_IMPL_START

using namespace Minisat;

//=================================================================================================
Expand Down Expand Up @@ -922,3 +924,5 @@ void Solver::garbageCollect()
ca.size()*ClauseAllocator::Unit_Size, to.size()*ClauseAllocator::Unit_Size);
to.moveTo(ca);
}

ABC_NAMESPACE_IMPL_END
3 changes: 3 additions & 0 deletions src/sat/bsat2/Solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Options.h"
#include "SolverTypes.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

Expand Down Expand Up @@ -370,4 +371,6 @@ inline void Solver::toDimacs (const char* file, Lit p, Lit q, Lit r){ ve
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/SolverTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "Map.h"
#include "Alloc.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -404,4 +406,6 @@ inline void Clause::strengthen(Lit p)
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
3 changes: 3 additions & 0 deletions src/sat/bsat2/Sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
//=================================================================================================
// Some sorting algorithms for vec's

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

Expand Down Expand Up @@ -95,4 +96,6 @@ template <class T> void sort(vec<T>& v) {
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
18 changes: 18 additions & 0 deletions src/sat/bsat2/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <stdio.h>
#include <stdlib.h>

ABC_NAMESPACE_IMPL_START

using namespace Minisat;

// TODO: split the memory reading functions into two: one for reading high-watermark of RSS, and
Expand Down Expand Up @@ -72,24 +74,40 @@ double Minisat::memUsedPeak() {
double peak = memReadPeak() / 1024;
return peak == 0 ? memUsed() : peak; }

ABC_NAMESPACE_IMPL_END

#elif defined(__FreeBSD__)

ABC_NAMESPACE_IMPL_START

double Minisat::memUsed(void) {
struct rusage ru;
getrusage(RUSAGE_SELF, &ru);
return (double)ru.ru_maxrss / 1024; }
double MiniSat::memUsedPeak(void) { return memUsed(); }

ABC_NAMESPACE_IMPL_END

#elif defined(__APPLE__)
#include <malloc/malloc.h>

ABC_NAMESPACE_IMPL_START

double Minisat::memUsed(void) {
malloc_statistics_t t;
malloc_zone_statistics(NULL, &t);
return (double)t.max_size_in_use / (1024*1024); }

ABC_NAMESPACE_IMPL_END

#else

ABC_NAMESPACE_IMPL_START

double Minisat::memUsed() { return 0; }
double Minisat::memUsedPeak() { return 0; }

ABC_NAMESPACE_IMPL_END

#endif

4 changes: 4 additions & 0 deletions src/sat/bsat2/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA

//-------------------------------------------------------------------------------------------------

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

static inline double cpuTime(void); // CPU-time in seconds.
Expand Down Expand Up @@ -57,4 +59,6 @@ static inline double Minisat::cpuTime(void) {

#endif

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/Vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include "IntTypes.h"
#include "XAlloc.h"

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand Down Expand Up @@ -127,4 +129,6 @@ void vec<T>::clear(bool dealloc) {
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif
4 changes: 4 additions & 0 deletions src/sat/bsat2/XAlloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA
#include <errno.h>
#include <stdlib.h>

ABC_NAMESPACE_CXX_HEADER_START

namespace Minisat {

//=================================================================================================
Expand All @@ -42,4 +44,6 @@ static inline void* xrealloc(void *ptr, size_t size)
//=================================================================================================
}

ABC_NAMESPACE_CXX_HEADER_END

#endif

0 comments on commit 4de4605

Please sign in to comment.