Just in case anyone is interested, I have resolved the problems
of building a usable python version of sparky with debian ppc sid by
patching it to build under gcc 3.2.2. Interestingly the gcc 2.95.4
build segfaults but a gcc 3.2.2 build works fine. Since sparky uses
its own __tkinter.so with threads disabled I am able to build against
tcl8.3 even though sid's python 2.1 is built against tcl8.4. The
attached patch has been sent upstream.
Jack
diff -uNr sparky/c++/assignguess.cc sparky.works/c++/assignguess.cc
--- sparky/c++/assignguess.cc 1999-11-09 11:38:31.0 -0500
+++ sparky.works/c++/assignguess.cc 2002-12-23 18:20:01.0 -0500
@@ -144,7 +144,7 @@
{
double pos = interval_mod(r->frequency(),
alias_onto.min[a], alias_onto.max[a]);
- dev += abs(pos - center[a]) / threshold;
+ dev += myabs(pos - center[a]) / threshold;
}
}
}
diff -uNr sparky/c++/brukerfile.cc sparky.works/c++/brukerfile.cc
--- sparky/c++/brukerfile.cc 2000-05-26 23:10:55.0 -0400
+++ sparky.works/c++/brukerfile.cc 2002-12-23 18:20:01.0 -0500
@@ -30,7 +30,11 @@
// SW_h = sweep width in Hz = SFO1 * SW (4587.155342)
//
+#if __GNUC__ >= 3
+#include
+#else
#include // Use ifstream
+#endif
#include // Use FILE *
#include // Use atoi()
#include // Use strchr()
diff -uNr sparky/c++/contour.cc sparky.works/c++/contour.cc
--- sparky/c++/contour.cc 1999-12-14 12:36:12.0 -0500
+++ sparky.works/c++/contour.cc 2002-12-23 18:20:01.0 -0500
@@ -127,12 +127,12 @@
// Should really use floor() and ceil() here but it creates
// off by one rounding problems.
- index_region.min[a] = round(sp->map(r.max[a], a, PPM, INDEX));
- index_region.max[a] = round(sp->map(r.min[a], a, PPM, INDEX));
+ index_region.min[a] = myround(sp->map(r.max[a], a, PPM, INDEX));
+ index_region.max[a] = myround(sp->map(r.min[a], a, PPM, INDEX));
}
else
{
- int center = round(sp->map(r.center(a), a, PPM, INDEX));
+ int center = myround(sp->map(r.center(a), a, PPM, INDEX));
index_region.min[a] = center;
index_region.max[a] = center;
}
diff -uNr sparky/c++/format.cc sparky.works/c++/format.cc
--- sparky/c++/format.cc 2001-11-13 16:46:31.0 -0500
+++ sparky.works/c++/format.cc 2002-12-23 18:20:01.0 -0500
@@ -1,6 +1,10 @@
//
//
+#if __GNUC__ >= 3
+#include
+#else
#include // Use ostream, istream
+#endif
#include // Use sprintf(), fputc(), ...
#include // Use strchr(), strcmp()
#include // Use isspace(), isalpha()
@@ -3530,7 +3534,7 @@
fprintf(fp, "extraPeakPlanes");
for (i = 0; i < sp->dimension(); i++) {
double d = sp->scale(v->visible_depth(i), i, PPM, INDEX);
- fprintf(fp, " %d", max(0, round(d-1)));
+ fprintf(fp, " %d", max(0, myround(d-1)));
}
fputc('\n', fp);
}
diff -uNr sparky/c++/format.h sparky.works/c++/format.h
--- sparky/c++/format.h 1999-11-24 15:43:07.0 -0500
+++ sparky.works/c++/format.h 2002-12-23 18:20:01.0 -0500
@@ -4,8 +4,13 @@
#ifndef FORMAT_HEADER_INCLUDED
#define FORMAT_HEADER_INCLUDED
+#if __GNUC__ >= 3
+#include
+using namespace std;
+#else
class istream;
class ostream;
+#endif
class Condition;
class Object_Table;
diff -uNr sparky/c++/integrate.cc sparky.works/c++/integrate.cc
--- sparky/c++/integrate.cc 1999-12-10 16:59:54.0 -0500
+++ sparky.works/c++/integrate.cc 2002-12-23 18:20:01.0 -0500
@@ -309,7 +309,7 @@
for (int row = 0; row < h; row++) {
for (int col = 0; col < w; col++) {
double weighted_height = (*dp++) * (*wp++);
- double abs_height = abs(weighted_height);
+ double abs_height = myabs(weighted_height);
integral += weighted_height;
abs_integral += abs_height;
comx += col * abs_height;
@@ -542,7 +542,7 @@
Peak *pk2 = (Peak *) overlapped[pi2];
bool close = true;
for (int a = 0 ; a < sp->dimension() ; ++a)
- if (abs(pk1->position()[a] - pk2->position()[a])
+ if (myabs(pk1->position()[a] - pk2->position()[a])
> sp->mIntegrate.grouping_dist[a])
close = false;
if (close)
diff -uNr sparky/c++/label.cc sparky.works/c++/label.cc
--- sparky/c++/label.cc 2001-12-06 19:28:36.0 -0500
+++ sparky.works/c++/label.cc 2002-12-23 18:20:01.0 -0500
@@ -15,6 +15,7 @@
#include "mathconst.h" // use MC_PI
#include "memalloc.h" // use new()
#include "notifier.h" // use Notifier
+#include
#include "num.h"
#include "peakgp.h"
#include "peak.h"
@@ -602,12 +603,12 @@
pointerLab1Y = labelCenterY + deltaY - labelYDelta * factor;
pointerLab2Y = labelCenterY - deltaY - labelYDelta * factor;
}
- else if (is_between(abs(aOL), 135, 180)
- && is_between(abs(aOR), 135, 180)) {
+ else if (is_between(myabs(aOL), 135, 180)
+ && is_between(myabs(aOR), 135, 180)) {
/*
* case C, label left of peak
*/
- factor = (aOR