summaryrefslogtreecommitdiffstats
path: root/academic/orsa/orsa.patch
blob: 488f15b2d591a37edf442bfb8742560d37af6448 (plain)

--- orsa-0.7.0.orig/configure.in
+++ orsa-0.7.0/configure.in
@@ -27,6 +27,7 @@
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_PROG_AWK
+PKG_PROG_PKG_CONFIG
 
 dnl select the language for the test programs
 AC_LANG(C++)
@@ -35,10 +36,24 @@
 AM_PATH_GSL([1.5])
 
 dnl checks for the cln library
-AC_PATH_CLN([1.1.6], ac_cv_have_cln=yes, ac_cv_have_cln=no)
+PKG_CHECK_MODULES(CLN, cln >= 1.1.6, ac_cv_have_cln=yes, ac_cv_have_cln=no)
+
+if test "x$ac_cv_have_cln" = "xyes"; then
+    CLN_CPPFLAGS=`pkg-config --cflags cln`
+    CLN_LIBS=`pkg-config --libs cln`
+    AC_SUBST(CLN_CPPFLAGS)
+    AC_SUBST(CLN_LIBS)
+fi
 
 dnl checks for the ginac library
-AM_PATH_GINAC([1.2.0], ac_cv_have_ginac=yes, ac_cv_have_ginac=no)
+PKG_CHECK_MODULES(GiNaC, ginac >= 1.2.0, ac_cv_have_ginac=yes, ac_cv_have_ginac=no)
+
+if test "x$ac_cv_have_ginac" = "xyes"; then
+    GINACLIB_CPPFLAGS=`pkg-config --cflags ginac`
+    GINACLIB_LIBS=`pkg-config --libs ginac`
+    AC_SUBST(GINACLIB_CPPFLAGS)
+    AC_SUBST(GINACLIB_LIBS)
+fi
 
 dnl QT libs
 AC_PATH_QT
--- orsa-0.7.0.orig/src/liborsa/orsa_interaction_tree.cc
+++ orsa-0.7.0/src/liborsa/orsa_interaction_tree.cc
@@ -26,6 +26,7 @@
 #include "orsa_secure_math.h"
 #include "orsa_universe.h"
 
+#include <cstring>
 #include <iostream>
 #include <list>
 #include <stack>
--- orsa-0.7.0.orig/src/liborsa/orsa_units.h
+++ orsa-0.7.0/src/liborsa/orsa_units.h
@@ -28,6 +28,7 @@
 #include <cmath>
 #include <string>
 #include <cstdio>
+#include <cstdlib>
 
 #include "orsa_secure_math.h"
 #include "orsa_coord.h"
--- orsa-0.7.0.orig/src/liborsa/orsa_file.cc
+++ orsa-0.7.0/src/liborsa/orsa_file.cc
@@ -24,6 +24,8 @@
 
 #include "orsa_file.h"
 
+#include <algorithm>
+#include <cstring>
 #include <iostream>
 
 #include <ctype.h>
--- orsa-0.7.0.orig/src/liborsa/orsa_coord.cc
+++ orsa-0.7.0/src/liborsa/orsa_coord.cc
@@ -25,6 +25,7 @@
 #include "orsa_coord.h"
 
 #include <cmath>
+#include <cstdlib>
 #include <iostream>
 
 using namespace std;
--- orsa-0.7.0.orig/src/liborsa/orsa_body.h
+++ orsa-0.7.0/src/liborsa/orsa_body.h
@@ -183,7 +183,7 @@
     inline void SetVelocity(const double x, const double y, const double z) { Vector v(x,y,z); SetVelocity(v); }
     
     // b position - this position
-    inline Vector Body::distanceVector(const Body & b) const { return b.position()-position(); }
+    inline Vector distanceVector(const Body & b) const { return b.position()-position(); }
     inline double distance(const Body & b) const { return distanceVector(b).Length(); }
     
     // alias
--- orsa-0.7.0.orig/src/liborsa/orsa_file_jpl.cc
+++ orsa-0.7.0/src/liborsa/orsa_file_jpl.cc
@@ -27,6 +27,7 @@
 #include "orsa_secure_math.h"
 
 #include <cstdio>
+#include <cstring>
 
 #include "sdncal.h"
 #include "jpleph.h"
--- orsa-0.7.0.orig/src/orsa/xorsa.h
+++ orsa-0.7.0/src/orsa/xorsa.h
@@ -62,7 +62,7 @@
   ObjectItem(QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null);
   
  public:
-  int ObjectItem::compare(QListViewItem * i, int col, bool ascending) const;    
+  int compare(QListViewItem * i, int col, bool ascending) const;    
   
 };
 
--- orsa-0.7.0.orig/src/orsa/xorsa.cc
+++ orsa-0.7.0/src/orsa/xorsa.cc
@@ -580,25 +580,25 @@
      MPC_UNUSUALS));
   */
   
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/MPCORB.ZIP",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_MPCORB));
   
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/NEA.DAT",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_NEA));
   
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/DAILY.DAT",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_DAILY));
   
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/DistantObjects.DAT",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_DISTANT));
     
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/PHA.DAT",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_PHA));
   
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/Unusuals.DAT",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_UNUSUALS));
   
-  items.push_back(XOrsaDownloadItem("http://www.astro.cz/mpcorb/COMET.DAT",
+  items.push_back(XOrsaDownloadItem("",
 				    MPC_COMET));
   
   /* 
@@ -627,22 +627,22 @@
   items.push_back(XOrsaDownloadItem("http://www.amsat.org/amsat/ftp/keps/current/nasa.all",
 				    TLE_NASA));   
   
-  items.push_back(XOrsaDownloadItem("ftp://alphalma.cnrs-mrs.fr/pub/astro/geo.tle",
+  items.push_back(XOrsaDownloadItem("",
 				    TLE_GEO));   
   
   items.push_back(XOrsaDownloadItem("http://www.celestrak.com/NORAD/elements/gps-ops.txt",
 				    TLE_GPS));   
   
-  items.push_back(XOrsaDownloadItem("ftp://alphalma.cnrs-mrs.fr/pub/astro/iss.tle",
+  items.push_back(XOrsaDownloadItem("",
 				    TLE_ISS));   
   
-  items.push_back(XOrsaDownloadItem("http://www.orbitessera.com/data/orbital/kepele.txt",
+  items.push_back(XOrsaDownloadItem("",
 				    TLE_KEPELE));   
   
-  items.push_back(XOrsaDownloadItem("ftp://alphalma.cnrs-mrs.fr/pub/astro/visual.tle",
+  items.push_back(XOrsaDownloadItem("",
 				    TLE_VISUAL));   
   
-  items.push_back(XOrsaDownloadItem("ftp://alphalma.cnrs-mrs.fr/pub/astro/weather.tle",
+  items.push_back(XOrsaDownloadItem("",
 				    TLE_WEATHER));   
   
   // textures
--- orsa-0.7.0.orig/src/libxorsa/xorsa_object_selector.cc
+++ orsa-0.7.0/src/libxorsa/xorsa_object_selector.cc
@@ -40,7 +40,7 @@
   XOrsaObjectItem(QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null);
   
  public:
-  int XOrsaObjectItem::compare(QListViewItem * i, int col, bool ascending) const;    
+  int compare(QListViewItem * i, int col, bool ascending) const;    
   
 };
 
--- orsa-0.7.0.orig/src/libxorsa/xorsa_wrapper.cc
+++ orsa-0.7.0/src/libxorsa/xorsa_wrapper.cc
@@ -148,9 +148,9 @@
 {
   if (doDefaultOutput) inherited::vtrace(fmt, ap);
   char str[1024];
-  std::vsnprintf(str, sizeof(str) - 1, fmt, ap);
+  vsnprintf(str, sizeof(str) - 1, fmt, ap);
   char msg[1024];
-  std::snprintf(msg, sizeof(msg) - 1, "[%s][%s:%i] %s %s\n", 
+  snprintf(msg, sizeof(msg) - 1, "[%s][%s:%i] %s %s\n", 
     QTime::currentTime(Qt::LocalTime).toString("hh:mm:ss").latin1(),d->file,d->line, d->msg.c_str(), str);
   QString s = msg;
   XOrsaDebugEvent *de = new XOrsaDebugEvent(s);
--- orsa-0.7.0.orig/src/libxorsa/xorsa_download.cc
+++ orsa-0.7.0/src/libxorsa/xorsa_download.cc
@@ -221,6 +221,21 @@
   
 }
 
+void XOrsaDownloadEntry::secure_download(const QUrlInfo &urlInfo)
+{
+  QUrl proto_url(le->text());
+  // download file if it appears in the file listing
+  if (proto_url.fileName() == urlInfo.name()) {
+    // abort the current QFtp::List and QFtp::Close commands
+    ftp->abort();
+    
+    if (urlInfo.isFile() && urlInfo.isReadable())
+      ftp->get(proto_url.fileName(),file);
+    
+    ftp->close();
+  }
+}
+
 void XOrsaDownloadEntry::download() {
   QUrl proto_url(le->text());
   ftp = 0;
@@ -235,7 +250,7 @@
     ftp->login("anonymous","orsa_user@orsa.sf.net");
     ftp->cd(proto_url.dirPath());
     //
-    ftp->get(proto_url.fileName(),file);
+    ftp->list();
     // WARNING: don't close the file HERE!!
     //
     ftp->close();
@@ -246,6 +261,8 @@
     
     connect(ftp,SIGNAL(done(bool)),this,SLOT(post_download(bool)));
     
+    connect(ftp,SIGNAL(listInfo(const QUrlInfo &)),this,SLOT(secure_download(const QUrlInfo &)));
+    
   } else if (proto_url.protocol() == "http") {
     
     http = new QHttp;
--- orsa-0.7.0.orig/src/libxorsa/xorsa_plot_area.h
+++ orsa-0.7.0/src/libxorsa/xorsa_plot_area.h
@@ -57,7 +57,7 @@
   }
 }
 
-extern char *MonthNameShort[13]; // sdncal.h
+extern "C" char *MonthNameShort[13]; // sdncal.h
 
 void FineDate(QString & label, const orsa::UniverseTypeAwareTime & t, bool=true);
 void FineDate_HMS(QString & label, const orsa::UniverseTypeAwareTime & t);
--- orsa-0.7.0.orig/src/libxorsa/xorsa_download.h
+++ orsa-0.7.0/src/libxorsa/xorsa_download.h
@@ -91,6 +91,7 @@
   void pb_clicked();  
   void post_download(bool);
   void download();
+  void secure_download(const QUrlInfo &);
 };
 
 
--- orsa-0.7.0.orig/src/libxorsa/xorsa_analysis.h
+++ orsa-0.7.0/src/libxorsa/xorsa_analysis.h
@@ -129,7 +129,7 @@
   XOrsaPeaksListItem(QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null);
   
  public:
-  int XOrsaPeaksListItem::compare(QListViewItem * i, int col, bool ascending) const;    
+  int compare(QListViewItem * i, int col, bool ascending) const;    
   
 };
 
--- orsa-0.7.0.orig/src/libxorsa/xorsa_import_astorb_objects.h
+++ orsa-0.7.0/src/libxorsa/xorsa_import_astorb_objects.h
@@ -600,7 +600,7 @@
   inline XOrsaAstorbObjectItem(QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null) : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) { };
   
  public:
-  inline int XOrsaAstorbObjectItem::compare(QListViewItem *i, int col, bool ascending) const {
+  inline int compare(QListViewItem *i, int col, bool ascending) const {
 
     using std::atof;