summaryrefslogtreecommitdiff
path: root/impl
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-09-20 15:19:49 +1000
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-09-20 15:19:49 +1000
commitbb9a899b7c45b830c6b70e2811130a41ebb31ee5 (patch)
tree070ca77682bf7e3b72a94e78fbe0fcf337bdd98a /impl
parent3d206f03985b50beacae843d880bccdc91a9f424 (diff)
Remove exceptions and C++11 features for LLVM.
Diffstat (limited to 'impl')
-rw-r--r--impl/Complete.hpp3
-rw-r--r--impl/EquationSystem.hpp6
-rw-r--r--impl/IdMap.hpp6
-rw-r--r--impl/Log.hpp1
-rw-r--r--impl/Makefile2
-rw-r--r--impl/MaxStrategy.hpp24
-rw-r--r--impl/Operator.hpp2
-rw-r--r--impl/VariableAssignment.hpp6
-rw-r--r--impl/gmon.outbin0 -> 82849 bytes
-rw-r--r--impl/systems/10
-rw-r--r--impl/systems/gmon.outbin0 -> 82405 bytes
-rw-r--r--impl/systems/test.eqns4
12 files changed, 34 insertions, 20 deletions
diff --git a/impl/Complete.hpp b/impl/Complete.hpp
index 81ced52..5219c9e 100644
--- a/impl/Complete.hpp
+++ b/impl/Complete.hpp
@@ -16,7 +16,8 @@ struct Complete {
Complete(const T& value, const bool& infinity)
: _value(value), _infinity(infinity) {
if (value == 0 && infinity == true) {
- throw "Zero infinity? Die die die!";
+ std::cout << "throw exception" << *(char*)NULL;
+ //throw "Zero infinity? Die die die!";
}
}
Complete(const Complete& other)
diff --git a/impl/EquationSystem.hpp b/impl/EquationSystem.hpp
index 4c55bd7..c0734aa 100644
--- a/impl/EquationSystem.hpp
+++ b/impl/EquationSystem.hpp
@@ -97,14 +97,16 @@ struct EquationSystem {
Variable<Domain>* varFromExpr(const Expression<Domain>& expr) const {
if (_expr_to_var) { // we've indexed:
- auto* maxExpr = dynamic_cast<const MaxExpression<Domain>*>(&expr);
+ const MaxExpression<Domain>* maxExpr = dynamic_cast<const MaxExpression<Domain>*>(&expr);
if (maxExpr) {
return (*_expr_to_var)[*maxExpr];
} else {
return NULL;
}
} else {
- throw "Must index max expressions before attempting lookup";
+ std::cout << "throw exception" << *(char*)NULL;
+ return NULL;
+ //throw "Must index max expressions before attempting lookup";
}
}
diff --git a/impl/IdMap.hpp b/impl/IdMap.hpp
index b265e37..27c0806 100644
--- a/impl/IdMap.hpp
+++ b/impl/IdMap.hpp
@@ -33,13 +33,15 @@ struct IdMap {
}
virtual const V& operator[] (const T& x) const {
if (x.id() >= _length) {
- throw "Array out of bounds";
+ std::cout << "throw exception" << *(char*)NULL;
+ //throw "Array out of bounds";
}
return _assignment[x.id()];
}
virtual V& operator[] (const T& x) {
if (x.id() >= _length) {
- throw "Array out of bounds";
+ std::cout << "throw exception" << *(char*)NULL;
+ //throw "Array out of bounds";
}
return _assignment[x.id()];
}
diff --git a/impl/Log.hpp b/impl/Log.hpp
index b595105..f7fe6b6 100644
--- a/impl/Log.hpp
+++ b/impl/Log.hpp
@@ -9,6 +9,7 @@
#include <string>
#include <iostream>
#include <map>
+#include <cstdio>
namespace log {
diff --git a/impl/Makefile b/impl/Makefile
index 213657b..6fc6f3b 100644
--- a/impl/Makefile
+++ b/impl/Makefile
@@ -2,7 +2,7 @@ CC=gcc
CPP=g++
BUILD=build
PARSER=parser
-FLAGS=-Wall -Werror -Wextra -pedantic -lantlr3c -std=c++11
+FLAGS=-Wall -Werror -Wextra -pedantic -lantlr3c -fno-exceptions
NORMAL_FLAGS=$(FLAGS) -g -pg
OPTIMISED_FLAGS=$(FLAGS) -O3
diff --git a/impl/MaxStrategy.hpp b/impl/MaxStrategy.hpp
index d15884c..667c127 100644
--- a/impl/MaxStrategy.hpp
+++ b/impl/MaxStrategy.hpp
@@ -36,9 +36,9 @@ struct DynamicMaxStrategy : public MaxStrategy<Domain> {
_values(system.maxExpressionCount(), 0),
_stable(system.maxExpressionCount()),
_influence(system.maxExpressionCount(),
- IdSet<MaxExpression<Domain>>(system.maxExpressionCount())),
+ IdSet<MaxExpression<Domain> >(system.maxExpressionCount())),
_var_influence(system.variableCount(),
- IdSet<MaxExpression<Domain>>(system.maxExpressionCount()))
+ IdSet<MaxExpression<Domain> >(system.maxExpressionCount()))
{}
void setRho(DynamicVariableAssignment<Domain>& rho) {
@@ -54,8 +54,10 @@ struct DynamicMaxStrategy : public MaxStrategy<Domain> {
log::strategy << indent() << "Invalidating " << v << " - " << *_system[v] << std::endl;
_stable.filter(_var_influence[v]);
- for (auto it = _var_influence[v].begin();
- it != _var_influence[v].end();
+ for (typename IdSet<MaxExpression<Domain> >::iterator
+ it = _var_influence[v].begin(),
+ end = _var_influence[v].end();
+ it != end;
++it) {
solve(_system.maxExpression(*it));
}
@@ -75,7 +77,7 @@ private:
if (val != _values[x]) {
log::strategy << x << " => " << *x.arguments()[val] << std::endl;
- auto oldInfluence = _influence[x];
+ IdSet<MaxExpression<Domain> > oldInfluence = _influence[x];
_influence[x].clear();
_values[x] = val;
@@ -83,8 +85,10 @@ private:
_stable.filter(oldInfluence);
- for (auto it = oldInfluence.begin();
- it != oldInfluence.end();
+ for (typename IdSet<MaxExpression<Domain> >::iterator
+ it = oldInfluence.begin(),
+ end = oldInfluence.end();
+ it != end;
++it) {
solve(_system.maxExpression(*it));
}
@@ -135,9 +139,9 @@ private:
const EquationSystem<Domain>& _system;
mutable DynamicVariableAssignment<Domain>* _rho;
mutable IdMap<MaxExpression<Domain>,unsigned int> _values;
- mutable IdSet<MaxExpression<Domain>> _stable;
- mutable IdMap<MaxExpression<Domain>,IdSet<MaxExpression<Domain>>> _influence;
- mutable IdMap<Variable<Domain>,IdSet<MaxExpression<Domain>>> _var_influence;
+ mutable IdSet<MaxExpression<Domain> > _stable;
+ mutable IdMap<MaxExpression<Domain>,IdSet<MaxExpression<Domain> > > _influence;
+ mutable IdMap<Variable<Domain>,IdSet<MaxExpression<Domain> > > _var_influence;
};
/*template<typename Domain>
diff --git a/impl/Operator.hpp b/impl/Operator.hpp
index e8d6ca7..b67591f 100644
--- a/impl/Operator.hpp
+++ b/impl/Operator.hpp
@@ -95,7 +95,7 @@ template<typename Domain>
struct Multiplication : public Operator<Domain> {
virtual Domain eval(const std::vector<Domain>& arguments) const {
Domain result = 1;
- for (auto it = arguments.begin(),
+ for (typename std::vector<Domain>::const_iterator it = arguments.begin(),
end = arguments.end();
it != end;
++it) {
diff --git a/impl/VariableAssignment.hpp b/impl/VariableAssignment.hpp
index 371ba56..69eeef2 100644
--- a/impl/VariableAssignment.hpp
+++ b/impl/VariableAssignment.hpp
@@ -25,7 +25,7 @@ struct DynamicVariableAssignment : public VariableAssignment<Domain> {
_values(system.variableCount(), infinity<Domain>()),
_stable(system.variableCount()),
_influence(system.variableCount(),
- IdSet<Variable<Domain>>(system.variableCount()))
+ IdSet<Variable<Domain> >(system.variableCount()))
{ }
const Domain& operator[](const Variable<Domain>& var) const {
@@ -54,7 +54,7 @@ private:
if (val != _values[x]) {
log::fixpoint << x << " = " << val << std::endl;
- auto oldInfluence = _influence[x];
+ IdSet<Variable<Domain> > oldInfluence = _influence[x];
_influence[x].clear();
_values[x] = val;
@@ -62,7 +62,7 @@ private:
_stable.filter(oldInfluence);
- for (auto it = oldInfluence.begin();
+ for (typename IdSet<Variable<Domain> >::iterator it = oldInfluence.begin();
it != oldInfluence.end();
++it) {
solve(_system.variable(*it));
diff --git a/impl/gmon.out b/impl/gmon.out
new file mode 100644
index 0000000..2c22b41
--- /dev/null
+++ b/impl/gmon.out
Binary files differ
diff --git a/impl/systems/1 b/impl/systems/1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/impl/systems/1
diff --git a/impl/systems/gmon.out b/impl/systems/gmon.out
new file mode 100644
index 0000000..4cb3fe1
--- /dev/null
+++ b/impl/systems/gmon.out
Binary files differ
diff --git a/impl/systems/test.eqns b/impl/systems/test.eqns
new file mode 100644
index 0000000..cc554d5
--- /dev/null
+++ b/impl/systems/test.eqns
@@ -0,0 +1,4 @@
+xup = max(0, min(xup + 1, 9 + 1))
+yup = max(0, min(xup + yup, 9 + yup))
+xlow = max(0, xlow-1)
+ylow = max(0, ylow + xlow)