Commit graph

136 commits

Author SHA1 Message Date
William S Fulton
e354ba8cdc Fix overloading for non-pointers and NULL - Octave 2018-12-30 11:25:41 +00:00
luz.paz
60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
Karl Wette
6586616e23 Lib/octave: fix getting/setting global variables for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
d0b1105f30 Lib/octave: use new class for function member dereference with Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
94e8853e61 Lib/octave: fix operator installation for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
84aab22f66 Lib/Octave: in Octave >= 4.4, assign reference to base class in subclass
- See Examples/octave/callback/runme.m: a.run() calls Octave callback,
  but due to changes in behaviour to subsref() a.Callback.run() can no
  longer be used to call C callback unless a.Callback actually exists;
  subsrefs() just gets the "Callback" call whereas prior to Octave 4.4
  it would get both the "Callback" and "run" calls. So now a.Callback is
  set to the original base class (with own=0) so that it can be accessed
2018-05-12 22:25:07 +10:00
Karl Wette
ce67bce72e Lib/octave: fix call to mlock() for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
df92ad6ebc Lib/octave: fix call to octave::call_stack::current() for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
931656bcbe Lib/octave: 'octave_exit' not longer exists in Octave >= 4.4
- Instead must register atexit() function, since Octave still
  cannot clean up its memory usage on exit with SWIG modules
2018-05-12 22:25:07 +10:00
Karl Wette
04357dca21 Lib/octave: replace is_bool_type() with islogical() for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
6f0561eb57 Lib/octave: replace is_numeric_type() with isnumeric() for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
358345db9e Lib/octave: replace is_cell() with iscell() for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
a46909a414 Lib/octave: call octave::feval() instead of feval() for Octave >= 4.4 2018-05-12 22:25:07 +10:00
Karl Wette
e8e507bf0b Lib/octave: fix function name passed to unwind_protect::begin_frame() 2018-05-12 22:25:07 +10:00
William S Fulton
4e0b2f1402 Cosmetic syntax tweak using throw in Octave directors 2018-05-04 20:02:13 +01:00
William S Fulton
cd9b7c3c34 std_basic_string.i fixes
- Remove python code from octave's std_basic_string.i
- Correctly return an error to fix error handling when using std::basic_string in
  overloaded methods - issue #1171.
2018-01-04 07:00:26 +00:00
William S Fulton
923091da13 Changes to use common DirectorException class
Add director.swg for Go as was completely absent.
This is just the start of a common exception handling approach to directors.
An exception thrown in a Java director method will be propogated back to
Java via a C++ DirectorException.
DirectorException throws typemap for Java is fully working, all other languages need work.
DirectorException throws typemap for Perl added just to fix compilation errors.
Add director_exception_catches test.
2017-11-29 20:31:55 +00:00
William S Fulton
3f8b8fe734 Enhancements for directorin typemaps
The directorin typemaps will now generate a temporary variable
(specified after the type), such as:
%typemap(directorin) MyType (MyType *temp) { ... use temp ... }

The shared_ptr director typemaps have been fixed for use in functions
that take more than one parameter.
2017-10-16 19:28:27 +01:00
William S Fulton
6470fe8c36 Director shared_ptr typemaps for scripting languages
Modify the Python and Ruby director shared_ptr typemaps to be language neutral.
Port the director modifications to other scripting languages that
have shared_ptr support - Octave, R and Scilab. Scilab shared_ptr
support is not fully working and needs work though.
2017-10-13 07:34:38 +01:00
William S Fulton
114fab31a1 Scilab, R and Octave shared_ptr typemaps null fix
Merge changes from Python/Ruby equivalent files to obtain a fix
for NULL handling of T*const& typemaps.
2017-10-11 18:08:32 +01:00
William S Fulton
a674edebf5 Octave and R shared_ptr typemaps update
Synchronize typemaps with other identical typemaps in Scilab/Ruby.
Adds some missing $disown support.
2017-10-11 08:33:02 +01:00
William S Fulton
e01cfd70c7 Add missing declaration for std::complex
Fixes missing type information for std::complex in scripting languages.
Closes #732.

Update Javascript and Octave complextest, although they don't actually
get run as they don't work
2017-10-02 19:07:24 +01:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
Mike Romberg
b27a58b5b8 as() no longer memsets and always throws. 2017-07-20 14:28:02 -06:00
William S Fulton
82969b0755 Fix warning in generated code - traits_asptr.
Visual Studio 2015 debug builds:
error C4703: potentially uninitialized local pointer variable 'p' used
2017-06-13 19:02:59 +01:00
William S Fulton
ab1e9f5bd9 Consistent whitespace amongst all the shared_ptr and intrusive_ptr typemaps
[skip ci]
2017-04-20 19:21:47 +01:00
Karl Wette
e24ec40895 Octave: add support for version 4.2
- .travis.yml:
  - ppa:kwwette/octaves has Octave version 4.2, also run C++11 tests
- configure.ac:
  - prefer Octave program "octave-cli" to "octave"
  - extract any -std=* flags from CXX, add to OCTAVE_CXXFLAGS
- Lib/typemaps/fragments.swg:
  - SWIG_isfinite_func(): extern "C++" is required as this fragment can
    end up inside an extern "C" { } block
- Lib/octave:
  - add std_wstring.i (copied from std_string.i) for C++11 tests
- Lib/octave/octrun.swg:
  - move Octave version-checking macros to octruntime.swg
  - Octave single()/double() functions now call .as_single()/.as_double()
    methods; redirect calls to __float__() method as per .scalar_value()
  - << and >> operators are no longer supported by Octave
- Lib/octave/octruntime.swg:
  - move Octave version-checking macros here for conditional #includes
  - #include interpreter.h instead of #toplev.h
  - #include call-stack.h (now needed for octave_call_stack)
  - unwind_protect is now in octave:: namespace
  - error_state and warning_state are deprecated; use try/catch to catch
    errors in feval() instead
  - always set octave_exit = ::_Exit, to try to prevent segfault on exit
- Lib/octave/octopers.swg:
  - << and >> operators are no longer supported by Octave
- Lib/octave/exception.i:
  - Add macro SWIG_RETHROW_OCTAVE_EXCEPTIONS which rethrows any
    exceptions raised by Octave >= 4.2
- Examples/test-suite/exception_order.i:
  - Use macro SWIG_RETHROW_OCTAVE_EXCEPTIONS to rethrow exceptions
    raised by error() function in Octave >= 4.2
- Update Doc/Manual/Octave.html and CHANGES.current
2017-01-22 11:53:12 +13:00
Karl Wette
a699944c95 Revert "Lib/octave/octopers.swg: update %ignoreoperator() calls"
This reverts commit 2bc66ab755.
2017-01-07 17:53:35 +13:00
Karl Wette
2bc66ab755 Lib/octave/octopers.swg: update %ignoreoperator() calls
- Need to use *::operator... to match C++ operator... methods
2017-01-06 22:57:41 +13:00
Anthony Heading
1871acd4bc Remove inheritance from std::unary_function and std::binary_function,
they are deprecated in C++11 and already removed in Visual C++ '15'
running with /std:c++latest

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3145.html
2016-12-29 00:56:46 -05:00
William S Fulton
364fa82499 Replicate Python memory leak fix in std::pair for Octave and Ruby
https://github.com/swig/swig/pull/851
2016-12-18 20:00:40 +00:00
William S Fulton
91aba9f719 UTL STL container descriptor checks
The vector of pointers (just fixed) were not working correctly because the
descriptors returned from swig::type_info() were sometimes returning
zero. Zero should only be used for void * as the subsequent call to
SWIG_ConvertPtr will blindly cast the pointer without checking
descriptor.

std::vector<void *> does not work and will require further changes:
specializing traits_info<void *> to return 0 and traits_asptr<void *>.
I tried this and traits_asptr<void> also needs to be added in which
seems odd and requires further investigation...

Lib/python/pystdcommon.swg:
  template <> struct traits_info<void *> {
    static swig_type_info *type_info() {
      static swig_type_info *info = 0;
    }
  };

Lib/std/std_common.i:
  template <>
  struct traits_asptr<void *> {
    static int asptr(PyObject *obj, void ***val) {
      void **p;
      swig_type_info *descriptor = 0;
      int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  };

  // this is needed, but am not sure this is expected
  template <>
  struct traits_asptr<void> {
    static int asptr(PyObject *obj, void **val) {
      void **p;
      swig_type_info *descriptor = 0;
      int res = SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0);
      if (SWIG_IsOK(res)) {
	if (val) *val = p;
      }
      return res;
    }
  };
2016-07-28 22:51:29 +01:00
Karl Wette
125329466d octave: map unary functions to __...___ Python-style unary members
- Only available in Octave 3.8.0 and higher
2016-02-07 20:22:39 +01:00
Karl Wette
000ab753df octave: recognize Python __float__ numeric conversion operator 2016-02-07 20:22:39 +01:00
Karl Wette
697a1b7c9d octrun.swg: simplify unary operator calls in dims() and string_value() 2016-02-07 20:22:39 +01:00
Karl Wette
0dd16f92ab octrun.swg: make dispatch_[unary|binary|index]_op() const-qualified 2016-02-07 20:22:39 +01:00
Karl Wette
b93b1871a9 octave: export function swig_octave_prereq() for easily testing Octave version 2016-02-07 20:22:39 +01:00
Alec Cooper
4e2fc7d115 Don't use long long if it isn't available
Adds preprocessor checks to avoid defining functions that use long long if it isn't available
Effects the following languages: javascript, octave, perl, python, r, ruby, tcl
2016-01-06 16:52:37 -05:00
William S Fulton
6b4e57245d Fix STL wrappers to not generate <: digraphs.
For example std::vector<::X::Y> was sometimes generated, now
corrected to std::vector< ::X::Y >.
2015-12-12 14:05:46 +00:00
William S Fulton
fcb383b46b shared_ptr typemap error message fix for global variables
$argnum was not being expanded in the generated code
Correct to use the error message from the standard typemaps
2015-09-25 22:57:59 +01:00
William S Fulton
ab8f05204f Cosmetic changes in Octave runtime
Fix bracket matching!
2015-08-31 12:44:13 +01:00
Orion Poplawski
5a6a39a4ee Add #include <climits> for INT_MAX 2015-07-10 08:24:09 -06:00
Orion Poplawski
350c410d4b Update print() signature for octave 4.0 2015-07-09 19:20:46 -06:00
Orion Poplawski
248890aad0 Support for octave 4.0.0 2015-07-08 13:26:36 -06:00
Olly Betts
c4268c369b Fix cut-and-paste typo 2015-03-12 17:50:52 +13:00
Jeremy
e301457a43 Attempting fixes for Octave shared_ptr support 2015-01-05 10:53:06 -05:00
William S Fulton
23373e9ffd Revert "Octave: cleanup/restructure library files"
This reverts commit bf12d76d03.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:34:02 +01:00
William S Fulton
bfa3d378ec Revert "Octave: drop support for Octave versions older than 3.2.0"
This reverts commit 952eee8f59.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:33:58 +01:00
William S Fulton
851f122bfe Revert "Octave: remove unused function SwigOctType::help_text()"
This reverts commit 8c7e578279.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:33:48 +01:00
William S Fulton
a9c9c9c848 Revert "Octave: remove unused field SwigOctClass::constructor_doc"
This reverts commit afa9affcd9.

Reverting a series of Octave commits for re-applying again without
incorrect whitespace changes.
2014-10-09 19:33:40 +01:00