Fix overloading for non-pointers and NULL - Guile

This commit is contained in:
William S Fulton 2018-12-30 09:26:33 +00:00
commit eb151e43be
4 changed files with 63 additions and 3 deletions

View file

@ -8,6 +8,7 @@
#define SWIGGUILE_SCM
%runtime "swigrun.swg" // Common C API type-checking code
%runtime "swigerrors.swg" // SWIG errors
%runtime "guile_scm_run.swg"
%include <guile.i>

View file

@ -186,7 +186,7 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
if (SCM_NULLP(smob)) {
*result = NULL;
return SWIG_OK;
return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
#if SCM_MAJOR_VERSION >= 2
} else if (SCM_POINTER_P(s)) {
*result = SCM_POINTER_VALUE(s);

View file

@ -444,15 +444,21 @@ typedef unsigned long SCM;
$1 = scm_is_string($input) ? 1 : 0;
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE [] {
void *ptr;
int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, 0);
$1 = SWIG_CheckState(res);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE &, SWIGTYPE && {
void *ptr;
int res = SWIG_ConvertPtr($input, &ptr, $1_descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
void *ptr;
int res = SWIG_ConvertPtr($input, &ptr, $&descriptor, 0);
int res = SWIG_ConvertPtr($input, &ptr, $&descriptor, SWIG_POINTER_NO_NULL);
$1 = SWIG_CheckState(res);
}