1#!/usr/bin/perl
2
3print "Reading from $ARGV[0]\nWriting to $ARGV[1]\n";
4open(LS, "ls $ARGV[0]|");
5open(FILE, "> $ARGV[1]");
6print FILE "// This file is auto generated using the following command.\n";
7print FILE "// Do not modify.\n";
8print FILE "// \t./jstocstring.pl $ARGV[0] $ARGV[1]\n";
9print FILE "#ifndef PROXY_TEST_SCRIPT_H_\n";
10print FILE "#define PROXY_TEST_SCRIPT_H_\n\n";
11
12while (<LS>) {
13    chomp();
14    open(FH, "cat $ARGV[0]/$_|");
15    if (s/\.js/_JS/) {
16        $upper = uc();
17        print FILE "#define $upper \\\n";
18        print FILE "  u\"\"\\\n";
19        while (<FH>) {
20            s/\"/\\\"/g;
21            chomp();
22            print FILE "  \"",$_,"\\n\" \\\n";
23        }
24    }
25    print FILE "\n"
26}
27print FILE "#endif //PROXY_TEST_SCRIPT_H_\n";
28close(FILE);
29