blob: 1f3a963dfb3e508dad1089d78ef18ffd998c12ce (
plain) (
blame)
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
|
#ifndef DEF_APPLICATION_PROTO_H
#define DEF_APPLICATION_PROTO_H
#include <Binding/Process.class.h>
#include <String.class.h>
extern u32int start_dtors, end_dtors;
#define APP(t) static t the_app; \
Application *app = &the_app;
class Application {
public:
Process pr;
Vector<String> args;
Application() : pr(Process::get()), args(pr.argc()) {
for (u32int i = 0; i < args.size(); i++) args[i] = pr.argv(i);
//TODO : add default signal handlers
}
virtual ~Application() {}
virtual int run() = 0; //Application's main loop
virtual void doEvents() {
//TODO : handle signals (IPC featurs to come)
}
void exit(u32int ret) {
//Call static destructors
for(u32int * call = &start_dtors; call < &end_dtors; call++) {
((void (*)(void))*call)();
}
threadFinishedSyscall(ret);
}
};
extern Application *app;
#endif
|