#!/usr/bin/perl

sub beg_arr {
  "\n const char *$_[0] [] = {\n"
}
sub end_arr {
  ($i++)?"  0\n};\n":""
}

while(<>) {
  chop;
  if (s/^\$\$\(([a-zA-Z0-9]+)\)[ 	]*$/ &end_arr(). &beg_arr($1)/ge)
    {
      print;
      next;
    }
  s/\\/\\\\/g;
  s/"/\\"/g;
  s/.*/  "$&",\n/;
  print;
}
print &end_arr();

