From 93502eae94c01d727228b16c3db8dd95ede58b03 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Quelin?= Date: Tue, 15 Jan 2008 19:03:53 +0100 Subject: [PATCH] LBVXS::clear() moved to xs --- XS.xs | 22 +++++++++++++++++++++- lib/Language/Befunge/Vector/XS.pm | 1 - 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/XS.xs b/XS.xs index 36b9a82..a2e5acc 100644 --- a/XS.xs +++ b/XS.xs @@ -200,12 +200,32 @@ get_all_components( self ) EXTEND(SP,dim+1); for ( i=0; i<=dim; i++ ) { val = SvIV( *av_fetch(my_array, i, 0) ); - printf("%d\n",val); PUSHs( sv_2mortal( newSViv(val) ) ); } #- mutators + +# +# $vec->clear; +# +# Set the vector back to the origin, all 0's. +# +void +clear( self ) + SV* self + INIT: + IV dim, i, zero; + AV* my_array; + PPCODE: + /* fetch the underlying array of the object */ + my_array = (AV*)SvRV(self); + dim = av_len(my_array); + for ( i=0; i