-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
77 lines (68 loc) · 1.88 KB
/
index.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var fs = require('fs');
var javaCompiler = require('./lib/javaC');
var pythonCompiler = require('./lib/pythonC');
var cppCompiler = require('./lib/cC');
exports.stats = false;
initialize = function(option)
{
if(option)
{
if(option.stats === true)
{
console.log("Stats are selected");
exports.stats = true;
}
}
//creating a directory for compiled files
fs.exists('./temp', function(exists){
if(!exists)
{
if(exports.stats)
{
console.log("Files folder created");
}
fs.mkdirSync('./temp');
}
});
}
javaCompile = function(envData, code, fun)
{
if(exports.stats)
javaCompiler.stats = true;
javaCompiler.javaCompile(envData, code, fun);
}
compileWithInput = function(envData, code, inp, fun)
{
if(exports.stats)
javaCompiler.stats = true;
javaCompiler.compileWithInput(envData, code, inp, fun);
}
executePython = function(envData, code, fn)
{
if(exports.stats)
pythonCompiler.stats = true;
pythonCompiler.executePython(envData, code, fn);
}
executeWithInput = function(envData, code, input, fn)
{
if(exports.stats)
pythonCompiler.stats = true;
pythonCompiler.executeWithInput(envData, code, input, fn);
}
ccCompile = function ( envData , code , fn ){
if(exports.stats)
cppCompiler.stats = true;
cppCompiler.ccCompile(envData , code , fn );
}
ccCompileWithInput = function ( envData , code , input , fn ) {
if(exports.stats)
cppCompiler.stats = true;
cppCompiler.ccCompileWithInput(envData , code , input , fn );
}
exports.initialize = initialize;
exports.javaCompile = javaCompile;
exports.compileWithInput = compileWithInput;
exports.executePython = executePython;
exports.executeWithInput = executeWithInput;
exports.ccCompile = ccCompile;
exports.ccCompileWithInput = ccCompileWithInput;