Commit graph

201 commits

Author SHA1 Message Date
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
William S Fulton
d32943b2a9 Javascript v8 object to string exceptions improvement 2022-09-19 09:09:29 +01:00
William S Fulton
00190c484f Javascript, Octave, R - Improve exceptions for %catches
and exception specifications for native types.

Now the raised exception contains the string value as the exception
message instead of just the C/C++ type of the exception.

R exceptions were completely swallowed beforehand
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
William S Fulton
fe17296eb4 Add Javascript support for std::unique_ptr and std::auto_ptr
Equivalent to Ruby/Python implementations.
2022-08-04 07:14:30 +01:00
Olly Betts
8dbcd710ff [Javascript] Fix handling of functions which take void*
Fixes #682
2022-03-07 14:17:52 +13:00
Olly Betts
b127e11f1e Fix typos in docs and comments 2022-02-27 18:15:46 +13:00
Olly Betts
7c97bd5ab3 [js] Remove code to handle v8 < 5.0
We require at least node v6 which means v8 5.0, so code to handle
older v8 is no longer useful.
2021-12-02 14:04:25 +13:00
William S Fulton
f17b6bda93 Merge branch 'fix_SWIG_V8_VERSION'
* fix_SWIG_V8_VERSION:
  [javascript][v8] SWIG_V8_VERSION generation method corrected.
2021-12-01 18:22:29 +00:00
Sergio Garcia Murillo
975a36d5a5
Merge branch 'fix-cast' into master 2021-11-29 16:12:38 +01:00
Sergio Garcia Murillo
56e7455af9 Return uint64_t as double if is bigger than uint32_t 2021-11-29 16:08:03 +01:00
William S Fulton
ada739b4a8 Fix mismatched new char[] and free() - Javascript
Javascript - v8 and node only.
When wrapping C code char arrays.
Now calloc is now used instead of new char[] in SWIG_AsCharPtrAndSize.
Fixes gcc-11 warning -Wmismatched-new-delete in arrays and
memberin_extend testcases.
2021-11-12 19:00:20 +00:00
Hirokazu MORIKAWA
3fe47b4b46 [javascript][v8] SWIG_V8_VERSION generation method corrected.
"SWIG_V8_VERSION" generation method was incorrectly fixed.

Signed-off-by: Hirokazu MORIKAWA <morikw2@gmail.com>
2021-05-01 09:25:03 +09:00
William S Fulton
3f391478c4 Merge branch 'v8-context-aware-race-free-preparation'
* v8-context-aware-race-free-preparation:
  Lib/javascript/v8: use ::Cast instead of To* when possible.
  Lib/javascript/v8/javascriptrun.swg: clean up pre-processor conditions.
  Lib/javascript/jsc/javascriptinit.swg: shortcut JSGlobalContextRef casts.
  Examples/test-suite/grouping.i: resolve compiler warning.
2021-03-11 22:48:38 +00:00
William S Fulton
04b46cc8a3 Javascript type conversion support
Add testcase for previous commit.
Add missing assert for future type conversions support that will use
the heap instead of pointer casts (for smart pointer type conversions).

Closes #1963
2021-03-11 20:10:13 +00:00
Andy Polyakov
2870e750f0 Lib/javascript/v8: use ::Cast instead of To* when possible.
If type is checked with Is*, it's safe to use corresponding ::Cast,
which is more optimal.
2021-03-10 14:51:08 +01:00
Andy Polyakov
b56814ce08 Lib/javascript/v8/javascriptrun.swg: clean up pre-processor conditions.
Harmonize javascriptcode.swg javascripthelpers.swg and clarify
documentation.
2021-03-10 14:51:08 +01:00
Sergio Garcia Murillo
fee5e239ec Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)
Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match
2021-03-10 08:34:45 +00:00
William S Fulton
513ea736d3 Merge branch 'array_fix'
* array_fix:
  add javascript_arays.i fix to changes file
  Convert javascript_arrays.i example into testcase
  Update .gitignore for java doxygen output
  Javascript code formatting corrections
  Fix Javascript arrays for modern node versions
  Fix for new SWIGV8_ARRAY_NEW definition
  Proper array typemaps in Javascript
2021-03-06 11:08:58 +00:00
Sergio Garcia Murillo
6aeee8effc
Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)
Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match
2021-03-05 15:08:17 +01:00
William S Fulton
b6aa39b82a Javascript code formatting corrections 2021-03-03 22:22:47 +00:00
William S Fulton
c4d003e442 Fix Javascript arrays for modern node versions 2021-03-03 22:19:29 +00:00
William S Fulton
53bdc3964d Fix for new SWIGV8_ARRAY_NEW definition 2021-03-03 22:19:22 +00:00
William S Fulton
1a4dc82931
Merge branch 'master' into array_fix 2021-03-03 21:54:30 +00:00
Andy Polyakov
b0c01ea851 Lib/javascript/v8: use context-aware initialization.
Context-aware initialization allows to instantiate add-ons multiple
times, most importantly in multiple Workers' contexts. Workers made
first appearance in v10.5. Context-aware initialization was option
earlier than that, even before supported minimum v6.x, yet condition
is chosen more conservatively as NODE_MODULE_VERSION >= 64, a.k.a.
v10.0.
2021-03-02 15:31:28 +01:00
Andy Polyakov
0215eaa344 Lib/javascript/v8/javascriptrun.swg: minor versioning cleanup.
|| (SWIG_V8_VERSION < 0x0704) is better handled in SWIGV8_MAYBE_CHECK.
2021-03-02 15:21:02 +01:00
William S Fulton
e74876f1b8 Add table of v8/node versions 2021-03-01 22:08:12 +00:00
William S Fulton
30216c4fb8 Merge branch 'js-fix-626'
* js-fix-626:
  Added check to prevent crash on illegal constructor call
2021-02-28 22:00:55 +00:00
William S Fulton
7005b156cc Modify SWIGV8_AppendOutput to work with newer versions of node 2021-02-28 20:59:46 +00:00
Olegs Jeremejevs
f7756be391 Fix SWIGV8_AppendOutput for OUTPUT typemaps
Create array to append to if the existing return type is not void.

Closes #405
Closes #1121
2021-02-28 20:46:38 +00:00
William S Fulton
59b780efed Cosmetic whitespace 2021-02-28 20:26:03 +00:00
William S Fulton
11deb82354 Restore complex number support for ancient v8 versions 2021-02-27 22:18:47 +00:00
William S Fulton
0e36b5d6fd Fixes for node v12.0-12.5 2021-02-27 22:18:27 +00:00
William S Fulton
7cb719ee67 -Wunused-result fixes for Node < 12
Fix 0533fc26c which adds in calls to Check(), which was added in Node 12.
Also fix e6315eedd which calls the new Set() and Check() method.
2021-02-27 22:17:59 +00:00
William S Fulton
bcc0b6b616 Use SWIGV8_INTEGER_NEW_UNS always for unsigned long long 2021-02-26 23:24:49 +00:00
Sergio Garcia Murillo
355ef40bc1 Use SWIGV8_INTEGER_NEW_UNS always for unsigned values 2021-02-26 23:23:36 +00:00
William S Fulton
e6315eedd0 Fix -Wunused-result warnings in node wrappers 2021-02-26 22:38:28 +00:00
William S Fulton
0533fc26ca Fix -Wunused-result warnings in node wrappers 2021-02-26 22:23:57 +00:00
William S Fulton
776917e43e Javascript: Stop using deprecated Array::Get method 2021-02-26 21:52:05 +00:00
William S Fulton
7b37c8cd02 Merge branch 'pr/new-node-fixes'
* pr/new-node-fixes:
  Travis testing: Node 12 support not fully working yet
  Revert "Merge pull request #3 from tungntpham/new-node-fixes-refactor"
  OPTIM: Restructured the code where it checks for V8 version, removing duplicate code and potentially improving the readability.
  Nodejs: run tests against Node.js v12
  Add support for Node.js v12
  Replace Handle with Local depending on Node.js version
  Introduce macros to support both Handle and Local types
2021-02-24 22:14:47 +00:00
tungpham25
36960396ba Revert "Merge pull request #3 from tungntpham/new-node-fixes-refactor"
This reverts commit 35f05bd541, reversing
changes made to 0ea6a3bdbf.
2021-01-28 21:48:45 +00:00
TungPham51D
4ce34742a7 OPTIM: Restructured the code where it checks for V8 version, removing duplicate code and potentially improving the readability. 2021-01-14 13:48:19 +00:00
William S Fulton
9a2513bf85 Javascript v8 C complex wrappers fix 2020-10-10 14:53:46 +01:00
Leo Singer
511df0e642 More C99 complex fixes, plus Python tests 2020-06-24 20:21:47 -04:00
Leo Singer
07b4b274e5 Restore _Complex as standalone type 2020-06-24 20:21:47 -04:00
Leo Singer
1adc7dac5d Small corrections for handling C99 _Complex 2020-06-24 20:21:47 -04:00
Leo Singer
13260f95b0 Properly handle C99 complex types even in C++ mode
Use the `_Complex` keyword rather than the `complex` macro.

Fixes #1487.
2020-06-24 20:21:47 -04:00
Yegor Yefremov
113d78a083 Add support for Node.js v12 2020-04-07 15:23:31 +02:00
Yegor Yefremov
26fc996ad6 Replace Handle with Local depending on Node.js version
Use newly introduced macros like SWIGV8_VALUE to use v8::Handle or
v8::Local depending on the selected Node.js version where possible.
2020-04-07 14:13:12 +02:00