Mercurial > hg > Game > Cerium
view TaskManager/kernel/main.cc @ 596:f1c2e11a2ef4 draft
add xdr_getpos
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 04 Nov 2009 22:52:06 +0900 |
parents | ce86b0186a4a |
children | 5e5e8eb8da5a |
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(TaskManager* manager, int argc, char *argv[]); /* Default TMend function */ static void defaultTMend(TaskManager *manager) {} //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; } } TaskManager *manager = new TaskManager(machineNum); manager->init(); manager->set_TMend(defaultTMend); if (TMmain(manager, argc, argv) < 0) { goto FINISH; } manager->run(); (manager->tm_end)(manager); FINISH: delete manager; return EXIT_SUCCESS; }