From 8564ddabf02875b7c5bf40caff5d1b1c1ba30352 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Thu, 7 Aug 2003 16:16:00 +0000 Subject: [PATCH] Improvements to array handling. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4979 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Lib/perl5/perl5.swg | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Lib/perl5/perl5.swg b/Lib/perl5/perl5.swg index 239cb1018..0c56ce9cd 100644 --- a/Lib/perl5/perl5.swg +++ b/Lib/perl5/perl5.swg @@ -232,6 +232,16 @@ } } +%typemap(varin) SWIGTYPE [ANY] { + int i; + $1_basetype *temp; + $1_basetype *b = ($1_basetype *) $1; + if (SWIG_ConvertPtr($input, (void **) &temp, $1_descriptor,0) < 0) { + croak("Type error in argument $argnum of $symname. Expected $1_mangle"); + } + for (i = 0; i < $1_size; i++) b[i] = temp[i]; +} + %typemap(varin) SWIGTYPE & { void *temp; if (SWIG_ConvertPtr($input, (void **) &temp, $1_descriptor,0) < 0) { @@ -325,6 +335,9 @@ %typemap(varin) char [ANY] "strncpy($1, (char *) SvPV(sv,PL_na), $1_dim0);"; +%typemap(varin,warning="462: Unable to set variable of type char []") char [] + { croak("Variable $symname is read-only."); } + %typemap(varin) enum SWIGTYPE "$1 = ($1_type) SvIV($input);";