forked from roba269/wai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompiler.h
More file actions
34 lines (31 loc) · 746 Bytes
/
compiler.h
File metadata and controls
34 lines (31 loc) · 746 Bytes
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
#ifndef COMPILER_H
#define COMPILER_H
#include <unistd.h>
#include <cstring>
class Compiler {
public:
static void InitInstance(const char *prefix) {
s_comp = new Compiler;
strcpy(m_prefix, prefix);
// TODO: change to multi-threaded
if (fork() == 0) {
while (1) {
sleep(1); // sleep 1 second
PickSource();
}
}
}
static Compiler *GetInstance() {
return s_comp;
}
static void DestoryInstance() {
delete s_comp;
}
private:
static int PickSource();
static int do_compile_cpp(int src_id);
static int do_compile_java(int src_id);
static Compiler *s_comp;
static char m_prefix[128];
};
#endif