aboutsummaryrefslogtreecommitdiff
path: root/test/jstocstring.pl
blob: 7b50772d1c9d73054fc1b0ef4260d98a9e2752b1 (plain)
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
#!/usr/bin/perl

print "Reading from $ARGV[0]\nWriting to $ARGV[1]\n";
open(LS, "ls $ARGV[0]|");
open(FILE, "> $ARGV[1]");
print FILE "// This file is auto generated using the following command.\n";
print FILE "// Do not modify.\n";
print FILE "// \t./jstocstring.pl $ARGV[0] $ARGV[1]\n";
print FILE "#ifndef PROXY_TEST_SCRIPT_H_\n";
print FILE "#define PROXY_TEST_SCRIPT_H_\n\n";

while (<LS>) {
    chomp();
    open(FH, "cat $ARGV[0]/$_|");
    if (s/\.js/_JS/) {
        $upper = uc();
        print FILE "#define $upper \\\n";
        while (<FH>) {
            s/\"/\\\"/g;
            chomp();
            print FILE "  \"",$_,"\\n\" \\\n";
        }
    }
    print FILE "\n"
}
print FILE "#endif //PROXY_TEST_SCRIPT_H_\n";
close(FILE);