Package: chemeq
Version: 2.3
Severity: important
Tags: patch

chemeq fails to build on at least mips/mipsel because it mixes up C and
C++ namespaces. The appended patch removes the C includes, and uses the
C++ "long double" function templates for exp() and log().

[The reason why it failed on mips is that "long double" is there an
alias for "double", and the corresponding expl()/logl() functions
are only defined in the header when c99 standard is requested.
g++ however implies gnu++98 standard.]


Thiemo


--- chemeq-2.3.old/src/chemeq.cc        2007-09-16 16:57:31.000000000 +0100
+++ chemeq-2.3/src/chemeq.cc    2007-11-13 01:21:15.000000000 +0000
@@ -1,8 +1,7 @@
 // -*- coding: utf-8 -*-
 #include "chemeq.h"
-#include <math.h>
-#include <sstream>
-#include <stdlib.h>
+#include <cmath>
+#include <cstdlib>
 
 atome lesatomes[] ={
 {-1, "e"},
@@ -574,7 +573,7 @@ void Chemeq::addChemeq(const Chemeq * c)
     fraction n1=nbelectron(), n2=c->nbelectron();
     long double e = e1+e2;
     fraction n=n1+n2;
-    if (n.i==0) val=expl(-e/R/T0);
+    if (n.i==0) val=exp(-e/R/T0);
     else val=-e*n.d/n.i/Faraday;
   } else {
     val=MINVAL;
@@ -591,7 +590,7 @@ void Chemeq::subChemeq(const Chemeq * c)
     long double e = e1-e2;
     fraction n=n1-n2;
     if (n.i==0) {
-      val=expl(-e/R/T0);
+    val=exp(-e/R/T0);
     } else{
       val=-e*n.d/n.i/Faraday;
     }
@@ -608,7 +607,7 @@ long double Chemeq::enthalpy() const{
   if (redox()){
     return -val*n.i/n.d*Faraday;
   } else {
-    return -R*T0*logl(val);
+    return -R*T0*log(val);
   }
 }
 
--- chemeq-2.3.old/src/chemeq.h 2007-08-26 19:31:08.000000000 +0100
+++ chemeq-2.3/src/chemeq.h     2007-11-13 01:22:43.000000000 +0000
@@ -2,7 +2,7 @@
 #ifndef CHEMEQ_H
 #define CHEMEQ_H
 
-#include <string.h>
+#include <cstring>
 #include <sstream>
 #include <iostream>
 #include <vector>



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to