Commit graph

4,000 commits

Author SHA1 Message Date
Olly Betts
56d7435573 Merge branch 'php8-support'
Fixes #1929, Fixes #1978
2021-03-21 10:57:35 +13:00
Andy Polyakov
1eebc2335a Lib/java/arrays_java.i: use actual C/C++ type in JAVA_ARRAYS_TYPEMAPS.
long long[] map was using JNI type as C/C++ type. General spirit of
JAVA_ARRAYS_TYPEMAPS is to cast individual array elements, not to
rely on potentially incompatible pointer casts.
2021-03-19 16:29:48 +01:00
Andy Polyakov
971e1154af Lib/java/javahead.swg: clean up jlong handling.
As for __int64 definition. __int64 is a non-standard Visual-C-specific
type used in win32/jni_md.h. It is defined by other Win32 compilers in
one way or another, obviously for compatibility. It's more appropriate
to give the compiler a chance to make necessary arrangements instead
of reinventing the wheel. This, giving a chance, can be achieved by
including virtually any standard header. Since jni.h includes stdio.h,
defining __int64 in javahead.swg is redundant. Since doing so actually
triggers compilation errors on MinGW if a system header is included
in the %begin section, it's arguably appropriate to omit it.

As for #undef _LP64 removal. Undefining a pre-defined macro, which
_LP64 is, is bad style, and if followed by inclusion of systems
headers, it's actually error-prone. Log suggests that it was added
to resolve a warning. I'm inclined to believe that it rather was a
misunderstanding of some kind. Or a bug in warning subsystem of
some particular compiler version, in which case it would have been
more appropriate to advise users to ignore the warning.
2021-03-19 16:29:48 +01:00
Olly Betts
3584c7d49c Add initial support for PHP8
Testcase director_overload2 is failing, but the rest of the testsuite
passes.
2021-03-19 19:30:27 +13:00
Olly Betts
71475b0af9 Improve PHP object creation
Reportedly the code we were using in the directorin case gave segfaults
in PHP 7.2 and later - we've been unable to reproduce these, but the new
approach is also simpler and should be bit faster too.

Fixes #1527, #1975
2021-03-19 08:45:33 +13:00
Olly Betts
b7dedecfdd php: Fix char* typecheck typemap to accept Null
The corresponding in typemap already does.

Fixes #1655, reported by CJSlominski.
2021-03-19 08:34:15 +13:00
Olly Betts
4e0997cd5a Conditionalise math.i for PHP
PHP already provides all the wrapped constants and all the wrapped
functions except fabs() (PHP provides abs() instead).  Rewrapping
the constants causes warnings or errors (depending on PHP version)
and the rewrapped functions seem to be hidden by the built-in
versions, so only wrap fabs() for PHP.

(Even a wrapper for fabs() seems of little use since abs() is already
provided, but really math.i seems of little use more generally since
any general purpose programming language will provide its own maths
functions and constants - the key motivation here is to eliminate
warnings and errors from running the testsuite.)
2021-03-17 09:43:15 +13: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
6aef217438 Add Javascript (JSC) support for type conversion
Fix types_directive testcase to ensure the %types code is actually
called and not just cast from one type to the other.
2021-03-11 20:18:58 +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
Andy Polyakov
0c10c0596f Lib/javascript/jsc/javascriptinit.swg: shortcut JSGlobalContextRef casts. 2021-03-10 14:48:18 +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
William S Fulton
db175f76c1
Merge pull request #1957 from dot-asm/v8-context-aware
Lib/javascript/v8: use context-aware initialization.
2021-03-05 22:28:42 +00: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
William S Fulton
d38c8d512f Merge branch 'vaughamhong-master'
* vaughamhong-master:
  fixed build error - ISO C90 forbids mixed declarations and code for jsc
  touch to kickoff another build - from accidental close pull request
  Implemented SetModule / GetModule for JSC to allow type sharing across modules - with fix for passing NULL to non-pointer argument
  Implemented SetModule / GetModule for JSC to allow type sharing across modules
2021-03-03 21:35:34 +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
4b64becbbb OUTPUT typemaps on methods that don't return void
SWIGJSC_ValueIsArray could be implemented by JSValueIsArray in later
versions of Javascript webkit, similar fix to previous commits for v8.

Enhance testing of OUTPUT typemaps to test more than one output.
2021-03-01 14:20:18 +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
Zackery Spytz
bcfa927298 Fix typos in attribute2ref() in Lib/typemaps/attribute.swg
AccessorName was being used instead of AttributeName.

Closes #1872.
2021-02-09 09:21:14 -07: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
Julien Schueller
9ed60ac7a0 Drop deprecated PyEval_CallObject method
see https://docs.python.org/3.9/whatsnew/3.9.html
2020-10-15 08:43:21 +02:00
William S Fulton
4b5baf0a60 0.0 float warning fix 2020-10-10 15:02:26 +01:00
William S Fulton
9a2513bf85 Javascript v8 C complex wrappers fix 2020-10-10 14:53:46 +01:00
William S Fulton
57957787b7 Convert C++ comment to C comment 2020-10-10 14:53:46 +01:00
William S Fulton
4f184500d7 Merge commit '8245277ad3' into c99-complex
* commit '8245277ad3':
  Remove test for unsupported complex or _Complex by itself
  More C99 complex fixes, plus Python tests
  Restore _Complex as standalone type
  Small corrections for handling C99 _Complex
  Properly handle C99 complex types even in C++ mode

Conflicts:
	Examples/test-suite/python/complextest_runme.py
2020-10-10 14:53:33 +01:00
William S Fulton
4d5f4bcd33 Merge branch 'PyBuffer_Release-pybuffer'
* PyBuffer_Release-pybuffer:
  Add tests.
  Fix the error handling for the PyObject_GetBuffer() calls in pybuffer.i
2020-10-07 22:37:17 +01:00
William S Fulton
c1b004f4fa Add access modifier support for interface feature
Add ability to change the modifiers for the C# and Java
interface generated when using the %interface macros.

For C# use the 'csinterfacemodifiers' typemap.
For Java use the 'javainterfacemodifiers' typemap.

For example:

  %typemap(csinterfacemodifiers) X "internal interface"

Closes #1874
2020-09-25 18:54:25 +01:00
Gareth Francis
beb1d8498d Fix C# wchar_t* csvarout to be same as csout 2020-09-05 17:03:34 +01:00
William S Fulton
b018c32f9d Fix crashes in swig_connect_director during director class construction.
Occurs when using the director class from multiple threads - a race condition
initialising block scope static variables.

Block scope static variables are guaranteed to be thread safe in C++11,
so the fix is guaranteed when using C++11. However, most modern compilers
also fix it when using C++03/C++98.

Closes #1862
2020-08-28 18:23:47 +01:00