blob: e27cfadb50145460a04075d51d2b8ddc0e76109d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/perl
use strict;
use warnings;
my $header;
my @syms;
open FILE, "<", "/usr/include/libdrm/drm_fourcc.h" or die "open drm_fourcc.h: $!";
{ local $/; undef $/; $header = <FILE>; }
close FILE;
$header =~ s/\\\n//g;
foreach my $line (split /\n/, $header) {
next unless $line =~ m/#define\s+([a-zA-Z0-9_]+)\s+fourcc_mod_code/;
push @syms, $1;
}
open FILE, ">", "drmfmtmods.h" or die "open drmfmtmods.h: $!";
print FILE "/* generated by update-fmtmod.pl */\n";
for my $sym (@syms) {
my $name = $sym;
$name =~ s/^DRM_FORMAT_MOD_//;
printf FILE "{ .mod = %s, .name = \"%s\" },\n", $sym, $name;
}
close FILE;
|