Merge branch 'master' into gsoc2017-php7-classes-via-c-api

This commit is contained in:
Olly Betts 2021-05-03 16:17:02 +12:00
commit c87047fd39
50 changed files with 271 additions and 325 deletions

View file

@ -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);

View file

@ -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));
}
/* ------------------------------------------------------------

View file

@ -28,7 +28,7 @@
}
%typemap(javaout) CTYPE *const& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : ($javainterfacename)new $javaclassname(cPtr, $owner);
return (cPtr == 0) ? null : ($*javainterfacename)new $*javaclassname(cPtr, $owner);
}
%typemap(javadirectorin) CTYPE "($&javainterfacename)new $&javaclassname($jniinput, true)"

View file

@ -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++;
%}

View file

@ -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 *;

View file

@ -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");
}