Merge remote-tracking branch 'origin/master' into HEAD
This commit is contained in:
commit
be0b975e6b
977 changed files with 15369 additions and 35050 deletions
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
|
||||
|
||||
#include <exception>
|
||||
|
||||
namespace Swig {
|
||||
|
||||
class Director {
|
||||
|
|
|
|||
2
Lib/octave/extra-install.list
Normal file
2
Lib/octave/extra-install.list
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# see top-level Makefile.in
|
||||
octheaders.hpp
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
Defines the As/From conversors for double/float complex, you need to
|
||||
provide complex Type, the Name you want to use in the conversors,
|
||||
the complex Constructor method, and the Real and Imag complex
|
||||
accesor methods.
|
||||
accessor methods.
|
||||
|
||||
See the std_complex.i and ccomplex.i for concrete examples.
|
||||
*/
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
int res = SWIG_AddCast(SWIG_AsVal(float)(ov, &d));
|
||||
if (SWIG_IsOK(res)) {
|
||||
if (val)
|
||||
*val = Constructor(d, 0.0);
|
||||
*val = Constructor(d, 0.0f);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,6 @@
|
|||
* be the case.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
%{
|
||||
#include <climits>
|
||||
#include <iostream>
|
||||
%}
|
||||
|
||||
|
||||
#if !defined(SWIG_NO_EXPORT_ITERATOR_METHODS)
|
||||
# if !defined(SWIG_EXPORT_ITERATOR_METHODS)
|
||||
# define SWIG_EXPORT_ITERATOR_METHODS SWIG_EXPORT_ITERATOR_METHODS
|
||||
|
|
@ -64,7 +58,6 @@ namespace swig {
|
|||
|
||||
%fragment("OctSequence_Base","header",fragment="<stddef.h>")
|
||||
{
|
||||
%#include <functional>
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
|
|
@ -576,8 +569,17 @@ namespace swig {
|
|||
} else {
|
||||
return octseq.check() ? SWIG_OK : SWIG_ERROR;
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
}
|
||||
%#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
catch (octave::execution_exception& exec) {
|
||||
}
|
||||
%#endif
|
||||
catch (std::exception& e) {
|
||||
%#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
if (seq) // Know that octave is not in an error state
|
||||
%#else
|
||||
if (seq&&!error_state)
|
||||
%#endif
|
||||
error("swig type error: %s",e.what());
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
|
|
|||
130
Lib/octave/octheaders.hpp
Normal file
130
Lib/octave/octheaders.hpp
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
//
|
||||
// This header includes all C++ headers required for generated Octave wrapper code.
|
||||
// Using a single header file allows pre-compilation of Octave headers, as follows:
|
||||
// * Check out this header file:
|
||||
// swig -octave -co octheaders.hpp
|
||||
// * Pre-compile header file into octheaders.hpp.gch:
|
||||
// g++ -c ... octheaders.hpp
|
||||
// * Use pre-compiled header file:
|
||||
// g++ -c -include octheaders.hpp ...
|
||||
//
|
||||
|
||||
#if !defined(_SWIG_OCTAVE_OCTHEADERS_HPP)
|
||||
#define _SWIG_OCTAVE_OCTHEADERS_HPP
|
||||
|
||||
// Required C++ headers
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <functional>
|
||||
#include <complex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
// Minimal headers to define Octave version
|
||||
#include <octave/oct.h>
|
||||
#include <octave/version.h>
|
||||
|
||||
// Macro for enabling features which require Octave version >= major.minor.patch
|
||||
// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers
|
||||
#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
|
||||
( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((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)
|
||||
|
||||
// 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)
|
||||
|
||||
// Required Octave headers
|
||||
#include <octave/Cell.h>
|
||||
#include <octave/dynamic-ld.h>
|
||||
#include <octave/oct-env.h>
|
||||
#include <octave/oct-map.h>
|
||||
#include <octave/ov-scalar.h>
|
||||
#include <octave/ov-fcn-handle.h>
|
||||
#include <octave/parse.h>
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#include <octave/interpreter.h>
|
||||
#else
|
||||
#include <octave/toplev.h>
|
||||
#endif
|
||||
#include <octave/unwind-prot.h>
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#include <octave/call-stack.h>
|
||||
#endif
|
||||
|
||||
#endif // !defined(_SWIG_OCTAVE_OCTHEADERS_HPP)
|
||||
|
|
@ -89,10 +89,6 @@ SWIGRUNTIME void SWIG_Octave_SetModule(void *clientdata, swig_module_info *point
|
|||
|
||||
// Runtime API implementation
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
typedef octave_value_list(*octave_func) (const octave_value_list &, int);
|
||||
class octave_swig_type;
|
||||
|
||||
|
|
@ -175,7 +171,16 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
|
||||
octave_function* function_value(bool = false) { return this; }
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
|
||||
return execute(tw,nargout,args);
|
||||
}
|
||||
#endif
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave_value_list execute(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
|
||||
#else
|
||||
octave_value_list call(octave::tree_evaluator& tw, int nargout = 0, const octave_value_list& args = octave_value_list()) {
|
||||
#endif
|
||||
octave_value_list all_args;
|
||||
all_args.append(first_args);
|
||||
all_args.append(args);
|
||||
|
|
@ -203,11 +208,7 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
|
||||
std::set<std::string> dispatch_classes;
|
||||
|
||||
private:
|
||||
|
||||
DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
|
||||
};
|
||||
DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(octave_swig_bound_func, "octave_swig_bound_func", "octave_swig_bound_func");
|
||||
#else
|
||||
#define SWIG_OCTAVE_BOUND_FUNC(func, args) octave_value(func)
|
||||
#endif
|
||||
|
|
@ -464,10 +465,20 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
// Fill in dim_vector
|
||||
for (int k=0;k<ndim;k++) {
|
||||
const octave_value& obj = c(k);
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
try {
|
||||
d.elem(k) = obj.int_value();
|
||||
}
|
||||
catch (octave::execution_exception& oee) {
|
||||
// __dims__ should return a cell filled with integers
|
||||
return dim_vector(1,1);
|
||||
}
|
||||
#else
|
||||
d.elem(k) = obj.int_value();
|
||||
|
||||
// __dims__ should return a cell filled with integers
|
||||
if (error_state) return dim_vector(1,1);
|
||||
#endif
|
||||
}
|
||||
return d;
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
|
|
@ -476,8 +487,18 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
} else if (out.is_matrix_type() || out.is_numeric_type() ) {
|
||||
#endif
|
||||
if (out.rows()==1 || out.columns()==1) {
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
Array<int> a;
|
||||
try {
|
||||
a = out.int_vector_value();
|
||||
}
|
||||
catch (octave::execution_exception& oee) {
|
||||
return dim_vector(1,1);
|
||||
}
|
||||
#else
|
||||
Array<int> a = out.int_vector_value();
|
||||
if (error_state) return dim_vector(1,1);
|
||||
#endif
|
||||
dim_vector d;
|
||||
d.resize(a.numel() < 2 ? 2 : a.numel());
|
||||
d(0) = d(1) = 1;
|
||||
|
|
@ -507,10 +528,10 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
delete this;
|
||||
}
|
||||
|
||||
long swig_this() const {
|
||||
size_t swig_this() const {
|
||||
if (!types.size())
|
||||
return (long) this;
|
||||
return (long) types[0].second.ptr;
|
||||
return (size_t) this;
|
||||
return (size_t) types[0].second.ptr;
|
||||
}
|
||||
const char* help_text() const {
|
||||
if (!types.size())
|
||||
|
|
@ -639,7 +660,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
return true;
|
||||
}
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
virtual bool isstruct() const {
|
||||
#else
|
||||
virtual bool is_map() const {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -787,7 +812,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
return as_value();
|
||||
}
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
virtual bool isobject() const {
|
||||
#else
|
||||
virtual bool is_object() const {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -882,7 +911,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
}
|
||||
|
||||
virtual bool load_binary (std::istream& is, bool swap,
|
||||
oct_mach_info::float_format fmt) {
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::mach_info::float_format fmt) {
|
||||
#else
|
||||
oct_mach_info::float_format fmt) {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1066,7 +1099,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
octave_swig_type *ptr;
|
||||
public:
|
||||
octave_swig_ref(octave_swig_type *_ptr = 0)
|
||||
:ptr(_ptr) { }
|
||||
:ptr(_ptr)
|
||||
{
|
||||
// Ensure type_id() is set correctly
|
||||
if (t_id == -1) {
|
||||
t_id = octave_swig_ref::static_type_id();
|
||||
}
|
||||
}
|
||||
|
||||
~octave_swig_ref()
|
||||
{ if (ptr) ptr->decref(); }
|
||||
|
|
@ -1086,8 +1125,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
bool is_defined() const
|
||||
{ return ptr->is_defined(); }
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
virtual bool isstruct() const
|
||||
{ return ptr->isstruct(); }
|
||||
#else
|
||||
virtual bool is_map() const
|
||||
{ return ptr->is_map(); }
|
||||
#endif
|
||||
|
||||
virtual octave_value subsref(const std::string &ops, const std::list < octave_value_list > &idx)
|
||||
{ return ptr->subsref(ops, idx); }
|
||||
|
|
@ -1098,9 +1142,9 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
octave_value subsasgn(const std::string &ops, const std::list < octave_value_list > &idx, const octave_value &rhs)
|
||||
{ return ptr->subsasgn(ops, idx, rhs); }
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
virtual bool isobject() const
|
||||
{ return ptr->is_object(); }
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
virtual bool isobject() const
|
||||
{ return ptr->isobject(); }
|
||||
#else
|
||||
virtual bool is_object() const
|
||||
{ return ptr->is_object(); }
|
||||
|
|
@ -1149,7 +1193,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
{ return ptr->save_binary(os, save_as_floats); }
|
||||
|
||||
virtual bool load_binary (std::istream& is, bool swap,
|
||||
oct_mach_info::float_format fmt)
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::mach_info::float_format fmt)
|
||||
#else
|
||||
oct_mach_info::float_format fmt)
|
||||
#endif
|
||||
{ return ptr->load_binary(is, swap, fmt); }
|
||||
|
||||
#if defined (HAVE_HDF5)
|
||||
|
|
@ -1185,6 +1233,10 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
#endif
|
||||
{ return ptr->print(os, pr_as_read_syntax); }
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
static void set_type_id(int type_id) { t_id=type_id; }
|
||||
#endif
|
||||
|
||||
virtual type_conv_info numeric_conversion_function(void) const {
|
||||
return octave_base_value::type_conv_info (default_numeric_conversion_function,
|
||||
octave_scalar::static_type_id ());
|
||||
|
|
@ -1212,8 +1264,13 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
public:
|
||||
|
||||
octave_swig_packed(swig_type_info *_type = 0, const void *_buf = 0, size_t _buf_len = 0)
|
||||
: type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len) {
|
||||
}
|
||||
: type(_type), buf((const char*)_buf, (const char*)_buf + _buf_len)
|
||||
{
|
||||
// Ensure type_id() is set correctly
|
||||
if (t_id == -1) {
|
||||
t_id = octave_swig_packed::static_type_id();
|
||||
}
|
||||
}
|
||||
|
||||
bool copy(swig_type_info *outtype, void *ptr, size_t sz) const {
|
||||
if (outtype && outtype != type)
|
||||
|
|
@ -1259,7 +1316,11 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
}
|
||||
|
||||
virtual bool load_binary (std::istream& is, bool swap,
|
||||
oct_mach_info::float_format fmt) {
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::mach_info::float_format fmt) {
|
||||
#else
|
||||
oct_mach_info::float_format fmt) {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1287,6 +1348,10 @@ SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own);
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
static void set_type_id(int type_id) { t_id=type_id; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
#if !SWIG_OCTAVE_PREREQ(4,0,0)
|
||||
DECLARE_OCTAVE_ALLOCATOR;
|
||||
|
|
@ -1509,16 +1574,24 @@ SWIGRUNTIMEINLINE void SWIG_Octave_SetConstant(octave_swig_type *module_ns, cons
|
|||
}
|
||||
|
||||
SWIGRUNTIMEINLINE octave_value SWIG_Octave_GetGlobalValue(std::string name) {
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::interpreter *interp = octave::interpreter::the_interpreter ();
|
||||
return interp->global_varval(name);
|
||||
#else
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
return symtab.global_varval(name);
|
||||
#else
|
||||
return get_global_value(name, true);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value& value) {
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::interpreter *interp = octave::interpreter::the_interpreter ();
|
||||
interp->global_assign(name, value);
|
||||
#elif SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
symtab.global_assign(name, value);
|
||||
#else
|
||||
|
|
@ -1528,10 +1601,20 @@ SWIGRUNTIME void SWIG_Octave_SetGlobalValue(std::string name, const octave_value
|
|||
|
||||
SWIGRUNTIME void SWIG_Octave_LinkGlobalValue(std::string name) {
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
octave::symbol_scope symscope = octave::interpreter::the_interpreter()->get_current_scope();
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::interpreter *interp = octave::interpreter::the_interpreter ();
|
||||
interp->assign(name, interp->global_varval(name));
|
||||
octave::tree_evaluator& tree_eval = interp->get_evaluator();
|
||||
octave::call_stack& callStack = tree_eval.get_call_stack();
|
||||
std::shared_ptr<octave::stack_frame> stackFrame = callStack.get_current_stack_frame();
|
||||
octave::symbol_record sym=symscope.lookup_symbol(name);
|
||||
stackFrame->mark_global(sym);
|
||||
#else
|
||||
octave::symbol_table& symtab = octave::interpreter::the_interpreter()->get_symbol_table();
|
||||
symscope.assign(name, symtab.global_varval(name));
|
||||
symscope.mark_global(name);
|
||||
#endif
|
||||
#else
|
||||
#if !SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
link_to_global_variable(curr_sym_tab->lookup(name, true));
|
||||
|
|
|
|||
|
|
@ -1,111 +1,10 @@
|
|||
#ifdef SWIG_OCTAVE_EXTERNAL_OCTHEADERS
|
||||
%insert(runtime) %{
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#include <octave/oct.h>
|
||||
#include <octave/version.h>
|
||||
|
||||
// Macro for enabling features which require Octave version >= major.minor.patch
|
||||
// - Use (OCTAVE_PATCH_VERSION + 0) to handle both '<digit>' (released) and '<digit>+' (in development) patch numbers
|
||||
#define SWIG_OCTAVE_PREREQ(major, minor, patch) \
|
||||
( (OCTAVE_MAJOR_VERSION<<16) + (OCTAVE_MINOR_VERSION<<8) + (OCTAVE_PATCH_VERSION + 0) >= ((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)
|
||||
|
||||
// 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)
|
||||
|
||||
#include <octave/Cell.h>
|
||||
#include <octave/dynamic-ld.h>
|
||||
#include <octave/oct-env.h>
|
||||
#include <octave/oct-map.h>
|
||||
#include <octave/ov-scalar.h>
|
||||
#include <octave/ov-fcn-handle.h>
|
||||
#include <octave/parse.h>
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#include <octave/interpreter.h>
|
||||
#else
|
||||
#include <octave/toplev.h>
|
||||
#endif
|
||||
#include <octave/unwind-prot.h>
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#include <octave/call-stack.h>
|
||||
#endif
|
||||
|
||||
#include "octheaders.hpp"
|
||||
%}
|
||||
#else
|
||||
%insert(runtime) "octheaders.hpp";
|
||||
#endif
|
||||
|
||||
%insert(runtime) "swigrun.swg";
|
||||
%insert(runtime) "swigerrors.swg";
|
||||
|
|
@ -120,7 +19,8 @@ static bool SWIG_init_user(octave_swig_type* module_ns);
|
|||
SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
||||
bool retn = false;
|
||||
{
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
#elif SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
octave::unwind_protect frame;
|
||||
frame.protect_var(discard_error_messages); discard_error_messages = true;
|
||||
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
|
||||
|
|
@ -163,7 +63,8 @@ SWIGINTERN bool SWIG_Octave_LoadModule(std::string name) {
|
|||
SWIGINTERN bool SWIG_Octave_InstallFunction(octave_function *octloadfcn, std::string name) {
|
||||
bool retn = false;
|
||||
{
|
||||
#if SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
#elif SWIG_OCTAVE_PREREQ(4,2,0)
|
||||
octave::unwind_protect frame;
|
||||
frame.protect_var(discard_error_messages); discard_error_messages = true;
|
||||
frame.protect_var(discard_warning_messages); discard_warning_messages = true;
|
||||
|
|
@ -315,13 +216,29 @@ DEFUN_DLD( swig_octave_prereq, args, nargout, swig_octave_prereq_usage ) {
|
|||
return octave_value(prereq);
|
||||
}
|
||||
|
||||
static const char *const swig_exit_usage = "-*- texinfo -*- \n\
|
||||
@deftypefn {Loadable Function} {} swig_exit([@var{exit_status}])\n\
|
||||
Exit Octave without performing any memory cleanup.\n\
|
||||
@end deftypefn";
|
||||
|
||||
DEFUN_DLD( swig_exit, args, nargout, swig_exit_usage ) {
|
||||
if (args.length() > 1) {
|
||||
error("swig_exit: must be called with at most one arguments");
|
||||
return octave_value_list();
|
||||
}
|
||||
int exit_status = 0;
|
||||
if (args.length() == 1) {
|
||||
exit_status = args(0).int_value();
|
||||
}
|
||||
::_Exit(exit_status);
|
||||
return octave_value();
|
||||
}
|
||||
|
||||
static const char *const SWIG_name_usage = "-*- texinfo -*- \n\
|
||||
@deftypefn {Loadable Module} {} " SWIG_name_d "\n\
|
||||
Loads the SWIG-generated module `" SWIG_name_d "'.\n\
|
||||
@end deftypefn";
|
||||
|
||||
void __swig_atexit__(void) { ::_Exit(0); }
|
||||
|
||||
DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
||||
|
||||
static octave_swig_type* module_ns = 0;
|
||||
|
|
@ -329,14 +246,15 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
// workaround to prevent octave seg-faulting on exit: set Octave exit function
|
||||
// octave_exit to _Exit, which exits immediately without trying to cleanup memory.
|
||||
// definitely affected version 3.2.*, not sure about 3.3.*, seems to be fixed in
|
||||
// version 3.4.*, but reappeared in 4.2.*, so turn on for all versions after 3.2.*.
|
||||
// version 3.4.*, reappeared in 4.2.*, hack not possible in 4.4.* or later due to
|
||||
// removal of octave_exit, so turn on for all versions between 3.2.*. and 4.4.*.
|
||||
// can be turned off with macro definition.
|
||||
#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
atexit(__swig_atexit__);
|
||||
#elif SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
#if !SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
#if SWIG_OCTAVE_PREREQ(3,2,0)
|
||||
octave_exit = ::_Exit;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// check for no input and output args
|
||||
|
|
@ -376,16 +294,14 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
string_vector types = typeinfo.installed_type_names();
|
||||
bool register_octave_swig_ref = true;
|
||||
bool register_octave_swig_packed = true;
|
||||
bool register_octave_swig_bound_func = true;
|
||||
for (int i = 0; i < types.numel(); ++i) {
|
||||
if (types(i) == octave_swig_ref::static_type_name()) {
|
||||
register_octave_swig_ref = false;
|
||||
octave_swig_ref::set_type_id(i);
|
||||
}
|
||||
if (types(i) == octave_swig_packed::static_type_name()) {
|
||||
register_octave_swig_packed = false;
|
||||
}
|
||||
if (types(i) == octave_swig_bound_func::static_type_name()) {
|
||||
register_octave_swig_bound_func = false;
|
||||
octave_swig_packed::set_type_id(i);
|
||||
}
|
||||
}
|
||||
if (register_octave_swig_ref) {
|
||||
|
|
@ -394,9 +310,6 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
if (register_octave_swig_packed) {
|
||||
octave_swig_packed::register_type();
|
||||
}
|
||||
if (register_octave_swig_bound_func) {
|
||||
octave_swig_bound_func::register_type();
|
||||
}
|
||||
}
|
||||
#else
|
||||
octave_swig_ref::register_type();
|
||||
|
|
@ -405,7 +318,11 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
SWIG_InitializeModule(0);
|
||||
SWIG_PropagateClientData();
|
||||
|
||||
#if SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
#if SWIG_OCTAVE_PREREQ(6,0,0)
|
||||
octave::tree_evaluator& tree_eval = octave::interpreter::the_interpreter()->get_evaluator();
|
||||
octave::call_stack& stack = tree_eval.get_call_stack();
|
||||
octave_function *me = stack.current_function();
|
||||
#elif SWIG_OCTAVE_PREREQ(4,4,0)
|
||||
octave::call_stack& stack = octave::interpreter::the_interpreter()->get_call_stack();
|
||||
octave_function *me = stack.current();
|
||||
#else
|
||||
|
|
@ -427,6 +344,9 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
|
|||
if (!SWIG_Octave_InstallFunction(me, "swig_octave_prereq")) {
|
||||
return octave_value_list();
|
||||
}
|
||||
if (!SWIG_Octave_InstallFunction(me, "swig_exit")) {
|
||||
return octave_value_list();
|
||||
}
|
||||
|
||||
octave_swig_type* cvar_ns=0;
|
||||
if (std::string(SWIG_global_name) != ".") {
|
||||
|
|
|
|||
|
|
@ -4,10 +4,6 @@
|
|||
|
||||
%include <octcomplex.swg>
|
||||
|
||||
%{
|
||||
#include <complex>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
%naturalvar complex;
|
||||
template<typename T> class complex;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue