Merge branch 'imfunc'

* imfunc:
  Add special variable imfuncname expansion for C# and D
  Test and document imfuncname special variable expansion
  Update docs.
  Also expose  in proxyClassFunctionHandler
  Expose  to javaout typemaps.

Conflicts:
	CHANGES.current
This commit is contained in:
William S Fulton 2022-05-30 19:45:28 +01:00
commit 34c219b5f7
11 changed files with 117 additions and 0 deletions

View file

@ -107,6 +107,22 @@ public class TestThread {
Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message);
Failed = true;
}
// $imfuncname substitution
ProxyA pa = new ProxyA();
if (pa.imfuncname_test() != 123)
throw new ApplicationException("imfuncname_test is not 123");
if (ProxyA.imfuncname_static_test() != 234)
throw new ApplicationException("imfuncname_test is not 234");
if (csharp_typemaps.imfuncname_global_test() != 345)
throw new ApplicationException("imfuncname_test is not 345");
pa.variab = 1000;
if (pa.variab != 1000 + 111 + 222)
throw new ApplicationException("pa.variab is not 1333");
csharp_typemaps.global_variab = 1000;
if (csharp_typemaps.global_variab != 1000 + 333 + 444)
throw new ApplicationException("csharp_typemaps.variab is not 1777");
}
}

View file

@ -136,3 +136,42 @@ namespace Glob {
bool MVar::svar = false;
%}
// $imfuncname substitution
%typemap(csout) int imfuncname_test {
return $modulePINVOKE.$imfuncname(swigCPtr) + 123;
}
%typemap(csout) int imfuncname_static_test {
return $modulePINVOKE.$imfuncname() + 234;
}
%typemap(csout) int imfuncname_global_test {
return $modulePINVOKE.$imfuncname() + 345;
}
%typemap(csvarout, excode=SWIGEXCODE2) int variab %{
get {
int ret = $modulePINVOKE.$imfuncname(swigCPtr) + 222;$excode
return ret;
} %}
%typemap(csvarin, excode=SWIGEXCODE2) int variab %{
set {
$modulePINVOKE.$imfuncname(swigCPtr, value + 111);$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) int global_variab %{
get {
int ret = $modulePINVOKE.$imfuncname() + 333;$excode
return ret;
} %}
%typemap(csvarin, excode=SWIGEXCODE2) int global_variab %{
set {
$modulePINVOKE.$imfuncname(value + 444);$excode
} %}
%inline %{
struct ProxyA {
int imfuncname_test() { return 0; }
static int imfuncname_static_test() { return 0; }
int variab;
};
int imfuncname_global_test() { return 0; }
int global_variab;
%}

View file

@ -76,6 +76,15 @@ public class java_typemaps_proxy_runme {
java_typemaps_proxyJNI.Without_member_method(nullPtr, nullPtr);
java_typemaps_proxyJNI.delete_Without(nullPtr);
java_typemaps_proxyJNI.global_method_without(nullPtr);
// $imfuncname substitution
ProxyA pa = new ProxyA();
if (pa.imfuncname_test() != 123)
throw new RuntimeException("imfuncname_test is not 123");
if (ProxyA.imfuncname_static_test() != 234)
throw new RuntimeException("imfuncname_test is not 234");
if (java_typemaps_proxy.imfuncname_global_test() != 345)
throw new RuntimeException("imfuncname_test is not 345");
}
}

View file

@ -125,3 +125,20 @@ void global_method_constwithout(const ConstWithout *p) {}
%}
// $imfuncname substitution
%typemap(javaout) int imfuncname_test {
return $moduleJNI.$imfuncname(swigCPtr, this) + 123;
}
%typemap(javaout) int imfuncname_static_test {
return $moduleJNI.$imfuncname() + 234;
}
%typemap(javaout) int imfuncname_global_test {
return $moduleJNI.$imfuncname() + 345;
}
%inline %{
struct ProxyA {
int imfuncname_test() { return 0; }
static int imfuncname_static_test() { return 0; }
};
int imfuncname_global_test() { return 0; }
%}