Commit graph

53 commits

Author SHA1 Message Date
William S Fulton
9dd33e6367 Add missing typedefs to std::map 2019-02-13 22:46:27 +00:00
William S Fulton
6d0c495fd0 Add missing parameter names in STL container wrappers
Mostly in STL copy constructors.

Best to have parameter names as they make their way into the wrappers in
some target languages.
2019-02-13 22:45:47 +00:00
William S Fulton
68e86614ff Create a consistent stl.i library file
Same file now for all languages except R which is still missing std_map.i.
Recent Java changes adding in std_set.i removed.
2019-02-12 18:46:05 +00:00
William S Fulton
ca287ae13b Add support for non-default compare template argument in std::map wrappers 2018-10-09 19:44:00 +01:00
luz.paz
60dfa31a67 Misc. typos
found via `codespell` and `grep`
2018-05-17 10:04:23 -04:00
William S Fulton
e86c881a70 Fix directorout typemaps which were causing undefined behaviour when returning pointers by reference.
Closes #1167
2017-12-14 07:00:42 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
William S Fulton
280090ed4b Add director shared_ptr typemaps for D 2017-10-17 22:47:16 +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
Olly Betts
90f9117e10 Fix various comment and documentation typos 2017-08-13 18:04:33 +12: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
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
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
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
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
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
1ba48ceb99 Initialise all newly created arrays in arrays.i library.
Affects C++ code only.

Closes #440.
2015-07-30 20:41:15 +01:00
William S Fulton
ef75735e9b pedantic warning fix for D wrappers 2015-02-11 23:24:39 +00:00
William S Fulton
b45c3737c8 Add c++11 strongly typed enum support for D 2014-11-28 08:13:27 +00:00
David Nadlinger
278308cfd3 D: Fix exception handling support.
The original code was ported from the C# module. It looks like it
tried to avoid reading TLS data by using a shared counter. However,
without also synchronizing on the counter check (or using atomics)
the code is racy. While the races might be benign (the thread that
sets the exception also increments the counter, so when there is
actually an exception, the visible value will always be non-zero
even if it is outdated), they are still undefined behavior,
strictly speaking. Additionally, just using TLS isn't expensive
either.
2014-11-06 23:04:36 +01:00
David Nadlinger
95e8db7c62 D: Fix class/method name ambiguity in test-suite/c_delete.i.
There might be other cases where this happens when $dclassname
is used for code emitted into the proxy class itself, but so
far, there are none in the test suite or any bug reports.
2014-11-06 23:04:35 +01:00
Timothee Cour
2b2260e996 _ 2014-08-12 09:11:10 -07:00
Curtis Dunham
fe91d6449f Remove register storage class declarations
They're unnecessary, anacronistic, deprecated in modern
standards, generally ignored, useless, and (most importantly)
clang complains about them.
2014-02-19 11:58:27 -06:00
Marvin Greenberg
843aa7cd65 Work around differences in clang libc++ std::vector<bool>::const_reference
clang++ using -stdlib=libc++ defines const_reference as a class,
to map boolean vectors onto a bit set.  Because swig does
not "see" the type as "const &" it generates incorrect code for this case,
generating a declaration like:

  const_reference result;

When const_reference is a typedef to 'bool' as is the case with stdlibc++
this works.  When this is actually a constant reference, this is clearly
invalid since it is not initialized.  For libc++, this is a class
which cannot be default constructed, resulting in an error.  The fix
is to explicitly define the various accessor extensions as having a
bool return type for this specialization.
2014-02-04 16:00:12 -05:00
William S Fulton
cc650e692e Director exceptions now derive from std::exception 2014-01-20 19:40:52 +00:00
William S Fulton
1a19451c1b Error out attempting to use directors without -c++
Remove redundant #ifdef __cplusplus markers in director.swg
2013-12-23 20:23:54 +00:00
William S Fulton
135a7cc558 Beautify director.swg files
Also some comment corrections for Perl
2013-12-23 19:50:41 +00:00
William S Fulton
12a9671440 std::string typemap modifications so they can be used with %apply for other string classes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13120 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-05-26 06:33:49 +00:00
David Nadlinger
7615b099d1 [D] Reverted part of #3502431 mistakenly applied in r12948.
(The changes only concerned D2, and were already present in trunk.)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13000 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-04-17 12:17:42 +00:00
William S Fulton
cd770b27ff Apply #3502431 to fix duplicate symbols in multiple modules and compiler errors due to lack of const in some methods taking char*.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12948 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-03-24 01:01:06 +00:00
David Nadlinger
17a7ba0403 [D] Exception and Error have become blessed names; removed d_exception_name test case.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12900 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-01-23 21:59:20 +00:00
David Nadlinger
8fa4d20ec3 [D] Correctly annotate function pointers with C linkage.
Minor cleanups as well.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12899 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-01-23 21:59:00 +00:00
William S Fulton
4c898b023c The 'directorin' typemap now accepts , etc expansions instead of having to use workarounds - _name, _name etc.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12879 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-21 07:16:44 +00:00
David Nadlinger
e2b2f26bf6 [D] Use stdc.config.c_long/c_ulong to represent C long types.
Previously, C's long/ulong types would always be mapped to 32 bit integers in D, which is wrong on D_LP64, but was not really a problem in practice since DMD used to be 32 bit only.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12861 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-03 19:48:01 +00:00
David Nadlinger
730e14077d [D] Fix exception glue code for newer DMD 2 versions.
Thanks to Andrej Mitrovic for reporting.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12856 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-12-03 19:46:46 +00:00
William S Fulton
30206f975c Fix constructors in named typedef class declarations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12784 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-08-25 19:27:38 +00:00
William S Fulton
8ee0593036 Remove incomplete directorin typemaps as users incorrectly assumed they were implemented and working
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12653 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-03 05:46:00 +00:00
William S Fulton
837835280d Remove directorout INPUT/INOUT/OUTPUT typemaps - they will never be used as they used for the return type, not parameters. Fix java directorin typemap.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12651 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-05-03 05:32:13 +00:00
David Nadlinger
ce6516fb4c [D] nspace support.
As for C# and Java, this doesn't work for free functions/variables yet.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12534 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-03-13 00:32:26 +00:00
David Nadlinger
828fac25cb [D] Don't break function return types in typemaps.i.
This fixes the new "li_typemaps_apply" testcase as done for C# in r12400.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12409 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-29 21:32:36 +00:00
David Nadlinger
de53ede681 [D] Fix byte/ubyte confusion in typemaps.i.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12408 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-29 21:32:23 +00:00
David Nadlinger
160ee9c937 [D] Support for C++ references to primitive types.
I am not sure why these typemaps were missing before since I included code for this in the C++ part of the feature, but please let me know if I missed some case where this could break generated code.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12406 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2011-01-29 21:31:53 +00:00
David Nadlinger
ab2af5ebe2 [D] Removed leftover %dstripprefix definition.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12359 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-30 17:37:48 +00:00
David Nadlinger
38c88a0931 [D] Operator overloading support for D1 and D2.
As mentioned in the documentation, opIndexAssign and implicit casting are not supported yet.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12357 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-12-30 02:44:04 +00:00
David Nadlinger
3477a9dff1 [D] Replaced the term "wrap D module" with "intermediary D module" (including names derived from it).
This was suggested by wsfulton on the mailing list in order to bring the D module in line with the C# one, the naming scheme of which is intended to be language-independent.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-11-28 23:12:03 +00:00
David Nadlinger
a22df2eca9 [D] Refer to the built-in Exception class using its fully-qualified name.
A C++ class called "Exception" could shadow the built-in one before, leading to compilation errors in the exception handling code.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12318 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-11-27 00:13:44 +00:00
David Nadlinger
e362f85431 [D] Use __cdecl instead of __stdcall on Windows as well to avoid special casing.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12303 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-11-22 00:33:26 +00:00