#! perl -slw
use strict;
use Inline C => Config => BUILD_NOISY => 1;
use Inline C => <<'END_C', NAME => '_1159002', CLEAN_AFTER_BUILD => 0
+;
#define IS_VARS Inline_Stack_Vars
#define IS_RESET Inline_Stack_Reset
#define IS_ITEMS Inline_Stack_Items
#define IS_ITEM( n ) Inline_Stack_Item( n )
#define IS_PUSHS( s ) Inline_Stack_Push( sv_2mortal( s ) )
#define IS_PUSHIV( iv ) Inline_Stack_Push( sv_2mortal( newSViv( iv ) )
+ )
#define IS_PUSHUV( uv ) Inline_Stack_Push( sv_2mortal( newSVuv( uv ) )
+ )
#define IS_PUSHNV( nv ) Inline_Stack_Push( sv_2mortal( newSVnv( nv ) )
+ )
#define IS_DONE Inline_Stack_Done
double do_nothing1( AV *x, int sizeOfX ) {
int index;
for( index=0; index<sizeOfX; index++ ) {
av_store( x, index, newSVnv( 1.0 ) );
}
return SvNV( *av_fetch( x, 0, NULL ) );
}
void do_nothing2( AV *a, SV *size ) {
IS_VARS;
int index;
IS_RESET;
for( index = 0; index < SvIV( size ); ++index ) {
IS_PUSHNV( 1.0 );
}
IS_DONE;
}
void do_nothing3( SV*dummy, ... ) {
IS_VARS;
int index;
for( index = 0; index < IS_ITEMS; ++index ) {
IS_ITEM( index ) = newSVnv( 1.0 );
}
return;
}
AV *do_nothing4( AV *x ) {
IS_VARS;
AV *r = newAV();
int index;
for( index = 0; index < IS_ITEMS; ++index ) {
av_push( r, newSVnv( SvNV( *av_fetch( x, index, NULL ) ) + 1.0
+ ) );
}
return r;
}
END_C
my @a = ( 0 ) x 10;
print do_nothing1( \@a, 10 );
print "@a";
my @b = ( 0 ) x 10;
print join ' ', do_nothing2( \@b, 10 );
print join ' ', do_nothing3( 1 .. 10 );
my @c = ( 1 .. 10 );
print join ' ', do_nothing4( \@c );
If you have Inline::C installed and you run the above code you'll get this output: C:\test>1159002.pl
1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
If you then look in the _inline directory tree created below the cwd where you run this, and look for the file _Inline/build/_1159002/_1159002.xs you'll see how it all fits together:
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
In the absence of evidence, opinion is indistinguishable from prejudice.
|