File: build_index.pl

package info (click to toggle)
prayer 1.3.3-dfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,388 kB
  • ctags: 3,280
  • sloc: ansic: 42,985; makefile: 805; sh: 451; perl: 166
file content (46 lines) | stat: -rwxr-xr-x 756 bytes parent folder | download
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
44
45
46
#!/usr/bin/perl
#
# $Cambridge: hermes/src/prayer/templates/src/build_index.pl,v 1.3 2008/09/16 09:59:59 dpc22 Exp $

$prefix = shift(@ARGV);
$count = 0;

@templates = ();
foreach $i (@ARGV) {
  if  ($i =~ /(\S+)\.t/) {
    push(@templates, $1);
  } else {
    push(@templates, $i);
  }
  $count++;
}
@ARGV = ();
@templates = sort(@templates);

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

EOM

foreach $i (@templates) {
  print "struct template _template_${prefix}_${i};\n";
}

print <<"EOM";

struct template_map template_map_${prefix}[] = {
EOM

foreach $i (@templates) {
  print <<"EOM";
    { "${i}", &_template_${prefix}_${i} },
EOM
}

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

unsigned long template_map_${prefix}_count = ${count};
EOM