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 &&)
This commit is contained in:
parent
abcae7c68b
commit
13158bda9a
5 changed files with 19 additions and 19 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
%}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 *;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue