Merge remote-tracking branch 'upstream/master' into director-classes-final-methods
This commit is contained in:
commit
cbae09f92f
14 changed files with 84 additions and 35 deletions
|
|
@ -7,6 +7,18 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.0.0 (in progress)
|
||||
===========================
|
||||
|
||||
2019-02-23: zphensley42
|
||||
Use fully qualified name 'java.lang.Object' instead of 'Object' in generated code to
|
||||
avoid clashes with wrapped C++ classes called 'Object'.
|
||||
|
||||
2019-02-23: gtbX
|
||||
[Java] #1035 Add (const char *STRING, size_t LENGTH) typemaps in addition to the non-const
|
||||
typemaps (char *STRING, size_t LENGTH) which does not attempt to write back to the const
|
||||
string.
|
||||
|
||||
2019-02-22: tamuratak
|
||||
#984 Add support for RTypedData introduced in Ruby 1.9.3.
|
||||
|
||||
2019-02-22: ZackerySpytz
|
||||
#1483 Fix compilation failures when a director class has final methods.
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ Active SWIG Developers:
|
|||
Oliver Buchtala (oliver.buchtala@gmail.com) (Javascript)
|
||||
Neha Narang (narangneha03@gmail.com) (Javascript)
|
||||
Simon Marchetto (simon.marchetto@scilab-enterprises.com) (Scilab)
|
||||
Zackery Spytz (zspytz@gmail.com) (OCaml, SWIG core)
|
||||
|
||||
Past SWIG developers and major contributors include:
|
||||
Dave Beazley (dave-swig@dabeaz.com) (SWIG core, Python, Tcl, Perl)
|
||||
|
|
@ -28,7 +29,7 @@ Past SWIG developers and major contributors include:
|
|||
Mikel Bancroft (mikel@franz.com) (Allegro CL)
|
||||
Surendra Singhi (efuzzyone@netscape.net) (CLISP, CFFI)
|
||||
Marcelo Matus (mmatus@acms.arizona.edu) (SWIG core, Python, UTL[python,perl,tcl,ruby])
|
||||
Art Yerkes (ayerkes@speakeasy.net) (Ocaml)
|
||||
Art Yerkes (ayerkes@speakeasy.net) (OCaml)
|
||||
Lyle Johnson (lyle@users.sourceforge.net) (Ruby)
|
||||
Charlie Savage (cfis@interserv.com) (Ruby)
|
||||
Thien-Thi Nguyen (ttn@glug.org) (build/test/misc)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ CPP_TEST_CASES = \
|
|||
ruby_keywords \
|
||||
ruby_minherit_shared_ptr \
|
||||
ruby_naming \
|
||||
ruby_rdata \
|
||||
ruby_track_objects \
|
||||
ruby_track_objects_directors \
|
||||
std_containers \
|
||||
|
|
|
|||
7
Examples/test-suite/ruby/ruby_rdata_runme.rb
Normal file
7
Examples/test-suite/ruby/ruby_rdata_runme.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
require 'swig_assert'
|
||||
require 'ruby_rdata'
|
||||
|
||||
include Ruby_rdata
|
||||
|
||||
swig_assert_equal_simple(1, take_proc_or_cpp_obj_and_ret_1(Proc.new{}))
|
||||
swig_assert_equal_simple(1, take_proc_or_cpp_obj_and_ret_1(C.new))
|
||||
20
Examples/test-suite/ruby_rdata.i
Normal file
20
Examples/test-suite/ruby_rdata.i
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
%module ruby_rdata
|
||||
|
||||
%{
|
||||
|
||||
class C {};
|
||||
|
||||
int take_proc_or_cpp_obj_and_ret_1(VALUE obj) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int take_proc_or_cpp_obj_and_ret_1(C c) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
class C {};
|
||||
|
||||
int take_proc_or_cpp_obj_and_ret_1(VALUE);
|
||||
int take_proc_or_cpp_obj_and_ret_1(C);
|
||||
|
|
@ -160,7 +160,7 @@ SWIGINTERN jint SWIG_JavaIntFromSize_t(size_t size) {
|
|||
%typemap(jtype) jfloat "float"
|
||||
%typemap(jtype) jdouble "double"
|
||||
%typemap(jtype) jstring "String"
|
||||
%typemap(jtype) jobject "Object"
|
||||
%typemap(jtype) jobject "java.lang.Object"
|
||||
%typemap(jtype) jbooleanArray "boolean[]"
|
||||
%typemap(jtype) jcharArray "char[]"
|
||||
%typemap(jtype) jbyteArray "byte[]"
|
||||
|
|
@ -169,7 +169,7 @@ SWIGINTERN jint SWIG_JavaIntFromSize_t(size_t size) {
|
|||
%typemap(jtype) jlongArray "long[]"
|
||||
%typemap(jtype) jfloatArray "float[]"
|
||||
%typemap(jtype) jdoubleArray "double[]"
|
||||
%typemap(jtype) jobjectArray "Object[]"
|
||||
%typemap(jtype) jobjectArray "java.lang.Object[]"
|
||||
|
||||
%typemap(jstype) jboolean "boolean"
|
||||
%typemap(jstype) jchar "char"
|
||||
|
|
@ -180,7 +180,7 @@ SWIGINTERN jint SWIG_JavaIntFromSize_t(size_t size) {
|
|||
%typemap(jstype) jfloat "float"
|
||||
%typemap(jstype) jdouble "double"
|
||||
%typemap(jstype) jstring "String"
|
||||
%typemap(jstype) jobject "Object"
|
||||
%typemap(jstype) jobject "java.lang.Object"
|
||||
%typemap(jstype) jbooleanArray "boolean[]"
|
||||
%typemap(jstype) jcharArray "char[]"
|
||||
%typemap(jstype) jbyteArray "byte[]"
|
||||
|
|
@ -189,7 +189,7 @@ SWIGINTERN jint SWIG_JavaIntFromSize_t(size_t size) {
|
|||
%typemap(jstype) jlongArray "long[]"
|
||||
%typemap(jstype) jfloatArray "float[]"
|
||||
%typemap(jstype) jdoubleArray "double[]"
|
||||
%typemap(jstype) jobjectArray "Object[]"
|
||||
%typemap(jstype) jobjectArray "java.lang.Object[]"
|
||||
|
||||
/* Non primitive types */
|
||||
%typemap(jni) SWIGTYPE "jlong"
|
||||
|
|
@ -1383,12 +1383,12 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
%apply SWIGTYPE & { SWIGTYPE (CLASS::*const&) }
|
||||
|
||||
/* String & length */
|
||||
%typemap(jni) (char *STRING, size_t LENGTH) "jbyteArray"
|
||||
%typemap(jtype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(jstype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(javain) (char *STRING, size_t LENGTH) "$javainput"
|
||||
%typemap(freearg) (char *STRING, size_t LENGTH) ""
|
||||
%typemap(in) (char *STRING, size_t LENGTH) {
|
||||
%typemap(jni) (const char *STRING, size_t LENGTH) "jbyteArray"
|
||||
%typemap(jtype) (const char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(jstype) (const char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(javain) (const char *STRING, size_t LENGTH) "$javainput"
|
||||
%typemap(freearg) (const char *STRING, size_t LENGTH) ""
|
||||
%typemap(in) (const char *STRING, size_t LENGTH) {
|
||||
if ($input) {
|
||||
$1 = ($1_ltype) JCALL2(GetByteArrayElements, jenv, $input, 0);
|
||||
$2 = ($2_type) JCALL1(GetArrayLength, jenv, $input);
|
||||
|
|
@ -1397,10 +1397,10 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
$2 = 0;
|
||||
}
|
||||
}
|
||||
%typemap(argout) (char *STRING, size_t LENGTH) {
|
||||
if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
%typemap(argout) (const char *STRING, size_t LENGTH) {
|
||||
if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, JNI_ABORT);
|
||||
}
|
||||
%typemap(directorin, descriptor="[B", noblock=1) (char *STRING, size_t LENGTH) {
|
||||
%typemap(directorin, descriptor="[B", noblock=1) (const char *STRING, size_t LENGTH) {
|
||||
$input = 0;
|
||||
if ($1) {
|
||||
$input = JCALL1(NewByteArray, jenv, (jsize)$2);
|
||||
|
|
@ -1409,9 +1409,14 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input);
|
||||
}
|
||||
%typemap(javadirectorin, descriptor="[B") (const char *STRING, size_t LENGTH) "$jniinput"
|
||||
%apply (const char *STRING, size_t LENGTH) { (char *STRING, size_t LENGTH) }
|
||||
/* Enable write-back for non-const version */
|
||||
%typemap(argout) (char *STRING, size_t LENGTH) {
|
||||
if ($input) JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
}
|
||||
%typemap(directorargout, noblock=1) (char *STRING, size_t LENGTH)
|
||||
{ if ($input && $1) JCALL4(GetByteArrayRegion, jenv, $input, 0, (jsize)$2, (jbyte *)$1); }
|
||||
%typemap(javadirectorin, descriptor="[B") (char *STRING, size_t LENGTH) "$jniinput"
|
||||
%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
|
||||
|
||||
/* java keywords */
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace std {
|
|||
this();
|
||||
java.util.ListIterator<$typemap(jboxtype, T)> it = listIterator(0);
|
||||
// Special case the "copy constructor" here to avoid lots of cross-language calls
|
||||
for (Object o : c) {
|
||||
for (java.lang.Object o : c) {
|
||||
it.add(($typemap(jboxtype, T))o);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ template<class K, class T, class C = std::less< K> > class map {
|
|||
return sizeImpl();
|
||||
}
|
||||
|
||||
public boolean containsKey(Object key) {
|
||||
public boolean containsKey(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ template<class K, class T, class C = std::less< K> > class map {
|
|||
return containsImpl(($typemap(jboxtype, K))key);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) get(Object key) {
|
||||
public $typemap(jboxtype, T) get(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ template<class K, class T, class C = std::less< K> > class map {
|
|||
}
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) remove(Object key) {
|
||||
public $typemap(jboxtype, T) remove(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class set {
|
|||
|
||||
public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
|
||||
boolean didAddElement = false;
|
||||
for (Object object : collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
didAddElement |= add(($typemap(jboxtype, T))object);
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ class set {
|
|||
}
|
||||
|
||||
public boolean containsAll(java.util.Collection<?> collection) {
|
||||
for (Object object : collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
if (!contains(object)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ class set {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean contains(Object object) {
|
||||
public boolean contains(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, T))) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -115,14 +115,14 @@ class set {
|
|||
|
||||
public boolean removeAll(java.util.Collection<?> collection) {
|
||||
boolean didRemoveElement = false;
|
||||
for (Object object : collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
didRemoveElement |= remove(object);
|
||||
}
|
||||
|
||||
return didRemoveElement;
|
||||
}
|
||||
|
||||
public boolean remove(Object object) {
|
||||
public boolean remove(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, T))) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ template<class K, class T> class unordered_map {
|
|||
return sizeImpl();
|
||||
}
|
||||
|
||||
public boolean containsKey(Object key) {
|
||||
public boolean containsKey(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ template<class K, class T> class unordered_map {
|
|||
return containsImpl(($typemap(jboxtype, K))key);
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) get(Object key) {
|
||||
public $typemap(jboxtype, T) get(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ template<class K, class T> class unordered_map {
|
|||
}
|
||||
}
|
||||
|
||||
public $typemap(jboxtype, T) remove(Object key) {
|
||||
public $typemap(jboxtype, T) remove(java.lang.Object key) {
|
||||
if (!(key instanceof $typemap(jboxtype, K))) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class unordered_set {
|
|||
|
||||
public boolean addAll(java.util.Collection<? extends $typemap(jboxtype, T)> collection) {
|
||||
boolean didAddElement = false;
|
||||
for (Object object : collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
didAddElement |= add(($typemap(jboxtype, T))object);
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ class unordered_set {
|
|||
}
|
||||
|
||||
public boolean containsAll(java.util.Collection<?> collection) {
|
||||
for (Object object : collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
if (!contains(object)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ class unordered_set {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean contains(Object object) {
|
||||
public boolean contains(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, T))) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -115,14 +115,14 @@ class unordered_set {
|
|||
|
||||
public boolean removeAll(java.util.Collection<?> collection) {
|
||||
boolean didRemoveElement = false;
|
||||
for (Object object : collection) {
|
||||
for (java.lang.Object object : collection) {
|
||||
didRemoveElement |= remove(object);
|
||||
}
|
||||
|
||||
return didRemoveElement;
|
||||
}
|
||||
|
||||
public boolean remove(Object object) {
|
||||
public boolean remove(java.lang.Object object) {
|
||||
if (!(object instanceof $typemap(jboxtype, T))) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@
|
|||
#ifndef RSTRUCT_PTR
|
||||
# define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
|
||||
#endif
|
||||
#ifndef RTYPEDDATA_P
|
||||
# define RTYPEDDATA_P(x) (TYPE(x) != T_DATA)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ typedef struct {
|
|||
SWIGRUNTIME swig_ruby_owntype
|
||||
SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
|
||||
swig_ruby_owntype oldown = {0, 0};
|
||||
if (TYPE(obj) == T_DATA) {
|
||||
if (TYPE(obj) == T_DATA && !RTYPEDDATA_P(obj)) {
|
||||
oldown.datafree = RDATA(obj)->dfree;
|
||||
RDATA(obj)->dfree = own.datafree;
|
||||
}
|
||||
|
|
@ -268,7 +268,7 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
|
|||
*ptr = 0;
|
||||
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
|
||||
} else {
|
||||
if (TYPE(obj) != T_DATA) {
|
||||
if (TYPE(obj) != T_DATA || (TYPE(obj) == T_DATA && RTYPEDDATA_P(obj))) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
Data_Get_Struct(obj, void, vptr);
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ public:
|
|||
Printv(df->code,
|
||||
"argv = (CAML_VALUE *)malloc( argc * sizeof( CAML_VALUE ) );\n"
|
||||
"for( i = 0; i < argc; i++ ) {\n" " argv[i] = caml_list_nth(args,i);\n" "}\n", NIL);
|
||||
Printv(df->code, dispatch, "\n", NIL);
|
||||
Printv(df->code, dispatch, "\nfree(argv);\n", NIL);
|
||||
Node *sibl = n;
|
||||
while (Getattr(sibl, "sym:previousSibling"))
|
||||
sibl = Getattr(sibl, "sym:previousSibling");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue