In $typemap(), the $n special variables are replaced by the appropriate
value for the type associated with the typemap calling $typemap().
The (undocumented) special variable overrides now also support
controlling what the $n special variables are replaced with from the
calling typemap, for example:
%typemap(in) std::pair<std::string, int> {
int& input_value_second = $1.second;
$typemap(in, int, 1=input_value_second);
...
}
replaces $1 in the int typemap with input_value_second instead of
whatever is the default for the target language (a variable that holds
the int value after marshalling from the target language).
This additional functionality might make it possible to replace the C++
templates used in the UTL with a much simpler system of typemaps utilising
$typemap(). See follow on commit to typemaps.c.
The strings from the Octave array are returned in a temporary
std::string object so we need to make a copy of them or else the
final string ends up replicated as all elements.
Unfortunately argcargvtest.i was only checking the final element's
value, so fix it to test both the elements as a regression test for
this, and to catch any similar issues with other target languages.
* typedef-namespace:
Partial revert of previous commit for typedefs
add an unit test
tentative fix for typedef/using declaration to struct typedef
Conflicts:
CHANGES.current
Setting current symbol table for a typedef seems wrong.
No difference to test-suite though.
Testcase rename for C++11 testing and minor adjustments.
Issue #2550Closes#2551
Previously the default was always "node", even if nodejs wasn't
detected by configure. This leads to a confusing failure from
"make check" if you have another support JS engine installed
but not node.
Now the default it picked based on which engines configure
found. If only one was detected, that should be used. If
multiple are, you can override the default choice by specifying
e.g. ENGINE=jsc on the make command line.
Fixes#2453
Nodejs is like V8 and needs C++ output enabled when wrapping C code.
The testsuite was masking this bug by using SWIG options
`-v8 -DBUILDING_NODE_EXTENSION=1` rather than `-node` when testing
with nodejs, while the javascript examples currently all seem to all get
processed with -c++.
This reverts commit ea514c3961.
The new runme.js isn't used for node because it fails to run
multicpptest testcases, but was failing for jsc in CI.
The first problem is the new file is missing `new` where the two
objects are created, but fixing that reveals that this testcase
is currently broken for Javascript so just revert for now.
* fix-cast:
add tests for new casting behavior
skip tests when value is out of range
refactor integers JS testcase to avoid repeating code
Return uint64_t as double if is bigger than uint32_t
Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)
Go, Guile, Racket, Scilab: Add throws typemaps for std::string so that
thrown string exception messages can be seen.
Test all language for std::string throws typemaps
For implementing full move semantics when passing parameters by value.
Based on SWIGTYPE && and std::unique_ptr typemaps which implement move
semantics.
Added for all languages, but untested for: Go, Ocaml, R, Scilab (and
unlikely to be fully functional for same reasons as for std::unique_ptr
support).
Issue #999