GCC-Builtins
view release on metacpan or search on metacpan
sbin/build-gcc-builtins-package.pl view on Meta::CPAN
# and done
$funcs{ $func{'name'} } = \%func;
}
# Inside the .pm output we have 2 lists to add: exported subs
# and pod of each of this exported sub
my $list_of_sub_names = "";
my $list_of_exported_subs = "";
my $exported_subs_descriptions = "";
# you can use $afuncdata->{'xs-signature-without-identifiers'} to have identifiers included
for my $afuncname (sort keys %funcs){
my $afuncdata = $funcs{$afuncname};
$list_of_sub_names .= $afuncdata->{'xs-name'}.' ';
$list_of_exported_subs .= '=item * C<'.$afuncdata->{'xs-signature-without-identifiers'}.">\n\n";
$exported_subs_descriptions .=<<EOP;
=head2 C<$afuncdata->{'xs-signature-without-identifiers'}>
$afuncdata->{'description'}
EOP
}
######################################################
################## Write test files ##################
my $tidx = 666;
for($tidx..999){
my $tfile = File::Spec->catfile($TDIR, $_.'-*.t');
my @files = glob($tfile);
unlink @files;
}
for my $afuncname (sort keys %funcs){
my $afuncdata = $funcs{$afuncname};
my $tfile = File::Spec->catfile($TDIR, $tidx++.'-'.$afuncdata->{'xs-name'}.'.t');
if( ! open($FH, '>', $tfile) ){ die "error, failed to open output XS file '$tfile' for writing: $!" }
my $tcon = $T_CONTENTS;
$tcon =~ s/<%\s*test_func_run\s*%>/$afuncdata->{'test_func_run'}/;
$tcon =~ s/<%\s*test_func_is_ok\s*%>/$afuncdata->{'test_func_is_ok'}/;
print $FH $tcon;
close $FH;
print "$0 : done, test file written to '$tfile'.\n";
}
######################################################
################## Write .pm file ####################
$PM_CONTENTS =~ s/^package\s*GCC::Builtins;.+?\n/package GCC::Builtins;\n/s;
$PM_CONTENTS =~ s/<%\s*list_of_sub_names\s*%>/${list_of_sub_names}/;
$PM_CONTENTS =~ s/<%\s*list_of_exported_subs\s*%>/${list_of_exported_subs}/;
sbin/build-gcc-builtins-package.pl view on Meta::CPAN
open($FH, '>', $PM_outfile) or die "error, failed to open output file '$TYPEMAP_outfile' for writing: $!";
print $FH $PM_CONTENTS;
close $FH;
print "$0 : done, perl module and pod written to '$PM_outfile'.\n";
######################################################
################## Write XS output ###################
if( ! open($FH, '>', $XS_outfile) ){ die "error, failed to open output XS file '$XS_outfile' for writing: $!" }
print $FH $XS_CONTENTS;
for my $afuncname (sort keys %funcs){
my $afuncdata = $funcs{$afuncname};
print $FH "\n".$afuncdata->{'xs-code'}."\n"
}
close $FH;
print "$0 : done, ".scalar(keys %funcs)." builtin functions written to '$XS_outfile'.\n";
######################################################
################## Write TYPEMAP file ################
# write the typemap, we assume that uintYYY_t types are not typemap'ed yet
open($FH, '>', $TYPEMAP_outfile) or die "error, failed to open output file '$TYPEMAP_outfile' for writing: $!";
print $FH <<'EOT';
#########################################################################
( run in 0.232 second using v1.01-cache-2.11-cpan-454fe037f31 )