Commit graph

1,439 commits

Author SHA1 Message Date
Olly Betts
8be1d0e03a Fix typo in manual 2017-10-09 09:06:05 +13: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
William S Fulton
bde40302bf Merge branch 'jder-java-doc-fix'
* jder-java-doc-fix:
  Improvements to Java Memory Management docs
  Avoid possible GC issues in Java example code
2017-09-19 20:36:19 +01:00
William S Fulton
f674018126 Improvements to Java Memory Management docs 2017-09-19 20:36:04 +01:00
William S Fulton
9671613372 Doc corrections for %shared_ptr and enhancements for %inline 2017-09-15 19:21:26 +01:00
William S Fulton
ce96d1b153 Library docs chapter tweaks
- Consistency in heading names
- html fixes
- shared_ptr corrections and add in subheadings
2017-09-15 08:45:39 +01:00
Artem V L
f1df34642b Merge branch 'master' into master 2017-09-14 22:04:25 +02:00
William S Fulton
9cc05a22f6 Improve docs for %rename and C++ features like default args 2017-09-14 18:51:36 +01:00
luav
d2b329f71d %rename for functions with default parameters explained, see #1087 2017-09-14 18:51:36 +01:00
William S Fulton
d5d97a4069 Overloaded methods section renamed slightly in docs 2017-09-14 18:51:36 +01:00
William S Fulton
ff52610dc5 Move C++ 'Default arguments' section in manual 2017-09-14 18:51:36 +01:00
William S Fulton
169738011c Update version number to 4.0 in docs 2017-09-14 07:39:16 +01:00
luav
73fe0fdc7e %rename for functions with default parameters explained, see #1087 2017-09-12 04:13:24 +02:00
luav
f069d0a744 %shared_ptr usage for the templates documented, see #1049 2017-09-11 22:55:13 +02:00
luav
0587edd559 Includes inside %inline block documented, see #1068 2017-09-11 22:13:19 +02:00
William S Fulton
330ef362f4 Add docs for C++11 ref-qualifiers 2017-08-30 18:17:04 +01:00
Jesse Rusak
175ab4e720 Avoid possible GC issues in Java example code
This prevents the previously-set element value from being collected
before or during the call to setElement. Since C++ could still have
a reference to during that time, it could lead to misbehavior.
2017-08-29 12:12:28 -04:00
William S Fulton
32a454cfef Merge branch 'templates-scope-enforcement'
* templates-scope-enforcement:
  Test a few %template errors
  Add using declarations to templates into typedef table.
  Fix type lookup in the presence of using directives and using declarations
  More docs on %template
  Testcase fix for nameclash in php
  %template scope enforcement and class definition fixes
  Template documentation tweaks
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  Documentation corrections to use targetlang formatting
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  More consistent formatting of examples in documentation
  Namespace documentation minor corrections
  Improve description of template_parameters_resolve
  Minor code optimisation in template_parameters_resolve
  Fix scope lookup for template parameters containing unary scope operators
  Typemap change for templates
2017-08-16 21:44:51 +01:00
William S Fulton
8bf81b8718 More docs on %template 2017-08-16 00:24:25 +01:00
William S Fulton
959e627208 %template scope enforcement and class definition fixes
The scoping rules around %template have been specified and enforced.
The %template directive for a class template is the equivalent to an
explicit instantiation of a C++ class template. The scope for a valid
%template instantiation is now the same as the scope required for a
valid explicit instantiation of a C++ template. A definition of the
template for the explicit instantiation must be in scope where the
instantiation is declared and must not be enclosed within a different
namespace.

For example, a few %template and explicit instantiations of std::vector
are shown below:

  // valid
  namespace std {
    %template(vin) vector<int>;
    template class vector<int>;
  }

  // valid
  using namespace std;
  %template(vin) vector<int>;
  template class vector<int>;

  // valid
  using std::vector;
  %template(vin) vector<int>;
  template class vector<int>;

  // ill-formed
  namespace unrelated {
    using std::vector;
    %template(vin) vector<int>;
    template class vector<int>;
  }

  // ill-formed
  namespace unrelated {
    using namespace std;
    %template(vin) vector<int>;
    template class vector<int>;
  }

  // ill-formed
  namespace unrelated {
    namespace std {
      %template(vin) vector<int>;
      template class vector<int>;
    }
  }

  // ill-formed
  namespace unrelated {
    %template(vin) std::vector<int>;
    template class std::vector<int>;
  }

When the scope is incorrect, an error now occurs such as:

cpp_template_scope.i:34: Error: 'vector' resolves to 'std::vector' and
was incorrectly instantiated in scope 'unrelated' instead of within scope 'std'.

Previously SWIG accepted the ill-formed examples above but this led to
numerous subtle template scope problems especially in the presence of
using declarations and using directives as well as with %feature and %typemap.

Actually, a valid instantiation is one which conforms to the C++03
standard as C++11 made a change to disallow using declarations and
using directives to find a template.

  // valid C++03, ill-formed C++11
  using std::vector;
  template class vector<int>;

Similar fixes for defining classes using forward class references have
also been put in place. For example:

namespace Space1 {
  struct A;
}
namespace Space2 {
  struct Space1::A {
    void x();
  }
}

will now error out with:

cpp_class_definition.i:5: Error: 'Space1::A' resolves to 'Space1::A' and
was incorrectly instantiated in scope 'Space2' instead of within scope 'Space1'.
2017-08-16 00:24:25 +01:00
William S Fulton
97ae9d66bc Template documentation tweaks
Add subsections to the template documentation
Rewrite some of the template introduction
2017-08-16 00:24:25 +01:00
William S Fulton
5779aa8d79 More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
04131a988f More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
c454f2ce2f Documentation corrections to use targetlang formatting 2017-08-16 00:24:25 +01:00
William S Fulton
ba45861b46 More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
8052211ac5 More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
7ee76f93f9 More consistent formatting of examples in documentation 2017-08-16 00:24:25 +01:00
William S Fulton
8753f9652c Namespace documentation minor corrections 2017-08-16 00:24:24 +01:00
Olly Betts
90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12:00
Olly Betts
a92137a708 [C++11] Allow static_assert at the top level
And disallow it right after template<T>).

Fixes https://github.com/swig/swig/issues/1031 reported by Artem V L.
2017-08-04 14:09:30 +12:00
William S Fulton
687cf9c9c1 Add missing %python:maybecall to operator overloads.
This ensures NotImplemented is returned on error so that the Python
interpreter will handle the operators correctly instead of throwing an
exception. NotImplemented was not being returned for non-builtin wrappers
when the operator overload did not have a function overload.

See PEP 207 and https://docs.python.org/3/library/constants.html#NotImplemented

Mentioned in SF patch #303 and SF bug #1208.
2017-06-19 19:25:27 +01:00
William S Fulton
10e73a5bfb Java jboxtype typemap documentation and tidy up 2017-06-05 20:47:49 +01:00
William S Fulton
57a89f987d Fix %import and %fragment forced inclusion to not generate code. 2017-06-03 18:37:05 +01:00
William S Fulton
857a62425c Formatting fixes in Lisp docs 2017-06-03 18:37:05 +01:00
William S Fulton
10172161bf Update STL library documentation 2017-05-20 15:38:38 +01:00
Olly Betts
9a0180c56c Merge pull request #970 from nihal95/master
Adds pragma version directive for php5 and php7.  Fixes #360.
2017-05-16 17:47:35 +12:00
William S Fulton
07ab80b49e Add raise methods for throwing c++ exceptions in C#, Java, D
The director c++ exceptions are thrown in a helper method instead of in
the director overloaded method. This circumvents compiler warnings about
throwing exceptions when the method has an exception specification or
noexcept. If the exception is thrown, abort will still be called!
In Java, the "director:noexcept" typemap can be used to do something
else. This typemap should be ported to the other languages too.
2017-05-13 17:01:15 +01:00
Nihal
21108781a7 Add documentation and examples for php version pragma.
Pragma version to specify versions for PHP5 and PHP7 extensions.
See issue #360.
2017-05-08 12:02:53 +05:30
William S Fulton
28f7d61986 Bump version to 4.0.0 2017-04-21 19:36:09 +01:00
Simon Marchetto
c06c9b3853 [Scilab] New parameter targetversion to specify the Scilab target version (5, 6, ..) for code generation
With Scilab 6 target specified, identifier names truncation is disabled (no longer necessary)

Signed-off-by: Simon Marchetto <simon.marchetto@scilab-enterprises.com>
2017-04-12 13:54:42 +02:00
Julien Schueller
7350e9fffa Typo in Python.html 2017-03-24 14:22:53 +01:00
William S Fulton
f0f2fd2dae Merge branch 'tleonhardt-python_threads'
* tleonhardt-python_threads:
  Style fixes for Python threads documentation changes
  Finished updating Python docs for -threads option
  Started making changes to Python.html to document support for multithreaded Python SWIG applications.
2017-03-24 08:22:51 +00:00
William S Fulton
d888fabc0c Style fixes for Python threads documentation changes 2017-03-24 08:22:16 +00:00
スノル
970b0fdca3 Add the missing parenthese.
I'm sorry that I didn't notice this last time.
2017-03-20 20:47:08 -05:00
William S Fulton
da381668a2 Python doc correction for %pybuffer_mutable_string usage
[skip ci]
2017-03-17 19:02:38 +00:00
Todd Leonhardt
bcf8d927f0 Finished updating Python docs for -threads option 2017-03-01 17:51:47 -05:00
Olly Betts
b451fc464b Escape literal > in HTML 2017-03-02 08:45:45 +13:00
Todd Leonhardt
52d12bc415 Started making changes to Python.html to document support for multithreaded Python SWIG applications. 2017-02-28 20:53:30 -05:00
William S Fulton
d6a349997c C++11 hash tables documentation 2017-02-10 19:49:58 +00:00
William S Fulton
2ab08e493f Bump version to 3.0.13
[skip ci]
2017-01-28 00:23:59 +00:00