Commit graph

302 commits

Author SHA1 Message Date
William S Fulton
5eb9f735da Add generic approach in fragments for converting size_t to Java int 2017-06-05 18:49:54 +01:00
William S Fulton
32e7074d9b Whitespace fixes in STL wrappers 2017-06-03 18:36:59 +01:00
William S Fulton
fdca8e9829 Better variable naming consistency in STL containers 2017-05-26 22:37:29 +01:00
William S Fulton
b51f32a915 Java std::vector tweaks
- Replace javacode typemap with %proxycode to make this typemap available to users
- Make doSize private.
2017-05-26 22:37:22 +01:00
William S Fulton
338acfabeb Merge branch 'vadz-java-vector'
* vadz-java-vector:
  Fix potential STL std::vector wrappers <: digraphs problems.
  Add runtime checks for vector size in Java
  Make std::vector<> wrappers conform to List interface in Java
  Add helper macro to avoid duplication in Java vector typemaps

Conflicts:
	CHANGES.current
2017-05-26 19:15:12 +01:00
William S Fulton
0bafadea5a Fix potential STL std::vector wrappers <: digraphs problems. 2017-05-26 18:55:52 +01:00
William S Fulton
98e67539dd Director testcase cosmetic fixes 2017-05-22 19:15:39 +01:00
William S Fulton
a271043555 Fix warnings in Java OUTPUT and INOUT typemaps 2017-05-14 00:39:08 +01: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
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
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
William S Fulton
8a4ab380a1 Java director typemaps and test tweak
- Fix java_director_typemaps test name clash ensuring parallel tests work
- Replace assert with code that is guaranteed to run
- Nicer generated code from directorargout typemap
2017-01-24 23:47:30 +00:00
Andrey Starodubtsev
519f296579 WIP: #704 (java directorargout + java/typemaps.i fixes)
- failed tests fixed
2017-01-22 18:14:38 +03:00
Andrey Starodubtsev
7cb2663132 WIP: #704 (java directorargout + java/typemaps.i fixes)
- avoid JCALL calls in generated code
- avoid redundant blocks in generated code
2017-01-22 13:41:53 +03:00
Andrey Starodubtsev
710804c88f WIP: #704 (java directorargout + java/typemaps.i fixes)
- reverted changes in javahead.swg
2017-01-22 13:41:44 +03:00
Andrey Starodubtsev
4ba9de370e Merge branch 'master' into directorargout_and_java_typemaps 2017-01-21 17:41:31 +03:00
William S Fulton
449aa08124 %extend changes and remove default use of javatype, dtype, cstype %typemaps
1) The %extend directive can now optionally support one of the 'class', 'struct' or 'union'.
2) The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
   completely freeing them up for users to use without having to replicate the library
   code that they previously added

Tested by changes to test: java_lib_arrays
2017-01-15 16:50:24 +00:00
William S Fulton
3d2e57b0f2 Add %proxycode directive for adding code into proxy classes for C#, D and Java 2017-01-13 20:43:50 +00:00
Vadim Zeitlin
eba70ed16f Add runtime checks for vector size in Java
It doesn't seem to be possible to have a Java collection with more than 2^31-1
items, but it is perfectly possible to have an std::vector with more elements
than that in C++, so add runtime checks verifying that we don't lose count of
elements in the Java wrappers.
2016-11-29 17:47:01 +01:00
Vadim Zeitlin
c79dd9d420 Make std::vector<> wrappers conform to List interface in Java
Derive the class wrapping std::vector<> in Java from java.util.AbstractList<>.
This makes it possible to use it with various algorithms working with Java
collections and, maybe even more importantly, makes it possible to iterate
over the wrapped vectors using for-each loops.

This commit is based on the original patch by Volker Diels-Grabsch from
https://sourceforge.net/p/swig/patches/278/
2016-11-29 17:46:38 +01:00
Vadim Zeitlin
7c4109c701 Add helper macro to avoid duplication in Java vector typemaps
No real changes yet, just use a C#-like macro in Java std::vector<> typemaps
too to avoid having to repeat almost exactly the same class declaration for
the general case and for the bool specialization.
2016-11-29 17:45:56 +01:00
William S Fulton
0a22fa0df1 Missing transient keywords in Java proxy class
Further security exploit refinements to a1771c
2016-11-13 19:55:50 +00:00
Andrey Starodubtsev
3e449ea05f Merge branch 'master' into directorargout_and_java_typemaps 2016-11-02 18:12:38 +03:00
Tobias Lau
26293546a6 Added LocalRefGuard for wstrings 2016-10-20 13:37:28 +02:00
Andrey Starodubtsev
b9cdc3c5e1 Merge branch 'master' into directorargout_and_java_typemaps 2016-10-13 14:14:59 +03:00
Daniel Vollmer
ce1cb85d86 Add <typeinfo> header for std::bad_cast 2016-09-17 13:24:32 +02:00
Daniel Vollmer
2dc87d7485 Add std::bad_cast to std_except.i
This exception occurs when dynamic_cast<T&> fails.

Fixes #783.
2016-09-17 10:26:54 +02:00
Andrey Starodubtsev
3ad041eede a lot of memory leak (local refs) fixed 2016-06-16 19:02:53 +03:00
Andrey Starodubtsev
b2bcf040c0 java directorargout + java/typemaps.i fixes
- directorargout didn't work - it used string "jresult" instead of
  argument name
- java/typemaps.i didn't work with directors
- test for using java/typemaps.i in directors added
2016-06-08 15:04:47 +03:00
William S Fulton
98a31ff633 Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value.
Closes #434
2016-05-14 21:32:24 +01:00
William S Fulton
a15bbbaee5 Java - unsigned long long marshalling improvements for negative numbers
Affects marshalling of negative numbers from Java to C only.
A cast to signed long long in the C layer will now result in the expected value.

Closes #623.
2016-03-31 18:56:32 +01:00
William S Fulton
8322686e84 Cosmetic java typemap cleanup 2016-03-31 18:56:32 +01:00
William S Fulton
870b814f5e Add C++11 std::array container support for Java 2016-03-14 20:46:56 +00:00
William S Fulton
dc4e0ab0f6 interface macro argument name tweaks 2016-03-11 19:47:08 +00:00
William S Fulton
e1dfad1a3b Change the name of the interface in %feature to be more portable
Use SwigInterface as a suffix to the class name when naming the
interface class instead of using a simple I as a prefix.
%feature_custom can be used to use I as a prefix if so desired.
2016-03-08 08:42:16 +00:00
William S Fulton
5cf20086a4 Rename feature_interface.i to swiginterface.i 2016-03-03 08:55:20 +00:00
William S Fulton
7f3f8fd76a Use rstrip instead of regex encoder in %feature_rename
The regex encoder is not always available in SWIG builds.
2016-03-03 08:55:10 +00:00
William S Fulton
3000824c94 Interface macros: %interface %interface_impl %interface_custom 2016-03-02 07:10:58 +00:00
William S Fulton
14d2341512 Add $interfacename family of special variable expansions
This is a simple expansion expanding to the name of the interface and is
not qualified like $javainterfacename and $csinterfacename.
Expansion within typemaps is much like $javainterfacename otherwise.
Note that expansion within the pure java code typemap,
'javainterfacecode' and similarly pure C# code typemap,
'csinterfacecode' works like $javaclassname/$csclassname and
$&interfacename should not be used, just $interfacename.
2016-02-29 21:18:42 +00:00
William S Fulton
c71dba5021 Interface name handling improvements and special variable changes
Support expansion of name attribute in: %feature("interface", name="%s")
%s expands to the proxy class name and all the usual %rename functions
can be used (regex, strip, camelcase etc) to derive the interface name
from the proxy class name.
Rename $interfacename family of special variables to $javainterfacename for Java
Rename $interfacename family of special variables to $csinterfacename for C#
This is to free up $interfacename for simple interface name expansion in forthcoming commit
2016-02-29 20:18:01 +00:00
William S Fulton
3b8f00f774 interface feature - SWIG_JAVABODY_PROXY does not need to be overridden 2016-02-26 18:17:20 +00:00
William S Fulton
50fec04759 Support namespaces and nspace with the interface feature for Java 2016-02-26 18:17:14 +00:00
William S Fulton
1737fc9b9b Add Java premature garbage collection prevention parameter (pgcpp) to interface feature
pgcpp was turned off but it is still needed for the interface feature
to prevent premature garbage collection of the proxy class being passed
into the C++ layer.
2016-02-24 08:30:10 +00:00
William S Fulton
e7bb3afa0c Create javainterfacecode and csinterfacecode typemaps
The interface feature is no longer hard coded and can
be controlled by a user via these new typemaps.
2016-02-23 07:30:00 +00:00
Vladimir Kalinin
5768d87deb director generation fixes
Conflicts:
	Lib/java/feature_interface.i
	Source/Modules/csharp.cxx
	Source/Modules/java.cxx
2016-02-12 07:09:17 +00:00
William S Fulton
abccc13a4a Merge branch 'interfaces' into interfaces2
* interfaces:
  Remove unnecessary interfaces for concrete classes
  cosmetic code formatting changes
  Correct interface name attributes that are internal
  interface macro changes to support templates
  Test non-virtual method in Derived classes
  interface tests for a most derived class inheriting the interfaces further up the chain
  Rename GetCPtr/getCPtr to SWIGInterfaceUpcast
  interface feature support for const ref pointers (used by the STL)
  Interface feature support for arrays
  More interface feature testing for return values
  interface feature support for passing by value
  interface feature support for references
  Multiple inheritance parameters as pointers testing
  Simplify multiple_inheritance_abstract Java runtime test
  Warning fixes
  Rename test functions in multiple_inheritance_abstract testcase
  Formatting fixes in generated code for interface feature
  Cosmetic spacing changes in test case
  interface feature typemap corrections to handle NULL pointers
  interface test added
  javadirectorin fix
  interface implementation visibility
  interface inheritance (2)
  interface inheritance (1)
  feature:interface ported to Java
  propagate non-abstract "interface" base methods (3)
  propagate non-abstract "interface" base methods (2)
  propagate non-abstract "interface" base methods (1)
  namespace support added GetCPtr now returns HandleRef "feature:interface:name" is now mandatory attribute
  interfaces (1)
  interfaces (1)

Conflicts:
	Source/Modules/csharp.cxx
	Source/Modules/java.cxx
2016-02-11 19:37:31 +00:00
William S Fulton
f82efac231 interface macro changes to support templates
The C++ type must be last in the argument list to support templates with
multiple arguments which are separated by commas.
Affects DECLARE_INTERFACE and DECLARE_INTERFACE_RENAME.
2016-02-09 07:02:42 +00:00
William S Fulton
72e5c221b6 Rename GetCPtr/getCPtr to SWIGInterfaceUpcast
This is then similarly named to other similar functions:
SWIGUpcast and SWIGSmartPtrUpcast
2016-02-08 20:49:46 +00:00
William S Fulton
e8907132cc interface feature support for const ref pointers (used by the STL)
Also interface feature return by value fixes
2016-02-07 13:58:47 +00:00
William S Fulton
5b86e2af13 Interface feature support for arrays 2016-02-06 20:15:48 +00:00