Commit Graph

147 Commits

Author SHA1 Message Date
William S Fulton e8d3c74590 Improvements to $typemap() special variable replacement overrides
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.
2023-11-03 09:07:51 +00:00
William S Fulton bd2dcf920c Correct attempts to not run tests in Javascript and Octave 2023-08-14 22:54:40 +01:00
William S Fulton 87e2e4b47c Remove trace output from Javascript testcase 2023-06-28 07:30:40 +01:00
Momtchil Momtchev ceed54758a Javascript Node-API support added
Closes #2545
2023-06-28 07:24:51 +01:00
Olly Betts d05e2709dc
Merge pull request #2629 from mmomtchev/js-run-tests-last-batch
add the last bulk batch of Python tests to JS
2023-06-02 16:50:53 +12:00
Olly Betts db922b5e4e
Merge pull request #2626 from mmomtchev/js-default-args
[JS] remove hacks and implement default arguments
2023-06-02 08:37:58 +12:00
Momtchil Momtchev 62d17187d1 fix the JSC incompatibilities 2023-06-01 13:47:39 +02:00
Momtchil Momtchev 303b00cb01 add the last bulk batch of Python tests to JS 2023-06-01 13:29:05 +02:00
Momtchil Momtchev bc6d6ed11a batch of JS run tests 2023-05-31 18:46:34 +02:00
Momtchil Momtchev f10eef462d add overload + extend + default args run test 2023-05-31 15:42:13 +02:00
Momtchil Momtchev 721a4808b8 remove hacks and implement default arguments 2023-05-31 13:22:35 +02:00
Momtchil Momtchev bcfeed0ea1 add more JS run tests 2023-05-30 20:12:55 +02:00
Olly Betts 0c40ac59f1 Merge branch 'v8-packed-obj' 2023-05-30 17:49:49 +12:00
Momtchil Momtchev de3c2fea95 fix JSC too 2023-05-29 21:02:42 +02:00
Momtchil Momtchev b99790c6db remove debugging leftovers 2023-05-29 20:19:38 +02:00
Momtchil Momtchev 2ccf3c3050 fix member pointers 2023-05-29 20:17:31 +02:00
Momtchil Momtchev d3e91b8273 another batch of run tests 2023-05-29 17:18:43 +02:00
Momtchil Momtchev 0d8ce6e031 add two Python tests 2023-05-29 12:42:59 +02:00
Momtchil Momtchev 92dfc5de2e first batch of tests 2023-05-29 12:39:51 +02:00
Olly Betts f8f47723a8 Add missing newlines at end on new files 2023-05-29 12:45:57 +12:00
Momtchil Momtchev a1e7441fad add a missing rename 2023-05-27 17:44:02 +02:00
Momtchil Momtchev 40d277ed31 try using finally as JS keyword 2023-05-27 17:31:59 +02:00
Momtchil Momtchev 1317583471 add two Python unit tests to JS 2023-05-26 16:54:41 +02:00
Momtchil Momtchev 3baa5c090f add more JS run tests 2023-05-26 16:50:24 +02:00
Olly Betts 8a73e25fe2 argcargv.i: NULL terminate argv with empty input
Fixes needed for: C# R
2023-05-23 10:12:49 +12:00
Olly Betts eaefa489c5 [js] argcargv.i: Allow empty array or empty string 2023-05-22 14:08:13 +12:00
Olly Betts 915dc93b0d [octave] Fix argcargv.i bug
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.
2023-05-22 13:38:59 +12:00
Olly Betts 5eedba422f [js] Add _runme.js files for ynit tests that pass
Fixes #2600
2023-05-22 08:18:31 +12:00
Erez Geva bdc2190cde Add argc and argv multi-argument typemap to Java, Guile, JavaScript, Scilab and C#
Fixes #2552

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2023-05-20 16:17:00 +12:00
Erez Geva b6eaee8d12 Add li_constraints test, testing 'constraints.i'.
For: JavaScript, C#, go, Java, Lua, Perl, PHP, python, Ruby, TCL and Octave.

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2023-05-12 01:23:31 +02:00
William S Fulton 281af00437 Tweak to struct name in testcase for R 2023-05-06 15:09:07 +01:00
William S Fulton e0c7f81ba5 Merge branch 'typedef-namespace'
* 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
2023-05-06 11:36:30 +01:00
William S Fulton 65be881295 Partial revert of previous commit for typedefs
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 #2550
Closes #2551
2023-05-06 11:13:23 +01:00
Momtchil Momtchev 33b4834920 add an unit test 2023-05-06 10:54:14 +01:00
Momtchil Momtchev edd55210bb take into account numinputs when counting arguments 2023-04-26 18:23:53 +02:00
Olly Betts 7bb7295a33 [js] Improve default for JSENGINE
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
2023-04-22 13:33:46 +12:00
Olly Betts b508598a42 [js] Turn on C++ output for node too
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++.
2023-04-22 13:33:46 +12:00
William S Fulton 1d73341aa4 Polymorphism in R wrappers fixed for C++ structs 2022-10-24 08:56:55 +01:00
Olly Betts cfd2557cda Revert "[js] Add mod_runme.js"
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.
2022-10-20 11:42:27 +13:00
Olly Betts ea514c3961 [js] Add mod_runme.js
See #2126
2022-10-19 07:35:53 +13:00
William S Fulton e622a708d2 Fix Javascript node test-suite to use desired c++ standard
Passes the -std determined in configure.ac to node-gyp
2022-10-15 14:58:25 +01:00
William S Fulton bba072d95d Merge branch 'fix-cast'
* 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)
2022-10-14 19:19:13 +01:00
Alba Mendez 55d7a51343 add tests for new casting behavior
more integers are preserved now
2022-10-10 13:28:44 +02:00
Alba Mendez 5b02dc93d6 skip tests when value is out of range 2022-10-10 13:28:44 +02:00
Alba Mendez cf7733e4b8 refactor integers JS testcase to avoid repeating code 2022-10-10 12:49:57 +02:00
William S Fulton 4a397869a2 Merge branch 'director-unwrap-result'
* director-unwrap-result:
  Unwrap director classes only when returning a pointer or reference to an object
2022-10-07 18:41:14 +01:00
William S Fulton ed333b6b97 std::string throws typemaps
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
2022-09-19 09:09:29 +01:00
William S Fulton 4a29229bab Add catches_strings test to test throws char * typemap 2022-09-19 09:09:29 +01:00
William S Fulton e97181ebc0 Add missing typecheck typemaps for std::auto_ptr and std::unique_ptr
To fix overloading when using these types.
2022-09-17 10:23:51 +01:00
William S Fulton dad7c93ca0 Provide SWIGTYPE MOVE typemaps in swigmove.i
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
2022-09-16 08:36:25 +01:00