From 074a88fd377b632cabde165ce17fbd918de6f2d4 Mon Sep 17 00:00:00 2001 From: Marcelo Matus Date: Wed, 31 Mar 2004 03:36:59 +0000 Subject: [PATCH] added compiler case without unnamed template param. support git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5808 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/swig.swg | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/SWIG/Lib/swig.swg b/SWIG/Lib/swig.swg index fa69da10f..e376cbf07 100644 --- a/SWIG/Lib/swig.swg +++ b/SWIG/Lib/swig.swg @@ -403,19 +403,35 @@ static int NAME(TYPE x) { %enddef -/* Auxiliary methods for assigning unnamed type C++ variables, where +/* + Auxiliary methods for assigning unnamed type C++ variables, where swig doesn't know the casting type, but C++ can derived it: struct Foo { enum {Hi, Hello } hola; }; + + Activate the following for compilers that do not support unnamed + template parameters (under your own risk). + + #define SWIG_UNNAMED_USE_MEMCPY */ %insert("runtime") %{ #ifdef __cplusplus +/* here, the C++ compilers that do not accept unnamed template parameters */ +#if defined(_SGI_COMPILER_VERSION) +#ifdef SWIG_UNNAMED_USE_MEMCPY +/* dangerous assigment, but for enums could work */ +#define swig_assign_unnamed(eval, val) memcpy(&(eval),&(val), sizeof(eval)) +#else +#define swig_assign_unnamed(eval, val) printf("unnamed member assigment not sopperted") +#endif +#else template inline void swig_assign_unnamed(T& eval, const V& val) { eval = static_cast(val); } +#endif #else #define swig_assign_unnamed(eval, val) eval = val #endif