Add the optimal attribute to the out typemap for more optimal code generation when returning objects by value
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10450 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ed0e1c7d90
commit
336b50b43d
39 changed files with 726 additions and 833 deletions
|
|
@ -137,12 +137,13 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
|
|||
%typemap(lispclass) double "cl:double-float";
|
||||
%typemap(lispclass) char * "cl:string";
|
||||
|
||||
%typemap(out) void "";
|
||||
%typemap(out) bool "$result = (int)$1;";
|
||||
%typemap(out) char, unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
float, double, long double, char *, void *,
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$result = $1;";
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -80,12 +80,13 @@
|
|||
SWIGTYPE[ANY], SWIGTYPE & "$1 = $input;";
|
||||
%typemap(in) SWIGTYPE "$1 = *$input;";
|
||||
|
||||
%typemap(out) void "";
|
||||
%typemap(out) bool "$result = (int)$1;";
|
||||
%typemap(out) char, unsigned char, signed char,
|
||||
short, signed short, unsigned short,
|
||||
int, signed int, unsigned int,
|
||||
long, signed long, unsigned long,
|
||||
float, double, long double, char *, void *, void,
|
||||
float, double, long double, char *, void *
|
||||
enum SWIGTYPE, SWIGTYPE *,
|
||||
SWIGTYPE[ANY], SWIGTYPE & "$result = $1;";
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
{
|
||||
$&1_ltype resultptr;
|
||||
C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
|
||||
resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
resultptr = new $1_ltype((const $1_ltype &) $1);
|
||||
$result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 1);
|
||||
}
|
||||
#else
|
||||
|
|
@ -348,7 +348,7 @@ SIMPLE_TYPEMAP(double, C_c_double, C_flonum, C_swig_is_number, (double), C_SIZEO
|
|||
{
|
||||
$&1_ltype resultptr;
|
||||
C_word *known_space = C_alloc(C_SIZEOF_SWIG_POINTER);
|
||||
resultptr = new $1_ltype(($1_ltype&) $1);
|
||||
resultptr = new $1_ltype((const $1_ltype&) $1);
|
||||
$result = SWIG_NewPointerObj(resultptr, $&1_descriptor, 0);
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
|||
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
%{ $result = new $1_ltype(($1_ltype &)$1); %}
|
||||
%{ $result = new $1_ltype((const $1_ltype &)$1); %}
|
||||
#else
|
||||
{
|
||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@
|
|||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
resultptr = new $1_ltype((const $1_ltype &) $1);
|
||||
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 1);
|
||||
}
|
||||
#else
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = new $1_ltype(($1_ltype&) $1);
|
||||
resultptr = new $1_ltype((const $1_ltype&) $1);
|
||||
$result = SWIG_NewPointerObj (resultptr, $&1_descriptor, 0);
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@
|
|||
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
%{ *($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
|
||||
%{ *($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %}
|
||||
#else
|
||||
{
|
||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ $1=&temp;%}
|
|||
#ifdef __cplusplus
|
||||
%typemap(out) SWIGTYPE
|
||||
{
|
||||
$&1_ltype resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
$&1_ltype resultptr = new $1_ltype((const $1_ltype &) $1);
|
||||
SWIG_NewPointerObj(L,(void *) resultptr,$&1_descriptor,1); SWIG_arg++;
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ $1 = &temp; %}
|
|||
$1 = *argp; %}
|
||||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
%{*($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
|
||||
%{*($&1_ltype*)&$result = new $1_ltype((const $1_ltype &)$1); %}
|
||||
#else
|
||||
{
|
||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
|
||||
%typemap(out) SWIGTYPE {
|
||||
/* %typemap(out) SWIGTYPE */
|
||||
$&1_ltype temp = new $ltype(($1_ltype &) $1);
|
||||
$&1_ltype temp = new $ltype((const $1_ltype &) $1);
|
||||
CAML_VALUE *fromval = caml_named_value("create_$ntype_from_ptr");
|
||||
if( fromval ) {
|
||||
$result = callback(*fromval,caml_val_ptr((void *)temp,$&1_descriptor));
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@
|
|||
%typemap(out) SWIGTYPE
|
||||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultobj = new $1_ltype(($1_ltype &) $1);
|
||||
$&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1);
|
||||
SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ extern "C" {
|
|||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultptr;
|
||||
resultptr = new $1_ltype(($1_ltype &) $1);
|
||||
resultptr = new $1_ltype((const $1_ltype &) $1);
|
||||
push_object(SWIG_NewPointerObj((void *) resultptr, $&1_descriptor, 1));
|
||||
}
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue