Mercurial > hg > Game > Cerium
view TaskManager/kernel/main.cc @ 391:492e60453124 draft
fix...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 07 Aug 2009 02:24:06 +0900 |
parents | f22280772f20 |
children | ce86b0186a4a |
line wrap: on
line source
#include <stdlib.h> #include <string.h> #include <SDL.h> #include "TaskManager.h" /*! User が書いた TMmain() (*名前は固定) を実行する */ /* User main function */ extern int TMmain(int argc, char *argv[]); /* Default TMend function */ static void defaultTMend(void) {} TaskManager *manager; /*! const char *usr_help_str を User 側で指定する必要がある -help で出力される文字列 */ const char *help_str = "\n\ * Cerium program option *\n\ -help Print this message \n\ -cpu Number of CPU (default 1) \n"; extern const char *usr_help_str; int main(int argc, char *argv[]) { int machineNum = 1; for (int i = 1; argv[i]; ++i) { if (strcmp(argv[i], "-cpu") == 0) { machineNum = atoi(argv[++i]); } if (strcmp(argv[i], "-help") == 0) { if (usr_help_str) { printf("%s", usr_help_str); } printf("%s", help_str); return EXIT_SUCCESS; } } manager = new TaskManager(machineNum); manager->init(); manager->set_TMend(defaultTMend); if (TMmain(argc, argv) < 0) { goto FINISH; } manager->run(); (manager->tm_end)(); FINISH: delete manager; return EXIT_SUCCESS; }