10 void* intArrayPtr(int num) {
12 mortal = sv_2mortal( NEWSV(0, num * sizeof(intArray)) );
17 MODULE = Language::Befunge::Vector::XS PACKAGE = Language::Befunge::Vector::XS
24 # my $vec = LB::Vector->new( $x [, $y, ...] );
26 # Create a new vector. The arguments are the actual vector data; one
27 # integer per dimension.
30 new( class, array, ... )
41 /* create the object and populate it */
43 for ( i=0; i<ix_array; i++ ) {
44 val = newSViv( array[i] );
48 /* Return a blessed reference to the AV */
49 RETVAL = newRV_noinc( (SV *)self );
50 stash = gv_stashpv( class, TRUE );
51 sv_bless( (SV *)RETVAL, stash );
58 # my $vec = Language::Befunge::Vector::XS->new_zeroes( $dims );
60 # Create a new vector, set to the origin. The only argument is the dimension of
61 # the vector to be created.
63 # ->new_zeroes(2) is exactly equivalent to ->new([0,0])
66 new_zeroes( class, dimension )
77 /* create the object and populate it */
79 for ( i=0; i<dimension; i++ ) {
84 /* return a blessed reference to the AV */
85 RETVAL = newRV_noinc( (SV *)self );
86 stash = gv_stashpv( class, TRUE );
87 sv_bless( (SV *)RETVAL, stash );
97 # my $dims = $vec->get_dims;
99 # Return the number of dimensions, an integer.
106 RETVAL = av_len(self) + 1;
112 # my $val = $vec->get_component( $index );
114 # Return the value for dimension $index.
117 get_component( self, index )
125 val = av_fetch(self, index, 0);