Browse Source

Add NOI Linux C / C++ compilers

master
Menci 6 years ago
parent
commit
ddf1c4f830
  1. 48
      src/languages/c-noilinux.ts
  2. 48
      src/languages/cpp-noilinux.ts
  3. 48
      src/languages/cpp11-noilinux.ts
  4. 5
      src/languages/index.ts
  5. 2
      src/languages/java.ts

48
src/languages/c-noilinux.ts

@ -0,0 +1,48 @@
export const lang = {
name: "c-noilinux",
sourceFileName: "a.c",
fileExtension: "c",
binarySizeLimit: 5000 * 1024,
// Note that these two paths are in the sandboxed environment.
compile: (sourcePath, outputDirectory) => ({
// To customize the compilation process,
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/compile-c-noilinux",
parameters: ["compile-c-noilinux", sourcePath, "-o", `${outputDirectory}/a.out`, "-O2", "-DONLINE_JUDGE"],
time: 5000,
memory: 1024 * 1024 * 1024 * 2,
process: 10,
// This is just a redirection. You can simply ignore this
// if you can specify custom location for message output
// in the parameter of the compiler, or have redirected the compilation
// message to somewhere.
// An example will be available soon.
stdout: `${outputDirectory}/message.txt`,
stderr: `${outputDirectory}/message.txt`,
// We will read this file for message in the output directory.
messageFile: 'message.txt',
workingDirectory: outputDirectory
}),
run: (binaryDirectory: string,
workingDirectory: string,
time: number,
memory: number,
stdinFile = null,
stdoutFile = null,
stderrFile = null
) => ({
executable: `${binaryDirectory}/a.out`,
parameters: [],
time: time,
memory: memory,
stackSize: memory,
process: 1,
stdin: stdinFile,
stdout: stdoutFile,
stderr: stderrFile,
workingDirectory: workingDirectory
})
};

48
src/languages/cpp-noilinux.ts

@ -0,0 +1,48 @@
export const lang = {
name: "cpp-noilinux",
sourceFileName: "a.cpp",
fileExtension: "cpp",
binarySizeLimit: 5000 * 1024,
// Note that these two paths are in the sandboxed environment.
compile: (sourcePath, outputDirectory) => ({
// To customize the compilation process,
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/compile-cpp-noilinux",
parameters: ["compile-cpp-noilinux", sourcePath, "-o", `${outputDirectory}/a.out`, "-O2", "-DONLINE_JUDGE"],
time: 5000,
memory: 1024 * 1024 * 1024 * 2,
process: 10,
// This is just a redirection. You can simply ignore this
// if you can specify custom location for message output
// in the parameter of the compiler, or have redirected the compilation
// message to somewhere.
// An example will be available soon.
stdout: `${outputDirectory}/message.txt`,
stderr: `${outputDirectory}/message.txt`,
// We will read this file for message in the output directory.
messageFile: 'message.txt',
workingDirectory: outputDirectory
}),
run: (binaryDirectory: string,
workingDirectory: string,
time: number,
memory: number,
stdinFile = null,
stdoutFile = null,
stderrFile = null
) => ({
executable: `${binaryDirectory}/a.out`,
parameters: [],
time: time,
memory: memory,
stackSize: memory,
process: 1,
stdin: stdinFile,
stdout: stdoutFile,
stderr: stderrFile,
workingDirectory: workingDirectory
})
};

48
src/languages/cpp11-noilinux.ts

@ -0,0 +1,48 @@
export const lang = {
name: "cpp11-noilinux",
sourceFileName: "a.cpp",
fileExtension: "cpp",
binarySizeLimit: 5000 * 1024,
// Note that these two paths are in the sandboxed environment.
compile: (sourcePath, outputDirectory) => ({
// To customize the compilation process,
// write a shell script or some other stuff,
// and put it to your sandbox.
executable: "/usr/bin/compile-cpp-noilinux",
parameters: ["compile-cpp-noilinux", "-std=c++11", sourcePath, "-o", `${outputDirectory}/a.out`, "-O2", "-DONLINE_JUDGE"],
time: 5000,
memory: 1024 * 1024 * 1024 * 2,
process: 10,
// This is just a redirection. You can simply ignore this
// if you can specify custom location for message output
// in the parameter of the compiler, or have redirected the compilation
// message to somewhere.
// An example will be available soon.
stdout: `${outputDirectory}/message.txt`,
stderr: `${outputDirectory}/message.txt`,
// We will read this file for message in the output directory.
messageFile: 'message.txt',
workingDirectory: outputDirectory
}),
run: (binaryDirectory: string,
workingDirectory: string,
time: number,
memory: number,
stdinFile = null,
stdoutFile = null,
stderrFile = null
) => ({
executable: `${binaryDirectory}/a.out`,
parameters: [],
time: time,
memory: memory,
stackSize: memory,
process: 1,
stdin: stdinFile,
stdout: stdoutFile,
stderr: stderrFile,
workingDirectory: workingDirectory
})
};

5
src/languages/index.ts

@ -29,12 +29,15 @@ export interface Language {
} }
export const languages: Language[] = [ export const languages: Language[] = [
require('./c'),
require('./cpp'), require('./cpp'),
require('./cpp11'), require('./cpp11'),
require('./cpp17'), require('./cpp17'),
require('./cpp-noilinux'),
require('./cpp11-noilinux'),
require('./cpp11-clang'), require('./cpp11-clang'),
require('./cpp17-clang'), require('./cpp17-clang'),
require('./c'),
require('./c-noilinux'),
require('./csharp'), require('./csharp'),
require('./haskell'), require('./haskell'),
require('./java'), require('./java'),

2
src/languages/java.ts

@ -13,7 +13,7 @@ export const lang = {
parameters: ["compile-java", sourcePath, outputDirectory], parameters: ["compile-java", sourcePath, outputDirectory],
time: 5000, time: 5000,
memory: 1024 * 1024 * 1024 * 2, memory: 1024 * 1024 * 1024 * 2,
process: 20, process: 30,
// This is just a redirection. You can simply ignore this // This is just a redirection. You can simply ignore this
// if you can specify custom location for message output // if you can specify custom location for message output
// in the parameter of the compiler, or have redirected the compilation // in the parameter of the compiler, or have redirected the compilation

Loading…
Cancel
Save