From e7793fb51cd449cb68c2d52a1d1112f686d1670e Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Thu, 29 May 2003 18:27:57 +0000 Subject: [PATCH] Added setter for global arrays. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4831 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/python/python.swg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Lib/python/python.swg b/Lib/python/python.swg index 7f61ec04a..78ee93ff2 100644 --- a/Lib/python/python.swg +++ b/Lib/python/python.swg @@ -300,6 +300,18 @@ return 1; } +%typemap(varin) SWIGTYPE [ANY] { + void *temp; + int ii; + $1_basetype *b = 0; + if ((SWIG_ConvertPtr($input,(void **) &temp, $1_descriptor, SWIG_POINTER_EXCEPTION)) == -1) { + PyErr_SetString(PyExc_TypeError, "C variable '$name ($1_ltype)'"); + return 1; + } + b = ($1_basetype *) $1; + for (ii = 0; ii < $1_size; ii++) b[ii] = *(($1_basetype *) temp + ii); +} + /* Special case for string array variables */ %typemap(varin) char [ANY] { char *temp = (char *) PyString_AsString($input);