summaryrefslogtreecommitdiffstats
path: root/academic/orsa/orsa.patch
blob: 488f15b2d591a37edf442bfb8742560d37af6448 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

--- 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;