summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2021-04-24 10:38:50 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2021-04-26 22:32:52 +0100
commit13158bda9a1da399d10bf0761749a2cf448d9589 (patch)
tree3f79093721117d4b02d3b82a242836ccca917621
parentabcae7c68b2ab456ae19b23a1ab969be184f4439 (diff)
downloadswig-13158bda9a1da399d10bf0761749a2cf448d9589.tar.gz
Member function pointer typemap tweaks
Use sizeof variable name rather than variable type. Workaround Visual C++ unable to parse some complex C++11 types, such as sizeof(short (Funcs::*)(bool) const &&)
-rw-r--r--Lib/chicken/chicken.swg4
-rw-r--r--Lib/guile/typemaps.i12
-rw-r--r--Lib/lua/luatypemaps.swg6
-rw-r--r--Lib/perl5/perltypemaps.swg2
-rw-r--r--Lib/typemaps/swigtype.swg14
5 files changed, 19 insertions, 19 deletions
diff --git a/Lib/chicken/chicken.swg b/Lib/chicken/chicken.swg
index 7df676754..f42fd27b9 100644
--- a/Lib/chicken/chicken.swg
+++ b/Lib/chicken/chicken.swg
@@ -258,7 +258,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
if (!SWIG_ConvertPtr(C_block_item($input,1), &result, $descriptor, 0)) {
C_word ptr = C_block_item($input,0);
if (C_swig_is_string(ptr)) {
- SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($type));
+ SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($1));
} else {
snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", $argnum, ($descriptor->str ? $descriptor->str : $descriptor->name));
SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
@@ -293,7 +293,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
if (!SWIG_ConvertPtr(C_block_item($input,1), &result, $descriptor, 0)) {
C_word ptr = C_block_item($input,0);
if (C_swig_is_string(ptr)) {
- SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($type));
+ SWIG_UnpackData(C_c_string(ptr), (void *) &$1, sizeof($1));
} else {
snprintf(err_msg, sizeof(err_msg), "Type error in argument #%i: expected %s", 1, ($descriptor->str ? $descriptor->str : $descriptor->name));
SWIG_Chicken_Barf(SWIG_BARF1_BAD_ARGUMENT_TYPE, err_msg);
diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i
index cfccced88..84a754d8b 100644
--- a/Lib/guile/typemaps.i
+++ b/Lib/guile/typemaps.i
@@ -378,26 +378,26 @@ typedef unsigned long SCM;
#define %argument_fail(code, type, name, argn) scm_wrong_type_arg((char *) FUNC_NAME, argn, $input);
#define %as_voidptr(ptr) (void*)(ptr)
-%typemap(in) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor);
+%typemap(in) SWIGTYPE (CLASS::*) {
+ int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
- %argument_fail(res,"$type",$symname, $argnum);
+ %argument_fail(res,"$type",$symname, $argnum);
}
}
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
- %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(varin) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor);
+ int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
scm_wrong_type_arg((char *) FUNC_NAME, 1, $input);
}
}
%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) {
- %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
/* ------------------------------------------------------------
diff --git a/Lib/lua/luatypemaps.swg b/Lib/lua/luatypemaps.swg
index 8959f201e..6c92e3b59 100644
--- a/Lib/lua/luatypemaps.swg
+++ b/Lib/lua/luatypemaps.swg
@@ -237,13 +237,13 @@ $1=($1_ltype)&temp;%}
// therefore a special wrapping functions SWIG_ConvertMember() & SWIG_NewMemberObj() were written
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE (CLASS::*)
%{
- if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($type),$descriptor)))
+ if (!SWIG_IsOK(SWIG_ConvertMember(L,$input,(void*)(&$1),sizeof($1),$descriptor)))
SWIG_fail_ptr("$symname",$argnum,$descriptor);
%}
%typemap(out) SWIGTYPE (CLASS::*)
-%{
- SWIG_NewMemberObj(L,(void*)(&$1),sizeof($type),$descriptor); SWIG_arg++;
+%{
+ SWIG_NewMemberObj(L,(void*)(&$1),sizeof($1),$descriptor); SWIG_arg++;
%}
diff --git a/Lib/perl5/perltypemaps.swg b/Lib/perl5/perltypemaps.swg
index bf1596e9f..bab3d7acd 100644
--- a/Lib/perl5/perltypemaps.swg
+++ b/Lib/perl5/perltypemaps.swg
@@ -95,7 +95,7 @@
"sv_setiv(SvRV($result), PTR2IV(&$1));";
%typemap(varout,type="$1_descriptor") SWIGTYPE (CLASS::*) {
- SWIG_MakePackedObj($result, (void *) &$1, sizeof($1_type), $1_descriptor);
+ SWIG_MakePackedObj($result, (void *) &$1, sizeof($1), $1_descriptor);
}
%typemap(varout) SWIGTYPE *const = SWIGTYPE *;
diff --git a/Lib/typemaps/swigtype.swg b/Lib/typemaps/swigtype.swg
index 581de1a90..402313ebf 100644
--- a/Lib/typemaps/swigtype.swg
+++ b/Lib/typemaps/swigtype.swg
@@ -562,29 +562,29 @@
* ------------------------------------------------------------ */
%typemap(in) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor);
+ int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1),$descriptor);
if (!SWIG_IsOK(res)) {
%argument_fail(res,"$type",$symname, $argnum);
}
}
%typemap(out,noblock=1) SWIGTYPE (CLASS::*) {
- %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(varin) SWIGTYPE (CLASS::*) {
- int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor);
+ int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($1), $descriptor);
if (!SWIG_IsOK(res)) {
%variable_fail(res, "$type", "$name");
}
}
%typemap(varout,noblock=1) SWIGTYPE (CLASS::*) {
- %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor));
+ %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor));
}
%typemap(constcode,noblock=1) SWIGTYPE (CLASS::*) {
- %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type), $descriptor));
+ %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($value), $descriptor));
}
#if defined(SWIG_DIRECTOR_TYPEMAPS)
@@ -592,13 +592,13 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) {
- $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor);
+ $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($1), $descriptor);
}
/* directorout */
%typemap(directorout) SWIGTYPE (CLASS::*) {
- int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor);
+ int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($result), $descriptor);
if (!SWIG_IsOK(swig_res)) {
%dirout_fail(swig_res,"$type");
}