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        while (<FH>) {
19            s/\"/\\\"/g;
20            chomp();
21            print FILE "  \"",$_,"\\n\" \\\n";
22        }
23    }
24    print FILE "\n"
25}
26print FILE "#endif //PROXY_TEST_SCRIPT_H_\n";
27close(FILE);
28