Skip to content

Commit 3172302

Browse files
authored
Merge pull request #17 from VincentDerk/enhancement/port-win-mac
Port code to windows + mac
2 parents e09c463 + 12d8a10 commit 3172302

18 files changed

Lines changed: 450 additions & 396 deletions

src/shared/Interface/AnalyzerData.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#include <string.h>
1717

1818

19-
using namespace std;
19+
using std::vector;
20+
using std::ifstream;
21+
using std::ofstream;
22+
using std::endl;
2023

2124
enum DATA_IDX
2225
{

src/shared/RealNumberTypes.h

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
#ifndef REALNUMBERTYPES_H
2-
#define REALNUMBERTYPES_H
3-
4-
5-
6-
using namespace std;
7-
8-
#ifdef GMP_BIGNUM
9-
#include <gmpxx.h>
10-
typedef mpf_class CRealNum;
11-
extern bool pow(mpf_class &res, const mpf_class &base, unsigned long int iExp);
12-
extern bool pow2(mpf_class &res, unsigned long int iExp);
13-
extern bool to_div_2exp(mpf_class &res, const mpf_class &op1, unsigned long int iExp);
14-
extern double to_doubleT(const mpf_class &num);
15-
16-
17-
18-
#else
19-
typedef long double CRealNum;
20-
21-
extern bool pow(CRealNum &res, CRealNum base, unsigned long int iExp);
22-
extern bool pow2(CRealNum &res, unsigned long int iExp);
23-
extern bool to_div_2exp(CRealNum &res, const CRealNum &op1, unsigned long int iExp);
24-
extern long double to_doubleT(const CRealNum &num);
25-
#endif
26-
27-
#endif
1+
#ifndef REALNUMBERTYPES_H
2+
#define REALNUMBERTYPES_H
3+
4+
5+
6+
7+
#ifdef GMP_BIGNUM
8+
#include <gmpxx.h>
9+
typedef mpf_class CRealNum;
10+
extern bool pow(mpf_class &res, const mpf_class &base, unsigned long int iExp);
11+
extern bool pow2(mpf_class &res, unsigned long int iExp);
12+
extern bool to_div_2exp(mpf_class &res, const mpf_class &op1, unsigned long int iExp);
13+
extern double to_doubleT(const mpf_class &num);
14+
15+
16+
17+
#else
18+
typedef long double CRealNum;
19+
20+
extern bool pow(CRealNum &res, CRealNum base, unsigned long int iExp);
21+
extern bool pow2(CRealNum &res, unsigned long int iExp);
22+
extern bool to_div_2exp(CRealNum &res, const CRealNum &op1, unsigned long int iExp);
23+
extern long double to_doubleT(const CRealNum &num);
24+
#endif
25+
26+
#endif

src/shared/SomeTime.h

Lines changed: 101 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,101 @@
1-
#ifndef SOMETIME_H
2-
#define SOMETIME_H
3-
4-
#include<cstdlib>
5-
#include <sys/time.h> // To seed random generator
6-
7-
using namespace std;
8-
9-
extern bool diffTimes(timeval& ret, const timeval &tLater, const timeval &tEarlier);
10-
11-
class CStepTime
12-
{
13-
static int timeVal;
14-
15-
public:
16-
17-
static void makeStart()
18-
{
19-
timeVal = 0;
20-
}
21-
22-
static int getTime()
23-
{
24-
return timeVal;
25-
}
26-
27-
static void stepTime()
28-
{
29-
timeVal++;
30-
}
31-
};
32-
33-
34-
35-
class CStopWatch
36-
{
37-
timeval timeStart;
38-
timeval timeStop;
39-
40-
long int timeBound;
41-
42-
public:
43-
44-
CStopWatch() {}
45-
~CStopWatch() {}
46-
47-
bool timeBoundBroken()
48-
{
49-
timeval actTime;
50-
gettimeofday(&actTime,NULL);
51-
52-
return actTime.tv_sec - timeStart.tv_sec > timeBound;
53-
}
54-
55-
bool markStartTime()
56-
{
57-
return gettimeofday(&timeStart,NULL) == 0;
58-
}
59-
60-
bool markStopTime()
61-
{
62-
return gettimeofday(&timeStop,NULL) == 0;
63-
}
64-
65-
66-
void setTimeBound(long int seconds)
67-
{
68-
timeBound = seconds;
69-
}
70-
71-
long int getTimeBound()
72-
{
73-
return timeBound;
74-
}
75-
76-
double getElapsedTime()
77-
{
78-
timeval r;
79-
double retT;
80-
diffTimes(r,timeStop, timeStart);
81-
82-
retT = r.tv_usec;
83-
retT /= 1000000.0;
84-
retT += (double)r.tv_sec;
85-
return retT;
86-
}
87-
88-
unsigned int getElapsedusecs()
89-
{
90-
unsigned int retT;
91-
timeval r;
92-
93-
diffTimes(r,timeStop, timeStart);
94-
95-
retT = r.tv_usec;
96-
97-
retT += r.tv_sec * 1000000;
98-
return retT;
99-
}
100-
};
101-
102-
#endif
1+
#ifndef SOMETIME_H
2+
#define SOMETIME_H
3+
4+
#include<cstdlib>
5+
#include <sys/time.h> // To seed random generator
6+
7+
8+
extern bool diffTimes(timeval& ret, const timeval &tLater, const timeval &tEarlier);
9+
10+
class CStepTime
11+
{
12+
static int timeVal;
13+
14+
public:
15+
16+
static void makeStart()
17+
{
18+
timeVal = 0;
19+
}
20+
21+
static int getTime()
22+
{
23+
return timeVal;
24+
}
25+
26+
static void stepTime()
27+
{
28+
timeVal++;
29+
}
30+
};
31+
32+
33+
34+
class CStopWatch
35+
{
36+
timeval timeStart;
37+
timeval timeStop;
38+
39+
long int timeBound;
40+
41+
public:
42+
43+
CStopWatch() {}
44+
~CStopWatch() {}
45+
46+
bool timeBoundBroken()
47+
{
48+
timeval actTime;
49+
gettimeofday(&actTime,NULL);
50+
51+
return actTime.tv_sec - timeStart.tv_sec > timeBound;
52+
}
53+
54+
bool markStartTime()
55+
{
56+
return gettimeofday(&timeStart,NULL) == 0;
57+
}
58+
59+
bool markStopTime()
60+
{
61+
return gettimeofday(&timeStop,NULL) == 0;
62+
}
63+
64+
65+
void setTimeBound(long int seconds)
66+
{
67+
timeBound = seconds;
68+
}
69+
70+
long int getTimeBound()
71+
{
72+
return timeBound;
73+
}
74+
75+
double getElapsedTime()
76+
{
77+
timeval r;
78+
double retT;
79+
diffTimes(r,timeStop, timeStart);
80+
81+
retT = r.tv_usec;
82+
retT /= 1000000.0;
83+
retT += (double)r.tv_sec;
84+
return retT;
85+
}
86+
87+
unsigned int getElapsedusecs()
88+
{
89+
unsigned int retT;
90+
timeval r;
91+
92+
diffTimes(r,timeStop, timeStart);
93+
94+
retT = r.tv_usec;
95+
96+
retT += r.tv_sec * 1000000;
97+
return retT;
98+
}
99+
};
100+
101+
#endif

src/src_sharpSAT/Basics.cpp

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
#include "Basics.h"
2-
3-
4-
bool CSolverConf::analyzeConflicts = true;
5-
bool CSolverConf::doNonChronBackTracking = true;
6-
7-
bool CSolverConf::allowComponentCaching = true;
8-
bool CSolverConf::allowImplicitBCP = true;
9-
10-
bool CSolverConf::allowPreProcessing = true;
11-
12-
bool CSolverConf::quietMode = false;
13-
14-
bool CSolverConf::smoothNNF = false;
15-
16-
bool CSolverConf::ensureAllLits = true;
17-
18-
bool CSolverConf::disableDynamicDecomp = false;
19-
20-
unsigned int CSolverConf::secsTimeBound = 100000;
21-
22-
unsigned int CSolverConf::maxCacheSize = 0;
23-
24-
int CSolverConf::nodeCount = 0;
25-
26-
27-
char TriValuetoChar(TriValue v)
28-
{
29-
switch (v)
30-
{
31-
case W:
32-
return '1';
33-
case F:
34-
return '0';
35-
case X:
36-
return '.';
37-
};
38-
return '.';
39-
}
1+
#include "Basics.h"
2+
3+
4+
bool CSolverConf::analyzeConflicts = true;
5+
bool CSolverConf::doNonChronBackTracking = true;
6+
7+
bool CSolverConf::allowComponentCaching = true;
8+
bool CSolverConf::allowImplicitBCP = true;
9+
10+
bool CSolverConf::allowPreProcessing = true;
11+
12+
bool CSolverConf::quietMode = false;
13+
14+
bool CSolverConf::smoothNNF = false;
15+
16+
bool CSolverConf::ensureAllLits = true;
17+
18+
bool CSolverConf::disableDynamicDecomp = false;
19+
20+
unsigned int CSolverConf::secsTimeBound = 100000;
21+
22+
size_t CSolverConf::maxCacheSize = 0;
23+
24+
int CSolverConf::nodeCount = 0;
25+
26+
27+
char TriValuetoChar(TriValue v)
28+
{
29+
switch (v)
30+
{
31+
case W:
32+
return '1';
33+
case F:
34+
return '0';
35+
case X:
36+
return '.';
37+
};
38+
return '.';
39+
}

0 commit comments

Comments
 (0)