From 980e21a3bf371ee8dbeb8276a5d61861e749fa7b Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 2 Jul 2022 16:12:16 +0100 Subject: [PATCH] Cosmetic changes to auto_ptr library files --- Lib/csharp/std_auto_ptr.i | 26 ++++++++++++++------------ Lib/java/std_auto_ptr.i | 28 +++++++++++++++------------- Lib/python/std_auto_ptr.i | 18 ++++++++++-------- Lib/ruby/std_auto_ptr.i | 18 ++++++++++-------- 4 files changed, 49 insertions(+), 41 deletions(-) diff --git a/Lib/csharp/std_auto_ptr.i b/Lib/csharp/std_auto_ptr.i index 1d91c9872..068d3a9d1 100644 --- a/Lib/csharp/std_auto_ptr.i +++ b/Lib/csharp/std_auto_ptr.i @@ -1,23 +1,25 @@ -/* - The typemaps here allow handling functions returning std::auto_ptr<>, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * The typemaps here allow handling functions returning std::auto_ptr<>, + * which is the most common use of this type. If you have functions taking it + * as parameter, these typemaps can't be used for them and you need to do + * something else (e.g. use shared_ptr<> which SWIG supports fully). + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (ctype) std::auto_ptr "void *" -%typemap (imtype, out="System.IntPtr") std::auto_ptr "HandleRef" -%typemap (cstype) std::auto_ptr "$typemap(cstype, TYPE)" -%typemap (out) std::auto_ptr %{ +%typemap (ctype) std::auto_ptr< TYPE > "void *" +%typemap (imtype, out="System.IntPtr") std::auto_ptr< TYPE > "HandleRef" +%typemap (cstype) std::auto_ptr< TYPE > "$typemap(cstype, TYPE)" +%typemap (out) std::auto_ptr< TYPE > %{ $result = (void *)$1.release(); %} -%typemap(csout, excode=SWIGEXCODE) std::auto_ptr { +%typemap(csout, excode=SWIGEXCODE) std::auto_ptr< TYPE > { System.IntPtr cPtr = $imcall; $typemap(cstype, TYPE) ret = (cPtr == System.IntPtr.Zero) ? null : new $typemap(cstype, TYPE)(cPtr, true);$excode return ret; } -%template() std::auto_ptr; +%template() std::auto_ptr< TYPE >; %enddef namespace std { diff --git a/Lib/java/std_auto_ptr.i b/Lib/java/std_auto_ptr.i index 69ac2841f..0eb5fe155 100644 --- a/Lib/java/std_auto_ptr.i +++ b/Lib/java/std_auto_ptr.i @@ -1,25 +1,27 @@ -/* - The typemaps here allow handling functions returning std::auto_ptr<>, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * The typemaps here allow handling functions returning std::auto_ptr<>, + * which is the most common use of this type. If you have functions taking it + * as parameter, these typemaps can't be used for them and you need to do + * something else (e.g. use shared_ptr<> which SWIG supports fully). + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (jni) std::auto_ptr "jlong" -%typemap (jtype) std::auto_ptr "long" -%typemap (jstype) std::auto_ptr "$typemap(jstype, TYPE)" +%typemap (jni) std::auto_ptr< TYPE > "jlong" +%typemap (jtype) std::auto_ptr< TYPE > "long" +%typemap (jstype) std::auto_ptr< TYPE > "$typemap(jstype, TYPE)" -%typemap (out) std::auto_ptr %{ +%typemap (out) std::auto_ptr< TYPE > %{ jlong lpp = 0; - *(TYPE**) &lpp = $1.release(); + *(TYPE **) &lpp = $1.release(); $result = lpp; %} -%typemap(javaout) std::auto_ptr { +%typemap(javaout) std::auto_ptr< TYPE > { long cPtr = $jnicall; return (cPtr == 0) ? null : new $typemap(jstype, TYPE)(cPtr, true); } -%template() std::auto_ptr; +%template() std::auto_ptr< TYPE >; %enddef namespace std { diff --git a/Lib/python/std_auto_ptr.i b/Lib/python/std_auto_ptr.i index c94006a68..fb044f851 100644 --- a/Lib/python/std_auto_ptr.i +++ b/Lib/python/std_auto_ptr.i @@ -1,15 +1,17 @@ -/* - The typemaps here allow handling functions returning std::auto_ptr<>, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * The typemaps here allow handling functions returning std::auto_ptr<>, + * which is the most common use of this type. If you have functions taking it + * as parameter, these typemaps can't be used for them and you need to do + * something else (e.g. use shared_ptr<> which SWIG supports fully). + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ +%typemap (out) std::auto_ptr< TYPE > %{ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; +%template() std::auto_ptr< TYPE >; %enddef namespace std { diff --git a/Lib/ruby/std_auto_ptr.i b/Lib/ruby/std_auto_ptr.i index eab8ec53d..ecaea2b0f 100644 --- a/Lib/ruby/std_auto_ptr.i +++ b/Lib/ruby/std_auto_ptr.i @@ -1,15 +1,17 @@ -/* - The typemaps here allow handling functions returning std::auto_ptr<>, - which is the most common use of this type. If you have functions taking it - as parameter, these typemaps can't be used for them and you need to do - something else (e.g. use shared_ptr<> which SWIG supports fully). - */ +/* ----------------------------------------------------------------------------- + * std_auto_ptr.i + * + * The typemaps here allow handling functions returning std::auto_ptr<>, + * which is the most common use of this type. If you have functions taking it + * as parameter, these typemaps can't be used for them and you need to do + * something else (e.g. use shared_ptr<> which SWIG supports fully). + * ----------------------------------------------------------------------------- */ %define %auto_ptr(TYPE) -%typemap (out) std::auto_ptr %{ +%typemap (out) std::auto_ptr< TYPE > %{ %set_output(SWIG_NewPointerObj($1.release(), $descriptor(TYPE *), SWIG_POINTER_OWN | %newpointer_flags)); %} -%template() std::auto_ptr; +%template() std::auto_ptr< TYPE >; %enddef namespace std {