aboutsummaryrefslogtreecommitdiff
path: root/src/util/makemetablob.pl
blob: f1349b2cc4e8f474c1a894734693918878ce47ac (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/perl -w

use strict;
  
print <<EOF;
/* This is an auto-generated file -- do not edit */

\#include <stddef.h>

struct datainfo
{
  unsigned char const * data;
  size_t length;
  struct datainfo const * next;
};

struct sourceinfo
{
  struct datainfo const * first;
  char const * arrangement;
  char const * thorn;
};

EOF

for (my $count = 0; $count <= $#ARGV; ++ $count)
{
    printf "extern struct sourceinfo cactus_source_%s;\n", $ARGV[$count];
}
printf "\n";
printf "struct sourceinfo const * const cactus_source [] = {";
for (my $count = 0; $count <= $#ARGV; ++ $count)
{
    if ($count != 0)
    {
        printf ",";
    }
    printf "\n";
    printf "  & cactus_source_%s", $ARGV[$count];
}
printf "\n";
printf "};\n";
printf "size_t const cactus_source_length = %d;\n", $#ARGV + 1;