Debian Codegraph @

maint/generate-record-accessor

raw
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5 use autodie;
6 use Template;
7
8 my $tt2 = Template->new(
9 INCLUDE_PATH => 'maint/tt',
10 );
11
12 my @list = map {
13 (
14 { ffi_type => "uint$_", c_type => "uint${_}_t", perl_type => "UV", zero => "0" },
15 { ffi_type => "sint$_", c_type => "int${_}_t", perl_type => "IV", zero => "0" },
16 )
17 } (8,16,32,64);
18
19 push @list, map { { ffi_type => $_, c_type => $_, perl_type => "NV", zero => "0.0" } } qw( float double );
20
21 my $content = '';
22
23 foreach my $config (@list)
24 {
25 $tt2->process("accessor.tt", $config, \$content) || die $tt2->error;
26 }
27
28 open my $fh, '>', 'xs/record_simple.c';
29 $tt2->process("accessor_wrapper.tt", { content => $content }, $fh);
30 close $fh;