#! /usr/bin/perl -w

die "Usage: $0 MACRONAME\n" if @ARGV != 1;

$firstline = 1;
$chars = 0;
print "/* Do not edit - automaticly generated by $0 */\n";
print "\n";

print "#define ", uc $ARGV[0], " ( \\\n";

while (<STDIN>) {
  chomp;
  s/^(\s*)//;
  $pad = $1;
  $chars += length $_;
  s/(["\\])/\\$1/g;
  print " \\\n" if !$firstline;
  $firstline = 0;
  print '    ', $pad, '"', $_, '"';
}

print ")\n";
print "#define ", uc $ARGV[0], '_LEN ', $chars, "\n";
