File: octave-3.8.0.patch

package info (click to toggle)
plplot 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 26,280 kB
  • ctags: 13,512
  • sloc: ansic: 83,001; xml: 27,081; ada: 18,878; cpp: 15,966; tcl: 11,651; python: 7,075; f90: 7,058; ml: 6,974; java: 6,665; perl: 5,029; sh: 2,210; makefile: 199; lisp: 75; sed: 25; fortran: 7
file content (284 lines) | stat: -rw-r--r-- 10,889 bytes parent folder | download | duplicates (2)
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
From 5b167cc12daf9ea275c17fedaefc975450613ab2 Mon Sep 17 00:00:00 2001
From: Karl Wette <karl.wette@ligo.org>
Date: Mon, 13 Jan 2014 18:24:17 +1300
Subject: [PATCH] octave: update support to Octave version 3.8.0

---
 CHANGES.current           |  26 ++++++++++++
 Doc/Manual/Octave.html    |   7 +---
 Lib/octave/octrun.swg     | 104 ++++++++++++++++++++++++++++++++++++++--------
 Lib/octave/octruntime.swg |  14 +++----
 4 files changed, 122 insertions(+), 29 deletions(-)

#diff --git a/CHANGES.current b/CHANGES.current
#index a4fc5db..c711536 100644
#--- a/CHANGES.current
#+++ b/CHANGES.current
@@ -5,6 +5,32 @@ See the RELEASENOTES file for a summary of changes in each release.
 Version 3.0.0 (in progress)
 ============================
 
+2014-01-13: kwwette
+            [Octave] update support to Octave version 3.8.0
+
+            - Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1
+              will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see
+                http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e
+              So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to
+              enable features requiring Octave version major.minor.patch or later.
+
+              For Octave versions prior to 3.8.1, we reconstruct values for
+              OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER,
+              extracted from Octave's ChangeLogs. An additional hack is needed to
+              distinguish between Octave <= 3.2.x and 3.8.0, neither of which define
+              OCTAVE_API_VERSION_NUMBER.
+
+            - Octave 3.8.0 deprecates symbol_table::varref(), so remove its use
+              for this and future versions of Octave.
+
+            - Octave 3.8.0 removes octave_value::is_real_nd_array(), used in
+              octave_swig_type::dims(). Its use is not required here, so remove it.
+
+            - Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0.
+
+            - Updated Octave documentation with tested Octave versions, and added a
+              warning against using versions <= 3.x.x, which are no longer tested.
+
 2014-01-11: wsfulton
             Fix and document the naturalvar feature override behaviour - the naturalvar
             feature attached to a variable name has precedence over the naturalvar
diff --git a/Doc/Manual/Octave.html b/Doc/Manual/Octave.html
index 84c0a0f..3e12ce6 100644
--- a/Doc/Manual/Octave.html
+++ b/Doc/Manual/Octave.html
@@ -59,11 +59,8 @@
 
 
 <p>
-The SWIG implemention was first based on Octave 2.9.12, so this is the minimum version required. Testing has only been done on Linux.
-</p>
-
-<p>
-As of SWIG 2.0.7, the Octave module has been tested with Octave versions 3.0.5, 3.2.4, 3.4.3, and 3.6.1.
+As of SWIG 3.0.0, the Octave module has been tested with Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0.
+Use of Octave versions older than 3.x.x is not recommended, as these versions are no longer tested with SWIG.
 </p>
 
 <H2><a name="Octave_nn3"></a>30.2 Running SWIG</H2>
diff --git a/Lib/octave/octrun.swg b/Lib/octave/octrun.swg
index 41d1c7a..2174a0f 100644
--- a/Lib/octave/octrun.swg
+++ b/Lib/octave/octrun.swg
@@ -1,20 +1,88 @@
 
 #include <octave/version.h>
-#ifndef OCTAVE_API_VERSION_NUMBER
-
-  // Hack to distinguish between Octave 3.2 and earlier versions before OCTAVE_API_VERSION_NUMBER existed
-  #define ComplexLU __ignore
-  #include <octave/CmplxLU.h>
-  #undef ComplexLU
-  #ifdef octave_Complex_LU_h
-  # define OCTAVE_API_VERSION_NUMBER 36
-  #else
-  # define OCTAVE_API_VERSION_NUMBER 37
-  #endif
 
-#endif
+// Macro for enabling features which require Octave version >= major.minor.patch
+#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
+  ( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + OCTAVE_PATCH_VERSION >= ((major)<<16) + ((minor)<<8) + (patch) )
+
+// Reconstruct Octave major, minor, and patch versions for releases prior to 3.8.1
+#if !defined(OCTAVE_MAJOR_VERSION)
+
+# if !defined(OCTAVE_API_VERSION_NUMBER)
+
+// Hack to distinguish between Octave 3.8.0, which removed OCTAVE_API_VERSION_NUMBER but did not yet
+// introduce OCTAVE_MAJOR_VERSION, and Octave <= 3.2, which did not define OCTAVE_API_VERSION_NUMBER
+#  include <octave/ov.h>
+#  if defined(octave_ov_h)
+#   define OCTAVE_MAJOR_VERSION 3
+#   define OCTAVE_MINOR_VERSION 8
+#   define OCTAVE_PATCH_VERSION 0
+#  else
+
+// Hack to distinguish between Octave 3.2 and earlier versions, before OCTAVE_API_VERSION_NUMBER existed
+#   define ComplexLU __ignore
+#   include <octave/CmplxLU.h>
+#   undef ComplexLU
+#   if defined(octave_Complex_LU_h)
+
+// We know only that this version is prior to Octave 3.2, i.e. OCTAVE_API_VERSION_NUMBER < 37
+#    define OCTAVE_MAJOR_VERSION 3
+#    define OCTAVE_MINOR_VERSION 1
+#    define OCTAVE_PATCH_VERSION 99
+
+#   else
+
+// OCTAVE_API_VERSION_NUMBER == 37
+#    define OCTAVE_MAJOR_VERSION 3
+#    define OCTAVE_MINOR_VERSION 2
+#    define OCTAVE_PATCH_VERSION 0
+
+#   endif // defined(octave_Complex_LU_h)
+
+#  endif // defined(octave_ov_h)
 
-#if OCTAVE_API_VERSION_NUMBER < 37
+// Correlation between Octave API and version numbers extracted from Octave's
+// ChangeLogs; version is the *earliest* released Octave with that API number
+# elif OCTAVE_API_VERSION_NUMBER >= 48
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 6
+#  define OCTAVE_PATCH_VERSION 0
+
+# elif OCTAVE_API_VERSION_NUMBER >= 45
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 4
+#  define OCTAVE_PATCH_VERSION 1
+
+# elif OCTAVE_API_VERSION_NUMBER >= 42
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 3
+#  define OCTAVE_PATCH_VERSION 54
+
+# elif OCTAVE_API_VERSION_NUMBER >= 41
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 3
+#  define OCTAVE_PATCH_VERSION 53
+
+# elif OCTAVE_API_VERSION_NUMBER >= 40
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 3
+#  define OCTAVE_PATCH_VERSION 52
+
+# elif OCTAVE_API_VERSION_NUMBER >= 39
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 3
+#  define OCTAVE_PATCH_VERSION 51
+
+# else // OCTAVE_API_VERSION_NUMBER == 38
+#  define OCTAVE_MAJOR_VERSION 3
+#  define OCTAVE_MINOR_VERSION 3
+#  define OCTAVE_PATCH_VERSION 50
+
+# endif // !defined(OCTAVE_API_VERSION_NUMBER)
+
+#endif // !defined(OCTAVE_MAJOR_VERSION)
+
+#if !SWIG_OCTAVE_PREREQ(3,2,0)
 #define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, FS ## cname, args, nargout, doc)
 #else
 #define SWIG_DEFUN(cname, wname, doc) DEFUNX_DLD(#cname, wname, G ## cname, args, nargout, doc)
@@ -427,7 +495,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
           if (error_state) return dim_vector(1,1);
         }
         return d;
-      } else if (out.is_matrix_type() || out.is_real_nd_array() || out.is_numeric_type() ) {
+      } else if (out.is_matrix_type() || out.is_numeric_type() ) {
         if (out.rows()==1 || out.columns()==1) {
            Array<int> a = out.int_vector_value();
            if (error_state) return dim_vector(1,1);
@@ -746,7 +814,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
       return outarg(0).string_value();
     }
 
-#if OCTAVE_API_VERSION_NUMBER >= 40
+#if SWIG_OCTAVE_PREREQ(3,3,52)
     virtual octave_map map_value() const {
       return octave_map();
     }
@@ -982,7 +1050,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
     virtual std::string string_value(bool force = false) const 
       { return ptr->string_value(force); }
 
-#if OCTAVE_API_VERSION_NUMBER >= 40
+#if SWIG_OCTAVE_PREREQ(3,3,52)
     virtual octave_map map_value() const
       { return ptr->map_value(); }
 #else
@@ -1293,10 +1361,12 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value
 }
 
 SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) {
-#if OCTAVE_API_VERSION_NUMBER < 37
+#if !SWIG_OCTAVE_PREREQ(3,2,0)
   link_to_global_variable(curr_sym_tab->lookup(name, true));
 #else
+#if !SWIG_OCTAVE_PREREQ(3,8,0)
   symbol_table::varref(name);
+#endif
   symbol_table::mark_global(name);
 #endif
 }
diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg
index 43313c3..fbf2007 100644
--- a/Lib/octave/octruntime.swg
+++ b/Lib/octave/octruntime.swg
@@ -25,7 +25,7 @@ static bool SWIG_init_user(octave_swig_type* module_ns);
 SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
   bool retn;
   {
-#if OCTAVE_API_VERSION_NUMBER < 38
+#if !SWIG_OCTAVE_PREREQ(3,3,50)
     unwind_protect::begin_frame("SWIG_Octave_LoadModule");
     unwind_protect_int(error_state);
     unwind_protect_int(warning_state);
@@ -44,7 +44,7 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
     discard_warning_messages = true;
     feval(name, octave_value_list(), 0);
     retn = (error_state == 0);
-#if OCTAVE_API_VERSION_NUMBER < 38
+#if !SWIG_OCTAVE_PREREQ(3,3,50)
     unwind_protect::run_frame("SWIG_Octave_LoadModule");
 #endif
   }
@@ -57,7 +57,7 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
 SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) {
   bool retn;
   {
-#if OCTAVE_API_VERSION_NUMBER < 38
+#if !SWIG_OCTAVE_PREREQ(3,3,50)
     unwind_protect::begin_frame("SWIG_Octave_InstallFunction");
     unwind_protect_int(error_state);
     unwind_protect_int(warning_state);
@@ -80,7 +80,7 @@ SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::st
     error_state = 0;
     feval("autoload", args, 0);
     retn = (error_state == 0);
-#if OCTAVE_API_VERSION_NUMBER < 38
+#if !SWIG_OCTAVE_PREREQ(3,3,50)
     unwind_protect::run_frame("SWIG_Octave_InstallFunction");
 #endif
   }
@@ -196,7 +196,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
   // definitely affects version 3.2.*, not sure about 3.3.*, seems to be fixed in
   // version 3.4.* and above. can be turned off with macro definition.
 #ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK
-#if 36 < OCTAVE_API_VERSION_NUMBER && OCTAVE_API_VERSION_NUMBER < 45
+#if SWIG_OCTAVE_PREREQ(3,2,0) && !SWIG_OCTAVE_PREREQ(3,4,1)
   octave_exit = ::_Exit;
 #endif
 #endif
@@ -212,7 +212,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
 
     // workaround bug in octave where installing global variable of custom type and then
     // exiting without explicitly clearing the variable causes octave to segfault.
-#if OCTAVE_API_VERSION_NUMBER > 36
+#if SWIG_OCTAVE_PREREQ(3,2,0)
     octave_value_list eval_args;
     eval_args.append("base");
     eval_args.append("function __swig_atexit__; "
@@ -297,7 +297,7 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
       }
     }
 
-#if OCTAVE_API_VERSION_NUMBER < 37
+#if !SWIG_OCTAVE_PREREQ(3,2,0)
     mlock(me->name());
 #else
     mlock();
-- 
1.8.5.1