configure.in | 9 +++------ libqalculate/Calculator.cc | 2 +- libqalculate/Calculator.h | 6 ++++-- libqalculate/DataSet.h | 2 +- libqalculate/Function.cc | 4 ++-- libqalculate/Function.h | 2 +- libqalculate/Number.cc | 9 +-------- libqalculate/includes.h | 4 +++- 8 files changed, 16 insertions(+), 22 deletions(-) diff --git a/configure.in b/configure.in index dc18e2c..be3a6f0 100644 --- a/configure.in +++ b/configure.in @@ -91,16 +91,13 @@ AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"]) AC_LANG([C++]) -AC_PATH_CLN(1.1.0, [ - LIBS="$LIBS $CLN_LIBS" - CPPFLAGS="$CPPFLAGS $CLN_CPPFLAGS" - AC_DEFINE(HAVE_LIBCLN,1,[If CLN can be used]) -], AC_MSG_ERROR([No suitable installed version of CLN could be found.])) - +PKG_CHECK_MODULES([CLN], [cln >= 1.2.2], [], + [AC_MSG_WARN([No suitable version of CLN can be found])]) PKG_CHECK_MODULES(GLIB, [ glib-2.0 libxml-2.0 >= 2.3.8 + cln >= 1.2.2 ]) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) diff --git a/libqalculate/Calculator.cc b/libqalculate/Calculator.cc index 50c74e1..d90a35b 100644 --- a/libqalculate/Calculator.cc +++ b/libqalculate/Calculator.cc @@ -1538,7 +1538,7 @@ void Calculator::saveState() { void Calculator::restoreState() { } void Calculator::clearBuffers() { - for(Sgi::hash_map::iterator it = ids_p.begin(); it != ids_p.end(); ++it) { + for(std::tr1::unordered_map::iterator it = ids_p.begin(); it != ids_p.end(); ++it) { if(!it->second) { freed_ids.push_back(it->first); id_structs.erase(it->first); diff --git a/libqalculate/Calculator.h b/libqalculate/Calculator.h index 746e618..cdb9053 100644 --- a/libqalculate/Calculator.h +++ b/libqalculate/Calculator.h @@ -198,8 +198,10 @@ class Calculator { vector data_sets; - Sgi::hash_map id_structs; - Sgi::hash_map ids_p; + //Sgi::hash_map id_structs; + std::tr1::unordered_map id_structs; + //Sgi::hash_map ids_p; + std::tr1::unordered_map ids_p; vector freed_ids; size_t ids_i; diff --git a/libqalculate/DataSet.h b/libqalculate/DataSet.h index 34a2961..8182ec4 100644 --- a/libqalculate/DataSet.h +++ b/libqalculate/DataSet.h @@ -17,7 +17,7 @@ /** @file */ -typedef Sgi::vector::iterator DataObjectPropertyIter; +typedef std::vector::iterator DataObjectPropertyIter; /// A a data set object. /** Data objects consist of property-value pairs. */ diff --git a/libqalculate/Function.cc b/libqalculate/Function.cc index 0cc9baf..8c6f0d3 100644 --- a/libqalculate/Function.cc +++ b/libqalculate/Function.cc @@ -359,7 +359,7 @@ Argument *MathFunction::getArgumentDefinition(size_t index) { return NULL; } void MathFunction::clearArgumentDefinitions() { - for(Sgi::hash_map::iterator it = argdefs.begin(); it != argdefs.end(); ++it) { + for(std::tr1::unordered_map::iterator it = argdefs.begin(); it != argdefs.end(); ++it) { delete it->second; } argdefs.clear(); @@ -444,7 +444,7 @@ int MathFunction::parse(MathStructure &mstruct, const string &argv, const ParseO } bool MathFunction::testArguments(MathStructure &vargs) { size_t last = 0; - for(Sgi::hash_map::iterator it = argdefs.begin(); it != argdefs.end(); ++it) { + for(std::tr1::unordered_map::iterator it = argdefs.begin(); it != argdefs.end(); ++it) { if(it->first > last) { last = it->first; } diff --git a/libqalculate/Function.h b/libqalculate/Function.h index 2686e43..d01b24b 100644 --- a/libqalculate/Function.h +++ b/libqalculate/Function.h @@ -71,7 +71,7 @@ class MathFunction : public ExpressionItem { int argc; int max_argc; vector default_values; - Sgi::hash_map argdefs; + std::tr1::unordered_map argdefs; size_t last_argdef_index; bool testArguments(MathStructure &vargs); virtual MathStructure createFunctionMathStructureFromVArgs(const MathStructure &vargs); diff --git a/libqalculate/Number.cc b/libqalculate/Number.cc index 64d5b92..f1a8fa4 100644 --- a/libqalculate/Number.cc +++ b/libqalculate/Number.cc @@ -15,6 +15,7 @@ #include "Calculator.h" #include +#include #include "util.h" #define REAL_PRECISION_FLOAT_RE(x) cln::cl_float(cln::realpart(x), cln::float_format(PRECISION + 1)) @@ -28,14 +29,6 @@ using namespace cln; -void cln::cl_abort() { - CALCULATOR->error(true, "CLN Error: see terminal output (probably too large or small floating point number)", NULL); - if(CALCULATOR->busy()) { - CALCULATOR->abort_this(); - } else { - exit(0); - } -} string printCL_I(cl_I integ, int base = 10, bool display_sign = true, BaseDisplay base_display = BASE_DISPLAY_NORMAL, bool lower_case = false) { if(base == BASE_ROMAN_NUMERALS) { diff --git a/libqalculate/includes.h b/libqalculate/includes.h index 68ce764..9199feb 100644 --- a/libqalculate/includes.h +++ b/libqalculate/includes.h @@ -30,6 +30,8 @@ using namespace std; #include #include #include +#include +#include #ifdef __GNUC__ @@ -37,7 +39,7 @@ using namespace std; # include namespace Sgi { using ::hash_map; }; // inherit globals # else -# include +# include # if __GNUC__ == 3 && __GNUC_MINOR__ == 0 namespace Sgi = std; // GCC 3.0 # else