Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/utils/platforms/v8cgi/bootstrap.js
blob: d4b30987e15a7993826a9aeeef834ee9d08d48b9 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(function (evalGlobal) {

    var prefix = ".";

    var isFile = function (path) {
        return new File(path).exists();
    };

    var read = function(path) {
        var result = "",
            f = new File(path);
        try {
            if (!f.exists())
                throw new Error();
                
            f.open("r");
            result = f.read();
            
        } finally {
            f.close();
        }
        return result;
    };
    
    eval(read(prefix + "/narwhal.js"))({
        global: this,
        evalGlobal: evalGlobal,
        platform: 'v8cgi',
        platforms: ['v8cgi', 'v8', 'c', 'default'],
        debug: false,
        print: print,
        fs: {
            read: read,
            isFile: isFile
        },
        prefix: prefix
    });

}).call(this, function () {
    return eval(arguments[0]);
});