diff options
author | pixel <pixel> | 2007-12-25 15:06:12 +0000 |
---|---|---|
committer | pixel <pixel> | 2007-12-25 15:06:12 +0000 |
commit | 54db14505bd22fcb452ced68a1243f97ac58d79e (patch) | |
tree | adab3be29d273ce3f098598c3b50a49ee53db8c9 /lib | |
parent | c677806f6f9fc4658a56c5b2807701cbf7223a41 (diff) |
Introducing some bits of task status.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LuaTask.cc | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/LuaTask.cc b/lib/LuaTask.cc index f7497be..754b136 100644 --- a/lib/LuaTask.cc +++ b/lib/LuaTask.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaTask.cc,v 1.18 2007-10-15 13:47:12 pixel Exp $ */ +/* $Id: LuaTask.cc,v 1.19 2007-12-25 15:06:12 pixel Exp $ */ #include <LuaTask.h> #include <LuaHandle.h> @@ -278,3 +278,42 @@ int LuaTask::Do() throw (GeneralException) { return TASK_ON_HOLD; } + +enum TaskMan_functions_t { + TASKMAN_NB_TASKS = 0, + TASKMAN_NB_ZOMBIES, +}; + +struct lua_functypes_t TaskMan_functions[] = { + { TASKMAN_NB_TASKS, "NB_Tasks", 0, 0, { } }, + { TASKMAN_NB_ZOMBIES, "NB_Zombies", 0, 0, { } }, + { -1, 0, 0, 0, 0 } +}; + +class sLua_TaskMan : public Base { + public: + DECLARE_FUNCTION(TaskMan, TASKMAN_NB_TASKS); + DECLARE_FUNCTION(TaskMan, TASKMAN_NB_ZOMBIES); + private: + static int TaskMan_proceed_statics(Lua * L, int n, int caller); +}; + +void LuaTaskMan::pushstatics(Lua * L) throw (GeneralException) { + CHECK_FUNCTIONS(TaskMan); + + PUSH_FUNCTION(TaskMan, TASKMAN_NB_TASKS); + PUSH_FUNCTION(TaskMan, TASKMAN_NB_ZOMBIES); +} + +int sLua_TaskMan::TaskMan_proceed_statics(Lua * L, int n, int caller) { + switch (caller) { + case TASKMAN_NB_TASKS: + return TaskMan::nb_tasks(); + break; + case TASKMAN_NB_ZOMBIES: + return TaskMan::nb_zombies(); + break; + } + + return 1; +} |