Add rvalue reference typemaps
This commit is contained in:
parent
341a5366dd
commit
8bdfcda66e
2 changed files with 37 additions and 1 deletions
|
|
@ -129,7 +129,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
void *ptr;
|
||||
$1 = !caml_ptr_val_internal($input, &ptr,$descriptor);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,21 @@
|
|||
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
|
||||
}
|
||||
|
||||
%typemap(in) SWIGTYPE && {
|
||||
/* %typemap(in) SWIGTYPE && */
|
||||
$1 = ($ltype) caml_ptr_val($input,$1_descriptor);
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE & {
|
||||
/* %typemap(varin) SWIGTYPE & */
|
||||
$1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
|
||||
}
|
||||
|
||||
%typemap(varin) SWIGTYPE && {
|
||||
/* %typemap(varin) SWIGTYPE && */
|
||||
$1 = *(($ltype) caml_ptr_val($input,$1_descriptor));
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE & {
|
||||
/* %typemap(out) SWIGTYPE & */
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
|
|
@ -49,6 +59,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(out) SWIGTYPE && {
|
||||
/* %typemap(out) SWIGTYPE && */
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
if( fromval ) {
|
||||
$result = callback(*fromval,caml_val_ptr((void *) &$1,$1_descriptor));
|
||||
} else {
|
||||
$result = caml_val_ptr ((void *) &$1,$1_descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
%typemap(argout) SWIGTYPE & {
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
|
|
@ -63,9 +83,23 @@
|
|||
caml_val_ptr ((void *) $1,$1_descriptor));
|
||||
}
|
||||
}
|
||||
%typemap(argout) SWIGTYPE && {
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
if( fromval ) {
|
||||
swig_result =
|
||||
caml_list_append(swig_result,
|
||||
callback(*fromval,caml_val_ptr((void *) $1,
|
||||
$1_descriptor)));
|
||||
} else {
|
||||
swig_result =
|
||||
caml_list_append(swig_result,
|
||||
caml_val_ptr ((void *) $1,$1_descriptor));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
%typemap(argout) const SWIGTYPE & { }
|
||||
%typemap(argout) const SWIGTYPE && { }
|
||||
|
||||
%typemap(in) SWIGTYPE {
|
||||
$1 = *(($&1_ltype) caml_ptr_val($input,$&1_descriptor)) ;
|
||||
|
|
@ -101,6 +135,7 @@
|
|||
}
|
||||
|
||||
%apply SWIGTYPE { const SWIGTYPE & };
|
||||
%apply SWIGTYPE { const SWIGTYPE && };
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -318,6 +353,7 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
|
|||
|
||||
/* Array reference typemaps */
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&)[ANY]) }
|
||||
|
||||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue