#!/usr/bin/perl
#
# $Cambridge: hermes/src/prayer/templates/src/build_map_index.pl,v 1.3 2010/07/26 13:02:51 dpc22 Exp $

@list=@ARGV;
@ARGV=();

print << "EOM";
#include "misc.h"
#include "template_structs.h"

EOM

foreach $name (@list) {
print << "EOM";
extern struct template_map template_map_${name}[];
extern unsigned long template_map_${name}_count;
EOM
}

print << "EOM";

struct template_map_index template_map_index[] = {
EOM

foreach $name (@list) {
  print << "EOM";
  { "$name",  &template_map_${name}[0], &template_map_${name}_count },
EOM
}

print << "EOM";
  { NIL, NIL, NIL }
};
EOM
