Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/main.cc @ 242:23e76c5369b7 draft
dma_wait
author | e065746@localhost.localdomain |
---|---|
date | Sun, 31 May 2009 15:55:00 +0900 |
parents | e9a52d68db42 |
children | 0c9c9906d777 c1ecbfd7ae29 |
rev | line source |
---|---|
109 | 1 #include <stdlib.h> |
2 #include <string.h> | |
3 #include <SDL.h> | |
4 #include "TaskManager.h" | |
5 | |
216
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
6 /* User main function */ |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
7 extern int TMmain(int argc, char *argv[]); |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
8 |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
9 /* Default TMend function */ |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
10 static void |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
11 defaultTMend(void) {} |
109 | 12 |
13 TaskManager *manager; | |
242 | 14 static char help_str[] = "\n\ |
109 | 15 * Cerium program option *\n\ |
16 -chelp Print this message \n\ | |
17 -cpu Number of CPU (default 1) \n"; | |
18 | |
19 int | |
20 main(int argc, char *argv[]) | |
21 { | |
22 int cpuNum = 1; | |
23 | |
24 for (int i = 1; argv[i]; ++i) { | |
25 if (strcmp(argv[i], "-cpu") == 0) { | |
26 cpuNum = atoi(argv[++i]); | |
27 } | |
28 if (strcmp(argv[i], "-chelp") == 0) { | |
29 printf("%s\n", help_str); | |
30 return EXIT_SUCCESS; | |
31 } | |
32 } | |
33 | |
34 manager = new TaskManager(cpuNum); | |
35 manager->init(); | |
36 | |
216
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
37 manager->set_TMend(defaultTMend); |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
38 |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
39 if (TMmain(argc, argv) < 0) { |
109 | 40 goto FINISH; |
41 } | |
42 | |
43 manager->run(); | |
44 | |
216
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
45 (manager->tm_end)(); |
e9a52d68db42
rename cerium_main to TMmain, add TMend()
gongo@localhost.localdomain
parents:
109
diff
changeset
|
46 |
109 | 47 FINISH: |
48 delete manager; | |
49 | |
50 return EXIT_SUCCESS; | |
51 } |